summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_doris.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 07:22:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 07:22:20 +0000
commit41e67f6ce6b4b732d02e421d6825c18b8d15a59d (patch)
tree30fb0000d3e6ff11b366567bc35564842e7dbb50 /tests/dialects/test_doris.py
parentAdding upstream version 23.16.0. (diff)
downloadsqlglot-41e67f6ce6b4b732d02e421d6825c18b8d15a59d.tar.xz
sqlglot-41e67f6ce6b4b732d02e421d6825c18b8d15a59d.zip
Adding upstream version 24.0.0.upstream/24.0.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.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/dialects/test_doris.py b/tests/dialects/test_doris.py
index 035289b..f7fce02 100644
--- a/tests/dialects/test_doris.py
+++ b/tests/dialects/test_doris.py
@@ -14,7 +14,9 @@ class TestDoris(Validator):
)
self.validate_all(
"SELECT MAX_BY(a, b), MIN_BY(c, d)",
- read={"clickhouse": "SELECT argMax(a, b), argMin(c, d)"},
+ read={
+ "clickhouse": "SELECT argMax(a, b), argMin(c, d)",
+ },
)
self.validate_all(
"SELECT ARRAY_SUM(x -> x * x, ARRAY(2, 3))",
@@ -36,6 +38,16 @@ class TestDoris(Validator):
"oracle": "ADD_MONTHS(d, n)",
},
)
+ self.validate_all(
+ """SELECT JSON_EXTRACT(CAST('{"key": 1}' AS JSONB), '$.key')""",
+ read={
+ "postgres": """SELECT '{"key": 1}'::jsonb ->> 'key'""",
+ },
+ write={
+ "doris": """SELECT JSON_EXTRACT(CAST('{"key": 1}' AS JSONB), '$.key')""",
+ "postgres": """SELECT JSON_EXTRACT_PATH(CAST('{"key": 1}' AS JSONB), 'key')""",
+ },
+ )
def test_identity(self):
self.validate_identity("COALECSE(a, b, c, d)")