Hello Gabor Kaszab, Attila Jeges, Tim Armstrong,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/8508
to look at the new patch set (#7).
Change subject: IMPALA-5237: Support a quoted string in date/time format
......................................................................
IMPALA-5237: Support a quoted string in date/time format
Impala does not represent a quoted string at date/time format.
For example, addtional quoted string between the patterns
(e.g. HH\'H\' => 11H). Hive supports this feature, so user wants
to get a same result from Impala. By the way, Impala returns
a different result as below.
* Hive
> select from_unixtime(1492677564, 'HH\'H\' mm\'M\' ss\'S\'');
08H 39M 24S
* Impala
> select from_unixtime(1492677564, 'HH\'H\' mm\'M\' ss\'S\'');
08'8' 39'4' 24'0'
The change affects the format pattern for
from_unixtime/from_timestamp/unix_timestamp.
In unix_timestamp, user can also specify a quoted string like this.
> select unix_timestamp('\'Epoch time: \'19700101',
> '\'Epoch time: \'yyyyMMdd');
0
By the way, the quoted strings between input and format should be
exactly same and internally string comparison is case-sensitive.
There is one intentional difference between Hive and Impala.
In Impala, the format string should have any date or time patten
as below. Throwing the error/warning is better if Impala cannot
optimize the expression. User must rewrite the query and don't pay
the function call.
* Hive
> select from_unixtime(0, '\'Hello world!\'');
Hello world!
* Impala
> select from_unixtime(0, '\'Hello world!\'');
Bad date/time conversion format: 'Hello world!'
Testing:
Add unit tests: ExprTest.QuotedStringForDateTimeFormat
Change-Id: Ie34055ac695748bcfb110bfa6ed5308f469ea178
---
M be/src/exprs/expr-test.cc
M be/src/runtime/timestamp-parse-util.cc
M be/src/runtime/timestamp-parse-util.h
3 files changed, 128 insertions(+), 2 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/08/8508/7
--
To view, visit http://gerrit.cloudera.org:8080/8508
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie34055ac695748bcfb110bfa6ed5308f469ea178
Gerrit-Change-Number: 8508
Gerrit-PatchSet: 7
Gerrit-Owner: Kim Jin Chul <[email protected]>
Gerrit-Reviewer: Attila Jeges <[email protected]>
Gerrit-Reviewer: Gabor Kaszab <[email protected]>
Gerrit-Reviewer: Kim Jin Chul <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>