Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
Signed-off-by: shuming.li <[email protected]>
  • Loading branch information
LiShuMing committed Aug 26, 2024
1 parent 89fba9f commit 39d686a
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,17 @@ public void testRewriteWithPushDownEquivalent4() throws Exception {
"AS SELECT k1, k3, sum(k2) from tbl1 group by k1, k3");
// sum(decimal)
{
setTracLogModule("MV");
String sql = "select t1.k1, " +
" 2 * sum(case when t1.k1 between date_add('2024-07-20', interval -1 month) and " +
" date_add('2024-07-20', interval 1 month) then t1.k2 else 0 end) " +
" from tbl1 t1 group by t1.k1";
String plan = getFragmentPlan(sql, "MV");
String plan = getVerboseExplain(sql);
PlanTestBase.assertContains(plan, "mv1");
PlanTestBase.assertContains(plan, "| aggregate: sum[(if[((8: k1 >= '2024-06-20') AND " +
PlanTestBase.assertContains(plan, " | aggregate: sum[(if[((8: k1 >= '2024-06-20') AND " +
"(8: k1 <= '2024-08-20'), [10: sum(k2), DECIMAL128(38,2), true], cast(0 as DECIMAL128(38,2))); " +
"args: BOOLEAN,DECIMAL128,DECIMAL128; result: DECIMAL128(38,2); args nullable: true; " +
"result nullable: true]); args: DECIMAL128; result: DECIMAL128; args nullable: true; " +
"result nullable: true]");
"result nullable: true]); args: DECIMAL128; result: DECIMAL128(38,2); " +
"args nullable: true; result nullable: true]");
}
{
String sql = "select t1.k1, " +
Expand Down Expand Up @@ -530,9 +529,10 @@ public void testRewriteWithPushDownEquivalent5() throws Exception {
" from tbl1 t1 group by t1.k1";
String plan = getVerboseExplain(sql);
PlanTestBase.assertContains(plan, "mv1");
PlanTestBase.assertContains(plan, "aggregate: sum[(CASE WHEN (8: k1 >= '2024-06-20') " +
"AND (8: k1 <= '2024-08-20') THEN 10: sum(k2) WHEN 9: k3 = 'xxxx' THEN 10: sum(k2) ELSE 0 END); " +
"args: DECIMAL128; result: DECIMAL128; args nullable: true; result nullable: true]");
PlanTestBase.assertContains(plan, "| aggregate: sum[(CASE WHEN (8: k1 >= '2024-06-20') AND " +
"(8: k1 <= '2024-08-20') THEN 10: sum(k2) WHEN 9: k3 = 'xxxx' THEN 10: sum(k2) " +
"ELSE CAST(0 AS DECIMAL128(38,2)) END); args: DECIMAL128; result: DECIMAL128(38,2); " +
"args nullable: true; result nullable: true]");
}

{
Expand Down

0 comments on commit 39d686a

Please sign in to comment.