Skip to content

Add TrinoDialect - #2485

Open
rexminnis wants to merge 1 commit into
apache:mainfrom
rexminnis:trino-dialect
Open

Add TrinoDialect#2485
rexminnis wants to merge 1 commit into
apache:mainfrom
rexminnis:trino-dialect

Conversation

@rexminnis

Copy link
Copy Markdown

Adds a TrinoDialect for Trino, the distributed SQL engine that descends from Presto, and registers it as "trino" in dialect_from_str.

Trino follows the SQL standard closely, so almost everything it needs is an existing opt-in hook. The dialect turns on:

tests/sqlparser_trino.rs carries a corpus of 27 statements a Trino user writes daily (typed literals, UNNEST WITH ORDINALITY, TABLESAMPLE, LISTAGG ... WITHIN GROUP, JSON path functions, AT TIME ZONE, FETCH FIRST, SHOW/DESCRIBE, ...), including a negative test that backquoted identifiers are rejected.

Not covered here, on purpose, each a small follow-up:

  • the FOR prefix on TIMESTAMP AS OF / VERSION AS OF (a stacked PR follows this one)
  • ROW(name type, ...) types with named fields, which currently parse as a flat list on every dialect
  • inline WITH FUNCTION ... RETURN routines

Trino (the SQL engine that descends from Presto) follows the standard
closely, and most of what it needs is already an opt-in hook: double-quoted
identifiers only, FILTER on aggregates, GROUP BY expressions and grouping
sets, lambdas, MATCH_RECOGNIZE, table versioning, parenthesized EXPLAIN
options, named table-function arguments with =>, and COMMENT ON. The test
corpus covers the constructs a Trino user writes daily. Not covered yet:
the FOR prefix on TIMESTAMP/VERSION AS OF (time travel), ROW types with
named fields, and inline WITH FUNCTION routines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant