Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9937#discussion_r46230560
  
    --- Diff: 
sql/core/src/test/java/test/org/apache/spark/sql/JavaDatasetSuite.java ---
    @@ -506,4 +507,131 @@ public void 
testJavaEncoderErrorMessageForPrivateClass() {
       public void testKryoEncoderErrorMessageForPrivateClass() {
         Encoders.kryo(PrivateClassTest.class);
       }
    +
    +  public class SimpleJavaBean implements Serializable {
    +    private boolean a;
    +    private int b;
    +    private byte[] c;
    +    private String[] d;
    +    private List<String> e;
    +
    +    public boolean isA() {
    +      return a;
    +    }
    +
    +    public void setA(boolean a) {
    +      this.a = a;
    +    }
    +
    +    public int getB() {
    +      return b;
    +    }
    +
    +    public void setB(int b) {
    +      this.b = b;
    +    }
    +
    +    public byte[] getC() {
    +      return c;
    +    }
    +
    +    public void setC(byte[] c) {
    +      this.c = c;
    +    }
    +
    +    public String[] getD() {
    +      return d;
    +    }
    +
    +    public void setD(String[] d) {
    +      this.d = d;
    +    }
    +
    +    public List<String> getE() {
    +      return e;
    +    }
    +
    +    public void setE(List<String> e) {
    +      this.e = e;
    +    }
    +
    +    @Override
    +    public boolean equals(Object o) {
    +      if (this == o) return true;
    +      if (o == null || getClass() != o.getClass()) return false;
    +
    +      SimpleJavaBean that = (SimpleJavaBean) o;
    +
    +      if (a != that.a) return false;
    +      if (b != that.b) return false;
    +      if (!Arrays.equals(c, that.c)) return false;
    +      if (!Arrays.equals(d, that.d)) return false;
    +      return e.equals(that.e);
    +    }
    +
    +    @Override
    +    public int hashCode() {
    +      int result = (a ? 1 : 0);
    +      result = 31 * result + b;
    +      result = 31 * result + Arrays.hashCode(c);
    +      result = 31 * result + Arrays.hashCode(d);
    +      result = 31 * result + e.hashCode();
    +      return result;
    +    }
    +  }
    +
    +  public class NestedJavaBean implements Serializable {
    +    private SimpleJavaBean a;
    +
    +    public SimpleJavaBean getA() {
    +      return a;
    +    }
    +
    +    public void setA(SimpleJavaBean a) {
    +      this.a = a;
    +    }
    +
    +    @Override
    +    public boolean equals(Object o) {
    +      if (this == o) return true;
    +      if (o == null || getClass() != o.getClass()) return false;
    +
    +      NestedJavaBean that = (NestedJavaBean) o;
    +
    +      return a.equals(that.a);
    +    }
    +
    +    @Override
    +    public int hashCode() {
    +      return a.hashCode();
    +    }
    +  }
    +
    +  @Test
    +  public void testJavaBeanEncoder() {
    --- End diff --
    
    Can we add a test that takes uses `as` to go from dataframes to a java bean?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to