diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:46 +0000 |
commit | 5dde903f4f6659e384287a3e508b9f369c5a2ba3 (patch) | |
tree | 05cd2920d82f0023f6ac695dbb6eaeef64608401 /tests/dialects/test_duckdb.py | |
parent | Adding upstream version 17.9.1. (diff) | |
download | sqlglot-5dde903f4f6659e384287a3e508b9f369c5a2ba3.tar.xz sqlglot-5dde903f4f6659e384287a3e508b9f369c5a2ba3.zip |
Adding upstream version 17.11.0.upstream/17.11.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_duckdb.py')
-rw-r--r-- | tests/dialects/test_duckdb.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py index 5284700..5c35d8f 100644 --- a/tests/dialects/test_duckdb.py +++ b/tests/dialects/test_duckdb.py @@ -583,6 +583,38 @@ class TestDuckDB(Validator): write={"duckdb": "SELECT a, BOOL_OR(b) FROM table GROUP BY a"}, ) + def test_encode_decode(self): + self.validate_all( + "ENCODE(x)", + read={ + "spark": "ENCODE(x, 'utf-8')", + "presto": "TO_UTF8(x)", + }, + write={ + "duckdb": "ENCODE(x)", + "spark": "ENCODE(x, 'utf-8')", + "presto": "TO_UTF8(x)", + }, + ) + self.validate_all( + "DECODE(x)", + read={ + "spark": "DECODE(x, 'utf-8')", + "presto": "FROM_UTF8(x)", + }, + write={ + "duckdb": "DECODE(x)", + "spark": "DECODE(x, 'utf-8')", + "presto": "FROM_UTF8(x)", + }, + ) + self.validate_all( + "DECODE(x)", + read={ + "presto": "FROM_UTF8(x, y)", + }, + ) + def test_rename_table(self): self.validate_all( "ALTER TABLE db.t1 RENAME TO db.t2", |