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/04 09:33:00 UTC

[jira] [Created] (SPARK-25638) Convert structs to CSV strings

Maxim Gekk created SPARK-25638:
----------------------------------

             Summary: Convert structs to CSV strings
                 Key: SPARK-25638
                 URL: https://issues.apache.org/jira/browse/SPARK-25638
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 2.4.0
            Reporter: Maxim Gekk


New function to_csv() should convert a column of StructType to a column with CSV string. The function should accept the CSV options as CSV data source does. API should expose the following methods:
{code:scala}
def to_csv(e: Column, options: Map[String, String]): Column
{code}
and for Python/R:
{code:scala}
def to_csv(e: Column, options: java.util.Map[String, String]): Column
{code}

Here is an example of usage:
{code:sql}
select to_csv(named_struct('time', to_timestamp('2015-08-26', 'yyyy-MM-dd')), map('timestampFormat', 'dd/MM/yyyy'));
{code}
{code}
26/08/2015
{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