You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/05/12 02:38:41 UTC

[3/7] impala git commit: IMPALA-6957: calc thread resource requirement in planner

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-planner/queries/PlannerTest/sort-expr-materialization.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/sort-expr-materialization.test b/testdata/workloads/functional-planner/queries/PlannerTest/sort-expr-materialization.test
index 4925f8f..003f3c5 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/sort-expr-materialization.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/sort-expr-materialization.test
@@ -2,14 +2,14 @@
 select * from functional.alltypes order by random()
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: random() ASC
 |  materialized: random()
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=105B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -19,21 +19,21 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # sort on a deterministic expr that exceeds the cost threshold
 select * from functional.alltypes order by abs(id) + abs(id)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: abs(id) + abs(id) ASC
 |  materialized: abs(id) + abs(id)
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=105B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -43,20 +43,20 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # sort on a deterministic expr that doesn't exceed the cost threshold
 select * from functional.alltypes order by tinyint_col + 1
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: tinyint_col + 1 ASC
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=97B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -66,7 +66,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # sort on multiple exprs, subset is materialized
@@ -74,14 +74,14 @@ select * from functional.alltypes
 order by dayofweek(timestamp_col), true, id + 1, string_col = date_string_col, id = tinyint_col
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: dayofweek(timestamp_col) ASC, TRUE ASC, id + 1 ASC, string_col = date_string_col ASC, id = tinyint_col ASC
 |  materialized: dayofweek(timestamp_col), string_col = date_string_col
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=102B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -91,7 +91,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # expensive analytic order by expr gets materialized
@@ -99,21 +99,21 @@ select last_value(id) over (order by to_date(timestamp_col), bool_col is null)
 from functional.alltypes
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=144.00MB mem-reservation=16.03MB
+|  Per-Host Resources: mem-estimate=144.00MB mem-reservation=16.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 02:ANALYTIC
 |  functions: last_value(id)
 |  order by: to_date(timestamp_col) ASC, bool_col IS NULL ASC
 |  window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
-|  mem-estimate=4.00MB mem-reservation=4.00MB spill-buffer=2.00MB
+|  mem-estimate=4.00MB mem-reservation=4.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=3,2 row-size=41B cardinality=7300
 |
 01:SORT
 |  order by: to_date(timestamp_col) ASC, bool_col IS NULL ASC
 |  materialized: to_date(timestamp_col)
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=3 row-size=37B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -123,7 +123,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=21B cardinality=7300
 ====
 # expensive order by expr in top-n gets materialized
@@ -131,14 +131,14 @@ select id from functional.alltypes order by string_col like 'a.*b', id * bigint_
 regexp_replace(string_col, 'a.*b', 'c') limit 10
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:TOP-N [LIMIT=10]
 |  order by: string_col LIKE 'a.*b' ASC, id * bigint_col ASC, regexp_replace(string_col, 'a.*b', 'c') ASC
 |  materialized: string_col LIKE 'a.*b', regexp_replace(string_col, 'a.*b', 'c')
-|  mem-estimate=290B mem-reservation=0B
+|  mem-estimate=290B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=29B cardinality=10
 |
 00:SCAN HDFS [functional.alltypes]
@@ -148,21 +148,21 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=29B cardinality=7300
 ====
 # sort on udf, gets materialized
 select * from functional.alltypes order by TestFn(double_col)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: default.testfn(double_col) ASC
 |  materialized: default.testfn(double_col)
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=101B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -172,21 +172,21 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # sort expr contains SlotRefs that don't need to be materialized separately
 select concat(date_string_col, string_col) c from functional.alltypes order by c
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB
+|  Per-Host Resources: mem-estimate=140.00MB mem-reservation=12.03MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 01:SORT
 |  order by: concat(date_string_col, string_col) ASC
 |  materialized: concat(date_string_col, string_col)
-|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB
+|  mem-estimate=12.00MB mem-reservation=12.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=16B cardinality=7300
 |
 00:SCAN HDFS [functional.alltypes]
@@ -196,7 +196,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=41B cardinality=7300
 ====
 # IMPALA-5270: Rand() and udf inside inline view referenced by analytic function.
@@ -207,13 +207,13 @@ select id, row_number() over (partition by u order by r) from
 order by id
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=42.00MB mem-reservation=16.00MB
+|  Per-Host Resources: mem-estimate=42.00MB mem-reservation=16.00MB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 03:SORT
 |  order by: id ASC
-|  mem-estimate=6.00MB mem-reservation=6.00MB spill-buffer=2.00MB
+|  mem-estimate=6.00MB mem-reservation=6.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=4 row-size=12B cardinality=8
 |
 02:ANALYTIC
@@ -221,13 +221,13 @@ PLAN-ROOT SINK
 |  partition by: u
 |  order by: random() ASC
 |  window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
-|  mem-estimate=4.00MB mem-reservation=4.00MB spill-buffer=2.00MB
+|  mem-estimate=4.00MB mem-reservation=4.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=6,5 row-size=32B cardinality=8
 |
 01:SORT
 |  order by: default.testfn(double_col) ASC NULLS FIRST, random() ASC
 |  materialized: default.testfn(double_col), random()
-|  mem-estimate=6.00MB mem-reservation=6.00MB spill-buffer=2.00MB
+|  mem-estimate=6.00MB mem-reservation=6.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=6 row-size=24B cardinality=8
 |
 00:SCAN HDFS [functional.alltypestiny]
@@ -237,6 +237,6 @@ PLAN-ROOT SINK
      partitions: 4/4 rows=8
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2
-   mem-estimate=32.00MB mem-reservation=8.00KB
+   mem-estimate=32.00MB mem-reservation=8.00KB thread-reservation=1
    tuple-ids=0 row-size=12B cardinality=8
 ====

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-planner/queries/PlannerTest/spillable-buffer-sizing.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/spillable-buffer-sizing.test b/testdata/workloads/functional-planner/queries/PlannerTest/spillable-buffer-sizing.test
index f7dfcff..e849da6 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/spillable-buffer-sizing.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/spillable-buffer-sizing.test
@@ -3,40 +3,40 @@ select straight_join *
 from tpch_parquet.customer
     inner join tpch_parquet.nation on c_nationkey = n_nationkey
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=18.97MB
+Max Per-Host Resource Reservation: Memory=18.97MB Threads=5
 Per-Host Resource Estimates: Memory=42.94MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=355B cardinality=150000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-Per-Host Resources: mem-estimate=26.94MB mem-reservation=18.94MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=26.94MB mem-reservation=18.94MB thread-reservation=2 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: c_nationkey = n_nationkey
 |  fk/pk conjuncts: c_nationkey = n_nationkey
 |  runtime filters: RF000[bloom] <- n_nationkey
-|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB
+|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=0,1 row-size=355B cardinality=150000
 |
 |--03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=117B cardinality=25
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.nation, RANDOM]
 |     partitions=1/1 files=1 size=2.75KB
 |     stored statistics:
 |       table: rows=25 size=2.75KB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=25
-|     mem-estimate=16.00MB mem-reservation=32.00KB
+|     mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=1
 |     tuple-ids=1 row-size=117B cardinality=25
 |
 00:SCAN HDFS [tpch_parquet.customer, RANDOM]
