You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2021/07/05 06:14:00 UTC

[jira] [Assigned] (SPARK-35998) Make from_csv/to_csv to handle year-month intervals properly

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

Apache Spark reassigned SPARK-35998:
------------------------------------

    Assignee: Apache Spark  (was: Kousuke Saruta)

> Make from_csv/to_csv to handle year-month intervals properly
> ------------------------------------------------------------
>
>                 Key: SPARK-35998
>                 URL: https://issues.apache.org/jira/browse/SPARK-35998
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.2.0, 3.3.0
>            Reporter: Kousuke Saruta
>            Assignee: Apache Spark
>            Priority: Major
>
> from_csv throws exception if year-month interval types are given.
> {code}
> spark-sql> select from_csv("interval '1-2' year to month", "a interval year to month");
> 21/07/03 04:32:24 ERROR SparkSQLDriver: Failed in [select from_csv("interval '1-2' year to month", "a interval year to month")]
> java.lang.Exception: Unsupported type: interval year to month
> 	at org.apache.spark.sql.errors.QueryExecutionErrors$.unsupportedTypeError(QueryExecutionErrors.scala:775)
> 	at org.apache.spark.sql.catalyst.csv.UnivocityParser.makeConverter(UnivocityParser.scala:224)
> 	at org.apache.spark.sql.catalyst.csv.UnivocityParser.$anonfun$valueConverters$1(UnivocityParser.scala:134)
> {code}
> Also, to_csv doesn't handle year-month interval types properly though any exception is thrown.
> The result of to_csv for year-month interval types is not ANSI interval compliant form.
> {code}
> spark-sql> select to_csv(named_struct("a", interval '1-2' year to month));
> 14
> {code}
> The result above should be INTERVAL '1-2' YEAR TO MONTH.



--
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