[fix](Nereids): Preserve "" in single quote strings and '' in double quote strings. (#27959)
This commit is contained in:
@ -1935,7 +1935,13 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
|
||||
public Literal visitStringLiteral(StringLiteralContext ctx) {
|
||||
String txt = ctx.STRING_LITERAL().getText();
|
||||
String s = txt.substring(1, txt.length() - 1);
|
||||
s = s.replace("''", "'").replace("\"\"", "\"");
|
||||
if (txt.charAt(0) == '\'') {
|
||||
// for single quote string, '' should be converted to '
|
||||
s = s.replace("''", "'");
|
||||
} else if (txt.charAt(0) == '"') {
|
||||
// for double quote string, "" should be converted to "
|
||||
s = s.replace("\"\"", "\"");
|
||||
}
|
||||
if (!SqlModeHelper.hasNoBackSlashEscapes()) {
|
||||
s = LogicalPlanBuilderAssistant.escapeBackSlash(s);
|
||||
}
|
||||
|
||||
@ -789,8 +789,7 @@ public class StatisticsUtil {
|
||||
return null;
|
||||
}
|
||||
return str.replace("'", "''")
|
||||
.replace("\\", "\\\\")
|
||||
.replace("\"", "\"\"");
|
||||
.replace("\\", "\\\\");
|
||||
}
|
||||
|
||||
public static boolean isExternalTable(String catalogName, String dbName, String tblName) {
|
||||
|
||||
Reference in New Issue
Block a user