Samin061 commented on code in PR #5075:
URL: https://github.com/apache/calcite/pull/5075#discussion_r3525002195
##########
cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java:
##########
@@ -302,7 +302,7 @@ private String translateOp2(String op, String name,
RexLiteral right) {
requireNonNull(rowType.getField(name, true, false));
SqlTypeName typeName = field.getType().getSqlTypeName();
if (typeName != SqlTypeName.CHAR) {
- valueString = "'" + valueString + "'";
+ valueString = "'" + valueString.replace("'", "''") + "'";
Review Comment:
String.replace here is literal, not regex, so it doubles every embedded
quote independently. For the value I''m fine (two adjacent quotes) it produces
'I''''m fine', which the CQL/OQL parser reads back as exactly I''m fine, so it
round-trips fine. This is the same doubling core already does in
SqlDialect.quoteStringLiteral (val.replace(literalEndQuoteString,
literalEscapedQuote)). I pushed a Geode test with that exact value to lock it
in.
--
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]