apurtell commented on code in PR #2724:
URL: https://github.com/apache/phoenix/pull/2724#discussion_r4794459708


##########
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:
   Added this regression test in 7bff8d1d29, in the OMID transactional global 
index suite. It commits rows, creates a functional index on a regular 
expression replace whose pattern is a backslash string literal, then writes 
more rows. It checks the index values from the build and from maintenance. On a 
transactional table the build goes through this compiler, and before the fix it 
escaped the stored expression a second time, so the build used a different 
pattern than maintenance. On the base commit with only the test added, the test 
fails because the backfilled row keeps its digits; with the fix it passes.
   
   (Claude Code)



-- 
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]

Reply via email to