Dwrite commented on code in PR #4339:
URL: https://github.com/apache/calcite/pull/4339#discussion_r2218153344
##########
core/src/main/java/org/apache/calcite/sql/parser/StringAndPos.java:
##########
@@ -52,8 +53,54 @@ private StringAndPos(String sql, int cursor, @Nullable
SqlParserPos pos) {
}
/**
- * Looks for one or two carets in a SQL string, and if present, converts
- * them into a parser position.
+ * Checks if the SQL expression is a simple XOR pattern that can be safely
processed.
+ *
+ * <p>This method provides special handling for the BITXOR_OPERATOR (^) in
Apache Calcite
Review Comment:
I totally understand the concern about adding too many special patterns
potentially making the test input language confusing.
However, after careful consideration and multiple attempts, this approach
with these specific patterns is currently the simplest way to guarantee
idempotency of the of(String sql) method and keep all existing test cases
passing.
Simply treating a single caret ^ as a normal character unfortunately breaks
certain tests that rely on caret-based highlighting for error ranges.
If you have any alternative approach that can keep idempotency and pass all
tests without introducing these patterns, I’d be very glad to explore it
together!
--
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]