You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sunny Jain (Jira)" <ji...@apache.org> on 2020/05/25 15:43:00 UTC

[jira] [Updated] (SPARK-31814) Null in Date conversion from yyMMddHHmmss for specific date and time

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

Sunny Jain updated SPARK-31814:
-------------------------------
    Description: 
Hi,

 

We are trying to convert a column with string datatype to date type using below example. It seems to work for all timestamps except for the timestamp for 31st March 2019 02:**:** like  190331020000. Can you please look into it. Thanks.

scala> sql("select to_date('190331000000','yyMMddHHmmss')").show(false)

+------------------------------------------------+
|to_date('190331000000', 'yyMMddHHmmss')|

+------------------------------------------------+
|2019-03-31                                                     |

+------------------------------------------------+

 

 

 Interstingly below is not working for highlighted hours (02). 

scala> sql("select to_date('190331020000','yyMMddHHmmss')").show(false)

+------------------------------------------------+
|to_date('190331{color:#ff0000}02{color}0000', 'yyMMddHHmmss')|

+------------------------------------------------+
|null                                                                   |

+------------------------------------------------+

 

 

  was:
Hi,

 

We are trying to convert a column with string datatype to date type using below example. It seems to work for all timestamps except for the timestamp for 31st March 2019 02:**:** like  190331020000. Can you please look into it. Thanks.

scala> sql("select to_date('190331000000','yyMMddHHmmss')").show(false)

+------------------------------------------------+

|to_date('190331000000', 'yyMMddHHmmss')|

+------------------------------------------------+

|2019-03-31                                                      |

+------------------------------------------------+

 

 

 Interstingly below is not working for highlighted hours (02). 

scala> sql("select to_date('190331020000','yyMMddHHmmss')").show(false)

+------------------------------------------------+

|to_date('190331{color:#FF0000}02{color}0000', 'yyMMddHHmmss') |

+------------------------------------------------+

|null                                                                   |

+------------------------------------------------+

 

 

    Environment: 
Spark Version : 2.3.0.2.6.5.0-292

Distribution : Hortonworks

> Null in Date conversion from yyMMddHHmmss for specific date and time
> --------------------------------------------------------------------
>
>                 Key: SPARK-31814
>                 URL: https://issues.apache.org/jira/browse/SPARK-31814
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.3.0
>         Environment: Spark Version : 2.3.0.2.6.5.0-292
> Distribution : Hortonworks
>            Reporter: Sunny Jain
>            Priority: Minor
>
> Hi,
>  
> We are trying to convert a column with string datatype to date type using below example. It seems to work for all timestamps except for the timestamp for 31st March 2019 02:**:** like  190331020000. Can you please look into it. Thanks.
> scala> sql("select to_date('190331000000','yyMMddHHmmss')").show(false)
> +------------------------------------------------+
> |to_date('190331000000', 'yyMMddHHmmss')|
> +------------------------------------------------+
> |2019-03-31                                                     |
> +------------------------------------------------+
>  
>  
>  Interstingly below is not working for highlighted hours (02). 
> scala> sql("select to_date('190331020000','yyMMddHHmmss')").show(false)
> +------------------------------------------------+
> |to_date('190331{color:#ff0000}02{color}0000', 'yyMMddHHmmss')|
> +------------------------------------------------+
> |null                                                                   |
> +------------------------------------------------+
>  
>  



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