Skip to content
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

[SPARK-20302][SQL] Short circuit cast when from and to types are structurally the same #17614

Closed
wants to merge 2 commits into from

Conversation

rxin
Copy link
Contributor

@rxin rxin commented Apr 12, 2017

What changes were proposed in this pull request?

When we perform a cast expression and the from and to types are structurally the same (having the same structure but different field names), we should be able to skip the actual cast.

How was this patch tested?

Added unit tests for the newly introduced functions.

(from, to) match {
case (left: ArrayType, right: ArrayType) =>
equalsStructurally(left.elementType, right.elementType) &&
left.containsNull == right.containsNull
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we be more flexible here? i.e. !left.containsNull || right.containsNull

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not symmetric. equalsStructurally should be symmetric, unless we rename this something else (e.g. structurallyCastable)

@SparkQA
Copy link

SparkQA commented Apr 12, 2017

Test build #75724 has finished for PR 17614 at commit b97b46e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor Author

rxin commented Apr 12, 2017

Merging in master.

@asfgit asfgit closed this in ffc57b0 Apr 12, 2017
peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
…cturally the same

## What changes were proposed in this pull request?
When we perform a cast expression and the from and to types are structurally the same (having the same structure but different field names), we should be able to skip the actual cast.

## How was this patch tested?
Added unit tests for the newly introduced functions.

Author: Reynold Xin <[email protected]>

Closes apache#17614 from rxin/SPARK-20302.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants