Skip to content

Commit

Permalink
revert the cost change for scan
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Jan 15, 2025
1 parent 79e7b5b commit e62146c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ public CostEstimate visitPhysicalOlapScan(PhysicalOlapScanOperator node, Express
}
}

// ScanOperator use a ChunkBuffer to implement async-io, which may takes significant memory for certain
// cases
SessionVariable variables = ConnectContext.get().getSessionVariable();
double memCost = (double) statistics.getAvgRowSize() * variables.getDegreeOfParallelism();
return CostEstimate.of(statistics.getComputeSize(), memCost, 0);
return CostEstimate.of(statistics.getComputeSize(), 0, 0);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ public void testExplain() throws Exception {
String sql = "explain (TYPE logical) select v1, v2 from t0,t1";
Assert.assertTrue(getExplain(sql), StringUtils.containsIgnoreCase(getExplain(sql),
"SCAN [t1] => [8:auto_fill_col]\n" +
" Estimates: {row: 1, cpu: 9.00, memory: 9.00, network: 0.00, cost: 22" +
" Estimates: {row: 1, cpu: 9.00, memory: 0.00, network: 0.00, cost: 4" +
".50}\n" +
" partitionRatio: 0/1, tabletRatio: 0/0\n" +
" 8:auto_fill_col := 1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2237,11 +2237,11 @@ public void testPlanCost() throws Exception {
System.out.println(plan);
assertContains(plan, "PLAN COST\n" +
" CPU: 4.80001312001E11\n" +
" Memory: 320241.0");
" Memory: 320201.0");

assertContains(getCostExplain(sql), "PLAN COST\n" +
" CPU: 4.80001312001E11\n" +
" Memory: 320241.0");
" Memory: 320201.0");

AuditEvent event = connectContext.getAuditEventBuilder().build();
Assert.assertTrue("planMemCosts should be > 1, but: " + event.planMemCosts, event.planMemCosts > 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void testMultiSubqueries() throws Exception {
public void testCorrelatedPredicateRewrite() throws Exception {
Pair<QueryDumpInfo, String> replayPair =
getPlanFragment(getDumpInfoFromFile("query_dump/union_with_subquery"), null, TExplainLevel.COSTS);
Assert.assertTrue(replayPair.second, replayPair.second.contains("1197:HASH JOIN\n" +
Assert.assertTrue(replayPair.second, replayPair.second.contains("1201:HASH JOIN\n" +
" | join op: RIGHT OUTER JOIN (BUCKET_SHUFFLE(S))\n" +
" | equal join conjunct: [3802: ref_id, BIGINT, true] = [3681: customer_id, BIGINT, true]"));
}
Expand Down

0 comments on commit e62146c

Please sign in to comment.