Dwrite commented on PR #4339:
URL: https://github.com/apache/calcite/pull/4339#issuecomment-3100803497

   > I will wait for an iq test to finish reviewing.
   Added  The iq test.
   The reason idempotency is broken is not because of ^^ sequences (which are 
already handled), but due to this specific logic:
   else if (secondCaret < 0) {
     String sqlSansCaret =
         sql.substring(0, firstCaret)
             + sql.substring(firstCaret + 1);
     ...
   }
   This block assumes that a single ^ in the SQL string is always an error 
marker, and removes it. However, in valid SQL expressions such as SELECT 2 ^ 3, 
the caret is actually a legitimate binary operator (bitwise XOR). As a result, 
writing a test like this and running QuidemTest will strip the caret — breaking 
the SQL and making the test output non-idempotent.
   
   That’s why the fix needs to distinguish between carets used as error markers 
versus those used as operators. Without that, tests using XOR will be 
incorrectly processed and fail on rerun.
   
   Escaping every caret manually (^^) would work, but that’s a workaround, not 
a real solution — it hurts test readability and burdens contributors 
unnecessarily. The fix I propose aims to retain natural SQL input and preserve 
idempotent behavior.


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