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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to