diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-03 07:37:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-03 07:37:50 +0000 |
commit | 8b1fb8d8676e832d02b99bb8e69f6897dd10c0f6 (patch) | |
tree | d31426ac93b330e755f0b500704e236b9a62dc15 /tests/dialects/test_dialect.py | |
parent | Releasing debian version 25.16.1-1. (diff) | |
download | sqlglot-8b1fb8d8676e832d02b99bb8e69f6897dd10c0f6.tar.xz sqlglot-8b1fb8d8676e832d02b99bb8e69f6897dd10c0f6.zip |
Merging upstream version 25.18.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_dialect.py')
-rw-r--r-- | tests/dialects/test_dialect.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py index 8f3c183..190d044 100644 --- a/tests/dialects/test_dialect.py +++ b/tests/dialects/test_dialect.py @@ -656,13 +656,29 @@ class TestDialect(Validator): }, ) self.validate_all( + "TIME_STR_TO_TIME('2020-01-01 12:13:14.123456+00:00')", + write={ + "mysql": "CAST('2020-01-01 12:13:14.123456+00:00' AS DATETIME(6))", + "trino": "CAST('2020-01-01 12:13:14.123456+00:00' AS TIMESTAMP(6))", + "presto": "CAST('2020-01-01 12:13:14.123456+00:00' AS TIMESTAMP)", + }, + ) + self.validate_all( + "TIME_STR_TO_TIME('2020-01-01 12:13:14.123-08:00', 'America/Los_Angeles')", + write={ + "mysql": "TIMESTAMP('2020-01-01 12:13:14.123-08:00')", + "trino": "CAST('2020-01-01 12:13:14.123-08:00' AS TIMESTAMP(3) WITH TIME ZONE)", + "presto": "CAST('2020-01-01 12:13:14.123-08:00' AS TIMESTAMP WITH TIME ZONE)", + }, + ) + self.validate_all( "TIME_STR_TO_TIME('2020-01-01 12:13:14-08:00', 'America/Los_Angeles')", write={ "bigquery": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMP)", "databricks": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMP)", "duckdb": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMPTZ)", "tsql": "CAST('2020-01-01 12:13:14-08:00' AS DATETIMEOFFSET) AT TIME ZONE 'UTC'", - "mysql": "CAST('2020-01-01 12:13:14-08:00' AS DATETIME)", + "mysql": "TIMESTAMP('2020-01-01 12:13:14-08:00')", "postgres": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMPTZ)", "redshift": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMP WITH TIME ZONE)", "snowflake": "CAST('2020-01-01 12:13:14-08:00' AS TIMESTAMPTZ)", @@ -683,7 +699,7 @@ class TestDialect(Validator): "databricks": "CAST(col AS TIMESTAMP)", "duckdb": "CAST(col AS TIMESTAMPTZ)", "tsql": "CAST(col AS DATETIMEOFFSET) AT TIME ZONE 'UTC'", - "mysql": "CAST(col AS DATETIME)", + "mysql": "TIMESTAMP(col)", "postgres": "CAST(col AS TIMESTAMPTZ)", "redshift": "CAST(col AS TIMESTAMP WITH TIME ZONE)", "snowflake": "CAST(col AS TIMESTAMPTZ)", @@ -723,6 +739,13 @@ class TestDialect(Validator): }, ) self.validate_all( + "TIME_TO_STR(a, '%Y-%m-%d %H:%M:%S.%f')", + write={ + "redshift": "TO_CHAR(a, 'YYYY-MM-DD HH24:MI:SS.US')", + "tsql": "FORMAT(a, 'yyyy-MM-dd HH:mm:ss.ffffff')", + }, + ) + self.validate_all( "TIME_TO_TIME_STR(x)", write={ "drill": "CAST(x AS VARCHAR)", |