http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test
index 0ef95b0..8c25730 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/analytic-fns.test
@@ -5,6 +5,8 @@ max(tinyint_col) over(partition by int_col)
 from functional.alltypes
 group by int_col, tinyint_col
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:EXCHANGE [UNPARTITIONED]
 |
 03:ANALYTIC
@@ -32,6 +34,8 @@ max(int_col) over(partition by int_col, bool_col),
 max(int_col) over(partition by int_col, tinyint_col)
 from functional.alltypes
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:EXCHANGE [UNPARTITIONED]
 |
 04:ANALYTIC
@@ -60,6 +64,8 @@ max(int_col) over(partition by int_col),
 min(int_col) over(order by int_col)
 from functional.alltypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:ANALYTIC
 |  functions: min(int_col)
 |  order by: int_col ASC
@@ -78,6 +84,8 @@ from functional.alltypes
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:ANALYTIC
 |  functions: min(int_col)
 |  order by: int_col ASC
@@ -115,6 +123,8 @@ max(int_col) over(partition by int_col order by bigint_col),
 max(int_col) over(partition by int_col order by bigint_col desc)
 from functional.alltypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 08:ANALYTIC
 |  functions: max(int_col)
 |  partition by: bool_col
@@ -155,6 +165,8 @@ from functional.alltypes
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 11:EXCHANGE [UNPARTITIONED]
 |
 08:ANALYTIC
@@ -226,6 +238,8 @@ min(int_col) over(partition by int_col, smallint_col order 
by bigint_col),
 max(int_col) over(partition by int_col, smallint_col order by int_col)
 from functional.alltypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 11:ANALYTIC
 |  functions: min(int_col), max(int_col)
 |  order by: bigint_col ASC
@@ -276,6 +290,8 @@ from functional.alltypes
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 11:ANALYTIC
 |  functions: min(int_col), max(int_col)
 |  order by: bigint_col ASC
@@ -336,12 +352,16 @@ from functional.alltypes
 # basic analytic with default window and no partition/ordering
 select count(*) over() from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:ANALYTIC
 |  functions: count(*)
 |
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:ANALYTIC
 |  functions: count(*)
 |
@@ -354,6 +374,8 @@ select count(*) over() from functional.alltypesagg
 select tinyint_col, sum(bigint_col) over(partition by tinyint_col) 
sum_of_bigints
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: sum(bigint_col)
 |  partition by: tinyint_col
@@ -364,6 +386,8 @@ from functional.alltypesagg
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 02:ANALYTIC
@@ -381,6 +405,8 @@ from functional.alltypesagg
 # basic analytic with default window and ordering
 select int_col, rank() over(order by int_col) from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: rank()
 |  order by: int_col ASC
@@ -392,6 +418,8 @@ select int_col, rank() over(order by int_col) from 
functional.alltypesagg
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: rank()
 |  order by: int_col ASC
@@ -413,6 +441,8 @@ select bigint_col, count(double_col)
 from functional.alltypesagg
 limit 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: count(double_col)
 |  partition by: tinyint_col + 1, double_col / 2
@@ -426,6 +456,8 @@ limit 10
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |  limit: 10
 |
@@ -463,6 +495,8 @@ avg(double_col)
 from functional.alltypes
 limit 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 05:ANALYTIC
 |  functions: avg(double_col)
 |  order by: int_col DESC
@@ -490,6 +524,8 @@ limit 10
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:ANALYTIC
 |  functions: avg(double_col)
 |  order by: int_col DESC
@@ -528,6 +564,8 @@ select a.tinyint_col, a.int_col, count(a.double_col)
 from functional.alltypes a inner join functional.alltypessmall b on a.id = b.id
 order by a.tinyint_col, a.int_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 05:SORT
 |  order by: tinyint_col ASC, int_col ASC
 |
@@ -551,6 +589,8 @@ order by a.tinyint_col, a.int_col
    partitions=24/24 files=24 size=478.45KB
    runtime filters: RF000 -> a.id
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 08:MERGING-EXCHANGE [UNPARTITIONED]
 |  order by: tinyint_col ASC, int_col ASC
 |
@@ -596,6 +636,8 @@ from functional.alltypes
 group by 1
 order by 1, 2, 3
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:SORT
 |  order by: bool_col ASC, sum(min(int_col)) ASC, max(sum(bigint_col)) ASC
 |
@@ -624,6 +666,8 @@ order by 1, 2, 3
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 10:MERGING-EXCHANGE [UNPARTITIONED]
 |  order by: bool_col ASC, sum(min(int_col)) ASC, max(sum(bigint_col)) ASC
 |
@@ -700,6 +744,8 @@ min(int_col)
   rows between unbounded preceding and 2 following)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 10:ANALYTIC
 |  functions: count(double_col), last_value(double_col)
 |  partition by: tinyint_col, double_col
@@ -754,6 +800,8 @@ from functional.alltypesagg
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 12:EXCHANGE [UNPARTITIONED]
 |
 10:ANALYTIC
@@ -829,6 +877,8 @@ sum(smallint_col)
   rows between 2 preceding and 2 following)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:ANALYTIC
 |  functions: sum(tinyint_col)
 |  order by: int_col DESC
@@ -862,6 +912,8 @@ from functional.alltypesagg
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 07:ANALYTIC
 |  functions: sum(tinyint_col)
 |  order by: int_col DESC
@@ -912,6 +964,8 @@ select double_col, a, b, a + b, double_col + a from
      (select * from functional.alltypes) v1) v2
 order by 2, 3, 4
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:SORT
 |  order by: a ASC, b ASC, a + b ASC
 |
@@ -928,6 +982,8 @@ order by 2, 3, 4
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:SORT
 |  order by: a ASC, b ASC, a + b ASC
 |
@@ -959,6 +1015,8 @@ with v2 as
 select double_col, a, b, a + b, double_col + a from v2
 order by 2, 3, 4
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:SORT
 |  order by: a ASC, b ASC, a + b ASC
 |
@@ -975,6 +1033,8 @@ order by 2, 3, 4
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:SORT
 |  order by: a ASC, b ASC, a + b ASC
 |
@@ -1007,6 +1067,8 @@ select b from
    from functional.alltypes) v
 where e < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 05:SELECT
 |  predicates: count(1) < 10
 |
@@ -1029,6 +1091,8 @@ where e < 10
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 08:EXCHANGE [UNPARTITIONED]
 |
 05:SELECT
@@ -1068,6 +1132,8 @@ union all
  from functional.alltypestiny)
 order by 1 desc nulls first
 ---- PLAN
+PLAN-ROOT SINK
+|
 12:SORT
 |  order by: min(id) OVER(...) DESC NULLS FIRST
 |
@@ -1110,6 +1176,8 @@ order by 1 desc nulls first
 09:SCAN HDFS [functional.alltypestiny]
    partitions=4/4 files=4 size=460B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 18:MERGING-EXCHANGE [UNPARTITIONED]
 |  order by: min(id) OVER(...) DESC NULLS FIRST
 |
