Copilot commented on code in PR #2724:
URL: https://github.com/apache/phoenix/pull/2724#discussion_r4794187153
##########
phoenix-core-client/src/main/java/org/apache/phoenix/compile/PostIndexDDLCompiler.java:
##########
@@ -74,10 +73,9 @@ public MutationPlan compile(final PTable indexTable) throws
SQLException {
for (int i = posOffset; i < nIndexPKColumns; i++) {
PColumn col = indexPKColumns.get(i);
String indexColName = col.getName().getString();
- // need to escape backslash as this used in the SELECT statement
- String dataColName = col.getExpressionStr() == null
- ? col.getName().getString()
- : StringUtil.escapeBackslash(col.getExpressionStr());
+ // The stored expression is valid SQL text. Do not escape it again.
+ String dataColName =
+ col.getExpressionStr() == null ? col.getName().getString() :
col.getExpressionStr();
Review Comment:
Please add a regression test for backfilling a global functional index with
a backslash-containing expression on a transactional table, which selects this
compiler. `PostIndexDDLCompilerTest.testCompile` covers only plain columns, and
`IndexUsageIT.helpTestCaseSensitiveFunctionIndex` inserts rows only after index
creation, leaving build-versus-maintenance escaping differences untested.
Commit rows before creating the index, insert another row afterward, and verify
that both paths produce the expected index keys.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]