summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/trino.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 16:13:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 16:13:01 +0000
commita7044b672667f2a0b48bd0b326b5a55b0815ef79 (patch)
tree4fb5238d47fb4709d47f766a74b8bbaa9c6f17d8 /sqlglot/dialects/trino.py
parentReleasing debian version 23.12.1-1. (diff)
downloadsqlglot-a7044b672667f2a0b48bd0b326b5a55b0815ef79.tar.xz
sqlglot-a7044b672667f2a0b48bd0b326b5a55b0815ef79.zip
Merging upstream version 23.13.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/trino.py')
-rw-r--r--sqlglot/dialects/trino.py9
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 = {