Skip to content

Commit 470d622

Browse files
committed
[SPARK-53112][PYTHON][TESTS][FOLLOW-UP] Remove some tests for Non-ANSI
### What changes were proposed in this pull request? remove some newly added tests which failed in non-ansi see https://github.com/apache/spark/actions/runs/18025276597/job/51291154866 ``` ====================================================================== FAIL [1.563s]: test_make_timestamp_ntz (pyspark.sql.tests.test_functions.FunctionsTests.test_make_timestamp_ntz) Comprehensive test cases for make_timestamp_ntz with various arguments and edge cases. ---------------------------------------------------------------------- Traceback (most recent call last): File "/__w/spark/spark/python/pyspark/sql/tests/test_functions.py", line 999, in test_make_timestamp_ntz with self.assertRaises(Exception): AssertionError: Exception not raised ---------------------------------------------------------------------- ``` ### Why are the changes needed? to make non-ansi schedule job happy ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? manually check ### Was this patch authored or co-authored using generative AI tooling? no Closes #52466 from zhengruifeng/remove_ansi_test. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
1 parent 984d578 commit 470d622

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

python/pyspark/sql/tests/test_functions.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -995,62 +995,6 @@ def test_make_timestamp_ntz(self):
995995
with self.assertRaises(Exception):
996996
F.make_timestamp_ntz(date=df_dt.date)
997997

998-
# Test 17: Invalid data types - should raise exception for invalid string to int cast
999-
with self.assertRaises(Exception):
1000-
self.spark.range(1).select(
1001-
F.make_timestamp_ntz(
1002-
F.lit("invalid"), F.lit(5), F.lit(22), F.lit(10), F.lit(30), F.lit(0)
1003-
)
1004-
).collect()
1005-
1006-
# Test 18: Out of range values (month=13) - should raise exception for invalid date
1007-
df_invalid = self.spark.createDataFrame(
1008-
[(2024, 13, 22, 10, 30, 0)], ["year", "month", "day", "hour", "minute", "second"]
1009-
)
1010-
with self.assertRaises(Exception):
1011-
df_invalid.select(
1012-
F.make_timestamp_ntz(
1013-
df_invalid.year,
1014-
df_invalid.month,
1015-
df_invalid.day,
1016-
df_invalid.hour,
1017-
df_invalid.minute,
1018-
df_invalid.second,
1019-
)
1020-
).collect()
1021-
1022-
# Test 19: Out of range values (hour=25) - should raise exception for invalid time
1023-
df_invalid_hour = self.spark.createDataFrame(
1024-
[(2024, 5, 22, 25, 30, 0)], ["year", "month", "day", "hour", "minute", "second"]
1025-
)
1026-
with self.assertRaises(Exception):
1027-
df_invalid_hour.select(
1028-
F.make_timestamp_ntz(
1029-
df_invalid_hour.year,
1030-
df_invalid_hour.month,
1031-
df_invalid_hour.day,
1032-
df_invalid_hour.hour,
1033-
df_invalid_hour.minute,
1034-
df_invalid_hour.second,
1035-
)
1036-
).collect()
1037-
1038-
# Test 20: February 29 in non-leap year
1039-
df_non_leap = self.spark.createDataFrame(
1040-
[(2023, 2, 29, 0, 0, 0)], ["year", "month", "day", "hour", "minute", "second"]
1041-
)
1042-
with self.assertRaises(Exception): # Should raise runtime exception for invalid date
1043-
df_non_leap.select(
1044-
F.make_timestamp_ntz(
1045-
df_non_leap.year,
1046-
df_non_leap.month,
1047-
df_non_leap.day,
1048-
df_non_leap.hour,
1049-
df_non_leap.minute,
1050-
df_non_leap.second,
1051-
)
1052-
).collect()
1053-
1054998
def test_make_date(self):
1055999
# SPARK-36554: expose make_date expression
10561000
df = self.spark.createDataFrame([(2020, 6, 26)], ["Y", "M", "D"])

0 commit comments

Comments
 (0)