You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maxim Gekk (Jira)" <ji...@apache.org> on 2020/03/03 16:28:00 UTC

[jira] [Updated] (SPARK-31020) Support foldable schemas by `from_csv`

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

Maxim Gekk updated SPARK-31020:
-------------------------------
    Description: 
Currently, Spark accepts only literals or schema_of_csv w/ literal input as the schema parameter of from_csv. And it fails on any foldable expressions, for instance:
{code:sql}
spark-sql> select from_csv('1, 3.14', replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', ''));
Error in query: Schema should be specified in DDL format as a string literal or output of the schema_of_csv function instead of replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', '');; line 1 pos 7
{code}
There are no reasons to restrict users by literals. The ticket aims to support any foldable schemas by from_csv().

  was:
Currently, Spark accepts only literals or schema_of_csv w/ literal input as the schema parameter of from_csv. And it fails on any foldable expressions, for instance:
{code:sql}
spark-sql> select from_csv('1, 3.14', replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', ''));
Error in query: Schema should be specified in DDL format as a string literal or output of the schema_of_csv function instead of replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', '');; line 1 pos 7
{code}
There is reasons to restrict users by literals. The ticket aims to support any foldable schemas by from_csv().


> Support foldable schemas by `from_csv`
> --------------------------------------
>
>                 Key: SPARK-31020
>                 URL: https://issues.apache.org/jira/browse/SPARK-31020
>             Project: Spark
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Maxim Gekk
>            Priority: Minor
>
> Currently, Spark accepts only literals or schema_of_csv w/ literal input as the schema parameter of from_csv. And it fails on any foldable expressions, for instance:
> {code:sql}
> spark-sql> select from_csv('1, 3.14', replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', ''));
> Error in query: Schema should be specified in DDL format as a string literal or output of the schema_of_csv function instead of replace('dpt_org_id INT, dpt_org_city STRING', 'dpt_org_', '');; line 1 pos 7
> {code}
> There are no reasons to restrict users by literals. The ticket aims to support any foldable schemas by from_csv().



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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