@@ -46,29 +46,29 @@ Per-Host Resources: mem-estimate=26.94MB mem-reservation=18.94MB runtime-filters
      table: rows=150000 size=12.31MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=150000
-   mem-estimate=24.00MB mem-reservation=16.00MB
+   mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=1
    tuple-ids=0 row-size=238B cardinality=150000
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=37.94MB
+Max Per-Host Resource Reservation: Memory=37.94MB Threads=5
 Per-Host Resource Estimates: Memory=85.88MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=355B cardinality=150000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
-Per-Host Resources: mem-estimate=53.88MB mem-reservation=37.88MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=53.88MB mem-reservation=37.88MB thread-reservation=2 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash-table-id=00
 |  hash predicates: c_nationkey = n_nationkey
 |  fk/pk conjuncts: c_nationkey = n_nationkey
 |  runtime filters: RF000[bloom] <- n_nationkey
-|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB
+|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=0,1 row-size=355B cardinality=150000
 |
 |--F03:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
@@ -76,21 +76,21 @@ Per-Host Resources: mem-estimate=53.88MB mem-reservation=37.88MB runtime-filters
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: n_nationkey
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=117B cardinality=25
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=64.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=64.00KB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.nation, RANDOM]
 |     partitions=1/1 files=1 size=2.75KB
 |     stored statistics:
 |       table: rows=25 size=2.75KB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=25
-|     mem-estimate=16.00MB mem-reservation=32.00KB
+|     mem-estimate=16.00MB mem-reservation=32.00KB thread-reservation=0
 |     tuple-ids=1 row-size=117B cardinality=25
 |
 00:SCAN HDFS [tpch_parquet.customer, RANDOM]
@@ -100,7 +100,7 @@ Per-Host Resources: mem-estimate=53.88MB mem-reservation=37.88MB runtime-filters
      table: rows=150000 size=12.31MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=150000
-   mem-estimate=24.00MB mem-reservation=16.00MB
+   mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=0
    tuple-ids=0 row-size=238B cardinality=150000
 ====
 # Join with large build side - should use default-sized buffers.
@@ -108,39 +108,39 @@ select straight_join *
 from tpch_parquet.lineitem
     left join tpch_parquet.orders on l_orderkey = o_orderkey
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=98.00MB
+Max Per-Host Resource Reservation: Memory=98.00MB Threads=5
 Per-Host Resource Estimates: Memory=420.41MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1N row-size=454B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=380.41MB mem-reservation=74.00MB
+Per-Host Resources: mem-estimate=380.41MB mem-reservation=74.00MB thread-reservation=2
 02:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
 |  hash predicates: l_orderkey = o_orderkey
 |  fk/pk conjuncts: l_orderkey = o_orderkey
-|  mem-estimate=300.41MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=300.41MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1N row-size=454B cardinality=6001215
 |
 |--03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=191B cardinality=1500000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  Per-Host Resources: mem-estimate=40.00MB mem-reservation=24.00MB
+|  Per-Host Resources: mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.orders, RANDOM]
 |     partitions=1/1 files=2 size=54.07MB
 |     stored statistics:
 |       table: rows=1500000 size=54.07MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=1177135
-|     mem-estimate=40.00MB mem-reservation=24.00MB
+|     mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=1
 |     tuple-ids=1 row-size=191B cardinality=1500000
 |
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
@@ -149,28 +149,28 @@ Per-Host Resources: mem-estimate=380.41MB mem-reservation=74.00MB
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=40.00MB
+   mem-estimate=80.00MB mem-reservation=40.00MB thread-reservation=1
    tuple-ids=0 row-size=263B cardinality=6001215
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=196.00MB
+Max Per-Host Resource Reservation: Memory=196.00MB Threads=5
 Per-Host Resource Estimates: Memory=840.83MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1N row-size=454B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-Per-Host Resources: mem-estimate=760.83MB mem-reservation=148.00MB
+Per-Host Resources: mem-estimate=760.83MB mem-reservation=148.00MB thread-reservation=2
 02:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
 |  hash-table-id=00
 |  hash predicates: l_orderkey = o_orderkey
 |  fk/pk conjuncts: l_orderkey = o_orderkey
-|  mem-estimate=300.41MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=300.41MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1N row-size=454B cardinality=6001215
 |
 |--F03:PLAN FRAGMENT [RANDOM] hosts=2 instances=4
@@ -178,21 +178,21 @@ Per-Host Resources: mem-estimate=760.83MB mem-reservation=148.00MB
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: o_orderkey
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=191B cardinality=1500000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=2 instances=4
-|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=48.00MB
+|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=48.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.orders, RANDOM]
 |     partitions=1/1 files=2 size=54.07MB
 |     stored statistics:
 |       table: rows=1500000 size=54.07MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=1177135
-|     mem-estimate=40.00MB mem-reservation=24.00MB
+|     mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=0
 |     tuple-ids=1 row-size=191B cardinality=1500000
 |
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
@@ -201,7 +201,7 @@ Per-Host Resources: mem-estimate=760.83MB mem-reservation=148.00MB
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=40.00MB
+   mem-estimate=80.00MB mem-reservation=40.00MB thread-reservation=0
    tuple-ids=0 row-size=263B cardinality=6001215
 ====
 # Shuffle join with mid-sized input.
@@ -209,48 +209,48 @@ select straight_join *
 from tpch_parquet.orders
     join /*+shuffle*/ tpch_parquet.customer on o_custkey = c_custkey
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=76.00MB
+Max Per-Host Resource Reservation: Memory=76.00MB Threads=6
 Per-Host Resource Estimates: Memory=100.00MB
 
 F03:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 05:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 F02:PLAN FRAGMENT [HASH(o_custkey)] hosts=2 instances=2
-Per-Host Resources: mem-estimate=35.00MB mem-reservation=35.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=35.00MB mem-reservation=35.00MB thread-reservation=1 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, PARTITIONED]
 |  hash predicates: o_custkey = c_custkey
 |  fk/pk conjuncts: o_custkey = c_custkey
 |  runtime filters: RF000[bloom] <- c_custkey
-|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 |--04:EXCHANGE [HASH(c_custkey)]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=238B cardinality=150000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=24.00MB mem-reservation=16.00MB
+|  Per-Host Resources: mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.customer, RANDOM]
 |     partitions=1/1 files=1 size=12.31MB
 |     stored statistics:
 |       table: rows=150000 size=12.31MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=150000
