classJsonArrayAggregate
final class JsonArrayAggregate
implements Scalar, OutputNaming
uses Snapshot
Public API: explicitly declared with
@visibility public.JSON_ARRAYAGG (value [ORDER BY ...] [NULL | ABSENT ON NULL] [RETURNING type]) with FILTER and OVER.
Mirrors PostgreSQL's JsonArrayAgg with its JsonAggConstructor. Rule: PG-JSON-ARRAYAGG-001. Facts: the value, the ordering, the filter and the window are derived at the position; the RETURNING type, otherwise json; NULL over no row. The result column is named json_arrayagg. Source: https://www.postgresql.org/docs/17/functions-aggregate.html. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonArrayAggregate(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral())))->outputName()->value // => 'json_arrayagg'Properties§
public list<SortItem> $orderpublic JsonValueExpression $valuepublic JsonNullHandling|null $nulls = nullpublic JsonReturning|null $returning = nullpublic Scalar|null $filter = nullpublic WindowSpecification|Name|null $over = nullMethods§
public function __construct(
public JsonValueExpression $value,
list<SortItem> $order = [],
public JsonNullHandling|null $nulls = null,
public JsonReturning|null $returning = null,
public Scalar|null $filter = null,
public WindowSpecification|Name|null $over = null,
)Parameters
$value | JsonValueExpression | The value aggregated |
$order | list<SortItem> | The ordering of the elements |
$nulls | JsonNullHandling|null | The NULL clause written |
$returning | JsonReturning|null | The RETURNING clause |
$filter | Scalar|null | The FILTER predicate |
$over | WindowSpecification|Name|null | The window after OVER |
Calls 2
- static-call Check::listOf() line 64
- class-const SortItem::class() line 64
public function outputName(): NameNames an unaliased result column.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the value, the ordering, the clauses, the filter and the window.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call JsonValueExpression::deriveValue() line 80
- method-call Derivation::scalar() line 86
- new ScalarFact line 92
- new Known line 92
- class-const Builtin::Json() line 92
- class-const Nullability::Nullable() line 92
public function render(Output $out): voidWrites JSON_ARRAYAGG with its clauses, the filter and the window.
Parameters
$out | Output |
Test cases 1
Calls 3
- method-call Output::keyword() line 100
- method-call Output::node() line 107
- class-const NameUse::Column() line 112
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.