Skip to content

test: migrate curated temporal expression tests to SQL file tests#4765

Open
andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:temporal-suite-to-sql-tests
Open

test: migrate curated temporal expression tests to SQL file tests#4765
andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:temporal-suite-to-sql-tests

Conversation

@andygrove

Copy link
Copy Markdown
Member

Which issue does this PR close?

Follows up on review feedback from #4761, where @comphead suggested moving the temporal expression suite to the SQL file test framework.

Rationale for this change

CometTemporalExpressionSuite contains several tests whose value is fully expressible in the SQL file test framework (curated/literal inputs, fallback-reason checks). Those read more clearly as SQL fixtures and live alongside the other datetime/cast fixtures, so this PR migrates that subset and removes the now-redundant Scala versions.

The migration is intentionally focused. Many tests in the suite cannot be faithfully expressed as SQL fixtures and are left in place:

  • Fuzz-based correctness tests (last_day, datediff, unix_date, the date_trunc / date_format column tests) rely on 1000-row random data that SQL fixtures cannot replicate.
  • days / hours tests build Days / Hours, which are Unevaluable partition-transform expressions not reachable through SQL.
  • The allowIncompatible-enabled tests verify only that execution stays native (they intentionally skip answer comparison because the native result may diverge from Spark). The SQL framework has no operator-only assertion mode.

What changes are included in this PR?

Migrated to SQL file tests and removed from CometTemporalExpressionSuite:

  • unix_timestamp string-input fallback to datetime/unix_timestamp.sql (via query expect_fallback(...))
  • date_format literal and null inputs to datetime/date_format.sql
  • cast TimestampNTZ to Timestamp DST edge cases to new cast/cast_timestamp_ntz_dst.sql (Europe/London spring-forward gap and fall-back overlap)

The suite drops from 34 to 30 tests.

How are these changes tested?

  • CometSqlFileTestSuite runs the migrated fixtures (unix_timestamp.sql, date_format.sql, and the new cast_timestamp_ntz_dst.sql); all pass.
  • CometTemporalExpressionSuite (30/30) continues to pass.

Move the temporal expression tests that rely only on curated/literal data
into the SQL file test framework, where they read more clearly and live
alongside the other datetime fixtures:

- unix_timestamp string-input fallback -> unix_timestamp.sql
- date_format literal and null inputs -> date_format.sql
- cast TimestampNTZ to Timestamp DST edge cases -> cast_timestamp_ntz_dst.sql

Fuzz-based, Catalyst-API (Days/Hours), and operator-only tests remain in
CometTemporalExpressionSuite since the SQL framework cannot express random
1000-row coverage, Unevaluable partition-transform expressions, or
native-execution checks that intentionally skip answer comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant