impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [23/50] [abbrv] incubator-impala git commit: IMPALA-3443: Replace BOOST_FOREACH with ranged for()
Date Thu, 12 May 2016 22:09:58 GMT
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/scheduling/admission-controller.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/admission-controller.cc b/be/src/scheduling/admission-controller.cc
index 679fcdd..70174a1 100644
--- a/be/src/scheduling/admission-controller.cc
+++ b/be/src/scheduling/admission-controller.cc
@@ -16,7 +16,6 @@
 
 #include <boost/algorithm/string.hpp>
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include <boost/mem_fn.hpp>
 #include <gutil/strings/substitute.h>
 
@@ -292,7 +291,7 @@ void AdmissionController::PoolStats::Dequeue(const QuerySchedule& schedule,
 void AdmissionController::UpdateHostMemAdmitted(const QuerySchedule& schedule,
     int64_t per_node_mem) {
   const unordered_set<TNetworkAddress>& hosts = schedule.unique_hosts();
-  BOOST_FOREACH(const TNetworkAddress& host_addr, hosts) {
+  for (const TNetworkAddress& host_addr: hosts) {
     const string host = TNetworkAddressToString(host_addr);
     VLOG_ROW << "Update admitted mem reserved for host=" << host
              << " prev=" << PrintBytes(host_mem_admitted_[host])
@@ -332,7 +331,7 @@ bool AdmissionController::HasAvailableMemResources(const QuerySchedule& schedule
 
   // Case 2:
   int64_t proc_mem_limit = GetProcMemLimit();
-  BOOST_FOREACH(const TNetworkAddress& host, schedule.unique_hosts()) {
+  for (const TNetworkAddress& host: schedule.unique_hosts()) {
     const string host_id = TNetworkAddressToString(host);
     int64_t mem_reserved = host_mem_reserved_[host_id];
     int64_t mem_admitted = host_mem_admitted_[host_id];
@@ -555,7 +554,7 @@ void AdmissionController::UpdatePoolStats(
       // and then re-compute the pool stats for any pools that changed.
       if (!delta.is_delta) {
         VLOG_ROW << "Full impala-request-queue stats update";
-        BOOST_FOREACH(PoolStatsMap::value_type& entry, pool_stats_) {
+        for (PoolStatsMap::value_type& entry: pool_stats_) {
           entry.second.ClearRemoteStats();
         }
       }
@@ -591,7 +590,7 @@ void AdmissionController::PoolStats::UpdateRemoteStats(const string& host_id,
 }
 
 void AdmissionController::HandleTopicUpdates(const vector<TTopicItem>& topic_updates) {
-  BOOST_FOREACH(const TTopicItem& item, topic_updates) {
+  for (const TTopicItem& item: topic_updates) {
     string pool_name;
     string topic_backend_id;
     if (!ParsePoolTopicKey(item.key, &pool_name, &topic_backend_id)) continue;
@@ -611,7 +610,7 @@ void AdmissionController::HandleTopicUpdates(const vector<TTopicItem>& topic_upd
 }
 
 void AdmissionController::HandleTopicDeletions(const vector<string>& topic_deletions) {
-  BOOST_FOREACH(const string& topic_key, topic_deletions) {
+  for (const string& topic_key: topic_deletions) {
     string pool_name;
     string topic_backend_id;
     if (!ParsePoolTopicKey(topic_key, &pool_name, &topic_backend_id)) continue;
@@ -626,8 +625,8 @@ void AdmissionController::PoolStats::UpdateAggregates(
   int64_t num_running = 0;
   int64_t num_queued = 0;
   int64_t mem_reserved = 0;
-  BOOST_FOREACH(const PoolStats::RemoteStatsMap::value_type& remote_entry,
-      remote_stats_) {
+  for (const PoolStats::RemoteStatsMap::value_type& remote_entry:
+       remote_stats_) {
     const string& host = remote_entry.first;
     // Skip an update from this subscriber as the information may be outdated.
     // The stats from this coordinator will be added below.
@@ -675,7 +674,7 @@ void AdmissionController::PoolStats::UpdateAggregates(
 void AdmissionController::UpdateClusterAggregates() {
   // Recompute the host mem reserved.
   HostMemMap updated_mem_reserved;
-  BOOST_FOREACH(PoolStatsMap::value_type& entry, pool_stats_) {
+  for (PoolStatsMap::value_type& entry: pool_stats_) {
     entry.second.UpdateAggregates(&updated_mem_reserved);
   }
 
@@ -683,7 +682,7 @@ void AdmissionController::UpdateClusterAggregates() {
     stringstream ss;
     ss << "Updated mem reserved for hosts:";
     int i = 0;
-    BOOST_FOREACH(const HostMemMap::value_type& e, updated_mem_reserved) {
+    for (const HostMemMap::value_type& e: updated_mem_reserved) {
       if (host_mem_reserved_[e.first] == e.second) continue;
       ss << endl << e.first << ": " << PrintBytes(host_mem_reserved_[e.first]);
       ss << " -> " << PrintBytes(e.second);
@@ -715,14 +714,14 @@ void AdmissionController::PoolStats::UpdateMemTrackerStats() {
 void AdmissionController::AddPoolUpdates(vector<TTopicDelta>* topic_updates) {
   // local_stats_ are updated eagerly except for backend_mem_reserved (which isn't used
   // for local admission control decisions). Update that now before sending local_stats_.
-  BOOST_FOREACH(PoolStatsMap::value_type& entry, pool_stats_) {
+  for (PoolStatsMap::value_type& entry: pool_stats_) {
     entry.second.UpdateMemTrackerStats();
   }
   if (pools_for_updates_.empty()) return;
   topic_updates->push_back(TTopicDelta());
   TTopicDelta& topic_delta = topic_updates->back();
   topic_delta.topic_name = IMPALA_REQUEST_QUEUE_TOPIC;
-  BOOST_FOREACH(const string& pool_name, pools_for_updates_) {
+  for (const string& pool_name: pools_for_updates_) {
     DCHECK(pool_stats_.find(pool_name) != pool_stats_.end());
     PoolStats* stats = GetPoolStats(pool_name);
     VLOG_ROW << "Sending topic update " << stats->DebugString();
@@ -744,7 +743,7 @@ void AdmissionController::DequeueLoop() {
     unique_lock<mutex> lock(admission_ctrl_lock_);
     if (done_) break;
     dequeue_cv_.wait(lock);
-    BOOST_FOREACH(const PoolConfigMap::value_type& entry, pool_config_map_) {
+    for (const PoolConfigMap::value_type& entry: pool_config_map_) {
       const string& pool_name = entry.first;
       const TPoolConfig& pool_config = entry.second;
       const int64_t max_requests = pool_config.max_requests;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/scheduling/query-resource-mgr.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/query-resource-mgr.cc b/be/src/scheduling/query-resource-mgr.cc
index e1e0581..5687269 100644
--- a/be/src/scheduling/query-resource-mgr.cc
+++ b/be/src/scheduling/query-resource-mgr.cc
@@ -14,7 +14,6 @@
 
 #include "scheduling/query-resource-mgr.h"
 
-#include <boost/foreach.hpp>
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <gutil/strings/substitute.h>
@@ -64,7 +63,7 @@ void ResourceResolver::CreateLocalLlamaNodeMapping(
       ExecEnv::GetInstance()->resource_broker()->llama_nodes();
   DCHECK(!llama_nodes.empty());
   int llama_node_ix = 0;
-  BOOST_FOREACH(const TNetworkAddress& host, unique_hosts) {
+  for (const TNetworkAddress& host: unique_hosts) {
     TNetworkAddress dn_hostport = MakeNetworkAddress(llama_nodes[llama_node_ix]);
     impalad_to_dn_[host] = dn_hostport;
     dn_to_impalad_[dn_hostport] = host;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/scheduling/query-schedule.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/query-schedule.cc b/be/src/scheduling/query-schedule.cc
index df2ee01..7edd52d 100644
--- a/be/src/scheduling/query-schedule.cc
+++ b/be/src/scheduling/query-schedule.cc
@@ -16,7 +16,6 @@
 
 #include <sstream>
 #include <boost/algorithm/string/join.hpp>
-#include <boost/foreach.hpp>
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 
@@ -72,7 +71,7 @@ QuerySchedule::QuerySchedule(const TUniqueId& query_id,
   // fragment's plan's nodes list.
   for (int i = 0; i < request.fragments.size(); ++i) {
     int node_idx = 0;
-    BOOST_FOREACH(const TPlanNode& node, request.fragments[i].plan.nodes) {
+    for (const TPlanNode& node: request.fragments[i].plan.nodes) {
       if (plan_node_to_fragment_idx_.size() < node.node_id + 1) {
         plan_node_to_fragment_idx_.resize(node.node_id + 1);
         plan_node_to_plan_node_idx_.resize(node.node_id + 1);
@@ -195,7 +194,7 @@ void QuerySchedule::PrepareReservationRequest(const string& pool, const string&
   DCHECK(resource_resolver_.get() != NULL)
       << "resource_resolver_ is NULL, didn't call SetUniqueHosts()?";
   random_generator uuid_generator;
-  BOOST_FOREACH(const TNetworkAddress& host, unique_hosts_) {
+  for (const TNetworkAddress& host: unique_hosts_) {
     reservation_request_.resources.push_back(llama::TResource());
     llama::TResource& resource = reservation_request_.resources.back();
     uuid id = uuid_generator();
@@ -217,8 +216,8 @@ Status QuerySchedule::ValidateReservation() {
   if (!HasReservation()) return Status("Query schedule does not have a reservation.");
   vector<TNetworkAddress> hosts_missing_resources;
   ResourceResolver resolver(unique_hosts_);
-  BOOST_FOREACH(const FragmentExecParams& params, fragment_exec_params_) {
-    BOOST_FOREACH(const TNetworkAddress& host, params.hosts) {
+  for (const FragmentExecParams& params: fragment_exec_params_) {
+    for (const TNetworkAddress& host: params.hosts) {
       // Ignore the coordinator host which is not contained in unique_hosts_.
       if (unique_hosts_.find(host) == unique_hosts_.end()) continue;
       TNetworkAddress resource_hostport;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/scheduling/simple-scheduler.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/simple-scheduler.cc b/be/src/scheduling/simple-scheduler.cc
index ad22f71..e6121ed 100644
--- a/be/src/scheduling/simple-scheduler.cc
+++ b/be/src/scheduling/simple-scheduler.cc
@@ -20,7 +20,6 @@
 #include <boost/algorithm/string/join.hpp>
 #include <boost/bind.hpp>
 #include <boost/mem_fn.hpp>
-#include <boost/foreach.hpp>
 #include <gutil/strings/substitute.h>
 
 #include "common/logging.h"
@@ -242,7 +241,7 @@ void SimpleScheduler::BackendsUrlCallback(const Webserver::ArgumentMap& args,
   BackendList backends;
   GetAllKnownBackends(&backends);
   Value backends_list(kArrayType);
-  BOOST_FOREACH(const BackendList::value_type& backend, backends) {
+  for (const BackendList::value_type& backend: backends) {
     Value str(TNetworkAddressToString(backend.address).c_str(), document->GetAllocator());
     backends_list.PushBack(str, document->GetAllocator());
   }
@@ -276,7 +275,7 @@ void SimpleScheduler::UpdateMembership(
       }
 
       // Process new entries to the topic
-      BOOST_FOREACH(const TTopicItem& item, delta.topic_entries) {
+      for (const TTopicItem& item: delta.topic_entries) {
         TBackendDescriptor be_desc;
         // Benchmarks have suggested that this method can deserialize
         // ~10m messages per second, so no immediate need to consider optimisation.
@@ -304,7 +303,7 @@ void SimpleScheduler::UpdateMembership(
         current_membership_.insert(make_pair(item.key, be_desc));
       }
       // Process deletions from the topic
-      BOOST_FOREACH(const string& backend_id, delta.topic_deletions) {
+      for (const string& backend_id: delta.topic_deletions) {
         if (current_membership_.find(backend_id) != current_membership_.end()) {
           const TBackendDescriptor& be_desc = current_membership_[backend_id];
           backend_ip_map_.erase(be_desc.address.hostname);
@@ -409,7 +408,7 @@ Status SimpleScheduler::GetBackend(const TNetworkAddress& data_location,
 void SimpleScheduler::GetAllKnownBackends(BackendList* backends) {
   lock_guard<mutex> lock(backend_map_lock_);
   backends->clear();
-  BOOST_FOREACH(const BackendMap::value_type& backend_list, backend_map_) {
+  for (const BackendMap::value_type& backend_list: backend_map_) {
     backends->insert(backends->end(), backend_list.second.begin(),
                      backend_list.second.end());
   }
@@ -477,7 +476,7 @@ Status SimpleScheduler::ComputeScanRangeAssignment(
   int64_t local_bytes = 0L;
   int64_t cached_bytes = 0L;
 
-  BOOST_FOREACH(const TScanRangeLocations& scan_range_locations, locations) {
+  for (const TScanRangeLocations& scan_range_locations: locations) {
     // Assign scans to replica with smallest memory distance.
     TReplicaPreference::type min_distance = TReplicaPreference::REMOTE;
     // Assign this scan range to the host w/ the fewest assigned bytes.
@@ -490,7 +489,7 @@ Status SimpleScheduler::ComputeScanRangeAssignment(
     // Equivalent replicas have the same adjusted memory distance and the same number of
     // assigned bytes.
     int num_equivalent_replicas = 0;
-    BOOST_FOREACH(const TScanRangeLocation& location, scan_range_locations.locations) {
+    for (const TScanRangeLocation& location: scan_range_locations.locations) {
       TReplicaPreference::type memory_distance = TReplicaPreference::REMOTE;
       const TNetworkAddress& replica_host = host_list[location.host_idx];
       if (HasLocalBackend(replica_host)) {
@@ -550,7 +549,7 @@ Status SimpleScheduler::ComputeScanRangeAssignment(
         is_cached = location.is_cached;
         remote_read = min_distance == TReplicaPreference::REMOTE;
       }
-    }  // end of BOOST_FOREACH
+    }  // end of for()
 
     int64_t scan_range_length = 0;
     if (scan_range_locations.scan_range.__isset.hdfs_file_split) {
@@ -606,17 +605,17 @@ Status SimpleScheduler::ComputeScanRangeAssignment(
     if (remote_hosts.size() > 0) {
       stringstream remote_node_log;
       remote_node_log << "Remote data node list: ";
-      BOOST_FOREACH(const TNetworkAddress& remote_host, remote_hosts) {
+      for (const TNetworkAddress& remote_host: remote_hosts) {
         remote_node_log << remote_host << " ";
       }
       VLOG_FILE << remote_node_log.str();
     }
 
-    BOOST_FOREACH(FragmentScanRangeAssignment::value_type& entry, *assignment) {
+    for (FragmentScanRangeAssignment::value_type& entry: *assignment) {
       VLOG_FILE << "ScanRangeAssignment: server=" << ThriftDebugString(entry.first);
-      BOOST_FOREACH(PerNodeScanRanges::value_type& per_node_scan_ranges, entry.second) {
+      for (PerNodeScanRanges::value_type& per_node_scan_ranges: entry.second) {
         stringstream str;
-        BOOST_FOREACH(TScanRangeParams& params, per_node_scan_ranges.second) {
+        for (TScanRangeParams& params: per_node_scan_ranges.second) {
           str << ThriftDebugString(params) << " ";
         }
         VLOG_FILE << "node_id=" << per_node_scan_ranges.first << " ranges=" << str.str();
@@ -632,7 +631,7 @@ void SimpleScheduler::ComputeFragmentExecParams(const TQueryExecRequest& exec_re
   vector<FragmentExecParams>* fragment_exec_params = schedule->exec_params();
   // assign instance ids
   int64_t num_fragment_instances = 0;
-  BOOST_FOREACH(FragmentExecParams& params, *fragment_exec_params) {
+  for (FragmentExecParams& params: *fragment_exec_params) {
     for (int j = 0; j < params.hosts.size(); ++j) {
       int instance_num = num_fragment_instances + j;
       // we add instance_num to query_id.lo to create a globally-unique instance id
@@ -762,7 +761,7 @@ void SimpleScheduler::ComputeFragmentHosts(const TQueryExecRequest& exec_request
   }
 
   unordered_set<TNetworkAddress> unique_hosts;
-  BOOST_FOREACH(const FragmentExecParams& exec_params, *fragment_exec_params) {
+  for (const FragmentExecParams& exec_params: *fragment_exec_params) {
     unique_hosts.insert(exec_params.hosts.begin(), exec_params.hosts.end());
   }
 
@@ -821,7 +820,7 @@ void SimpleScheduler::GetScanHosts(TPlanNodeId scan_id,
   }
 
   // Get the list of impalad host from scan_range_assignment_
-  BOOST_FOREACH(const FragmentScanRangeAssignment::value_type& scan_range_assignment,
+  for (const FragmentScanRangeAssignment::value_type& scan_range_assignment:
       params.scan_range_assignment) {
     scan_hosts->push_back(scan_range_assignment.first);
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/impala-beeswax-server.cc
----------------------------------------------------------------------
diff --git a/be/src/service/impala-beeswax-server.cc b/be/src/service/impala-beeswax-server.cc
index 9a880c0..478c1ea 100644
--- a/be/src/service/impala-beeswax-server.cc
+++ b/be/src/service/impala-beeswax-server.cc
@@ -21,7 +21,6 @@
 #include <jni.h>
 #include <thrift/protocol/TDebugProtocol.h>
 #include <gtest/gtest.h>
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 #include <boost/algorithm/string.hpp>
 #include <gperftools/heap-profiler.h>
@@ -533,7 +532,7 @@ Status ImpalaServer::QueryToTQueryContext(const Query& query,
 
   // Override default query options with Query.Configuration
   if (query.__isset.configuration) {
-    BOOST_FOREACH(const string& option, query.configuration) {
+    for (const string& option: query.configuration) {
       RETURN_IF_ERROR(ParseQueryOptions(option, &query_ctx->request.query_options,
           &set_query_options_mask));
     }
@@ -638,8 +637,8 @@ Status ImpalaServer::CloseInsertInternal(const TUniqueId& query_id,
       // need to revisit this, since that might lead us to insert a row without a
       // coordinator, depending on how we choose to drive the table sink.
       if (exec_state->coord() != NULL) {
-        BOOST_FOREACH(const PartitionStatusMap::value_type& v,
-            exec_state->coord()->per_partition_status()) {
+        for (const PartitionStatusMap::value_type& v:
+             exec_state->coord()->per_partition_status()) {
           const pair<string, TInsertPartitionStatus> partition_status = v;
           insert_result->rows_appended[partition_status.first] =
               partition_status.second.num_appended_rows;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/impala-hs2-server.cc
----------------------------------------------------------------------
diff --git a/be/src/service/impala-hs2-server.cc b/be/src/service/impala-hs2-server.cc
index 5ebd38c..1dc4982 100644
--- a/be/src/service/impala-hs2-server.cc
+++ b/be/src/service/impala-hs2-server.cc
@@ -22,7 +22,6 @@
 #include <jni.h>
 #include <thrift/protocol/TDebugProtocol.h>
 #include <gtest/gtest.h>
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 #include <boost/algorithm/string.hpp>
 #include <gperftools/heap-profiler.h>
@@ -89,7 +88,7 @@ int64_t ByteSize(const thrift::TColumnValue& val) {
 
 static int64_t ByteSize(const thrift::TRow& row) {
   int64_t bytes = sizeof(row);
-  BOOST_FOREACH(const thrift::TColumnValue& c, row.colVals) {
+  for (const thrift::TColumnValue& c: row.colVals) {
     bytes += ByteSize(c);
   }
   return bytes;
@@ -248,7 +247,7 @@ class ImpalaServer::HS2ColumnarResultSet : public ImpalaServer::QueryResultSet {
   virtual int64_t ByteSize(int start_idx, int num_rows) {
     const int end = min(start_idx + num_rows, (int)size());
     int64_t bytes = 0L;
-    BOOST_FOREACH(const thrift::TColumn& c, result_set_->columns) {
+    for (const thrift::TColumn& c: result_set_->columns) {
       bytes += TColumnByteSize(c, start_idx, end);
     }
     return bytes;
@@ -271,7 +270,7 @@ class ImpalaServer::HS2ColumnarResultSet : public ImpalaServer::QueryResultSet {
 
   void InitColumns() {
     result_set_->__isset.columns = true;
-    BOOST_FOREACH(const TColumn& col, metadata_.columns) {
+    for (const TColumn& col: metadata_.columns) {
       DCHECK(col.columnType.types.size() == 1) <<
           "Structured columns unsupported in HS2 interface";
       thrift::TColumn column;
@@ -610,7 +609,7 @@ void ImpalaServer::OpenSession(TOpenSessionResp& return_val,
   state->database = "default";
   state->session_timeout = FLAGS_idle_session_timeout;
   typedef map<string, string> ConfigurationMap;
-  BOOST_FOREACH(const ConfigurationMap::value_type& v, request.configuration) {
+  for (const ConfigurationMap::value_type& v: request.configuration) {
     if (iequals(v.first, "use:database")) {
       state->database = v.second;
     } else if (iequals(v.first, "idle_session_timeout")) {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/impala-server-callbacks.cc
----------------------------------------------------------------------
diff --git a/be/src/service/impala-server-callbacks.cc b/be/src/service/impala-server-callbacks.cc
index 89555e4..27806f5 100644
--- a/be/src/service/impala-server-callbacks.cc
+++ b/be/src/service/impala-server-callbacks.cc
@@ -114,7 +114,7 @@ void ImpalaServer::HadoopVarzUrlCallback(const Webserver::ArgumentMap& args,
 
   Value configs(kArrayType);
   typedef map<string, string> ConfigMap;
-  BOOST_FOREACH(const ConfigMap::value_type& config, response.configs) {
+  for (const ConfigMap::value_type& config: response.configs) {
     Value key(config.first.c_str(), document->GetAllocator());
     Value value(config.second.c_str(), document->GetAllocator());
     Value config_json(kObjectType);
@@ -204,7 +204,7 @@ void ImpalaServer::InflightQueryIdsUrlCallback(const Webserver::ArgumentMap& arg
     Document* document) {
   lock_guard<mutex> l(query_exec_state_map_lock_);
   stringstream ss;
-  BOOST_FOREACH(const QueryExecStateMap::value_type& exec_state, query_exec_state_map_) {
+  for (const QueryExecStateMap::value_type& exec_state: query_exec_state_map_) {
     ss << exec_state.second->query_id() << "\n";
   }
   document->AddMember(Webserver::ENABLE_RAW_JSON_KEY, true, document->GetAllocator());
@@ -297,8 +297,7 @@ void ImpalaServer::QueryStateUrlCallback(const Webserver::ArgumentMap& args,
   set<QueryStateRecord, QueryStateRecord> sorted_query_records;
   {
     lock_guard<mutex> l(query_exec_state_map_lock_);
-    BOOST_FOREACH(
-        const QueryExecStateMap::value_type& exec_state, query_exec_state_map_) {
+    for(const QueryExecStateMap::value_type& exec_state: query_exec_state_map_) {
       // TODO: Do this in the browser so that sorts on other keys are possible.
       sorted_query_records.insert(QueryStateRecord(*exec_state.second));
     }
@@ -306,7 +305,7 @@ void ImpalaServer::QueryStateUrlCallback(const Webserver::ArgumentMap& args,
 
   Value in_flight_queries(kArrayType);
   int64_t num_waiting_queries = 0;
-  BOOST_FOREACH(const QueryStateRecord& record, sorted_query_records) {
+  for (const QueryStateRecord& record: sorted_query_records) {
     Value record_json(kObjectType);
     QueryStateToJson(record, &record_json, document);
 
@@ -332,7 +331,7 @@ void ImpalaServer::QueryStateUrlCallback(const Webserver::ArgumentMap& args,
   Value completed_queries(kArrayType);
   {
     lock_guard<mutex> l(query_log_lock_);
-    BOOST_FOREACH(const QueryStateRecord& log_entry, query_log_) {
+    for (const QueryStateRecord& log_entry: query_log_) {
       Value record_json(kObjectType);
       QueryStateToJson(log_entry, &record_json, document);
       completed_queries.PushBack(record_json, document->GetAllocator());
@@ -345,7 +344,7 @@ void ImpalaServer::QueryStateUrlCallback(const Webserver::ArgumentMap& args,
   Value query_locations(kArrayType);
   {
     lock_guard<mutex> l(query_locations_lock_);
-    BOOST_FOREACH(const QueryLocations::value_type& location, query_locations_) {
+    for (const QueryLocations::value_type& location: query_locations_) {
       Value location_json(kObjectType);
       Value location_name(lexical_cast<string>(location.first).c_str(),
           document->GetAllocator());
@@ -363,7 +362,7 @@ void ImpalaServer::SessionsUrlCallback(const Webserver::ArgumentMap& args,
     Document* document) {
   lock_guard<mutex> l(session_state_map_lock_);
   Value sessions(kArrayType);
-  BOOST_FOREACH(const SessionStateMap::value_type& session, session_state_map_) {
+  for (const SessionStateMap::value_type& session: session_state_map_) {
     shared_ptr<SessionState> state = session.second;
     Value session_json(kObjectType);
     Value type(PrintTSessionType(state->session_type).c_str(),
@@ -424,7 +423,7 @@ void ImpalaServer::CatalogUrlCallback(const Webserver::ArgumentMap& args,
   }
 
   Value databases(kArrayType);
-  BOOST_FOREACH(const TDatabase& db, get_dbs_result.dbs) {
+  for (const TDatabase& db: get_dbs_result.dbs) {
     Value database(kObjectType);
     Value str(db.db_name.c_str(), document->GetAllocator());
     database.AddMember("name", str, document->GetAllocator());
@@ -439,7 +438,7 @@ void ImpalaServer::CatalogUrlCallback(const Webserver::ArgumentMap& args,
     }
 
     Value table_array(kArrayType);
-    BOOST_FOREACH(const string& table, get_table_results.tables) {
+    for (const string& table: get_table_results.tables) {
       Value table_obj(kObjectType);
       Value fq_name(Substitute("$0.$1", db.db_name, table).c_str(),
           document->GetAllocator());
@@ -503,7 +502,7 @@ void PlanToJsonHelper(const map<TPlanNodeId, TPlanNodeExecSummary>& summaries,
     int64_t cardinality = 0;
     int64_t max_time = 0L;
     int64_t total_time = 0;
-    BOOST_FOREACH(const TExecStats& stat, summary->second.exec_stats) {
+    for (const TExecStats& stat: summary->second.exec_stats) {
       if (summary->second.is_broadcast) {
         // Avoid multiple-counting for recipients of broadcasts.
         cardinality = ::max(cardinality, stat.cardinality);
@@ -576,19 +575,19 @@ void PlanToJson(const vector<TPlanFragment>& fragments, const TExecSummary& summ
   // Build a map from id to label so that we can resolve the targets of data-stream sinks
   // and connect plan fragments.
   map<TPlanNodeId, string> label_map;
-  BOOST_FOREACH(const TPlanFragment& fragment, fragments) {
-    BOOST_FOREACH(const TPlanNode& node, fragment.plan.nodes) {
+  for (const TPlanFragment& fragment: fragments) {
+    for (const TPlanNode& node: fragment.plan.nodes) {
       label_map[node.node_id] = node.label;
     }
   }
 
   map<TPlanNodeId, TPlanNodeExecSummary> exec_summaries;
-  BOOST_FOREACH(const TPlanNodeExecSummary& s, summary.nodes) {
+  for (const TPlanNodeExecSummary& s: summary.nodes) {
     exec_summaries[s.node_id] = s;
   }
 
   Value nodes(kArrayType);
-  BOOST_FOREACH(const TPlanFragment& fragment, fragments) {
+  for (const TPlanFragment& fragment: fragments) {
     Value plan_fragment(kObjectType);
     vector<TPlanNode>::const_iterator it = fragment.plan.nodes.begin();
     PlanToJsonHelper(exec_summaries, fragment.plan.nodes, &it, document, &plan_fragment);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/impala-server.cc
----------------------------------------------------------------------
diff --git a/be/src/service/impala-server.cc b/be/src/service/impala-server.cc
index 8c8ebcf..2d314b2 100644
--- a/be/src/service/impala-server.cc
+++ b/be/src/service/impala-server.cc
@@ -21,7 +21,6 @@
 #include <boost/filesystem.hpp>
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include <boost/unordered_set.hpp>
-#include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/lexical_cast.hpp>
@@ -286,7 +285,7 @@ ImpalaServer::ImpalaServer(ExecEnv* exec_env)
     split(proxy_user_config, FLAGS_authorized_proxy_user_config, is_any_of(";"),
         token_compress_on);
     if (proxy_user_config.size() > 0) {
-      BOOST_FOREACH(const string& config, proxy_user_config) {
+      for (const string& config: proxy_user_config) {
         size_t pos = config.find("=");
         if (pos == string::npos) {
           CLEAN_EXIT_WITH_ERROR(Substitute("Invalid proxy user configuration. No "
@@ -462,7 +461,7 @@ Status ImpalaServer::LogAuditRecord(const ImpalaServer::QueryExecState& exec_sta
   writer.String(stmt.c_str());
   writer.String("catalog_objects");
   writer.StartArray();
-  BOOST_FOREACH(const TAccessEvent& event, request.access_events) {
+  for (const TAccessEvent& event: request.access_events) {
     writer.StartObject();
     writer.String("name");
     writer.String(event.name.c_str());
@@ -830,7 +829,7 @@ Status ImpalaServer::ExecuteInternal(
         (*exec_state)->schedule()->unique_hosts();
     if (!unique_hosts.empty()) {
       lock_guard<mutex> l(query_locations_lock_);
-      BOOST_FOREACH(const TNetworkAddress& port, unique_hosts) {
+      for (const TNetworkAddress& port: unique_hosts) {
         query_locations_[port].insert((*exec_state)->query_id());
       }
     }
@@ -963,7 +962,7 @@ Status ImpalaServer::UnregisterQuery(const TUniqueId& query_id, bool check_infli
         exec_state->schedule()->unique_hosts();
     if (!unique_hosts.empty()) {
       lock_guard<mutex> l(query_locations_lock_);
-      BOOST_FOREACH(const TNetworkAddress& hostport, unique_hosts) {
+      for (const TNetworkAddress& hostport: unique_hosts) {
         // Query may have been removed already by cancellation path. In particular, if
         // node to fail was last sender to an exchange, the coordinator will realise and
         // fail the query at the same time the failure detection path does the same
@@ -984,7 +983,7 @@ Status ImpalaServer::UpdateCatalogMetrics() {
   RETURN_IF_ERROR(exec_env_->frontend()->GetDbs(NULL, NULL, &dbs));
   ImpaladMetrics::CATALOG_NUM_DBS->set_value(dbs.dbs.size());
   ImpaladMetrics::CATALOG_NUM_TABLES->set_value(0L);
-  BOOST_FOREACH(const TDatabase& db, dbs.dbs) {
+  for (const TDatabase& db: dbs.dbs) {
     TGetTablesResult table_names;
     RETURN_IF_ERROR(exec_env_->frontend()->GetTableNames(db.db_name, NULL, NULL,
         &table_names));
@@ -1046,7 +1045,7 @@ Status ImpalaServer::CloseSessionInternal(const TUniqueId& session_id,
   }
   // Unregister all open queries from this session.
   Status status("Session closed");
-  BOOST_FOREACH(const TUniqueId& query_id, inflight_queries) {
+  for (const TUniqueId& query_id: inflight_queries) {
     UnregisterQuery(query_id, false, &status);
   }
   // Reconfigure the poll period of session_timeout_thread_ if necessary.
@@ -1228,7 +1227,7 @@ Status ImpalaServer::AuthorizeProxyUser(const string& user, const string& do_as_
   ProxyUserMap::const_iterator proxy_user =
       authorized_proxy_user_config_.find(short_user);
   if (proxy_user != authorized_proxy_user_config_.end()) {
-    BOOST_FOREACH(const string& user, proxy_user->second) {
+    for (const string& user: proxy_user->second) {
       if (user == "*" || user == do_as_user) return Status::OK();
     }
   }
@@ -1251,7 +1250,7 @@ void ImpalaServer::CatalogUpdateCallback(
     // Process all Catalog updates (new and modified objects) and determine what the
     // new catalog version will be.
     int64_t new_catalog_version = catalog_update_info_.catalog_version;
-    BOOST_FOREACH(const TTopicItem& item, delta.topic_entries) {
+    for (const TTopicItem& item: delta.topic_entries) {
       uint32_t len = item.value.size();
       TCatalogObject catalog_object;
       Status status = DeserializeThriftMsg(reinterpret_cast<const uint8_t*>(
@@ -1286,7 +1285,7 @@ void ImpalaServer::CatalogUpdateCallback(
 
     // Process all Catalog deletions (dropped objects). We only know the keys (object
     // names) so must parse each key to determine the TCatalogObject.
-    BOOST_FOREACH(const string& key, delta.topic_deletions) {
+    for (const string& key: delta.topic_deletions) {
       LOG(INFO) << "Catalog topic entry deletion: " << key;
       TCatalogObject catalog_object;
       Status status = TCatalogObjectFromEntryKey(key, &catalog_object);
@@ -1340,7 +1339,7 @@ void ImpalaServer::CatalogUpdateCallback(
       UpdateCatalogMetrics();
       // Remove all dropped objects from the library cache.
       // TODO: is this expensive? We'd like to process heartbeats promptly.
-      BOOST_FOREACH(TCatalogObject& object, dropped_objects) {
+      for (TCatalogObject& object: dropped_objects) {
         if (object.type == TCatalogObjectType::FUNCTION) {
           LibCache::instance()->RemoveEntry(object.fn.hdfs_location);
         } else if (object.type == TCatalogObjectType::DATA_SOURCE) {
@@ -1463,7 +1462,7 @@ void ImpalaServer::MembershipCallback(
     if (!delta.is_delta) known_backends_.clear();
 
     // Process membership additions.
-    BOOST_FOREACH(const TTopicItem& item, delta.topic_entries) {
+    for (const TTopicItem& item: delta.topic_entries) {
       uint32_t len = item.value.size();
       TBackendDescriptor backend_descriptor;
       Status status = DeserializeThriftMsg(reinterpret_cast<const uint8_t*>(
@@ -1476,7 +1475,7 @@ void ImpalaServer::MembershipCallback(
       known_backends_.insert(make_pair(item.key, backend_descriptor));
     }
     // Process membership deletions.
-    BOOST_FOREACH(const string& backend_id, delta.topic_deletions) {
+    for (const string& backend_id: delta.topic_deletions) {
       known_backends_.erase(backend_id);
     }
 
@@ -1487,7 +1486,7 @@ void ImpalaServer::MembershipCallback(
     TUpdateMembershipRequest update_req;
     bool any_changes = !delta.topic_entries.empty() || !delta.topic_deletions.empty() ||
         !delta.is_delta;
-    BOOST_FOREACH(const BackendDescriptorMap::value_type& backend, known_backends_) {
+    for (const BackendDescriptorMap::value_type& backend: known_backends_) {
       current_membership.insert(backend.second.address);
       if (any_changes) {
         update_req.hostnames.insert(backend.second.address.hostname);
@@ -1658,7 +1657,7 @@ void ImpalaServer::ConnectionEnd(
   LOG(INFO) << "Connection from client " << connection_context.network_address
             << " closed, closing " << it->second.size() << " associated session(s)";
 
-  BOOST_FOREACH(const TUniqueId& session_id, it->second) {
+  for (const TUniqueId& session_id: it->second) {
     Status status = CloseSessionInternal(session_id, true);
     if (!status.ok()) {
       LOG(WARNING) << "Error closing session " << session_id << ": "
@@ -1695,7 +1694,7 @@ void ImpalaServer::ExpireSessions() {
     VLOG(3) << "Session expiration thread waking up";
     // TODO: If holding session_state_map_lock_ for the duration of this loop is too
     // expensive, consider a priority queue.
-    BOOST_FOREACH(SessionStateMap::value_type& session_state, session_state_map_) {
+    for (SessionStateMap::value_type& session_state: session_state_map_) {
       unordered_set<TUniqueId> inflight_queries;
       {
         lock_guard<mutex> state_lock(session_state.second->lock);
@@ -1719,7 +1718,7 @@ void ImpalaServer::ExpireSessions() {
       }
       // Unregister all open queries from this session.
       Status status("Session expired due to inactivity");
-      BOOST_FOREACH(const TUniqueId& query_id, inflight_queries) {
+      for (const TUniqueId& query_id: inflight_queries) {
         cancellation_thread_pool_->Offer(CancellationWork(query_id, status, true));
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/query-exec-state.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-exec-state.cc b/be/src/service/query-exec-state.cc
index 18c1faf..4f97143 100644
--- a/be/src/service/query-exec-state.cc
+++ b/be/src/service/query-exec-state.cc
@@ -238,7 +238,7 @@ Status ImpalaServer::QueryExecState::ExecLocalCatalogOp(
       vector<string> names, comments;
       names.reserve(dbs.dbs.size());
       comments.reserve(dbs.dbs.size());
-      BOOST_FOREACH(const TDatabase& db, dbs.dbs) {
+      for (const TDatabase& db: dbs.dbs) {
         names.push_back(db.db_name);
         comments.push_back(db.metastore_db.description);
       }
@@ -833,7 +833,7 @@ Status ImpalaServer::QueryExecState::GetRowValue(TupleRow* row, vector<void*>* r
 
 void ImpalaServer::QueryExecState::Cancel(const Status* cause) {
   // Cancel and close child queries before cancelling parent.
-  BOOST_FOREACH(ChildQuery& child_query, child_queries_) {
+  for (ChildQuery& child_query: child_queries_) {
     child_query.Cancel();
   }
 
@@ -971,8 +971,7 @@ void ImpalaServer::QueryExecState::SetCreateTableAsSelectResultSet() {
   // operation.
   if (catalog_op_executor_->ddl_exec_response()->new_table_created) {
     DCHECK(coord_.get());
-    BOOST_FOREACH(
-        const PartitionStatusMap::value_type& p, coord_->per_partition_status()) {
+    for (const PartitionStatusMap::value_type& p: coord_->per_partition_status()) {
       total_num_rows_inserted += p.second.num_appended_rows;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/service/query-options.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc
index 08c6625..8f5a682 100644
--- a/be/src/service/query-options.cc
+++ b/be/src/service/query-options.cc
@@ -22,7 +22,6 @@
 #include "gen-cpp/ImpalaInternalService_types.h"
 
 #include <sstream>
-#include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
 #include <gutil/strings/substitute.h>
 
@@ -409,7 +408,7 @@ Status impala::ParseQueryOptions(const string& options, TQueryOptions* query_opt
   if (options.length() == 0) return Status::OK();
   vector<string> kv_pairs;
   split(kv_pairs, options, is_any_of(","), token_compress_on);
-  BOOST_FOREACH(string& kv_string, kv_pairs) {
+  for (string& kv_string: kv_pairs) {
     trim(kv_string);
     if (kv_string.length() == 0) continue;
     vector<string> key_value;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/statestore/statestore-subscriber.cc
----------------------------------------------------------------------
diff --git a/be/src/statestore/statestore-subscriber.cc b/be/src/statestore/statestore-subscriber.cc
index 4e193b4..4df9aa7 100644
--- a/be/src/statestore/statestore-subscriber.cc
+++ b/be/src/statestore/statestore-subscriber.cc
@@ -18,7 +18,6 @@
 #include <utility>
 
 #include <boost/algorithm/string/join.hpp>
-#include <boost/foreach.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/thread/shared_mutex.hpp>
 #include <gutil/strings/substitute.h>
@@ -141,7 +140,7 @@ Status StatestoreSubscriber::Register() {
 
   TRegisterSubscriberRequest request;
   request.topic_registrations.reserve(update_callbacks_.size());
-  BOOST_FOREACH(const UpdateCallbacks::value_type& topic, update_callbacks_) {
+  for (const UpdateCallbacks::value_type& topic: update_callbacks_) {
     TTopicRegistration thrift_topic;
     thrift_topic.topic_name = topic.first;
     thrift_topic.is_transient = topic_registrations_[topic.first];
@@ -314,7 +313,7 @@ Status StatestoreSubscriber::UpdateState(const TopicDeltaMap& incoming_topic_del
     // to this subscriber. If any invalid ranges are found, request new update(s) with
     // version ranges applicable to this subscriber.
     bool found_unexpected_delta = false;
-    BOOST_FOREACH(const TopicDeltaMap::value_type& delta, incoming_topic_deltas) {
+    for (const TopicDeltaMap::value_type& delta: incoming_topic_deltas) {
       TopicVersionMap::const_iterator itr = current_topic_versions_.find(delta.first);
       if (itr != current_topic_versions_.end()) {
         if (delta.second.is_delta && delta.second.from_version != itr->second) {
@@ -337,10 +336,10 @@ Status StatestoreSubscriber::UpdateState(const TopicDeltaMap& incoming_topic_del
 
     // Skip calling the callbacks when an unexpected delta update is found.
     if (!found_unexpected_delta) {
-      BOOST_FOREACH(const UpdateCallbacks::value_type& callbacks, update_callbacks_) {
+      for (const UpdateCallbacks::value_type& callbacks: update_callbacks_) {
         MonotonicStopWatch sw;
         sw.Start();
-        BOOST_FOREACH(const UpdateCallback& callback, callbacks.second.callbacks) {
+        for (const UpdateCallback& callback: callbacks.second.callbacks) {
           // TODO: Consider filtering the topics to only send registered topics to
           // callbacks
           callback(incoming_topic_deltas, subscriber_topic_updates);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/statestore/statestore.cc
----------------------------------------------------------------------
diff --git a/be/src/statestore/statestore.cc b/be/src/statestore/statestore.cc
index 7304d0b..d11ba0e 100644
--- a/be/src/statestore/statestore.cc
+++ b/be/src/statestore/statestore.cc
@@ -14,7 +14,6 @@
 
 #include "statestore/statestore.h"
 
-#include <boost/foreach.hpp>
 #include <boost/thread.hpp>
 #include <thrift/Thrift.h>
 #include <gutil/strings/substitute.h>
@@ -178,7 +177,7 @@ Statestore::Subscriber::Subscriber(const SubscriberId& subscriber_id,
     : subscriber_id_(subscriber_id),
       registration_id_(registration_id),
       network_address_(network_address) {
-  BOOST_FOREACH(const TTopicRegistration& topic, subscribed_topics) {
+  for (const TTopicRegistration& topic: subscribed_topics) {
     TopicState topic_state;
     topic_state.is_transient = topic.is_transient;
     topic_state.last_version = TOPIC_INITIAL_VERSION;
@@ -268,7 +267,7 @@ void Statestore::TopicsHandler(const Webserver::ArgumentMap& args,
 
   Value topics(kArrayType);
 
-  BOOST_FOREACH(const TopicMap::value_type& topic, topics_) {
+  for (const TopicMap::value_type& topic: topics_) {
     Value topic_json(kObjectType);
 
     Value topic_id(topic.second.id().c_str(), document->GetAllocator());
@@ -308,7 +307,7 @@ void Statestore::SubscribersHandler(const Webserver::ArgumentMap& args,
     Document* document) {
   lock_guard<mutex> l(subscribers_lock_);
   Value subscribers(kArrayType);
-  BOOST_FOREACH(const SubscriberMap::value_type& subscriber, subscribers_) {
+  for (const SubscriberMap::value_type& subscriber: subscribers_) {
     Value sub_json(kObjectType);
 
     Value subscriber_id(subscriber.second->id().c_str(), document->GetAllocator());
@@ -360,7 +359,7 @@ Status Statestore::RegisterSubscriber(const SubscriberId& subscriber_id,
   // by the worker threads its topics are guaranteed to exist.
   {
     lock_guard<mutex> l(topic_lock_);
-    BOOST_FOREACH(const TTopicRegistration& topic, topic_registrations) {
+    for (const TTopicRegistration& topic: topic_registrations) {
       TopicMap::iterator topic_it = topics_.find(topic.topic_name);
       if (topic_it == topics_.end()) {
         LOG(INFO) << "Creating new topic: ''" << topic.topic_name
@@ -449,7 +448,7 @@ Status Statestore::SendTopicUpdate(Subscriber* subscriber, bool* update_skipped)
   // Thirdly: perform any / all updates returned by the subscriber
   {
     lock_guard<mutex> l(topic_lock_);
-    BOOST_FOREACH(const TTopicDelta& update, response.topic_updates) {
+    for (const TTopicDelta& update: response.topic_updates) {
       TopicMap::iterator topic_it = topics_.find(update.topic_name);
       if (topic_it == topics_.end()) {
         VLOG(1) << "Received update for unexpected topic:" << update.topic_name;
@@ -471,12 +470,12 @@ Status Statestore::SendTopicUpdate(Subscriber* subscriber, bool* update_skipped)
       }
 
       Topic* topic = &topic_it->second;
-      BOOST_FOREACH(const TTopicItem& item, update.topic_entries) {
+      for (const TTopicItem& item: update.topic_entries) {
         TopicEntry::Version version = topic->Put(item.key, item.value);
         subscriber->AddTransientUpdate(update.topic_name, item.key, version);
       }
 
-      BOOST_FOREACH(const string& key, update.topic_deletions) {
+      for (const string& key: update.topic_deletions) {
         TopicEntry::Version version =
             topic->Put(key, Statestore::TopicEntry::NULL_VALUE);
         subscriber->AddTransientUpdate(update.topic_name, key, version);
@@ -491,8 +490,8 @@ void Statestore::GatherTopicUpdates(const Subscriber& subscriber,
     TUpdateStateRequest* update_state_request) {
   {
     lock_guard<mutex> l(topic_lock_);
-    BOOST_FOREACH(const Subscriber::Topics::value_type& subscribed_topic,
-        subscriber.subscribed_topics()) {
+    for (const Subscriber::Topics::value_type& subscribed_topic:
+         subscriber.subscribed_topics()) {
       TopicMap::const_iterator topic_it = topics_.find(subscribed_topic.first);
       DCHECK(topic_it != topics_.end());
 
@@ -552,8 +551,7 @@ void Statestore::GatherTopicUpdates(const Subscriber& subscriber,
   // topic_lock_.
   lock_guard<mutex> l(subscribers_lock_);
   typedef map<TopicId, TTopicDelta> TopicDeltaMap;
-  BOOST_FOREACH(TopicDeltaMap::value_type& topic_delta,
-      update_state_request->topic_deltas) {
+  for (TopicDeltaMap::value_type& topic_delta: update_state_request->topic_deltas) {
     topic_delta.second.__set_min_subscriber_topic_version(
         GetMinSubscriberTopicVersion(topic_delta.first));
   }
@@ -564,7 +562,7 @@ const Statestore::TopicEntry::Version Statestore::GetMinSubscriberTopicVersion(
   TopicEntry::Version min_topic_version = numeric_limits<int64_t>::max();
   bool found = false;
   // Find the minimum version processed for this topic across all topic subscribers.
-  BOOST_FOREACH(const SubscriberMap::value_type& subscriber, subscribers_) {
+  for (const SubscriberMap::value_type& subscriber: subscribers_) {
     if (subscriber.second->subscribed_topics().find(topic_id) !=
         subscriber.second->subscribed_topics().end()) {
       found = true;
@@ -734,8 +732,8 @@ void Statestore::UnregisterSubscriber(Subscriber* subscriber) {
 
   // Delete all transient entries
   lock_guard<mutex> topic_lock(topic_lock_);
-  BOOST_FOREACH(Statestore::Subscriber::TransientEntryMap::value_type entry,
-      subscriber->transient_entries()) {
+  for (Statestore::Subscriber::TransientEntryMap::value_type entry:
+       subscriber->transient_entries()) {
     Statestore::TopicMap::iterator topic_it = topics_.find(entry.first.first);
     DCHECK(topic_it != topics_.end());
     topic_it->second.DeleteIfVersionsMatch(entry.second, // version

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/testutil/mini-impala-cluster.cc
----------------------------------------------------------------------
diff --git a/be/src/testutil/mini-impala-cluster.cc b/be/src/testutil/mini-impala-cluster.cc
index 25f4cf6..469066a 100644
--- a/be/src/testutil/mini-impala-cluster.cc
+++ b/be/src/testutil/mini-impala-cluster.cc
@@ -16,7 +16,6 @@
 // A standalone test utility that starts multiple Impala backends and a state store
 // within a single process.
 
-#include <boost/foreach.hpp>
 
 #include "codegen/llvm-codegen.h"
 #include "common/logging.h"
@@ -85,7 +84,5 @@ int main(int argc, char** argv) {
 
   impala_servers[0]->Join();
 
-  BOOST_FOREACH(InProcessImpalaServer* server, impala_servers) {
-    delete server;
-  }
+  for (InProcessImpalaServer* server: impala_servers) delete server;
 }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/codec.cc
----------------------------------------------------------------------
diff --git a/be/src/util/codec.cc b/be/src/util/codec.cc
index bf08b62..6863d1f 100644
--- a/be/src/util/codec.cc
+++ b/be/src/util/codec.cc
@@ -48,8 +48,7 @@ const Codec::CodecMap Codec::CODEC_MAP = map_list_of
   (SNAPPY_COMPRESSION, THdfsCompression::SNAPPY_BLOCKED);
 
 string Codec::GetCodecName(THdfsCompression::type type) {
-  BOOST_FOREACH(const CodecMap::value_type& codec,
-      g_CatalogObjects_constants.COMPRESSION_MAP) {
+  for (const CodecMap::value_type& codec: g_CatalogObjects_constants.COMPRESSION_MAP) {
     if (codec.second == type) return codec.first;
   }
   DCHECK(false) << "Missing codec in COMPRESSION_MAP: " << type;
@@ -57,7 +56,7 @@ string Codec::GetCodecName(THdfsCompression::type type) {
 }
 
 Status Codec::GetHadoopCodecClassName(THdfsCompression::type type, string* out_name) {
-  BOOST_FOREACH(const CodecMap::value_type& codec, CODEC_MAP) {
+  for (const CodecMap::value_type& codec: CODEC_MAP) {
     if (codec.second == type) {
       out_name->assign(codec.first);
       return Status::OK();

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/collection-metrics.h
----------------------------------------------------------------------
diff --git a/be/src/util/collection-metrics.h b/be/src/util/collection-metrics.h
index 4698729..276f4b9 100644
--- a/be/src/util/collection-metrics.h
+++ b/be/src/util/collection-metrics.h
@@ -22,7 +22,6 @@
 #include <vector>
 #include <set>
 #include <boost/algorithm/string/join.hpp>
-#include <boost/foreach.hpp>
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics/count.hpp>
 #include <boost/accumulators/statistics/mean.hpp>
@@ -76,7 +75,7 @@ class SetMetric : public Metric {
     rapidjson::Value container(rapidjson::kObjectType);
     AddStandardFields(document, &container);
     rapidjson::Value metric_list(rapidjson::kArrayType);
-    BOOST_FOREACH(const T& s, value_) {
+    for (const T& s: value_) {
       rapidjson::Value entry_value;
       ToJsonValue(s, TUnit::NONE, document, &entry_value);
       metric_list.PushBack(entry_value, document->GetAllocator());
@@ -87,7 +86,7 @@ class SetMetric : public Metric {
 
   virtual void ToLegacyJson(rapidjson::Document* document) {
     rapidjson::Value metric_list(rapidjson::kArrayType);
-    BOOST_FOREACH(const T& s, value_) {
+    for (const T& s: value_) {
       rapidjson::Value entry_value;
       ToJsonValue(s, TUnit::NONE, document, &entry_value);
       metric_list.PushBack(entry_value, document->GetAllocator());

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/debug-util.cc
----------------------------------------------------------------------
diff --git a/be/src/util/debug-util.cc b/be/src/util/debug-util.cc
index ddb9455..7e6a290 100644
--- a/be/src/util/debug-util.cc
+++ b/be/src/util/debug-util.cc
@@ -16,7 +16,6 @@
 
 #include <iomanip>
 #include <sstream>
-#include <boost/foreach.hpp>
 
 #include "common/version.h"
 #include "runtime/collection-value.h"
@@ -124,7 +123,7 @@ bool ParseId(const string& s, TUniqueId* id) {
     char_separator<char> sep(" ");
     tokenizer< char_separator<char> > tokens(s, sep);
     int i = 0;
-    BOOST_FOREACH(const string& token, tokens) {
+    for (const string& token: tokens) {
       StringParser::ParseResult parse_result = StringParser::PARSE_SUCCESS;
       int64_t component = StringParser::StringToInt<int64_t>(
           token.c_str(), token.length(), &parse_result);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/dict-encoding.h
----------------------------------------------------------------------
diff --git a/be/src/util/dict-encoding.h b/be/src/util/dict-encoding.h
index 75e89ac..7a48886 100644
--- a/be/src/util/dict-encoding.h
+++ b/be/src/util/dict-encoding.h
@@ -17,7 +17,6 @@
 
 #include <map>
 
-#include <boost/foreach.hpp>
 #include <boost/unordered_map.hpp>
 
 #include "gutil/bits.h"
@@ -294,7 +293,7 @@ inline bool DictDecoder<Decimal16Value>::GetValue(Decimal16Value* value) {
 
 template<typename T>
 inline void DictEncoder<T>::WriteDict(uint8_t* buffer) {
-  BOOST_FOREACH(const Node& node, nodes_) {
+  for (const Node& node: nodes_) {
     buffer += ParquetPlainEncoder::Encode(buffer, encoded_value_size_, node.value);
   }
 }
@@ -306,7 +305,7 @@ inline int DictEncoderBase::WriteData(uint8_t* buffer, int buffer_len) {
   --buffer_len;
 
   RleEncoder encoder(buffer, buffer_len, bit_width());
-  BOOST_FOREACH(int index, buffered_indices_) {
+  for (int index: buffered_indices_) {
     if (!encoder.Put(index)) return -1;
   }
   encoder.Flush();

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/dict-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/dict-test.cc b/be/src/util/dict-test.cc
index fec3185..1fb8eaa 100644
--- a/be/src/util/dict-test.cc
+++ b/be/src/util/dict-test.cc
@@ -16,7 +16,6 @@
 #include <stdio.h>
 #include <iostream>
 
-#include <boost/foreach.hpp>
 #include <gtest/gtest.h>
 
 #include "common/init.h"
@@ -36,9 +35,7 @@ void ValidateDict(const vector<T>& values, int fixed_buffer_byte_size) {
   MemTracker tracker;
   MemPool pool(&tracker);
   DictEncoder<T> encoder(&pool, fixed_buffer_byte_size);
-  BOOST_FOREACH(T i, values) {
-    encoder.Put(i);
-  }
+  for (T i: values) encoder.Put(i);
   EXPECT_EQ(encoder.num_entries(), values_set.size());
 
   uint8_t dict_buffer[encoder.dict_encoded_size()];
@@ -53,7 +50,7 @@ void ValidateDict(const vector<T>& values, int fixed_buffer_byte_size) {
   DictDecoder<T> decoder(
       dict_buffer, encoder.dict_encoded_size(), fixed_buffer_byte_size);
   decoder.SetData(data_buffer, data_len);
-  BOOST_FOREACH(T i, values) {
+  for (T i: values) {
     T j;
     decoder.GetValue(&j);
     EXPECT_EQ(i, j);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/error-util.cc
----------------------------------------------------------------------
diff --git a/be/src/util/error-util.cc b/be/src/util/error-util.cc
index 408864c..81c53a8 100644
--- a/be/src/util/error-util.cc
+++ b/be/src/util/error-util.cc
@@ -14,8 +14,6 @@
 
 #include "util/error-util.h"
 
-#include <boost/foreach.hpp>
-
 #include <errno.h>
 #include <string.h>
 #include <sstream>
@@ -132,11 +130,11 @@ ErrorMsg ErrorMsg::Init(TErrorCode::type error, const ArgType& arg0,
 }
 
 void PrintErrorMap(ostream* stream, const ErrorLogMap& errors) {
-  BOOST_FOREACH(const ErrorLogMap::value_type& v, errors) {
+  for (const ErrorLogMap::value_type& v: errors) {
     const TErrorLogEntry& log_entry = v.second;
     if (v.first == TErrorCode::GENERAL) {
       DCHECK_EQ(log_entry.count, 0);
-      BOOST_FOREACH(const string& s, log_entry.messages) {
+      for (const string& s: log_entry.messages) {
         *stream << s << "\n";
       }
     } else if (!log_entry.messages.empty()) {
@@ -159,7 +157,7 @@ string PrintErrorMapToString(const ErrorLogMap& errors) {
 }
 
 void MergeErrorMaps(ErrorLogMap* left, const ErrorLogMap& right) {
-  BOOST_FOREACH(const ErrorLogMap::value_type& v, right) {
+  for (const ErrorLogMap::value_type& v: right) {
     TErrorLogEntry& target = (*left)[v.first];
     const TErrorLogEntry& source = v.second;
     // Append generic message, append specific codes or increment count if exists

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/error-util.h
----------------------------------------------------------------------
diff --git a/be/src/util/error-util.h b/be/src/util/error-util.h
index 755a232..e8f0871 100644
--- a/be/src/util/error-util.h
+++ b/be/src/util/error-util.h
@@ -16,7 +16,6 @@
 #ifndef IMPALA_UTIL_ERROR_UTIL_H
 #define IMPALA_UTIL_ERROR_UTIL_H
 
-
 #include <string>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/hdfs-bulk-ops.cc
----------------------------------------------------------------------
diff --git a/be/src/util/hdfs-bulk-ops.cc b/be/src/util/hdfs-bulk-ops.cc
index d4d94ed..34769dd 100644
--- a/be/src/util/hdfs-bulk-ops.cc
+++ b/be/src/util/hdfs-bulk-ops.cc
@@ -15,7 +15,6 @@
 #include "util/hdfs-bulk-ops.h"
 
 #include <vector>
-#include <boost/foreach.hpp>
 
 #include "util/debug-util.h"
 #include "util/error-util.h"
@@ -156,9 +155,7 @@ bool HdfsOperationSet::Execute(ThreadPool<HdfsOp>* pool, bool abort_on_error) {
   if (num_ops == 0) return true;
 
   ops_complete_barrier_.reset(new CountingBarrier(num_ops));
-  BOOST_FOREACH(const HdfsOp& op, ops_) {
-    pool->Offer(op);
-  }
+  for (const HdfsOp& op: ops_) pool->Offer(op);
 
   ops_complete_barrier_->Wait();
   return errors().size() == 0;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/logging-support.cc
----------------------------------------------------------------------
diff --git a/be/src/util/logging-support.cc b/be/src/util/logging-support.cc
index 7de7fcf..2ac7be8 100644
--- a/be/src/util/logging-support.cc
+++ b/be/src/util/logging-support.cc
@@ -14,7 +14,6 @@
 
 #include "util/logging-support.h"
 
-#include <boost/foreach.hpp>
 #include <glob.h>
 #include <sys/stat.h>
 
@@ -132,7 +131,7 @@ void LoggingSupport::DeleteOldLogs(const string& path_pattern, int max_log_files
   if (log_file_mtime.size() <= max_log_files) return;
   int files_to_delete = log_file_mtime.size() - max_log_files;
   DCHECK_GT(files_to_delete, 0);
-  BOOST_FOREACH(LogFileMap::const_reference val, log_file_mtime) {
+  for (LogFileMap::const_reference val: log_file_mtime) {
     if (unlink(val.second.c_str()) == 0) {
       LOG(INFO) << "Old log file deleted during log rotation: " << val.second;
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/memory-metrics.cc
----------------------------------------------------------------------
diff --git a/be/src/util/memory-metrics.cc b/be/src/util/memory-metrics.cc
index cf8510e..bda926c 100644
--- a/be/src/util/memory-metrics.cc
+++ b/be/src/util/memory-metrics.cc
@@ -15,7 +15,6 @@
 #include "util/memory-metrics.h"
 
 #include <boost/algorithm/string.hpp>
-#include <boost/foreach.hpp>
 #include <gutil/strings/substitute.h>
 
 #include "util/jni-util.h"
@@ -83,7 +82,7 @@ Status JvmMetric::InitMetrics(MetricGroup* metrics) {
   request.get_all = true;
   TGetJvmMetricsResponse response;
   RETURN_IF_ERROR(JniUtil::GetJvmMetrics(request, &response));
-  BOOST_FOREACH(const TJvmMemoryPool& usage, response.memory_pools) {
+  for (const TJvmMemoryPool& usage: response.memory_pools) {
     JvmMetric::CreateAndRegister(metrics, "jvm.$0.max-usage-bytes", usage.name, MAX);
     JvmMetric::CreateAndRegister(metrics, "jvm.$0.current-usage-bytes", usage.name,
         CURRENT);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/metrics.cc
----------------------------------------------------------------------
diff --git a/be/src/util/metrics.cc b/be/src/util/metrics.cc
index 7f8cde8..0ae18e6 100644
--- a/be/src/util/metrics.cc
+++ b/be/src/util/metrics.cc
@@ -115,10 +115,10 @@ void MetricGroup::CMCompatibleCallback(const Webserver::ArgumentMap& args,
     // expected by CM before we introduced metric groups.
     MetricGroup* group = groups.top();
     groups.pop();
-    BOOST_FOREACH(const ChildGroupMap::value_type& child, group->children_) {
+    for (const ChildGroupMap::value_type& child: group->children_) {
       groups.push(child.second);
     }
-    BOOST_FOREACH(const MetricMap::value_type& m, group->metric_map_) {
+    for (const MetricMap::value_type& m: group->metric_map_) {
       m.second->ToLegacyJson(document);
     }
   } while (!groups.empty());
@@ -148,7 +148,7 @@ void MetricGroup::TemplateCallback(const Webserver::ArgumentMap& args,
     // expected by CM before we introduced metric groups.
     MetricGroup* group = groups.top();
     groups.pop();
-    BOOST_FOREACH(const ChildGroupMap::value_type& child, group->children_) {
+    for (const ChildGroupMap::value_type& child: group->children_) {
       if (child.first == metric_group->second) {
         found_group = child.second;
         break;
@@ -169,7 +169,7 @@ void MetricGroup::TemplateCallback(const Webserver::ArgumentMap& args,
 
 void MetricGroup::ToJson(bool include_children, Document* document, Value* out_val) {
   Value metric_list(kArrayType);
-  BOOST_FOREACH(const MetricMap::value_type& m, metric_map_) {
+  for (const MetricMap::value_type& m: metric_map_) {
     Value metric_value;
     m.second->ToJson(document, &metric_value);
     metric_list.PushBack(metric_value, document->GetAllocator());
@@ -180,7 +180,7 @@ void MetricGroup::ToJson(bool include_children, Document* document, Value* out_v
   container.AddMember("name", name_.c_str(), document->GetAllocator());
   if (include_children) {
     Value child_groups(kArrayType);
-    BOOST_FOREACH(const ChildGroupMap::value_type& child, children_) {
+    for (const ChildGroupMap::value_type& child: children_) {
       Value child_value;
       child.second->ToJson(true, document, &child_value);
       child_groups.PushBack(child_value, document->GetAllocator());

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/metrics.h
----------------------------------------------------------------------
diff --git a/be/src/util/metrics.h b/be/src/util/metrics.h
index 62a48e6..ab4b6c2 100644
--- a/be/src/util/metrics.h
+++ b/be/src/util/metrics.h
@@ -19,7 +19,6 @@
 #include <string>
 #include <sstream>
 #include <stack>
-#include <boost/foreach.hpp>
 #include <boost/function.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/thread/locks.hpp>
@@ -281,7 +280,7 @@ class MetricGroup {
       groups.pop();
       MetricMap::const_iterator it = group->metric_map_.find(key);
       if (it != group->metric_map_.end()) return reinterpret_cast<M*>(it->second);
-      BOOST_FOREACH(const ChildGroupMap::value_type& child, group->children_) {
+      for (const ChildGroupMap::value_type& child: group->children_) {
         groups.push(child.second);
       }
     } while (!groups.empty());

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/network-util.cc
----------------------------------------------------------------------
diff --git a/be/src/util/network-util.cc b/be/src/util/network-util.cc
index edfc953..8d8a38b 100644
--- a/be/src/util/network-util.cc
+++ b/be/src/util/network-util.cc
@@ -22,7 +22,6 @@
 #include <sstream>
 #include <vector>
 #include <boost/algorithm/string.hpp>
-#include <boost/foreach.hpp>
 
 #include "util/debug-util.h"
 #include "util/error-util.h"
@@ -90,7 +89,7 @@ Status HostnameToIpAddrs(const string& name, vector<string>* addresses) {
 }
 
 bool FindFirstNonLocalhost(const vector<string>& addresses, string* addr) {
-  BOOST_FOREACH(const string& candidate, addresses) {
+  for (const string& candidate: addresses) {
     if (candidate != LOCALHOST) {
       *addr = candidate;
       return true;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/runtime-profile-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/runtime-profile-test.cc b/be/src/util/runtime-profile-test.cc
index 8315437..d98b54c 100644
--- a/be/src/util/runtime-profile-test.cc
+++ b/be/src/util/runtime-profile-test.cc
@@ -17,7 +17,6 @@
 #include <iostream>
 #include <gtest/gtest.h>
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include "common/object-pool.h"
 #include "util/cpu-info.h"
 #include "util/periodic-counter-updater.h"
@@ -455,7 +454,7 @@ TEST(CountersTest, EventSequences) {
 
   uint64_t last_timestamp = 0;
   string last_string = "";
-  BOOST_FOREACH(const RuntimeProfile::EventSequence::Event& ev, events) {
+  for (const RuntimeProfile::EventSequence::Event& ev: events) {
     EXPECT_TRUE(ev.second >= last_timestamp);
     last_timestamp = ev.second;
     EXPECT_TRUE(ev.first > last_string);
@@ -477,7 +476,7 @@ TEST(CountersTest, EventSequences) {
   EXPECT_TRUE(seq != NULL);
   seq->GetEvents(&events);
   EXPECT_EQ(3, events.size());
-  BOOST_FOREACH(const RuntimeProfile::EventSequence::Event& ev, events) {
+  for (const RuntimeProfile::EventSequence::Event& ev: events) {
     EXPECT_TRUE(ev.second >= last_timestamp);
     last_timestamp = ev.second;
     EXPECT_TRUE(ev.first > last_string);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/runtime-profile.cc
----------------------------------------------------------------------
diff --git a/be/src/util/runtime-profile.cc b/be/src/util/runtime-profile.cc
index e2d0744..bc7447a 100644
--- a/be/src/util/runtime-profile.cc
+++ b/be/src/util/runtime-profile.cc
@@ -18,7 +18,6 @@
 #include <iostream>
 
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
 #include <boost/thread/locks.hpp>
 #include <boost/thread/thread.hpp>
 
@@ -119,14 +118,14 @@ RuntimeProfile* RuntimeProfile::CreateFromThrift(ObjectPool* pool,
   }
 
   if (node.__isset.event_sequences) {
-    BOOST_FOREACH(const TEventSequence& sequence, node.event_sequences) {
+    for (const TEventSequence& sequence: node.event_sequences) {
       profile->event_sequence_map_[sequence.name] =
           pool->Add(new EventSequence(sequence.timestamps, sequence.labels));
     }
   }
 
   if (node.__isset.time_series_counters) {
-    BOOST_FOREACH(const TTimeSeriesCounter& val, node.time_series_counters) {
+    for (const TTimeSeriesCounter& val: node.time_series_counters) {
       profile->time_series_counter_map_[val.name] =
           pool->Add(new TimeSeriesCounter(val.name, val.unit, val.period_ms, val.values));
     }
@@ -253,7 +252,7 @@ void RuntimeProfile::Update(const vector<TRuntimeProfileNode>& nodes, int* idx)
   {
     const InfoStrings& info_strings = node.info_strings;
     lock_guard<SpinLock> l(info_strings_lock_);
-    BOOST_FOREACH(const string& key, node.info_strings_display_order) {
+    for (const string& key: node.info_strings_display_order) {
       // Look for existing info strings and update in place. If there
       // are new strings, add them to the end of the display order.
       // TODO: Is nodes.info_strings always a superset of
@@ -551,7 +550,7 @@ void RuntimeProfile::PrettyPrint(ostream* s, const string& prefix) const {
 
   {
     lock_guard<SpinLock> l(info_strings_lock_);
-    BOOST_FOREACH(const string& key, info_strings_display_order_) {
+    for (const string& key: info_strings_display_order_) {
       stream << prefix << "  " << key << ": " << info_strings_.find(key)->second << endl;
     }
   }
@@ -565,8 +564,7 @@ void RuntimeProfile::PrettyPrint(ostream* s, const string& prefix) const {
     // The times in parentheses are the time elapsed since the last event.
     vector<EventSequence::Event> events;
     lock_guard<SpinLock> l(event_sequence_lock_);
-    BOOST_FOREACH(
-        const EventSequenceMap::value_type& event_sequence, event_sequence_map_) {
+    for (const EventSequenceMap::value_type& event_sequence: event_sequence_map_) {
       // If the stopwatch has never been started (e.g. because this sequence came from
       // Thrift), look for the last element to tell us the total runtime. For
       // currently-updating sequences, it's better to use the stopwatch value because that
@@ -580,7 +578,7 @@ void RuntimeProfile::PrettyPrint(ostream* s, const string& prefix) const {
 
       int64_t prev = 0L;
       event_sequence.second->GetEvents(&events);
-      BOOST_FOREACH(const EventSequence::Event& event, events) {
+      for (const EventSequence::Event& event: events) {
         stream << prefix << "     - " << event.first << ": "
                << PrettyPrinter::Print(event.second, TUnit::TIME_NS) << " ("
                << PrettyPrinter::Print(event.second - prev, TUnit::TIME_NS) << ")"
@@ -596,7 +594,7 @@ void RuntimeProfile::PrettyPrint(ostream* s, const string& prefix) const {
     SpinLock* lock;
     int num, period;
     lock_guard<SpinLock> l(time_series_counter_map_lock_);
-    BOOST_FOREACH(const TimeSeriesCounterMap::value_type& v, time_series_counter_map_) {
+    for (const TimeSeriesCounterMap::value_type& v: time_series_counter_map_) {
       const int64_t* samples = v.second->samples_.GetSamples(&num, &period, &lock);
       if (num > 0) {
         stream << prefix << "  " << v.first << "("
@@ -706,11 +704,11 @@ void RuntimeProfile::ToThrift(vector<TRuntimeProfileNode>* nodes) const {
       node.__set_event_sequences(vector<TEventSequence>());
       node.event_sequences.resize(event_sequence_map_.size());
       int idx = 0;
-      BOOST_FOREACH(const EventSequenceMap::value_type& val, event_sequence_map_) {
+      for (const EventSequenceMap::value_type& val: event_sequence_map_) {
         TEventSequence* seq = &node.event_sequences[idx++];
         seq->name = val.first;
         val.second->GetEvents(&events);
-        BOOST_FOREACH(const EventSequence::Event& ev, events) {
+        for (const EventSequence::Event& ev: events) {
           seq->labels.push_back(ev.first);
           seq->timestamps.push_back(ev.second);
         }
@@ -724,8 +722,7 @@ void RuntimeProfile::ToThrift(vector<TRuntimeProfileNode>* nodes) const {
       node.__set_time_series_counters(vector<TTimeSeriesCounter>());
       node.time_series_counters.resize(time_series_counter_map_.size());
       int idx = 0;
-      BOOST_FOREACH(const TimeSeriesCounterMap::value_type& val,
-          time_series_counter_map_) {
+      for (const TimeSeriesCounterMap::value_type& val: time_series_counter_map_) {
         val.second->ToThrift(&node.time_series_counters[idx++]);
       }
     }
@@ -846,7 +843,7 @@ void RuntimeProfile::PrintChildCounters(const string& prefix,
   ChildCounterMap::const_iterator itr = child_counter_map.find(counter_name);
   if (itr != child_counter_map.end()) {
     const set<string>& child_counters = itr->second;
-    BOOST_FOREACH(const string& child_counter, child_counters) {
+    for (const string& child_counter: child_counters) {
       CounterMap::const_iterator iter = counter_map.find(child_counter);
       if (iter == counter_map.end()) continue;
       stream << prefix << "   - " << iter->first << ": "
@@ -901,7 +898,7 @@ string RuntimeProfile::TimeSeriesCounter::DebugString() const {
 }
 
 void RuntimeProfile::EventSequence::ToThrift(TEventSequence* seq) const {
-  BOOST_FOREACH(const EventSequence::Event& ev, events_) {
+  for (const EventSequence::Event& ev: events_) {
     seq->labels.push_back(ev.first);
     seq->timestamps.push_back(ev.second);
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/thread.cc
----------------------------------------------------------------------
diff --git a/be/src/util/thread.cc b/be/src/util/thread.cc
index 1bad25a..6325a0d 100644
--- a/be/src/util/thread.cc
+++ b/be/src/util/thread.cc
@@ -16,7 +16,6 @@
 
 #include <set>
 #include <map>
-#include <boost/foreach.hpp>
 #include <unistd.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
@@ -201,7 +200,7 @@ void ThreadMgr::ThreadOverviewUrlCallback(const Webserver::ArgumentMap& args,
         document->GetAllocator());
   }
   Value lst(kArrayType);
-  BOOST_FOREACH(const ThreadCategoryMap::value_type& category, thread_categories_) {
+  for (const ThreadCategoryMap::value_type& category: thread_categories_) {
     Value val(kObjectType);
     val.AddMember("name", category.first.c_str(), document->GetAllocator());
     val.AddMember("size", static_cast<uint64_t>(category.second.size()),
@@ -231,14 +230,14 @@ void ThreadMgr::ThreadGroupUrlCallback(const Webserver::ArgumentMap& args,
         document->GetAllocator());
     document->AddMember("thread-group", val, document->GetAllocator());
   } else {
-    BOOST_FOREACH(const ThreadCategoryMap::value_type& category, thread_categories_) {
+    for (const ThreadCategoryMap::value_type& category: thread_categories_) {
       categories_to_print.push_back(&category.second);
     }
   }
 
   Value lst(kArrayType);
-  BOOST_FOREACH(const ThreadCategory* category, categories_to_print) {
-    BOOST_FOREACH(const ThreadCategory::value_type& thread, *category) {
+  for (const ThreadCategory* category: categories_to_print) {
+    for (const ThreadCategory::value_type& thread: *category) {
       Value val(kObjectType);
       val.AddMember("name", thread.second.name().c_str(), document->GetAllocator());
       ThreadStats stats;
@@ -327,18 +326,14 @@ Status ThreadGroup::AddThread(Thread* thread) {
 }
 
 void ThreadGroup::JoinAll() {
-  BOOST_FOREACH(const Thread& thread, threads_) {
-    thread.Join();
-  }
+  for (const Thread& thread: threads_) thread.Join();
 }
 
 Status ThreadGroup::SetCgroup(const string& cgroup) {
   DCHECK(cgroups_mgr_ != NULL);
   cgroup_path_ = cgroup;
-  // BOOST_FOREACH + ptr_vector + const are not compatible
-  for (ptr_vector<Thread>::const_iterator it = threads_.begin();
-       it != threads_.end(); ++it) {
-    RETURN_IF_ERROR(cgroups_mgr_->AssignThreadToCgroup(*it, cgroup));
+  for (const Thread& t: threads_) {
+    RETURN_IF_ERROR(cgroups_mgr_->AssignThreadToCgroup(t, cgroup));
   }
   return Status::OK();
 }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/url-coding.cc
----------------------------------------------------------------------
diff --git a/be/src/util/url-coding.cc b/be/src/util/url-coding.cc
index 017b9ff..b64e609 100644
--- a/be/src/util/url-coding.cc
+++ b/be/src/util/url-coding.cc
@@ -20,7 +20,6 @@
 #include <boost/archive/iterators/base64_from_binary.hpp>
 #include <boost/archive/iterators/binary_from_base64.hpp>
 #include <boost/archive/iterators/transform_width.hpp>
-#include <boost/foreach.hpp>
 
 #include "common/logging.h"
 
@@ -177,7 +176,7 @@ bool Base64Decode(const string& in, string* out) {
 
 void EscapeForHtml(const string& in, stringstream* out) {
   DCHECK(out != NULL);
-  BOOST_FOREACH(const char& c, in) {
+  for (const char c: in) {
     switch (c) {
       case '<': (*out) << "&lt;";
                 break;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5454086c/be/src/util/webserver.cc
----------------------------------------------------------------------
diff --git a/be/src/util/webserver.cc b/be/src/util/webserver.cc
index 7eecc79..b1ff7f6 100644
--- a/be/src/util/webserver.cc
+++ b/be/src/util/webserver.cc
@@ -17,7 +17,6 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/bind.hpp>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/mem_fn.hpp>
 #include <boost/thread/locks.hpp>
@@ -92,7 +91,7 @@ DEFINE_string(webserver_password_file, "",
     "(Optional) Location of .htpasswd file containing user names and hashed passwords for"
     " debug webserver authentication");
 
-DEFINE_string(webserver_x_frame_options, "DENY", 
+DEFINE_string(webserver_x_frame_options, "DENY",
     "webserver will add X-Frame-Options HTTP header with this value");
 
 static const char* DOC_FOLDER = "/www/";
@@ -198,7 +197,7 @@ void Webserver::BuildArgumentMap(const string& args, ArgumentMap* output) {
   vector<string> arg_pairs;
   split(arg_pairs, args, is_any_of("&"));
 
-  BOOST_FOREACH(const string& arg_pair, arg_pairs) {
+  for (const string& arg_pair: arg_pairs) {
     vector<string> key_value;
     split(key_value, arg_pair, is_any_of("="));
     if (key_value.empty()) continue;
@@ -247,10 +246,10 @@ Status Webserver::Start() {
       options.push_back("ssl_private_key");
       options.push_back(FLAGS_webserver_private_key_file.c_str());
 
-      if (!FLAGS_webserver_private_key_password_cmd.empty()) {
-        if (!RunShellProcess(FLAGS_webserver_private_key_password_cmd, &key_password, true)) {
-          return Status(TErrorCode::SSL_PASSWORD_CMD_FAILED,
-              FLAGS_webserver_private_key_password_cmd, key_password);
+      const string& password_cmd = FLAGS_webserver_private_key_password_cmd;
+      if (!password_cmd.empty()) {
+        if (!RunShellProcess(password_cmd, &key_password, true)) {
+          return Status(TErrorCode::SSL_PASSWORD_CMD_FAILED, password_cmd, key_password);
         }
         options.push_back("ssl_private_key_password");
         options.push_back(key_password.c_str());
@@ -333,7 +332,7 @@ void Webserver::GetCommonJson(Document* document) {
       document->GetAllocator());
 
   Value lst(kArrayType);
-  BOOST_FOREACH(const UrlHandlerMap::value_type& handler, url_handlers_) {
+  for (const UrlHandlerMap::value_type& handler: url_handlers_) {
     if (handler.second.is_on_nav_bar()) {
       Value obj(kObjectType);
       obj.AddMember("link", handler.first.c_str(), document->GetAllocator());


Mime
View raw message