-|     mem-estimate=24.00MB mem-reservation=16.00MB
+|     mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=1
 |     tuple-ids=1 row-size=238B cardinality=150000
 |
 03:EXCHANGE [HASH(o_custkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0 row-size=191B cardinality=1500000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-Per-Host Resources: mem-estimate=41.00MB mem-reservation=25.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=41.00MB mem-reservation=25.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 00:SCAN HDFS [tpch_parquet.orders, RANDOM]
    partitions=1/1 files=2 size=54.07MB
    runtime filters: RF000[bloom] -> o_custkey
@@ -258,29 +258,29 @@ Per-Host Resources: mem-estimate=41.00MB mem-reservation=25.00MB runtime-filters
      table: rows=1500000 size=54.07MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=1177135
-   mem-estimate=40.00MB mem-reservation=24.00MB
+   mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=1
    tuple-ids=0 row-size=191B cardinality=1500000
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=118.00MB
+Max Per-Host Resource Reservation: Memory=118.00MB Threads=7
 Per-Host Resource Estimates: Memory=166.00MB
 
 F03:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 05:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 F02:PLAN FRAGMENT [HASH(o_custkey)] hosts=2 instances=4
-Per-Host Resources: mem-estimate=36.00MB mem-reservation=36.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=36.00MB mem-reservation=36.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, PARTITIONED]
 |  hash-table-id=00
 |  hash predicates: o_custkey = c_custkey
 |  fk/pk conjuncts: o_custkey = c_custkey
 |  runtime filters: RF000[bloom] <- c_custkey
-|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB
+|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 |--F04:PLAN FRAGMENT [HASH(o_custkey)] hosts=1 instances=2
@@ -288,29 +288,29 @@ Per-Host Resources: mem-estimate=36.00MB mem-reservation=36.00MB runtime-filters
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: c_custkey
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  04:EXCHANGE [HASH(c_custkey)]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=238B cardinality=150000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
-|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00MB
+|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.customer, RANDOM]
 |     partitions=1/1 files=1 size=12.31MB
 |     stored statistics:
 |       table: rows=150000 size=12.31MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=150000
-|     mem-estimate=24.00MB mem-reservation=16.00MB
+|     mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=0
 |     tuple-ids=1 row-size=238B cardinality=150000
 |
 03:EXCHANGE [HASH(o_custkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0 row-size=191B cardinality=1500000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=2 instances=4
-Per-Host Resources: mem-estimate=82.00MB mem-reservation=50.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=82.00MB mem-reservation=50.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 00:SCAN HDFS [tpch_parquet.orders, RANDOM]
    partitions=1/1 files=2 size=54.07MB
    runtime filters: RF000[bloom] -> o_custkey
@@ -318,7 +318,7 @@ Per-Host Resources: mem-estimate=82.00MB mem-reservation=50.00MB runtime-filters
      table: rows=1500000 size=54.07MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=1177135
-   mem-estimate=40.00MB mem-reservation=24.00MB
+   mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=0
    tuple-ids=0 row-size=191B cardinality=1500000
 ====
 # Broadcast join with mid-sized input - should use larger buffers than shuffle join.
@@ -326,40 +326,40 @@ select straight_join *
 from tpch_parquet.orders
     join /*+broadcast*/ tpch_parquet.customer on o_custkey = c_custkey
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=75.00MB
+Max Per-Host Resource Reservation: Memory=75.00MB Threads=5
 Per-Host Resource Estimates: Memory=102.38MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-Per-Host Resources: mem-estimate=78.38MB mem-reservation=59.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=78.38MB mem-reservation=59.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: o_custkey = c_custkey
 |  fk/pk conjuncts: o_custkey = c_custkey
 |  runtime filters: RF000[bloom] <- c_custkey
-|  mem-estimate=37.38MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=37.38MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 |--03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=238B cardinality=150000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=24.00MB mem-reservation=16.00MB
+|  Per-Host Resources: mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.customer, RANDOM]
 |     partitions=1/1 files=1 size=12.31MB
 |     stored statistics:
 |       table: rows=150000 size=12.31MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=150000
-|     mem-estimate=24.00MB mem-reservation=16.00MB
+|     mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=1
 |     tuple-ids=1 row-size=238B cardinality=150000
 |
 00:SCAN HDFS [tpch_parquet.orders, RANDOM]
@@ -369,29 +369,29 @@ Per-Host Resources: mem-estimate=78.38MB mem-reservation=59.00MB runtime-filters
      table: rows=1500000 size=54.07MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=1177135
-   mem-estimate=40.00MB mem-reservation=24.00MB
+   mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=1
    tuple-ids=0 row-size=191B cardinality=1500000
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=150.00MB
+Max Per-Host Resource Reservation: Memory=150.00MB Threads=5
 Per-Host Resource Estimates: Memory=204.76MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=2 instances=4
-Per-Host Resources: mem-estimate=156.76MB mem-reservation=118.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=156.76MB mem-reservation=118.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 02:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash-table-id=00
 |  hash predicates: o_custkey = c_custkey
 |  fk/pk conjuncts: o_custkey = c_custkey
 |  runtime filters: RF000[bloom] <- c_custkey
-|  mem-estimate=37.38MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=37.38MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1 row-size=428B cardinality=1500000
 |
 |--F03:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
@@ -399,21 +399,21 @@ Per-Host Resources: mem-estimate=156.76MB mem-reservation=118.00MB runtime-filte
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: c_custkey
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=238B cardinality=150000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
-|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00MB
+|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.customer, RANDOM]
 |     partitions=1/1 files=1 size=12.31MB
 |     stored statistics:
 |       table: rows=150000 size=12.31MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=150000
-|     mem-estimate=24.00MB mem-reservation=16.00MB
+|     mem-estimate=24.00MB mem-reservation=16.00MB thread-reservation=0
 |     tuple-ids=1 row-size=238B cardinality=150000
 |
 00:SCAN HDFS [tpch_parquet.orders, RANDOM]
@@ -423,7 +423,7 @@ Per-Host Resources: mem-estimate=156.76MB mem-reservation=118.00MB runtime-filte
      table: rows=1500000 size=54.07MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=1177135
-   mem-estimate=40.00MB mem-reservation=24.00MB
+   mem-estimate=40.00MB mem-reservation=24.00MB thread-reservation=0
    tuple-ids=0 row-size=191B cardinality=1500000
 ====
 # Join with no stats for right input - should use default buffers.
@@ -431,34 +431,34 @@ select straight_join *
 from functional_parquet.alltypes
     left join functional_parquet.alltypestiny on alltypes.id = alltypestiny.id
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=34.17MB
+Max Per-Host Resource Reservation: Memory=34.17MB Threads=5
 Per-Host Resource Estimates: Memory=2.03GB
 WARNING: The following tables are missing relevant table and/or column statistics.
 functional_parquet.alltypes, functional_parquet.alltypestiny
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1N row-size=176B cardinality=unavailable
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=2.02GB mem-reservation=34.09MB
+Per-Host Resources: mem-estimate=2.02GB mem-reservation=34.09MB thread-reservation=2
 02:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
 |  hash predicates: alltypes.id = alltypestiny.id
 |  fk/pk conjuncts: assumed fk/pk
-|  mem-estimate=2.00GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=2.00GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1N row-size=176B cardinality=unavailable
 |
 |--03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=88B cardinality=unavailable
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=88.00KB
+|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=88.00KB thread-reservation=2
 |  01:SCAN HDFS [functional_parquet.alltypestiny, RANDOM]
 |     partitions=4/4 files=4 size=9.79KB
 |     stored statistics:
@@ -466,7 +466,7 @@ Per-Host Resources: mem-estimate=2.02GB mem-reservation=34.09MB
 |       partitions: 0/4 rows=unavailable
 |       columns: unavailable
 |     extrapolated-rows=disabled max-scan-range-rows=unavailable
