Skip to content

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