Description
There's a null pointer exception in the cases where TypeDescription does not have children.
For example:
val orcSchema1 = TypeDescription.createStruct() .addField("a", TypeDescription.createString()) .addField("b", TypeDescription.createDouble()) .addField("c", TypeDescription.createBoolean()) println(orcSchema1.hashCode())
This will throw:
java.lang.NullPointerException: Cannot invoke "java.util.List.hashCode()" because "this.children" is null
As you can see version 1.7 had this code:
@Override public int hashCode() { long result = category.ordinal() * 4241 + maxLength + precision * 13 + scale; if (children != null) { for(TypeDescription child: children) { result = result * 6959 + child.hashCode(); } } return (int) result; }
while version 1.8 has this:
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + category.hashCode(); result = prime * result + children.hashCode(); result = prime * result + maxLength; result = prime * result + precision; result = prime * result + scale; return result; }
Primitive type description do not have children which means that hashCode cannot work on any TypeDescription (as it will surely have primitive types somewhere).
Attachments
Issue Links
- is caused by
-
ORC-844 Improve hashCode Methods
- Closed
- links to