diff options
Diffstat (limited to 'sqlglot/dialects/trino.py')
-rw-r--r-- | sqlglot/dialects/trino.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sqlglot/dialects/trino.py b/sqlglot/dialects/trino.py index 457e2f0..4b5f8e0 100644 --- a/sqlglot/dialects/trino.py +++ b/sqlglot/dialects/trino.py @@ -1,7 +1,7 @@ from __future__ import annotations from sqlglot import exp -from sqlglot.dialects.dialect import merge_without_target_sql +from sqlglot.dialects.dialect import merge_without_target_sql, trim_sql from sqlglot.dialects.presto import Presto @@ -9,12 +9,19 @@ class Trino(Presto): SUPPORTS_USER_DEFINED_TYPES = False LOG_BASE_FIRST = True + class Parser(Presto.Parser): + FUNCTION_PARSERS = { + **Presto.Parser.FUNCTION_PARSERS, + "TRIM": lambda self: self._parse_trim(), + } + 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, + exp.Trim: trim_sql, } SUPPORTED_JSON_PATH_PARTS = { |