Skip to content
Merged
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
84 changes: 41 additions & 43 deletions datafusion/sqllogictest/test_files/current_date_timezone.slt
Original file line number Diff line number Diff line change
Expand Up @@ -19,64 +19,62 @@
## current_date with timezone tests
##########

# CI Fails https://github.com/apache/datafusion/issues/18062

# Test 1: Verify current_date is consistent within the same query (default UTC)
# query B
# SELECT current_date() = current_date();
# ----
# true
query B
SELECT current_date() = current_date();
----
true

# Test 2: Verify alias 'today' works the same as current_date
# query B
# SELECT current_date() = today();
# ----
# true
query B
SELECT current_date() = today();
----
true

# Test 3: Set timezone to +05:00 and verify current_date is still stable
# statement ok
# SET datafusion.execution.time_zone = '+05:00';
statement ok
SET datafusion.execution.time_zone = '+05:00';

# query B
# SELECT current_date() = current_date();
# ----
# true
query B
SELECT current_date() = current_date();
----
true

# Test 4: Verify current_date matches cast(now() as date) in the same timezone
# query B
# SELECT current_date() = cast(now() as date);
# ----
# true
#Test 4: Verify current_date matches cast(now() as date) in the same timezone
query B
SELECT current_date() = cast(now() as date);
----
true
Comment on lines +45 to +47
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the failed test. See #18062 (comment)

This checks current_date must equal now::date after setting timezone = +05:00.

I verified CI passed around 2025-10-23 20:30PM UTC, which was 2025-10-24 01:30AM UTC+5.

(It had failed around 2025-10-14 20:03PM UTC = 2025-10-15 01:03AM UTC+5)


# Test 5: Test with negative offset timezone
# statement ok
# SET datafusion.execution.time_zone = '-08:00';
statement ok
SET datafusion.execution.time_zone = '-08:00';

# query B
# SELECT current_date() = today();
# ----
# true
query B
SELECT current_date() = today();
----
true

# Test 6: Test with named timezone (America/New_York)
# statement ok
# SET datafusion.execution.time_zone = 'America/New_York';
statement ok
SET datafusion.execution.time_zone = 'America/New_York';

# query B
# SELECT current_date() = current_date();
# ----
# true
query B
SELECT current_date() = current_date();
----
true

# Test 7: Verify date type is preserved
# query T
# SELECT arrow_typeof(current_date());
# ----
# Date32
query T
SELECT arrow_typeof(current_date());
----
Date32

# Test 8: Reset to UTC
# statement ok
# SET datafusion.execution.time_zone = '+00:00';
statement ok
SET datafusion.execution.time_zone = '+00:00';

# query B
# SELECT current_date() = today();
# ----
# true
query B
SELECT current_date() = today();
----
true