Skip to content

Conversation

@kupferk
Copy link
Contributor

@kupferk kupferk commented Jul 6, 2018

What changes were proposed in this pull request?

This pull request provides a fix for SPARK-24742: SQL Field MetaData was throwing an Exception in the hashCode method when a "null" Metadata was added via "putNull"

How was this patch tested?

A new unittest is provided in org/apache/spark/sql/types/MetadataSuite.scala

x.##
case x: Metadata =>
hash(x.map)
case null =>
Copy link
Member

Choose a reason for hiding this comment

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

Basically, we do not support null in Metadata.

Copy link
Member

Choose a reason for hiding this comment

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

nvm, I found we added the support in #8969

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the putNull method exists, but is actually not useable because of this bug. Having null in Metadata would be really helpful for me, as I'd like to store default values for fields in the Metadata. And NULL is a very common case as a default value.

@SparkQA
Copy link

SparkQA commented Aug 1, 2018

Test build #4227 has finished for PR 21722 at commit 088e2d7.

  • This patch fails Spark unit tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Aug 1, 2018

Test build #4228 has finished for PR 21722 at commit 088e2d7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

import org.apache.spark.SparkFunSuite

class MetadataSuite extends SparkFunSuite {
test("String Metadata") {
Copy link
Member

Choose a reason for hiding this comment

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

Oh @kupferk actually just noticed that the indents in this file are too deep. They should be 2-space. I think it might also be useful to use === and !== as test failures produces more detailed error messages then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comment, I am happy to fix that :)

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #93933 has finished for PR 21722 at commit 17485a7.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #93978 has finished for PR 21722 at commit 17485a7.

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

@srowen
Copy link
Member

srowen commented Aug 2, 2018

Merged to master

@HyukjinKwon
Copy link
Member

ooops.. I merged this master too and looks there's an empty commit by that ... - d182b3d

@asfgit asfgit closed this in 7be6fc3 Aug 2, 2018
asfgit pushed a commit that referenced this pull request Aug 2, 2018
## What changes were proposed in this pull request?

This pull request provides a fix for SPARK-24742: SQL Field MetaData was throwing an Exception in the hashCode method when a "null" Metadata was added via "putNull"

## How was this patch tested?

A new unittest is provided in org/apache/spark/sql/types/MetadataSuite.scala

Author: Kaya Kupferschmidt <[email protected]>

Closes #21722 from kupferk/SPARK-24742.
@srowen
Copy link
Member

srowen commented Aug 2, 2018

Heh, collided yeah. I thought one commit would end up failing but since they're identical guess it results in an empty commit. No big deal.

zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
## What changes were proposed in this pull request?

This pull request provides a fix for SPARK-24742: SQL Field MetaData was throwing an Exception in the hashCode method when a "null" Metadata was added via "putNull"

## How was this patch tested?

A new unittest is provided in org/apache/spark/sql/types/MetadataSuite.scala

Author: Kaya Kupferschmidt <[email protected]>

Closes apache#21722 from kupferk/SPARK-24742.
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.

5 participants