Skip to content

[SPARK-52586][SQL] Introduce AnyTimeType #51293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Jun 26, 2025

What changes were proposed in this pull request?

In the PR, I propose to introduce the abstract class AnyTimeType and its companion object that represents the TIME type of any valid precision. Also added the default precision value which is set to 6 (microseconds) at the moment.

Why are the changes needed?

  1. This abstract class (and its companion) can be used in checks of input types like inputTypes() of ExpectsInputTypes. Apparently, instead of pointing out all valid TIME types: TIME(0), TIME(1), ..., TIME(6), and in the future TIME(7)..TIME(9), devs could refer to only AnyTimeType.
  2. Improve user-facing errors like DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE which mentions all precisions of the TIME type.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By running the affected and modified test suites:

$ build/sbt "test:testOnly *TimeExpressionsSuite"
$ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z time.sql"
$ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z timestamp-ntz.sql"

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Jun 26, 2025
@MaxGekk MaxGekk changed the title [WIP][SQL] Introduce AnyTimeType [WIP][SPARK-52586][SQL] Introduce AnyTimeType Jun 26, 2025
@MaxGekk MaxGekk changed the title [WIP][SPARK-52586][SQL] Introduce AnyTimeType [SPARK-52586][SQL] Introduce AnyTimeType Jun 26, 2025
@MaxGekk MaxGekk marked this pull request as ready for review June 26, 2025 11:21
@MaxGekk
Copy link
Member Author

MaxGekk commented Jun 26, 2025

@LuciferYang @yaooqinn @dongjoon-hyun Could you review this PR, please.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @MaxGekk .

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 4.1.0. Thank you for polishing this area.

@LuciferYang
Copy link
Contributor

LuciferYang commented Jun 27, 2025

late LGTM, Thank you @MaxGekk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants