You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jr...@apache.org on 2017/02/08 21:59:47 UTC

[3/5] incubator-impala git commit: IMPALA-3909 (follow-up): Properly qualify min() and max() in header

IMPALA-3909 (follow-up): Properly qualify min() and max() in header

parquet-column-stats.h was using unqualified references to std::max and
std::min, which we disallow in header files. The reason this compiled is
that some headers included "names.h". This commit flushes those out as
well, and fixes the resulting compilation errors.

I tried to make a static_assert method that complained if names.h was
included in a header file, but couldn't do so without needing an extra
macro, e.g.:

USE_IMPORTED_NAMES();

Which seemed too verbose for now.

Change-Id: If8381d5b1fa072e89ac1f7f54959c02bf8e43b4b
Reviewed-on: http://gerrit.cloudera.org:8080/5916
Reviewed-by: Jim Apple <jb...@apache.org>
Tested-by: Impala Public 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/d074f71d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/d074f71d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/d074f71d

Branch: refs/heads/master
Commit: d074f71d819b876c907068634ba7a431ac1f2e9b
Parents: c671ee1
Author: Henry Robinson <he...@cloudera.com>
Authored: Mon Feb 6 11:43:14 2017 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Wed Feb 8 00:57:35 2017 +0000

----------------------------------------------------------------------
 be/src/exec/parquet-column-stats.h        |  9 +++++----
 be/src/exec/write-stream.inline.h         |  2 --
 be/src/exprs/anyval-util.h                |  2 --
 be/src/runtime/fragment-instance-state.cc |  2 ++
 be/src/runtime/query-exec-mgr.cc          |  3 ++-
 be/src/runtime/query-state.cc             |  2 ++
 be/src/service/impala-internal-service.cc |  3 +++
 be/src/util/process-state-info.h          | 18 ++++++++----------
 be/src/util/uid-util.h                    |  1 -
 9 files changed, 22 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/exec/parquet-column-stats.h
----------------------------------------------------------------------
diff --git a/be/src/exec/parquet-column-stats.h b/be/src/exec/parquet-column-stats.h
index 8bcf4de..a279781 100644
--- a/be/src/exec/parquet-column-stats.h
+++ b/be/src/exec/parquet-column-stats.h
@@ -18,6 +18,7 @@
 #ifndef IMPALA_EXEC_PARQUET_COLUMN_STATS_H
 #define IMPALA_EXEC_PARQUET_COLUMN_STATS_H
 
+#include <algorithm>
 #include <type_traits>
 
 namespace impala {
@@ -103,8 +104,8 @@ class ColumnStats : public ColumnStatsBase {
       min_value_ = v;
       max_value_ = v;
     } else {
-      min_value_ = min(min_value_, v);
-      max_value_ = max(max_value_, v);
+      min_value_ = std::min(min_value_, v);
+      max_value_ = std::max(max_value_, v);
     }
   }
 
