github-actions[bot] commented on code in PR #62196:
URL: https://github.com/apache/doris/pull/62196#discussion_r3062820010
##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -664,10 +665,23 @@ public void checkBlockRulesByScan(Planner planner) throws
AnalysisException {
List<ScanNode> scanNodeList = planner.getScanNodes();
for (ScanNode scanNode : scanNodeList) {
if (scanNode instanceof OlapScanNode || scanNode instanceof
FileScanNode) {
+ boolean isPartitionedTable = false;
+ boolean hasPartitionPredicate = false;
+ if (scanNode instanceof OlapScanNode) {
+ OlapScanNode olapScanNode = (OlapScanNode) scanNode;
+ isPartitionedTable =
olapScanNode.getOlapTable().isPartitionedTable();
+ hasPartitionPredicate =
olapScanNode.hasPartitionPruningPredicate();
+ } else if (scanNode instanceof HiveScanNode) {
+ HiveScanNode hiveScanNode = (HiveScanNode) scanNode;
+ isPartitionedTable =
!hiveScanNode.getPathPartitionKeys().isEmpty();
+ hasPartitionPredicate =
hiveScanNode.hasPartitionPredicate();
+ }
Env.getCurrentEnv().getSqlBlockRuleMgr().checkLimitations(
scanNode.getSelectedPartitionNum(),
scanNode.getSelectedSplitNum(),
scanNode.getCardinality(),
+ isPartitionedTable,
+ hasPartitionPredicate,
Review Comment:
This still runs before the Nereids `EXPLAIN` fast path. In
`executeByNereids`, `planner.plan(...)` and `checkBlockRulesByScan(planner)`
happen before `handleQueryStmt()` returns early for `queryStmt.isExplain()`, so
a global `require_partition_filter` rule can reject `EXPLAIN SELECT * FROM
partitioned_tbl`. That contradicts the PR description and the regression
comments that say `EXPLAIN` must remain allowed.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSqlBlockRuleCommand.java:
##########
@@ -70,10 +70,14 @@ public void setProperties(Map<String, String> properties)
throws AnalysisExcepti
String partitionNumString = properties.get(SCANNED_PARTITION_NUM);
String tabletNumString = properties.get(SCANNED_TABLET_NUM);
String cardinalityString = properties.get(SCANNED_CARDINALITY);
+ String requirePartitionFilterString =
properties.get(REQUIRE_PARTITION_FILTER_PROPERTY);
+ this.requirePartitionFilter =
StringUtils.isNotEmpty(requirePartitionFilterString)
+ ? Boolean.parseBoolean(requirePartitionFilterString) : null;
Review Comment:
`Boolean.parseBoolean()` silently maps any non-`true` string to `false`.
That means `ALTER SQL_BLOCK_RULE ... PROPERTIES("require_partition_filter" =
"not_a_bool")` will clear the flag instead of rejecting invalid input. `CREATE
SQL_BLOCK_RULE` already uses `Util.getBooleanPropertyOrDefault(...)` here, so
`ALTER` should validate the new property the same way.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java:
##########
@@ -125,6 +125,10 @@ public HiveScanNode(PlanNodeId id, TupleDescriptor desc,
String planNodeName,
this.directoryLister = directoryLister;
}
+ public boolean hasPartitionPredicate() {
+ return selectedPartitions != null &&
selectedPartitions.hasPartitionPredicate;
Review Comment:
This only works for Nereids. The field comment directly above says
`selectedPartitions` is only populated in Nereids and stays `null` in the
legacy planner, so `hasPartitionPredicate()` is always `false` there. With
`enable_nereids_planner=false`, a partitioned Hive query like `... WHERE pt1 =
a` will still hit `missing partition filter` even though the scan is pruned
correctly.
--
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]