Skip to content

Commit

Permalink
[fix](Planner) fix escape character when used in create view
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBinfeng-01 committed Dec 9, 2024
1 parent a25d457 commit 1c14cc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public boolean isMinValue() {

@Override
public String toSqlImpl() {
if (value.equals("\\")) {
value = "\\\\";
}
return "'" + value.replaceAll("'", "''") + "'";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public void testBinaryPredicateConvertEsDsl() {
QueryBuilders.toEsDsl(stringNeExpr, column2typeMap).toJson());
}

@Test
public void testStringLiteralToSql() {
Expr escape = new StringLiteral("\\");
Assertions.assertEquals("'\\\\'", escape.toSql());
}

@Test
public void testCompoundPredicateConvertEsDsl() {
SlotRef k1 = new SlotRef(null, "k1");
Expand Down

0 comments on commit 1c14cc6

Please sign in to comment.