Merging upstream version 26.16.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
f03ef3fd88
commit
1e2a8571aa
110 changed files with 62370 additions and 61414 deletions
|
@ -739,6 +739,12 @@ class TestClickhouse(Validator):
|
|||
with self.subTest(f"Casting to ClickHouse {data_type}"):
|
||||
self.validate_identity(f"SELECT CAST(val AS {data_type})")
|
||||
|
||||
def test_nothing_type(self):
|
||||
data_types = ["Nothing", "Nullable(Nothing)"]
|
||||
for data_type in data_types:
|
||||
with self.subTest(f"Casting to ClickHouse {data_type}"):
|
||||
self.validate_identity(f"SELECT CAST(val AS {data_type})")
|
||||
|
||||
def test_aggregate_function_column_with_any_keyword(self):
|
||||
# Regression test for https://github.com/tobymao/sqlglot/issues/4723
|
||||
self.validate_all(
|
||||
|
@ -766,6 +772,17 @@ ORDER BY (
|
|||
pretty=True,
|
||||
)
|
||||
|
||||
def test_create_table_as_alias(self):
|
||||
ctas_alias = "CREATE TABLE my_db.my_table AS another_db.another_table"
|
||||
|
||||
expected = exp.Create(
|
||||
this=exp.to_table("my_db.my_table"),
|
||||
kind="TABLE",
|
||||
expression=exp.to_table("another_db.another_table"),
|
||||
)
|
||||
self.assertEqual(self.parse_one(ctas_alias), expected)
|
||||
self.validate_identity(ctas_alias)
|
||||
|
||||
def test_ddl(self):
|
||||
db_table_expr = exp.Table(this=None, db=exp.to_identifier("foo"), catalog=None)
|
||||
create_with_cluster = exp.Create(
|
||||
|
@ -1220,6 +1237,15 @@ LIFETIME(MIN 0 MAX 0)""",
|
|||
f"SELECT {func_alias}(SECOND, 1, bar)",
|
||||
f"SELECT {func_name}(SECOND, 1, bar)",
|
||||
)
|
||||
# 4-arg functions of type <func>(unit, value, date, timezone)
|
||||
for func in (("DATE_DIFF", "DATEDIFF"),):
|
||||
func_name = func[0]
|
||||
for func_alias in func:
|
||||
with self.subTest(f"Test 4-arg date-time function {func_alias}"):
|
||||
self.validate_identity(
|
||||
f"SELECT {func_alias}(SECOND, 1, bar, 'UTC')",
|
||||
f"SELECT {func_name}(SECOND, 1, bar, 'UTC')",
|
||||
)
|
||||
|
||||
def test_convert(self):
|
||||
self.assertEqual(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue