You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2017/02/27 16:26:45 UTC

[jira] [Comment Edited] (SPARK-19751) Create Data frame API fails with a self referencing bean

    [ https://issues.apache.org/jira/browse/SPARK-19751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15886067#comment-15886067 ] 

Sean Owen edited comment on SPARK-19751 at 2/27/17 4:26 PM:
------------------------------------------------------------

Can you show the stack trace, at least the part before it just starts repeating?
To be clear, your bean doesn't reference itself, it just references instances of its same class right?
I'm not sure that's supposed to work, because it's not clear how that translates to a fixed nested schema, but it seems like the error could be better


was (Author: srowen):
Can you show the stack trace, at least the part before it just starts repeating?
To be clear, your bean doesn't reference itself, it just references instances of its same class right?

> Create Data frame API fails with a self referencing bean
> --------------------------------------------------------
>
>                 Key: SPARK-19751
>                 URL: https://issues.apache.org/jira/browse/SPARK-19751
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 2.1.0
>            Reporter: Avinash Venkateshaiah
>
> createDataset API throws a stack overflow exception when we try creating a 
> Dataset using a bean encoder. The bean is self referencing
> BEAN:
> public class HierObj implements Serializable {
>     String name;
>     List<HierObj> children;
>     public String getName() {
>         return name;
>     }
>     public void setName(String name) {
>         this.name = name;
>     }
>     public List<HierObj> getChildren() {
>         return children;
>     }
>     public void setChildren(List<HierObj> children) {
>         this.children = children;
>     }
> }
> // create an object
>         HierObj hierObj = new HierObj();
>         hierObj.setName("parent");
>         List children = new ArrayList();
>         HierObj child1 = new HierObj();
>         child1.setName("child1");
>         HierObj child2 = new HierObj();
>         child2.setName("child2");
>         children.add(child1);
>         children.add(child2);
>         hierObj.setChildren(children);
> // create a dataset
>         Dataset ds = sparkSession().createDataset(Arrays.asList(hierObj), Encoders.bean(HierObj.class));



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org