summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/doris.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/doris.py')
-rw-r--r--sqlglot/dialects/doris.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/sqlglot/dialects/doris.py b/sqlglot/dialects/doris.py
index 11af17b..6e229b3 100644
--- a/sqlglot/dialects/doris.py
+++ b/sqlglot/dialects/doris.py
@@ -22,6 +22,7 @@ class Doris(MySQL):
"COLLECT_SET": exp.ArrayUniqueAgg.from_arg_list,
"DATE_TRUNC": parse_timestamp_trunc,
"REGEXP": exp.RegexpLike.from_arg_list,
+ "TO_DATE": exp.TsOrDsToDate.from_arg_list,
}
class Generator(MySQL.Generator):
@@ -34,21 +35,26 @@ class Doris(MySQL):
exp.DataType.Type.TIMESTAMPTZ: "DATETIME",
}
+ LAST_DAY_SUPPORTS_DATE_PART = False
+
TIMESTAMP_FUNC_TYPES = set()
TRANSFORMS = {
**MySQL.Generator.TRANSFORMS,
exp.ApproxDistinct: approx_count_distinct_sql,
+ exp.ArgMax: rename_func("MAX_BY"),
+ exp.ArgMin: rename_func("MIN_BY"),
exp.ArrayAgg: rename_func("COLLECT_LIST"),
+ exp.ArrayUniqueAgg: rename_func("COLLECT_SET"),
exp.CurrentTimestamp: lambda *_: "NOW()",
exp.DateTrunc: lambda self, e: self.func(
"DATE_TRUNC", e.this, "'" + e.text("unit") + "'"
),
exp.JSONExtractScalar: arrow_json_extract_sql,
exp.JSONExtract: arrow_json_extract_sql,
+ exp.Map: rename_func("ARRAY_MAP"),
exp.RegexpLike: rename_func("REGEXP"),
exp.RegexpSplit: rename_func("SPLIT_BY_STRING"),
- exp.ArrayUniqueAgg: rename_func("COLLECT_SET"),
exp.StrToUnix: lambda self, e: f"UNIX_TIMESTAMP({self.sql(e, 'this')}, {self.format_time(e)})",
exp.Split: rename_func("SPLIT_BY_STRING"),
exp.TimeStrToDate: rename_func("TO_DATE"),
@@ -63,5 +69,4 @@ class Doris(MySQL):
"FROM_UNIXTIME", e.this, time_format("doris")(self, e)
),
exp.UnixToTime: rename_func("FROM_UNIXTIME"),
- exp.Map: rename_func("ARRAY_MAP"),
}