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_spark_from_json_date_with_format when run in a non-UTC TZ #10562

Merged
merged 2 commits into from
Mar 9, 2024
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
3 changes: 2 additions & 1 deletion integration_tests/src/main/python/conftest.py
jlowe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -355,6 +355,7 @@ def pytest_collection_modifyitems(config, items):
if len(qualifier) != 0:
qualifier = "_" + qualifier # prefix separator for formatting purposes
extras.append('DATAGEN_SEED%s=%s' % (qualifier, str(test_datagen_random_seed_choice)))
extras.append('TZ=%s' % get_test_tz())

if injection_mode == 'random':
inject_choice = r.randrange(0, 2) == 1
Expand Down
8 changes: 5 additions & 3 deletions integration_tests/src/main/python/json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ def test_from_json_struct_date_fallback_non_default_format(date_gen, date_format
pytest.param("[0-9]{1,5}", marks=pytest.mark.xfail(reason="https://github.com/NVIDIA/spark-rapids/issues/9588")),
pytest.param("[1-9]{1,8}", marks=pytest.mark.xfail(reason="https://github.com/NVIDIA/spark-rapids/issues/4940")),
# floating-point
"[0-9]{0,2}\.[0-9]{1,2}"
r"[0-9]{0,2}\.[0-9]{1,2}"
# boolean
"(true|false)"
])
Expand Down Expand Up @@ -1328,9 +1328,11 @@ def test_spark_from_json_date_with_locale(data, locale):
'ProjectExec',
conf = { 'spark.rapids.sql.expression.JsonToStructs': True })

@pytest.mark.skipif(is_before_spark_320(), reason="only dd/MM/yyyy is supported prior to 3.2.0")
@allow_non_gpu(*non_utc_allow)
@pytest.mark.skipif(is_before_spark_320(), reason="dd/MM/yyyy is supported in 3.2.0 and after")
def test_spark_from_json_date_with_format():
data = [["""{"time": "26/08/2015"}"""]]
data = [["""{"time": "26/08/2015"}"""],
["""{"time": "01/01/2024"}"""]]
schema = StructType([StructField("d", DateType())])
assert_gpu_and_cpu_are_equal_collect(
lambda spark : spark.createDataFrame(data, 'json STRING').select(f.col('json'), f.from_json(f.col('json'), schema, {'dateFormat': 'dd/MM/yyyy'})),
Expand Down
Loading