Skip to content

fix(integ): align DateTimeComparisonIT today's date to UTC#5543

Merged
ahkcs merged 1 commit into
opensearch-project:mainfrom
ahkcs:fix/datetime-comparison-utc-zone
Jun 11, 2026
Merged

fix(integ): align DateTimeComparisonIT today's date to UTC#5543
ahkcs merged 1 commit into
opensearch-project:mainfrom
ahkcs:fix/datetime-comparison-utc-zone

Conversation

@ahkcs

@ahkcs ahkcs commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • DateTimeComparisonIT builds its TIME/DATE/TIMESTAMP comparison parameters with LocalDate.now().toString() (JVM-local zone).
  • The analytics-engine route lowers CURRENT_DATE through DataFusion using UTC.
  • When a run starts after 17:00 PDT (= 00:00 UTC of the next day) — or any equivalent zone offset where the local date is one day behind UTC — the JVM date and the engine date disagree by one day. TIME-to-{DATE,TIMESTAMP} coercion then produces tomorrow's timestamp and 24 parameterized cases fail with expected=true got=false (and the inverse).
  • Switch to LocalDate.now(ZoneOffset.UTC) so the test parameters use the same date the engine uses, regardless of when or where the run starts. Pure test fix; no production code touched.

Before / After

CalciteDateTimeComparisonIT against the analytics-engine route, run started at 18:43 PDT on 2026-06-10 (UTC date already 2026-06-11):

tests failures errors TIME-vs-{DATE,TIMESTAMP} cases pass
before 191 24 0 72/96
after 191 0 0 96/96

The 24 failures previously fell into two report buckets keyed on the assertion message (one for true-expected, one for false-expected), each with 12 instances — e.g. TIME('00:00:00') = DATE('2026-06-10') => true and TIME('00:00:00') != DATE('2026-06-10') => false. Both buckets evaporate with this change.

Test plan

  • Run ./gradlew :integ-test:integTestRemote --tests 'org.opensearch.sql.calcite.remote.CalciteDateTimeComparisonIT' against an analytics-engine cluster — 191/0/0.
  • Verified grep 'LocalDate.now()' DateTimeComparisonIT.java returns no matches after the change (all 14 use sites updated).

The TIME/DATE/TIMESTAMP comparison test parameters compute `today` via
`LocalDate.now().toString()` (JVM-local zone), but the analytics-engine
route lowers `CURRENT_DATE` through DataFusion using UTC. When a run
starts after 17:00 PDT (= 00:00 UTC of the next day), the JVM date and
the engine date disagree by one day, so TIME-to-TIMESTAMP coercion
produces tomorrow's timestamp and 24 parameterized cases fail with
expected=true got=false (and the inverse).

Switch to `LocalDate.now(ZoneOffset.UTC)` so the test parameters use
the same date the engine uses, regardless of when or where the run
starts.

Before/after (CalciteDateTimeComparisonIT, analytics-engine route,
running at 18:43 PDT 2026-06-10):
  before:  tests=191 failures=24 errors=0
  after:   tests=191 failures=0  errors=0

Signed-off-by: Kai Huang <ahkcs@amazon.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@ahkcs ahkcs added the enhancement New feature or request label Jun 11, 2026
@ahkcs ahkcs merged commit 370c230 into opensearch-project:main Jun 11, 2026
35 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants