Hello Quanlong Huang, Aman Sinha, Zoltan Borok-Nagy, Joe McDonnell, Michael 
Smith, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    https://gerrit.cloudera.org/25415

to look at the new patch set (#7).

Change subject: IMPALA-15774: Decode SQL string escapes before Calcite 
simplification
......................................................................

IMPALA-15774: Decode SQL string escapes before Calcite simplification

Calcite kept string literals in their SQL-escaped form and only
unescaped them when building an Impala StringLiteral. Simplification
and predicate inference compared that escape text, so '\061' and '1'
folded the wrong way. LIKE patterns with an escaped wildcard had the
same cause.

Decode the literal in ImpalaRexBuilder while the plan is still being
built from SQL, which is before postAnalysis_. Literals created after
that are already decoded, so RexLiteralConverter no longer unescapes
them and constant folding no longer doubles backslashes.

Removed the line in ImpalaRexExecutor which added the escape
character back into the RexLiteral after constant folding since the
string in the RexLiteral is already unescaped.

One exception that is handled. The date format string in the cast
statement needs to retain its escape characters.

Testing
 - CalciteEscapedStringLiteralTest, compared with the original planner.
 - Added the IMPALA-15774 cases to QueryTest/calcite.test. The existing
   IMPALA-15753 LIKE cases still match the original planner.

Assisted-by: Grok 4.7 (Cursor)
Change-Id: I2f3e3d7c152fe43feea88a97f9b4c892bee4afa4
---
M fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java
M fe/src/main/java/org/apache/impala/planner/HBaseScanNode.java
M fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/functions/RexLiteralConverter.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaConvertletTable.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaRexBuilder.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaValuesRel.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/ImpalaRexExecutor.java
A 
java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteEscapedStringLiteralTest.java
M testdata/workloads/functional-query/queries/QueryTest/calcite.test
10 files changed, 223 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/15/25415/7
--
To view, visit https://gerrit.cloudera.org/25415
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2f3e3d7c152fe43feea88a97f9b4c892bee4afa4
Gerrit-Change-Number: 25415
Gerrit-PatchSet: 7
Gerrit-Owner: Steve Carlin <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to