@@ -1172,6 +1240,8 @@ where int_col in
   (select min(bigint_col) over(partition by bool_col)
    from functional.alltypestiny t2 where t2.id < 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [LEFT SEMI JOIN]
 |  hash predicates: int_col = min(bigint_col)
 |  runtime filters: RF000 <- min(bigint_col)
@@ -1191,6 +1261,8 @@ where int_col in
    partitions=4/4 files=4 size=6.32KB
    runtime filters: RF000 -> int_col
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 07:EXCHANGE [UNPARTITIONED]
 |
 04:HASH JOIN [LEFT SEMI JOIN, BROADCAST]
@@ -1247,6 +1319,8 @@ where
   v.a != v.e and
   v.b != v.c
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:SELECT
 |  predicates: min(int_col) < 1, max(int_col) < 2, bigint_col > 10, 
count(int_col) < 3, sum(int_col) < 4, avg(int_col) < 5, min(int_col) != 
count(int_col), min(int_col) != avg(int_col), max(int_col) != count(int_col), 
count(int_col) < bigint_col + 3, sum(int_col) < bigint_col + 4, min(int_col) < 
bigint_col + 1, max(int_col) < bigint_col + 2, avg(int_col) < bigint_col + 5
 |
@@ -1279,6 +1353,8 @@ where
    partitions=24/24 files=24 size=478.45KB
    predicates: int_col <= 10, int_col >= 5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 07:SELECT
 |  predicates: min(int_col) < 1, max(int_col) < 2, bigint_col > 10, 
count(int_col) < 3, sum(int_col) < 4, avg(int_col) < 5, min(int_col) != 
count(int_col), min(int_col) != avg(int_col), max(int_col) != count(int_col), 
count(int_col) < bigint_col + 3, sum(int_col) < bigint_col + 4, min(int_col) < 
bigint_col + 1, max(int_col) < bigint_col + 2, avg(int_col) < bigint_col + 5
 |
@@ -1330,6 +1406,8 @@ inner join functional.alltypes t2
 on (t1.id = t2.id and t1.a = t2.int_col)
 where t2.id < 10 and t2.int_col < 20
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [INNER JOIN]
 |  hash predicates: id = t2.id, sum(int_col) = t2.int_col
 |
@@ -1362,6 +1440,8 @@ left outer join functional.alltypes t2
 on (t1.id = t2.id and t1.a = t2.int_col)
 where t2.id < 10 and t2.int_col < 20
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: id = t2.id, sum(int_col) = t2.int_col
 |  other predicates: t2.id < 10, t2.int_col < 20
@@ -1387,6 +1467,8 @@ select
 row_number() over(partition by tinyint_col order by id)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: row_number()
 |  partition by: tinyint_col
@@ -1410,6 +1492,8 @@ lead(int_col, 8, 20) over(partition by int_col order by 
id),
 lag(int_col, 8, 20) over(partition by int_col order by id)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 09:ANALYTIC
 |  functions: lag(int_col, 8, 20)
 |  partition by: int_col
@@ -1478,6 +1562,8 @@ count(bigint_col) over(partition by tinyint_col order by 
id
 #                       range between unbounded preceding and 10 following)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 08:ANALYTIC
 |  functions: count(bigint_col)
 |  partition by: tinyint_col
@@ -1544,6 +1630,8 @@ first_value(tinyint_col ignore nulls) over (order by id
                                             rows between 1 following and 2 
following)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 09:ANALYTIC
 |  functions: last_value_ignore_nulls(tinyint_col)
 |  order by: id DESC
@@ -1607,6 +1695,8 @@ last_value(bigint_col) over(partition by tinyint_col 
order by id
                             range between unbounded preceding and unbounded 
following)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 08:ANALYTIC
 |  functions: last_value(bigint_col)
 |  partition by: tinyint_col
@@ -1654,6 +1744,8 @@ select DENSE_RANK() OVER (ORDER BY t1.day ASC)
 FROM functional.alltypesagg t1
 WHERE EXISTS (SELECT t1.year AS int_col_1 FROM functional.alltypesagg t1)
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:ANALYTIC
 |  functions: dense_rank()
 |  order by: day ASC
@@ -1682,6 +1774,8 @@ FROM (
   FROM functional.alltypes t1 ) t1
 WHERE id IS NULL and tinyint_col != 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -1705,6 +1799,8 @@ WHERE id IS NULL and tinyint_col != 5
    partitions=4/4 files=4 size=460B
    predicates: t1.id IS NULL, t1.tinyint_col != 5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 10:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |
@@ -1747,6 +1843,8 @@ select * from
    from functional.alltypes) v
 where year = 2009 and id = 1 and int_col < 10 and s = 4
 ---- PLAN
+PLAN-ROOT SINK
+|
 03:SELECT
 |  predicates: id = 1, int_col < 10, sum(int_col) = 4
 |
@@ -1775,6 +1873,8 @@ select * from
    from functional.alltypes) v
 where year = 2009 and tinyint_col + 1 = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 09:SELECT
 |  predicates: tinyint_col + 1 = 1
 |
@@ -1826,6 +1926,8 @@ select * from
    from functional.alltypes) v
 where year = 2009 and tinyint_col = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:SELECT
 |  predicates: tinyint_col = 1, year = 2009
 |
@@ -1866,6 +1968,8 @@ select * from
    from functional.alltypestiny where id = tinyint_col) v
 where month = int_col and int_col = 1 and tinyint_col = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 03:SELECT
 |  predicates: month = int_col
 |
@@ -1894,6 +1998,8 @@ select * from
    on t1.id = t2.id) v
 where v.x + v.y < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 05:SELECT
 |  predicates: tinyint_col + int_col < 10
 |
@@ -1928,6 +2034,8 @@ select * from
    from functional.alltypestiny) v
 where x = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 03:SELECT
 |  predicates: int_col + 1 = 1
 |
@@ -1964,6 +2072,8 @@ left outer join
    from functional.alltypestiny) t2
 on (t1.id = t2.a + 100)
 ---- PLAN
+PLAN-ROOT SINK
+|
 08:ANALYTIC
 |  functions: avg(if(TupleIsNull(), NULL, coalesce(id + bigint_col, 40)))
 |  order by: if(TupleIsNull(), NULL, coalesce(bigint_col, 30)) ASC
@@ -2023,6 +2133,8 @@ from
   on (t1.id = t2.a + 100)) t3
 group by d
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:AGGREGATE [FINALIZE]
 |  output: avg(sum(t1.id)), sum(avg(g)), count(id)
 |  group by: if(TupleIsNull(), NULL, coalesce(int_col, 20))
@@ -2090,6 +2202,8 @@ full outer join
    on (c.id = v3.id)) v4
 on (v2.id = v4.id)
 ---- PLAN
+PLAN-ROOT SINK
+|
 14:HASH JOIN [FULL OUTER JOIN]
 |  hash predicates: id = id
 |
@@ -2152,6 +2266,8 @@ left outer join
    on (t1.id = t2.id)) b
 on (a.id = b.id and b.int_col < 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: a.id = t1.id
 |
@@ -2198,6 +2314,8 @@ first_value(int_col) over (order by bigint_col
                            rows between unbounded preceding and current row)
 from functional.alltypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:ANALYTIC
 |  functions: last_value(int_col), first_value(int_col)
 |  order by: bigint_col ASC

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/complex-types-file-formats.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/complex-types-file-formats.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/complex-types-file-formats.test
index f0431a2..9c68c65 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/complex-types-file-formats.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/complex-types-file-formats.test
@@ -1,6 +1,8 @@
 # Scanning an unpartitioned Parquet table with complex types plans ok.
 select s.f1 from functional_parquet.complextypes_fileformat t, t.a
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:SUBPLAN
 |
 |--04:NESTED LOOP JOIN [CROSS JOIN]
@@ -47,6 +49,8 @@ Complex types are supported for these file formats: PARQUET.
 # only scalar type columns are allowed.
 select id from functional_rc_snap.complextypes_fileformat
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional_rc_snap.complextypes_fileformat]
    partitions=1/1 files=1 size=56B
 ====
@@ -54,6 +58,8 @@ select id from functional_rc_snap.complextypes_fileformat
 # queries should work.
 select count(*) from functional_rc_snap.complextypes_fileformat
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -70,6 +76,8 @@ Complex types are supported for these file formats: PARQUET.
 # are allowed.
 select id from functional_seq_snap.complextypes_fileformat
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional_seq_snap.complextypes_fileformat]
    partitions=1/1 files=1 size=87B
 ====
@@ -85,6 +93,8 @@ not implemented: Scan of partition
 # columns are selected.
 select id from functional_hbase.allcomplextypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.allcomplextypes]
 ====
 # Scanning an HBase table with complex-types columns fails if a complex-typed
@@ -115,6 +125,8 @@ Complex types are supported for these file formats: PARQUET.
 # Scanning a Parquet partition of a multi-format table with complex types 
plans ok.
 select s.f1 from functional.complextypes_multifileformat t, t.a where p = 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:SUBPLAN
 |
 |--04:NESTED LOOP JOIN [CROSS JOIN]
@@ -143,6 +155,8 @@ Complex types are supported for these file formats: PARQUET.
 # queries should work.
 select count(*) from functional.complextypes_multifileformat where p = 4
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
index 29e1864..9f97d62 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
@@ -4,6 +4,8 @@ from functional.alltypes a
 where a.int_col = a.tinyint_col and
       a.bool_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.bool_col, a.int_col = a.tinyint_col
@@ -14,6 +16,8 @@ from functional.alltypes a
 where a.string_col LIKE '%a%' and
       a.int_col = a.tinyint_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = a.tinyint_col, a.string_col LIKE '%a%'
