Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Opt](pipeline) disable shared scan in key point search #24797

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,51 @@ public boolean getShouldColoScan() {
return shouldColoScan;
}

@Override
// If scan is key search, should not enable the shared scan opt to prevent the performance problem
// 1. where contain the eq or in expr of key column slot
// 2. key column slot is distribution column and first column
public boolean isKeySearch() {
List<SlotRef> whereSlot = Lists.newArrayList();
for (Expr conjunct : conjuncts) {
if (conjunct instanceof BinaryPredicate) {
BinaryPredicate binaryPredicate = (BinaryPredicate) conjunct;
if (binaryPredicate.getOp().isEquivalence()) {
if (binaryPredicate.getChild(0) instanceof SlotRef) {
whereSlot.add((SlotRef) binaryPredicate.getChild(0));
}
if (binaryPredicate.getChild(1) instanceof SlotRef) {
whereSlot.add((SlotRef) binaryPredicate.getChild(1));
}
}
}

if (conjunct instanceof InPredicate) {
InPredicate inPredicate = (InPredicate) conjunct;
if (!inPredicate.isNotIn()) {
if (inPredicate.getChild(0) instanceof SlotRef) {
whereSlot.add((SlotRef) inPredicate.getChild(0));
}
if (inPredicate.getChild(1) instanceof SlotRef) {
whereSlot.add((SlotRef) inPredicate.getChild(1));
}
}
}
}

for (SlotRef slotRef : whereSlot) {
String columnName = slotRef.getDesc().getColumn().getName().toLowerCase();
if (olapTable != null) {
if (olapTable.getDistributionColumnNames().contains(columnName)
&& olapTable.getBaseSchema().get(0).getName().toLowerCase().equals(columnName)) {
return true;
}
}
}

return false;
}

@Override
protected void toThrift(TPlanNode msg) {
List<String> keyColumnNames = new ArrayList<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,8 @@ public static TScanRangeLocations createSingleScanRangeLocations(FederationBacke
scanRangeLocation.addToLocations(location);
return scanRangeLocation;
}

public boolean isKeySearch() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,7 @@ private void computeFragmentHosts() throws Exception {
if (!enablePipelineEngine || perNodeScanRanges.size() > parallelExecInstanceNum
|| (node.isPresent() && node.get().getShouldColoScan())
|| (node.isPresent() && node.get() instanceof FileScanNode)
|| (node.isPresent() && node.get().isKeySearch())
|| Config.disable_shared_scan || enablePipelineXEngine) {
int expectedInstanceNum = 1;
if (parallelExecInstanceNum > 1) {
Expand Down