summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_doris.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
commit258c7df9cab21a4978c100568907ac1cb7fd6ee0 (patch)
treea98c4c9fc7433833be72543de5d99d15b9927442 /tests/dialects/test_doris.py
parentAdding upstream version 20.4.0. (diff)
downloadsqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.tar.xz
sqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.zip
Adding upstream version 20.9.0.upstream/20.9.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_doris.py')
-rw-r--r--tests/dialects/test_doris.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/dialects/test_doris.py b/tests/dialects/test_doris.py
index 9591269..5ae23ad 100644
--- a/tests/dialects/test_doris.py
+++ b/tests/dialects/test_doris.py
@@ -4,6 +4,29 @@ from tests.dialects.test_dialect import Validator
class TestDoris(Validator):
dialect = "doris"
+ def test_doris(self):
+ self.validate_all(
+ "SELECT TO_DATE('2020-02-02 00:00:00')",
+ write={
+ "doris": "SELECT TO_DATE('2020-02-02 00:00:00')",
+ "oracle": "SELECT CAST('2020-02-02 00:00:00' AS DATE)",
+ },
+ )
+ self.validate_all(
+ "SELECT MAX_BY(a, b), MIN_BY(c, d)",
+ read={"clickhouse": "SELECT argMax(a, b), argMin(c, d)"},
+ )
+ self.validate_all(
+ "SELECT ARRAY_SUM(x -> x * x, ARRAY(2, 3))",
+ read={
+ "clickhouse": "SELECT arraySum(x -> x*x, [2, 3])",
+ },
+ write={
+ "clickhouse": "SELECT arraySum(x -> x * x, [2, 3])",
+ "doris": "SELECT ARRAY_SUM(x -> x * x, ARRAY(2, 3))",
+ },
+ )
+
def test_identity(self):
self.validate_identity("COALECSE(a, b, c, d)")
self.validate_identity("SELECT CAST(`a`.`b` AS INT) FROM foo")