impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [4/4] incubator-impala git commit: Refactor RuntimeState and ExecEnv dependencies
Date Thu, 26 May 2016 02:41:54 GMT
Refactor RuntimeState and ExecEnv dependencies

Previously including runtime-state.h or exec-env.h pulled in a huge
number of headers. By replacing all of those includes with forward
declarations, we can reduce the number of headers included when building
each source file.

This required various changes, including splitting header files, and in
one case extracting the nested DiskIoMgr::RequestContext class so that
the RequestContext can be instantiated without the full DiskIoMgr
header.

The payoff is that touching many header files results in significantly
smaller incremental builds. E.g. changes to bloom-filter.h only require
recompiling a handful of files, instead of 100+.

Build time of individual files should also be slightly quicker, since
they pull in fewer headers.

Change-Id: I3b246ad9c3681d649e7bfc969c7fa885c6242d84
Reviewed-on: http://gerrit.cloudera.org:8080/3108
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/6198d926
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/6198d926
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/6198d926

Branch: refs/heads/master
Commit: 6198d9262e6a9b5beb937e996b9afa942190bfdc
Parents: f09c631
Author: Tim Armstrong <tarmstrong@cloudera.com>
Authored: Tue Feb 23 18:10:26 2016 -0800
Committer: Tim Armstrong <tarmstrong@cloudera.com>
Committed: Wed May 25 19:41:45 2016 -0700

----------------------------------------------------------------------
 .../benchmarks/row-batch-serialize-benchmark.cc |   1 +
 be/src/codegen/codegen-anyval.h                 |   2 +
 be/src/codegen/llvm-codegen-test.cc             |   2 +
 be/src/codegen/llvm-codegen.cc                  |   4 +
 be/src/common/status.h                          |   3 -
 be/src/exec/aggregation-node.cc                 |   2 +-
 be/src/exec/aggregation-node.h                  |   1 -
 be/src/exec/analytic-eval-node.cc               |   1 +
 be/src/exec/base-sequence-scanner.cc            |   1 +
 be/src/exec/blocking-join-node.cc               |   4 +-
 be/src/exec/catalog-op-executor.cc              |   1 +
 be/src/exec/data-sink.cc                        |   1 +
 be/src/exec/data-source-scan-node.cc            |   3 +-
 be/src/exec/exchange-node.cc                    |   2 +-
 be/src/exec/exec-node.cc                        |   2 +-
 be/src/exec/filter-context.cc                   |   2 +
 be/src/exec/hash-join-node.cc                   |   5 +-
 be/src/exec/hash-table-test.cc                  |   3 +-
 be/src/exec/hash-table.h                        |   1 -
 be/src/exec/hbase-scan-node.cc                  |   3 +-
 be/src/exec/hbase-table-scanner.cc              |   2 +
 be/src/exec/hbase-table-sink.cc                 |   2 +
 be/src/exec/hbase-table-writer.cc               |   6 +-
 be/src/exec/hbase-table-writer.h                |   3 +-
 be/src/exec/hdfs-avro-scanner-ir.cc             |   1 +
 be/src/exec/hdfs-avro-scanner.cc                |   2 +-
 be/src/exec/hdfs-avro-table-writer.cc           |   8 +
 be/src/exec/hdfs-avro-table-writer.h            |   2 +-
 be/src/exec/hdfs-parquet-scanner.cc             |   2 +-
 be/src/exec/hdfs-parquet-scanner.h              |   1 +
 be/src/exec/hdfs-parquet-table-writer.cc        |   2 +
 be/src/exec/hdfs-rcfile-scanner.cc              |   1 +
 be/src/exec/hdfs-scan-node.cc                   |   5 +-
 be/src/exec/hdfs-scan-node.h                    |   6 +-
 be/src/exec/hdfs-scanner.cc                     |   2 +-
 be/src/exec/hdfs-sequence-scanner.cc            |   1 +
 be/src/exec/hdfs-sequence-table-writer.cc       |   3 +
 be/src/exec/hdfs-table-writer.cc                |   1 +
 be/src/exec/hdfs-text-scanner.cc                |   1 +
 be/src/exec/hdfs-text-scanner.h                 |   1 +
 be/src/exec/hdfs-text-table-writer.cc           |   2 +
 be/src/exec/kudu-scan-node-test.cc              |   2 +
 be/src/exec/kudu-scan-node.cc                   |   9 +-
 be/src/exec/kudu-scanner.cc                     |   3 +-
 be/src/exec/kudu-table-sink-test.cc             |   3 +-
 be/src/exec/kudu-table-sink.cc                  |   3 +
 be/src/exec/kudu-testutil.h                     |   1 +
 be/src/exec/nested-loop-join-node.cc            |   3 +-
 be/src/exec/old-hash-table-test.cc              |   4 +-
 be/src/exec/old-hash-table.cc                   |   4 +
 be/src/exec/old-hash-table.h                    |   1 +
 be/src/exec/partitioned-aggregation-node.cc     |   3 +-
 be/src/exec/partitioned-aggregation-node.h      |   1 -
 be/src/exec/partitioned-hash-join-node.cc       |   4 +-
 be/src/exec/row-batch-list-test.cc              |   2 +-
 be/src/exec/scan-node.cc                        |   2 +
 be/src/exec/scanner-context.cc                  |   1 +
 be/src/exec/scanner-context.h                   |   1 -
 be/src/exec/select-node.cc                      |   2 +
 be/src/exec/sort-node.cc                        |   1 +
 be/src/exec/subplan-node.cc                     |   1 +
 be/src/exec/text-converter.cc                   |   1 +
 be/src/exec/topn-node.cc                        |   2 +-
 be/src/exec/union-node.cc                       |   2 +
 be/src/exec/unnest-node.cc                      |   4 +-
 be/src/experiments/data-provider.cc             |   2 +
 be/src/experiments/tuple-splitter-test.cc       |   2 +-
 be/src/exprs/agg-fn-evaluator.h                 |   2 +-
 be/src/exprs/compound-predicates.cc             |  16 +
 be/src/exprs/compound-predicates.h              |  12 +-
 be/src/exprs/expr-benchmark.cc                  |   1 +
 be/src/exprs/expr-codegen-test.cc               |   1 +
 be/src/exprs/expr-context.cc                    |   1 +
 be/src/exprs/expr-test.cc                       |   1 +
 be/src/exprs/expr.cc                            |   9 +
 be/src/exprs/expr.h                             |  24 +-
 be/src/exprs/in-predicate-ir.cc                 |   1 +
 be/src/exprs/math-functions-ir.cc               |   4 -
 be/src/exprs/slot-ref.cc                        |   4 +
 be/src/exprs/slot-ref.h                         |   1 +
 be/src/exprs/tuple-is-null-predicate.cc         |   2 +
 be/src/runtime/CMakeLists.txt                   |   1 +
 be/src/runtime/backend-client.h                 |   5 +-
 be/src/runtime/buffered-block-mgr.cc            |   2 +-
 be/src/runtime/buffered-block-mgr.h             |   2 +-
 be/src/runtime/buffered-tuple-stream.cc         |   1 +
 be/src/runtime/client-cache-types.h             |  42 ++
 be/src/runtime/client-cache.h                   |   4 +-
 be/src/runtime/collection-value-builder-test.cc |   1 +
 be/src/runtime/coordinator.cc                   |   2 +
 be/src/runtime/coordinator.h                    |   2 +-
 be/src/runtime/data-stream-mgr.cc               |   1 +
 be/src/runtime/data-stream-mgr.h                |   2 +-
 be/src/runtime/data-stream-recvr.cc             |   3 +-
 be/src/runtime/data-stream-sender.cc            |   1 +
 be/src/runtime/data-stream-sender.h             |   1 +
 be/src/runtime/data-stream-test.cc              |   3 +-
 be/src/runtime/descriptors.h                    |   1 -
 be/src/runtime/disk-io-mgr-internal.h           |  53 +-
 be/src/runtime/disk-io-mgr-reader-context.cc    |  42 +-
 be/src/runtime/disk-io-mgr-scan-range.cc        |   4 +-
 be/src/runtime/disk-io-mgr-stress.cc            |   2 +-
 be/src/runtime/disk-io-mgr-test.cc              |  38 +-
 be/src/runtime/disk-io-mgr.cc                   | 123 ++---
 be/src/runtime/disk-io-mgr.h                    |  75 +--
 be/src/runtime/exec-env.cc                      |   2 +
 be/src/runtime/exec-env.h                       |  28 +-
 be/src/runtime/lib-cache.cc                     |  11 +-
 be/src/runtime/lib-cache.h                      |   4 +-
 be/src/runtime/mem-pool.h                       |   1 -
 be/src/runtime/mem-tracker.h                    |   2 +-
 be/src/runtime/plan-fragment-executor.cc        |   5 +-
 be/src/runtime/plan-fragment-executor.h         |   1 +
 be/src/runtime/row-batch-serialize-test.cc      |   2 +
 be/src/runtime/row-batch.h                      |   1 -
 be/src/runtime/runtime-filter-bank.cc           | 222 +++++++++
 be/src/runtime/runtime-filter-bank.h            | 149 ++++++
 be/src/runtime/runtime-filter.cc                | 201 +-------
 be/src/runtime/runtime-filter.h                 | 127 +----
 be/src/runtime/runtime-state.cc                 |  12 +-
 be/src/runtime/runtime-state.h                  |  38 +-
 be/src/runtime/sorted-run-merger.cc             |   2 +-
 be/src/runtime/sorter.cc                        |   2 +-
 be/src/runtime/string-buffer.h                  |   1 +
 be/src/runtime/thread-resource-mgr.h            |   3 -
 be/src/runtime/tuple.cc                         |   1 +
 be/src/scheduling/admission-controller.cc       |   2 +-
 be/src/scheduling/query-resource-mgr.cc         |   1 +
 be/src/scheduling/simple-scheduler.cc           |   1 +
 be/src/service/fragment-exec-state.cc           |   1 +
 be/src/service/fragment-mgr.cc                  |   1 +
 be/src/service/impala-beeswax-server.cc         |   1 +
 be/src/service/impala-hs2-server.cc             |   3 +-
 be/src/service/query-exec-state.cc              |   3 +
 be/src/statestore/statestore-subscriber.h       |   7 +-
 be/src/testutil/desc-tbl-builder.cc             |   2 +-
 be/src/testutil/desc-tbl-builder.h              |   1 +
 be/src/util/auth-util.cc                        |   2 +
 be/src/util/auth-util.h                         |  16 +-
 be/src/util/avro-util.cc                        |   5 +-
 be/src/util/codec.h                             |   2 -
 be/src/util/decompress.cc                       |   1 +
 be/src/util/dict-encoding.h                     |   1 -
 be/src/util/hdfs-bulk-ops-defs.h                |  31 ++
 be/src/util/hdfs-bulk-ops.h                     |   5 +-
 be/src/util/metrics.h                           |   2 +-
 be/src/util/periodic-counter-updater.cc         |   1 +
 be/src/util/runtime-profile-counters.h          | 488 ++++++++++++++++++
 be/src/util/runtime-profile-test.cc             |   2 +-
 be/src/util/runtime-profile.cc                  |   2 +-
 be/src/util/runtime-profile.h                   | 497 +------------------
 be/src/util/simple-logger.cc                    |   1 +
 be/src/util/simple-logger.h                     |   2 +-
 be/src/util/streaming-sampler.h                 |   2 +
 be/src/util/tuple-row-compare.cc                |   1 +
 be/src/util/tuple-row-compare.h                 |   3 +-
 156 files changed, 1415 insertions(+), 1139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/benchmarks/row-batch-serialize-benchmark.cc