@@ -117,8 +118,8 @@ class ColumnStats : public ColumnStatsBase {
       min_value_ = cs->min_value_;
       max_value_ = cs->max_value_;
     } else {
-      min_value_ = min(min_value_, cs->min_value_);
-      max_value_ = max(max_value_, cs->max_value_);
+      min_value_ = std::min(min_value_, cs->min_value_);
+      max_value_ = std::max(max_value_, cs->max_value_);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/exec/write-stream.inline.h
----------------------------------------------------------------------
diff --git a/be/src/exec/write-stream.inline.h b/be/src/exec/write-stream.inline.h
index 146b014..80c3459 100644
--- a/be/src/exec/write-stream.inline.h
+++ b/be/src/exec/write-stream.inline.h
@@ -24,8 +24,6 @@
 
 #include <stdlib.h>
 
-#include "common/names.h"
-
 namespace impala {
 
 inline int WriteStream::WriteByte(uint8_t val) {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/exprs/anyval-util.h
----------------------------------------------------------------------
diff --git a/be/src/exprs/anyval-util.h b/be/src/exprs/anyval-util.h
index 4703266..e5473c7 100644
--- a/be/src/exprs/anyval-util.h
+++ b/be/src/exprs/anyval-util.h
@@ -25,8 +25,6 @@
 #include "util/decimal-util.h"
 #include "util/hash-util.h"
 
-#include "common/names.h"
-
 using namespace impala_udf;
 
 namespace impala {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/runtime/fragment-instance-state.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/fragment-instance-state.cc b/be/src/runtime/fragment-instance-state.cc
index 5dcd4c6..b0adde9 100644
--- a/be/src/runtime/fragment-instance-state.cc
+++ b/be/src/runtime/fragment-instance-state.cc
@@ -29,6 +29,8 @@
 #include "runtime/query-state.h"
 #include "gen-cpp/ImpalaInternalService_types.h"
 
+#include "common/names.h"
+
 using namespace impala;
 
 FragmentInstanceState::FragmentInstanceState(

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/runtime/query-exec-mgr.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/query-exec-mgr.cc b/be/src/runtime/query-exec-mgr.cc
index c38f478..8b72ed9 100644
--- a/be/src/runtime/query-exec-mgr.cc
+++ b/be/src/runtime/query-exec-mgr.cc
@@ -33,7 +33,8 @@
 #include "util/impalad-metrics.h"
 #include "util/debug-util.h"
 
-using boost::lock_guard;
+#include "common/names.h"
+
 using namespace impala;
 
 // TODO: this logging should go into a per query log.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/runtime/query-state.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/query-state.cc b/be/src/runtime/query-state.cc
index 7757936..2b2e3a0 100644
--- a/be/src/runtime/query-state.cc
+++ b/be/src/runtime/query-state.cc
@@ -26,6 +26,8 @@
 #include "runtime/mem-tracker.h"
 #include "runtime/query-exec-mgr.h"
 
+#include "common/names.h"
+
 using namespace impala;
 
 QueryState::ScopedRef::ScopedRef(const TUniqueId& query_id) {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/service/impala-internal-service.cc
----------------------------------------------------------------------
diff --git a/be/src/service/impala-internal-service.cc b/be/src/service/impala-internal-service.cc
index fff7f9e..a9f7f01 100644
--- a/be/src/service/impala-internal-service.cc
+++ b/be/src/service/impala-internal-service.cc
@@ -20,6 +20,7 @@
 #include <boost/lexical_cast.hpp>
 
 #include "common/status.h"
+#include "gutil/strings/substitute.h"
 #include "service/impala-server.h"
 #include "runtime/query-exec-mgr.h"
 #include "runtime/query-state.h"
@@ -27,6 +28,8 @@
 #include "runtime/exec-env.h"
 #include "testutil/fault-injection-util.h"
 
+#include "common/names.h"
+
 using namespace impala;
 
 ImpalaInternalService::ImpalaInternalService() {

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/util/process-state-info.h
----------------------------------------------------------------------
diff --git a/be/src/util/process-state-info.h b/be/src/util/process-state-info.h
index fd4690f..7b96313 100644
--- a/be/src/util/process-state-info.h
+++ b/be/src/util/process-state-info.h
@@ -20,11 +20,9 @@
 
 #include <map>
 #include <string>
-
 #include <boost/cstdint.hpp>
-#include "common/logging.h"
-#include "common/names.h"
 
+#include "common/logging.h"
 
 namespace impala {
 
@@ -86,20 +84,20 @@ class ProcessStateInfo {
   /// to be thread safe.
   ProcessStateInfo();
 
-  string DebugString() const;
+  std::string DebugString() const;
 
-  int GetInt(const string& state_key) const;
-  int64_t GetInt64(const string& state_key) const;
-  string GetString(const string& state_key) const;
+  int GetInt(const std::string& state_key) const;
+  int64_t GetInt64(const std::string& state_key) const;
+  std::string GetString(const std::string& state_key) const;
 
   /// Original data's unit is B or KB.
-  int64_t GetBytes(const string& state_key) const;
+  int64_t GetBytes(const std::string& state_key) const;
  private:
-  typedef map<string, string> ProcessStateMap;
+  typedef std::map<std::string, std::string> ProcessStateMap;
   ProcessStateMap process_state_map_;
 
   /// The description info for each file.
-  typedef map<int, string> FileDescriptorMap;
+  typedef std::map<int, std::string> FileDescriptorMap;
   FileDescriptorMap fd_desc_;
 
   /// Read I/O info from /proc/<pid>/io.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d074f71d/be/src/util/uid-util.h
----------------------------------------------------------------------
diff --git a/be/src/util/uid-util.h b/be/src/util/uid-util.h
index b532278..37f804a 100644
--- a/be/src/util/uid-util.h
+++ b/be/src/util/uid-util.h
@@ -25,7 +25,6 @@
 
 #include "gen-cpp/Types_types.h"  // for TUniqueId
 #include "util/debug-util.h"
-#include "common/names.h"
 
 namespace impala {