@@ -24,6 +28,8 @@ from functional.alltypes a
 where (a.int_col = a.tinyint_col or a.int_col = a.smallint_col) and
       a.int_col = a.bigint_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = a.bigint_col, (a.int_col = a.tinyint_col OR 
a.int_col = a.smallint_col)
@@ -33,6 +39,8 @@ select *
 from functional.alltypes a
 where a.int_col + 5 = a.bigint_col - 10 and a.int_col = a.tinyint_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = a.tinyint_col, a.int_col + 5 = a.bigint_col - 10
@@ -43,6 +51,8 @@ from functional.alltypes a
 where a.int_col = a.tinyint_col and
       (case a.int_col when 0 then true when 1 then true when 2 then true else 
false end)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = a.tinyint_col, (CASE a.int_col WHEN 0 THEN TRUE 
WHEN 1 THEN TRUE WHEN 2 THEN TRUE ELSE FALSE END), (CASE a.tinyint_col WHEN 0 
THEN TRUE WHEN 1 THEN TRUE WHEN 2 THEN TRUE ELSE FALSE END)
@@ -53,6 +63,8 @@ select *
 from functional.alltypes a
 where a.date_string_col LIKE 'a%a' and a.date_string_col LIKE '%a%'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.date_string_col LIKE '%a%', a.date_string_col LIKE 'a%a'
@@ -62,6 +74,8 @@ select *
 from functional.alltypes a
 where a.int_col IN (1, 2, 3, 4, 5, 6, 7, 8, 9) and a.int_col = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = 1, a.int_col IN (1, 2, 3, 4, 5, 6, 7, 8, 9)
@@ -71,6 +85,8 @@ select *
 from functional.alltypes a
 where a.timestamp_col > '2000-01-01' and a.int_col = 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col = 0, a.timestamp_col > '2000-01-01'
@@ -82,6 +98,8 @@ where a.string_col = "looooooooooooooooong string" and
       a.string_col = "medium string" and
       a.string_col = "a"
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.string_col = 'a', a.string_col = 'medium string', 
a.string_col = 'looooooooooooooooong string'
@@ -92,6 +110,8 @@ from functional.alltypes a
 where a.timestamp_col - interval 1 day > '2000-01-01' and
       a.timestamp_col < '2020-01-01'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.timestamp_col < '2020-01-01', a.timestamp_col - INTERVAL 1 
day > '2000-01-01'
@@ -101,6 +121,8 @@ select *
 from functional.alltypes a
 where ceil(a.double_col) > 0 and a.double_col > 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.double_col > 0, ceil(a.double_col) > 0
@@ -110,6 +132,8 @@ select *
 from functional.alltypes a
 where cast(a.int_col as double) > 0 and a.int_col > 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col > 0, CAST(a.int_col AS DOUBLE) > 0
@@ -119,6 +143,8 @@ select *
 from functional.alltypes a
 where a.string_col = "string" and a.int_col is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.int_col IS NULL, a.string_col = 'string'
@@ -131,6 +157,8 @@ where a.string_col LIKE '%a%' and
       (a.int_col = a.tinyint_col or a.int_col = a.smallint_col) and
       a.int_col = a.bigint_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.bool_col, a.int_col = a.bigint_col, (a.int_col = 
a.tinyint_col OR a.int_col = a.smallint_col), a.string_col LIKE '%a%'
@@ -141,6 +169,8 @@ select *
 from functional.alltypes a
 where a.int_col = 0 and a.id = 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
    predicates: a.id = 0, a.int_col = 0

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/constant.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/constant.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/constant.test
index 76b0fec..3c03cd5 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/constant.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/constant.test
@@ -1,8 +1,12 @@
 select 1 + 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:UNION
    constant-operands=1
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 00:UNION
    constant-operands=1
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/data-source-tables.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/data-source-tables.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/data-source-tables.test
index 5662f5d..fd7dc1e 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/data-source-tables.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/data-source-tables.test
@@ -5,6 +5,8 @@ where tinyint_col < 256 and
       float_col != 0 and
       cast(int_col as bigint) < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN DATA SOURCE [functional.alltypes_datasource]
 data source predicates: tinyint_col < 256
 predicates: float_col != 0, CAST(int_col AS BIGINT) < 10
@@ -22,6 +24,8 @@ where 10 > int_col and
       not true = bool_col and
       not 5.0 = double_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN DATA SOURCE [functional.alltypes_datasource]
 data source predicates: 10 > int_col, string_col != 'Foo'
 predicates: 5 > double_col, NOT 5.0 = double_col, NOT TRUE = bool_col, 
string_col != 'Bar'
@@ -34,6 +38,8 @@ where int_col < 10 and
       string_col in ("Foo", "Bar") and
       bool_col != false
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN DATA SOURCE [functional.alltypes_datasource]
 data source predicates: int_col < 10, bool_col != FALSE
 predicates: double_col > 5, string_col IN ('Foo', 'Bar')
@@ -50,6 +56,8 @@ and a.int_col = b.id and a.bigint_col = b.id
 # redundant predicates to test minimal spanning tree of equivalent slots
 where a.tinyint_col = a.smallint_col and a.int_col = a.bigint_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [INNER JOIN]
 |  hash predicates: a.id = b.id
 |
@@ -69,6 +77,8 @@ and smallint_col IS DISTINCT FROM 3
 and int_col is not distinct from 4
 and bigint_col is not distinct from 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN DATA SOURCE [functional.alltypes_datasource]
 data source predicates: id IS NOT DISTINCT FROM 1, tinyint_col IS DISTINCT 
FROM 2, int_col IS NOT DISTINCT FROM 4
 predicates: bigint_col IS NOT DISTINCT FROM 5, bool_col IS NOT DISTINCT FROM 
TRUE, smallint_col IS DISTINCT FROM 3

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/disable-preaggregations.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/disable-preaggregations.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/disable-preaggregations.test
index f91dae5..07726c9 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/disable-preaggregations.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/disable-preaggregations.test
@@ -2,6 +2,8 @@ select tinyint_col, count(*)
 from functional.alltypesagg
 group by 1
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 03:AGGREGATE [FINALIZE]
@@ -20,6 +22,8 @@ group by 1
 select count(distinct id)
 from functional.alltypesagg
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(id)
 |

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/distinct-estimate.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/distinct-estimate.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/distinct-estimate.test
index fca99ed..b895ad0 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/distinct-estimate.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/distinct-estimate.test
@@ -1,12 +1,16 @@
 # Distinct estimate
 select distinctpc(l_orderkey) from tpch.lineitem
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: distinctpc(l_orderkey)
 |
 00:SCAN HDFS [tpch.lineitem]
    partitions=1/1 files=1 size=718.94MB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 03:AGGREGATE [FINALIZE]
 |  output: distinctpc:merge(l_orderkey)
 |
@@ -21,6 +25,8 @@ select distinctpc(l_orderkey) from tpch.lineitem
 # Distinct estimate with distinct
 select count(distinct l_orderkey), distinctpc(l_orderkey) from tpch.lineitem
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(l_orderkey), distinctpc:merge(l_orderkey)
 |
@@ -31,6 +37,8 @@ select count(distinct l_orderkey), distinctpc(l_orderkey) 
from tpch.lineitem
 00:SCAN HDFS [tpch.lineitem]
    partitions=1/1 files=1 size=718.94MB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(l_orderkey), distinctpc:merge(l_orderkey)
 |

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/distinct.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/distinct.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/distinct.test
index e5f3bce..b5361a6 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/distinct.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/distinct.test
@@ -2,12 +2,16 @@
 select distinct *
 from functional.testtbl
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  group by: functional.testtbl.id, functional.testtbl.name, 
functional.testtbl.zip
 |
 00:SCAN HDFS [functional.testtbl]
    partitions=1/1 files=0 size=0B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 03:AGGREGATE [FINALIZE]
@@ -25,12 +29,16 @@ from functional.testtbl
 select distinct id, zip
 from functional.testtbl
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  group by: id, zip
 |
 00:SCAN HDFS [functional.testtbl]
    partitions=1/1 files=0 size=0B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 03:AGGREGATE [FINALIZE]
@@ -48,6 +56,8 @@ from functional.testtbl
 select count(distinct id, zip)
 from functional.testtbl
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(if(id IS NULL, NULL, zip))
 |
@@ -57,6 +67,8 @@ from functional.testtbl
 00:SCAN HDFS [functional.testtbl]
    partitions=1/1 files=0 size=0B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(if(id IS NULL, NULL, zip))
 |
@@ -81,6 +93,8 @@ select tinyint_col, count(distinct int_col, bigint_col)
 from functional.alltypesagg
 group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(if(int_col IS NULL, NULL, bigint_col))
 |  group by: tinyint_col
