xinyiZzz commented on code in PR #33264: URL: https://github.com/apache/doris/pull/33264#discussion_r1554535785
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java: ########## @@ -59,10 +72,74 @@ public ShowResultSetMetaData getMetaData() { return builder.build(); } + private String extractFilterValue(PartitionColumnFilter colFilter) { + + InPredicate inPredicate = colFilter.getInPredicate(); + if (null == inPredicate) { + // equal one value + if (colFilter.lowerBoundInclusive && colFilter.upperBoundInclusive + && colFilter.lowerBound != null && colFilter.upperBound != null + && 0 == colFilter.lowerBound.compareLiteral(colFilter.upperBound)) { + return colFilter.lowerBound.getStringValue(); + } + } + throw new AnalysisException("Only supports equalTo in filter for whereClause"); + } + + private void validateAndExtractFilters(StringBuilder dbFilter, StringBuilder procFilter) throws Exception { + Map<String, PartitionColumnFilter> filterMap = Maps.newHashMap(); + if (!this.whereExpr.isEmpty()) { + whereExpr.stream().map(ExpressionUtils::checkAndMaybeCommute).filter(Optional::isPresent) + .forEach(expr -> new ExpressionColumnFilterConverter(filterMap).convert(expr.get())); + } + // we support filter on Db and Name and ProcedureName. + // But one column we can put only once and support conjucts + for (Map.Entry<String, PartitionColumnFilter> 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"); Review Comment: Currently only support "Db", "Name", "ProcedureName" equals and `LIKE`, which can meet requirements. Ideally, parse whereClause like query to support any expression filter, is not necessary now. ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java: ########## @@ -59,10 +72,74 @@ public ShowResultSetMetaData getMetaData() { return builder.build(); } + private String extractFilterValue(PartitionColumnFilter colFilter) { + + InPredicate inPredicate = colFilter.getInPredicate(); + if (null == inPredicate) { + // equal one value + if (colFilter.lowerBoundInclusive && colFilter.upperBoundInclusive + && colFilter.lowerBound != null && colFilter.upperBound != null + && 0 == colFilter.lowerBound.compareLiteral(colFilter.upperBound)) { + return colFilter.lowerBound.getStringValue(); + } + } + throw new AnalysisException("Only supports equalTo in filter for whereClause"); Review Comment: "Only supports equalTo and Like in filter for whereClause" ########## fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java: ########## @@ -3432,7 +3468,18 @@ public LogicalPlan visitDropProcedure(DropProcedureContext ctx) { @Override public LogicalPlan visitShowProcedureStatus(ShowProcedureStatusContext ctx) { - return ParserUtils.withOrigin(ctx, () -> new ShowProcedureStatusCommand()); + Set<Expression> whereExpr = Collections.emptySet(); + if (ctx.whereClause() != null) { + whereExpr = ExpressionUtils.extractConjunctionToSet( + getExpression(ctx.whereClause().booleanExpression())); + } + Expression valueExpr = null; + if (ctx.valueExpression() != null) { + valueExpr = new Like(getExpression(ctx.valueExpression()), getExpression(ctx.pattern)); Review Comment: `showProcedureStatus` is `SHOW PROCEDURE STATUS (LIKE pattern=valueExpression | whereClause)?` whereClause contains `LIKE pattern=valueExpression`, what is the purpose of matching `LIKE` first? now `whereClause` only use to parse equal to, why not parse `LIKE`. -- 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