Skip to content

[SPARK-52867][SQL] Remove redundant GetTimestamp #51556

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zml1206
Copy link
Contributor

@zml1206 zml1206 commented Jul 18, 2025

What changes were proposed in this pull request?

Remove redundant GetTimestamp for ParseToDate when left's dateType is TimestampType and ParseToTimestamp when dateType is the same as left's dateType.

Why are the changes needed?

Simplify plan.

select to_date(t, 'yyyy-MM') from time

before
*(1) Project [cast(gettimestamp(t#7, yyyy-MM, TimestampType, Some(America/Los_Angeles), false) as date) AS to_date(t, yyyy-MM)#9]
+- *(1) ColumnarToRow
   +- FileScan parquet

after
*(1) Project [cast(t#7 as date) AS to_date(t, yyyy-MM)#9]
+- *(1) ColumnarToRow
   +- FileScan parquet
select to_timestamp(t, 'yyyy-MM') from time

before
*(1) Project [gettimestamp(t#7, yyyy-MM, TimestampType, Some(America/Los_Angeles), false) AS to_timestamp(t, yyyy-MM)#11]
+- *(1) ColumnarToRow
   +- FileScan parquet

after
*(1) Project [t#7 AS to_timestamp(t, yyyy-MM)#11]
+- *(1) ColumnarToRow
   +- FileScan parquet

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

No.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

UT.

@github-actions github-actions bot added the SQL label Jul 18, 2025
@zml1206 zml1206 changed the title [SPARK-52867] Remove redundant GetTimestamp [SPARK-52867][SQL] Remove redundant GetTimestamp Jul 18, 2025
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.

1 participant