Vallishp commented on code in PR #33264:
URL: https://github.com/apache/doris/pull/33264#discussion_r1582089789
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java:
##########
@@ -59,10 +71,56 @@ public ShowResultSetMetaData getMetaData() {
return builder.build();
}
+ private void validateAndExtractFilters(StringBuilder dbFilter,
StringBuilder procFilter) throws Exception {
+
+ if (whereExpr.isEmpty()) {
+ return;
+ }
+ Set<Expression> likeSet =
whereExpr.stream().filter(Like.class::isInstance).collect(Collectors.toSet());
+ Set<Expression> equalTo =
whereExpr.stream().filter(EqualTo.class::isInstance).collect(Collectors.toSet());
+
+ if (whereExpr.size() != likeSet.size() + equalTo.size()) {
+ throw new AnalysisException("Only support equalTo and Like
filters.");
+ }
+
+ equalTo.addAll(likeSet);
+
+ Map<String, String> filterMap = equalTo.stream()
+ .collect(Collectors.toMap(exp -> ((Slot)
exp.child(0)).getName(),
+ exp -> ((Literal) exp.child(1)).getStringValue()));
Review Comment:
> it u only allow one predicate for one column. u should check it first. or
u should use multi map here. otherwise toMap will throw duplicate key
exception. btw, doris' column name is case insensitive, so u should use ci key
map.
Thanks for your comments. we support only one predicate for one column. so
i have added exception, and change map values to lowercase.
testcase:
mysql> SET enable_fallback_to_original_planner=false;
Query OK, 0 rows affected (0.01 sec)
mysql> show procedure status where Name ="TEST_PLSQL_SHOW_PROC1" and name
LIKE "TEST";
ERROR 1105 (HY000): errCode = 2, detailMessage = WhereClause can contain one
predicate for one column.
mysql> show procedure status where db ="TEST_PLSQL_SHOW_PROC1" and DB LIKE
"TEST";
ERROR 1105 (HY000): errCode = 2, detailMessage = WhereClause can contain one
predicate for one column.
mysql>
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]