1
0
Fork 0

Merging upstream version 26.1.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:59:50 +01:00
parent 829d661a08
commit c8d4d2df63
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
119 changed files with 71635 additions and 68059 deletions

View file

@ -753,6 +753,16 @@ class TestTSQL(Validator):
},
)
self.validate_all(
"CREATE TABLE t (col1 DATETIME2(2))",
read={
"snowflake": "CREATE TABLE t (col1 TIMESTAMP_NTZ(2))",
},
write={
"tsql": "CREATE TABLE t (col1 DATETIME2(2))",
},
)
def test_types_bin(self):
self.validate_all(
"CAST(x as BIT)",
@ -1220,7 +1230,10 @@ WHERE
def test_datefromparts(self):
self.validate_all(
"SELECT DATEFROMPARTS('2020', 10, 01)",
write={"spark": "SELECT MAKE_DATE('2020', 10, 01)"},
write={
"spark": "SELECT MAKE_DATE('2020', 10, 01)",
"tsql": "SELECT DATEFROMPARTS('2020', 10, 01)",
},
)
def test_datename(self):
@ -2090,3 +2103,27 @@ FROM OPENJSON(@json) WITH (
"oracle": "SELECT NEXT VALUE FOR db.schema.sequence_name",
},
)
# string literals in the DATETRUNC are casted as DATETIME2
def test_datetrunc(self):
self.validate_all(
"SELECT DATETRUNC(month, 'foo')",
write={
"duckdb": "SELECT DATE_TRUNC('MONTH', CAST('foo' AS TIMESTAMP))",
"tsql": "SELECT DATETRUNC(MONTH, CAST('foo' AS DATETIME2))",
},
)
self.validate_all(
"SELECT DATETRUNC(month, foo)",
write={
"duckdb": "SELECT DATE_TRUNC('MONTH', foo)",
"tsql": "SELECT DATETRUNC(MONTH, foo)",
},
)
self.validate_all(
"SELECT DATETRUNC(year, CAST('foo1' AS date))",
write={
"duckdb": "SELECT DATE_TRUNC('YEAR', CAST('foo1' AS DATE))",
"tsql": "SELECT DATETRUNC(YEAR, CAST('foo1' AS DATE))",
},
)