xinyiZzz commented on code in PR #33264: URL: https://github.com/apache/doris/pull/33264#discussion_r1581804376
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java: ########## @@ -59,10 +68,53 @@ 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())); + + // we support filter on Db and Name and ProcedureName. + // But one column we can put only once and support conjuncts + for (Map.Entry<String, String> elem : filterMap.entrySet()) { + String columnName = elem.getKey(); + if ((!columnName.equals("Db")) && (!columnName.equals("Name")) && (!columnName.equals("ProcedureName"))) { + throw new AnalysisException("Only supports filter Db, Name, ProcedureName with equalTo or LIKE"); + } + if (columnName.equals("Db")) { + if (dbFilter.length() != 0) { + throw new AnalysisException("Only supports filter Db only 1 time in where clause"); + } + dbFilter.append(elem.getValue()); Review Comment: column name and value both are case insensitive, so modify to `elem.getValue().toLowerCase` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org