cloud-fan commented on a change in pull request #27851: [SPARK-31071][SQL]
Allow annotating non-null fields when encoding Java Beans
URL: https://github.com/apache/spark/pull/27851#discussion_r389503356
##########
File path:
sql/core/src/test/java/test/org/apache/spark/sql/JavaDatasetSuite.java
##########
@@ -823,6 +824,75 @@ public int hashCode() {
}
}
+ public static class NestedSmallBeanWithNonNullField implements Serializable {
+ private SmallBean nonNull_f;
+ private SmallBean nullable_f;
+ private Map<String, SmallBean> childMap;
+
+ @Nonnull
+ public SmallBean getNonNull_f() {
+ return nonNull_f;
+ }
+
+ public void setNonNull_f(SmallBean f) {
+ this.nonNull_f = f;
+ }
+
+ public SmallBean getNullable_f() {
+ return nullable_f;
+ }
+
+ public void setNullable_f(SmallBean f) {
+ this.nullable_f = f;
+ }
+
+ @Nonnull
+ public Map<String, SmallBean> getChildMap() { return childMap; }
+ public void setChildMap(Map<String, SmallBean> childMap) {
+ this.childMap = childMap;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ NestedSmallBeanWithNonNullField that = (NestedSmallBeanWithNonNullField)
o;
+ return Objects.equal(nullable_f, that.nullable_f) &&
+ Objects.equal(nonNull_f, that.nonNull_f) && Objects.equal(childMap,
that.childMap);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(nullable_f, nonNull_f, childMap);
+ }
+ }
+
+ public static class NestedSmallBean2 implements Serializable {
Review comment:
is this necessary? It's just testing another non-nullable jave bean.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]