summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_duckdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_duckdb.py')
-rw-r--r--tests/dialects/test_duckdb.py32
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",