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 2016/09/23 11:29:20 UTC

[jira] [Commented] (SPARK-17646) SparkType::add method does not work in 2.0.0 (in Java)

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

Sean Owen commented on SPARK-17646:
-----------------------------------

This is not a bug. add does not modify the object but creates a new object.

> SparkType::add method does not work in 2.0.0 (in Java)
> ------------------------------------------------------
>
>                 Key: SPARK-17646
>                 URL: https://issues.apache.org/jira/browse/SPARK-17646
>             Project: Spark
>          Issue Type: Bug
>          Components: Java API
>         Environment: spark-sql_2.11
> version 2.0.0
> Java 8
>            Reporter: Pawel Skorupinski
>            Priority: Minor
>
> Add methods do not work:
> StructType inputStructure = new StructType();
> inputStructure.add("b",new IntegerType(),false);
> inputStructure.add("a","string");
> System.err.println(inputStructure.sql());
> >> STRUCT<>
> System.err.println(inputStructure.length());
> >> 0
> Constructor is working:
> StructField [] structFields = new StructField[1];
> structFields[0] = new StructField("a",new StringType(),false,null);
> inputStructure = new StructType(structFields);
> System.err.println(inputStructure.sql());
> >> STRUCT<`a`: STRING>
> System.err.println(inputStructure.length());
> >> 1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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