@@ -1184,18 +1184,22 @@ public void testJoin() throws Exception {
11841184 " union select 1,2\n " +
11851185 " ) sys" ;
11861186 plan = getFragmentPlan (sql );
1187- assertContains (plan , plan , " 20:AGGREGATE (update serialize)\n "
1188- + " | STREAMING\n "
1189- + " | group by: 32: cast, 33: cast\n "
1190- + " | \n "
1191- + " 0:UNION\n "
1192- + " | \n "
1193- + " |----19:EXCHANGE\n "
1194- + " | \n "
1195- + " 16:EXCHANGE" );
1187+ assertContains (plan , plan , " 20:AGGREGATE (update serialize)\n " +
1188+ " | STREAMING\n " +
1189+ " | group by: 32: cast, 33: cast\n " +
1190+ " | \n " +
1191+ " 0:UNION\n " +
1192+ " | \n " +
1193+ " |----19:EXCHANGE\n " +
1194+ " | \n " +
1195+ " 16:Decode\n " +
1196+ " | <dict id 38> : <string id 25>\n " +
1197+ " | <dict id 39> : <string id 26>\n " +
1198+ " | \n " +
1199+ " 15:EXCHANGE" );
11961200 assertContains (plan , plan , "Decode" );
11971201 plan = getThriftPlan (sql );
1198- assertNotContains (plan .split ("\n " )[1 ], "query_global_dicts" );
1202+ assertContains (plan .split ("\n " )[1 ], "query_global_dicts" );
11991203 }
12001204
12011205 @ Test
@@ -1296,9 +1300,6 @@ public void testAnalytic() throws Exception {
12961300 "select row_number() over( partition by L_COMMENT order by L_PARTKEY) as rm from lineitem" +
12971301 ") t where rm < 10" ;
12981302 plan = getCostExplain (sql );
1299- assertContains (plan , " 4:Decode\n " +
1300- " | <dict id 20> : <string id 16>" );
1301-
13021303 assertContains (plan , " 3:ANALYTIC\n " +
13031304 " | functions: [, row_number[(); args: ; result: BIGINT; " +
13041305 "args nullable: false; result nullable: true], ]\n " +
@@ -1310,7 +1311,7 @@ public void testAnalytic() throws Exception {
13101311 sql = "select * from (select L_COMMENT,l_quantity, row_number() over " +
13111312 "(partition by L_COMMENT order by l_quantity desc) rn from lineitem )t where rn <= 10;" ;
13121313 plan = getCostExplain (sql );
1313- assertContains (plan , " 4 :Decode\n " +
1314+ assertContains (plan , " 5 :Decode\n " +
13141315 " | <dict id 19> : <string id 16>" );
13151316 assertContains (plan , " 3:ANALYTIC\n " +
13161317 " | functions: [, row_number[(); args: ; result: BIGINT; " +
@@ -1323,7 +1324,7 @@ public void testAnalytic() throws Exception {
13231324 sql = "select * from (select L_COMMENT,l_quantity, rank() over " +
13241325 "(partition by L_COMMENT order by l_quantity desc) rn from lineitem )t where rn <= 10;" ;
13251326 plan = getCostExplain (sql );
1326- assertContains (plan , " 4 :Decode\n " +
1327+ assertContains (plan , " 5 :Decode\n " +
13271328 " | <dict id 19> : <string id 16>" );
13281329 assertContains (plan , " 3:ANALYTIC\n " +
13291330 " | functions: [, rank[(); args: ; result: BIGINT; " +
@@ -1336,7 +1337,7 @@ public void testAnalytic() throws Exception {
13361337 sql = "select * from (select L_COMMENT,l_quantity, rank() over " +
13371338 "(partition by L_COMMENT, l_shipmode order by l_quantity desc) rn from lineitem )t where rn <= 10;" ;
13381339 plan = getCostExplain (sql );
1339- assertContains (plan , " 4 :Decode\n " +
1340+ assertContains (plan , " 6 :Decode\n " +
13401341 " | <dict id 19> : <string id 16>" );
13411342 assertContains (plan , " 3:ANALYTIC\n " +
13421343 " | functions: [, rank[(); args: ; result: BIGINT; " +
@@ -1524,7 +1525,7 @@ public void testSubqueryWithLimit() throws Exception {
15241525 String sql = "select t0.S_ADDRESS from (select S_ADDRESS, S_NATIONKEY from supplier_nullable limit 10) t0" +
15251526 " inner join supplier on t0.S_NATIONKEY = supplier.S_NATIONKEY;" ;
15261527 String plan = getVerboseExplain (sql );
1527- assertContains (plan , " 2 :Decode\n " +
1528+ assertContains (plan , " 7 :Decode\n " +
15281529 " | <dict id 17> : <string id 3>\n " );
15291530 }
15301531
@@ -1560,16 +1561,17 @@ public void testAssignWrongNullableProperty() throws Exception {
15601561 sql = "select S_ADDRESS, S_COMMENT from (select S_ADDRESS, " +
15611562 "S_COMMENT from supplier_nullable order by S_COMMENT limit 10) tb where S_ADDRESS = 'SS' order by S_ADDRESS " ;
15621563 plan = getFragmentPlan (sql );
1563- assertContains (plan , " 5 :SORT\n " +
1564- " | order by: <slot 3> 3 : S_ADDRESS ASC\n " +
1564+ assertContains (plan , " 4 :SORT\n " +
1565+ " | order by: <slot 9> 9 : S_ADDRESS ASC\n " +
15651566 " | offset: 0\n " +
15661567 " | \n " +
1567- " 4:SELECT\n " +
1568- " | predicates: 3: S_ADDRESS = 'SS'\n " +
1569- " | \n " +
1570- " 3:Decode\n " +
1568+ " 3:SELECT\n " +
1569+ " | predicates: DictDecode(9: S_ADDRESS, [<place-holder> = 'SS'])" );
1570+ assertContains (plan , " 6:Decode\n " +
15711571 " | <dict id 9> : <string id 3>\n " +
1572- " | <dict id 10> : <string id 7>" );
1572+ " | <dict id 10> : <string id 7>\n " +
1573+ " | \n " +
1574+ " 5:MERGING-EXCHANGE" );
15731575 }
15741576
15751577 @ Test
@@ -2167,7 +2169,7 @@ public void testShuffleJoinOn2() throws Exception {
21672169 "where l1 = 'BJ'" ;
21682170 String plan = getFragmentPlan (sql );
21692171 // TODO: rewrite physical operator
2170- assertContains (plan , " 9 :Decode\n " +
2172+ assertContains (plan , " 10 :Decode\n " +
21712173 " | <dict id 22> : <string id 12>" );
21722174 }
21732175
@@ -2351,19 +2353,19 @@ public void testWindowFunction() throws Exception {
23512353 "WHERE\n " +
23522354 " t.row_num = 1;" ;
23532355 String plan = getVerboseExplain (sql );
2354- assertContains (plan , " 7:Decode\n " +
2355- " | <dict id 12> : <string id 3>\n " +
2356- " | <dict id 13> : <string id 9>\n " +
2357- " | <dict id 14> : <string id 11>\n " +
2356+ assertContains (plan , " 7:SELECT\n " +
2357+ " | predicates: 10: row_number() = 1\n " +
23582358 " | cardinality: 1\n " +
23592359 " | \n " +
23602360 " 6:ANALYTIC\n " +
2361- " | functions: [, row_number[(); args: ; result: BIGINT; " +
2362- "args nullable: false; result nullable: true], ]\n " +
2361+ " | functions: [, row_number[(); args: ; result: BIGINT; args nullable: false; result nullable: true], ]\n " +
23632362 " | partition by: [12: S_ADDRESS, INT, false]\n " +
23642363 " | order by: [12: S_ADDRESS, INT, false] ASC\n " +
23652364 " | window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW\n " +
23662365 " | cardinality: 1" );
2366+ assertContains (plan , " 9:Decode\n " +
2367+ " | <dict id 12> : <string id 3>\n " +
2368+ " | <dict id 13> : <string id 9>" );
23672369 }
23682370
23692371 @ Test
@@ -2849,4 +2851,22 @@ public void testCreateDecodeInfoDoesNotReturnSharedMutableSingleton() {
28492851 Assertions .assertTrue (d2 .getInputStringColumns ().isEmpty ());
28502852 Assertions .assertTrue (d2 .getDecodeStringColumns ().isEmpty ());
28512853 }
2854+
2855+ @ Test
2856+ public void testPhysicalFilter () throws Exception {
2857+ String sql = """
2858+ SELECT *
2859+ FROM (
2860+ SELECT
2861+ MAX(C_USER) OVER (PARTITION BY C_DEPT) max_user
2862+ FROM
2863+ low_card_t1
2864+ ) cte
2865+ WHERE max_user != 'abc'
2866+ """ ;
2867+ String plan = getVerboseExplain (sql );
2868+ assertContains (plan , " 3:SELECT\n " +
2869+ " | predicates: DictDecode(15: max(2: c_user), [<place-holder> != 'abc'])\n " +
2870+ " | cardinality: 1" , plan );
2871+ }
28522872}
0 commit comments