You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "taiho choi (JIRA)" <ji...@apache.org> on 2017/09/13 02:31:00 UTC
[jira] [Created] (SPARK-21989) createDataset and the schema of
encoder class
taiho choi created SPARK-21989:
----------------------------------
Summary: createDataset and the schema of encoder class
Key: SPARK-21989
URL: https://issues.apache.org/jira/browse/SPARK-21989
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 2.2.0
Reporter: taiho choi
Hello.
public class SampleData implements Serializable {
public String str;
}
ArrayList<String> arr= new ArrayList();
arr.add("{\"str\": \"everyone\"}");
arr.add("{\"str\": \"Hello\"}");
JavaRDD<SampleData> data2 = sc.parallelize(arr).map(v -> {return new Gson().fromJson(v, SampleData.class);});
Dataset<SampleData> df = sqc.createDataset(data2.rdd(), Encoders.bean(SampleData.class));
df.printSchema();
expected result of printSchema is str field of sampleData class.
actual result is following.
root
and if i call df.show() it displays like following.
++
||
++
||
||
++
what i expected is , "hello", "everyone" will be displayed.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org