Skip to content

[SPARK-38526][SQL] Fix misleading function alias name for RuntimeReplaceable#35821

Closed
cloud-fan wants to merge 1 commit intoapache:masterfrom
cloud-fan:follow2
Closed

[SPARK-38526][SQL] Fix misleading function alias name for RuntimeReplaceable#35821
cloud-fan wants to merge 1 commit intoapache:masterfrom
cloud-fan:follow2

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

This PR uses a manual recursion to replace RuntimeReplaceable expressions instead of transformAllExpressionsWithPruning. The problem of transformAllExpressionsWithPruning is it will automatically make the replacement expression inherit the function alias name from the parent node, which is quite misleading. For example, select date_part('month', c) from t, the optimized plan in EXPLAIN before this PR is

Project [date_part(cast(c#18 as date)) AS date_part(month, c)#19]
+- Relation default.t[c#18] parquet

Now it's

Project [month(cast(c#9 as date)) AS date_part(month, c)#10]
+- Relation default.t[c#9] parquet

Why are the changes needed?

fix misleading EXPLAIN result

Does this PR introduce any user-facing change?

no

How was this patch tested?

new test

@cloud-fan
Copy link
Contributor Author

cc @HyukjinKwon

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.

Thank you, @cloud-fan , @HyukjinKwon , @yaooqinn .
Merged to master for Apache Spark 3.3.0.

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.

4 participants