@@ -91,6 +105,8 @@ group by 1
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:EXCHANGE [UNPARTITIONED]
 |
 02:AGGREGATE [FINALIZE]
@@ -113,6 +129,8 @@ select tinyint_col, count(distinct int_col), sum(distinct 
int_col)
 from functional.alltypesagg
 group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(int_col), sum(int_col)
 |  group by: tinyint_col
@@ -123,6 +141,8 @@ group by 1
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:EXCHANGE [UNPARTITIONED]
 |
 02:AGGREGATE [FINALIZE]
@@ -144,6 +164,8 @@ group by 1
 select sum(distinct int_col)
 from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: sum(int_col)
 |
@@ -153,6 +175,8 @@ from functional.alltypesagg
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: sum:merge(int_col)
 |
@@ -178,6 +202,8 @@ select tinyint_col, count(distinct int_col),
 min(distinct smallint_col), max(distinct string_col)
 from functional.alltypesagg group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(int_col), min:merge(smallint_col), max:merge(string_col)
 |  group by: tinyint_col
@@ -189,6 +215,8 @@ from functional.alltypesagg group by 1
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:EXCHANGE [UNPARTITIONED]
 |
 02:AGGREGATE [FINALIZE]
@@ -213,6 +241,8 @@ select tinyint_col, count(distinct int_col), count(*), 
sum(distinct int_col),
 sum(int_col), min(smallint_col), max(bigint_col)
 from functional.alltypesagg group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(int_col), sum(int_col), count:merge(*), sum:merge(int_col), 
min:merge(smallint_col), max:merge(bigint_col)
 |  group by: tinyint_col
@@ -224,6 +254,8 @@ from functional.alltypesagg group by 1
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:EXCHANGE [UNPARTITIONED]
 |
 02:AGGREGATE [FINALIZE]
@@ -250,6 +282,8 @@ select t1.c, t2.c from
 (select count(distinct int_col) as c from functional.alltypestiny) t1 inner 
join
 (select count(distinct bigint_col) as c from functional.alltypestiny) t2 on 
(t1.c = t2.c)
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:HASH JOIN [INNER JOIN]
 |  hash predicates: count(int_col) = count(bigint_col)
 |
@@ -271,6 +305,8 @@ select t1.c, t2.c from
 00:SCAN HDFS [functional.alltypestiny]
    partitions=4/4 files=4 size=460B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: count(int_col) = count(bigint_col)
 |
@@ -323,6 +359,8 @@ select t1.c, t2.c from
 select count(distinct tinyint_col) from functional.alltypes
 having count(bigint_col) > 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(tinyint_col), count:merge(bigint_col)
 |  having: zeroifnull(count(bigint_col)) > 0
@@ -334,6 +372,8 @@ having count(bigint_col) > 0
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(tinyint_col), count:merge(bigint_col)
 |  having: zeroifnull(count(bigint_col)) > 0
@@ -362,6 +402,8 @@ select 1 from
   (select count(distinct 1) x from functional.alltypes) t
 where t.x is not null
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(1)
 |  having: count(1) IS NOT NULL
@@ -372,6 +414,8 @@ where t.x is not null
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(1)
 |  having: count(1) IS NOT NULL
@@ -398,6 +442,8 @@ select 1 from
   (select count(distinct 1) x, count(1) y from functional.alltypes) t
 where t.x + t.y > 10 and t.x > 0 and t.y > 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(1), count:merge(1)
 |  having: count(1) > 0, zeroifnull(count(1)) > 1, count(1) + 
zeroifnull(count(1)) > 10
@@ -409,6 +455,8 @@ where t.x + t.y > 10 and t.x > 0 and t.y > 1
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(1), count:merge(1)
 |  having: count(1) > 0, zeroifnull(count(1)) > 1, count(1) + 
zeroifnull(count(1)) > 10
@@ -434,6 +482,8 @@ where t.x + t.y > 10 and t.x > 0 and t.y > 1
 # IMPALA-2266: Test non-grouping distinct aggregation inside an inline view.
 select * from (select count(distinct int_col) cd from functional.alltypes) v
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(int_col)
 |
@@ -456,6 +506,8 @@ select * from (select count(distinct int_col) cd from 
functional.alltypes) v
 # IMPALA-2266: Test grouping distinct aggregation inside an inline view.
 select * from (select count(distinct int_col) cd from functional.alltypes 
group by bool_col) v
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 05:EXCHANGE [UNPARTITIONED]
 |
 02:AGGREGATE [FINALIZE]
@@ -476,6 +528,8 @@ select * from (select count(distinct int_col) cd from 
functional.alltypes group
 # IMPALA-4042: count(distinct NULL) fails on a view
 select count(distinct null) from functional.alltypes_view
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count:merge(NULL)
 |

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/empty.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
index 27413c0..7933b3a 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
@@ -5,11 +5,15 @@ left outer join functional.alltypes t2
 on t1.id = t2.id
 where false
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # HBase scan turns into empty-set node due to a constant conjunct.
 select * from functional_hbase.alltypessmall where false
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Data source scan turns into empty-set node due to a constant conjunct.
@@ -19,6 +23,8 @@ inner join functional.alltypestiny b
 on a.id = b.id
 where length("a") > 7
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Constant conjunct in ON clause turns query block into an empty-set node.
@@ -27,6 +33,8 @@ from functional.alltypestiny t1
 inner join functional.alltypes t2
 on (t1.id = t2.id and (false or false))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Constant conjunct in WHERE clause turns query block into an aggregation
@@ -35,6 +43,8 @@ select count(int_col), avg(double_col), count(*)
 from functional.alltypes
 where null
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(int_col), avg(double_col), count(*)
 |
@@ -47,6 +57,8 @@ from functional.alltypestiny t1
 inner join functional.alltypes t2
 on (t1.id = t2.id and (false or false))
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -61,6 +73,8 @@ on t1.id = t2.id
 group by t1.int_col
 having ifnull(null, false)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Constant conjunct causes empty-set inline view.
@@ -74,6 +88,8 @@ inner join
    where 1 + 3 > 10) e
 on e.id = f.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [INNER JOIN]
 |  hash predicates: f.id = t1.id
 |  runtime filters: RF000 <- t1.id
@@ -91,6 +107,8 @@ select * from functional.alltypes where "abc" = "cde"
 union all
 select * from functional.alltypestiny
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:UNION
 |
 |--02:SCAN HDFS [functional.alltypestiny]
@@ -110,6 +128,8 @@ full outer join
    where null) t2
 on a.id = t2.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [FULL OUTER JOIN]
 |  hash predicates: a.id = id
 |
@@ -125,6 +145,8 @@ from functional.alltypessmall a
 left outer join functional.alltypestiny b
 on (a.id = b.id and 1 + 1 > 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: a.id = b.id
 |  other join predicates: 1 + 1 > 10
@@ -142,6 +164,8 @@ from functional.alltypessmall a
 right outer join functional.alltypestiny b
 on (a.id = b.id and !true)
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [RIGHT OUTER JOIN]
 |  hash predicates: a.id = b.id
 |  other join predicates: NOT TRUE
@@ -161,6 +185,8 @@ from functional.alltypessmall a
 full outer join functional.alltypestiny b
 on (a.id = b.id and null = "abc")
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [FULL OUTER JOIN]
 |  hash predicates: a.id = b.id
 |  other join predicates: NULL = 'abc'
@@ -178,6 +204,8 @@ left outer join functional.alltypes t2
 on t1.id = t2.id
 limit 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Limit 0 turns query block into an empty-set node.
@@ -185,6 +213,8 @@ select count(int_col), avg(double_col), count(*)
 from functional.alltypes
 limit 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Limit 0 causes empty-set inline view.
@@ -198,6 +228,8 @@ inner join
    limit 0) e
 on e.id = f.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:HASH JOIN [INNER JOIN]
 |  hash predicates: f.id = t1.id
 |  runtime filters: RF000 <- t1.id
@@ -215,6 +247,8 @@ select * from functional.alltypes limit 0
 union all
 select * from functional.alltypestiny
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:UNION
 |
 |--02:SCAN HDFS [functional.alltypestiny]
@@ -231,6 +265,8 @@ union all
 (select * from functional.alltypestiny)
 limit 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # Inline view with a constant select stmt that is guaranteed to be empty.
