Skip to content

Commit 60b3c12

Browse files
committed
Add tests for timezone_for_iceberg_timestamptz setting
1 parent 58eb474 commit 60b3c12

File tree

1 file changed

+31
-0
lines changed
  • tests/integration/test_database_iceberg

1 file changed

+31
-0
lines changed

tests/integration/test_database_iceberg/test.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,37 @@ def test_timestamps(started_cluster):
535535
assert node.query(f"SHOW CREATE TABLE {CATALOG_NAME}.`{root_namespace}.{table_name}`") == f"CREATE TABLE {CATALOG_NAME}.`{root_namespace}.{table_name}`\\n(\\n `timestamp` Nullable(DateTime64(6)),\\n `timestamptz` Nullable(DateTime64(6, \\'UTC\\'))\\n)\\nENGINE = Iceberg(\\'http://minio:9000/warehouse-rest/data/\\', \\'minio\\', \\'[HIDDEN]\\')\n"
536536
assert node.query(f"SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`") == "2024-01-01 12:00:00.000000\t2024-01-01 12:00:00.000000\n"
537537

538+
# Berlin - UTC+1 at winter
539+
# Istanbul - UTC+3 at winter
540+
assert node.query(f"""
541+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
542+
SETTINGS timezone_for_iceberg_timestamptz='UTC'
543+
""") == "2024-01-01 12:00:00.000000\t2024-01-01 12:00:00.000000\n"
544+
assert node.query(f"""
545+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
546+
SETTINGS timezone_for_iceberg_timestamptz='Europe/Berlin'
547+
""") == "2024-01-01 12:00:00.000000\t2024-01-01 13:00:00.000000\n"
548+
assert node.query(f"""
549+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
550+
SETTINGS timezone_for_iceberg_timestamptz=''
551+
""") == "2024-01-01 12:00:00.000000\t2024-01-01 12:00:00.000000\n"
552+
assert node.query(f"""
553+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
554+
SETTINGS session_timezone='Asia/Istanbul'
555+
""") == "2024-01-01 15:00:00.000000\t2024-01-01 12:00:00.000000\n"
556+
assert node.query(f"""
557+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
558+
SETTINGS session_timezone='Asia/Istanbul', timezone_for_iceberg_timestamptz='Europe/Berlin'
559+
""") == "2024-01-01 15:00:00.000000\t2024-01-01 13:00:00.000000\n"
560+
assert node.query(f"""
561+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
562+
SETTINGS session_timezone='Asia/Istanbul', timezone_for_iceberg_timestamptz=''
563+
""") == "2024-01-01 15:00:00.000000\t2024-01-01 15:00:00.000000\n"
564+
assert "Invalid time zone: Foo/Bar" in node.query_and_get_error(f"""
565+
SELECT * FROM {CATALOG_NAME}.`{root_namespace}.{table_name}`
566+
SETTINGS timezone_for_iceberg_timestamptz='Foo/Bar'
567+
""")
568+
538569

539570
def test_insert(started_cluster):
540571
node = started_cluster.instances["node1"]

0 commit comments

Comments
 (0)