maropu commented on a change in pull request #23854: [SPARK-22000][SQL] Use
String.valueOf to assign value to String type of field in Java Bean
URL: https://github.com/apache/spark/pull/23854#discussion_r258900710
##########
File path:
sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java
##########
@@ -252,4 +283,73 @@ public String toString() {
return String.format("[%d,%d]", startTime, endTime);
}
}
+
+ public static class RecordSpark22000 {
+ private String ref;
+ private String userId;
+ private int x;
+ private int y;
+
+ public RecordSpark22000() { }
+
+ RecordSpark22000(String ref, String userId, int x, int y) {
+ this.ref = ref;
+ this.userId = userId;
+ this.x = x;
+ this.y = y;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+ public void setY(int y) {
+ this.y = y;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RecordSpark22000 that = (RecordSpark22000) o;
+ return x == that.x &&
+ y == that.y &&
+ Objects.equals(ref, that.ref) &&
+ Objects.equals(userId, that.userId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ref, userId, x, y);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("ref='%s', userId='%s', x=%d, y=%d", ref, userId,
x, y);
+ }
Review comment:
We need to override `toString`, `hashCode`, and `equals` for the test?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]