Skip to content

[SPARK-51541][SQL] Support the TIME data type in Literal methods - #50299

Closed
MaxGekk wants to merge 5 commits into
apache:masterfrom
MaxGekk:time-in-literals
Closed

[SPARK-51541][SQL] Support the TIME data type in Literal methods#50299
MaxGekk wants to merge 5 commits into
apache:masterfrom
MaxGekk:time-in-literals

Conversation

@MaxGekk

@MaxGekkMaxGekk commented Mar 17, 2025

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

In the PR, I propose to support new data type TIME in Literal's methods such as:

  • default()
  • sql()
  • toString()
  • componentTypeToDataType()

Why are the changes needed?

To output literals of the TIME data type in human readable format. In particular, the column names are formatted by default with internal representation. See the example below where 43200000000 is a column name:

spark-sql (default)>descselecttime'12:00';
43200000000time(6)

Does this PR introduce any user-facing change?

Yes. After the changes, TIME literals are in human readable format. For the example above:

spark-sql (default)>descselecttime'12:00';
TIME'12:00:00'time(6)

How was this patch tested?

By running the modified test suites:

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

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

No.

@MaxGekkMaxGekk changed the title [WIP][SQL] Support the TIME data type in Literal methods[WIP][SPARK-51541][SQL] Support the TIME data type in Literal methodsMar 18, 2025
@MaxGekkMaxGekk changed the title [WIP][SPARK-51541][SQL] Support the TIME data type in Literal methods[SPARK-51541][SQL] Support the TIME data type in Literal methodsMar 18, 2025
@MaxGekk
MaxGekk marked this pull request as ready for review March 18, 2025 07:00

@yaooqinnyaooqinn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@LuciferYangLuciferYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MaxGekk

Copy link
Copy Markdown
MemberAuthor

Merging to master. Thank you, @yaooqinn@LuciferYang for review.

@belieferbeliefer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

Sign up for freeto 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.

4 participants

@MaxGekk@LuciferYang@yaooqinn@beliefer