@@ -241,6 +277,8 @@ w1 where w1.c1 is null
 union all
 select int_col from functional.alltypesagg
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:UNION
 |
 |--03:SCAN HDFS [functional.alltypesagg]
@@ -254,6 +292,8 @@ select int_col from functional.alltypesagg
 # IMPALA-1234: Analytic with constant empty result set failed precondition 
check in FE
 select MIN(int_col) OVER () FROM functional.alltypes limit 0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # IMPALA-1860: INSERT/CTAS should evaluate and apply constant predicates.
@@ -291,6 +331,8 @@ from
   (select id, int_col, bigint_col from functional.alltypestiny) T
 where false
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: sum(id), count(int_col)
 |
@@ -304,6 +346,8 @@ from
   (select id, int_col from functional.alltypestiny) T2 on (T1.id = T2.id)
 where T1.bigint_col < 10 and 1 > 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: sum(id + int_col)
 |
@@ -317,6 +361,8 @@ from
   functional.alltypessmall T2 on T1.id = T2.id
 where T2.bigint_col < 10 and false
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:AGGREGATE [FINALIZE]
 |  output: count(T1.int_col)
 |
@@ -338,6 +384,8 @@ union all
 select coalesce(10.4, int_col)
 from functional.alltypes where false
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:UNION
 |
 01:AGGREGATE [FINALIZE]
@@ -359,6 +407,8 @@ select 1
 union all select bigint_col
 from functional.alltypestiny
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:UNION
 |  constant-operands=1
 |
@@ -375,6 +425,8 @@ from functional.alltypestiny
 select * from (select 10 as i, 2 as j, '2013' as s) as t
 where t.i < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====
 # IMPALA-2216: Make sure the final output exprs are substituted, even
@@ -406,6 +458,8 @@ left outer join
       where null) nv) v4
 where c_custkey < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:SUBPLAN
 |
 |--16:NESTED LOOP JOIN [LEFT OUTER JOIN]
@@ -457,6 +511,8 @@ from tpch_nested_parquet.customer c,
  ) v1
 where c_custkey = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:SUBPLAN
 |
 |--07:NESTED LOOP JOIN [CROSS JOIN]
@@ -479,5 +535,7 @@ where c_custkey = 1
 # IMPALA-2215: Having clause without aggregation.
 select 1 from (select 1) v having 1 > 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:EMPTYSET
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test
index 57b2cce..91aff74 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test
@@ -1,6 +1,8 @@
 # full scan of string typed row-key
 select * from functional_hbase.stringids
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
 ====
 # predicate on row key doesn't get transformed into scan parameter, because
@@ -8,6 +10,8 @@ select * from functional_hbase.stringids
 select * from functional_hbase.alltypessmall
 where id < 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    predicates: id < 5
 ---- SCANRANGELOCATIONS
@@ -16,6 +20,8 @@ NODE 0:
   HBASE KEYRANGE port=16202 3:7
   HBASE KEYRANGE port=16203 7:<unbounded>
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -26,6 +32,8 @@ select * from functional_hbase.stringids
 where id = '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 5
    stop key: 5\0
@@ -34,6 +42,8 @@ and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 5:5\0
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -45,6 +55,8 @@ select * from functional_hbase.stringids
 where id > '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 5\0
    predicates: tinyint_col = 5
@@ -53,6 +65,8 @@ NODE 0:
   HBASE KEYRANGE port=16202 5\0:7
   HBASE KEYRANGE port=16203 7:<unbounded>
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -63,6 +77,8 @@ select * from functional_hbase.stringids
 where id >= '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 5
    predicates: tinyint_col = 5
@@ -71,6 +87,8 @@ NODE 0:
   HBASE KEYRANGE port=16202 5:7
   HBASE KEYRANGE port=16203 7:<unbounded>
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -81,6 +99,8 @@ select * from functional_hbase.stringids
 where id < '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    stop key: 5
    predicates: tinyint_col = 5
@@ -89,6 +109,8 @@ NODE 0:
   HBASE KEYRANGE port=16201 <unbounded>:3
   HBASE KEYRANGE port=16202 3:5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -99,6 +121,8 @@ select * from functional_hbase.stringids
 where id <= '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    stop key: 5\0
    predicates: tinyint_col = 5
@@ -107,6 +131,8 @@ select * from functional_hbase.stringids
 where id > '4' and id < '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4\0
    stop key: 5
@@ -115,6 +141,8 @@ and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 4\0:5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -126,6 +154,8 @@ select * from functional_hbase.stringids
 where id >= '4' and id < '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4
    stop key: 5
@@ -134,6 +164,8 @@ and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 4:5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -145,6 +177,8 @@ select * from functional_hbase.stringids
 where id > '4' and id <= '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4\0
    stop key: 5\0
@@ -153,6 +187,8 @@ and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 4\0:5\0
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -164,6 +200,8 @@ select * from functional_hbase.stringids
 where id >= '4' and id <= '5'
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4
    stop key: 5\0
@@ -172,6 +210,8 @@ and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 4:5\0
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -185,6 +225,8 @@ from functional_hbase.alltypessmall
 where id < 5
 group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |  group by: int_col
@@ -192,6 +234,8 @@ group by 1
 00:SCAN HBASE [functional_hbase.alltypessmall]
    predicates: id < 5
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 03:AGGREGATE [FINALIZE]
@@ -210,10 +254,14 @@ group by 1
 # predicates on string columns against a constant string are converted to 
HBase filters
 select * from functional_hbase.alltypessmall where string_col = '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col EQUAL '4'
    predicates: string_col = '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -223,10 +271,14 @@ select * from functional_hbase.alltypessmall where 
string_col = '4'
 # test all comparison ops
 select * from functional_hbase.alltypessmall where string_col != '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col NOT_EQUAL '4'
    predicates: string_col != '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -235,10 +287,14 @@ select * from functional_hbase.alltypessmall where 
string_col != '4'
 ====
 select * from functional_hbase.alltypessmall where string_col < '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col LESS '4'
    predicates: string_col < '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -247,10 +303,14 @@ select * from functional_hbase.alltypessmall where 
string_col < '4'
 ====
 select * from functional_hbase.alltypessmall where string_col > '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col GREATER '4'
    predicates: string_col > '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -259,10 +319,14 @@ select * from functional_hbase.alltypessmall where 
string_col > '4'
 ====
 select * from functional_hbase.alltypessmall where string_col <= '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col LESS_OR_EQUAL '4'
    predicates: string_col <= '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -271,10 +335,14 @@ select * from functional_hbase.alltypessmall where 
string_col <= '4'
 ====
 select * from functional_hbase.alltypessmall where string_col >= '4'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col GREATER_OR_EQUAL '4'
    predicates: string_col >= '4'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -285,6 +353,8 @@ select * from functional_hbase.alltypessmall where 
string_col >= '4'
 select * from functional_hbase.alltypessmall
 where string_col >= '4' and string_col != '2' and date_string_col = '04/03/09'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters:
   d:string_col NOT_EQUAL '2'
@@ -292,6 +362,8 @@ where string_col >= '4' and string_col != '2' and 
date_string_col = '04/03/09'
   d:date_string_col EQUAL '04/03/09'
    predicates: string_col != '2', string_col >= '4', date_string_col = 
'04/03/09'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypessmall]
@@ -304,6 +376,8 @@ where string_col >= '4' and string_col != '2' and 
date_string_col = '04/03/09'
 # mix of predicates and functional_hbase. filters
 select * from functional_hbase.alltypessmall where string_col = '4' and 
tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    hbase filters: d:string_col EQUAL '4'
    predicates: tinyint_col = 5, string_col = '4'
@@ -312,6 +386,8 @@ select * from functional_hbase.alltypessmall where 
string_col = '4' and tinyint_
 select * from functional_hbase.stringids
 where string_col = '4' and tinyint_col = 5 and id >= '4' and id <= '5'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4
    stop key: 5\0
@@ -321,6 +397,8 @@ where string_col = '4' and tinyint_col = 5 and id >= '4' 
and id <= '5'
 NODE 0:
   HBASE KEYRANGE port=16202 4:5\0
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -332,12 +410,16 @@ NODE 0:
 # predicates involving casts (ie, non-string comparisons) cannot be turned 
into filters
 select * from functional_hbase.alltypessmall where cast(string_col as int) >= 4
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    predicates: CAST(string_col AS INT) >= 4
 ====
 # non-const comparisons cannot be turned into filters
 select * from functional_hbase.alltypessmall where string_col >= 
date_string_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypessmall]
    predicates: string_col >= date_string_col
 ====
