Attila Jeges 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 3: (1 comment) http://gerrit.cloudera.org:8080/#/c/14665/3/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/3/fe/src/main/java/org/apache/impala/analysis/CastExpr.java@197 PS3, Line 197: public String getCastFormatWithEscapedSingleQuotes() { : Preconditions.checkNotNull(castFormat_); : Preconditions.checkState(!castFormat_.isEmpty()); : return castFormat_.replaceAll("([^\\\\])'", "$1\\\\'"); : } This doesn't work under every circumstance, e.g.: - unescaped apostrophe at the beginning of the format string: select cast("'2010-02-01" as date format "'yyyy-mm-dd"); the printout in the header is incorrect: cast('\'2010-02-01' as date format ''yyyy-mm-dd') - escaped \ in front of an unescaped apostrophe in a text token: select cast("2010-\\'-02-01" as date FORMAT "FXYYYY-\"\\'\"-MM-DD"); the printout in the header is incorrect: cast('2010-\\\'-02-01' as date format 'fxyyyy-\"\\'\"-mm-dd') Maybe you could use something from the StringEscapeUtils class in org.apache.commons.lang3 package? -- 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: 3 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: Wed, 27 Nov 2019 12:19:12 +0000 Gerrit-HasComments: Yes
