From c0a41dc0f881c6b3bbe2c6a36949c7d8f5be9215 Mon Sep 17 00:00:00 2001 From: minghong Date: Fri, 8 Sep 2023 16:25:35 +0800 Subject: [PATCH] [fix](nereids) external scan use STORAGE_ANY instead of ANY as distibution (#24039) --- .../properties/ChildOutputPropertyDeriver.java | 16 +++++++++++++--- .../trees/plans/physical/PhysicalJdbcScan.java | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java index 33df7657fa88fe..e0b3e05a7500d2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java @@ -125,17 +125,27 @@ public PhysicalProperties visitPhysicalEmptyRelation(PhysicalEmptyRelation empty @Override public PhysicalProperties visitPhysicalEsScan(PhysicalEsScan esScan, PlanContext context) { - return PhysicalProperties.ANY; + return PhysicalProperties.STORAGE_ANY; } @Override public PhysicalProperties visitPhysicalFileScan(PhysicalFileScan fileScan, PlanContext context) { - return PhysicalProperties.ANY; + return PhysicalProperties.STORAGE_ANY; } + /** + * TODO return ANY after refactor coordinator + * return STORAGE_ANY not ANY, in order to generate distribute on jdbc scan. + * select * from (select * from external.T) as A union all (select * from external.T) + * if visitPhysicalJdbcScan returns ANY, the plan is + * union + * |--- JDBCSCAN + * +--- JDBCSCAN + * this breaks coordinator assumption that one fragment has at most only one scan. + */ @Override public PhysicalProperties visitPhysicalJdbcScan(PhysicalJdbcScan jdbcScan, PlanContext context) { - return PhysicalProperties.ANY; + return PhysicalProperties.STORAGE_ANY; } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalJdbcScan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalJdbcScan.java index 0b81c5f44b6f2e..d68a459bd3799c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalJdbcScan.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalJdbcScan.java @@ -48,8 +48,8 @@ public class PhysicalJdbcScan extends PhysicalCatalogRelation { */ public PhysicalJdbcScan(RelationId id, TableIf table, List qualifier, Optional groupExpression, LogicalProperties logicalProperties, Set conjuncts) { - super(id, PlanType.PHYSICAL_JDBC_SCAN, table, qualifier, groupExpression, logicalProperties); - this.conjuncts = ImmutableSet.copyOf(Objects.requireNonNull(conjuncts, "conjuncts should not be null")); + this(id, table, qualifier, groupExpression, logicalProperties, + null, null, conjuncts); } /**