You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2016/04/02 06:40:31 UTC

[2/3] arrow git commit: ARROW-71: [C++] Add clang-tidy and clang-format to the the tool chain.

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/test-util.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/test-util.h b/cpp/src/arrow/test-util.h
index b2bce26..538d9b2 100644
--- a/cpp/src/arrow/test-util.h
+++ b/cpp/src/arrow/test-util.h
@@ -36,38 +36,29 @@
 #include "arrow/util/random.h"
 #include "arrow/util/status.h"
 
-#define ASSERT_RAISES(ENUM, expr)               \
-  do {                                          \
-    Status s = (expr);                          \
-    if (!s.Is##ENUM()) {                        \
-      FAIL() << s.ToString();                   \
-    }                                           \
+#define ASSERT_RAISES(ENUM, expr)                  \
+  do {                                             \
+    Status s = (expr);                             \
+    if (!s.Is##ENUM()) { FAIL() << s.ToString(); } \
   } while (0)
 
-
-#define ASSERT_OK(expr)                         \
-  do {                                          \
-    Status s = (expr);                          \
-    if (!s.ok()) {                              \
-        FAIL() << s.ToString();                 \
-    }                                           \
+#define ASSERT_OK(expr)                      \
+  do {                                       \
+    Status s = (expr);                       \
+    if (!s.ok()) { FAIL() << s.ToString(); } \
   } while (0)
 
-
-#define EXPECT_OK(expr)                         \
-  do {                                          \
-    Status s = (expr);                          \
-    EXPECT_TRUE(s.ok());                        \
+#define EXPECT_OK(expr)  \
+  do {                   \
+    Status s = (expr);   \
+    EXPECT_TRUE(s.ok()); \
   } while (0)
 
-
 namespace arrow {
 
 class TestBase : public ::testing::Test {
  public:
-  void SetUp() {
-    pool_ = default_memory_pool();
-  }
+  void SetUp() { pool_ = default_memory_pool(); }
 
   template <typename ArrayType>
   std::shared_ptr<Array> MakePrimitive(int32_t length, int32_t null_count = 0) {
@@ -97,10 +88,8 @@ void randint(int64_t N, T lower, T upper, std::vector<T>* out) {
   }
 }
 
-
 template <typename T>
-void random_real(int n, uint32_t seed, T min_value, T max_value,
-    std::vector<T>* out) {
+void random_real(int n, uint32_t seed, T min_value, T max_value, std::vector<T>* out) {
   std::mt19937 gen(seed);
   std::uniform_real_distribution<T> d(min_value, max_value);
   for (int i = 0; i < n; ++i) {
@@ -108,11 +97,10 @@ void random_real(int n, uint32_t seed, T min_value, T max_value,
   }
 }
 
-
 template <typename T>
 std::shared_ptr<Buffer> to_buffer(const std::vector<T>& values) {
-  return std::make_shared<Buffer>(reinterpret_cast<const uint8_t*>(values.data()),
-      values.size() * sizeof(T));
+  return std::make_shared<Buffer>(
+      reinterpret_cast<const uint8_t*>(values.data()), values.size() * sizeof(T));
 }
 
 void random_null_bitmap(int64_t n, double pct_null, uint8_t* null_bitmap) {
@@ -143,8 +131,8 @@ void rand_uniform_int(int n, uint32_t seed, T min_value, T max_value, T* out) {
 static inline int bitmap_popcount(const uint8_t* data, int length) {
   int count = 0;
   for (int i = 0; i < length; ++i) {
-    // TODO: accelerate this
-    if (util::get_bit(data, i)) ++count;
+    // TODO(wesm): accelerate this
+    if (util::get_bit(data, i)) { ++count; }
   }
   return count;
 }
@@ -152,9 +140,7 @@ static inline int bitmap_popcount(const uint8_t* data, int length) {
 static inline int null_count(const std::vector<uint8_t>& valid_bytes) {
   int result = 0;
   for (size_t i = 0; i < valid_bytes.size(); ++i) {
-    if (valid_bytes[i] == 0) {
-      ++result;
-    }
+    if (valid_bytes[i] == 0) { ++result; }
   }
   return result;
 }
@@ -167,7 +153,7 @@ std::shared_ptr<Buffer> bytes_to_null_buffer(const std::vector<uint8_t>& bytes)
   return out;
 }
 
-} // namespace test
-} // namespace arrow
+}  // namespace test
+}  // namespace arrow
 
-#endif // ARROW_TEST_UTIL_H_
+#endif  // ARROW_TEST_UTIL_H_

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/type.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/type.cc b/cpp/src/arrow/type.cc
index f7f835e..4e686d9 100644
--- a/cpp/src/arrow/type.cc
+++ b/cpp/src/arrow/type.cc
@@ -25,9 +25,7 @@ namespace arrow {
 std::string Field::ToString() const {
   std::stringstream ss;
   ss << this->name << ": " << this->type->ToString();
-  if (!this->nullable) {
-    ss << " not null";
-  }
+  if (!this->nullable) { ss << " not null"; }
   return ss.str();
 }
 
@@ -50,7 +48,7 @@ std::string StructType::ToString() const {
   std::stringstream s;
   s << "struct<";
   for (int i = 0; i < this->num_children(); ++i) {
-    if (i > 0) s << ", ";
+    if (i > 0) { s << ", "; }
     const std::shared_ptr<Field>& field = this->child(i);
     s << field->name << ": " << field->type->ToString();
   }
@@ -58,4 +56,4 @@ std::string StructType::ToString() const {
   return s.str();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/type.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/type.h b/cpp/src/arrow/type.h
index 86e4779..051ab46 100644
--- a/cpp/src/arrow/type.h
+++ b/cpp/src/arrow/type.h
@@ -110,8 +110,7 @@ struct DataType {
 
   std::vector<std::shared_ptr<Field>> children_;
 
-  explicit DataType(Type::type type) :
-      type(type) {}
+  explicit DataType(Type::type type) : type(type) {}
 
   virtual ~DataType();
 
@@ -120,21 +119,13 @@ struct DataType {
     return this == other || (this->type == other->type);
   }
 
-  bool Equals(const std::shared_ptr<DataType>& other) {
-    return Equals(other.get());
-  }
+  bool Equals(const std::shared_ptr<DataType>& other) { return Equals(other.get()); }
 
-  const std::shared_ptr<Field>& child(int i) const {
-    return children_[i];
-  }
+  const std::shared_ptr<Field>& child(int i) const { return children_[i]; }
 
-  int num_children() const {
-    return children_.size();
-  }
+  int num_children() const { return children_.size(); }
 
-  virtual int value_size() const {
-    return -1;
-  }
+  virtual int value_size() const { return -1; }
 
   virtual std::string ToString() const = 0;
 };
@@ -153,28 +144,20 @@ struct Field {
   // Fields can be nullable
   bool nullable;
 
-  Field(const std::string& name, const TypePtr& type, bool nullable = true) :
-      name(name),
-      type(type),
-      nullable(nullable) {}
+  Field(const std::string& name, const TypePtr& type, bool nullable = true)
+      : name(name), type(type), nullable(nullable) {}
 
-  bool operator==(const Field& other) const {
-    return this->Equals(other);
-  }
+  bool operator==(const Field& other) const { return this->Equals(other); }
 
-  bool operator!=(const Field& other) const {
-    return !this->Equals(other);
-  }
+  bool operator!=(const Field& other) const { return !this->Equals(other); }
 
   bool Equals(const Field& other) const {
-    return (this == &other) || (this->name == other.name &&
-        this->nullable == other.nullable &&
-        this->type->Equals(other.type.get()));
+    return (this == &other) ||
+           (this->name == other.name && this->nullable == other.nullable &&
+               this->type->Equals(other.type.get()));
   }
 
-  bool Equals(const std::shared_ptr<Field>& other) const {
-    return Equals(*other.get());
-  }
+  bool Equals(const std::shared_ptr<Field>& other) const { return Equals(*other.get()); }
 
   std::string ToString() const;
 };
@@ -192,20 +175,15 @@ inline std::string PrimitiveType<Derived>::ToString() const {
   return result;
 }
 
-#define PRIMITIVE_DECL(TYPENAME, C_TYPE, ENUM, SIZE, NAME)  \
-  typedef C_TYPE c_type;                                    \
-  static constexpr Type::type type_enum = Type::ENUM;       \
-                                                            \
-  TYPENAME()                                                \
-      : PrimitiveType<TYPENAME>() {}                        \
-                                                            \
-  virtual int value_size() const {                          \
-    return SIZE;                                            \
-  }                                                         \
-                                                            \
-  static const char* name() {                               \
-    return NAME;                                            \
-  }
+#define PRIMITIVE_DECL(TYPENAME, C_TYPE, ENUM, SIZE, NAME) \
+  typedef C_TYPE c_type;                                   \
+  static constexpr Type::type type_enum = Type::ENUM;      \
+                                                           \
+  TYPENAME() : PrimitiveType<TYPENAME>() {}                \
+                                                           \
+  virtual int value_size() const { return SIZE; }          \
+                                                           \
+  static const char* name() { return NAME; }
 
 struct NullType : public PrimitiveType<NullType> {
   PRIMITIVE_DECL(NullType, void, NA, 0, "null");
@@ -257,27 +235,19 @@ struct DoubleType : public PrimitiveType<DoubleType> {
 
 struct ListType : public DataType {
   // List can contain any other logical value type
-  explicit ListType(const std::shared_ptr<DataType>& value_type)
-      : DataType(Type::LIST) {
+  explicit ListType(const std::shared_ptr<DataType>& value_type) : DataType(Type::LIST) {
     children_ = {std::make_shared<Field>("item", value_type)};
   }
 
-  explicit ListType(const std::shared_ptr<Field>& value_field)
-      : DataType(Type::LIST) {
+  explicit ListType(const std::shared_ptr<Field>& value_field) : DataType(Type::LIST) {
     children_ = {value_field};
   }
 
-  const std::shared_ptr<Field>& value_field() const {
-    return children_[0];
-  }
+  const std::shared_ptr<Field>& value_field() const { return children_[0]; }
 
-  const std::shared_ptr<DataType>& value_type() const {
-    return children_[0]->type;
-  }
+  const std::shared_ptr<DataType>& value_type() const { return children_[0]->type; }
 
-  static char const *name() {
-    return "list";
-  }
+  static char const* name() { return "list"; }
 
   std::string ToString() const override;
 };
@@ -286,9 +256,7 @@ struct ListType : public DataType {
 struct StringType : public DataType {
   StringType();
 
-  static char const *name() {
-    return "string";
-  }
+  static char const* name() { return "string"; }
 
   std::string ToString() const override;
 };
@@ -304,10 +272,8 @@ struct StructType : public DataType {
 
 // These will be defined elsewhere
 template <typename T>
-struct type_traits {
-};
-
+struct type_traits {};
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_TYPE_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/binary.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/binary.h b/cpp/src/arrow/types/binary.h
index 1fd675e..201fbb6 100644
--- a/cpp/src/arrow/types/binary.h
+++ b/cpp/src/arrow/types/binary.h
@@ -23,8 +23,6 @@
 
 #include "arrow/type.h"
 
-namespace arrow {
+namespace arrow {}  // namespace arrow
 
-} // namespace arrow
-
-#endif // ARROW_TYPES_BINARY_H
+#endif  // ARROW_TYPES_BINARY_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/collection.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/collection.h b/cpp/src/arrow/types/collection.h
index 46d84f1..1712030 100644
--- a/cpp/src/arrow/types/collection.h
+++ b/cpp/src/arrow/types/collection.h
@@ -31,15 +31,11 @@ struct CollectionType : public DataType {
 
   CollectionType() : DataType(T) {}
 
-  const TypePtr& child(int i) const {
-    return child_types_[i];
-  }
+  const TypePtr& child(int i) const { return child_types_[i]; }
 
-  int num_children() const {
-    return child_types_.size();
-  }
+  int num_children() const { return child_types_.size(); }
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_COLLECTION_H
+#endif  // ARROW_TYPES_COLLECTION_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/construct.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/construct.cc b/cpp/src/arrow/types/construct.cc
index 34647a5..0a30929 100644
--- a/cpp/src/arrow/types/construct.cc
+++ b/cpp/src/arrow/types/construct.cc
@@ -30,10 +30,10 @@ namespace arrow {
 
 class ArrayBuilder;
 
-#define BUILDER_CASE(ENUM, BuilderType)         \
-    case Type::ENUM:                            \
-      out->reset(new BuilderType(pool, type));  \
-      return Status::OK();
+#define BUILDER_CASE(ENUM, BuilderType)      \
+  case Type::ENUM:                           \
+    out->reset(new BuilderType(pool, type)); \
+    return Status::OK();
 
 // Initially looked at doing this with vtables, but shared pointers makes it
 // difficult
@@ -58,30 +58,28 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
 
     BUILDER_CASE(STRING, StringBuilder);
 
-    case Type::LIST:
-      {
-        std::shared_ptr<ArrayBuilder> value_builder;
+    case Type::LIST: {
+      std::shared_ptr<ArrayBuilder> value_builder;
 
-        const std::shared_ptr<DataType>& value_type = static_cast<ListType*>(
-            type.get())->value_type();
-        RETURN_NOT_OK(MakeBuilder(pool, value_type, &value_builder));
-        out->reset(new ListBuilder(pool, type, value_builder));
-        return Status::OK();
-      }
+      const std::shared_ptr<DataType>& value_type =
+          static_cast<ListType*>(type.get())->value_type();
+      RETURN_NOT_OK(MakeBuilder(pool, value_type, &value_builder));
+      out->reset(new ListBuilder(pool, type, value_builder));
+      return Status::OK();
+    }
     default:
       return Status::NotImplemented(type->ToString());
   }
 }
 
-#define MAKE_PRIMITIVE_ARRAY_CASE(ENUM, ArrayType)                      \
-    case Type::ENUM:                                                    \
-      out->reset(new ArrayType(type, length, data, null_count, null_bitmap)); \
-      return Status::OK();
+#define MAKE_PRIMITIVE_ARRAY_CASE(ENUM, ArrayType)                          \
+  case Type::ENUM:                                                          \
+    out->reset(new ArrayType(type, length, data, null_count, null_bitmap)); \
+    return Status::OK();
 
-Status MakePrimitiveArray(const std::shared_ptr<DataType>& type,
-    int32_t length, const std::shared_ptr<Buffer>& data,
-    int32_t null_count, const std::shared_ptr<Buffer>& null_bitmap,
-    std::shared_ptr<Array>* out) {
+Status MakePrimitiveArray(const std::shared_ptr<DataType>& type, int32_t length,
+    const std::shared_ptr<Buffer>& data, int32_t null_count,
+    const std::shared_ptr<Buffer>& null_bitmap, std::shared_ptr<Array>* out) {
   switch (type->type) {
     MAKE_PRIMITIVE_ARRAY_CASE(BOOL, BooleanArray);
     MAKE_PRIMITIVE_ARRAY_CASE(UINT8, UInt8Array);
@@ -99,4 +97,4 @@ Status MakePrimitiveArray(const std::shared_ptr<DataType>& type,
   }
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/construct.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/construct.h b/cpp/src/arrow/types/construct.h
index 228faec..27fb7bd 100644
--- a/cpp/src/arrow/types/construct.h
+++ b/cpp/src/arrow/types/construct.h
@@ -33,11 +33,10 @@ class Status;
 Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
     std::shared_ptr<ArrayBuilder>* out);
 
-Status MakePrimitiveArray(const std::shared_ptr<DataType>& type,
-    int32_t length, const std::shared_ptr<Buffer>& data,
-    int32_t null_count, const std::shared_ptr<Buffer>& null_bitmap,
-    std::shared_ptr<Array>* out);
+Status MakePrimitiveArray(const std::shared_ptr<DataType>& type, int32_t length,
+    const std::shared_ptr<Buffer>& data, int32_t null_count,
+    const std::shared_ptr<Buffer>& null_bitmap, std::shared_ptr<Array>* out);
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_BUILDER_H_
+#endif  // ARROW_BUILDER_H_

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/datetime.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/datetime.h b/cpp/src/arrow/types/datetime.h
index e57b66a..b782455 100644
--- a/cpp/src/arrow/types/datetime.h
+++ b/cpp/src/arrow/types/datetime.h
@@ -23,49 +23,30 @@
 namespace arrow {
 
 struct DateType : public DataType {
-  enum class Unit: char {
-    DAY = 0,
-    MONTH = 1,
-    YEAR = 2
-  };
+  enum class Unit : char { DAY = 0, MONTH = 1, YEAR = 2 };
 
   Unit unit;
 
-  explicit DateType(Unit unit = Unit::DAY)
-      : DataType(Type::DATE),
-        unit(unit) {}
+  explicit DateType(Unit unit = Unit::DAY) : DataType(Type::DATE), unit(unit) {}
 
-  DateType(const DateType& other)
-      : DateType(other.unit) {}
+  DateType(const DateType& other) : DateType(other.unit) {}
 
-  static char const *name() {
-    return "date";
-  }
+  static char const* name() { return "date"; }
 };
 
-
 struct TimestampType : public DataType {
-  enum class Unit: char {
-    SECOND = 0,
-    MILLI = 1,
-    MICRO = 2,
-    NANO = 3
-  };
+  enum class Unit : char { SECOND = 0, MILLI = 1, MICRO = 2, NANO = 3 };
 
   Unit unit;
 
   explicit TimestampType(Unit unit = Unit::MILLI)
-      : DataType(Type::TIMESTAMP),
-        unit(unit) {}
+      : DataType(Type::TIMESTAMP), unit(unit) {}
 
-  TimestampType(const TimestampType& other)
-      : TimestampType(other.unit) {}
+  TimestampType(const TimestampType& other) : TimestampType(other.unit) {}
 
-  static char const *name() {
-    return "timestamp";
-  }
+  static char const* name() { return "timestamp"; }
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_DATETIME_H
+#endif  // ARROW_TYPES_DATETIME_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/decimal-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/decimal-test.cc b/cpp/src/arrow/types/decimal-test.cc
index 89896c8..7296ff8 100644
--- a/cpp/src/arrow/types/decimal-test.cc
+++ b/cpp/src/arrow/types/decimal-test.cc
@@ -37,4 +37,4 @@ TEST(TypesTest, TestDecimalType) {
   ASSERT_EQ(t2.scale, 4);
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/decimal.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/decimal.cc b/cpp/src/arrow/types/decimal.cc
index f120c1a..1d9a5e5 100644
--- a/cpp/src/arrow/types/decimal.cc
+++ b/cpp/src/arrow/types/decimal.cc
@@ -28,5 +28,4 @@ std::string DecimalType::ToString() const {
   return s.str();
 }
 
-} // namespace arrow
-
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/decimal.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/decimal.h b/cpp/src/arrow/types/decimal.h
index 26243b4..1be489d 100644
--- a/cpp/src/arrow/types/decimal.h
+++ b/cpp/src/arrow/types/decimal.h
@@ -26,18 +26,15 @@ namespace arrow {
 
 struct DecimalType : public DataType {
   explicit DecimalType(int precision_, int scale_)
-      : DataType(Type::DECIMAL), precision(precision_),
-        scale(scale_) { }
+      : DataType(Type::DECIMAL), precision(precision_), scale(scale_) {}
   int precision;
   int scale;
 
-  static char const *name() {
-    return "decimal";
-  }
+  static char const* name() { return "decimal"; }
 
   std::string ToString() const override;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_DECIMAL_H
+#endif  // ARROW_TYPES_DECIMAL_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/json.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/json.cc b/cpp/src/arrow/types/json.cc
index fb731ed..a4e0d08 100644
--- a/cpp/src/arrow/types/json.cc
+++ b/cpp/src/arrow/types/json.cc
@@ -30,9 +30,8 @@ static const TypePtr String(new StringType());
 static const TypePtr Double(new DoubleType());
 static const TypePtr Bool(new BooleanType());
 
-static const std::vector<TypePtr> json_types = {Null, Int32, String,
-                                                Double, Bool};
+static const std::vector<TypePtr> json_types = {Null, Int32, String, Double, Bool};
 TypePtr JSONScalar::dense_type = TypePtr(new DenseUnionType(json_types));
 TypePtr JSONScalar::sparse_type = TypePtr(new SparseUnionType(json_types));
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/json.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/json.h b/cpp/src/arrow/types/json.h
index 9c850af..9de961f 100644
--- a/cpp/src/arrow/types/json.h
+++ b/cpp/src/arrow/types/json.h
@@ -28,11 +28,9 @@ struct JSONScalar : public DataType {
   static TypePtr dense_type;
   static TypePtr sparse_type;
 
-  explicit JSONScalar(bool dense = true)
-      : DataType(Type::JSON_SCALAR),
-        dense(dense) {}
+  explicit JSONScalar(bool dense = true) : DataType(Type::JSON_SCALAR), dense(dense) {}
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_JSON_H
+#endif  // ARROW_TYPES_JSON_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/list-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/list-test.cc b/cpp/src/arrow/types/list-test.cc
index 4eb560e..aa34f23 100644
--- a/cpp/src/arrow/types/list-test.cc
+++ b/cpp/src/arrow/types/list-test.cc
@@ -76,9 +76,7 @@ class TestListBuilder : public TestBuilder {
     builder_ = std::dynamic_pointer_cast<ListBuilder>(tmp);
   }
 
-  void Done() {
-    result_ = std::dynamic_pointer_cast<ListArray>(builder_->Finish());
-  }
+  void Done() { result_ = std::dynamic_pointer_cast<ListArray>(builder_->Finish()); }
 
  protected:
   TypePtr value_type_;
@@ -88,9 +86,7 @@ class TestListBuilder : public TestBuilder {
   shared_ptr<ListArray> result_;
 };
 
-
-TEST_F(TestListBuilder, TestResize) {
-}
+TEST_F(TestListBuilder, TestResize) {}
 
 TEST_F(TestListBuilder, TestAppendNull) {
   ASSERT_OK(builder_->AppendNull());
@@ -155,5 +151,4 @@ TEST_F(TestListBuilder, TestZeroLength) {
   Done();
 }
 
-
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/list.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/list.cc b/cpp/src/arrow/types/list.cc
index d64c06d..23f12dd 100644
--- a/cpp/src/arrow/types/list.cc
+++ b/cpp/src/arrow/types/list.cc
@@ -20,32 +20,25 @@
 namespace arrow {
 
 bool ListArray::EqualsExact(const ListArray& other) const {
-  if (this == &other) return true;
-  if (null_count_ != other.null_count_) {
-    return false;
-  }
+  if (this == &other) { return true; }
+  if (null_count_ != other.null_count_) { return false; }
 
-  bool equal_offsets = offset_buf_->Equals(*other.offset_buf_,
-      length_ + 1);
+  bool equal_offsets = offset_buf_->Equals(*other.offset_buf_, length_ + 1);
   bool equal_null_bitmap = true;
   if (null_count_ > 0) {
-    equal_null_bitmap = null_bitmap_->Equals(*other.null_bitmap_,
-        util::bytes_for_bits(length_));
+    equal_null_bitmap =
+        null_bitmap_->Equals(*other.null_bitmap_, util::bytes_for_bits(length_));
   }
 
-  if (!(equal_offsets && equal_null_bitmap)) {
-    return false;
-  }
+  if (!(equal_offsets && equal_null_bitmap)) { return false; }
 
   return values()->Equals(other.values());
 }
 
 bool ListArray::Equals(const std::shared_ptr<Array>& arr) const {
-  if (this == arr.get()) return true;
-  if (this->type_enum() != arr->type_enum()) {
-    return false;
-  }
+  if (this == arr.get()) { return true; }
+  if (this->type_enum() != arr->type_enum()) { return false; }
   return EqualsExact(*static_cast<const ListArray*>(arr.get()));
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/list.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/list.h b/cpp/src/arrow/types/list.h
index 8073b51..6b81546 100644
--- a/cpp/src/arrow/types/list.h
+++ b/cpp/src/arrow/types/list.h
@@ -37,13 +37,12 @@ class MemoryPool;
 class ListArray : public Array {
  public:
   ListArray(const TypePtr& type, int32_t length, std::shared_ptr<Buffer> offsets,
-      const ArrayPtr& values,
-      int32_t null_count = 0,
-      std::shared_ptr<Buffer> null_bitmap = nullptr) :
-      Array(type, length, null_count, null_bitmap) {
+      const ArrayPtr& values, int32_t null_count = 0,
+      std::shared_ptr<Buffer> null_bitmap = nullptr)
+      : Array(type, length, null_count, null_bitmap) {
     offset_buf_ = offsets;
-    offsets_ = offsets == nullptr? nullptr :
-      reinterpret_cast<const int32_t*>(offset_buf_->data());
+    offsets_ = offsets == nullptr ? nullptr
+                                  : reinterpret_cast<const int32_t*>(offset_buf_->data());
     values_ = values;
   }
 
@@ -51,19 +50,17 @@ class ListArray : public Array {
 
   // Return a shared pointer in case the requestor desires to share ownership
   // with this array.
-  const std::shared_ptr<Array>& values() const {return values_;}
+  const std::shared_ptr<Array>& values() const { return values_; }
 
-  const std::shared_ptr<DataType>& value_type() const {
-    return values_->type();
-  }
+  const std::shared_ptr<DataType>& value_type() const { return values_->type(); }
 
-  const int32_t* offsets() const { return offsets_;}
+  const int32_t* offsets() const { return offsets_; }
 
-  int32_t offset(int i) const { return offsets_[i];}
+  int32_t offset(int i) const { return offsets_[i]; }
 
   // Neither of these functions will perform boundschecking
-  int32_t value_offset(int i) { return offsets_[i];}
-  int32_t value_length(int i) { return offsets_[i + 1] - offsets_[i];}
+  int32_t value_offset(int i) { return offsets_[i]; }
+  int32_t value_length(int i) { return offsets_[i + 1] - offsets_[i]; }
 
   bool EqualsExact(const ListArray& other) const;
   bool Equals(const std::shared_ptr<Array>& arr) const override;
@@ -77,7 +74,6 @@ class ListArray : public Array {
 // ----------------------------------------------------------------------
 // Array builder
 
-
 // Builder class for variable-length list array value types
 //
 // To use this class, you must append values to the child array builder and use
@@ -85,10 +81,9 @@ class ListArray : public Array {
 // have been appended to the child array)
 class ListBuilder : public Int32Builder {
  public:
-  ListBuilder(MemoryPool* pool, const TypePtr& type,
-      std::shared_ptr<ArrayBuilder> value_builder)
-      : Int32Builder(pool, type),
-        value_builder_(value_builder) {}
+  ListBuilder(
+      MemoryPool* pool, const TypePtr& type, std::shared_ptr<ArrayBuilder> value_builder)
+      : Int32Builder(pool, type), value_builder_(value_builder) {}
 
   Status Init(int32_t elements) {
     // One more than requested.
@@ -116,12 +111,9 @@ class ListBuilder : public Int32Builder {
       int32_t new_capacity = util::next_power2(length_ + length);
       RETURN_NOT_OK(Resize(new_capacity));
     }
-    memcpy(raw_data_ + length_, values,
-        type_traits<Int32Type>::bytes_required(length));
+    memcpy(raw_data_ + length_, values, type_traits<Int32Type>::bytes_required(length));
 
-    if (valid_bytes != nullptr) {
-      AppendNulls(valid_bytes, length);
-    }
+    if (valid_bytes != nullptr) { AppendNulls(valid_bytes, length); }
 
     length_ += length;
     return Status::OK();
@@ -132,12 +124,10 @@ class ListBuilder : public Int32Builder {
     std::shared_ptr<Array> items = value_builder_->Finish();
 
     // Add final offset if the length is non-zero
-    if (length_) {
-      raw_data_[length_] = items->length();
-    }
+    if (length_) { raw_data_[length_] = items->length(); }
 
-    auto result = std::make_shared<Container>(type_, length_, data_, items,
-        null_count_, null_bitmap_);
+    auto result = std::make_shared<Container>(
+        type_, length_, data_, items, null_count_, null_bitmap_);
 
     data_ = null_bitmap_ = nullptr;
     capacity_ = length_ = null_count_ = 0;
@@ -145,9 +135,7 @@ class ListBuilder : public Int32Builder {
     return result;
   }
 
-  std::shared_ptr<Array> Finish() override {
-    return Transfer<ListArray>();
-  }
+  std::shared_ptr<Array> Finish() override { return Transfer<ListArray>(); }
 
   // Start a new variable-length list slot
   //
@@ -167,19 +155,14 @@ class ListBuilder : public Int32Builder {
     return Status::OK();
   }
 
-  Status AppendNull() {
-    return Append(true);
-  }
+  Status AppendNull() { return Append(true); }
 
-  const std::shared_ptr<ArrayBuilder>& value_builder() const {
-    return value_builder_;
-  }
+  const std::shared_ptr<ArrayBuilder>& value_builder() const { return value_builder_; }
 
  protected:
   std::shared_ptr<ArrayBuilder> value_builder_;
 };
 
+}  // namespace arrow
 
-} // namespace arrow
-
-#endif // ARROW_TYPES_LIST_H
+#endif  // ARROW_TYPES_LIST_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/primitive-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/primitive-test.cc b/cpp/src/arrow/types/primitive-test.cc
index 761845d..6bd9e73 100644
--- a/cpp/src/arrow/types/primitive-test.cc
+++ b/cpp/src/arrow/types/primitive-test.cc
@@ -41,15 +41,15 @@ namespace arrow {
 
 class Array;
 
-#define PRIMITIVE_TEST(KLASS, ENUM, NAME)       \
-  TEST(TypesTest, TestPrimitive_##ENUM) {       \
-    KLASS tp;                                   \
-                                                \
-    ASSERT_EQ(tp.type, Type::ENUM);             \
-    ASSERT_EQ(tp.name(), string(NAME));         \
-                                                \
-    KLASS tp_copy = tp;                         \
-    ASSERT_EQ(tp_copy.type, Type::ENUM);        \
+#define PRIMITIVE_TEST(KLASS, ENUM, NAME) \
+  TEST(TypesTest, TestPrimitive_##ENUM) { \
+    KLASS tp;                             \
+                                          \
+    ASSERT_EQ(tp.type, Type::ENUM);       \
+    ASSERT_EQ(tp.name(), string(NAME));   \
+                                          \
+    KLASS tp_copy = tp;                   \
+    ASSERT_EQ(tp_copy.type, Type::ENUM);  \
   }
 
 PRIMITIVE_TEST(Int8Type, INT8, "int8");
@@ -108,8 +108,8 @@ class TestPrimitiveBuilder : public TestBuilder {
   void Check(const std::shared_ptr<BuilderType>& builder, bool nullable) {
     int size = builder->length();
 
-    auto ex_data = std::make_shared<Buffer>(reinterpret_cast<uint8_t*>(draws_.data()),
-        size * sizeof(T));
+    auto ex_data = std::make_shared<Buffer>(
+        reinterpret_cast<uint8_t*>(draws_.data()), size * sizeof(T));
 
     std::shared_ptr<Buffer> ex_null_bitmap;
     int32_t ex_null_count = 0;
@@ -121,10 +121,10 @@ class TestPrimitiveBuilder : public TestBuilder {
       ex_null_bitmap = nullptr;
     }
 
-    auto expected = std::make_shared<ArrayType>(size, ex_data, ex_null_count,
-        ex_null_bitmap);
-    std::shared_ptr<ArrayType> result = std::dynamic_pointer_cast<ArrayType>(
-        builder->Finish());
+    auto expected =
+        std::make_shared<ArrayType>(size, ex_data, ex_null_count, ex_null_bitmap);
+    std::shared_ptr<ArrayType> result =
+        std::dynamic_pointer_cast<ArrayType>(builder->Finish());
 
     // Builder is now reset
     ASSERT_EQ(0, builder->length());
@@ -145,30 +145,30 @@ class TestPrimitiveBuilder : public TestBuilder {
   vector<uint8_t> valid_bytes_;
 };
 
-#define PTYPE_DECL(CapType, c_type)                 \
-  typedef CapType##Array ArrayType;                 \
-  typedef CapType##Builder BuilderType;             \
-  typedef CapType##Type Type;                       \
-  typedef c_type T;                                 \
-                                                    \
-  static std::shared_ptr<DataType> type() {         \
-    return std::shared_ptr<DataType>(new Type());   \
+#define PTYPE_DECL(CapType, c_type)               \
+  typedef CapType##Array ArrayType;               \
+  typedef CapType##Builder BuilderType;           \
+  typedef CapType##Type Type;                     \
+  typedef c_type T;                               \
+                                                  \
+  static std::shared_ptr<DataType> type() {       \
+    return std::shared_ptr<DataType>(new Type()); \
   }
 
-#define PINT_DECL(CapType, c_type, LOWER, UPPER)    \
-  struct P##CapType {                               \
-    PTYPE_DECL(CapType, c_type);                    \
-    static void draw(int N, vector<T>* draws) {     \
-      test::randint<T>(N, LOWER, UPPER, draws);     \
-    }                                               \
+#define PINT_DECL(CapType, c_type, LOWER, UPPER) \
+  struct P##CapType {                            \
+    PTYPE_DECL(CapType, c_type);                 \
+    static void draw(int N, vector<T>* draws) {  \
+      test::randint<T>(N, LOWER, UPPER, draws);  \
+    }                                            \
   }
 
-#define PFLOAT_DECL(CapType, c_type, LOWER, UPPER)      \
-  struct P##CapType {                                   \
-    PTYPE_DECL(CapType, c_type);                        \
-    static void draw(int N, vector<T>* draws) {         \
-      test::random_real<T>(N, 0, LOWER, UPPER, draws);  \
-    }                                                   \
+#define PFLOAT_DECL(CapType, c_type, LOWER, UPPER)     \
+  struct P##CapType {                                  \
+    PTYPE_DECL(CapType, c_type);                       \
+    static void draw(int N, vector<T>* draws) {        \
+      test::random_real<T>(N, 0, LOWER, UPPER, draws); \
+    }                                                  \
   }
 
 PINT_DECL(UInt8, uint8_t, 0, UINT8_MAX);
@@ -214,10 +214,10 @@ void TestPrimitiveBuilder<PBoolean>::Check(
     ex_null_bitmap = nullptr;
   }
 
-  auto expected = std::make_shared<BooleanArray>(size, ex_data, ex_null_count,
-      ex_null_bitmap);
-  std::shared_ptr<BooleanArray> result = std::dynamic_pointer_cast<BooleanArray>(
-      builder->Finish());
+  auto expected =
+      std::make_shared<BooleanArray>(size, ex_data, ex_null_count, ex_null_bitmap);
+  std::shared_ptr<BooleanArray> result =
+      std::dynamic_pointer_cast<BooleanArray>(builder->Finish());
 
   // Builder is now reset
   ASSERT_EQ(0, builder->length());
@@ -230,31 +230,23 @@ void TestPrimitiveBuilder<PBoolean>::Check(
   ASSERT_EQ(expected->length(), result->length());
 
   for (int i = 0; i < result->length(); ++i) {
-    if (nullable) {
-      ASSERT_EQ(valid_bytes_[i] == 0, result->IsNull(i)) << i;
-    }
+    if (nullable) { ASSERT_EQ(valid_bytes_[i] == 0, result->IsNull(i)) << i; }
     bool actual = util::get_bit(result->raw_data(), i);
     ASSERT_EQ(static_cast<bool>(draws_[i]), actual) << i;
   }
   ASSERT_TRUE(result->EqualsExact(*expected.get()));
 }
 
-typedef ::testing::Types<PBoolean,
-                         PUInt8, PUInt16, PUInt32, PUInt64,
-                         PInt8, PInt16, PInt32, PInt64,
-                         PFloat, PDouble> Primitives;
+typedef ::testing::Types<PBoolean, PUInt8, PUInt16, PUInt32, PUInt64, PInt8, PInt16,
+    PInt32, PInt64, PFloat, PDouble> Primitives;
 
 TYPED_TEST_CASE(TestPrimitiveBuilder, Primitives);
 
-#define DECL_T()                                \
-  typedef typename TestFixture::T T;
+#define DECL_T() typedef typename TestFixture::T T;
 
-#define DECL_TYPE()                             \
-  typedef typename TestFixture::Type Type;
-
-#define DECL_ARRAYTYPE()                                \
-  typedef typename TestFixture::ArrayType ArrayType;
+#define DECL_TYPE() typedef typename TestFixture::Type Type;
 
+#define DECL_ARRAYTYPE() typedef typename TestFixture::ArrayType ArrayType;
 
 TYPED_TEST(TestPrimitiveBuilder, TestInit) {
   DECL_TYPE();
@@ -369,7 +361,6 @@ TYPED_TEST(TestPrimitiveBuilder, TestAppendScalar) {
   this->Check(this->builder_nn_, false);
 }
 
-
 TYPED_TEST(TestPrimitiveBuilder, TestAppendVector) {
   DECL_T();
 
@@ -424,8 +415,7 @@ TYPED_TEST(TestPrimitiveBuilder, TestResize) {
   ASSERT_EQ(cap, this->builder_->capacity());
 
   ASSERT_EQ(type_traits<Type>::bytes_required(cap), this->builder_->data()->size());
-  ASSERT_EQ(util::bytes_for_bits(cap),
-      this->builder_->null_bitmap()->size());
+  ASSERT_EQ(util::bytes_for_bits(cap), this->builder_->null_bitmap()->size());
 }
 
 TYPED_TEST(TestPrimitiveBuilder, TestReserve) {
@@ -437,8 +427,7 @@ TYPED_TEST(TestPrimitiveBuilder, TestReserve) {
   ASSERT_OK(this->builder_->Advance(100));
   ASSERT_OK(this->builder_->Reserve(MIN_BUILDER_CAPACITY));
 
-  ASSERT_EQ(util::next_power2(MIN_BUILDER_CAPACITY + 100),
-      this->builder_->capacity());
+  ASSERT_EQ(util::next_power2(MIN_BUILDER_CAPACITY + 100), this->builder_->capacity());
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/primitive.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/primitive.cc b/cpp/src/arrow/types/primitive.cc
index c54d075..9549c47 100644
--- a/cpp/src/arrow/types/primitive.cc
+++ b/cpp/src/arrow/types/primitive.cc
@@ -28,26 +28,21 @@ namespace arrow {
 // Primitive array base
 
 PrimitiveArray::PrimitiveArray(const TypePtr& type, int32_t length,
-    const std::shared_ptr<Buffer>& data,
-    int32_t null_count,
-    const std::shared_ptr<Buffer>& null_bitmap) :
-    Array(type, length, null_count, null_bitmap) {
+    const std::shared_ptr<Buffer>& data, int32_t null_count,
+    const std::shared_ptr<Buffer>& null_bitmap)
+    : Array(type, length, null_count, null_bitmap) {
   data_ = data;
-  raw_data_ = data == nullptr? nullptr : data_->data();
+  raw_data_ = data == nullptr ? nullptr : data_->data();
 }
 
 bool PrimitiveArray::EqualsExact(const PrimitiveArray& other) const {
-  if (this == &other) return true;
-  if (null_count_ != other.null_count_) {
-    return false;
-  }
+  if (this == &other) { return true; }
+  if (null_count_ != other.null_count_) { return false; }
 
   if (null_count_ > 0) {
-    bool equal_bitmap = null_bitmap_->Equals(*other.null_bitmap_,
-        util::ceil_byte(length_) / 8);
-    if (!equal_bitmap) {
-      return false;
-    }
+    bool equal_bitmap =
+        null_bitmap_->Equals(*other.null_bitmap_, util::ceil_byte(length_) / 8);
+    if (!equal_bitmap) { return false; }
 
     const uint8_t* this_data = raw_data_;
     const uint8_t* other_data = other.raw_data_;
@@ -56,9 +51,7 @@ bool PrimitiveArray::EqualsExact(const PrimitiveArray& other) const {
     DCHECK_GT(value_size, 0);
 
     for (int i = 0; i < length_; ++i) {
-      if (!IsNull(i) && memcmp(this_data, other_data, value_size)) {
-        return false;
-      }
+      if (!IsNull(i) && memcmp(this_data, other_data, value_size)) { return false; }
       this_data += value_size;
       other_data += value_size;
     }
@@ -69,10 +62,8 @@ bool PrimitiveArray::EqualsExact(const PrimitiveArray& other) const {
 }
 
 bool PrimitiveArray::Equals(const std::shared_ptr<Array>& arr) const {
-  if (this == arr.get()) return true;
-  if (this->type_enum() != arr->type_enum()) {
-    return false;
-  }
+  if (this == arr.get()) { return true; }
+  if (this->type_enum() != arr->type_enum()) { return false; }
   return EqualsExact(*static_cast<const PrimitiveArray*>(arr.get()));
 }
 
@@ -92,9 +83,7 @@ Status PrimitiveBuilder<T>::Init(int32_t capacity) {
 template <typename T>
 Status PrimitiveBuilder<T>::Resize(int32_t capacity) {
   // XXX: Set floor size for now
-  if (capacity < MIN_BUILDER_CAPACITY) {
-    capacity = MIN_BUILDER_CAPACITY;
-  }
+  if (capacity < MIN_BUILDER_CAPACITY) { capacity = MIN_BUILDER_CAPACITY; }
 
   if (capacity_ == 0) {
     RETURN_NOT_OK(Init(capacity));
@@ -122,8 +111,8 @@ Status PrimitiveBuilder<T>::Reserve(int32_t elements) {
 }
 
 template <typename T>
-Status PrimitiveBuilder<T>::Append(const value_type* values, int32_t length,
-    const uint8_t* valid_bytes) {
+Status PrimitiveBuilder<T>::Append(
+    const value_type* values, int32_t length, const uint8_t* valid_bytes) {
   RETURN_NOT_OK(PrimitiveBuilder<T>::Reserve(length));
 
   if (length > 0) {
@@ -156,9 +145,8 @@ void PrimitiveBuilder<T>::AppendNulls(const uint8_t* valid_bytes, int32_t length
 
 template <typename T>
 std::shared_ptr<Array> PrimitiveBuilder<T>::Finish() {
-  std::shared_ptr<Array> result = std::make_shared<
-    typename type_traits<T>::ArrayType>(
-        type_, length_, data_, null_count_, null_bitmap_);
+  std::shared_ptr<Array> result = std::make_shared<typename type_traits<T>::ArrayType>(
+      type_, length_, data_, null_count_, null_bitmap_);
 
   data_ = null_bitmap_ = nullptr;
   capacity_ = length_ = null_count_ = 0;
@@ -166,8 +154,8 @@ std::shared_ptr<Array> PrimitiveBuilder<T>::Finish() {
 }
 
 template <>
-Status PrimitiveBuilder<BooleanType>::Append(const uint8_t* values, int32_t length,
-    const uint8_t* valid_bytes) {
+Status PrimitiveBuilder<BooleanType>::Append(
+    const uint8_t* values, int32_t length, const uint8_t* valid_bytes) {
   RETURN_NOT_OK(Reserve(length));
 
   for (int i = 0; i < length; ++i) {
@@ -202,23 +190,18 @@ template class PrimitiveBuilder<DoubleType>;
 template class PrimitiveBuilder<BooleanType>;
 
 BooleanArray::BooleanArray(int32_t length, const std::shared_ptr<Buffer>& data,
-    int32_t null_count,
-    const std::shared_ptr<Buffer>& null_bitmap) :
-    PrimitiveArray(std::make_shared<BooleanType>(), length,
-        data, null_count, null_bitmap) {}
+    int32_t null_count, const std::shared_ptr<Buffer>& null_bitmap)
+    : PrimitiveArray(
+          std::make_shared<BooleanType>(), length, data, null_count, null_bitmap) {}
 
 bool BooleanArray::EqualsExact(const BooleanArray& other) const {
   if (this == &other) return true;
-  if (null_count_ != other.null_count_) {
-    return false;
-  }
+  if (null_count_ != other.null_count_) { return false; }
 
   if (null_count_ > 0) {
-    bool equal_bitmap = null_bitmap_->Equals(*other.null_bitmap_,
-        util::bytes_for_bits(length_));
-    if (!equal_bitmap) {
-      return false;
-    }
+    bool equal_bitmap =
+        null_bitmap_->Equals(*other.null_bitmap_, util::bytes_for_bits(length_));
+    if (!equal_bitmap) { return false; }
 
     const uint8_t* this_data = raw_data_;
     const uint8_t* other_data = other.raw_data_;
@@ -236,10 +219,8 @@ bool BooleanArray::EqualsExact(const BooleanArray& other) const {
 
 bool BooleanArray::Equals(const std::shared_ptr<Array>& arr) const {
   if (this == arr.get()) return true;
-  if (Type::BOOL != arr->type_enum()) {
-    return false;
-  }
+  if (Type::BOOL != arr->type_enum()) { return false; }
   return EqualsExact(*static_cast<const BooleanArray*>(arr.get()));
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/primitive.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h
index ec6fee3..fcd3db4 100644
--- a/cpp/src/arrow/types/primitive.h
+++ b/cpp/src/arrow/types/primitive.h
@@ -34,17 +34,14 @@ namespace arrow {
 
 class MemoryPool;
 
-
 // Base class for fixed-size logical types
 class PrimitiveArray : public Array {
  public:
-  PrimitiveArray(const TypePtr& type, int32_t length,
-      const std::shared_ptr<Buffer>& data,
-      int32_t null_count = 0,
-      const std::shared_ptr<Buffer>& null_bitmap = nullptr);
+  PrimitiveArray(const TypePtr& type, int32_t length, const std::shared_ptr<Buffer>& data,
+      int32_t null_count = 0, const std::shared_ptr<Buffer>& null_bitmap = nullptr);
   virtual ~PrimitiveArray() {}
 
-  const std::shared_ptr<Buffer>& data() const { return data_;}
+  const std::shared_ptr<Buffer>& data() const { return data_; }
 
   bool EqualsExact(const PrimitiveArray& other) const;
   bool Equals(const std::shared_ptr<Array>& arr) const override;
@@ -54,31 +51,25 @@ class PrimitiveArray : public Array {
   const uint8_t* raw_data_;
 };
 
-#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T)                  \
-class NAME : public PrimitiveArray {                            \
- public:                                                        \
-  using value_type = T;                                         \
-  using PrimitiveArray::PrimitiveArray;                         \
-                                                                \
-  NAME(int32_t length, const std::shared_ptr<Buffer>& data,     \
-      int32_t null_count = 0,                                   \
-      const std::shared_ptr<Buffer>& null_bitmap = nullptr) :   \
-      PrimitiveArray(std::make_shared<TypeClass>(), length,     \
-          data, null_count, null_bitmap) {}                     \
-                                                                \
-  bool EqualsExact(const NAME& other) const {                   \
-    return PrimitiveArray::EqualsExact(                         \
-        *static_cast<const PrimitiveArray*>(&other));           \
-  }                                                             \
-                                                                \
-  const T* raw_data() const {                                   \
-    return reinterpret_cast<const T*>(raw_data_);               \
-  }                                                             \
-                                                                \
-  T Value(int i) const {                                        \
-    return raw_data()[i];                                       \
-  }                                                             \
-};
+#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T)                                         \
+  class NAME : public PrimitiveArray {                                                 \
+   public:                                                                             \
+    using value_type = T;                                                              \
+    using PrimitiveArray::PrimitiveArray;                                              \
+                                                                                       \
+    NAME(int32_t length, const std::shared_ptr<Buffer>& data, int32_t null_count = 0,  \
+        const std::shared_ptr<Buffer>& null_bitmap = nullptr)                          \
+        : PrimitiveArray(                                                              \
+              std::make_shared<TypeClass>(), length, data, null_count, null_bitmap) {} \
+                                                                                       \
+    bool EqualsExact(const NAME& other) const {                                        \
+      return PrimitiveArray::EqualsExact(*static_cast<const PrimitiveArray*>(&other)); \
+    }                                                                                  \
+                                                                                       \
+    const T* raw_data() const { return reinterpret_cast<const T*>(raw_data_); }        \
+                                                                                       \
+    T Value(int i) const { return raw_data()[i]; }                                     \
+  };
 
 NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type, uint8_t);
 NUMERIC_ARRAY_DECL(Int8Array, Int8Type, int8_t);
@@ -96,9 +87,8 @@ class PrimitiveBuilder : public ArrayBuilder {
  public:
   typedef typename Type::c_type value_type;
 
-  explicit PrimitiveBuilder(MemoryPool* pool, const TypePtr& type) :
-      ArrayBuilder(pool, type),
-      data_(nullptr) {}
+  explicit PrimitiveBuilder(MemoryPool* pool, const TypePtr& type)
+      : ArrayBuilder(pool, type), data_(nullptr) {}
 
   virtual ~PrimitiveBuilder() {}
 
@@ -117,16 +107,14 @@ class PrimitiveBuilder : public ArrayBuilder {
     return Status::OK();
   }
 
-  std::shared_ptr<Buffer> data() const {
-    return data_;
-  }
+  std::shared_ptr<Buffer> data() const { return data_; }
 
   // Vector append
   //
   // If passed, valid_bytes is of equal length to values, and any zero byte
   // will be considered as a null for that slot
-  Status Append(const value_type* values, int32_t length,
-      const uint8_t* valid_bytes = nullptr);
+  Status Append(
+      const value_type* values, int32_t length, const uint8_t* valid_bytes = nullptr);
 
   // Ensure that builder can accommodate an additional number of
   // elements. Resizes if the current capacity is not sufficient
@@ -172,89 +160,69 @@ template <>
 struct type_traits<UInt8Type> {
   typedef UInt8Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements;
-  }
+  static inline int bytes_required(int elements) { return elements; }
 };
 
 template <>
 struct type_traits<Int8Type> {
   typedef Int8Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements;
-  }
+  static inline int bytes_required(int elements) { return elements; }
 };
 
 template <>
 struct type_traits<UInt16Type> {
   typedef UInt16Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(uint16_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(uint16_t); }
 };
 
 template <>
 struct type_traits<Int16Type> {
   typedef Int16Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(int16_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(int16_t); }
 };
 
 template <>
 struct type_traits<UInt32Type> {
   typedef UInt32Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(uint32_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(uint32_t); }
 };
 
 template <>
 struct type_traits<Int32Type> {
   typedef Int32Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(int32_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(int32_t); }
 };
 
 template <>
 struct type_traits<UInt64Type> {
   typedef UInt64Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(uint64_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(uint64_t); }
 };
 
 template <>
 struct type_traits<Int64Type> {
   typedef Int64Array ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(int64_t);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(int64_t); }
 };
 template <>
 struct type_traits<FloatType> {
   typedef FloatArray ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(float);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(float); }
 };
 
 template <>
 struct type_traits<DoubleType> {
   typedef DoubleArray ArrayType;
 
-  static inline int bytes_required(int elements) {
-    return elements * sizeof(double);
-  }
+  static inline int bytes_required(int elements) { return elements * sizeof(double); }
 };
 
 // Builders
@@ -272,25 +240,19 @@ typedef NumericBuilder<Int64Type> Int64Builder;
 typedef NumericBuilder<FloatType> FloatBuilder;
 typedef NumericBuilder<DoubleType> DoubleBuilder;
 
-
 class BooleanArray : public PrimitiveArray {
  public:
   using PrimitiveArray::PrimitiveArray;
 
   BooleanArray(int32_t length, const std::shared_ptr<Buffer>& data,
-      int32_t null_count = 0,
-      const std::shared_ptr<Buffer>& null_bitmap = nullptr);
+      int32_t null_count = 0, const std::shared_ptr<Buffer>& null_bitmap = nullptr);
 
   bool EqualsExact(const BooleanArray& other) const;
   bool Equals(const std::shared_ptr<Array>& arr) const override;
 
-  const uint8_t* raw_data() const {
-    return reinterpret_cast<const uint8_t*>(raw_data_);
-  }
+  const uint8_t* raw_data() const { return reinterpret_cast<const uint8_t*>(raw_data_); }
 
-  bool Value(int i) const {
-    return util::get_bit(raw_data(), i);
-  }
+  bool Value(int i) const { return util::get_bit(raw_data(), i); }
 };
 
 template <>
@@ -304,8 +266,8 @@ struct type_traits<BooleanType> {
 
 class BooleanBuilder : public PrimitiveBuilder<BooleanType> {
  public:
-  explicit BooleanBuilder(MemoryPool* pool, const TypePtr& type) :
-      PrimitiveBuilder<BooleanType>(pool, type) {}
+  explicit BooleanBuilder(MemoryPool* pool, const TypePtr& type)
+      : PrimitiveBuilder<BooleanType>(pool, type) {}
 
   virtual ~BooleanBuilder() {}
 
@@ -322,11 +284,9 @@ class BooleanBuilder : public PrimitiveBuilder<BooleanType> {
     ++length_;
   }
 
-  void Append(uint8_t val) {
-    Append(static_cast<bool>(val));
-  }
+  void Append(uint8_t val) { Append(static_cast<bool>(val)); }
 };
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_TYPES_PRIMITIVE_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/string-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/string-test.cc b/cpp/src/arrow/types/string-test.cc
index d3a4cc3..ee4307c 100644
--- a/cpp/src/arrow/types/string-test.cc
+++ b/cpp/src/arrow/types/string-test.cc
@@ -48,7 +48,6 @@ TEST(TypesTest, TestCharType) {
   ASSERT_EQ(t2.size, 5);
 }
 
-
 TEST(TypesTest, TestVarcharType) {
   VarcharType t1(5);
 
@@ -72,7 +71,7 @@ TEST(TypesTest, TestStringType) {
 // ----------------------------------------------------------------------
 // String container
 
-class TestStringContainer : public ::testing::Test  {
+class TestStringContainer : public ::testing::Test {
  public:
   void SetUp() {
     chars_ = {'a', 'b', 'b', 'c', 'c', 'c'};
@@ -95,8 +94,8 @@ class TestStringContainer : public ::testing::Test  {
     null_bitmap_ = test::bytes_to_null_buffer(valid_bytes_);
     null_count_ = test::null_count(valid_bytes_);
 
-    strings_ = std::make_shared<StringArray>(length_, offsets_buf_, values_,
-        null_count_, null_bitmap_);
+    strings_ = std::make_shared<StringArray>(
+        length_, offsets_buf_, values_, null_count_, null_bitmap_);
   }
 
  protected:
@@ -117,7 +116,6 @@ class TestStringContainer : public ::testing::Test  {
   std::shared_ptr<StringArray> strings_;
 };
 
-
 TEST_F(TestStringContainer, TestArrayBasics) {
   ASSERT_EQ(length_, strings_->length());
   ASSERT_EQ(1, strings_->null_count());
@@ -130,7 +128,6 @@ TEST_F(TestStringContainer, TestType) {
   ASSERT_EQ(Type::STRING, strings_->type_enum());
 }
 
-
 TEST_F(TestStringContainer, TestListFunctions) {
   int pos = 0;
   for (size_t i = 0; i < expected_.size(); ++i) {
@@ -140,10 +137,9 @@ TEST_F(TestStringContainer, TestListFunctions) {
   }
 }
 
-
 TEST_F(TestStringContainer, TestDestructor) {
-  auto arr = std::make_shared<StringArray>(length_, offsets_buf_, values_,
-      null_count_, null_bitmap_);
+  auto arr = std::make_shared<StringArray>(
+      length_, offsets_buf_, values_, null_count_, null_bitmap_);
 }
 
 TEST_F(TestStringContainer, TestGetString) {
@@ -167,9 +163,7 @@ class TestStringBuilder : public TestBuilder {
     builder_.reset(new StringBuilder(pool_, type_));
   }
 
-  void Done() {
-    result_ = std::dynamic_pointer_cast<StringArray>(builder_->Finish());
-  }
+  void Done() { result_ = std::dynamic_pointer_cast<StringArray>(builder_->Finish()); }
 
  protected:
   TypePtr type_;
@@ -222,4 +216,4 @@ TEST_F(TestStringBuilder, TestZeroLength) {
   Done();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/string.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/string.cc b/cpp/src/arrow/types/string.cc
index 80b075c..29d97d0 100644
--- a/cpp/src/arrow/types/string.cc
+++ b/cpp/src/arrow/types/string.cc
@@ -26,11 +26,10 @@ namespace arrow {
 
 const std::shared_ptr<DataType> STRING(new StringType());
 
-StringArray::StringArray(int32_t length,
-    const std::shared_ptr<Buffer>& offsets,
+StringArray::StringArray(int32_t length, const std::shared_ptr<Buffer>& offsets,
     const ArrayPtr& values, int32_t null_count,
-    const std::shared_ptr<Buffer>& null_bitmap) :
-    StringArray(STRING, length, offsets, values, null_count, null_bitmap) {}
+    const std::shared_ptr<Buffer>& null_bitmap)
+    : StringArray(STRING, length, offsets, values, null_count, null_bitmap) {}
 
 std::string CharType::ToString() const {
   std::stringstream s;
@@ -38,7 +37,6 @@ std::string CharType::ToString() const {
   return s.str();
 }
 
-
 std::string VarcharType::ToString() const {
   std::stringstream s;
   s << "varchar(" << size << ")";
@@ -47,4 +45,4 @@ std::string VarcharType::ToString() const {
 
 TypePtr StringBuilder::value_type_ = TypePtr(new UInt8Type());
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/string.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/string.h b/cpp/src/arrow/types/string.h
index 84cd032..c5cbe10 100644
--- a/cpp/src/arrow/types/string.h
+++ b/cpp/src/arrow/types/string.h
@@ -37,48 +37,37 @@ class MemoryPool;
 struct CharType : public DataType {
   int size;
 
-  explicit CharType(int size)
-      : DataType(Type::CHAR),
-        size(size) {}
+  explicit CharType(int size) : DataType(Type::CHAR), size(size) {}
 
-  CharType(const CharType& other)
-      : CharType(other.size) {}
+  CharType(const CharType& other) : CharType(other.size) {}
 
   virtual std::string ToString() const;
 };
 
-
 // Variable-length, null-terminated strings, up to a certain length
 struct VarcharType : public DataType {
   int size;
 
-  explicit VarcharType(int size)
-      : DataType(Type::VARCHAR),
-        size(size) {}
-  VarcharType(const VarcharType& other)
-      : VarcharType(other.size) {}
+  explicit VarcharType(int size) : DataType(Type::VARCHAR), size(size) {}
+  VarcharType(const VarcharType& other) : VarcharType(other.size) {}
 
   virtual std::string ToString() const;
 };
 
-// TODO: add a BinaryArray layer in between
+// TODO(wesm): add a BinaryArray layer in between
 class StringArray : public ListArray {
  public:
-  StringArray(const TypePtr& type, int32_t length,
-      const std::shared_ptr<Buffer>& offsets,
-      const ArrayPtr& values,
-      int32_t null_count = 0,
-      const std::shared_ptr<Buffer>& null_bitmap = nullptr) :
-      ListArray(type, length, offsets, values, null_count, null_bitmap) {
+  StringArray(const TypePtr& type, int32_t length, const std::shared_ptr<Buffer>& offsets,
+      const ArrayPtr& values, int32_t null_count = 0,
+      const std::shared_ptr<Buffer>& null_bitmap = nullptr)
+      : ListArray(type, length, offsets, values, null_count, null_bitmap) {
     // For convenience
     bytes_ = static_cast<UInt8Array*>(values.get());
     raw_bytes_ = bytes_->raw_data();
   }
 
-  StringArray(int32_t length,
-      const std::shared_ptr<Buffer>& offsets,
-      const ArrayPtr& values,
-      int32_t null_count = 0,
+  StringArray(int32_t length, const std::shared_ptr<Buffer>& offsets,
+      const ArrayPtr& values, int32_t null_count = 0,
       const std::shared_ptr<Buffer>& null_bitmap = nullptr);
 
   // Compute the pointer t
@@ -103,21 +92,18 @@ class StringArray : public ListArray {
 // Array builder
 class StringBuilder : public ListBuilder {
  public:
-  explicit StringBuilder(MemoryPool* pool, const TypePtr& type) :
-      ListBuilder(pool, type, std::make_shared<UInt8Builder>(pool, value_type_)) {
+  explicit StringBuilder(MemoryPool* pool, const TypePtr& type)
+      : ListBuilder(pool, type, std::make_shared<UInt8Builder>(pool, value_type_)) {
     byte_builder_ = static_cast<UInt8Builder*>(value_builder_.get());
   }
 
-  Status Append(const std::string& value) {
-    return Append(value.c_str(), value.size());
-  }
+  Status Append(const std::string& value) { return Append(value.c_str(), value.size()); }
 
   Status Append(const char* value, int32_t length) {
     RETURN_NOT_OK(ListBuilder::Append());
     return byte_builder_->Append(reinterpret_cast<const uint8_t*>(value), length);
   }
-  Status Append(const std::vector<std::string>& values,
-                uint8_t* null_bytes);
+  Status Append(const std::vector<std::string>& values, uint8_t* null_bytes);
 
   std::shared_ptr<Array> Finish() override {
     return ListBuilder::Transfer<StringArray>();
@@ -130,6 +116,6 @@ class StringBuilder : public ListBuilder {
   static TypePtr value_type_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_STRING_H
+#endif  // ARROW_TYPES_STRING_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/struct-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/struct-test.cc b/cpp/src/arrow/types/struct-test.cc
index d94396f..79d560e 100644
--- a/cpp/src/arrow/types/struct-test.cc
+++ b/cpp/src/arrow/types/struct-test.cc
@@ -49,7 +49,7 @@ TEST(TestStructType, Basics) {
 
   ASSERT_EQ(struct_type.ToString(), "struct<f0: int32, f1: string, f2: uint8>");
 
-  // TODO: out of bounds for field(...)
+  // TODO(wesm): out of bounds for field(...)
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/struct.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/struct.cc b/cpp/src/arrow/types/struct.cc
index 02af600..04a277a 100644
--- a/cpp/src/arrow/types/struct.cc
+++ b/cpp/src/arrow/types/struct.cc
@@ -17,6 +17,4 @@
 
 #include "arrow/types/struct.h"
 
-namespace arrow {
-
-} // namespace arrow
+namespace arrow {}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/struct.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/struct.h b/cpp/src/arrow/types/struct.h
index 5842534..17e3299 100644
--- a/cpp/src/arrow/types/struct.h
+++ b/cpp/src/arrow/types/struct.h
@@ -24,8 +24,6 @@
 
 #include "arrow/type.h"
 
-namespace arrow {
+namespace arrow {}  // namespace arrow
 
-} // namespace arrow
-
-#endif // ARROW_TYPES_STRUCT_H
+#endif  // ARROW_TYPES_STRUCT_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/test-common.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/test-common.h b/cpp/src/arrow/types/test-common.h
index 227aca6..1957636 100644
--- a/cpp/src/arrow/types/test-common.h
+++ b/cpp/src/arrow/types/test-common.h
@@ -28,10 +28,10 @@
 #include "arrow/type.h"
 #include "arrow/util/memory-pool.h"
 
-using std::unique_ptr;
-
 namespace arrow {
 
+using std::unique_ptr;
+
 class TestBuilder : public ::testing::Test {
  public:
   void SetUp() {
@@ -40,6 +40,7 @@ class TestBuilder : public ::testing::Test {
     builder_.reset(new UInt8Builder(pool_, type_));
     builder_nn_.reset(new UInt8Builder(pool_, type_));
   }
+
  protected:
   MemoryPool* pool_;
 
@@ -48,6 +49,6 @@ class TestBuilder : public ::testing::Test {
   unique_ptr<ArrayBuilder> builder_nn_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_TEST_COMMON_H
+#endif  // ARROW_TYPES_TEST_COMMON_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/union.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/union.cc b/cpp/src/arrow/types/union.cc
index db3f817..c891b4a 100644
--- a/cpp/src/arrow/types/union.cc
+++ b/cpp/src/arrow/types/union.cc
@@ -30,7 +30,7 @@ static inline std::string format_union(const std::vector<TypePtr>& child_types)
   std::stringstream s;
   s << "union<";
   for (size_t i = 0; i < child_types.size(); ++i) {
-    if (i) s << ", ";
+    if (i) { s << ", "; }
     s << child_types[i]->ToString();
   }
   s << ">";
@@ -41,10 +41,8 @@ std::string DenseUnionType::ToString() const {
   return format_union(child_types_);
 }
 
-
 std::string SparseUnionType::ToString() const {
   return format_union(child_types_);
 }
 
-
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/types/union.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/types/union.h b/cpp/src/arrow/types/union.h
index 29cda90..d2ee9bd 100644
--- a/cpp/src/arrow/types/union.h
+++ b/cpp/src/arrow/types/union.h
@@ -33,27 +33,23 @@ class Buffer;
 struct DenseUnionType : public CollectionType<Type::DENSE_UNION> {
   typedef CollectionType<Type::DENSE_UNION> Base;
 
-  explicit DenseUnionType(const std::vector<TypePtr>& child_types) :
-      Base() {
+  explicit DenseUnionType(const std::vector<TypePtr>& child_types) : Base() {
     child_types_ = child_types;
   }
 
   virtual std::string ToString() const;
 };
 
-
 struct SparseUnionType : public CollectionType<Type::SPARSE_UNION> {
   typedef CollectionType<Type::SPARSE_UNION> Base;
 
-  explicit SparseUnionType(const std::vector<TypePtr>& child_types) :
-      Base() {
+  explicit SparseUnionType(const std::vector<TypePtr>& child_types) : Base() {
     child_types_ = child_types;
   }
 
   virtual std::string ToString() const;
 };
 
-
 class UnionArray : public Array {
  protected:
   // The data are types encoded as int16
@@ -61,16 +57,13 @@ class UnionArray : public Array {
   std::vector<std::shared_ptr<Array>> children_;
 };
 
-
 class DenseUnionArray : public UnionArray {
  protected:
   Buffer* offset_buf_;
 };
 
+class SparseUnionArray : public UnionArray {};
 
-class SparseUnionArray : public UnionArray {
-};
-
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_TYPES_UNION_H
+#endif  // ARROW_TYPES_UNION_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/bit-util-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/bit-util-test.cc b/cpp/src/arrow/util/bit-util-test.cc
index 220bff0..26554d2 100644
--- a/cpp/src/arrow/util/bit-util-test.cc
+++ b/cpp/src/arrow/util/bit-util-test.cc
@@ -41,4 +41,4 @@ TEST(UtilTests, TestNextPower2) {
   ASSERT_EQ(1LL << 62, next_power2((1LL << 62) - 1));
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/bit-util.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/bit-util.cc b/cpp/src/arrow/util/bit-util.cc
index 6c6d533..475576e 100644
--- a/cpp/src/arrow/util/bit-util.cc
+++ b/cpp/src/arrow/util/bit-util.cc
@@ -26,14 +26,12 @@ namespace arrow {
 
 void util::bytes_to_bits(const std::vector<uint8_t>& bytes, uint8_t* bits) {
   for (size_t i = 0; i < bytes.size(); ++i) {
-    if (bytes[i] > 0) {
-      set_bit(bits, i);
-    }
+    if (bytes[i] > 0) { set_bit(bits, i); }
   }
 }
 
-Status util::bytes_to_bits(const std::vector<uint8_t>& bytes,
-    std::shared_ptr<Buffer>* out) {
+Status util::bytes_to_bits(
+    const std::vector<uint8_t>& bytes, std::shared_ptr<Buffer>* out) {
   int bit_length = util::bytes_for_bits(bytes.size());
 
   auto buffer = std::make_shared<PoolBuffer>();
@@ -45,4 +43,4 @@ Status util::bytes_to_bits(const std::vector<uint8_t>& bytes,
   return Status::OK();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/bit-util.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/bit-util.h b/cpp/src/arrow/util/bit-util.h
index 8d62871..1f0f08c 100644
--- a/cpp/src/arrow/util/bit-util.h
+++ b/cpp/src/arrow/util/bit-util.h
@@ -74,8 +74,8 @@ static inline int64_t next_power2(int64_t n) {
 void bytes_to_bits(const std::vector<uint8_t>& bytes, uint8_t* bits);
 Status bytes_to_bits(const std::vector<uint8_t>&, std::shared_ptr<Buffer>*);
 
-} // namespace util
+}  // namespace util
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_UTIL_BIT_UTIL_H
+#endif  // ARROW_UTIL_BIT_UTIL_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/buffer-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/buffer-test.cc b/cpp/src/arrow/util/buffer-test.cc
index 1d58226..dad0f74 100644
--- a/cpp/src/arrow/util/buffer-test.cc
+++ b/cpp/src/arrow/util/buffer-test.cc
@@ -29,8 +29,7 @@ using std::string;
 
 namespace arrow {
 
-class TestBuffer : public ::testing::Test {
-};
+class TestBuffer : public ::testing::Test {};
 
 TEST_F(TestBuffer, Resize) {
   PoolBuffer buf;
@@ -54,4 +53,4 @@ TEST_F(TestBuffer, ResizeOOM) {
   ASSERT_RAISES(OutOfMemory, buf.Resize(to_alloc));
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/buffer.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/buffer.cc b/cpp/src/arrow/util/buffer.cc
index 04cdcd7..bc9c22c 100644
--- a/cpp/src/arrow/util/buffer.cc
+++ b/cpp/src/arrow/util/buffer.cc
@@ -24,8 +24,7 @@
 
 namespace arrow {
 
-Buffer::Buffer(const std::shared_ptr<Buffer>& parent, int64_t offset,
-    int64_t size) {
+Buffer::Buffer(const std::shared_ptr<Buffer>& parent, int64_t offset, int64_t size) {
   data_ = parent->data() + offset;
   size_ = size;
   parent_ = parent;
@@ -37,18 +36,13 @@ std::shared_ptr<Buffer> MutableBuffer::GetImmutableView() {
   return std::make_shared<Buffer>(this->get_shared_ptr(), 0, size());
 }
 
-PoolBuffer::PoolBuffer(MemoryPool* pool) :
-    ResizableBuffer(nullptr, 0) {
-  if (pool == nullptr) {
-    pool = default_memory_pool();
-  }
+PoolBuffer::PoolBuffer(MemoryPool* pool) : ResizableBuffer(nullptr, 0) {
+  if (pool == nullptr) { pool = default_memory_pool(); }
   pool_ = pool;
 }
 
 PoolBuffer::~PoolBuffer() {
-  if (mutable_data_ != nullptr) {
-    pool_->Free(mutable_data_, capacity_);
-  }
+  if (mutable_data_ != nullptr) { pool_->Free(mutable_data_, capacity_); }
 }
 
 Status PoolBuffer::Reserve(int64_t new_capacity) {
@@ -74,4 +68,4 @@ Status PoolBuffer::Resize(int64_t new_size) {
   return Status::OK();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/buffer.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/buffer.h b/cpp/src/arrow/util/buffer.h
index c15f9b6..94e53b6 100644
--- a/cpp/src/arrow/util/buffer.h
+++ b/cpp/src/arrow/util/buffer.h
@@ -38,9 +38,7 @@ class Status;
 // class instance
 class Buffer : public std::enable_shared_from_this<Buffer> {
  public:
-  Buffer(const uint8_t* data, int64_t size) :
-      data_(data),
-      size_(size) {}
+  Buffer(const uint8_t* data, int64_t size) : data_(data), size_(size) {}
   virtual ~Buffer();
 
   // An offset into data that is owned by another buffer, but we want to be
@@ -48,40 +46,28 @@ class Buffer : public std::enable_shared_from_this<Buffer> {
   // parent buffer have been destroyed
   Buffer(const std::shared_ptr<Buffer>& parent, int64_t offset, int64_t size);
 
-  std::shared_ptr<Buffer> get_shared_ptr() {
-    return shared_from_this();
-  }
+  std::shared_ptr<Buffer> get_shared_ptr() { return shared_from_this(); }
 
   // Return true if both buffers are the same size and contain the same bytes
   // up to the number of compared bytes
   bool Equals(const Buffer& other, int64_t nbytes) const {
-    return this == &other ||
-      (size_ >= nbytes && other.size_ >= nbytes &&
-          !memcmp(data_, other.data_, nbytes));
+    return this == &other || (size_ >= nbytes && other.size_ >= nbytes &&
+                                 !memcmp(data_, other.data_, nbytes));
   }
 
   bool Equals(const Buffer& other) const {
-    return this == &other ||
-      (size_ == other.size_ && !memcmp(data_, other.data_, size_));
+    return this == &other || (size_ == other.size_ && !memcmp(data_, other.data_, size_));
   }
 
-  const uint8_t* data() const {
-    return data_;
-  }
+  const uint8_t* data() const { return data_; }
 
-  int64_t size() const {
-    return size_;
-  }
+  int64_t size() const { return size_; }
 
   // Returns true if this Buffer is referencing memory (possibly) owned by some
   // other buffer
-  bool is_shared() const {
-    return static_cast<bool>(parent_);
-  }
+  bool is_shared() const { return static_cast<bool>(parent_); }
 
-  const std::shared_ptr<Buffer> parent() const {
-    return parent_;
-  }
+  const std::shared_ptr<Buffer> parent() const { return parent_; }
 
  protected:
   const uint8_t* data_;
@@ -97,22 +83,17 @@ class Buffer : public std::enable_shared_from_this<Buffer> {
 // A Buffer whose contents can be mutated. May or may not own its data.
 class MutableBuffer : public Buffer {
  public:
-  MutableBuffer(uint8_t* data, int64_t size) :
-      Buffer(data, size) {
+  MutableBuffer(uint8_t* data, int64_t size) : Buffer(data, size) {
     mutable_data_ = data;
   }
 
-  uint8_t* mutable_data() {
-    return mutable_data_;
-  }
+  uint8_t* mutable_data() { return mutable_data_; }
 
   // Get a read-only view of this buffer
   std::shared_ptr<Buffer> GetImmutableView();
 
  protected:
-  MutableBuffer() :
-      Buffer(nullptr, 0),
-      mutable_data_(nullptr) {}
+  MutableBuffer() : Buffer(nullptr, 0), mutable_data_(nullptr) {}
 
   uint8_t* mutable_data_;
 };
@@ -128,9 +109,8 @@ class ResizableBuffer : public MutableBuffer {
   virtual Status Reserve(int64_t new_capacity) = 0;
 
  protected:
-  ResizableBuffer(uint8_t* data, int64_t size) :
-      MutableBuffer(data, size),
-      capacity_(size) {}
+  ResizableBuffer(uint8_t* data, int64_t size)
+      : MutableBuffer(data, size), capacity_(size) {}
 
   int64_t capacity_;
 };
@@ -152,16 +132,11 @@ static constexpr int64_t MIN_BUFFER_CAPACITY = 1024;
 
 class BufferBuilder {
  public:
-  explicit BufferBuilder(MemoryPool* pool) :
-      pool_(pool),
-      capacity_(0),
-      size_(0) {}
+  explicit BufferBuilder(MemoryPool* pool) : pool_(pool), capacity_(0), size_(0) {}
 
   Status Append(const uint8_t* data, int length) {
     if (capacity_ < length + size_) {
-      if (capacity_ == 0) {
-        buffer_ = std::make_shared<PoolBuffer>(pool_);
-      }
+      if (capacity_ == 0) { buffer_ = std::make_shared<PoolBuffer>(pool_); }
       capacity_ = std::max(MIN_BUFFER_CAPACITY, capacity_);
       while (capacity_ < length + size_) {
         capacity_ *= 2;
@@ -188,6 +163,6 @@ class BufferBuilder {
   int64_t size_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_UTIL_BUFFER_H
+#endif  // ARROW_UTIL_BUFFER_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/logging.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/logging.h b/cpp/src/arrow/util/logging.h
index 3ce4ccc..527ce42 100644
--- a/cpp/src/arrow/util/logging.h
+++ b/cpp/src/arrow/util/logging.h
@@ -19,6 +19,7 @@
 #define ARROW_UTIL_LOGGING_H
 
 #include <iostream>
+#include <cstdlib>
 
 namespace arrow {
 
@@ -37,19 +38,34 @@ namespace arrow {
 #define ARROW_LOG_INTERNAL(level) arrow::internal::CerrLog(level)
 #define ARROW_LOG(level) ARROW_LOG_INTERNAL(ARROW_##level)
 
-#define ARROW_CHECK(condition) \
-  (condition) ? 0 : ARROW_LOG(FATAL) << "Check failed: " #condition " "
+#define ARROW_CHECK(condition)                               \
+  (condition) ? 0 : ::arrow::internal::FatalLog(ARROW_FATAL) \
+                        << __FILE__ << __LINE__ << "Check failed: " #condition " "
 
 #ifdef NDEBUG
 #define ARROW_DFATAL ARROW_WARNING
 
-#define DCHECK(condition) while (false) arrow::internal::NullLog()
-#define DCHECK_EQ(val1, val2) while (false) arrow::internal::NullLog()
-#define DCHECK_NE(val1, val2) while (false) arrow::internal::NullLog()
-#define DCHECK_LE(val1, val2) while (false) arrow::internal::NullLog()
-#define DCHECK_LT(val1, val2) while (false) arrow::internal::NullLog()
-#define DCHECK_GE(val1, val2) while (false) arrow::internal::NullLog()
-#define DCHECK_GT(val1, val2) while (false) arrow::internal::NullLog()
+#define DCHECK(condition) \
+  while (false)           \
+  arrow::internal::NullLog()
+#define DCHECK_EQ(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
+#define DCHECK_NE(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
+#define DCHECK_LE(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
+#define DCHECK_LT(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
+#define DCHECK_GE(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
+#define DCHECK_GT(val1, val2) \
+  while (false)               \
+  arrow::internal::NullLog()
 
 #else
 #define ARROW_DFATAL ARROW_FATAL
@@ -62,13 +78,13 @@ namespace arrow {
 #define DCHECK_GE(val1, val2) ARROW_CHECK((val1) >= (val2))
 #define DCHECK_GT(val1, val2) ARROW_CHECK((val1) > (val2))
 
-#endif // NDEBUG
+#endif  // NDEBUG
 
 namespace internal {
 
 class NullLog {
  public:
-  template<class T>
+  template <class T>
   NullLog& operator<<(const T& t) {
     return *this;
   }
@@ -76,34 +92,42 @@ class NullLog {
 
 class CerrLog {
  public:
-  CerrLog(int severity) // NOLINT(runtime/explicit)
-    : severity_(severity),
-      has_logged_(false) {
-  }
+  CerrLog(int severity)  // NOLINT(runtime/explicit)
+      : severity_(severity),
+        has_logged_(false) {}
 
-  ~CerrLog() {
-    if (has_logged_) {
-      std::cerr << std::endl;
-    }
-    if (severity_ == ARROW_FATAL) {
-      exit(1);
-    }
+  virtual ~CerrLog() {
+    if (has_logged_) { std::cerr << std::endl; }
+    if (severity_ == ARROW_FATAL) { std::exit(1); }
   }
 
-  template<class T>
+  template <class T>
   CerrLog& operator<<(const T& t) {
     has_logged_ = true;
     std::cerr << t;
     return *this;
   }
 
- private:
+ protected:
   const int severity_;
   bool has_logged_;
 };
 
-} // namespace internal
+// Clang-tidy isn't smart enough to determine that DCHECK using CerrLog doesn't
+// return so we create a new class to give it a hint.
+class FatalLog : public CerrLog {
+ public:
+  FatalLog(int /* severity */)  // NOLINT
+      : CerrLog(ARROW_FATAL) {}
+
+  [[noreturn]] ~FatalLog() {
+    if (has_logged_) { std::cerr << std::endl; }
+    std::exit(1);
+  }
+};
+
+}  // namespace internal
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_UTIL_LOGGING_H
+#endif  // ARROW_UTIL_LOGGING_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/macros.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/macros.h b/cpp/src/arrow/util/macros.h
index 069e627..51e605e 100644
--- a/cpp/src/arrow/util/macros.h
+++ b/cpp/src/arrow/util/macros.h
@@ -19,8 +19,8 @@
 #define ARROW_UTIL_MACROS_H
 
 // From Google gutil
-#define DISALLOW_COPY_AND_ASSIGN(TypeName)      \
-  TypeName(const TypeName&) = delete;           \
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+  TypeName(const TypeName&) = delete;      \
   void operator=(const TypeName&) = delete
 
-#endif // ARROW_UTIL_MACROS_H
+#endif  // ARROW_UTIL_MACROS_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/memory-pool-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/memory-pool-test.cc b/cpp/src/arrow/util/memory-pool-test.cc
index 6ef07a0..e4600a9 100644
--- a/cpp/src/arrow/util/memory-pool-test.cc
+++ b/cpp/src/arrow/util/memory-pool-test.cc
@@ -45,4 +45,4 @@ TEST(DefaultMemoryPool, OOM) {
   ASSERT_RAISES(OutOfMemory, pool->Allocate(to_alloc, &data));
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/memory-pool.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/memory-pool.cc b/cpp/src/arrow/util/memory-pool.cc
index 0b885e9..fb417e7 100644
--- a/cpp/src/arrow/util/memory-pool.cc
+++ b/cpp/src/arrow/util/memory-pool.cc
@@ -75,4 +75,4 @@ MemoryPool* default_memory_pool() {
   return &default_memory_pool_;
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/memory-pool.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/memory-pool.h b/cpp/src/arrow/util/memory-pool.h
index 0d24786..824c724 100644
--- a/cpp/src/arrow/util/memory-pool.h
+++ b/cpp/src/arrow/util/memory-pool.h
@@ -36,6 +36,6 @@ class MemoryPool {
 
 MemoryPool* default_memory_pool();
 
-} // namespace arrow
+}  // namespace arrow
 
-#endif // ARROW_UTIL_MEMORY_POOL_H
+#endif  // ARROW_UTIL_MEMORY_POOL_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/random.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/random.h b/cpp/src/arrow/util/random.h
index 64c197e..31f2b06 100644
--- a/cpp/src/arrow/util/random.h
+++ b/cpp/src/arrow/util/random.h
@@ -15,10 +15,10 @@ namespace arrow {
 
 namespace random_internal {
 
-static const uint32_t M = 2147483647L;   // 2^31-1
+static const uint32_t M = 2147483647L;  // 2^31-1
 const double kTwoPi = 6.283185307179586476925286;
 
-} // namespace random_internal
+}  // namespace random_internal
 
 // A very simple random number generator.  Not especially good at
 // generating truly random bits, but good enough for our needs in this
@@ -27,9 +27,7 @@ class Random {
  public:
   explicit Random(uint32_t s) : seed_(s & 0x7fffffffu) {
     // Avoid bad seeds.
-    if (seed_ == 0 || seed_ == random_internal::M) {
-      seed_ = 1;
-    }
+    if (seed_ == 0 || seed_ == random_internal::M) { seed_ = 1; }
   }
 
   // Next pseudo-random 32-bit unsigned integer.
@@ -50,9 +48,7 @@ class Random {
     // The first reduction may overflow by 1 bit, so we may need to
     // repeat.  mod == M is not possible; using > allows the faster
     // sign-bit-based test.
-    if (seed_ > random_internal::M) {
-      seed_ -= random_internal::M;
-    }
+    if (seed_ > random_internal::M) { seed_ -= random_internal::M; }
     return seed_;
   }
 
@@ -91,9 +87,7 @@ class Random {
   // Skewed: pick "base" uniformly from range [0,max_log] and then
   // return "base" random bits.  The effect is to pick a number in the
   // range [0,2^max_log-1] with exponential bias towards smaller numbers.
-  uint32_t Skewed(int max_log) {
-    return Uniform(1 << Uniform(max_log + 1));
-  }
+  uint32_t Skewed(int max_log) { return Uniform(1 << Uniform(max_log + 1)); }
 
   // Creates a normal distribution variable using the
   // Box-Muller transform. See:
@@ -103,8 +97,9 @@ class Random {
   double Normal(double mean, double std_dev) {
     double uniform1 = (Next() + 1.0) / (random_internal::M + 1.0);
     double uniform2 = (Next() + 1.0) / (random_internal::M + 1.0);
-    return (mean + std_dev * sqrt(-2 * ::log(uniform1)) *
-        cos(random_internal::kTwoPi * uniform2));
+    return (
+        mean +
+        std_dev * sqrt(-2 * ::log(uniform1)) * cos(random_internal::kTwoPi * uniform2));
   }
 
   // Return a random number between 0.0 and 1.0 inclusive.
@@ -116,13 +111,11 @@ class Random {
   uint32_t seed_;
 };
 
-
 uint32_t random_seed() {
-  // TODO: use system time to get a reasonably random seed
+  // TODO(wesm): use system time to get a reasonably random seed
   return 0;
 }
 
-
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_UTIL_RANDOM_H_

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/status.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/status.cc b/cpp/src/arrow/util/status.cc
index 43cb87e..d194ed5 100644
--- a/cpp/src/arrow/util/status.cc
+++ b/cpp/src/arrow/util/status.cc
@@ -36,9 +36,7 @@ const char* Status::CopyState(const char* state) {
 }
 
 std::string Status::CodeAsString() const {
-  if (state_ == NULL) {
-    return "OK";
-  }
+  if (state_ == NULL) { return "OK"; }
 
   const char* type;
   switch (code()) {
@@ -66,9 +64,7 @@ std::string Status::CodeAsString() const {
 
 std::string Status::ToString() const {
   std::string result(CodeAsString());
-  if (state_ == NULL) {
-    return result;
-  }
+  if (state_ == NULL) { return result; }
 
   result.append(": ");
 
@@ -78,4 +74,4 @@ std::string Status::ToString() const {
   return result;
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/util/status.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/status.h b/cpp/src/arrow/util/status.h
index 4e273ed..6ddc177 100644
--- a/cpp/src/arrow/util/status.h
+++ b/cpp/src/arrow/util/status.h
@@ -20,32 +20,36 @@
 #include <string>
 
 // Return the given status if it is not OK.
-#define ARROW_RETURN_NOT_OK(s) do {           \
-    ::arrow::Status _s = (s);                 \
-    if (!_s.ok()) return _s;                    \
+#define ARROW_RETURN_NOT_OK(s)   \
+  do {                           \
+    ::arrow::Status _s = (s);    \
+    if (!_s.ok()) { return _s; } \
   } while (0);
 
 // Return the given status if it is not OK, but first clone it and
 // prepend the given message.
-#define ARROW_RETURN_NOT_OK_PREPEND(s, msg) do {                      \
-    ::arrow::Status _s = (s);                                         \
+#define ARROW_RETURN_NOT_OK_PREPEND(s, msg)                               \
+  do {                                                                    \
+    ::arrow::Status _s = (s);                                             \
     if (::gutil::PREDICT_FALSE(!_s.ok())) return _s.CloneAndPrepend(msg); \
   } while (0);
 
 // Return 'to_return' if 'to_call' returns a bad status.
 // The substitution for 'to_return' may reference the variable
 // 's' for the bad status.
-#define ARROW_RETURN_NOT_OK_RET(to_call, to_return) do { \
-    ::arrow::Status s = (to_call); \
-    if (::gutil::PREDICT_FALSE(!s.ok())) return (to_return);    \
+#define ARROW_RETURN_NOT_OK_RET(to_call, to_return)          \
+  do {                                                       \
+    ::arrow::Status s = (to_call);                           \
+    if (::gutil::PREDICT_FALSE(!s.ok())) return (to_return); \
   } while (0);
 
 // If 'to_call' returns a bad status, CHECK immediately with a logged message
 // of 'msg' followed by the status.
-#define ARROW_CHECK_OK_PREPEND(to_call, msg) do {         \
-::arrow::Status _s = (to_call);                           \
-ARROW_CHECK(_s.ok()) << (msg) << ": " << _s.ToString();   \
-} while (0);
+#define ARROW_CHECK_OK_PREPEND(to_call, msg)                \
+  do {                                                      \
+    ::arrow::Status _s = (to_call);                         \
+    ARROW_CHECK(_s.ok()) << (msg) << ": " << _s.ToString(); \
+  } while (0);
 
 // If the status is bad, CHECK immediately, appending the status to the
 // logged message.
@@ -53,12 +57,13 @@ ARROW_CHECK(_s.ok()) << (msg) << ": " << _s.ToString();   \
 
 namespace arrow {
 
-#define RETURN_NOT_OK(s) do {                   \
-    Status _s = (s);                            \
-    if (!_s.ok()) return _s;                    \
+#define RETURN_NOT_OK(s)         \
+  do {                           \
+    Status _s = (s);             \
+    if (!_s.ok()) { return _s; } \
   } while (0);
 
-enum class StatusCode: char {
+enum class StatusCode : char {
   OK = 0,
   OutOfMemory = 1,
   KeyError = 2,
@@ -71,7 +76,7 @@ enum class StatusCode: char {
 class Status {
  public:
   // Create a success status.
-  Status() : state_(NULL) { }
+  Status() : state_(NULL) {}
   ~Status() { delete[] state_; }
 
   // Copy the specified status.
@@ -132,8 +137,7 @@ class Status {
   const char* state_;
 
   StatusCode code() const {
-    return ((state_ == NULL) ?
-        StatusCode::OK : static_cast<StatusCode>(state_[4]));
+    return ((state_ == NULL) ? StatusCode::OK : static_cast<StatusCode>(state_[4]));
   }
 
   Status(StatusCode code, const std::string& msg, int16_t posix_code);
@@ -155,5 +159,4 @@ inline void Status::operator=(const Status& s) {
 
 }  // namespace arrow
 
-
-#endif // ARROW_STATUS_H_
+#endif  // ARROW_STATUS_H_