xinyiZzz commented on code in PR #33264: URL: https://github.com/apache/doris/pull/33264#discussion_r1570138914
########## 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 and Like 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"); + } + if (columnName.equals("Db")) { + if (dbFilter.length() != 0) { + throw new AnalysisException("Only supports filter Db only 1 time in where clause"); + } + dbFilter.append(extractFilterValue(elem.getValue())); + } else if ((columnName.equals("Name")) + || (columnName.equals("ProcedureName"))) { + if (procFilter.length() != 0) { + throw new AnalysisException("Only supports filter Name/ProcedureName only 1 time in where clause"); + } + procFilter.append(extractFilterValue(elem.getValue())); + } + } + } + + private String extractLikeFilter() { + String likeFilter = ""; + if (this.valueExpr == null) { + return likeFilter; + } + Map<String, PartitionColumnFilter> filterMap = Maps.newHashMap(); + new ExpressionColumnFilterConverter(filterMap) + .convert(this.valueExpr); + for (Map.Entry<String, PartitionColumnFilter> elem : filterMap.entrySet()) { + likeFilter = extractFilterValue(elem.getValue()); Review Comment: > this class is use for bucket prune. should not change anything about it morrySnow means that `ExpressionColumnFilterConverter` cannot be modified. -- 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