Gabor Kaszab has posted comments on this change. ( http://gerrit.cloudera.org:8080/14665 )
Change subject: IMPALA-9131: Use single quotes around FORMAT clause in CAST ...................................................................... Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/14665/1/fe/src/main/java/org/apache/impala/analysis/CastExpr.java File fe/src/main/java/org/apache/impala/analysis/CastExpr.java: http://gerrit.cloudera.org:8080/#/c/14665/1/fe/src/main/java/org/apache/impala/analysis/CastExpr.java@209 PS1, Line 209: castFormat_ > Are single quotes allowed inside 'castFormat_' ? Yes, there are two ways you can use single quotes within castFormat_: 1: It's a valid separator char 2: Can be in a free text token. As a free text this works fine: select cast(date'2019-11-10' as string format 'YYYY"\'" '); +------------------------------------------------------+ | cast(date '2019-11-10' as string format 'yyyy"\'" ') | +------------------------------------------------------+ However, providing single quote as a separator seems a bit problematic: apparent;y there is no way to have a single quote separator when the format is surrounded by single quotes (treats it as a closing quote). > select cast(date'2019-10-11' as string format 'YYYY'MM'); > select cast(date'2019-11-10' as string format "DAY'"); +-------------------------------------------------+ | cast(date '2019-11-10' as string format 'day'') | +-------------------------------------------------+ I'm trying to figure out a way to handle single quote as separator. I also consider removing it from the valid separator list as it seems more complicated to implement than the gain we have. But anyway, this issue is not related to the fact that the whole format should be surrounded by double quotes in the printout. -- To view, visit http://gerrit.cloudera.org:8080/14665 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3310abfa6f3ccbbe4c437846c6dd05791153e6f7 Gerrit-Change-Number: 14665 Gerrit-PatchSet: 1 Gerrit-Owner: Gabor Kaszab <[email protected]> Gerrit-Reviewer: Anonymous Coward (536) Gerrit-Reviewer: Attila Jeges <[email protected]> Gerrit-Reviewer: Gabor Kaszab <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Norbert Luksa <[email protected]> Gerrit-Comment-Date: Mon, 11 Nov 2019 13:42:22 +0000 Gerrit-HasComments: Yes
