You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2023/03/30 08:38:00 UTC

[impala] 01/02: IMPALA-12028: test_execute_rollback might fail due to used timezone

This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 409ea25a299b8d760659c4e091e19857d7c66909
Author: Gabor Kaszab <ga...@cloudera.com>
AuthorDate: Tue Mar 28 12:41:06 2023 +0200

    IMPALA-12028: test_execute_rollback might fail due to used timezone
    
    There are some steps in the test that set the timezone and execute
    rollback to given time. However, the snapshot creation, and querying
    the current time uses local timezone. As a reuslt if the test is run
    e.g. in CET timezone it fails when expecting an error in the Icelandic
    timezone.
    
    Tests:
      - Re-ran TestIcebergTable.test_execute_rollback.
    
    Change-Id: Iba9724f9b86cc508e6497eb33844a6480498b6e4
    Reviewed-on: http://gerrit.cloudera.org:8080/19655
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 tests/query_test/test_iceberg.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/query_test/test_iceberg.py b/tests/query_test/test_iceberg.py
index 5895a78f8..328c03247 100644
--- a/tests/query_test/test_iceberg.py
+++ b/tests/query_test/test_iceberg.py
@@ -21,6 +21,7 @@ import datetime
 import logging
 import os
 import pytest
+import pytz
 import random
 
 import re
@@ -292,6 +293,8 @@ class TestIcebergTable(IcebergTestSuite):
       # We are setting the TIMEZONE query option in this test, so let's create a local
       # impala client.
       with self.create_impala_client() as impalad_client:
+        orig_timezone = 'America/Los_Angeles'
+        impalad_client.execute("SET TIMEZONE='" + orig_timezone + "'")
         impalad_client.execute("""
           create table {0} (i int) stored as iceberg
           TBLPROPERTIES ({1})""".format(tbl_name, catalog_properties))
@@ -321,7 +324,7 @@ class TestIcebergTable(IcebergTestSuite):
                           "state")
 
         # Create another snapshot.
-        before_insert = datetime.datetime.now()
+        before_insert = datetime.datetime.now(pytz.timezone(orig_timezone))
         impalad_client.execute("INSERT INTO {0} VALUES ({1})".format(tbl_name, 4))
         snapshots = get_snapshots(impalad_client, tbl_name, expected_result_size=5)