-|     mem-estimate=16.00MB mem-reservation=88.00KB
+|     mem-estimate=16.00MB mem-reservation=88.00KB thread-reservation=1
 |     tuple-ids=1 row-size=88B cardinality=unavailable
 |
 00:SCAN HDFS [functional_parquet.alltypes, RANDOM]
@@ -476,30 +476,30 @@ Per-Host Resources: mem-estimate=2.02GB mem-reservation=34.09MB
      partitions: 0/24 rows=unavailable
      columns missing stats: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col
    extrapolated-rows=disabled max-scan-range-rows=unavailable
-   mem-estimate=16.00MB mem-reservation=88.00KB
+   mem-estimate=16.00MB mem-reservation=88.00KB thread-reservation=1
    tuple-ids=0 row-size=88B cardinality=unavailable
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=68.34MB
+Max Per-Host Resource Reservation: Memory=68.34MB Threads=5
 Per-Host Resource Estimates: Memory=4.06GB
 WARNING: The following tables are missing relevant table and/or column statistics.
 functional_parquet.alltypestiny
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0,1N row-size=176B cardinality=unavailable
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-Per-Host Resources: mem-estimate=4.03GB mem-reservation=68.17MB
+Per-Host Resources: mem-estimate=4.03GB mem-reservation=68.17MB thread-reservation=2
 02:HASH JOIN [LEFT OUTER JOIN, BROADCAST]
 |  hash-table-id=00
 |  hash predicates: alltypes.id = alltypestiny.id
 |  fk/pk conjuncts: assumed fk/pk
-|  mem-estimate=2.00GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=2.00GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=0,1N row-size=176B cardinality=unavailable
 |
 |--F03:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
@@ -507,14 +507,14 @@ Per-Host Resources: mem-estimate=4.03GB mem-reservation=68.17MB
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: alltypestiny.id
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  03:EXCHANGE [BROADCAST]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=88B cardinality=unavailable
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=176.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=176.00KB thread-reservation=2
 |  01:SCAN HDFS [functional_parquet.alltypestiny, RANDOM]
 |     partitions=4/4 files=4 size=9.79KB
 |     stored statistics:
@@ -522,7 +522,7 @@ Per-Host Resources: mem-estimate=4.03GB mem-reservation=68.17MB
 |       partitions: 0/4 rows=unavailable
 |       columns: unavailable
 |     extrapolated-rows=disabled max-scan-range-rows=unavailable
-|     mem-estimate=16.00MB mem-reservation=88.00KB
+|     mem-estimate=16.00MB mem-reservation=88.00KB thread-reservation=0
 |     tuple-ids=1 row-size=88B cardinality=unavailable
 |
 00:SCAN HDFS [functional_parquet.alltypes, RANDOM]
@@ -532,7 +532,7 @@ Per-Host Resources: mem-estimate=4.03GB mem-reservation=68.17MB
      partitions: 0/24 rows=unavailable
      columns missing stats: id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col, timestamp_col
    extrapolated-rows=disabled max-scan-range-rows=unavailable
-   mem-estimate=16.00MB mem-reservation=88.00KB
+   mem-estimate=16.00MB mem-reservation=88.00KB thread-reservation=0
    tuple-ids=0 row-size=88B cardinality=unavailable
 ====
 # Low NDV aggregation - should scale down buffers to minimum.
@@ -540,36 +540,36 @@ select c_nationkey, avg(c_acctbal)
 from tpch_parquet.customer
 group by c_nationkey
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=5.94MB
+Max Per-Host Resource Reservation: Memory=5.94MB Threads=4
 Per-Host Resource Estimates: Memory=44.00MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=10B cardinality=25
 |
 F01:PLAN FRAGMENT [HASH(c_nationkey)] hosts=1 instances=1
-Per-Host Resources: mem-estimate=10.00MB mem-reservation=1.94MB
+Per-Host Resources: mem-estimate=10.00MB mem-reservation=1.94MB thread-reservation=1
 03:AGGREGATE [FINALIZE]
 |  output: avg:merge(c_acctbal)
 |  group by: c_nationkey
