Skip to content

Commit

Permalink
branch-3.0: [fix](external) fix count(*) performance fallback in exte…
Browse files Browse the repository at this point in the history
…rnal table query #44172 (#44193)

Cherry-picked from #44172

Co-authored-by: Mingyu Chen (Rayner) <morningman@163.com>
  • Loading branch information
github-actions[bot] and morningman authored Nov 18, 2024
1 parent b0244ff commit 984b47d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public void createScanRangeLocations() throws UserException {
location.setServer(new TNetworkAddress(backend.getHost(), backend.getBePort()));
curLocations.addToLocations(location);
scanRangeLocations.add(curLocations);
scanBackendIds.add(backendId);
return;
}
}
Expand Down Expand Up @@ -346,6 +347,7 @@ public void createScanRangeLocations() throws UserException {
// However, even one ScanNode instance can provide maximum scanning concurrency.
scanRangeLocations.add(curLocations);
setLocationPropertiesIfNecessary(backend, locationType, locationProperties);
scanBackendIds.add(backend.getId());
}
} else {
List<Split> inputSplits = getSplits();
Expand All @@ -363,6 +365,7 @@ public void createScanRangeLocations() throws UserException {
scanRangeLocations.add(splitToScanRange(backend, locationProperties, split, pathPartitionKeys));
totalFileSize += split.getLength();
}
scanBackendIds.add(backend.getId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ public class OlapScanNode extends ScanNode {
private Set<Long> sampleTabletIds = Sets.newHashSet();
private TableSample tableSample;

private HashSet<Long> scanBackendIds = new HashSet<>();

private Map<Long, Integer> tabletId2BucketSeq = Maps.newHashMap();
// a bucket seq may map to many tablets, and each tablet has a
// TScanRangeLocations.
Expand Down Expand Up @@ -1919,9 +1917,4 @@ public boolean pushDownAggNoGroupingCheckCol(FunctionCallExpr aggExpr, Column co
public int getScanRangeNum() {
return getScanTabletIds().size();
}

@Override
public int numScanBackends() {
return scanBackendIds.size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public abstract class ScanNode extends PlanNode implements SplitGenerator {

protected TableSnapshot tableSnapshot;

// Save the id of backends which this scan node will be executed on.
// This is also important for local shuffle logic.
// Now only OlapScanNode and FileQueryScanNode implement this.
protected HashSet<Long> scanBackendIds = new HashSet<>();

public ScanNode(PlanNodeId id, TupleDescriptor desc, String planNodeName, StatisticalType statisticalType) {
super(id, desc.getId().asList(), planNodeName, statisticalType);
this.desc = desc;
Expand Down Expand Up @@ -731,7 +736,7 @@ && getScanRangeNum()
}

public int numScanBackends() {
return 0;
return scanBackendIds.size();
}

public int getScanRangeNum() {
Expand Down

0 comments on commit 984b47d

Please sign in to comment.