diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-12 10:17:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-12 10:17:12 +0000 |
commit | e53bec16fb5ba08b2ff8daf3ffe5467a7c24b757 (patch) | |
tree | c13a841e8033707ca74d492bac3ebfc5bd9dd393 /tests/dialects/test_sqlite.py | |
parent | Adding upstream version 11.3.3. (diff) | |
download | sqlglot-9223f39e389c515847532b0faf15279cc861ed82.tar.xz sqlglot-9223f39e389c515847532b0faf15279cc861ed82.zip |
Adding upstream version 11.3.6.upstream/11.3.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_sqlite.py')
-rw-r--r-- | tests/dialects/test_sqlite.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/dialects/test_sqlite.py b/tests/dialects/test_sqlite.py index a3e4cc9..f889445 100644 --- a/tests/dialects/test_sqlite.py +++ b/tests/dialects/test_sqlite.py @@ -89,6 +89,20 @@ class TestSQLite(Validator): write={"snowflake": "LEAST(x, y, z)"}, ) + def test_datediff(self): + self.validate_all( + "DATEDIFF(a, b, 'day')", + write={"sqlite": "CAST((JULIANDAY(a) - JULIANDAY(b)) AS INTEGER)"}, + ) + self.validate_all( + "DATEDIFF(a, b, 'hour')", + write={"sqlite": "CAST((JULIANDAY(a) - JULIANDAY(b)) * 24.0 AS INTEGER)"}, + ) + self.validate_all( + "DATEDIFF(a, b, 'year')", + write={"sqlite": "CAST((JULIANDAY(a) - JULIANDAY(b)) / 365.0 AS INTEGER)"}, + ) + def test_hexadecimal_literal(self): self.validate_all( "SELECT 0XCC", |