Attila Jeges has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/14714 )

Change subject: IMPALA-8705: ISO:SQL:2016 datetime patterns - Milestone 3
......................................................................


Patch Set 1:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/14714/1/be/src/runtime/datetime-parser-common.cc
File be/src/runtime/datetime-parser-common.cc:

http://gerrit.cloudera.org:8080/#/c/14714/1/be/src/runtime/datetime-parser-common.cc@270
PS1, Line 270:   TimestampFunctions::TextCase text_case = 
TimestampFunctions::CAMELCASE;
             :   if (ascii_islower(*tok.val)) {
             :     text_case = TimestampFunctions::LOWERCASE;
             :   } else if  (strncmp(tok.val, "MONTH", 5) == 0 || 
strncmp(tok.val, "MON", 3) == 0) {
             :     text_case = TimestampFunctions::UPPERCASE;
             :   }
This logic is a bit weird:

impala> select cast(DATE '2011-01-01' as string format 
'yyyy-mONTH-MOnth-MONth-MONTh');
2011-january  -January  -JANUARY  -JANUARY

Maybe these alternatively spelled format tokens shouldn't even be accepted.


http://gerrit.cloudera.org:8080/#/c/14714/1/be/src/runtime/datetime-parser-common.cc@290
PS1, Line 290:   if (ascii_islower(*tok.val)) {
             :     text_case = TimestampFunctions::LOWERCASE;
             :   } else if  (strncmp(tok.val, "DAY", 3) == 0 || 
strncmp(tok.val, "DY", 2) == 0) {
             :     text_case = TimestampFunctions::UPPERCASE;
             :   }
Same as L270


http://gerrit.cloudera.org:8080/#/c/14714/1/tests/query_test/test_cast_with_format.py
File tests/query_test/test_cast_with_format.py:

http://gerrit.cloudera.org:8080/#/c/14714/1/tests/query_test/test_cast_with_format.py@399
PS1, Line 399:    # Test different lowercase vs uppercase scenarios with the 
datetime to string path
             :     # when FM is provided.
             :     result = self.execute_query("select cast(date'2010-10-18' as 
string FORMAT "
             :         "'FMMONTH FMMonth FMmonth')")
             :     assert result.data == ["OCTOBER October october"]
This is a bit weird that we have to add FM modifier to the MONTH token to avoid 
padding in the resulting string. Hive works this way too?


http://gerrit.cloudera.org:8080/#/c/14714/1/tests/query_test/test_cast_with_format.py@834
PS1, Line 834:     result = self.execute_query("select cast(date'2019-01-01' as 
string "
             :         "format 'FXYYYY FMDAY DD')")
             :     assert result.data == ["2019 TUESDAY 01"]
Same as L403



--
To view, visit http://gerrit.cloudera.org:8080/14714
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic797f19a1311b54e5d00d01d0a7afe1f0f21fb8f
Gerrit-Change-Number: 14714
Gerrit-PatchSet: 1
Gerrit-Owner: Gabor Kaszab <[email protected]>
Gerrit-Reviewer: Attila Jeges <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Comment-Date: Mon, 18 Nov 2019 13:35:06 +0000
Gerrit-HasComments: Yes

Reply via email to