test: add SQL file tests for try_to_date, try_to_timestamp, try_make_timestamp#4555
Open
andygrove wants to merge 2 commits into
Open
test: add SQL file tests for try_to_date, try_to_timestamp, try_make_timestamp#4555andygrove wants to merge 2 commits into
andygrove wants to merge 2 commits into
Conversation
andygrove
added a commit
to andygrove/datafusion-comet
that referenced
this pull request
Jun 1, 2026
…tamp not in earlier versions)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
N/A. This adds test coverage only. Surfaces and references #4554.
Rationale for this change
The
try_*datetime parsing/constructor functions (try_to_date,try_to_timestamp,try_make_timestamp) had no Comet test coverage. They areRuntimeReplaceableand lower toCast/GetTimestamp/MakeTimestamp, whose non-tryforms Comet already accelerates, so it was worth checking empirically whether thetry_forms are accelerated too. The result is mixed and worth pinning down with tests.What changes are included in this PR?
Adds
spark/src/test/resources/sql-tests/expressions/datetime/try_datetime.sql, covering column and literal arguments (including invalid inputs that exercise the NULL-on-error path) and NULLs. Empirical findings, encoded in the query modes:try_to_dateandtry_to_timestampcurrently fall back to Spark, so their queries usequery spark_answer_only(result correctness is still validated against Spark).try_make_timestampruns natively for valid inputs, but returns wrong values instead of NULL for out-of-range components (failOnError = falseis not honoured natively). Valid-input queries usequery spark_answer_only; invalid-input queries usequery ignore(...)referencing the bug, try_make_timestamp returns wrong values for invalid inputs instead of NULL #4554.When #4554 is fixed and the
try_to_*fallback is addressed, these queries can be promoted to the defaultquerymode to assert native execution.How are these changes tested?
This PR is test-only. The file runs under
CometSqlFileTestSuite, executing each query through both Spark and Comet and comparing results. Verified locally:Result: the discovered test file passes.