[
https://issues.apache.org/jira/browse/IMPALA-8367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843942#comment-16843942
]
Gabor Kaszab commented on IMPALA-8367:
--------------------------------------
Hey [~tmate],
Currently 'u' is not a valid token in Impala's custom implementation of
SimpleDateFormat. I think regardless of the input value the desired outcome
would be to write an error saying "Bad date/time conversion format: u" as
format tokenization is an operation that happens before the backend starts to
run through the inputs. As I see, this is currently the behaviour of Impala.
It's an interesting topic in general whether we want to extend the
SimpleDateFormat implementation of Impala (with token 'u' in this case) as
there is an ongoing work to introduce ISO:SQL:2016 compliant datetime pattern
matching that is going to be the preferred way of casting and we would like
users to use this instead of SimpleDateFormat. That includes sooner or later
coverage for "day number of week".
https://issues.apache.org/jira/browse/IMPALA-4018
We closed a Jira recently that was also meant to extend SimpleDateFormat
handling with the reason that the IMPALA-4018 will be able to cover the
proposed tokens and users should use that instead.
https://issues.apache.org/jira/browse/IMPALA-3381
My point is that I wouldn't spend much efforts on extending SimpleDateFormat
unless there is a very strong demand from user's side.
> 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]