@@ -346,6 +428,8 @@ select * from functional_hbase.stringids
 where id = concat('', '5')
 and tinyint_col = 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 5
    stop key: 5\0
@@ -356,6 +440,8 @@ select * from functional_hbase.stringids
 where string_col = '4' and tinyint_col = 5
   and id >= concat('', '4') and id <= concat('5', '')
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    start key: 4
    stop key: 5\0
@@ -365,6 +451,8 @@ where string_col = '4' and tinyint_col = 5
 NODE 0:
   HBASE KEYRANGE port=16202 4:5\0
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.stringids]
@@ -376,8 +464,12 @@ NODE 0:
 # IMP-1188 - row key predicate is null.
 select * from functional_hbase.stringids where id = null
 ---- PLAN
+PLAN-ROOT SINK
+|
 empty scan node
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 empty scan node
@@ -385,8 +477,12 @@ empty scan node
 # IMP-1188 - row key lower bound is bigger than upper bound.
 select * from functional_hbase.stringids where id > 'b' and id < 'a'
 ---- PLAN
+PLAN-ROOT SINK
+|
 empty scan node
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 empty scan node
@@ -396,6 +492,8 @@ empty scan node
 select * from functional_hbase.stringids
 where cast(id as int) < 5
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.stringids]
    predicates: CAST(id AS INT) < 5
 ====
@@ -407,6 +505,8 @@ where cast(id as int) < 5
 select * from functional_hbase.alltypesagg
 where bigint_col is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col IS NULL
 ====
@@ -415,6 +515,8 @@ where bigint_col is null
 select bigint_col, day from functional_hbase.alltypesagg
 where bigint_col is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col IS NULL
 ====
@@ -422,6 +524,8 @@ where bigint_col is null
 select * from functional_hbase.alltypesagg
 where bigint_col is not null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col IS NOT NULL
 ====
@@ -429,6 +533,8 @@ where bigint_col is not null
 select * from functional_hbase.alltypesagg
 where bigint_col is null and day = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col IS NULL, day = 1
 ====
@@ -436,6 +542,8 @@ where bigint_col is null and day = 1
 select * from functional_hbase.alltypesagg
 where bigint_col is not null and bool_col = true
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col IS NOT NULL, bool_col = TRUE
 ---- SCANRANGELOCATIONS
@@ -444,6 +552,8 @@ NODE 0:
   HBASE KEYRANGE port=16202 3:7
   HBASE KEYRANGE port=16203 7:<unbounded>
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HBASE [functional_hbase.alltypesagg]
@@ -453,12 +563,16 @@ NODE 0:
 select count(*) from functional_hbase.alltypesagg
 where bigint_col = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
 00:SCAN HBASE [functional_hbase.alltypesagg]
    predicates: bigint_col = 10
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 03:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |
@@ -474,6 +588,8 @@ where bigint_col = 10
 select count(*) from functional_hbase.alltypesagg
 where bigint_col = 10 and day = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -492,6 +608,8 @@ where
   a.int_col = b.int_col and
   c.int_col = b.int_col
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [INNER JOIN]
 |  hash predicates: b.int_col = a.int_col
 |

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
index 785d111..9d43a25 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/hdfs.test
@@ -2,9 +2,13 @@
 select * FROM functional.alltypes
 where cast(year as string) = to_date( from_unixtime(unix_timestamp()) )
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HDFS [functional.alltypes]
@@ -16,6 +20,8 @@ from functional.testtbl
 where name like 'm%'
 group by 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
 |  group by: zip
@@ -24,6 +30,8 @@ group by 1
    partitions=1/1 files=0 size=0B
    predicates: name LIKE 'm%'
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 04:EXCHANGE [UNPARTITIONED]
 |
 03:AGGREGATE [FINALIZE]
@@ -43,6 +51,8 @@ group by 1
 # all partitions are selected
 select * from functional.alltypes
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ---- SCANRANGELOCATIONS
@@ -72,6 +82,8 @@ NODE 0:
   HDFS SPLIT 
hdfs://localhost:20500/test-warehouse/alltypes/year=2010/month=8/100801.txt 
0:20853
   HDFS SPLIT 
hdfs://localhost:20500/test-warehouse/alltypes/year=2010/month=9/100901.txt 
0:20179
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HDFS [functional.alltypes]
@@ -80,6 +92,8 @@ NODE 0:
 # predicate on first partition key
 select id, month from functional.alltypes where year = 2009
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ---- SCANRANGELOCATIONS
@@ -97,6 +111,8 @@ NODE 0:
   HDFS SPLIT 
hdfs://localhost:20500/test-warehouse/alltypes/year=2009/month=8/090801.txt 
0:20853
   HDFS SPLIT 
hdfs://localhost:20500/test-warehouse/alltypes/year=2009/month=9/090901.txt 
0:20179
 ---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
 01:EXCHANGE [UNPARTITIONED]
 |
 00:SCAN HDFS [functional.alltypes]
@@ -105,141 +121,191 @@ NODE 0:
 # same predicate, phrased differently
 select * from functional.alltypes where year = 2009.0
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ====
 select * from functional.alltypes where 2009 = year
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ====
 select * from functional.alltypes where 2009 <=> year
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ====
 # compound predicate on the second partition key
 select * from functional.alltypes where !(month > 2)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=76.83KB
 ====
 # nested compound predicates on the second partition key
 select * from functional.alltypes where !(!(month=1))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=2/24 files=2 size=40.32KB
 ====
 select * from functional.alltypes where !(!(month<=>1))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=2/24 files=2 size=40.32KB
 ====
 # predicates on both partition keys one of which is a compound predicate with 
