Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_cast_timestamp_to_date when running in a DST time zone #10171

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion integration_tests/src/main/python/cast_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pytest

from asserts import *
from conftest import is_not_utc
from conftest import is_not_utc, is_supported_time_zone
from data_gen import *
from spark_session import *
from marks import allow_non_gpu, approximate_float, datagen_overrides, tz_sensitive_test
Expand Down Expand Up @@ -540,6 +540,8 @@ def test_cast_timestamp_to_string():
lambda spark: unary_op_df(spark, timestamp_gen)
.selectExpr("cast(a as string)"))

@tz_sensitive_test
@allow_non_gpu(*non_supported_tz_allow)
def test_cast_timestamp_to_date():
assert_gpu_and_cpu_are_equal_collect(
lambda spark: unary_op_df(spark, timestamp_gen)
Expand Down
7 changes: 6 additions & 1 deletion integration_tests/src/main/python/data_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from spark_session import is_before_spark_340, with_cpu_session
import sre_yield
import struct
from conftest import skip_unless_precommit_tests, get_datagen_seed, is_not_utc
from conftest import skip_unless_precommit_tests, get_datagen_seed, is_not_utc, is_supported_time_zone
import time
import os
from functools import lru_cache
Expand Down Expand Up @@ -1212,6 +1212,11 @@ def get_25_partitions_df(spark):
'DeserializeToObjectExec', 'DataWritingCommandExec', 'WriteFilesExec', 'ShuffleExchangeExec',
'ExecutedCommandExec'] if is_not_utc() else []

non_supported_tz_allow = ['ProjectExec', 'FilterExec', 'FileSourceScanExec', 'BatchScanExec', 'CollectLimitExec',
'DeserializeToObjectExec', 'DataWritingCommandExec', 'WriteFilesExec', 'ShuffleExchangeExec',
'ExecutedCommandExec'] if not is_supported_time_zone() else []


# date related regexps for generating date strings within python's range limits

# regexp to generate date from 0001-02-01, format is yyyy-MM-dd
Expand Down