[fix](JdbcCatalog) fix that the predicate column name does not have back quote when querying the JDBC appearance (#26479)

This commit is contained in:
Tiewei Fang
2023-11-10 09:54:39 +08:00
committed by GitHub
parent 328e5b120b
commit 49cffd0bc9
7 changed files with 29 additions and 3 deletions

View File

@ -353,6 +353,19 @@ public class JdbcScanNode extends ExternalScanNode {
return filter;
}
if (expr.contains(SlotRef.class) && expr instanceof BinaryPredicate) {
ArrayList<Expr> children = expr.getChildren();
String filter;
if (children.get(0) instanceof SlotRef) {
filter = JdbcTable.databaseProperName(tableType, children.get(0).toMySql());
} else {
filter = children.get(0).toMySql();
}
filter += " " + ((BinaryPredicate) expr).getOp().toString() + " ";
filter += children.get(1).toMySql();
return filter;
}
// only for old planner
if (expr.contains(BoolLiteral.class) && "1".equals(expr.getStringValue()) && expr.getChildren().isEmpty()) {
return "1 = 1";