Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support nested JavaBeans in SparkValueWriter
ScalaValueHandler now intercepts JavaValueHandler's recursion calls and attempts to handle the value before handing it back to the JavaValueHandler. Nested Beans works now, and correctly reports serialization errors. fixes #1021, relates #1019
- Loading branch information
Showing
5 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
spark/core/test/scala/org/elasticsearch/spark/serialization/testbeans/Contact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.elasticsearch.spark.serialization.testbeans; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Bean object with contact info for tests. | ||
*/ | ||
public class Contact implements Serializable { | ||
|
||
private String name; | ||
private String relation; | ||
|
||
public Contact() { | ||
} | ||
|
||
public Contact(String name, String relation) { | ||
this.name = name; | ||
this.relation = relation; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getRelation() { | ||
return relation; | ||
} | ||
|
||
public void setRelation(String relation) { | ||
this.relation = relation; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
spark/core/test/scala/org/elasticsearch/spark/serialization/testbeans/ContactBook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.elasticsearch.spark.serialization.testbeans; | ||
|
||
import java.io.Serializable; | ||
import java.util.Map; | ||
|
||
/** | ||
* A collection of contacts | ||
*/ | ||
public class ContactBook implements Serializable { | ||
|
||
private String owner; | ||
private Map<String, Contact> contacts; | ||
|
||
public ContactBook() { | ||
|
||
} | ||
|
||
public ContactBook(String owner, Map<String, Contact> contacts) { | ||
this.owner = owner; | ||
this.contacts = contacts; | ||
} | ||
|
||
public String getOwner() { | ||
return owner; | ||
} | ||
|
||
public void setOwner(String owner) { | ||
this.owner = owner; | ||
} | ||
|
||
public Map<String, Contact> getContacts() { | ||
return contacts; | ||
} | ||
|
||
public void setContacts(Map<String, Contact> contacts) { | ||
this.contacts = contacts; | ||
} | ||
} |