1
0
Fork 0
sqlglot/sqlglot/dialects/trino.py
Daniel Baumann 37a231f554
Merging upstream version 20.9.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-13 21:19:14 +01:00

19 lines
581 B
Python

from __future__ import annotations
from sqlglot import exp
from sqlglot.dialects.dialect import merge_without_target_sql
from sqlglot.dialects.presto import Presto
class Trino(Presto):
SUPPORTS_USER_DEFINED_TYPES = False
class Generator(Presto.Generator):
TRANSFORMS = {
**Presto.Generator.TRANSFORMS,
exp.ArraySum: lambda self, e: f"REDUCE({self.sql(e, 'this')}, 0, (acc, x) -> acc + x, acc -> acc)",
exp.Merge: merge_without_target_sql,
}
class Tokenizer(Presto.Tokenizer):
HEX_STRINGS = [("X'", "'")]