-|  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB
+|  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=2 row-size=10B cardinality=25
 |
 02:EXCHANGE [HASH(c_nationkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=10B cardinality=25
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=1 instances=1
-Per-Host Resources: mem-estimate=34.00MB mem-reservation=4.00MB
+Per-Host Resources: mem-estimate=34.00MB mem-reservation=4.00MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  output: avg(c_acctbal)
 |  group by: c_nationkey
-|  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB
+|  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=1 row-size=10B cardinality=25
 |
 00:SCAN HDFS [tpch_parquet.customer, RANDOM]
@@ -578,39 +578,39 @@ Per-Host Resources: mem-estimate=34.00MB mem-reservation=4.00MB
      table: rows=150000 size=12.31MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=150000
-   mem-estimate=24.00MB mem-reservation=2.00MB
+   mem-estimate=24.00MB mem-reservation=2.00MB thread-reservation=1
    tuple-ids=0 row-size=10B cardinality=150000
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=11.88MB
+Max Per-Host Resource Reservation: Memory=11.88MB Threads=5
 Per-Host Resource Estimates: Memory=88.00MB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=10B cardinality=25
 |
 F01:PLAN FRAGMENT [HASH(c_nationkey)] hosts=1 instances=2
-Per-Host Resources: mem-estimate=20.00MB mem-reservation=3.88MB
+Per-Host Resources: mem-estimate=20.00MB mem-reservation=3.88MB thread-reservation=2
 03:AGGREGATE [FINALIZE]
 |  output: avg:merge(c_acctbal)
 |  group by: c_nationkey
-|  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB
+|  mem-estimate=10.00MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=2 row-size=10B cardinality=25
 |
 02:EXCHANGE [HASH(c_nationkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=10B cardinality=25
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=1 instances=2
-Per-Host Resources: mem-estimate=68.00MB mem-reservation=8.00MB
+Per-Host Resources: mem-estimate=68.00MB mem-reservation=8.00MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  output: avg(c_acctbal)
 |  group by: c_nationkey
-|  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB
+|  mem-estimate=10.00MB mem-reservation=2.00MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=1 row-size=10B cardinality=25
 |
 00:SCAN HDFS [tpch_parquet.customer, RANDOM]
@@ -619,7 +619,7 @@ Per-Host Resources: mem-estimate=68.00MB mem-reservation=8.00MB
      table: rows=150000 size=12.31MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=150000
-   mem-estimate=24.00MB mem-reservation=2.00MB
+   mem-estimate=24.00MB mem-reservation=2.00MB thread-reservation=0
    tuple-ids=0 row-size=10B cardinality=150000
 ====
 # Mid NDV aggregation - should scale down buffers to intermediate size.
@@ -629,67 +629,67 @@ from tpch_parquet.lineitem
 group by 1, 2
 having count(*) = 1
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=99.00MB
+Max Per-Host Resource Reservation: Memory=99.00MB Threads=7
 Per-Host Resource Estimates: Memory=227.12MB
 
 F04:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 08:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 F03:PLAN FRAGMENT [HASH(l_orderkey,o_orderstatus)] hosts=3 instances=3
-Per-Host Resources: mem-estimate=34.00MB mem-reservation=34.00MB
+Per-Host Resources: mem-estimate=34.00MB mem-reservation=34.00MB thread-reservation=1
 07:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |  group by: l_orderkey, o_orderstatus
 |  having: count(*) = 1
-|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 06:EXCHANGE [HASH(l_orderkey,o_orderstatus)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 F02:PLAN FRAGMENT [HASH(l_orderkey)] hosts=3 instances=3
-Per-Host Resources: mem-estimate=72.12MB mem-reservation=52.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=72.12MB mem-reservation=52.00MB thread-reservation=1 runtime-filters-memory=1.00MB
 03:AGGREGATE [STREAMING]
 |  output: count(*)
 |  group by: l_orderkey, o_orderstatus
-|  mem-estimate=54.12MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=54.12MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 02:HASH JOIN [INNER JOIN, PARTITIONED]
 |  hash predicates: l_orderkey = o_orderkey
 |  fk/pk conjuncts: l_orderkey = o_orderkey
 |  runtime filters: RF000[bloom] <- o_orderkey
-|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB
+|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB thread-reservation=0
 |  tuple-ids=0,1 row-size=33B cardinality=5757710
 |
 |--05:EXCHANGE [HASH(o_orderkey)]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=25B cardinality=1500000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=2 instances=2
-|  Per-Host Resources: mem-estimate=40.00MB mem-reservation=8.00MB
+|  Per-Host Resources: mem-estimate=40.00MB mem-reservation=8.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.orders, RANDOM]
 |     partitions=1/1 files=2 size=54.07MB
 |     stored statistics:
 |       table: rows=1500000 size=54.07MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=1177135
-|     mem-estimate=40.00MB mem-reservation=8.00MB
+|     mem-estimate=40.00MB mem-reservation=8.00MB thread-reservation=1
 |     tuple-ids=1 row-size=25B cardinality=1500000
 |
 04:EXCHANGE [HASH(l_orderkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0 row-size=8B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=81.00MB mem-reservation=5.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=81.00MB mem-reservation=5.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
    partitions=1/1 files=3 size=193.71MB
    runtime filters: RF000[bloom] -> l_orderkey
@@ -697,40 +697,40 @@ Per-Host Resources: mem-estimate=81.00MB mem-reservation=5.00MB runtime-filters-
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=4.00MB
+   mem-estimate=80.00MB mem-reservation=4.00MB thread-reservation=1
    tuple-ids=0 row-size=8B cardinality=6001215
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=147.00MB
+Max Per-Host Resource Reservation: Memory=147.00MB Threads=9
 Per-Host Resource Estimates: Memory=363.00MB
 
 F04:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 08:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 F03:PLAN FRAGMENT [HASH(l_orderkey,o_orderstatus)] hosts=3 instances=6
-Per-Host Resources: mem-estimate=34.00MB mem-reservation=34.00MB
+Per-Host Resources: mem-estimate=34.00MB mem-reservation=34.00MB thread-reservation=2
 07:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |  group by: l_orderkey, o_orderstatus
 |  having: count(*) = 1
-|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB
+|  mem-estimate=17.00MB mem-reservation=17.00MB spill-buffer=1.00MB thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 06:EXCHANGE [HASH(l_orderkey,o_orderstatus)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 F02:PLAN FRAGMENT [HASH(l_orderkey)] hosts=3 instances=6
-Per-Host Resources: mem-estimate=87.00MB mem-reservation=87.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=87.00MB mem-reservation=87.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 03:AGGREGATE [STREAMING]
 |  output: count(*)
 |  group by: l_orderkey, o_orderstatus
-|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=34.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=2 row-size=33B cardinality=4690314
 |
 02:HASH JOIN [INNER JOIN, PARTITIONED]
@@ -738,7 +738,7 @@ Per-Host Resources: mem-estimate=87.00MB mem-reservation=87.00MB runtime-filters
 |  hash predicates: l_orderkey = o_orderkey
 |  fk/pk conjuncts: l_orderkey = o_orderkey
 |  runtime filters: RF000[bloom] <- o_orderkey
-|  mem-estimate=8.50MB mem-reservation=8.50MB spill-buffer=512.00KB
+|  mem-estimate=8.50MB mem-reservation=8.50MB spill-buffer=512.00KB thread-reservation=0
 |  tuple-ids=0,1 row-size=33B cardinality=5757710
 |
 |--F05:PLAN FRAGMENT [HASH(l_orderkey)] hosts=2 instances=4
@@ -746,29 +746,29 @@ Per-Host Resources: mem-estimate=87.00MB mem-reservation=87.00MB runtime-filters
 |  JOIN BUILD
 |  |  join-table-id=00 plan-id=01 cohort-id=01
 |  |  build expressions: o_orderkey
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |
 |  05:EXCHANGE [HASH(o_orderkey)]
-|  |  mem-estimate=0B mem-reservation=0B
+|  |  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  |  tuple-ids=1 row-size=25B cardinality=1500000
 |  |
 |  F01:PLAN FRAGMENT [RANDOM] hosts=2 instances=4
-|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=16.00MB
+|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=16.00MB thread-reservation=2
 |  01:SCAN HDFS [tpch_parquet.orders, RANDOM]
 |     partitions=1/1 files=2 size=54.07MB
 |     stored statistics:
 |       table: rows=1500000 size=54.07MB
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=1177135
-|     mem-estimate=40.00MB mem-reservation=8.00MB
+|     mem-estimate=40.00MB mem-reservation=8.00MB thread-reservation=0
 |     tuple-ids=1 row-size=25B cardinality=1500000
 |
 04:EXCHANGE [HASH(l_orderkey)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=0 row-size=8B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-Per-Host Resources: mem-estimate=162.00MB mem-reservation=10.00MB runtime-filters-memory=1.00MB
+Per-Host Resources: mem-estimate=162.00MB mem-reservation=10.00MB thread-reservation=2 runtime-filters-memory=1.00MB
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
    partitions=1/1 files=3 size=193.71MB
    runtime filters: RF000[bloom] -> l_orderkey
@@ -776,41 +776,41 @@ Per-Host Resources: mem-estimate=162.00MB mem-reservation=10.00MB runtime-filter
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=4.00MB
+   mem-estimate=80.00MB mem-reservation=4.00MB thread-reservation=0
    tuple-ids=0 row-size=8B cardinality=6001215
 ====
 # High NDV aggregation - should use default buffer size.
 select distinct *
 from tpch_parquet.lineitem
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=108.00MB
+Max Per-Host Resource Reservation: Memory=108.00MB Threads=4
 Per-Host Resource Estimates: Memory=3.31GB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 F01:PLAN FRAGMENT [HASH(tpch_parquet.lineitem.l_orderkey,tpch_parquet.lineitem.l_partkey,tpch_parquet.lineitem.l_suppkey,tpch_parquet.lineitem.l_linenumber,tpch_parquet.lineitem.l_quantity,tpch_parquet.lineitem.l_extendedprice,tpch_parquet.lineitem.l_discount,tpch_parquet.lineitem.l_tax,tpch_parquet.lineitem.l_returnflag,tpch_parquet.lineitem.l_linestatus,tpch_parquet.lineitem.l_shipdate,tpch_parquet.lineitem.l_commitdate,tpch_parquet.lineitem.l_receiptdate,tpch_parquet.lineitem.l_shipinstruct,tpch_parquet.lineitem.l_shipmode,tpch_parquet.lineitem.l_comment)] hosts=3 instances=3
-Per-Host Resources: mem-estimate=1.62GB mem-reservation=34.00MB
+Per-Host Resources: mem-estimate=1.62GB mem-reservation=34.00MB thread-reservation=1
 03:AGGREGATE [FINALIZE]
 |  group by: tpch_parquet.lineitem.l_orderkey, tpch_parquet.lineitem.l_partkey, tpch_parquet.lineitem.l_suppkey, tpch_parquet.lineitem.l_linenumber, tpch_parquet.lineitem.l_quantity, tpch_parquet.lineitem.l_extendedprice, tpch_parquet.lineitem.l_discount, tpch_parquet.lineitem.l_tax, tpch_parquet.lineitem.l_returnflag, tpch_parquet.lineitem.l_linestatus, tpch_parquet.lineitem.l_shipdate, tpch_parquet.lineitem.l_commitdate, tpch_parquet.lineitem.l_receiptdate, tpch_parquet.lineitem.l_shipinstruct, tpch_parquet.lineitem.l_shipmode, tpch_parquet.lineitem.l_comment
-|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 02:EXCHANGE [HASH(tpch_parquet.lineitem.l_orderkey,tpch_parquet.lineitem.l_partkey,tpch_parquet.lineitem.l_suppkey,tpch_parquet.lineitem.l_linenumber,tpch_parquet.lineitem.l_quantity,tpch_parquet.lineitem.l_extendedprice,tpch_parquet.lineitem.l_discount,tpch_parquet.lineitem.l_tax,tpch_parquet.lineitem.l_returnflag,tpch_parquet.lineitem.l_linestatus,tpch_parquet.lineitem.l_shipdate,tpch_parquet.lineitem.l_commitdate,tpch_parquet.lineitem.l_receiptdate,tpch_parquet.lineitem.l_shipinstruct,tpch_parquet.lineitem.l_shipmode,tpch_parquet.lineitem.l_comment)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=1.69GB mem-reservation=74.00MB
+Per-Host Resources: mem-estimate=1.69GB mem-reservation=74.00MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  group by: tpch_parquet.lineitem.l_orderkey, tpch_parquet.lineitem.l_partkey, tpch_parquet.lineitem.l_suppkey, tpch_parquet.lineitem.l_linenumber, tpch_parquet.lineitem.l_quantity, tpch_parquet.lineitem.l_extendedprice, tpch_parquet.lineitem.l_discount, tpch_parquet.lineitem.l_tax, tpch_parquet.lineitem.l_returnflag, tpch_parquet.lineitem.l_linestatus, tpch_parquet.lineitem.l_shipdate, tpch_parquet.lineitem.l_commitdate, tpch_parquet.lineitem.l_receiptdate, tpch_parquet.lineitem.l_shipinstruct, tpch_parquet.lineitem.l_shipmode, tpch_parquet.lineitem.l_comment
-|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
@@ -819,37 +819,37 @@ Per-Host Resources: mem-estimate=1.69GB mem-reservation=74.00MB
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=40.00MB
+   mem-estimate=80.00MB mem-reservation=40.00MB thread-reservation=1
    tuple-ids=0 row-size=263B cardinality=6001215
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=216.00MB
+Max Per-Host Resource Reservation: Memory=216.00MB Threads=5
 Per-Host Resource Estimates: Memory=6.62GB
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 F01:PLAN FRAGMENT [HASH(tpch_parquet.lineitem.l_orderkey,tpch_parquet.lineitem.l_partkey,tpch_parquet.lineitem.l_suppkey,tpch_parquet.lineitem.l_linenumber,tpch_parquet.lineitem.l_quantity,tpch_parquet.lineitem.l_extendedprice,tpch_parquet.lineitem.l_discount,tpch_parquet.lineitem.l_tax,tpch_parquet.lineitem.l_returnflag,tpch_parquet.lineitem.l_linestatus,tpch_parquet.lineitem.l_shipdate,tpch_parquet.lineitem.l_commitdate,tpch_parquet.lineitem.l_receiptdate,tpch_parquet.lineitem.l_shipinstruct,tpch_parquet.lineitem.l_shipmode,tpch_parquet.lineitem.l_comment)] hosts=3 instances=6
-Per-Host Resources: mem-estimate=3.23GB mem-reservation=68.00MB
+Per-Host Resources: mem-estimate=3.23GB mem-reservation=68.00MB thread-reservation=2
 03:AGGREGATE [FINALIZE]
 |  group by: tpch_parquet.lineitem.l_orderkey, tpch_parquet.lineitem.l_partkey, tpch_parquet.lineitem.l_suppkey, tpch_parquet.lineitem.l_linenumber, tpch_parquet.lineitem.l_quantity, tpch_parquet.lineitem.l_extendedprice, tpch_parquet.lineitem.l_discount, tpch_parquet.lineitem.l_tax, tpch_parquet.lineitem.l_returnflag, tpch_parquet.lineitem.l_linestatus, tpch_parquet.lineitem.l_shipdate, tpch_parquet.lineitem.l_commitdate, tpch_parquet.lineitem.l_receiptdate, tpch_parquet.lineitem.l_shipinstruct, tpch_parquet.lineitem.l_shipmode, tpch_parquet.lineitem.l_comment
-|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 02:EXCHANGE [HASH(tpch_parquet.lineitem.l_orderkey,tpch_parquet.lineitem.l_partkey,tpch_parquet.lineitem.l_suppkey,tpch_parquet.lineitem.l_linenumber,tpch_parquet.lineitem.l_quantity,tpch_parquet.lineitem.l_extendedprice,tpch_parquet.lineitem.l_discount,tpch_parquet.lineitem.l_tax,tpch_parquet.lineitem.l_returnflag,tpch_parquet.lineitem.l_linestatus,tpch_parquet.lineitem.l_shipdate,tpch_parquet.lineitem.l_commitdate,tpch_parquet.lineitem.l_receiptdate,tpch_parquet.lineitem.l_shipinstruct,tpch_parquet.lineitem.l_shipmode,tpch_parquet.lineitem.l_comment)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-Per-Host Resources: mem-estimate=3.39GB mem-reservation=148.00MB
+Per-Host Resources: mem-estimate=3.39GB mem-reservation=148.00MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  group by: tpch_parquet.lineitem.l_orderkey, tpch_parquet.lineitem.l_partkey, tpch_parquet.lineitem.l_suppkey, tpch_parquet.lineitem.l_linenumber, tpch_parquet.lineitem.l_quantity, tpch_parquet.lineitem.l_extendedprice, tpch_parquet.lineitem.l_discount, tpch_parquet.lineitem.l_tax, tpch_parquet.lineitem.l_returnflag, tpch_parquet.lineitem.l_linestatus, tpch_parquet.lineitem.l_shipdate, tpch_parquet.lineitem.l_commitdate, tpch_parquet.lineitem.l_receiptdate, tpch_parquet.lineitem.l_shipinstruct, tpch_parquet.lineitem.l_shipmode, tpch_parquet.lineitem.l_comment
-|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=1.62GB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=263B cardinality=6001215
 |
 00:SCAN HDFS [tpch_parquet.lineitem, RANDOM]
@@ -858,7 +858,7 @@ Per-Host Resources: mem-estimate=3.39GB mem-reservation=148.00MB
      table: rows=6001215 size=193.71MB
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2141802
-   mem-estimate=80.00MB mem-reservation=40.00MB
+   mem-estimate=80.00MB mem-reservation=40.00MB thread-reservation=0
    tuple-ids=0 row-size=263B cardinality=6001215
 ====
 # Aggregation with unknown input - should use default buffer size.
@@ -866,38 +866,38 @@ select string_col, count(*)
 from functional_parquet.alltypestiny
 group by string_col
 ---- DISTRIBUTEDPLAN
-Max Per-Host Resource Reservation: Memory=68.01MB
+Max Per-Host Resource Reservation: Memory=68.01MB Threads=4
 Per-Host Resource Estimates: Memory=272.00MB
 WARNING: The following tables are missing relevant table and/or column statistics.
 functional_parquet.alltypestiny
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 F01:PLAN FRAGMENT [HASH(string_col)] hosts=3 instances=3
-Per-Host Resources: mem-estimate=128.00MB mem-reservation=34.00MB
+Per-Host Resources: mem-estimate=128.00MB mem-reservation=34.00MB thread-reservation=1
 03:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |  group by: string_col
-|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 02:EXCHANGE [HASH(string_col)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=144.00MB mem-reservation=34.01MB
+Per-Host Resources: mem-estimate=144.00MB mem-reservation=34.01MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  output: count(*)
 |  group by: string_col
-|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 00:SCAN HDFS [functional_parquet.alltypestiny, RANDOM]
@@ -907,41 +907,41 @@ Per-Host Resources: mem-estimate=144.00MB mem-reservation=34.01MB
      partitions: 0/4 rows=unavailable
      columns: unavailable
    extrapolated-rows=disabled max-scan-range-rows=unavailable
-   mem-estimate=16.00MB mem-reservation=8.00KB
+   mem-estimate=16.00MB mem-reservation=8.00KB thread-reservation=1
    tuple-ids=0 row-size=16B cardinality=unavailable
 ---- PARALLELPLANS
-Max Per-Host Resource Reservation: Memory=136.02MB
+Max Per-Host Resource Reservation: Memory=136.02MB Threads=5
 Per-Host Resource Estimates: Memory=544.00MB
 WARNING: The following tables are missing relevant table and/or column statistics.
 functional_parquet.alltypestiny
 
 F02:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 04:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 F01:PLAN FRAGMENT [HASH(string_col)] hosts=3 instances=6
-Per-Host Resources: mem-estimate=256.00MB mem-reservation=68.00MB
+Per-Host Resources: mem-estimate=256.00MB mem-reservation=68.00MB thread-reservation=2
 03:AGGREGATE [FINALIZE]
 |  output: count:merge(*)
 |  group by: string_col
-|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 02:EXCHANGE [HASH(string_col)]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 F00:PLAN FRAGMENT [RANDOM] hosts=3 instances=6
-Per-Host Resources: mem-estimate=288.00MB mem-reservation=68.02MB
+Per-Host Resources: mem-estimate=288.00MB mem-reservation=68.02MB thread-reservation=2
 01:AGGREGATE [STREAMING]
 |  output: count(*)
 |  group by: string_col
-|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB
+|  mem-estimate=128.00MB mem-reservation=34.00MB spill-buffer=2.00MB thread-reservation=0
 |  tuple-ids=1 row-size=24B cardinality=unavailable
 |
 00:SCAN HDFS [functional_parquet.alltypestiny, RANDOM]
@@ -951,6 +951,6 @@ Per-Host Resources: mem-estimate=288.00MB mem-reservation=68.02MB
      partitions: 0/4 rows=unavailable
      columns: unavailable
    extrapolated-rows=disabled max-scan-range-rows=unavailable
-   mem-estimate=16.00MB mem-reservation=8.00KB
+   mem-estimate=16.00MB mem-reservation=8.00KB thread-reservation=0
    tuple-ids=0 row-size=16B cardinality=unavailable
 ====

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-planner/queries/PlannerTest/tablesample.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/tablesample.test b/testdata/workloads/functional-planner/queries/PlannerTest/tablesample.test
index d8f6105..c63e985 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/tablesample.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/tablesample.test
@@ -2,9 +2,9 @@
 select * from functional.alltypes tablesample system(10) repeatable(1234)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.68KB
@@ -13,16 +13,16 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2449
-   mem-estimate=32.00MB mem-reservation=32.00KB
+   mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=730
 ====
 # Sample 50%
 select * from functional.alltypes tablesample system(50) repeatable(1234)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.26KB
@@ -31,7 +31,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=621
-   mem-estimate=80.00MB mem-reservation=32.00KB
+   mem-estimate=80.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=3650
 ====
 # Sampling and scan predicates. Scan predicates are evaluated after sampling and
@@ -40,9 +40,9 @@ select * from functional.alltypes tablesample system(50) repeatable(1234)
 where id < 10
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=80.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=12/24 files=12 size=239.26KB
@@ -53,7 +53,7 @@ PLAN-ROOT SINK
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=621
    parquet dictionary predicates: id < 10
-   mem-estimate=80.00MB mem-reservation=32.00KB
+   mem-estimate=80.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=365
 ====
 # Partition pruning + sampling. Partition pruning happens before sampling.
@@ -61,9 +61,9 @@ select * from functional.alltypes tablesample system(50) repeatable(1234)
 where year = 2009
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=48.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=6/24 files=6 size=119.70KB
@@ -72,16 +72,16 @@ PLAN-ROOT SINK
      partitions: 12/12 rows=3650
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=1241
-   mem-estimate=48.00MB mem-reservation=32.00KB
+   mem-estimate=48.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=1825
 ====
 # Edge case: sample 0%, no files should be selected
 select * from functional.alltypes tablesample system(0)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=0/24 files=0 size=0B
@@ -90,16 +90,16 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=0
-   mem-estimate=0B mem-reservation=0B
+   mem-estimate=0B mem-reservation=0B thread-reservation=0
    tuple-ids=0 row-size=97B cardinality=0
 ====
 # Edge case: sample 1%, at least one file should be selected
 select * from functional.alltypes tablesample system(1) repeatable(1234)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=1/24 files=1 size=19.95KB
@@ -108,7 +108,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=7300
-   mem-estimate=32.00MB mem-reservation=32.00KB
+   mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=73
 ====
 # Edge case: sample 1% and prune partitions, at least one file should be selected
@@ -116,9 +116,9 @@ select * from functional.alltypes tablesample system(1) repeatable(1234)
 where year = 2010
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=1/24 files=1 size=20.36KB
@@ -127,16 +127,16 @@ PLAN-ROOT SINK
      partitions: 12/12 rows=3650
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=7300
-   mem-estimate=32.00MB mem-reservation=32.00KB
+   mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=37
 ====
 # Edge case: sample 100%, all files should be selected
 select * from functional.alltypes tablesample system (100)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
@@ -145,16 +145,16 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=97B cardinality=7300
 ====
 # Table that has no stats.
 select id from functional_parquet.alltypes tablesample system(10) repeatable(1234)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=16.00KB
+|  Per-Host Resources: mem-estimate=16.00MB mem-reservation=16.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional_parquet.alltypes]
    partitions=3/24 files=3 size=24.23KB
@@ -163,7 +163,7 @@ PLAN-ROOT SINK
      partitions: 0/24 rows=unavailable
      columns: unavailable
    extrapolated-rows=disabled max-scan-range-rows=unavailable
-   mem-estimate=16.00MB mem-reservation=16.00KB
+   mem-estimate=16.00MB mem-reservation=16.00KB thread-reservation=1
    tuple-ids=0 row-size=4B cardinality=unavailable
 ====
 # Sampling in a subquery.
@@ -172,14 +172,14 @@ select id from functional.alltypes t1 where exists (
   where t1.id = t2.id)
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=162.94MB mem-reservation=2.98MB runtime-filters-memory=1.00MB
+|  Per-Host Resources: mem-estimate=162.94MB mem-reservation=2.98MB thread-reservation=3 runtime-filters-memory=1.00MB
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 02:HASH JOIN [LEFT SEMI JOIN]
 |  hash predicates: t1.id = t2.id
 |  runtime filters: RF000[bloom] <- t2.id
-|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB
+|  mem-estimate=1.94MB mem-reservation=1.94MB spill-buffer=64.00KB thread-reservation=0
 |  tuple-ids=0 row-size=4B cardinality=10
 |
 |--01:SCAN HDFS [functional.alltypessmall t2]
@@ -189,7 +189,7 @@ PLAN-ROOT SINK
 |       partitions: 4/4 rows=100
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=100
-|     mem-estimate=32.00MB mem-reservation=8.00KB
+|     mem-estimate=32.00MB mem-reservation=8.00KB thread-reservation=1
 |     tuple-ids=1 row-size=4B cardinality=10
 |
 00:SCAN HDFS [functional.alltypes t1]
@@ -200,7 +200,7 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=4B cardinality=7300
 ====
 # Sampling in WITH-clause view.
@@ -208,9 +208,9 @@ with t as (select * from functional.alltypes tablesample system(10) repeatable(1
 select id from t
 ---- PLAN
 F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB
+|  Per-Host Resources: mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=2
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 00:SCAN HDFS [functional.alltypes]
    partitions=3/24 files=3 size=60.68KB
@@ -219,6 +219,6 @@ PLAN-ROOT SINK
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=2449
-   mem-estimate=32.00MB mem-reservation=32.00KB
+   mem-estimate=32.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=4B cardinality=730
 ====

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-planner/queries/PlannerTest/union.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/union.test b/testdata/workloads/functional-planner/queries/PlannerTest/union.test
index 62bf2dd..eeaf246 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/union.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/union.test
@@ -3224,19 +3224,19 @@ select int_col from functional.alltypes
 explain_level=2
 ---- DISTRIBUTEDPLAN
 F03:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 03:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=4B cardinality=7300
 |
 F02:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
+Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=2
 00:UNION
 |  pass-through-operands: all
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=4B cardinality=7300
 |
 |--02:SCAN HDFS [functional.alltypes, RANDOM]
@@ -3246,7 +3246,7 @@ Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
 |       partitions: 24/24 rows=7300
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=310
-|     mem-estimate=128.00MB mem-reservation=32.00KB
+|     mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
 |     tuple-ids=1 row-size=4B cardinality=7300
 |
 01:SCAN HDFS [functional.emptytable, RANDOM]
@@ -3256,7 +3256,7 @@ Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
      partitions: 0/0 rows=unavailable
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=0
-   mem-estimate=0B mem-reservation=0B
+   mem-estimate=0B mem-reservation=0B thread-reservation=0
    tuple-ids=0 row-size=4B cardinality=0
 ====
 # IMPALA-6388: Verify that the order of the union operands does not impact the
@@ -3268,19 +3268,19 @@ select f2 from functional.emptytable
 explain_level=2
 ---- DISTRIBUTEDPLAN
 F03:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
-|  Per-Host Resources: mem-estimate=0B mem-reservation=0B
+|  Per-Host Resources: mem-estimate=0B mem-reservation=0B thread-reservation=1
 PLAN-ROOT SINK
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |
 03:EXCHANGE [UNPARTITIONED]
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=4B cardinality=7300
 |
 F02:PLAN FRAGMENT [RANDOM] hosts=3 instances=3
-Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
+Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=2
 00:UNION
 |  pass-through-operands: all
-|  mem-estimate=0B mem-reservation=0B
+|  mem-estimate=0B mem-reservation=0B thread-reservation=0
 |  tuple-ids=2 row-size=4B cardinality=7300
 |
 |--02:SCAN HDFS [functional.emptytable, RANDOM]
@@ -3290,7 +3290,7 @@ Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
 |       partitions: 0/0 rows=unavailable
 |       columns: all
 |     extrapolated-rows=disabled max-scan-range-rows=0
-|     mem-estimate=0B mem-reservation=0B
+|     mem-estimate=0B mem-reservation=0B thread-reservation=0
 |     tuple-ids=1 row-size=4B cardinality=0
 |
 01:SCAN HDFS [functional.alltypes, RANDOM]
@@ -3300,6 +3300,6 @@ Per-Host Resources: mem-estimate=128.00MB mem-reservation=32.00KB
      partitions: 24/24 rows=7300
      columns: all
    extrapolated-rows=disabled max-scan-range-rows=310
-   mem-estimate=128.00MB mem-reservation=32.00KB
+   mem-estimate=128.00MB mem-reservation=32.00KB thread-reservation=1
    tuple-ids=0 row-size=4B cardinality=7300
 ====

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-query/queries/QueryTest/explain-level0.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/explain-level0.test b/testdata/workloads/functional-query/queries/QueryTest/explain-level0.test
index 53afc32..400124a 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/explain-level0.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/explain-level0.test
@@ -5,7 +5,7 @@ explain
 select *
 from tpch.lineitem join tpch.orders on l_orderkey = o_orderkey;
 ---- RESULTS: VERIFY_IS_EQUAL
-row_regex:.*Max Per-Host Resource Reservation: Memory=[0-9.]*MB.*
+row_regex:.*Max Per-Host Resource Reservation: Memory=[0-9.]*MB Threads=[0-9]*.*
 row_regex:.*Per-Host Resource Estimates: Memory=[0-9.]*MB.*
 ''
 'PLAN-ROOT SINK'

http://git-wip-us.apache.org/repos/asf/impala/blob/e12ee485/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test b/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test
index 6d58d29..13f7148 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test
@@ -5,7 +5,7 @@ explain
 select *
 from tpch.lineitem join tpch.orders on l_orderkey = o_orderkey;
 ---- RESULTS: VERIFY_IS_EQUAL
-row_regex:.*Max Per-Host Resource Reservation: Memory=[0-9.]*MB.*
+row_regex:.*Max Per-Host Resource Reservation: Memory=[0-9.]*MB Threads=[0-9]*.*
 row_regex:.*Per-Host Resource Estimates: Memory=[0-9.]*MB.*
 ''
 'PLAN-ROOT SINK'