morrySnow commented on code in PR #15699:
URL: https://github.com/apache/doris/pull/15699#discussion_r1064147716
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/LogicalOlapScanToPhysicalOlapScan.java:
##########
@@ -59,7 +63,17 @@ public Rule build() {
}
private DistributionSpec convertDistribution(LogicalOlapScan olapScan) {
- DistributionInfo distributionInfo =
olapScan.getTable().getDefaultDistributionInfo();
+ OlapTable olapTable = olapScan.getTable();
+ DistributionInfo distributionInfo =
olapTable.getDefaultDistributionInfo();
+ ColocateTableIndex colocateTableIndex = Env.getCurrentColocateIndex();
+ if ((colocateTableIndex.isColocateTable(olapTable.getId())
+ &&
!colocateTableIndex.isGroupUnstable(colocateTableIndex.getGroup(olapTable.getId())))
+ || olapTable.getPartitionInfo().getType() ==
PartitionType.UNPARTITIONED
+ || olapTable.getPartitions().size() == 1) {
+ if (!(distributionInfo instanceof HashDistributionInfo)) {
+ return DistributionSpecAny.INSTANCE;
+ }
+ }
if (distributionInfo instanceof HashDistributionInfo) {
Review Comment:
we should return `DistributionSpecAny.INSTANCE` even if table's
`defaultDistributionInfo` is `HashDistributionInfo`, when we need to scan more
than one partition and table is not colocate table or not in a stable group.
##########
regression-test/suites/nereids_syntax_p0/scan_partition.groovy:
##########
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_scan_part") {
+ sql """DROP TABLE IF EXISTS test_part;"""
+ sql """CREATE TABLE test_part (
+ id INT,
+ i1 INT NOT NULL,
+ i2 VARCHAR(32) NOT NULL
+ ) DUPLICATE KEY(`id`)
+ PARTITION BY LIST(i2)
+ (
+ PARTITION p1 VALUES IN('1'),
+ PARTITION p2 VALUES IN('5'),
+ PARTITION p3 VALUES IN('9')
+ )
+ DISTRIBUTED BY HASH(`id`)
+ BUCKETS 3
+ PROPERTIES("replication_allocation" = "tag.location.default:1");
+ """
+ sql """INSERT INTO test_part VALUES (1, 1, '1');"""
+ sql """INSERT INTO test_part VALUES (1, 1, '1');"""
+ sql """INSERT INTO test_part VALUES (1, 5, '5');"""
+ sql """INSERT INTO test_part VALUES (1, 5, '5');"""
+ sql """INSERT INTO test_part VALUES (2, 5, '5');"""
+ sql """INSERT INTO test_part VALUES (3, 5, '1');"""
+ sql """INSERT INTO test_part VALUES (4, 5, '5');"""
+ sql """INSERT INTO test_part VALUES (7, 5, '9');"""
+ sql "SET enable_nereids_planner=true"
+ sql "SET enable_fallback_to_original_planner=false"
Review Comment:
should set `parallel_fragment_exec_instance_num` to `8`
--
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]