final class JsonTable
    implements Relation
    uses Snapshot
Public API: explicitly declared with @visibility public.

The table function JSON_TABLE(document, path COLUMNS (...)) [AS] alias.

Rule: MYSQL-JSON-TABLE-001. The document expression sees the enclosing queries and the tables to its left in the same FROM clause (MYSQL-FROM-SCOPE-001). The columns are the slots the column definitions contribute, nested paths flattened in order. A table function without alias is reported. Source: https://dev.mysql.com/doc/refman/8.4/en/json-table-functions.html. Status: Implemented.

Reading the alias of a JSON tabledoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM JSON_TABLE('[1]', '$[*]' COLUMNS (a INT PATH '$')) AS j");
    $query->statement->from->alias?->value // => 'j'

Properties§

public non-empty-list<JsonTableColumn> $columns
public Scalar $document
public Name|null $alias = null
public AliasMark $mark = AliasMark::As

Methods§

public function __construct(
    public Scalar $document,
    public StringLiteral $path,
    list<JsonTableColumn> $columns,
    public Name|null $alias = null,
    public AliasMark $mark = AliasMark::As,
)

Parameters

$documentScalarThe JSON document
$pathStringLiteralThe path of the rows
$columnslist<JsonTableColumn>The column definitions; at least one
$aliasName|nullThe correlation name
$markAliasMarkWhat is written before the alias
Calls 4
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Derives the document, the path and the columns.

Parameters

$derivationDerivation
$environmentEnvironment
Calls 7
public function render(Output $out): void

Writes the table function.

Parameters

$outOutput
Calls 4

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type checks 4
Type declarations 1