[
https://issues.apache.org/jira/browse/IMPALA-8367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16846091#comment-16846091
]
Greg Rahn commented on IMPALA-8367:
-----------------------------------
The docs should probably state what SimpleDateFormat masks/values are supported
and what are not if it does not already.
I would agree it's probably not worth adding new SimpleDateFormat options for
the following reasons:
- as mentioned the direction is to the ANSI SQL:2016 format
- it is possible in current versions to get the value via
dayofweek(from_unixtime(1558545818))
- the origin of from_unixtime() is MySQL and it does not use SimpleDateFormat,
so there is no cross compatibility as shown below
{noformat}
MariaDB [(none)]> select
-> from_unixtime(1558545818) as dt,
-> from_unixtime(1558545818, '%W') as dow_name,
-> from_unixtime(1558545818, '%w') as dow_number;
+---------------------+-----------+------------+
| dt | dow_name | dow_number |
+---------------------+-----------+------------+
| 2019-05-22 10:23:38 | Wednesday | 3 |
+---------------------+-----------+------------+
{noformat}
> from_unixtime Bad date/time conversion format: u on NULL value
> --------------------------------------------------------------
>
> Key: IMPALA-8367
> URL: https://issues.apache.org/jira/browse/IMPALA-8367
> Project: IMPALA
> Issue Type: Bug
> Components: Backend
> Affects Versions: Impala 2.11.0
> Environment: impalad version 2.11.0-cdh5.14.2 RELEASE (build
> ed85dce709da9557aeb28be89e8044947708876c) Built on Tue Mar 27 13:39:48 PDT
> 2018
> Reporter: Sergio Leoni
> Assignee: Tamas Mate
> Priority: Minor
> Labels: newbie, ramp-up
>
> The function
> {code:sql}
> from_unixtime(bigint unixtime[, string format]) {code}
> output error if the value of unixtime is NULL and format is 'u'.
>
> This doesn't work:
> {code:sql}
> SELECT FROM_UNIXTIME(NULL, 'u')
> {code}
> {noformat}
> Bad date/time conversion format: u{noformat}
>
> This works:
> {code:sql}
> SELECT FROM_UNIXTIME(NULL, 'yyyy-MM-dd')
> {code}
> {noformat}
> |from_unixtime(null, 'yyyy-mm-dd')|
> |---------------------------------|
> | NULL |
> |---------------------------------|{noformat}
>
> I haven't checked all the possible combinations.
> Other software like Hive handles this correctly.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]