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

[fix](planner) fix orthogonal_bitmap_union_count planner : wrong PREAGGREGATION #12581

Merged
merged 4 commits into from
Sep 15, 2022
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
@@ -1,6 +1,6 @@
---
{
"title": "ADMIN-COPY-TABLET"
"title": "ADMIN-COPY-TABLET",
"language": "en"
}
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
{
"title": "ADMIN-COPY-TABLET"
"title": "ADMIN-COPY-TABLET",
"language": "zh-CN"
}
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ private void turnOffPreAgg(AggregateInfo aggInfo, SelectStmt selectStmt, Analyze
break;
}
} else if (aggExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION)
|| aggExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION_COUNT)) {
|| aggExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION_COUNT)
|| aggExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.ORTHOGONAL_BITMAP_UNION_COUNT)) {
if (col.getAggregationType() != AggregateType.BITMAP_UNION) {
turnOffReason =
"Aggregate Operator not match: BITMAP_UNION <--> " + col.getAggregationType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2159,4 +2159,27 @@ public void testOutJoinWithOnFalse() throws Exception {
Assert.assertFalse(explainString.contains("non-equal FULL OUTER JOIN is not supported"));

}
}

@Test
public void testPreaggregationOfOrthogonalBitmapUDAF() throws Exception {
connectContext.setDatabase("default_cluster:test");
createTable("CREATE TABLE test.bitmap_tb (\n"
+ " `id` int(11) NULL COMMENT \"\",\n"
+ " `id2` int(11) NULL COMMENT \"\",\n"
+ " `id3` bitmap bitmap_union NULL\n"
+ ") ENGINE=OLAP\n"
+ "AGGREGATE KEY(`id`,`id2`)\n"
+ "DISTRIBUTED BY HASH(`id`) BUCKETS 1\n"
+ "PROPERTIES (\n"
+ " \"replication_num\" = \"1\"\n"
+ ");");

String queryBaseTableStr = "explain select id,id2,orthogonal_bitmap_union_count(id3) from test.bitmap_tb t1 group by id,id2";
String explainString1 = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryBaseTableStr);
Assert.assertTrue(explainString1.contains("PREAGGREGATION: ON"));

String queryTableStr = "explain select id,orthogonal_bitmap_union_count(id3) from test.bitmap_tb t1 group by id";
String explainString2 = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryTableStr);
Assert.assertTrue(explainString2.contains("PREAGGREGATION: ON"));
}
}