----------------------------------------------------------------------
diff --git a/be/src/benchmarks/row-batch-serialize-benchmark.cc b/be/src/benchmarks/row-batch-serialize-benchmark.cc
index fa5a09c..b03d31b 100644
--- a/be/src/benchmarks/row-batch-serialize-benchmark.cc
+++ b/be/src/benchmarks/row-batch-serialize-benchmark.cc
@@ -15,6 +15,7 @@
 #include <iostream>
 #include <sstream>
 
+#include "runtime/mem-tracker.h"
 #include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/tuple-row.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/codegen/codegen-anyval.h
----------------------------------------------------------------------
diff --git a/be/src/codegen/codegen-anyval.h b/be/src/codegen/codegen-anyval.h
index cafe522..10e2150 100644
--- a/be/src/codegen/codegen-anyval.h
+++ b/be/src/codegen/codegen-anyval.h
@@ -16,6 +16,8 @@
 #define IMPALA_CODEGEN_CODEGEN_ANYVAL_H
 
 #include "codegen/llvm-codegen.h"
+#include "runtime/descriptors.h"
+#include "runtime/multi-precision.h"
 
 namespace llvm {
 class Type;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/codegen/llvm-codegen-test.cc
----------------------------------------------------------------------
diff --git a/be/src/codegen/llvm-codegen-test.cc b/be/src/codegen/llvm-codegen-test.cc
index 6167501..baf9921 100644
--- a/be/src/codegen/llvm-codegen-test.cc
+++ b/be/src/codegen/llvm-codegen-test.cc
@@ -19,6 +19,8 @@
 #include "testutil/gtest-util.h"
 #include "codegen/llvm-codegen.h"
 #include "common/init.h"
+#include "common/object-pool.h"
+#include "runtime/string-value.h"
 #include "util/cpu-info.h"
 #include "util/hash-util.h"
 #include "util/path-builder.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/codegen/llvm-codegen.cc
----------------------------------------------------------------------
diff --git a/be/src/codegen/llvm-codegen.cc b/be/src/codegen/llvm-codegen.cc
index b7f0601..2bdbbcc 100644
--- a/be/src/codegen/llvm-codegen.cc
+++ b/be/src/codegen/llvm-codegen.cc
@@ -55,9 +55,13 @@
 #include "codegen/mcjit-mem-mgr.h"
 #include "impala-ir/impala-ir-names.h"
 #include "runtime/hdfs-fs-cache.h"
+#include "runtime/mem-pool.h"
+#include "runtime/string-value.h"
+#include "runtime/timestamp-value.h"
 #include "util/cpu-info.h"
 #include "util/hdfs-util.h"
 #include "util/path-builder.h"
+#include "util/runtime-profile-counters.h"
 #include "util/test-info.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/common/status.h
----------------------------------------------------------------------
diff --git a/be/src/common/status.h b/be/src/common/status.h
index 29631d0..f88bf50 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -19,9 +19,6 @@
 #include <string>
 #include <vector>
 
-#include <boost/lexical_cast.hpp>
-
-#include "codegen/impala-ir.h"
 #include "common/compiler-util.h"
 #include "common/logging.h"
 #include "gen-cpp/Status_types.h"  // for TStatus

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/aggregation-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/aggregation-node.cc b/be/src/exec/aggregation-node.cc
index 509f961..95db201 100644
--- a/be/src/exec/aggregation-node.cc
+++ b/be/src/exec/aggregation-node.cc
@@ -38,7 +38,7 @@
 #include "runtime/tuple-row.h"
 #include "udf/udf-internal.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/Exprs_types.h"
 #include "gen-cpp/PlanNodes_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/aggregation-node.h
----------------------------------------------------------------------
diff --git a/be/src/exec/aggregation-node.h b/be/src/exec/aggregation-node.h
index 95b0482..24ce37b 100644
--- a/be/src/exec/aggregation-node.h
+++ b/be/src/exec/aggregation-node.h
@@ -16,7 +16,6 @@
 #ifndef IMPALA_EXEC_AGGREGATION_NODE_H
 #define IMPALA_EXEC_AGGREGATION_NODE_H
 
-#include <functional>
 #include <boost/scoped_ptr.hpp>
 
 #include "exec/exec-node.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/analytic-eval-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/analytic-eval-node.cc b/be/src/exec/analytic-eval-node.cc
index 93960c9..d9fa6c3 100644
--- a/be/src/exec/analytic-eval-node.cc
+++ b/be/src/exec/analytic-eval-node.cc
@@ -22,6 +22,7 @@
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "udf/udf-internal.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/base-sequence-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/base-sequence-scanner.cc b/be/src/exec/base-sequence-scanner.cc
index dadab51..4e0ac59 100644
--- a/be/src/exec/base-sequence-scanner.cc
+++ b/be/src/exec/base-sequence-scanner.cc
@@ -21,6 +21,7 @@
 #include "runtime/runtime-state.h"
 #include "runtime/string-search.h"
 #include "util/codec.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/blocking-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/blocking-join-node.cc b/be/src/exec/blocking-join-node.cc
index c7d5e4f..eb9704b 100644
--- a/be/src/exec/blocking-join-node.cc
+++ b/be/src/exec/blocking-join-node.cc
@@ -19,8 +19,10 @@
 #include "exprs/expr.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
+#include "runtime/tuple-row.h"
+#include "util/cgroups-mgr.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/time.h"
 
 #include "gen-cpp/PlanNodes_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/catalog-op-executor.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/catalog-op-executor.cc b/be/src/exec/catalog-op-executor.cc
index 77a2e82..42ef2e0 100644
--- a/be/src/exec/catalog-op-executor.cc
+++ b/be/src/exec/catalog-op-executor.cc
@@ -22,6 +22,7 @@
 #include "service/impala-server.h"
 #include "service/hs2-util.h"
 #include "util/string-parser.h"
+#include "util/runtime-profile-counters.h"
 #include "gen-cpp/CatalogService.h"
 #include "gen-cpp/CatalogService_types.h"
 #include "gen-cpp/CatalogObjects_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/data-sink.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/data-sink.cc b/be/src/exec/data-sink.cc
index 0ed6ab0..dc3a17c 100644
--- a/be/src/exec/data-sink.cc
+++ b/be/src/exec/data-sink.cc
@@ -27,6 +27,7 @@
 #include "gen-cpp/ImpalaInternalService_types.h"
 #include "gen-cpp/ImpalaInternalService_constants.h"
 #include "runtime/data-stream-sender.h"
+#include "runtime/mem-tracker.h"
 #include "util/container-util.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/data-source-scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/data-source-scan-node.cc b/be/src/exec/data-source-scan-node.cc
index 1c1aae5..76e86e9 100644
--- a/be/src/exec/data-source-scan-node.cc
+++ b/be/src/exec/data-source-scan-node.cc
@@ -21,13 +21,14 @@
 #include "exec/read-write-util.h"
 #include "exprs/expr.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/runtime-state.h"
 #include "runtime/row-batch.h"
 #include "runtime/string-value.h"
 #include "runtime/tuple-row.h"
 #include "util/jni-util.h"
 #include "util/periodic-counter-updater.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/exchange-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/exchange-node.cc b/be/src/exec/exchange-node.cc
index b2c3f4e..395bc0e 100644
--- a/be/src/exec/exchange-node.cc
+++ b/be/src/exec/exchange-node.cc
@@ -21,7 +21,7 @@
 #include "runtime/runtime-state.h"
 #include "runtime/row-batch.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/time.h"
 #include "gen-cpp/PlanNodes_types.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/exec-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/exec-node.cc b/be/src/exec/exec-node.cc
index fdde613..b0f07d0 100644
--- a/be/src/exec/exec-node.cc
+++ b/be/src/exec/exec-node.cc
@@ -50,7 +50,7 @@
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/filter-context.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/filter-context.cc b/be/src/exec/filter-context.cc
index e65f0ac..b4cd290 100644
--- a/be/src/exec/filter-context.cc
+++ b/be/src/exec/filter-context.cc
@@ -14,6 +14,8 @@
 
 #include "exec/filter-context.h"
 
+#include "util/runtime-profile-counters.h"
+
 using namespace impala;
 using namespace strings;
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hash-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hash-join-node.cc b/be/src/exec/hash-join-node.cc
index 7163c88..9a66d36 100644
--- a/be/src/exec/hash-join-node.cc
+++ b/be/src/exec/hash-join-node.cc
@@ -23,10 +23,13 @@
 #include "exprs/expr.h"
 #include "gutil/strings/substitute.h"
 #include "runtime/row-batch.h"
+#include "runtime/runtime-filter.h"
+#include "runtime/runtime-filter-bank.h"
 #include "runtime/runtime-state.h"
+#include "runtime/tuple-row.h"
 #include "util/debug-util.h"
 #include "util/bloom-filter.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/PlanNodes_types.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hash-table-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hash-table-test.cc b/be/src/exec/hash-table-test.cc
index d6cd196..3a0b0b1 100644
--- a/be/src/exec/hash-table-test.cc
+++ b/be/src/exec/hash-table-test.cc
@@ -30,9 +30,10 @@
 #include "runtime/mem-tracker.h"
 #include "runtime/string-value.h"
 #include "runtime/test-env.h"
+#include "runtime/tuple-row.h"
 #include "service/fe-support.h"
 #include "util/cpu-info.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/test-info.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hash-table.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hash-table.h b/be/src/exec/hash-table.h
index 55dd120..5b466dc 100644
--- a/be/src/exec/hash-table.h
+++ b/be/src/exec/hash-table.h
@@ -25,7 +25,6 @@
 #include "runtime/buffered-block-mgr.h"
 #include "runtime/buffered-tuple-stream.h"
 #include "runtime/buffered-tuple-stream.inline.h"
-#include "runtime/mem-tracker.h"
 #include "runtime/tuple-row.h"
 #include "util/bitmap.h"
 #include "util/hash-util.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hbase-scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hbase-scan-node.cc b/be/src/exec/hbase-scan-node.cc
index f628c0d..ab649d6 100644
--- a/be/src/exec/hbase-scan-node.cc
+++ b/be/src/exec/hbase-scan-node.cc
@@ -16,6 +16,7 @@
 
 #include <algorithm>
 
+#include "runtime/mem-tracker.h"
 #include "runtime/runtime-state.h"
 #include "runtime/row-batch.h"
 #include "runtime/string-value.h"
@@ -23,7 +24,7 @@
 #include "runtime/tuple.h"
 #include "util/jni-util.h"
 #include "util/periodic-counter-updater.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "gen-cpp/PlanNodes_types.h"
 #include "exec/text-converter.inline.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hbase-table-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hbase-table-scanner.cc b/be/src/exec/hbase-table-scanner.cc
index 3b25429..5c6e45b 100644
--- a/be/src/exec/hbase-table-scanner.cc
+++ b/be/src/exec/hbase-table-scanner.cc
@@ -23,7 +23,9 @@
 #include "runtime/descriptors.h"
 #include "runtime/runtime-state.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/tuple.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hbase-table-sink.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hbase-table-sink.cc b/be/src/exec/hbase-table-sink.cc
index 8ddccb7..b1afcd0 100644
--- a/be/src/exec/hbase-table-sink.cc
+++ b/be/src/exec/hbase-table-sink.cc
@@ -20,6 +20,8 @@
 #include "exprs/expr.h"
 #include "exprs/expr-context.h"
 #include "gen-cpp/ImpalaInternalService_constants.h"
+#include "runtime/mem-tracker.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hbase-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hbase-table-writer.cc b/be/src/exec/hbase-table-writer.cc
index eeb3fef..5e047e1 100644
--- a/be/src/exec/hbase-table-writer.cc
+++ b/be/src/exec/hbase-table-writer.cc
@@ -18,11 +18,15 @@
 #include <sstream>
 
 #include "common/logging.h"
+#include "exprs/expr.h"
 #include "exprs/expr-context.h"
 #include "runtime/hbase-table-factory.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/raw-value.h"
+#include "runtime/tuple.h"
+#include "runtime/tuple-row.h"
 #include "util/bit-util.h"
 #include "util/jni-util.h"
-#include "exprs/expr.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hbase-table-writer.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hbase-table-writer.h b/be/src/exec/hbase-table-writer.h
index 2bb6f15..2bb0df0 100644
--- a/be/src/exec/hbase-table-writer.h
+++ b/be/src/exec/hbase-table-writer.h
@@ -25,11 +25,12 @@
 #include "common/status.h"
 #include "runtime/runtime-state.h"
 #include "runtime/descriptors.h"
-#include "runtime/row-batch.h"
 #include "runtime/hbase-table.h"
 
 namespace impala {
 
+class RowBatch;
+
 /// Class to write RowBatches to an HBase table using the java HTable client.
 /// This class should only be called from a single sink and should not be
 /// shared.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-avro-scanner-ir.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-avro-scanner-ir.cc b/be/src/exec/hdfs-avro-scanner-ir.cc
index f3ebb97..84ca502 100644
--- a/be/src/exec/hdfs-avro-scanner-ir.cc
+++ b/be/src/exec/hdfs-avro-scanner-ir.cc
@@ -16,6 +16,7 @@
 
 #include "exec/hdfs-avro-scanner.h"
 #include "exec/read-write-util.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/string-value.inline.h"
 
 using namespace impala;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-avro-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-avro-scanner.cc b/be/src/exec/hdfs-avro-scanner.cc
index 5f469b7..ec8ec26 100644
--- a/be/src/exec/hdfs-avro-scanner.cc
+++ b/be/src/exec/hdfs-avro-scanner.cc
@@ -26,7 +26,7 @@
 #include "runtime/runtime-state.h"
 #include "util/codec.h"
 #include "util/decompress.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-avro-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-avro-table-writer.cc b/be/src/exec/hdfs-avro-table-writer.cc
index 3a7e001..9ee704d 100644
--- a/be/src/exec/hdfs-avro-table-writer.cc
+++ b/be/src/exec/hdfs-avro-table-writer.cc
@@ -26,9 +26,13 @@
 #include "util/uid-util.h"
 #include "exprs/expr.h"
 #include "exprs/expr-context.h"
+#include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "runtime/hdfs-fs-cache.h"
+#include "util/runtime-profile-counters.h"
 #include "write-stream.inline.h"
 
 #include "common/names.h"
@@ -163,6 +167,10 @@ Status HdfsAvroTableWriter::Init() {
   return Status::OK();
 }
 
+void HdfsAvroTableWriter::Close() {
+  mem_pool_->FreeAll();
+}
+
 Status HdfsAvroTableWriter::AppendRowBatch(RowBatch* batch,
     const vector<int32_t>& row_group_indices, bool* new_file) {
   int32_t limit;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-avro-table-writer.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-avro-table-writer.h b/be/src/exec/hdfs-avro-table-writer.h
index 2cb5138..e8315f7 100644
--- a/be/src/exec/hdfs-avro-table-writer.h
+++ b/be/src/exec/hdfs-avro-table-writer.h
@@ -66,7 +66,7 @@ class HdfsAvroTableWriter : public HdfsTableWriter {
   virtual Status Init();
   virtual Status Finalize() { return Flush(); }
   virtual Status InitNewFile() { return WriteFileHeader(); }
-  virtual void Close() { mem_pool_->FreeAll(); }
+  virtual void Close();
   virtual uint64_t default_block_size() const { return 0; }
   virtual std::string file_extension() const { return "avro"; }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-parquet-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-parquet-scanner.cc b/be/src/exec/hdfs-parquet-scanner.cc
index d9ce76f..4bb7bac 100644
--- a/be/src/exec/hdfs-parquet-scanner.cc
+++ b/be/src/exec/hdfs-parquet-scanner.cc
@@ -44,7 +44,7 @@
 #include "util/error-util.h"
 #include "util/dict-encoding.h"
 #include "util/rle-encoding.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "rpc/thrift-util.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-parquet-scanner.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-parquet-scanner.h b/be/src/exec/hdfs-parquet-scanner.h
index 0700cbe..5a12602 100644
--- a/be/src/exec/hdfs-parquet-scanner.h
+++ b/be/src/exec/hdfs-parquet-scanner.h
@@ -18,6 +18,7 @@
 
 #include "exec/hdfs-scanner.h"
 #include "exec/parquet-common.h"
+#include "util/runtime-profile-counters.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-parquet-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-parquet-table-writer.cc b/be/src/exec/hdfs-parquet-table-writer.cc
index 3743503..6193da7 100644
--- a/be/src/exec/hdfs-parquet-table-writer.cc
+++ b/be/src/exec/hdfs-parquet-table-writer.cc
@@ -18,6 +18,8 @@
 #include "exprs/expr.h"
 #include "exprs/expr-context.h"
 #include "runtime/decimal-value.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "runtime/string-value.inline.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-rcfile-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-rcfile-scanner.cc b/be/src/exec/hdfs-rcfile-scanner.cc
index ca24394..d85ad49 100644
--- a/be/src/exec/hdfs-rcfile-scanner.cc
+++ b/be/src/exec/hdfs-rcfile-scanner.cc
@@ -29,6 +29,7 @@
 #include "runtime/string-value.h"
 #include "util/codec.h"
 #include "util/string-parser.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/PlanNodes_types.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-scan-node.cc b/be/src/exec/hdfs-scan-node.cc
index 4511867..cb4f2f7 100644
--- a/be/src/exec/hdfs-scan-node.cc
+++ b/be/src/exec/hdfs-scan-node.cc
@@ -39,8 +39,11 @@
 #include "runtime/runtime-filter.inline.h"
 #include "runtime/runtime-state.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
+#include "runtime/string-buffer.h"
+#include "scheduling/query-resource-mgr.h"
 #include "util/bit-util.h"
 #include "util/container-util.h"
 #include "util/debug-util.h"
@@ -49,7 +52,7 @@
 #include "util/hdfs-util.h"
 #include "util/impalad-metrics.h"
 #include "util/periodic-counter-updater.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/PlanNodes_types.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-scan-node.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-scan-node.h b/be/src/exec/hdfs-scan-node.h
index 93253a2..f0eb8e3 100644
--- a/be/src/exec/hdfs-scan-node.h
+++ b/be/src/exec/hdfs-scan-node.h
@@ -25,14 +25,12 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/thread/condition_variable.hpp>
 #include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
 
 #include "exec/filter-context.h"
 #include "exec/scan-node.h"
 #include "exec/scanner-context.h"
 #include "runtime/descriptors.h"
 #include "runtime/disk-io-mgr.h"
-#include "runtime/string-buffer.h"
 #include "util/avro-util.h"
 #include "util/counting-barrier.h"
 #include "util/progress-updater.h"
@@ -164,7 +162,7 @@ class HdfsScanNode : public ScanNode {
 
   int skip_header_line_count() const { return skip_header_line_count_; }
 
-  DiskIoMgr::RequestContext* reader_context() { return reader_context_; }
+  DiskIoRequestContext* reader_context() { return reader_context_; }
 
   typedef std::map<TupleId, std::vector<ExprContext*> > ConjunctsMap;
   const ConjunctsMap& conjuncts_map() const { return conjuncts_map_; }
@@ -325,7 +323,7 @@ class HdfsScanNode : public ScanNode {
   const int tuple_id_;
 
   /// RequestContext object to use with the disk-io-mgr for reads.
-  DiskIoMgr::RequestContext* reader_context_;
+  DiskIoRequestContext* reader_context_;
 
   /// Descriptor for tuples this scan node constructs
   const TupleDescriptor* tuple_desc_;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-scanner.cc b/be/src/exec/hdfs-scanner.cc
index 6e9eb61..74a5efb 100644
--- a/be/src/exec/hdfs-scanner.cc
+++ b/be/src/exec/hdfs-scanner.cc
@@ -38,7 +38,7 @@
 #include "util/bitmap.h"
 #include "util/codec.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/sse-util.h"
 #include "util/string-parser.h"
 #include "gen-cpp/PlanNodes_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-sequence-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-sequence-scanner.cc b/be/src/exec/hdfs-sequence-scanner.cc
index 168cdd1..1460b1a 100644
--- a/be/src/exec/hdfs-sequence-scanner.cc
+++ b/be/src/exec/hdfs-sequence-scanner.cc
@@ -24,6 +24,7 @@
 #include "runtime/tuple.h"
 #include "runtime/tuple-row.h"
 #include "util/codec.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-sequence-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-sequence-table-writer.cc b/be/src/exec/hdfs-sequence-table-writer.cc
index dd8f986..19f3202 100644
--- a/be/src/exec/hdfs-sequence-table-writer.cc
+++ b/be/src/exec/hdfs-sequence-table-writer.cc
@@ -19,9 +19,12 @@
 #include "util/uid-util.h"
 #include "exprs/expr.h"
 #include "exprs/expr-context.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "runtime/hdfs-fs-cache.h"
+#include "util/runtime-profile-counters.h"
 
 #include <vector>
 #include <hdfs.h>

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-table-writer.cc b/be/src/exec/hdfs-table-writer.cc
index 4a55d5e..e75c305 100644
--- a/be/src/exec/hdfs-table-writer.cc
+++ b/be/src/exec/hdfs-table-writer.cc
@@ -15,6 +15,7 @@
 #include "exec/hdfs-table-writer.h"
 
 #include "common/names.h"
+#include "runtime/mem-tracker.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-text-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-text-scanner.cc b/be/src/exec/hdfs-text-scanner.cc
index f3b669d..6e501cc 100644
--- a/be/src/exec/hdfs-text-scanner.cc
+++ b/be/src/exec/hdfs-text-scanner.cc
@@ -24,6 +24,7 @@
 #include "exec/text-converter.inline.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
+#include "runtime/tuple-row.h"
 #include "util/codec.h"
 #include "util/decompress.h"
 #include "util/cpu-info.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-text-scanner.h
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-text-scanner.h b/be/src/exec/hdfs-text-scanner.h
index 03b8343..997637d 100644
--- a/be/src/exec/hdfs-text-scanner.h
+++ b/be/src/exec/hdfs-text-scanner.h
@@ -18,6 +18,7 @@
 
 #include "exec/hdfs-scanner.h"
 #include "runtime/string-buffer.h"
+#include "util/runtime-profile-counters.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/hdfs-text-table-writer.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-text-table-writer.cc b/be/src/exec/hdfs-text-table-writer.cc
index 9936237..37ccd3e 100644
--- a/be/src/exec/hdfs-text-table-writer.cc
+++ b/be/src/exec/hdfs-text-table-writer.cc
@@ -17,6 +17,7 @@
 #include "exprs/expr.h"
 #include "exprs/expr-context.h"
 #include "runtime/hdfs-fs-cache.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
@@ -24,6 +25,7 @@
 #include "util/codec.h"
 #include "util/compress.h"
 #include "util/hdfs-util.h"
+#include "util/runtime-profile-counters.h"
 
 #include <hdfs.h>
 #include <stdlib.h>

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-scan-node-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scan-node-test.cc b/be/src/exec/kudu-scan-node-test.cc
index b7453ee..7082991 100644
--- a/be/src/exec/kudu-scan-node-test.cc
+++ b/be/src/exec/kudu-scan-node-test.cc
@@ -24,7 +24,9 @@
 #include "gen-cpp/Types_types.h"
 #include "gutil/strings/split.h"
 #include "runtime/descriptors.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/row-batch.h"
+#include "runtime/tuple-row.h"
 #include "runtime/runtime-state.h"
 #include "service/fe-support.h"
 #include "testutil/desc-tbl-builder.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scan-node.cc b/be/src/exec/kudu-scan-node.cc
index 3d12f4f..a08034f 100644
--- a/be/src/exec/kudu-scan-node.cc
+++ b/be/src/exec/kudu-scan-node.cc
@@ -24,18 +24,19 @@
 #include "exec/kudu-scanner.h"
 #include "exec/kudu-util.h"
 #include "exprs/expr.h"
+#include "gutil/gscoped_ptr.h"
+#include "gutil/strings/substitute.h"
+#include "gutil/stl_util.h"
 #include "runtime/mem-pool.h"
 #include "runtime/runtime-state.h"
 #include "runtime/row-batch.h"
 #include "runtime/string-value.h"
 #include "runtime/tuple-row.h"
-#include "gutil/gscoped_ptr.h"
-#include "gutil/strings/substitute.h"
-#include "gutil/stl_util.h"
+#include "scheduling/query-resource-mgr.h"
 #include "util/disk-info.h"
 #include "util/jni-util.h"
 #include "util/periodic-counter-updater.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scanner.cc b/be/src/exec/kudu-scanner.cc
index db98f8d..ac844c7 100644
--- a/be/src/exec/kudu-scanner.cc
+++ b/be/src/exec/kudu-scanner.cc
@@ -22,6 +22,7 @@
 #include "exprs/expr-context.h"
 #include "exec/kudu-util.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/runtime-state.h"
 #include "runtime/row-batch.h"
 #include "runtime/string-value.h"
@@ -30,7 +31,7 @@
 #include "gutil/strings/substitute.h"
 #include "util/jni-util.h"
 #include "util/periodic-counter-updater.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-table-sink-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-table-sink-test.cc b/be/src/exec/kudu-table-sink-test.cc
index 1d5c642..f7919dc 100644
--- a/be/src/exec/kudu-table-sink-test.cc
+++ b/be/src/exec/kudu-table-sink-test.cc
@@ -15,7 +15,6 @@
 #include "exec/kudu-testutil.h"
 
 #include "common/init.h"
-#include "common/object-pool.h"
 #include "codegen/llvm-codegen.h"
 #include "exec/kudu-table-sink.h"
 #include "exec/kudu-util.h"
@@ -26,8 +25,10 @@
 #include "gutil/stl_util.h"
 #include "kudu/client/row_result.h"
 #include "runtime/descriptors.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
+#include "runtime/tuple-row.h"
 #include "service/fe-support.h"
 #include "testutil/desc-tbl-builder.h"
 #include "testutil/test-macros.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-table-sink.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-table-sink.cc b/be/src/exec/kudu-table-sink.cc
index c3b91b7..055292e 100644
--- a/be/src/exec/kudu-table-sink.cc
+++ b/be/src/exec/kudu-table-sink.cc
@@ -22,6 +22,9 @@
 #include "exprs/expr-context.h"
 #include "gen-cpp/ImpalaInternalService_constants.h"
 #include "gutil/gscoped_ptr.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/row-batch.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/kudu-testutil.h
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-testutil.h b/be/src/exec/kudu-testutil.h
index 6849e74..083a2c7 100644
--- a/be/src/exec/kudu-testutil.h
+++ b/be/src/exec/kudu-testutil.h
@@ -24,6 +24,7 @@
 #include <tr1/memory>
 #include <vector>
 
+#include "common/object-pool.h"
 #include "gutil/gscoped_ptr.h"
 #include "runtime/exec-env.h"
 #include "testutil/desc-tbl-builder.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/nested-loop-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/nested-loop-join-node.cc b/be/src/exec/nested-loop-join-node.cc
index a12957e..149e8d3 100644
--- a/be/src/exec/nested-loop-join-node.cc
+++ b/be/src/exec/nested-loop-join-node.cc
@@ -20,11 +20,12 @@
 #include "exec/row-batch-cache.h"
 #include "exprs/expr.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "util/bitmap.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "gen-cpp/PlanNodes_types.h"
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/old-hash-table-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table-test.cc b/be/src/exec/old-hash-table-test.cc
index 0118f1d..eeccd76 100644
--- a/be/src/exec/old-hash-table-test.cc
+++ b/be/src/exec/old-hash-table-test.cc
@@ -26,9 +26,9 @@
 #include "runtime/mem-pool.h"
 #include "runtime/mem-tracker.h"
 #include "runtime/string-value.h"
-#include "runtime/mem-tracker.h"
+#include "runtime/tuple-row.h"
 #include "util/cpu-info.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/old-hash-table.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table.cc b/be/src/exec/old-hash-table.cc
index 4d419d2..b2109c0 100644
--- a/be/src/exec/old-hash-table.cc
+++ b/be/src/exec/old-hash-table.cc
@@ -24,9 +24,13 @@
 #include "exprs/slot-ref.h"
 #include "runtime/mem-tracker.h"
 #include "runtime/raw-value.inline.h"
+#include "runtime/runtime-filter.h"
+#include "runtime/runtime-filter-bank.h"
 #include "runtime/runtime-state.h"
 #include "runtime/string-value.inline.h"
+#include "runtime/tuple-row.h"
 #include "util/bloom-filter.h"
+#include "runtime/tuple.h"
 #include "util/debug-util.h"
 #include "util/error-util.h"
 #include "util/impalad-metrics.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/old-hash-table.h
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table.h b/be/src/exec/old-hash-table.h
index 0645b8d..ad28512 100644
--- a/be/src/exec/old-hash-table.h
+++ b/be/src/exec/old-hash-table.h
@@ -18,6 +18,7 @@
 
 #include <vector>
 #include <boost/cstdint.hpp>
+#include <boost/scoped_ptr.hpp>
 #include "codegen/impala-ir.h"
 #include "common/logging.h"
 #include "runtime/mem-pool.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/partitioned-aggregation-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/partitioned-aggregation-node.cc b/be/src/exec/partitioned-aggregation-node.cc
index 51478fc..33ddfc4 100644
--- a/be/src/exec/partitioned-aggregation-node.cc
+++ b/be/src/exec/partitioned-aggregation-node.cc
@@ -32,6 +32,7 @@
 #include "runtime/buffered-tuple-stream.inline.h"
 #include "runtime/descriptors.h"
 #include "runtime/mem-pool.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/raw-value.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
@@ -40,7 +41,7 @@
 #include "runtime/tuple-row.h"
 #include "udf/udf-internal.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/Exprs_types.h"
 #include "gen-cpp/PlanNodes_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/partitioned-aggregation-node.h
----------------------------------------------------------------------
diff --git a/be/src/exec/partitioned-aggregation-node.h b/be/src/exec/partitioned-aggregation-node.h
index 300b9e0..b2f8587 100644
--- a/be/src/exec/partitioned-aggregation-node.h
+++ b/be/src/exec/partitioned-aggregation-node.h
@@ -16,7 +16,6 @@
 #ifndef IMPALA_EXEC_PARTITIONED_AGGREGATION_NODE_H
 #define IMPALA_EXEC_PARTITIONED_AGGREGATION_NODE_H
 
-#include <functional>
 #include <boost/scoped_ptr.hpp>
 
 #include "exec/exec-node.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/partitioned-hash-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/partitioned-hash-join-node.cc b/be/src/exec/partitioned-hash-join-node.cc
index e45cbb6..640c674 100644
--- a/be/src/exec/partitioned-hash-join-node.cc
+++ b/be/src/exec/partitioned-hash-join-node.cc
@@ -26,12 +26,14 @@
 #include "exprs/slot-ref.h"
 #include "runtime/buffered-block-mgr.h"
 #include "runtime/buffered-tuple-stream.inline.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-filter.h"
+#include "runtime/runtime-filter-bank.h"
 #include "runtime/runtime-state.h"
 #include "util/bloom-filter.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/PlanNodes_types.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/row-batch-list-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/row-batch-list-test.cc b/be/src/exec/row-batch-list-test.cc
index 5a634f6..c834255 100644
--- a/be/src/exec/row-batch-list-test.cc
+++ b/be/src/exec/row-batch-list-test.cc
@@ -26,7 +26,7 @@
 #include "runtime/string-value.h"
 #include "runtime/tuple-row.h"
 #include "util/cpu-info.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "testutil/desc-tbl-builder.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/scan-node.cc b/be/src/exec/scan-node.cc
index 8527ee8..6e58a72 100644
--- a/be/src/exec/scan-node.cc
+++ b/be/src/exec/scan-node.cc
@@ -16,6 +16,8 @@
 
 #include <boost/bind.hpp>
 
+#include "util/runtime-profile-counters.h"
+
 #include "common/names.h"
 
 namespace impala {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/scanner-context.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/scanner-context.cc b/be/src/exec/scanner-context.cc
index 897f8c5..833436c 100644
--- a/be/src/exec/scanner-context.cc
+++ b/be/src/exec/scanner-context.cc
@@ -22,6 +22,7 @@
 #include "runtime/runtime-state.h"
 #include "runtime/string-buffer.h"
 #include "util/debug-util.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/scanner-context.h
----------------------------------------------------------------------
diff --git a/be/src/exec/scanner-context.h b/be/src/exec/scanner-context.h
index 22e0928..e1dee97 100644
--- a/be/src/exec/scanner-context.h
+++ b/be/src/exec/scanner-context.h
@@ -23,7 +23,6 @@
 #include "common/status.h"
 #include "exec/filter-context.h"
 #include "runtime/disk-io-mgr.h"
-#include "runtime/row-batch.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/select-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/select-node.cc b/be/src/exec/select-node.cc
index 97407f8..6c95268 100644
--- a/be/src/exec/select-node.cc
+++ b/be/src/exec/select-node.cc
@@ -16,6 +16,8 @@
 #include "exprs/expr.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
+#include "runtime/raw-value.h"
+#include "util/runtime-profile-counters.h"
 #include "gen-cpp/PlanNodes_types.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/sort-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/sort-node.cc b/be/src/exec/sort-node.cc
index 2ce0245..3ceaf00 100644
--- a/be/src/exec/sort-node.cc
+++ b/be/src/exec/sort-node.cc
@@ -17,6 +17,7 @@
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "runtime/sorted-run-merger.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/subplan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/subplan-node.cc b/be/src/exec/subplan-node.cc
index 3b946a9..f52a844 100644
--- a/be/src/exec/subplan-node.cc
+++ b/be/src/exec/subplan-node.cc
@@ -18,6 +18,7 @@
 #include "exec/unnest-node.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
+#include "util/runtime-profile-counters.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/text-converter.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/text-converter.cc b/be/src/exec/text-converter.cc
index 8e71ef4..5768231 100644
--- a/be/src/exec/text-converter.cc
+++ b/be/src/exec/text-converter.cc
@@ -23,6 +23,7 @@
 #include "runtime/tuple.h"
 #include "text-converter.h"
 #include "util/string-parser.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/topn-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/topn-node.cc b/be/src/exec/topn-node.cc
index a73c3b5..a2b8e06 100644
--- a/be/src/exec/topn-node.cc
+++ b/be/src/exec/topn-node.cc
@@ -25,7 +25,7 @@
 #include "runtime/tuple.h"
 #include "runtime/tuple-row.h"
 #include "util/debug-util.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/Exprs_types.h"
 #include "gen-cpp/PlanNodes_types.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/union-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/union-node.cc b/be/src/exec/union-node.cc
index 6694f12..42d9b97 100644
--- a/be/src/exec/union-node.cc
+++ b/be/src/exec/union-node.cc
@@ -18,6 +18,8 @@
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "runtime/raw-value.h"
+#include "runtime/tuple-row.h"
+#include "util/runtime-profile-counters.h"
 #include "gen-cpp/PlanNodes_types.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exec/unnest-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/unnest-node.cc b/be/src/exec/unnest-node.cc
index e31c938..68846b8 100644
--- a/be/src/exec/unnest-node.cc
+++ b/be/src/exec/unnest-node.cc
@@ -17,8 +17,10 @@
 #include "exec/subplan-node.h"
 #include "exprs/expr-context.h"
 #include "exprs/slot-ref.h"
+#include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
-#include "util/runtime-profile.h"
+#include "runtime/tuple-row.h"
+#include "util/runtime-profile-counters.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/experiments/data-provider.cc
----------------------------------------------------------------------
diff --git a/be/src/experiments/data-provider.cc b/be/src/experiments/data-provider.cc
index f17b72a..fa98b80 100644
--- a/be/src/experiments/data-provider.cc
+++ b/be/src/experiments/data-provider.cc
@@ -5,6 +5,8 @@
 #include <math.h>
 #include <iostream>
 
+#include "util/runtime-profile-counters.h"
+
 #include "common/names.h"
 
 using boost::minstd_rand;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/experiments/tuple-splitter-test.cc
----------------------------------------------------------------------
diff --git a/be/src/experiments/tuple-splitter-test.cc b/be/src/experiments/tuple-splitter-test.cc
index c458c66..efc6ca9 100644
--- a/be/src/experiments/tuple-splitter-test.cc
+++ b/be/src/experiments/tuple-splitter-test.cc
@@ -24,7 +24,7 @@
 #include "runtime/mem-tracker.h"
 #include "runtime/string-value.h"
 #include "util/cpu-info.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #define PRINT_RESULT 0
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/agg-fn-evaluator.h
----------------------------------------------------------------------
diff --git a/be/src/exprs/agg-fn-evaluator.h b/be/src/exprs/agg-fn-evaluator.h
index e9598ea..77ecd47 100644
--- a/be/src/exprs/agg-fn-evaluator.h
+++ b/be/src/exprs/agg-fn-evaluator.h
@@ -200,7 +200,7 @@ class AggFnEvaluator {
   impala_udf::AnyVal* staging_merge_input_val_;
 
   /// Cache entry for the library containing the function ptrs.
-  LibCache::LibCacheEntry* cache_entry_;
+  LibCacheEntry* cache_entry_;
 
   /// Function ptrs for the different phases of the aggregate function.
   void* init_fn_;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/compound-predicates.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/compound-predicates.cc b/be/src/exprs/compound-predicates.cc
index ce78f1f..3ee7f8a 100644
--- a/be/src/exprs/compound-predicates.cc
+++ b/be/src/exprs/compound-predicates.cc
@@ -12,11 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include <sstream>
+
 #include "exprs/compound-predicates.h"
 #include "codegen/codegen-anyval.h"
 #include "codegen/llvm-codegen.h"
 #include "runtime/runtime-state.h"
 
+#include "common/names.h"
+
 using namespace impala;
 using namespace llvm;
 
@@ -33,6 +37,12 @@ BooleanVal AndPredicate::GetBooleanVal(ExprContext* context, TupleRow* row) {
   return BooleanVal(true);
 }
 
+string AndPredicate::DebugString() const {
+  stringstream out;
+  out << "AndPredicate(" << Expr::DebugString() << ")";
+  return out.str();
+}
+
 // (<> || true) is true, (false || NULL) is NULL
 BooleanVal OrPredicate::GetBooleanVal(ExprContext* context, TupleRow* row) {
   DCHECK_EQ(children_.size(), 2);
@@ -46,6 +56,12 @@ BooleanVal OrPredicate::GetBooleanVal(ExprContext* context, TupleRow* row) {
   return BooleanVal(false);
 }
 
+string OrPredicate::DebugString() const {
+  stringstream out;
+  out << "OrPredicate(" << Expr::DebugString() << ")";
+  return out.str();
+}
+
 // IR codegen for compound and/or predicates.  Compound predicate has non trivial 
 // null handling as well as many branches so this is pretty complicated.  The IR 
 // for x && y is:

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/compound-predicates.h
----------------------------------------------------------------------
diff --git a/be/src/exprs/compound-predicates.h b/be/src/exprs/compound-predicates.h
index df4fe67..b391831 100644
--- a/be/src/exprs/compound-predicates.h
+++ b/be/src/exprs/compound-predicates.h
@@ -47,11 +47,7 @@ class AndPredicate: public CompoundPredicate {
   friend class Expr;
   AndPredicate(const TExprNode& node) : CompoundPredicate(node) { }
 
-  virtual std::string DebugString() const {
-    std::stringstream out;
-    out << "AndPredicate(" << Expr::DebugString() << ")";
-    return out.str();
-  }
+  virtual std::string DebugString() const;
 
  private:
   friend class OpcodeRegistry;
@@ -70,11 +66,7 @@ class OrPredicate: public CompoundPredicate {
   friend class Expr;
   OrPredicate(const TExprNode& node) : CompoundPredicate(node) { }
 
-  virtual std::string DebugString() const {
-    std::stringstream out;
-    out << "OrPredicate(" << Expr::DebugString() << ")";
-    return out.str();
-  }
+  virtual std::string DebugString() const;
 
  private:
   friend class OpcodeRegistry;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr-benchmark.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr-benchmark.cc b/be/src/exprs/expr-benchmark.cc
index 5439e4e..91f89b5 100644
--- a/be/src/exprs/expr-benchmark.cc
+++ b/be/src/exprs/expr-benchmark.cc
@@ -26,6 +26,7 @@
 #include "rpc/thrift-server.h"
 #include "common/object-pool.h"
 #include "common/status.h"
+#include "runtime/mem-tracker.h"
 #include "service/impala-server.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr-codegen-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr-codegen-test.cc b/be/src/exprs/expr-codegen-test.cc
index ec81b30..c660bfd 100644
--- a/be/src/exprs/expr-codegen-test.cc
+++ b/be/src/exprs/expr-codegen-test.cc
@@ -47,6 +47,7 @@ IntVal TestGetConstant(
 #include "common/init.h"
 #include "exprs/expr-context.h"
 #include "runtime/exec-env.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/runtime-state.h"
 #include "service/fe-support.h"
 #include "udf/udf-internal.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr-context.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr-context.cc b/be/src/exprs/expr-context.cc
index 2a01bfa..4420394 100644
--- a/be/src/exprs/expr-context.cc
+++ b/be/src/exprs/expr-context.cc
@@ -16,6 +16,7 @@
 
 #include <sstream>
 
+#include "common/object-pool.h"
 #include "exprs/expr.h"
 #include "runtime/decimal-value.inline.h"
 #include "runtime/mem-pool.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr-test.cc b/be/src/exprs/expr-test.cc
index 09f60cb..ed60016 100644
--- a/be/src/exprs/expr-test.cc
+++ b/be/src/exprs/expr-test.cc
@@ -39,6 +39,7 @@
 #include "gen-cpp/hive_metastore_types.h"
 #include "rpc/thrift-client.h"
 #include "rpc/thrift-server.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/raw-value.inline.h"
 #include "runtime/string-value.h"
 #include "runtime/timestamp-value.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr.cc b/be/src/exprs/expr.cc
index 29c8c91..0156edc 100644
--- a/be/src/exprs/expr.cc
+++ b/be/src/exprs/expr.cc
@@ -57,6 +57,9 @@
 #include "gen-cpp/Data_types.h"
 #include "runtime/lib-cache.h"
 #include "runtime/runtime-state.h"
+#include "runtime/raw-value.h"
+#include "runtime/tuple.h"
+#include "runtime/tuple-row.h"
 #include "udf/udf.h"
 #include "udf/udf-internal.h"
 
@@ -728,4 +731,10 @@ Status Expr::GetFnContextError(ExprContext* ctx) {
   return Status::OK();
 }
 
+string Expr::DebugString(const string& expr_name) const {
+  stringstream out;
+  out << expr_name << "(" << Expr::DebugString() << ")";
+  return out.str();
+}
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/expr.h
----------------------------------------------------------------------
diff --git a/be/src/exprs/expr.h b/be/src/exprs/expr.h
index e7e12b2..e0c55b6 100644
--- a/be/src/exprs/expr.h
+++ b/be/src/exprs/expr.h
@@ -85,18 +85,14 @@
 #ifndef IMPALA_EXPRS_EXPR_H
 #define IMPALA_EXPRS_EXPR_H
 
+#include <boost/scoped_ptr.hpp>
 #include <string>
 #include <vector>
 
+#include "common/global-types.h"
 #include "common/status.h"
 #include "impala-ir/impala-ir-functions.h"
-#include "runtime/descriptors.h"
-#include "runtime/decimal-value.h"
-#include "runtime/lib-cache.h"
-#include "runtime/tuple.h"
-#include "runtime/tuple-row.h"
-#include "runtime/string-value.h"
-#include "runtime/timestamp-value.h"
+#include "runtime/types.h"
 #include "udf/udf.h"
 #include "udf/udf-internal.h" // for CollectionVal
 
@@ -111,15 +107,19 @@ namespace llvm {
 
 namespace impala {
 
-class Expr;
+class ExprContext;
 class IsNullExpr;
+class LibCacheEntry;
 class LlvmCodeGen;
+class MemTracker;
 class ObjectPool;
 class RowDescriptor;
 class RuntimeState;
 class TColumnValue;
 class TExpr;
 class TExprNode;
+class Tuple;
+class TupleRow;
 
 /// This is the superclass of all expr evaluation nodes.
 class Expr {
@@ -343,7 +343,7 @@ class Expr {
       FunctionContext::FunctionStateScope scope = FunctionContext::FRAGMENT_LOCAL);
 
   /// Cache entry for the library implementing this function.
-  LibCache::LibCacheEntry* cache_entry_;
+  LibCacheEntry* cache_entry_;
 
   /// Function description.
   TFunction fn_;
@@ -399,11 +399,7 @@ class Expr {
   int InlineConstants(LlvmCodeGen* codegen, llvm::Function* fn);
 
   /// Simple debug string that provides no expr subclass-specific information
-  std::string DebugString(const std::string& expr_name) const {
-    std::stringstream out;
-    out << expr_name << "(" << Expr::DebugString() << ")";
-    return out.str();
-  }
+  std::string DebugString(const std::string& expr_name) const;
 
  private:
   friend class ExprContext;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/in-predicate-ir.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/in-predicate-ir.cc b/be/src/exprs/in-predicate-ir.cc
index 61d39ef..80883c7 100644
--- a/be/src/exprs/in-predicate-ir.cc
+++ b/be/src/exprs/in-predicate-ir.cc
@@ -17,6 +17,7 @@
 #include "exprs/in-predicate.h"
 
 #include "exprs/anyval-util.h"
+#include "runtime/decimal-value.h"
 #include "runtime/string-value.inline.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/math-functions-ir.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/math-functions-ir.cc b/be/src/exprs/math-functions-ir.cc
index ce08ba8..344db59 100644
--- a/be/src/exprs/math-functions-ir.cc
+++ b/be/src/exprs/math-functions-ir.cc
@@ -27,10 +27,6 @@
 
 #include "common/names.h"
 
-using boost::algorithm::is_any_of;
-using boost::algorithm::join;
-using boost::algorithm::split;
-using boost::algorithm::to_lower;
 using std::uppercase;
 
 namespace impala {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/slot-ref.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/slot-ref.cc b/be/src/exprs/slot-ref.cc
index b075fb2..59c2b78 100644
--- a/be/src/exprs/slot-ref.cc
+++ b/be/src/exprs/slot-ref.cc
@@ -20,8 +20,12 @@
 #include "codegen/llvm-codegen.h"
 #include "gen-cpp/Exprs_types.h"
 #include "runtime/collection-value.h"
+#include "runtime/decimal-value.h"
+#include "runtime/multi-precision.h"
 #include "runtime/runtime-state.h"
 #include "runtime/string-value.inline.h"
+#include "runtime/timestamp-value.h"
+#include "runtime/tuple-row.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/slot-ref.h
----------------------------------------------------------------------
diff --git a/be/src/exprs/slot-ref.h b/be/src/exprs/slot-ref.h
index 4708df5..a00adbf 100644
--- a/be/src/exprs/slot-ref.h
+++ b/be/src/exprs/slot-ref.h
@@ -16,6 +16,7 @@
 #define IMPALA_EXPRS_SLOTREF_H
 
 #include "exprs/expr.h"
+#include "runtime/descriptors.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/exprs/tuple-is-null-predicate.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/tuple-is-null-predicate.cc b/be/src/exprs/tuple-is-null-predicate.cc
index ff20471..ba96138 100644
--- a/be/src/exprs/tuple-is-null-predicate.cc
+++ b/be/src/exprs/tuple-is-null-predicate.cc
@@ -19,6 +19,8 @@
 #include "gen-cpp/Exprs_types.h"
 
 #include "common/names.h"
+#include "runtime/descriptors.h"
+#include "runtime/tuple-row.h"
 
 namespace impala {
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/be/src/runtime/CMakeLists.txt b/be/src/runtime/CMakeLists.txt
index 6c15330..0498125 100644
--- a/be/src/runtime/CMakeLists.txt
+++ b/be/src/runtime/CMakeLists.txt
@@ -48,6 +48,7 @@ add_library(Runtime
   raw-value-ir.cc
   row-batch.cc
   runtime-filter.cc
+  runtime-filter-bank.cc
   runtime-state.cc
   sorted-run-merger.cc
   sorter.cc

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/backend-client.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/backend-client.h b/be/src/runtime/backend-client.h
index 28e8348..d0783ea 100644
--- a/be/src/runtime/backend-client.h
+++ b/be/src/runtime/backend-client.h
@@ -16,7 +16,7 @@
 #define IMPALA_BACKEND_CLIENT_H
 
 #include "runtime/client-cache.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 
 #include "gen-cpp/ImpalaInternalService.h"
 
@@ -63,9 +63,6 @@ class ImpalaBackendClient : public ImpalaInternalServiceClient {
   RuntimeProfile::ConcurrentTimerCounter* transmit_csw_;
 };
 
-class ImpalaBackendClient;
-typedef ClientCache<ImpalaBackendClient> ImpalaBackendClientCache;
-typedef ClientConnection<ImpalaBackendClient> ImpalaBackendConnection;
 }
 
 #endif // IMPALA_BACKEND_CLIENT_H

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/buffered-block-mgr.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/buffered-block-mgr.cc b/be/src/runtime/buffered-block-mgr.cc
index b11054c..8265ea2 100644
--- a/be/src/runtime/buffered-block-mgr.cc
+++ b/be/src/runtime/buffered-block-mgr.cc
@@ -17,7 +17,7 @@
 #include "runtime/mem-pool.h"
 #include "runtime/buffered-block-mgr.h"
 #include "runtime/tmp-file-mgr.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/disk-info.h"
 #include "util/filesystem-util.h"
 #include "util/impalad-metrics.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/buffered-block-mgr.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/buffered-block-mgr.h b/be/src/runtime/buffered-block-mgr.h
index 3efa634..9e54c4f 100644
--- a/be/src/runtime/buffered-block-mgr.h
+++ b/be/src/runtime/buffered-block-mgr.h
@@ -592,7 +592,7 @@ class BufferedBlockMgr {
 
   /// DiskIoMgr handles to read and write blocks.
   DiskIoMgr* io_mgr_;
-  DiskIoMgr::RequestContext* io_request_context_;
+  DiskIoRequestContext* io_request_context_;
 
   /// If true, a disk write failed and all API calls return.
   /// Status::CANCELLED. Set to true if there was an error writing a block, or if

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/buffered-tuple-stream.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/buffered-tuple-stream.cc b/be/src/runtime/buffered-tuple-stream.cc
index eb35a69..96e2d0c 100644
--- a/be/src/runtime/buffered-tuple-stream.cc
+++ b/be/src/runtime/buffered-tuple-stream.cc
@@ -24,6 +24,7 @@
 #include "runtime/tuple-row.h"
 #include "util/bit-util.h"
 #include "util/debug-util.h"
+#include "util/runtime-profile-counters.h"
 
 #include "common/names.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/client-cache-types.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/client-cache-types.h b/be/src/runtime/client-cache-types.h
new file mode 100644
index 0000000..70a82bf
--- /dev/null
+++ b/be/src/runtime/client-cache-types.h
@@ -0,0 +1,42 @@
+// Copyright 2016 Cloudera Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef IMPALA_RUNTIME_CLIENT_CACHE_DECLS_H
+#define IMPALA_RUNTIME_CLIENT_CACHE_DECLS_H
+
+namespace impala {
+
+/// Forward declarations for client cache types to avoid including the full class
+/// declaration indirectly in many places where it is not needed.
+template<class T>
+class ClientCache;
+
+template<class T>
+class ClientConnection;
+
+/// Common cache / connection types
+class ImpalaInternalServiceClient;
+typedef ClientCache<ImpalaInternalServiceClient> ImpalaInternalServiceClientCache;
+typedef ClientConnection<ImpalaInternalServiceClient> ImpalaInternalServiceConnection;
+
+class CatalogServiceClient;
+typedef ClientCache<CatalogServiceClient> CatalogServiceClientCache;
+typedef ClientConnection<CatalogServiceClient> CatalogServiceConnection;
+
+class ImpalaBackendClient;
+typedef ClientCache<ImpalaBackendClient> ImpalaBackendClientCache;
+typedef ClientConnection<ImpalaBackendClient> ImpalaBackendConnection;
+}
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/client-cache.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/client-cache.h b/be/src/runtime/client-cache.h
index 7ca24a2..ff38286 100644
--- a/be/src/runtime/client-cache.h
+++ b/be/src/runtime/client-cache.h
@@ -22,6 +22,7 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/bind.hpp>
 
+#include "runtime/client-cache-types.h"
 #include "util/metrics.h"
 #include "rpc/thrift-client.h"
 #include "rpc/thrift-util.h"
@@ -183,9 +184,6 @@ class ClientCacheHelper {
       ClientKey* client_key);
 };
 
-template<class T>
-class ClientCache;
-
 /// A scoped client connection to help manage clients from a client cache. Clients of this
 /// class should use DoRpc() to actually make RPC calls.
 template<class T>

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/collection-value-builder-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/collection-value-builder-test.cc b/be/src/runtime/collection-value-builder-test.cc
index e86737b..b3dfc55 100644
--- a/be/src/runtime/collection-value-builder-test.cc
+++ b/be/src/runtime/collection-value-builder-test.cc
@@ -15,6 +15,7 @@
 #include <gtest/gtest.h>
 
 #include "runtime/collection-value-builder.h"
+#include "runtime/mem-tracker.h"
 #include "testutil/desc-tbl-builder.h"
 #include "testutil/gtest-util.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/coordinator.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/coordinator.cc b/be/src/runtime/coordinator.cc
index fd27a51..7cb6c97 100644
--- a/be/src/runtime/coordinator.cc
+++ b/be/src/runtime/coordinator.cc
@@ -43,10 +43,12 @@
 #include "runtime/data-stream-mgr.h"
 #include "runtime/exec-env.h"
 #include "runtime/hdfs-fs-cache.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/plan-fragment-executor.h"
 #include "runtime/row-batch.h"
 #include "runtime/backend-client.h"
 #include "runtime/parallel-executor.h"
+#include "runtime/tuple-row.h"
 #include "scheduling/scheduler.h"
 #include "exec/data-sink.h"
 #include "exec/scan-node.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/coordinator.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/coordinator.h b/be/src/runtime/coordinator.h
index 048523c..578c61d 100644
--- a/be/src/runtime/coordinator.h
+++ b/be/src/runtime/coordinator.h
@@ -28,10 +28,10 @@
 #include <boost/accumulators/statistics/variance.hpp>
 #include <boost/unordered_map.hpp>
 #include <boost/unordered_set.hpp>
-#include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 
+#include "common/hdfs.h"
 #include "common/status.h"
 #include "common/global-types.h"
 #include "util/progress-updater.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-mgr.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-mgr.cc b/be/src/runtime/data-stream-mgr.cc
index ae41a36..b366a70 100644
--- a/be/src/runtime/data-stream-mgr.cc
+++ b/be/src/runtime/data-stream-mgr.cc
@@ -25,6 +25,7 @@
 #include "runtime/runtime-state.h"
 #include "util/debug-util.h"
 #include "util/periodic-counter-updater.h"
+#include "util/runtime-profile-counters.h"
 #include "util/uid-util.h"
 
 #include "gen-cpp/ImpalaInternalService.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-mgr.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-mgr.h b/be/src/runtime/data-stream-mgr.h
index 05da622..21f8336 100644
--- a/be/src/runtime/data-stream-mgr.h
+++ b/be/src/runtime/data-stream-mgr.h
@@ -27,7 +27,7 @@
 #include "common/status.h"
 #include "common/object-pool.h"
 #include "runtime/descriptors.h"  // for PlanNodeId
-#include "runtime/mem-tracker.h"
+#include "util/metrics.h"
 #include "util/promise.h"
 #include "util/runtime-profile.h"
 #include "gen-cpp/Types_types.h"  // for TUniqueId

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-recvr.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-recvr.cc b/be/src/runtime/data-stream-recvr.cc
index 516aef6..10b0803 100644
--- a/be/src/runtime/data-stream-recvr.cc
+++ b/be/src/runtime/data-stream-recvr.cc
@@ -17,9 +17,10 @@
 
 #include "runtime/data-stream-recvr.h"
 #include "runtime/data-stream-mgr.h"
+#include "runtime/mem-tracker.h"
 #include "runtime/row-batch.h"
 #include "runtime/sorted-run-merger.h"
-#include "util/runtime-profile.h"
+#include "util/runtime-profile-counters.h"
 #include "util/periodic-counter-updater.h"
 
 #include "common/names.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-sender.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-sender.cc b/be/src/runtime/data-stream-sender.cc
index 79f7d64..0a10963 100644
--- a/be/src/runtime/data-stream-sender.cc
+++ b/be/src/runtime/data-stream-sender.cc
@@ -31,6 +31,7 @@
 #include "runtime/backend-client.h"
 #include "util/debug-util.h"
 #include "util/network-util.h"
+#include "util/thread-pool.h"
 #include "rpc/thrift-client.h"
 #include "rpc/thrift-util.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-sender.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-sender.h b/be/src/runtime/data-stream-sender.h
index 7a93933..6f66aa7 100644
--- a/be/src/runtime/data-stream-sender.h
+++ b/be/src/runtime/data-stream-sender.h
@@ -29,6 +29,7 @@
 namespace impala {
 
 class Expr;
+class ExprContext;
 class RowBatch;
 class RowDescriptor;
 class MemTracker;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/data-stream-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/data-stream-test.cc b/be/src/runtime/data-stream-test.cc
index 2341c17..54b38b1 100644
--- a/be/src/runtime/data-stream-test.cc
+++ b/be/src/runtime/data-stream-test.cc
@@ -29,8 +29,9 @@
 #include "runtime/data-stream-recvr.h"
 #include "runtime/descriptors.h"
 #include "runtime/client-cache.h"
-#include "runtime/raw-value.inline.h"
 #include "runtime/backend-client.h"
+#include "runtime/mem-tracker.h"
+#include "runtime/raw-value.inline.h"
 #include "service/fe-support.h"
 #include "util/cpu-info.h"
 #include "util/disk-info.h"

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/descriptors.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/descriptors.h b/be/src/runtime/descriptors.h
index 18d835c..3c67c7e 100644
--- a/be/src/runtime/descriptors.h
+++ b/be/src/runtime/descriptors.h
@@ -16,7 +16,6 @@
 #ifndef IMPALA_RUNTIME_DESCRIPTORS_H
 #define IMPALA_RUNTIME_DESCRIPTORS_H
 
-#include <vector>
 #include <tr1/unordered_map>
 #include <vector>
 #include <boost/scoped_ptr.hpp>

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6198d926/be/src/runtime/disk-io-mgr-internal.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/disk-io-mgr-internal.h b/be/src/runtime/disk-io-mgr-internal.h
index e58a3f3..6994cfe 100644
--- a/be/src/runtime/disk-io-mgr-internal.h
+++ b/be/src/runtime/disk-io-mgr-internal.h
@@ -22,6 +22,7 @@
 #include <gutil/strings/substitute.h>
 
 #include "common/logging.h"
+#include "runtime/disk-io-mgr.h"
 #include "runtime/mem-tracker.h"
 #include "runtime/thread-resource-mgr.h"
 #include "util/cpu-info.h"
@@ -50,10 +51,10 @@ struct DiskIoMgr::DiskQueue {
   boost::condition_variable work_available;
 
   /// list of all request contexts that have work queued on this disk
-  std::list<RequestContext*> request_contexts;
+  std::list<DiskIoRequestContext*> request_contexts;
 
   /// Enqueue the request context to the disk queue.  The DiskQueue lock must not be taken.
-  inline void EnqueueContext(RequestContext* worker) {
+  inline void EnqueueContext(DiskIoRequestContext* worker) {
     {
       boost::unique_lock<boost::mutex> disk_lock(lock);
       /// Check that the reader is not already on the queue
@@ -75,14 +76,14 @@ struct DiskIoMgr::DiskQueue {
 /// A scan range for the reader is on one of five states:
 /// 1) PerDiskState's unstarted_ranges: This range has only been queued
 ///    and nothing has been read from it.
-/// 2) RequestContext's ready_to_start_ranges_: This range is about to be started.
+/// 2) DiskIoRequestContext's ready_to_start_ranges_: This range is about to be started.
 ///    As soon as the reader picks it up, it will move to the in_flight_ranges
 ///    queue.
 /// 3) PerDiskState's in_flight_ranges: This range is being processed and will
 ///    be read from the next time a disk thread picks it up in GetNextRequestRange()
 /// 4) ScanRange's outgoing ready buffers is full. We can't read for this range
 ///    anymore. We need the caller to pull a buffer off which will put this in
-///    the in_flight_ranges queue. These ranges are in the RequestContext's
+///    the in_flight_ranges queue. These ranges are in the DiskIoRequestContext's
 ///    blocked_ranges_ queue.
 /// 5) ScanRange is cached and in the cached_ranges_ queue.
 //
@@ -111,15 +112,21 @@ struct DiskIoMgr::DiskQueue {
 /// the entire range is written when the write request is handled. (In other words, writes
 /// are not broken up.)
 //
-/// When a RequestContext is processed by a disk thread in GetNextRequestRange(), a write
-/// range is always removed from the list of unstarted write ranges and appended to the
-/// in_flight_ranges_ queue. This is done to alternate reads and writes - a read that is
-/// scheduled (by calling GetNextRange()) is always followed by a write (if one exists).
-/// And since at most one WriteRange can be present in in_flight_ranges_ at any time
-/// (once a write range is returned from GetNetxRequestRange() it is completed and not
-/// re-enqueued), a scan range scheduled via a call to GetNextRange() can be queued up
+/// When a DiskIoRequestContext is processed by a disk thread in GetNextRequestRange(),
+/// a write range is always removed from the list of unstarted write ranges and appended
+/// to the in_flight_ranges_ queue. This is done to alternate reads and writes - a read
+/// that is scheduled (by calling GetNextRange()) is always followed by a write (if one
+/// exists).  And since at most one WriteRange can be present in in_flight_ranges_ at any
+/// time (once a write range is returned from GetNetxRequestRange() it is completed an
+/// not re-enqueued), a scan range scheduled via a call to GetNextRange() can be queued up
 /// behind at most one write range.
-class DiskIoMgr::RequestContext {
+class DiskIoRequestContext {
+  using DiskQueue = DiskIoMgr::DiskQueue;
+  using RequestRange = DiskIoMgr::RequestRange;
+  using ScanRange = DiskIoMgr::ScanRange;
+  using WriteRange = DiskIoMgr::WriteRange;
+  using RequestType = DiskIoMgr::RequestType;
+
  public:
   enum State {
     /// Reader is initialized and maps to a client
@@ -135,7 +142,7 @@ class DiskIoMgr::RequestContext {
     Inactive,
   };
 
-  RequestContext(DiskIoMgr* parent, int num_disks);
+  DiskIoRequestContext(DiskIoMgr* parent, int num_disks);
 
   /// Resets this object.
   void Reset(MemTracker* tracker);
@@ -162,10 +169,10 @@ class DiskIoMgr::RequestContext {
   /// Adds range to in_flight_ranges, scheduling this reader on the disk threads
   /// if necessary.
   /// Reader lock must be taken before this.
-  void ScheduleScanRange(DiskIoMgr::ScanRange* range) {
+  void ScheduleScanRange(ScanRange* range) {
     DCHECK_EQ(state_, Active);
     DCHECK(range != NULL);
-    RequestContext::PerDiskState& state = disk_states_[range->disk_id()];
+    DiskIoRequestContext::PerDiskState& state = disk_states_[range->disk_id()];
     state.in_flight_ranges()->Enqueue(range);
     state.ScheduleContext(this, range->disk_id());
   }
@@ -175,7 +182,7 @@ class DiskIoMgr::RequestContext {
 
   /// Adds request range to disk queue for this request context. Currently,
   /// schedule_immediately must be false is RequestRange is a write range.
-  void AddRequestRange(DiskIoMgr::RequestRange* range, bool schedule_immediately);
+  void AddRequestRange(RequestRange* range, bool schedule_immediately);
 
   /// Returns the default queue capacity for scan ranges. This is updated
   /// as the reader processes ranges.
@@ -338,11 +345,15 @@ class DiskIoMgr::RequestContext {
       return &in_flight_ranges_;
     }
 
-    InternalQueue<ScanRange>* unstarted_scan_ranges() { return &unstarted_scan_ranges_; }
+    InternalQueue<ScanRange>* unstarted_scan_ranges() {
+      return &unstarted_scan_ranges_;
+    }
     InternalQueue<WriteRange>* unstarted_write_ranges() {
       return &unstarted_write_ranges_;
     }
-    InternalQueue<RequestRange>* in_flight_ranges() { return &in_flight_ranges_; }
+    InternalQueue<RequestRange>* in_flight_ranges() {
+      return &in_flight_ranges_;
+    }
 
     PerDiskState() {
       Reset();
@@ -350,7 +361,7 @@ class DiskIoMgr::RequestContext {
 
     /// Schedules the request context on this disk if it's not already on the queue.
     /// Context lock must be taken before this.
-    void ScheduleContext(RequestContext* context, int disk_id) {
+    void ScheduleContext(DiskIoRequestContext* context, int disk_id) {
       if (!is_on_queue_ && !done_) {
         is_on_queue_ = true;
         context->parent_->disk_queues_[disk_id]->EnqueueContext(context);
@@ -371,7 +382,7 @@ class DiskIoMgr::RequestContext {
 
     /// Decrement request thread count and do final cleanup if this is the last
     /// thread. RequestContext lock must be taken before this.
-    void DecrementRequestThreadAndCheckDone(RequestContext* context) {
+    void DecrementRequestThreadAndCheckDone(DiskIoRequestContext* context) {
       num_threads_in_op_.Add(-1); // Also acts as a barrier.
       if (!is_on_queue_ && num_threads_in_op_.Load() == 0 && !done_) {
         // This thread is the last one for this reader on this disk, do final cleanup
@@ -416,7 +427,7 @@ class DiskIoMgr::RequestContext {
     /// For each disks, the number of request ranges that have not been fully read.
     /// In the non-cancellation path, this will hit 0, and done will be set to true
     /// by the disk thread. This is undefined in the cancellation path (the various
-    /// threads notice by looking at the RequestContext's state_).
+    /// threads notice by looking at the DiskIoRequestContext's state_).
     int num_remaining_ranges_;
 
     /// Queue of ranges that have not started being read.  This list is exclusive



Mime
View raw message