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 2018/10/07 20:02:00 UTC

[jira] [Created] (SPARK-25672) Inferring schema from CSV string literal

Maxim Gekk created SPARK-25672:
----------------------------------

             Summary: Inferring schema from CSV string literal
                 Key: SPARK-25672
                 URL: https://issues.apache.org/jira/browse/SPARK-25672
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 2.4.0
            Reporter: Maxim Gekk


Need to add new function - *schema_of_csv()*. The function should infer schema of CSV string literal. The result of the function is a schema in DDL format.

One of the use cases is passing output of _schema_of_csv()_ to *from_csv()* (see SPARK-25393). The new function should allow schema inferring from an example. Let's say csv_col is a column containing CSV string with the same schema. It should be possible to pass a CSV string with the same schema to _schema_of_csv()_ which infers schema for the particular example.

{code:sql}
select from_csv(csv_col, schema_of_csv('1,a,0.1'))
from csv_table;
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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