Steve Carlin has uploaded a new patch set (#5). ( https://gerrit.cloudera.org/25415 )
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 M java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteOptimizer.java A java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteEscapedStringLiteralTest.java M testdata/workloads/functional-query/queries/QueryTest/calcite.test 11 files changed, 190 insertions(+), 14 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/15/25415/5 -- 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: 5 Gerrit-Owner: Steve Carlin <[email protected]>