NOT
 select * from functional.alltypes where year=2009 and !(month < 6)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=7/24 files=7 size=140.58KB
 ====
 # compound predicates on both partition keys
 select * from functional.alltypes where !(year < 2009) and !(month < 6)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=14/24 files=14 size=281.15KB
 ====
 # compound predicate on a conjunct
 select * from functional.alltypes where !(year = 2009 and month > 6)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=18/24 files=18 size=357.58KB
 ====
 select * from functional.alltypes where !(year <=> 2009 and month > 6)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=18/24 files=18 size=357.58KB
 ====
 select * from functional.alltypes where !(year <=> 2009) or !(month > 6)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=18/24 files=18 size=357.58KB
 ====
 # compound predicate on a disjunct
 select * from functional.alltypes where !(month = 6 or month = 8)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=20/24 files=20 size=398.31KB
 ====
 select * from functional.alltypes where !(month <=> 6 or month <=> 8)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=20/24 files=20 size=398.31KB
 ====
 # not predicate with is null
 select * from functional.alltypes where not (year = 2009 or month is null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.77KB
 ====
 # not predicate with "<=> null" as a synonym of "is null"
 select * from functional.alltypes where not (year = 2009 or month <=> null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.77KB
 ====
 # nested not predicates with is null
 select * from functional.alltypes where not (not (month is null))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
 ====
 # nested not predicates with "<=> null" as a synonym of "is null"
 select * from functional.alltypes where not (not (month <=> null))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
 ====
 # nested not predicates with disjunct
 select * from functional.alltypes where not (not (month is null or year = 
2009))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ====
 # nested not predicates with disjunct and "<=> null" as a synonym of "is null"
 select * from functional.alltypes where not (not (month <=> null or year = 
2009))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=238.68KB
 ====
 # predicate on second partition key
 select * from functional.alltypes where month=1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=2/24 files=2 size=40.32KB
 ====
 # predicate on both partition keys
 select * from functional.alltypes where year=2009 and month=1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=1/24 files=1 size=19.95KB
 ====
 # single-sided range on 2nd key
 select * from functional.alltypes where year=2009 and month > 6
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=6/24 files=6 size=120.87KB
 ====
 select * from functional.alltypes where year=2009 and month < 6
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=5/24 files=5 size=98.11KB
 ====
 select * from functional.alltypes where year=2009 and month in (1, 3, 5, 7)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=80.74KB
 ====
 select * from functional.alltypes where year<=>2009 and month in (1, 3, 5, 7)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=80.74KB
 ====
@@ -247,6 +313,8 @@ select * from functional.alltypes where year<=>2009 and 
month in (1, 3, 5, 7)
 select * from functional.alltypes
 where year=2009 and month in (1, 3, 5, 7) and month is not null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=80.74KB
 ====
@@ -254,29 +322,39 @@ where year=2009 and month in (1, 3, 5, 7) and month is 
not null
 select * from functional.alltypes
 where year=2009 and month in (1, 3, 5, 7) and month is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
 ====
 select * from functional.alltypes where year=2009 and (month in (1, 3, 5) or 
month = 7)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=80.74KB
 ====
 # single-sided ranges on both keys
 select * from functional.alltypes where year<=2009 and month < 6
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=5/24 files=5 size=98.11KB
 ====
 # range on 2nd key
 select * from functional.alltypes where month < 9 and month > 6
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=4/24 files=4 size=81.46KB
 ====
 # multiple predicates on first key; 2nd one applied as predicate
 select * from functional.alltypes where year < 2010 and year < 2009 and month 
> 6
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
 ====
@@ -284,6 +362,8 @@ select * from functional.alltypes where year < 2010 and 
year < 2009 and month >
 select * from functional.alltypes
 where year < 2010 and (month > 6 or month = 1 or month in (3, 4))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=9/24 files=9 size=180.49KB
 ====
@@ -291,18 +371,24 @@ where year < 2010 and (month > 6 or month = 1 or month in 
(3, 4))
 select * from functional.alltypes
 where year < 2010 and (month > 6 or month <=> 1 or month in (3, 4))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=9/24 files=9 size=180.49KB
 ====
 # between predicate on second key
 select * from functional.alltypes where year = 2009 and month between 6 and 8
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.43KB
 ====
 # between predicate on second key
 select * from functional.alltypes where year <=> 2009 and month between 6 and 8
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.43KB
 ====
@@ -310,6 +396,8 @@ select * from functional.alltypes where year <=> 2009 and 
month between 6 and 8
 select * from functional.alltypes
 where year between 2009 and 2009 and month between 6 and 8
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.43KB
 ====
@@ -317,6 +405,8 @@ where year between 2009 and 2009 and month between 6 and 8
 select * from functional.alltypes
 where year = 2009 and (month between 6 and 7 or month between 7 and 8)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.43KB
 ---- SCANRANGELOCATIONS
@@ -329,6 +419,8 @@ NODE 0:
 select * from functional.alltypes
 where year = 2009 and (month between 5+1 and 8-1 or month between 9-2 and 1+7)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.43KB
 ---- SCANRANGELOCATIONS
@@ -340,11 +432,15 @@ NODE 0:
 # slot binding still determined
 select * from functional.alltypes where year - 1 = 2009
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.77KB
 ====
 select * from functional.alltypes where year - 1 <=> 2009
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.77KB
 ====
@@ -352,82 +448,110 @@ select * from functional.alltypes where year - 1 <=> 2009
 # IS NULL predicate on a partition key with nulls
 select * from functional.alltypesagg where day is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # <=> null predicate on a partition key with nulls
 select * from functional.alltypesagg where day <=> null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # IS NOT NULL predicate on a partition key with nulls
 select * from functional.alltypesagg where day is not null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=10/11 files=10 size=743.67KB
 ====
 # IS DISTINCT FROM NULL predicate on a partition key with nulls
 select * from functional.alltypesagg where day is distinct from null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=10/11 files=10 size=743.67KB
 ====
 select * from functional.alltypesagg where day = day
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=10/11 files=10 size=743.67KB
 ====
 select * from functional.alltypesagg where day <=> day
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ====
 # partition key predicates which are in conjunctive normal form (case 1)
 select * from functional.alltypesagg where day is null and day = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=0/11 files=0 size=0B
 ====
 # partition key predicates which are in conjunctive normal form (case 1)
 select * from functional.alltypesagg where day <=> null and day = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=0/11 files=0 size=0B
 ====
 # partition key predicates which are in conjunctive normal form (case 2)
 select * from functional.alltypesagg where day is null and month = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates which are in conjunctive normal form (case 2)
 select * from functional.alltypesagg where day <=> null and month = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates which are in conjunctive normal form (case 3)
 select * from functional.alltypesagg where month = 1 and (day is null or day = 
10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
 # partition key predicates which are in conjunctive normal form (case 3)
 select * from functional.alltypesagg where month = 1 and (day <=> null or day 
= 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
 # partition key predicates which are in conjunctive normal form (case 4)
 select * from functional.alltypesagg where month = 1 and (day is null or year 
= 2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ====
 # partition key predicates which are in conjunctive normal form (case 4)
 select * from functional.alltypesagg where month = 1 and (day <=> null or year 
= 2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ====
@@ -435,6 +559,8 @@ select * from functional.alltypesagg where month = 1 and 
(day <=> null or year =
 select * from functional.alltypesagg
 where (year = 2010 or month = 1) and (day is not null or day = 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=10/11 files=10 size=743.67KB
 ====
@@ -442,42 +568,56 @@ where (year = 2010 or month = 1) and (day is not null or 
day = 10)
 select * from functional.alltypesagg
 where (year = 2010 or month = 1) and (day is distinct from null or day = 10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=10/11 files=10 size=743.67KB
 ====
 # partition key predicates which are in disjunctive normal form (case 1)
 select * from functional.alltypesagg where day is null or month = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ====
 # partition key predicates which are in disjunctive normal form (case 1)
 select * from functional.alltypesagg where day <=> null or month = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=11/11 files=11 size=814.73KB
 ====
 # partition key predicates which are in disjunctive normal form (case 2)
 select * from functional.alltypesagg where day is null or day = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
 # partition key predicates which are in disjunctive normal form (case 2)
 select * from functional.alltypesagg where day <=> null or day = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
 # partition key predicates which are in disjunctive normal form (case 3)
 select * from functional.alltypesagg where day = 10 or (day is null and year = 
2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
 # partition key predicates which are in disjunctive normal form (case 3)
 select * from functional.alltypesagg where day = 10 or (day <=> null and year 
= 2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=145.53KB
 ====
@@ -485,6 +625,8 @@ select * from functional.alltypesagg where day = 10 or (day 
<=> null and year =
 select * from functional.alltypesagg
 where (month = 1 and day = 1) or (day is null and year = 2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=144.45KB
 ====
@@ -492,54 +634,72 @@ where (month = 1 and day = 1) or (day is null and year = 
2010)
 select * from functional.alltypesagg
 where (month = 1 and day = 1) or (day <=> null and year = 2010)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=2/11 files=2 size=144.45KB
 ====
 # partition key predicates with negation (case 1)
 select * from functional.alltypesagg where not (day is not null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 1)
 select * from functional.alltypesagg where not (day is distinct from null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 2)
 select * from functional.alltypesagg where not (not (day is null))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 2)
 select * from functional.alltypesagg where not (not (day <=> null))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 3)
 select * from functional.alltypesagg where not (day is not null and month = 1)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 3)
 select * from functional.alltypesagg where not (day is distinct from null and 
month = 1)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
 # partition key predicates with negation (case 3)
 select * from functional.alltypesagg where not (day is not null or day < 9)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=0/11 files=0 size=0B
 ====
 # partition key predicates with negation (case 3)
 select * from functional.alltypesagg where not (day is distinct from null or 
day < 9)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=0/11 files=0 size=0B
 ====
@@ -547,6 +707,8 @@ select * from functional.alltypesagg where not (day is 
distinct from null or day
 select * from functional.alltypesagg
 where not (day is not null and (not (day < 9 and month = 1)))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=9/11 files=9 size=665.77KB
 ====
@@ -554,6 +716,8 @@ where not (day is not null and (not (day < 9 and month = 
1)))
 select * from functional.alltypesagg
 where not (day is distinct from null and (not (day < 9 and month = 1)))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=9/11 files=9 size=665.77KB
 ====
@@ -561,6 +725,8 @@ where not (day is distinct from null and (not (day < 9 and 
month = 1)))
 select * from functional.alltypesagg
 where not (day is not null or (day = 1 and (not (month = 1 or year = 2010))))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
@@ -568,6 +734,8 @@ where not (day is not null or (day = 1 and (not (month = 1 
or year = 2010))))
 select * from functional.alltypesagg
 where not (day is distinct from null or (day = 1 and (not (month = 1 or year = 
2010))))
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
@@ -575,6 +743,8 @@ where not (day is distinct from null or (day = 1 and (not 
(month = 1 or year = 2
 select * from functional.alltypesagg
 where year + 1 = 2011 and month + 1 <= 3 and day is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
@@ -582,6 +752,8 @@ where year + 1 = 2011 and month + 1 <= 3 and day is null
 select * from functional.alltypesagg
 where year + 1 = 2011 and month + 1 <= 3 and day <=> null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=1/11 files=1 size=71.05KB
 ====
@@ -591,6 +763,8 @@ where day = 5 or (day >= 1 and day <= 2) or (day > 6 and 
day < 8)
 or day is null or day in (4) or not(day is not null)
 or not (day not in (10)) or not (day != 8)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=8/11 files=8 size=591.30KB
 ---- SCANRANGELOCATIONS
@@ -610,6 +784,8 @@ where day = 5 or (day >= 1 and day <= 2) or (day > 6 and 
day < 8)
 or day <=> null or day in (4) or not(day is distinct from null)
 or not (day not in (10)) or not (day != 8)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg]
    partitions=8/11 files=8 size=591.30KB
 ---- SCANRANGELOCATIONS
@@ -626,47 +802,65 @@ NODE 0:
 # Predicates on a partition key with no values (see IMPALA-4128).
 select * from functional.emptytable where f2 = 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 != 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 > 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 < 10
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 in (10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 not in (10)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 is null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 select * from functional.emptytable where f2 is not null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.emptytable]
    partitions=0/0 files=0 size=0B
 ====
 # multi-file non-partitioned table
 select * from functional.alltypesaggmultifilesNoPart
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesaggmultifilesnopart]
    partitions=1/1 files=4 size=805.23KB
 ---- SCANRANGELOCATIONS
@@ -679,6 +873,8 @@ NODE 0:
 # multi-file partitioned table
 select * from functional.alltypesaggmultifiles where day <= 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesaggmultifiles]
    partitions=2/11 files=8 size=145.97KB
 ====
@@ -688,39 +884,53 @@ select * from functional.alltypesaggmultifiles where day 
<= 2
 # Test single binary predicate on a partition column
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j = 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=1/1234 files=1 size=2B
 ====
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j <=> 1
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=1/1234 files=1 size=2B
 ====
 # Test disjunctive predicate on a partition column
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j = 1 
or j = 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=2/1234 files=2 size=4B
 ====
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j <=> 
1 or j <=> 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=2/1234 files=2 size=4B
 ====
 # Test conjunctive predicate on a partition column
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j = 1 
and j = 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=0/1234 files=0 size=0B
 ====
 select * from scale_db.num_partitions_1234_blocks_per_partition_1 where j <=> 
1 and j <=> 2
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [scale_db.num_partitions_1234_blocks_per_partition_1]
    partitions=0/1234 files=0 size=0B
 ====
 # Partition pruning when a binary predicate contains a NullLiteral 
(IMPALA-1535)
 select * from functional.alltypestiny t1 where t1.year != null or t1.year = 
null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypestiny t1]
    partitions=0/4 files=0 size=0B
 ====
@@ -728,6 +938,8 @@ select * from functional.alltypestiny t1 where t1.year != 
null or t1.year = null
 select * from functional.alltypestiny t1
 where t1.year IS DISTINCT FROM null or t1.year = null
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypestiny t1]
    partitions=4/4 files=4 size=460B
 ====
@@ -735,6 +947,8 @@ where t1.year IS DISTINCT FROM null or t1.year = null
 # expression
 select * from functional.alltypesagg t1 where t1.year + null != t1.day
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=0/11 files=0 size=0B
 ====
@@ -742,6 +956,8 @@ select * from functional.alltypesagg t1 where t1.year + 
null != t1.day
 # expression and IS DISTINCT FROM
 select * from functional.alltypesagg t1 where t1.year + null IS DISTINCT FROM 
t1.day
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=10/11 files=10 size=743.67KB
 ====
@@ -749,6 +965,8 @@ select * from functional.alltypesagg t1 where t1.year + 
null IS DISTINCT FROM t1
 # (a single partition is scanned)
 select * from functional.alltypesagg t1 where day in (10, null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=1/11 files=1 size=74.48KB
 ====
@@ -756,6 +974,8 @@ select * from functional.alltypesagg t1 where day in (10, 
null)
 # (all partitions are pruned)
 select * from functional.alltypesagg t1 where day not in (10, null)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=0/11 files=0 size=0B
 ====
@@ -763,6 +983,8 @@ select * from functional.alltypesagg t1 where day not in 
(10, null)
 select * from functional.alltypesagg t1
 where t1.day = instr("this is a test", "this") or t1.year = year(now()) + 100
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=1/11 files=1 size=73.39KB
 ====
@@ -771,6 +993,8 @@ where t1.day = instr("this is a test", "this") or t1.year = 
year(now()) + 100
 select * from functional.alltypesagg t1
 where t1.day in (1, cast(2.0 as INT), year(now()) + 100)
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=2/11 files=2 size=147.87KB
 ====
@@ -779,6 +1003,8 @@ where t1.day in (1, cast(2.0 as INT), year(now()) + 100)
 select * from functional.alltypesagg t1
 where -t1.day in(-1 - 1) or cast(t1.day as string) like '%1%'
 ---- PLAN
+PLAN-ROOT SINK
+|
 00:SCAN HDFS [functional.alltypesagg t1]
    partitions=3/11 files=3 size=222.34KB
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9f61397f/testdata/workloads/functional-planner/queries/PlannerTest/implicit-joins.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/implicit-joins.test 
b/testdata/workloads/functional-planner/queries/PlannerTest/implicit-joins.test
index 8fd3ce2..229c1e6 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/implicit-joins.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/implicit-joins.test
@@ -5,6 +5,8 @@ from (select * from functional.alltypestiny) t1
   join (select * from functional.alltypestiny) t2 on (t1.id = t2.id)
   join functional.alltypestiny t3 on (coalesce(t1.id, t3.id) = t3.id)
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:NESTED LOOP JOIN [INNER JOIN]
 |  predicates: (coalesce(functional.alltypestiny.id, t3.id) = t3.id)
 |
@@ -30,6 +32,8 @@ from
 where
   v.x < v.y
 ---- PLAN
+PLAN-ROOT SINK
+|
 02:NESTED LOOP JOIN [INNER JOIN]
 |  predicates: t1.id < t2.id
 |
@@ -47,6 +51,8 @@ from
 where
   t1.id = t2.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:NESTED LOOP JOIN [CROSS JOIN]
 |
 |--02:SCAN HDFS [functional.alltypes t3]
@@ -71,6 +77,8 @@ from
 where
   t1.id = t3.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:NESTED LOOP JOIN [CROSS JOIN]
 |
 |--01:SCAN HDFS [functional.alltypes t2]
@@ -98,6 +106,8 @@ from
 where
   t2.id = t3.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [INNER JOIN]
 |  hash predicates: t2.id = t3.id
 |  runtime filters: RF000 <- t3.id
@@ -121,6 +131,8 @@ from
   functional.alltypes t3 on t3.id = t2.id,
   functional.alltypes t4
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:NESTED LOOP JOIN [CROSS JOIN]
 |
 |--03:SCAN HDFS [functional.alltypes t4]
@@ -147,6 +159,8 @@ select a.* from
   functional.alltypessmall b full outer join
   functional.alltypes c on a.id = c.id and a.id < b.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 04:HASH JOIN [FULL OUTER JOIN]
 |  hash predicates: a.id = c.id
 |  other join predicates: a.id < b.id
@@ -169,6 +183,8 @@ functional.alltypestiny c,
 functional.alltypes d
 where a.id = d.id and b.id = c.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:HASH JOIN [INNER JOIN]
 |  hash predicates: d.id = a.id
 |  runtime filters: RF000 <- a.id
@@ -201,6 +217,8 @@ from
     on t1.id < t2.id,
   functional.alltypes t3
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -232,6 +250,8 @@ from
 where
   t1.id = t2.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -267,6 +287,8 @@ from
 where
   t1.id = t2.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 07:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -298,6 +320,8 @@ from
   functional.alltypes t0 left semi join
   functional.alltypes t1 on ( t0.id < t1.id )
 ---- PLAN
+PLAN-ROOT SINK
+|
 03:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -320,6 +344,8 @@ where
   b.id in (select avg(id) from functional.alltypes group by month) and
   a.id < b.id
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:AGGREGATE [FINALIZE]
 |  output: count(*)
 |
@@ -348,6 +374,8 @@ from functional.alltypes t1,
 functional.alltypes t2 join functional.alltypes t3 on (t1.id = t2.id),
 functional.alltypes t4
 ---- PLAN
+PLAN-ROOT SINK
+|
 06:NESTED LOOP JOIN [CROSS JOIN]
 |
 |--03:SCAN HDFS [functional.alltypes t4]


Reply via email to