[fix](es catalog) only es_query function can push down to ES (#29320)
Issue Number: close #29318 1. Only push down `es_query` function to ES 2. Add null check where ES query result not have `_source` or `fields` fields.
This commit is contained in:
@ -209,11 +209,8 @@ public final class QueryBuilders {
|
||||
// }');
|
||||
// The first child k1 compatible with expr syntax
|
||||
FunctionCallExpr functionCallExpr = (FunctionCallExpr) expr;
|
||||
if ("esquery".equals(functionCallExpr.getFnName().getFunction())) {
|
||||
String stringValue = functionCallExpr.getChild(1).getStringValue();
|
||||
return new QueryBuilders.EsQueryBuilder(stringValue);
|
||||
}
|
||||
return null;
|
||||
String stringValue = functionCallExpr.getChild(1).getStringValue();
|
||||
return new QueryBuilders.EsQueryBuilder(stringValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,7 +273,14 @@ public final class QueryBuilders {
|
||||
return parseInPredicate(expr, column, needDateCompat);
|
||||
}
|
||||
if (expr instanceof FunctionCallExpr) {
|
||||
return parseFunctionCallExpr(expr);
|
||||
FunctionCallExpr functionCallExpr = (FunctionCallExpr) expr;
|
||||
// current only esquery functionCallExpr can be push down to ES
|
||||
if (!"esquery".equals(functionCallExpr.getFnName().getFunction())) {
|
||||
notPushDownList.add(expr);
|
||||
return null;
|
||||
} else {
|
||||
return parseFunctionCallExpr(expr);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user