-
Notifications
You must be signed in to change notification settings - Fork 28k
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-24742: Fix NullPointerexception in Field Metadata #21722
Conversation
@@ -215,6 +215,8 @@ object Metadata { | |||
x.## | |||
case x: Metadata => | |||
hash(x.map) | |||
case null => |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Test build #4227 has finished for PR 21722 at commit
|
Test build #4228 has finished for PR 21722 at commit
|
import org.apache.spark.SparkFunSuite | ||
|
||
class MetadataSuite extends SparkFunSuite { | ||
test("String Metadata") { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
retest this please |
Test build #93933 has finished for PR 21722 at commit
|
retest this please |
Test build #93978 has finished for PR 21722 at commit
|
Merged to master |
ooops.. I merged this master too and looks there's an empty commit by that ... - d182b3d |
## 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 <k.kupferschmidt@dimajix.de> Closes #21722 from kupferk/SPARK-24742.
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. |
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