[ 
https://issues.apache.org/jira/browse/SPARK-61029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon updated SPARK-61029:
---------------------------------
    Description: 
In PySpark Connect, {{spark.createDataFrame(data, schema)}} parses a DDL string 
schema on the server ({{AnalyzePlanRequest.ddl_parse}}), as do {{mapInPandas}}, 
{{mapInArrow}} and the apply functions of their schemas, so they take any DDL 
that Spark does: {{"st struct<a:int,b:double>"}}, {{"arr 
array<struct<c:int>>"}}, {{"m map<string,struct<x:int>>"}}, backtick-quoted 
names such as {{"`a b` int"}}, collations such as {{"s STRING COLLATE 
UTF8_LCASE"}}, and {{NOT NULL}} and {{COMMENT}} clauses. They raise the errors 
of Spark's parser, such as {{PARSE_SYNTAX_ERROR}} for {{"a INT,"}}. 
{{transformWithStateInPandas}} sends a DDL output schema as an 
{{UnparsedDataType}}, for the server to parse.

The Rust-backed Python client parses it on the client, which raises 
{{ValueError: invalid type string 'st struct<a:int,b:double>': SparkError { 
kind: ValueError, error_class: "INVALID_DATATYPE_FORMAT", ... }}} for these. It 
takes {{"a INT,"}} as {{a INT}}, and sends a type of {{"s STRING COLLATE 
UTF8_LCASE"}} that the server fails to parse ({{PARSE_SYNTAX_ERROR}}). Parse 
them as PySpark does.

  was:
In PySpark Connect, {{spark.createDataFrame(data, schema)}} parses a DDL string 
schema on the server ({{AnalyzePlanRequest.ddl_parse}}), as do {{mapInPandas}}, 
{{mapInArrow}} and the apply functions of their schemas, so they take any DDL 
that Spark does: {{"st struct<a:int,b:double>"}}, {{"arr 
array<struct<c:int>>"}}, {{"m map<string,struct<x:int>>"}}, backtick-quoted 
names such as {{"`a b` int"}}, and {{NOT NULL}} and {{COMMENT}} clauses.

The Rust-backed Python client parses it on the client, which raises 
{{ValueError: invalid type string 'st struct<a:int,b:double>': SparkError { 
kind: ValueError, error_class: "INVALID_DATATYPE_FORMAT", ... }}} for these. 
Parse them as PySpark does.



> Parse the DDL schema strings of createDataFrame and the map functions on the 
> server in the Python client as PySpark does
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-61029
>                 URL: https://issues.apache.org/jira/browse/SPARK-61029
>             Project: Spark
>          Issue Type: Bug
>          Components: Connect
>    Affects Versions: connect-rust-4.3.0
>            Reporter: Hyukjin Kwon
>            Priority: Major
>             Fix For: connect-rust-4.3.0
>
>
> In PySpark Connect, {{spark.createDataFrame(data, schema)}} parses a DDL 
> string schema on the server ({{AnalyzePlanRequest.ddl_parse}}), as do 
> {{mapInPandas}}, {{mapInArrow}} and the apply functions of their schemas, so 
> they take any DDL that Spark does: {{"st struct<a:int,b:double>"}}, {{"arr 
> array<struct<c:int>>"}}, {{"m map<string,struct<x:int>>"}}, backtick-quoted 
> names such as {{"`a b` int"}}, collations such as {{"s STRING COLLATE 
> UTF8_LCASE"}}, and {{NOT NULL}} and {{COMMENT}} clauses. They raise the 
> errors of Spark's parser, such as {{PARSE_SYNTAX_ERROR}} for {{"a INT,"}}. 
> {{transformWithStateInPandas}} sends a DDL output schema as an 
> {{UnparsedDataType}}, for the server to parse.
> The Rust-backed Python client parses it on the client, which raises 
> {{ValueError: invalid type string 'st struct<a:int,b:double>': SparkError { 
> kind: ValueError, error_class: "INVALID_DATATYPE_FORMAT", ... }}} for these. 
> It takes {{"a INT,"}} as {{a INT}}, and sends a type of {{"s STRING COLLATE 
> UTF8_LCASE"}} that the server fails to parse ({{PARSE_SYNTAX_ERROR}}). Parse 
> them as PySpark does.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to