arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [3/3] arrow git commit: ARROW-71: [C++] Add clang-tidy and clang-format to the the tool chain.
Date Sat, 02 Apr 2016 04:40:32 GMT
ARROW-71: [C++] Add clang-tidy and clang-format to the the tool chain.

I changed the ubuntu flavor for building to precise because https://github.com/travis-ci/apt-source-whitelist/issues/199 is currently blocking using trusty.

I also expect there might be a couple of iterations on settings for clang-format and clang-tidy (or if we even want them as standard parts of the toolchain).  @wesm I noticed the lint target explicitly turns off some checks, I don't know if these were copy and pasted or you really don't like them.  If the latter I can do a first pass of turning the same ones off for clang-tidy.

In terms of reviewing: It is likely useful, to look at the PR commit by commit, since the last two commits are 99% driven by the first commit.   The main chunk of code that wasn't machine fixed is FatalLog in logging.

The good news is clang-tidy caught one potential corner case segfault when a column happened to be null :)

Author: Micah Kornfield <emkornfield@gmail.com>

Closes #55 from emkornfield/emk_add_clang_tidy_PR and squashes the following commits:

2fafb10 [Micah Kornfield] adjust line length from 88 to 90, turn on bin packing of parameters. increase penality for before first call parameter
169352f [Micah Kornfield] add llvm tool chain as travis source
e7723d1 [Micah Kornfield] upgrade to precise to verify if build works.  address self comments
d3f76d8 [Micah Kornfield] clang format change
9c556ef [Micah Kornfield] cleanup from clang-tidy
26945e9 [Micah Kornfield] add more failure checks for build_thirdparty
4dd0b81 [Micah Kornfield] Add clang-format and clang-tidy targets to toolchain


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/5d129991
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/5d129991
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/5d129991

Branch: refs/heads/master
Commit: 5d129991b3369b0e45cb79d1efe6ba2fd8dd21d0
Parents: 79fddd1
Author: Micah Kornfield <emkornfield@gmail.com>
Authored: Fri Apr 1 21:40:20 2016 -0700
Committer: Wes McKinney <wesm@apache.org>
Committed: Fri Apr 1 21:40:20 2016 -0700

----------------------------------------------------------------------
 .travis.yml                                  |   5 +-
 ci/travis_script_cpp.sh                      |   4 +
 cpp/CMakeLists.txt                           |  39 ++++++-
 cpp/README.md                                |  16 +++
 cpp/build-support/run-clang-format.sh        |  42 +++++++
 cpp/build-support/run-clang-tidy.sh          |  40 +++++++
 cpp/cmake_modules/FindClangTools.cmake       |  60 ++++++++++
 cpp/src/.clang-format                        |  65 +++++++++++
 cpp/src/.clang-tidy                          |  14 +++
 cpp/src/arrow/api.h                          |   2 +-
 cpp/src/arrow/array-test.cc                  |  16 +--
 cpp/src/arrow/array.cc                       |  17 +--
 cpp/src/arrow/array.h                        |  28 ++---
 cpp/src/arrow/builder.cc                     |   2 +-
 cpp/src/arrow/builder.h                      |  40 +++----
 cpp/src/arrow/column-benchmark.cc            |  23 ++--
 cpp/src/arrow/column-test.cc                 |   2 +-
 cpp/src/arrow/column.cc                      |  27 ++---
 cpp/src/arrow/column.h                       |  41 ++-----
 cpp/src/arrow/ipc/adapter.cc                 |  50 ++++-----
 cpp/src/arrow/ipc/adapter.h                  |  18 +--
 cpp/src/arrow/ipc/ipc-adapter-test.cc        |  20 ++--
 cpp/src/arrow/ipc/ipc-memory-test.cc         |  15 +--
 cpp/src/arrow/ipc/ipc-metadata-test.cc       |   8 +-
 cpp/src/arrow/ipc/memory.cc                  |  46 +++-----
 cpp/src/arrow/ipc/memory.h                   |  22 ++--
 cpp/src/arrow/ipc/metadata-internal.cc       |  70 ++++++------
 cpp/src/arrow/ipc/metadata-internal.h        |  12 +-
 cpp/src/arrow/ipc/metadata.cc                |  72 +++++-------
 cpp/src/arrow/ipc/metadata.h                 |  20 ++--
 cpp/src/arrow/ipc/test-common.h              |  10 +-
 cpp/src/arrow/parquet/parquet-schema-test.cc |  63 ++++-------
 cpp/src/arrow/parquet/schema.cc              |  15 ++-
 cpp/src/arrow/parquet/schema.h               |  11 +-
 cpp/src/arrow/schema-test.cc                 |   6 +-
 cpp/src/arrow/schema.cc                      |  20 ++--
 cpp/src/arrow/schema.h                       |  10 +-
 cpp/src/arrow/table-test.cc                  |  16 ++-
 cpp/src/arrow/table.cc                       |  31 ++----
 cpp/src/arrow/table.h                        |  38 ++-----
 cpp/src/arrow/test-util.h                    |  58 ++++------
 cpp/src/arrow/type.cc                        |   8 +-
 cpp/src/arrow/type.h                         |  94 +++++-----------
 cpp/src/arrow/types/binary.h                 |   6 +-
 cpp/src/arrow/types/collection.h             |  12 +-
 cpp/src/arrow/types/construct.cc             |  42 ++++---
 cpp/src/arrow/types/construct.h              |  11 +-
 cpp/src/arrow/types/datetime.h               |  39 ++-----
 cpp/src/arrow/types/decimal-test.cc          |   2 +-
 cpp/src/arrow/types/decimal.cc               |   3 +-
 cpp/src/arrow/types/decimal.h                |  11 +-
 cpp/src/arrow/types/json.cc                  |   5 +-
 cpp/src/arrow/types/json.h                   |   8 +-
 cpp/src/arrow/types/list-test.cc             |  11 +-
 cpp/src/arrow/types/list.cc                  |  25 ++---
 cpp/src/arrow/types/list.h                   |  65 ++++-------
 cpp/src/arrow/types/primitive-test.cc        | 107 ++++++++----------
 cpp/src/arrow/types/primitive.cc             |  75 +++++--------
 cpp/src/arrow/types/primitive.h              | 128 ++++++++--------------
 cpp/src/arrow/types/string-test.cc           |  20 ++--
 cpp/src/arrow/types/string.cc                |  10 +-
 cpp/src/arrow/types/string.h                 |  48 +++-----
 cpp/src/arrow/types/struct-test.cc           |   4 +-
 cpp/src/arrow/types/struct.cc                |   4 +-
 cpp/src/arrow/types/struct.h                 |   6 +-
 cpp/src/arrow/types/test-common.h            |   9 +-
 cpp/src/arrow/types/union.cc                 |   6 +-
 cpp/src/arrow/types/union.h                  |  17 +--
 cpp/src/arrow/util/bit-util-test.cc          |   2 +-
 cpp/src/arrow/util/bit-util.cc               |  10 +-
 cpp/src/arrow/util/bit-util.h                |   6 +-
 cpp/src/arrow/util/buffer-test.cc            |   5 +-
 cpp/src/arrow/util/buffer.cc                 |  16 +--
 cpp/src/arrow/util/buffer.h                  |  61 +++--------
 cpp/src/arrow/util/logging.h                 |  78 ++++++++-----
 cpp/src/arrow/util/macros.h                  |   6 +-
 cpp/src/arrow/util/memory-pool-test.cc       |   2 +-
 cpp/src/arrow/util/memory-pool.cc            |   2 +-
 cpp/src/arrow/util/memory-pool.h             |   4 +-
 cpp/src/arrow/util/random.h                  |  27 ++---
 cpp/src/arrow/util/status.cc                 |  10 +-
 cpp/src/arrow/util/status.h                  |  45 ++++----
 cpp/src/arrow/util/test_main.cc              |   2 +-
 cpp/thirdparty/build_thirdparty.sh           |   4 +-
 84 files changed, 1015 insertions(+), 1155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d89a200..a0138a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,14 @@
 sudo: required
-dist: trusty
+dist: precise 
 addons:
   apt:
     sources:
     - ubuntu-toolchain-r-test
     - kalakris-cmake
+    - llvm-toolchain-precise-3.7
     packages:
+    - clang-format-3.7
+    - clang-tidy-3.7
     - gcc-4.9   # Needed for C++11
     - g++-4.9   # Needed for C++11
     - gdb

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/ci/travis_script_cpp.sh
----------------------------------------------------------------------
diff --git a/ci/travis_script_cpp.sh b/ci/travis_script_cpp.sh
index 997bdf3..c9b3b5f 100755
--- a/ci/travis_script_cpp.sh
+++ b/ci/travis_script_cpp.sh
@@ -7,6 +7,10 @@ set -e
 pushd $CPP_BUILD_DIR
 
 make lint
+if [ $TRAVIS_OS_NAME == "linux" ]; then
+  make check-format
+  make check-clang-tidy
+fi
 
 ctest -L unittest
 

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 26d12d2..f803c0f 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -30,10 +30,11 @@ set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
 # Must be declared in the top-level CMakeLists.txt.
 set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
 
-# Generate a Clang compile_commands.json "compilation database" file for use
-# with various development tools, such as Vim's YouCompleteMe plugin.
-# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
-if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1")
+find_package(ClangTools)
+if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
+  # Generate a Clang compile_commands.json "compilation database" file for use
+  # with various development tools, such as Vim's YouCompleteMe plugin.
+  # See http://clang.llvm.org/docs/JSONCompilationDatabase.html
   set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 endif()
 
@@ -540,6 +541,36 @@ if (UNIX)
     `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc -or -name \\*.h | sed -e '/_generated/g'`)
 endif (UNIX)
 
+
+############################################################
+# "make format" and "make check-format" targets
+############################################################
+if (${CLANG_FORMAT_FOUND})
+  # runs clang format and updates files in place.
+  add_custom_target(format ${BUILD_SUPPORT_DIR}/run-clang-format.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CLANG_FORMAT_BIN} 1
+  `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc -or -name \\*.h | sed -e '/_generated/g'`)
+
+  # runs clang format and exits with a non-zero exit code if any files need to be reformatted
+  add_custom_target(check-format ${BUILD_SUPPORT_DIR}/run-clang-format.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CLANG_FORMAT_BIN} 0
+  `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc -or -name \\*.h | sed -e '/_generated/g'`)
+endif()
+
+
+############################################################
+# "make clang-tidy" and "make check-clang-tidy" targets
+############################################################
+if (${CLANG_TIDY_FOUND})
+  # runs clang-tidy and attempts to fix any warning automatically
+  add_custom_target(clang-tidy ${BUILD_SUPPORT_DIR}/run-clang-tidy.sh ${CLANG_TIDY_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 1
+  `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc | sed -e '/_generated/g'`)
+  # runs clang-tidy and exits with a non-zero exit code if any errors are found.
+  add_custom_target(check-clang-tidy ${BUILD_SUPPORT_DIR}/run-clang-tidy.sh ${CLANG_TIDY_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 
+  0 `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc | sed -e '/_generated/g'`)
+
+endif()
+
+
+
 ############################################################
 # Subdirectories
 ############################################################

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/README.md
----------------------------------------------------------------------
diff --git a/cpp/README.md b/cpp/README.md
index 9026cf9..3f5da21 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -61,3 +61,19 @@ variables
 * Googletest: `GTEST_HOME` (only required to build the unit tests)
 * Google Benchmark: `GBENCHMARK_HOME` (only required if building benchmarks)
 * Flatbuffers: `FLATBUFFERS_HOME` (only required for the IPC extensions)
+
+## Continuous Integration
+
+Pull requests are run through travis-ci for continuous integration.  You can avoid
+build failures by running the following checks before submitting your pull request:
+
+    make unittest
+    make lint
+    # The next two commands may change your code.  It is recommended you commit
+    # before running them.
+    make clang-tidy # requires clang-tidy is installed
+    make format # requires clang-format is installed
+
+Note that the clang-tidy target may take a while to run.  You might consider
+running clang-tidy separately on the files you have added/changed before
+invoking the make target to reduce iteration time.

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/build-support/run-clang-format.sh
----------------------------------------------------------------------
diff --git a/cpp/build-support/run-clang-format.sh b/cpp/build-support/run-clang-format.sh
new file mode 100755
index 0000000..ba525df
--- /dev/null
+++ b/cpp/build-support/run-clang-format.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Runs clang format in the given directory
+# Arguments:
+#   $1 - Path to the source tree
+#   $2 - Path to the clang format binary
+#   $3 - Apply fixes (will raise an error if false and not there where changes)
+#   $ARGN - Files to run clang format on
+#
+SOURCE_DIR=$1
+shift
+CLANG_FORMAT=$1
+shift
+APPLY_FIXES=$1
+shift
+
+# clang format will only find its configuration if we are in 
+# the source tree or in a path relative to the source tree
+pushd $SOURCE_DIR
+if [ "$APPLY_FIXES" == "1" ]; then
+  $CLANG_FORMAT -i $@
+else
+
+  NUM_CORRECTIONS=`$CLANG_FORMAT -output-replacements-xml  $@ | grep offset | wc -l`
+  if [ "$NUM_CORRECTIONS" -gt "0" ]; then
+    echo "clang-format suggested changes, please run 'make format'!!!!"
+    exit 1
+  fi
+fi 
+popd

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/build-support/run-clang-tidy.sh
----------------------------------------------------------------------
diff --git a/cpp/build-support/run-clang-tidy.sh b/cpp/build-support/run-clang-tidy.sh
new file mode 100755
index 0000000..4ba8ab8
--- /dev/null
+++ b/cpp/build-support/run-clang-tidy.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# Runs clang format in the given directory
+# Arguments:
+#   $1 - Path to the clang tidy binary
+#   $2 - Path to the compile_commands.json to use
+#   $3 - Apply fixes (will raise an error if false and not there where changes)
+#   $ARGN - Files to run clang-tidy on
+#
+CLANG_TIDY=$1
+shift
+COMPILE_COMMANDS=$1
+shift
+APPLY_FIXES=$1
+shift
+
+# clang format will only find its configuration if we are in 
+# the source tree or in a path relative to the source tree
+if [ "$APPLY_FIXES" == "1" ]; then
+  $CLANG_TIDY -p $COMPILE_COMMANDS -fix  $@
+else
+  NUM_CORRECTIONS=`$CLANG_TIDY -p $COMPILE_COMMANDS $@ 2>&1 | grep -v Skipping | grep "warnings* generated" | wc -l`
+  if [ "$NUM_CORRECTIONS" -gt "0" ]; then
+    echo "clang-tidy had suggested fixes.  Please fix these!!!"
+    exit 1
+  fi
+fi 

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/cmake_modules/FindClangTools.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/FindClangTools.cmake b/cpp/cmake_modules/FindClangTools.cmake
new file mode 100644
index 0000000..c07c7d2
--- /dev/null
+++ b/cpp/cmake_modules/FindClangTools.cmake
@@ -0,0 +1,60 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Tries to find the clang-tidy and clang-format modules
+#
+# Usage of this module as follows:
+#
+#  find_package(ClangTools)
+#
+# Variables used by this module, they can change the default behaviour and need
+# to be set before calling find_package:
+#
+#  ClangToolsBin_HOME -
+#   When set, this path is inspected instead of standard library binary locations
+#   to find clang-tidy and clang-format
+#
+# This module defines
+#  CLANG_TIDY_BIN, The  path to the clang tidy binary
+#  CLANG_TIDY_FOUND, Whether clang tidy was found
+#  CLANG_FORMAT_BIN, The path to the clang format binary 
+#  CLANG_TIDY_FOUND, Whether clang format was found
+
+find_program(CLANG_TIDY_BIN 
+  NAMES clang-tidy-3.8 clang-tidy-3.7 clang-tidy-3.6  clang-tidy
+  PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin 
+        NO_DEFAULT_PATH
+)
+
+if ( "${CLANG_TIDY_BIN}" STREQUAL "CLANG_TIDY_BIN-NOTFOUND" ) 
+  set(CLANG_TIDY_FOUND 0)
+  message("clang-tidy not found")
+else()
+  set(CLANG_TIDY_FOUND 1)
+  message("clang-tidy found at ${CLANG_TIDY_BIN}")
+endif()
+
+find_program(CLANG_FORMAT_BIN 
+  NAMES clang-format-3.8 clang-format-3.7 clang-format-3.6  clang-format
+  PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin 
+        NO_DEFAULT_PATH
+)
+
+if ( "${CLANG_FORMAT_BIN}" STREQUAL "CLANG_FORMAT_BIN-NOTFOUND" ) 
+  set(CLANG_FORMAT_FOUND 0)
+  message("clang-format not found")
+else()
+  set(CLANG_FORMAT_FOUND 1)
+  message("clang-format found at ${CLANG_FORMAT_BIN}")
+endif()
+

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/.clang-format
----------------------------------------------------------------------
diff --git a/cpp/src/.clang-format b/cpp/src/.clang-format
new file mode 100644
index 0000000..7d5b3cf
--- /dev/null
+++ b/cpp/src/.clang-format
@@ -0,0 +1,65 @@
+---
+Language:        Cpp
+# BasedOnStyle:  Google
+AccessModifierOffset: -1
+AlignAfterOpenBracket: false 
+AlignConsecutiveAssignments: false
+AlignEscapedNewlinesLeft: true
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true 
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: true
+AllowShortLoopsOnASingleLine: false 
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true 
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 90 
+CommentPragmas:  '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false 
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IndentCaseLabels: true
+IndentWidth:     2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 1000
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Left
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+TabWidth:        8
+UseTab:          Never

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/.clang-tidy
----------------------------------------------------------------------
diff --git a/cpp/src/.clang-tidy b/cpp/src/.clang-tidy
new file mode 100644
index 0000000..deaa9bd
--- /dev/null
+++ b/cpp/src/.clang-tidy
@@ -0,0 +1,14 @@
+---
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-.*,modernize-.*,readablity-.*'
+HeaderFilterRegex: 'arrow/.*'
+AnalyzeTemporaryDtors: true
+CheckOptions:    
+  - key:             google-readability-braces-around-statements.ShortStatementLines
+    value:           '1'
+  - key:             google-readability-function-size.StatementThreshold
+    value:           '800'
+  - key:             google-readability-namespace-comments.ShortNamespaceLines
+    value:           '10'
+  - key:             google-readability-namespace-comments.SpacesBeforeComments
+    value:           '2'
+

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/api.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/api.h b/cpp/src/arrow/api.h
index 2ae80f6..2d317b4 100644
--- a/cpp/src/arrow/api.h
+++ b/cpp/src/arrow/api.h
@@ -37,4 +37,4 @@
 #include "arrow/util/memory-pool.h"
 #include "arrow/util/status.h"
 
-#endif // ARROW_API_H
+#endif  // ARROW_API_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/array-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc
index 121b802..b4c7279 100644
--- a/cpp/src/arrow/array-test.cc
+++ b/cpp/src/arrow/array-test.cc
@@ -33,15 +33,12 @@ namespace arrow {
 
 class TestArray : public ::testing::Test {
  public:
-  void SetUp() {
-    pool_ = default_memory_pool();
-  }
+  void SetUp() { pool_ = default_memory_pool(); }
 
  protected:
   MemoryPool* pool_;
 };
 
-
 TEST_F(TestArray, TestNullCount) {
   auto data = std::make_shared<PoolBuffer>(pool_);
   auto null_bitmap = std::make_shared<PoolBuffer>(pool_);
@@ -53,7 +50,6 @@ TEST_F(TestArray, TestNullCount) {
   ASSERT_EQ(0, arr_no_nulls->null_count());
 }
 
-
 TEST_F(TestArray, TestLength) {
   auto data = std::make_shared<PoolBuffer>(pool_);
   std::unique_ptr<Int32Array> arr(new Int32Array(100, data));
@@ -61,14 +57,16 @@ TEST_F(TestArray, TestLength) {
 }
 
 TEST_F(TestArray, TestIsNull) {
+  // clang-format off
   std::vector<uint8_t> null_bitmap = {1, 0, 1, 1, 0, 1, 0, 0,
                                       1, 0, 1, 1, 0, 1, 0, 0,
                                       1, 0, 1, 1, 0, 1, 0, 0,
                                       1, 0, 1, 1, 0, 1, 0, 0,
                                       1, 0, 0, 1};
+  // clang-format on
   int32_t null_count = 0;
   for (uint8_t x : null_bitmap) {
-    if (x == 0) ++null_count;
+    if (x == 0) { ++null_count; }
   }
 
   std::shared_ptr<Buffer> null_buf = test::bytes_to_null_buffer(null_bitmap);
@@ -85,8 +83,6 @@ TEST_F(TestArray, TestIsNull) {
   }
 }
 
+TEST_F(TestArray, TestCopy) {}
 
-TEST_F(TestArray, TestCopy) {
-}
-
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/array.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/array.cc b/cpp/src/arrow/array.cc
index 3736732..a153686 100644
--- a/cpp/src/arrow/array.cc
+++ b/cpp/src/arrow/array.cc
@@ -32,30 +32,25 @@ Array::Array(const TypePtr& type, int32_t length, int32_t null_count,
   length_ = length;
   null_count_ = null_count;
   null_bitmap_ = null_bitmap;
-  if (null_bitmap_) {
-    null_bitmap_data_ = null_bitmap_->data();
-  }
+  if (null_bitmap_) { null_bitmap_data_ = null_bitmap_->data(); }
 }
 
 bool Array::EqualsExact(const Array& other) const {
-  if (this == &other) return true;
+  if (this == &other) { return true; }
   if (length_ != other.length_ || null_count_ != other.null_count_ ||
       type_enum() != other.type_enum()) {
     return false;
   }
   if (null_count_ > 0) {
     return null_bitmap_->Equals(*other.null_bitmap_, util::bytes_for_bits(length_));
-  } else {
-    return true;
   }
+  return true;
 }
 
 bool NullArray::Equals(const std::shared_ptr<Array>& arr) const {
-  if (this == arr.get()) return true;
-  if (Type::NA != arr->type_enum()) {
-    return false;
-  }
+  if (this == arr.get()) { return true; }
+  if (Type::NA != arr->type_enum()) { return false; }
   return arr->length() == length_;
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/array.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/array.h b/cpp/src/arrow/array.h
index 097634d..c6735f8 100644
--- a/cpp/src/arrow/array.h
+++ b/cpp/src/arrow/array.h
@@ -36,8 +36,7 @@ class Buffer;
 // count is greater than 0
 class Array {
  public:
-  Array(const std::shared_ptr<DataType>& type, int32_t length,
-      int32_t null_count = 0,
+  Array(const std::shared_ptr<DataType>& type, int32_t length, int32_t null_count = 0,
       const std::shared_ptr<Buffer>& null_bitmap = nullptr);
 
   virtual ~Array() {}
@@ -47,19 +46,15 @@ class Array {
     return null_count_ > 0 && util::bit_not_set(null_bitmap_data_, i);
   }
 
-  int32_t length() const { return length_;}
-  int32_t null_count() const { return null_count_;}
+  int32_t length() const { return length_; }
+  int32_t null_count() const { return null_count_; }
 
-  const std::shared_ptr<DataType>& type() const { return type_;}
-  Type::type type_enum() const { return type_->type;}
+  const std::shared_ptr<DataType>& type() const { return type_; }
+  Type::type type_enum() const { return type_->type; }
 
-  const std::shared_ptr<Buffer>& null_bitmap() const {
-    return null_bitmap_;
-  }
+  const std::shared_ptr<Buffer>& null_bitmap() const { return null_bitmap_; }
 
-  const uint8_t* null_bitmap_data() const {
-    return null_bitmap_data_;
-  }
+  const uint8_t* null_bitmap_data() const { return null_bitmap_data_; }
 
   bool EqualsExact(const Array& arr) const;
   virtual bool Equals(const std::shared_ptr<Array>& arr) const = 0;
@@ -80,17 +75,16 @@ class Array {
 // Degenerate null type Array
 class NullArray : public Array {
  public:
-  NullArray(const std::shared_ptr<DataType>& type, int32_t length) :
-      Array(type, length, length, nullptr) {}
+  NullArray(const std::shared_ptr<DataType>& type, int32_t length)
+      : Array(type, length, length, nullptr) {}
 
-  explicit NullArray(int32_t length) :
-      NullArray(std::make_shared<NullType>(), length) {}
+  explicit NullArray(int32_t length) : NullArray(std::make_shared<NullType>(), length) {}
 
   bool Equals(const std::shared_ptr<Array>& arr) const override;
 };
 
 typedef std::shared_ptr<Array> ArrayPtr;
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/builder.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/builder.cc b/cpp/src/arrow/builder.cc
index 4061f35..1447078 100644
--- a/cpp/src/arrow/builder.cc
+++ b/cpp/src/arrow/builder.cc
@@ -62,4 +62,4 @@ Status ArrayBuilder::Reserve(int32_t elements) {
   return Status::OK();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/builder.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/builder.h b/cpp/src/arrow/builder.h
index d1a49dc..21a6341 100644
--- a/cpp/src/arrow/builder.h
+++ b/cpp/src/arrow/builder.h
@@ -37,30 +37,26 @@ static constexpr int32_t MIN_BUILDER_CAPACITY = 1 << 5;
 // Base class for all data array builders
 class ArrayBuilder {
  public:
-  explicit ArrayBuilder(MemoryPool* pool, const TypePtr& type) :
-      pool_(pool),
-      type_(type),
-      null_bitmap_(nullptr),
-      null_count_(0),
-      null_bitmap_data_(nullptr),
-      length_(0),
-      capacity_(0) {}
+  explicit ArrayBuilder(MemoryPool* pool, const TypePtr& type)
+      : pool_(pool),
+        type_(type),
+        null_bitmap_(nullptr),
+        null_count_(0),
+        null_bitmap_data_(nullptr),
+        length_(0),
+        capacity_(0) {}
 
   virtual ~ArrayBuilder() {}
 
   // For nested types. Since the objects are owned by this class instance, we
   // skip shared pointers and just return a raw pointer
-  ArrayBuilder* child(int i) {
-    return children_[i].get();
-  }
+  ArrayBuilder* child(int i) { return children_[i].get(); }
 
-  int num_children() const {
-    return children_.size();
-  }
+  int num_children() const { return children_.size(); }
 
-  int32_t length() const { return length_;}
-  int32_t null_count() const { return null_count_;}
-  int32_t capacity() const { return capacity_;}
+  int32_t length() const { return length_; }
+  int32_t null_count() const { return null_count_; }
+  int32_t capacity() const { return capacity_; }
 
   // Allocates requires memory at this level, but children need to be
   // initialized independently
@@ -76,15 +72,13 @@ class ArrayBuilder {
   // this function responsibly.
   Status Advance(int32_t elements);
 
-  const std::shared_ptr<PoolBuffer>& null_bitmap() const { return null_bitmap_;}
+  const std::shared_ptr<PoolBuffer>& null_bitmap() const { return null_bitmap_; }
 
   // Creates new array object to hold the contents of the builder and transfers
   // ownership of the data
   virtual std::shared_ptr<Array> Finish() = 0;
 
-  const std::shared_ptr<DataType>& type() const {
-    return type_;
-  }
+  const std::shared_ptr<DataType>& type() const { return type_; }
 
  protected:
   MemoryPool* pool_;
@@ -107,6 +101,6 @@ class ArrayBuilder {
   DISALLOW_COPY_AND_ASSIGN(ArrayBuilder);
 };
 
-} // 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/column-benchmark.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/column-benchmark.cc b/cpp/src/arrow/column-benchmark.cc
index 335d581..edea094 100644
--- a/cpp/src/arrow/column-benchmark.cc
+++ b/cpp/src/arrow/column-benchmark.cc
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-
 #include "benchmark/benchmark.h"
 
 #include "arrow/test-util.h"
@@ -24,19 +23,19 @@
 
 namespace arrow {
 namespace {
-  template <typename ArrayType>
-  std::shared_ptr<Array> MakePrimitive(int32_t length, int32_t null_count = 0) {
-    auto pool = default_memory_pool();
-    auto data = std::make_shared<PoolBuffer>(pool);
-    auto null_bitmap = std::make_shared<PoolBuffer>(pool);
-    data->Resize(length * sizeof(typename ArrayType::value_type));
-    null_bitmap->Resize(util::bytes_for_bits(length));
-    return std::make_shared<ArrayType>(length, data, 10, null_bitmap);
-  }
+template <typename ArrayType>
+std::shared_ptr<Array> MakePrimitive(int32_t length, int32_t null_count = 0) {
+  auto pool = default_memory_pool();
+  auto data = std::make_shared<PoolBuffer>(pool);
+  auto null_bitmap = std::make_shared<PoolBuffer>(pool);
+  data->Resize(length * sizeof(typename ArrayType::value_type));
+  null_bitmap->Resize(util::bytes_for_bits(length));
+  return std::make_shared<ArrayType>(length, data, 10, null_bitmap);
+}
 }  // anonymous namespace
 
-
-static void BM_BuildInt32ColumnByChunk(benchmark::State& state) { //NOLINT non-const reference
+static void BM_BuildInt32ColumnByChunk(
+    benchmark::State& state) {  // NOLINT non-const reference
   ArrayVector arrays;
   for (int chunk_n = 0; chunk_n < state.range_x(); ++chunk_n) {
     arrays.push_back(MakePrimitive<Int32Array>(100, 10));

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/column-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/column-test.cc b/cpp/src/arrow/column-test.cc
index 0630785..1edf313 100644
--- a/cpp/src/arrow/column-test.cc
+++ b/cpp/src/arrow/column-test.cc
@@ -72,4 +72,4 @@ TEST_F(TestColumn, ChunksInhomogeneous) {
   ASSERT_RAISES(Invalid, column_->ValidateData());
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/column.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/column.cc b/cpp/src/arrow/column.cc
index 46acf8d..52e4c58 100644
--- a/cpp/src/arrow/column.cc
+++ b/cpp/src/arrow/column.cc
@@ -26,8 +26,7 @@
 
 namespace arrow {
 
-ChunkedArray::ChunkedArray(const ArrayVector& chunks) :
-    chunks_(chunks) {
+ChunkedArray::ChunkedArray(const ArrayVector& chunks) : chunks_(chunks) {
   length_ = 0;
   null_count_ = 0;
   for (const std::shared_ptr<Array>& chunk : chunks) {
@@ -36,35 +35,31 @@ ChunkedArray::ChunkedArray(const ArrayVector& chunks) :
   }
 }
 
-Column::Column(const std::shared_ptr<Field>& field, const ArrayVector& chunks) :
-    field_(field) {
+Column::Column(const std::shared_ptr<Field>& field, const ArrayVector& chunks)
+    : field_(field) {
   data_ = std::make_shared<ChunkedArray>(chunks);
 }
 
-Column::Column(const std::shared_ptr<Field>& field,
-    const std::shared_ptr<Array>& data) :
-    field_(field) {
+Column::Column(const std::shared_ptr<Field>& field, const std::shared_ptr<Array>& data)
+    : field_(field) {
   data_ = std::make_shared<ChunkedArray>(ArrayVector({data}));
 }
 
-Column::Column(const std::shared_ptr<Field>& field,
-    const std::shared_ptr<ChunkedArray>& data) :
-    field_(field),
-    data_(data) {}
+Column::Column(
+    const std::shared_ptr<Field>& field, const std::shared_ptr<ChunkedArray>& data)
+    : field_(field), data_(data) {}
 
 Status Column::ValidateData() {
   for (int i = 0; i < data_->num_chunks(); ++i) {
     const std::shared_ptr<DataType>& type = data_->chunk(i)->type();
     if (!this->type()->Equals(type)) {
       std::stringstream ss;
-      ss << "In chunk " << i << " expected type "
-         << this->type()->ToString()
-         << " but saw "
-         << type->ToString();
+      ss << "In chunk " << i << " expected type " << this->type()->ToString()
+         << " but saw " << type->ToString();
       return Status::Invalid(ss.str());
     }
   }
   return Status::OK();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/column.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/column.h b/cpp/src/arrow/column.h
index 1ad97b2..22becc3 100644
--- a/cpp/src/arrow/column.h
+++ b/cpp/src/arrow/column.h
@@ -39,21 +39,13 @@ class ChunkedArray {
   explicit ChunkedArray(const ArrayVector& chunks);
 
   // @returns: the total length of the chunked array; computed on construction
-  int64_t length() const {
-    return length_;
-  }
+  int64_t length() const { return length_; }
 
-  int64_t null_count() const {
-    return null_count_;
-  }
+  int64_t null_count() const { return null_count_; }
 
-  int num_chunks() const {
-    return chunks_.size();
-  }
+  int num_chunks() const { return chunks_.size(); }
 
-  const std::shared_ptr<Array>& chunk(int i) const {
-    return chunks_[i];
-  }
+  const std::shared_ptr<Array>& chunk(int i) const { return chunks_[i]; }
 
  protected:
   ArrayVector chunks_;
@@ -67,33 +59,22 @@ class ChunkedArray {
 class Column {
  public:
   Column(const std::shared_ptr<Field>& field, const ArrayVector& chunks);
-  Column(const std::shared_ptr<Field>& field,
-      const std::shared_ptr<ChunkedArray>& data);
+  Column(const std::shared_ptr<Field>& field, const std::shared_ptr<ChunkedArray>& data);
 
   Column(const std::shared_ptr<Field>& field, const std::shared_ptr<Array>& data);
 
-  int64_t length() const {
-    return data_->length();
-  }
+  int64_t length() const { return data_->length(); }
 
-  int64_t null_count() const {
-    return data_->null_count();
-  }
+  int64_t null_count() const { return data_->null_count(); }
 
   // @returns: the column's name in the passed metadata
-  const std::string& name() const {
-    return field_->name;
-  }
+  const std::string& name() const { return field_->name; }
 
   // @returns: the column's type according to the metadata
-  const std::shared_ptr<DataType>& type() const {
-    return field_->type;
-  }
+  const std::shared_ptr<DataType>& type() const { return field_->type; }
 
   // @returns: the column's data as a chunked logical array
-  const std::shared_ptr<ChunkedArray>& data() const {
-    return data_;
-  }
+  const std::shared_ptr<ChunkedArray>& data() const { return data_; }
   // Verify that the column's array data is consistent with the passed field's
   // metadata
   Status ValidateData();
@@ -103,6 +84,6 @@ class Column {
   std::shared_ptr<ChunkedArray> data_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_COLUMN_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/adapter.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/adapter.cc b/cpp/src/arrow/ipc/adapter.cc
index c79e846..2f72c3a 100644
--- a/cpp/src/arrow/ipc/adapter.cc
+++ b/cpp/src/arrow/ipc/adapter.cc
@@ -94,8 +94,7 @@ Status VisitArray(const Array* arr, std::vector<flatbuf::FieldNode>* field_nodes
 
 class RowBatchWriter {
  public:
-  explicit RowBatchWriter(const RowBatch* batch) :
-      batch_(batch) {}
+  explicit RowBatchWriter(const RowBatch* batch) : batch_(batch) {}
 
   Status AssemblePayload() {
     // Perform depth-first traversal of the row-batch
@@ -138,12 +137,12 @@ class RowBatchWriter {
     // determine the data header size then request a buffer such that you can
     // construct the flatbuffer data accessor object (see arrow::ipc::Message)
     std::shared_ptr<Buffer> data_header;
-    RETURN_NOT_OK(WriteDataHeader(batch_->num_rows(), offset,
-            field_nodes_, buffer_meta_, &data_header));
+    RETURN_NOT_OK(WriteDataHeader(
+        batch_->num_rows(), offset, field_nodes_, buffer_meta_, &data_header));
 
     // Write the data header at the end
-    RETURN_NOT_OK(dst->Write(position + offset, data_header->data(),
-            data_header->size()));
+    RETURN_NOT_OK(
+        dst->Write(position + offset, data_header->data(), data_header->size()));
 
     *data_header_offset = position + offset;
     return Status::OK();
@@ -174,8 +173,8 @@ class RowBatchWriter {
   std::vector<std::shared_ptr<Buffer>> buffers_;
 };
 
-Status WriteRowBatch(MemorySource* dst, const RowBatch* batch, int64_t position,
-    int64_t* header_offset) {
+Status WriteRowBatch(
+    MemorySource* dst, const RowBatch* batch, int64_t position, int64_t* header_offset) {
   RowBatchWriter serializer(batch);
   RETURN_NOT_OK(serializer.AssemblePayload());
   return serializer.Write(dst, position, header_offset);
@@ -187,15 +186,14 @@ static constexpr int64_t INIT_METADATA_SIZE = 4096;
 
 class RowBatchReader::Impl {
  public:
-  Impl(MemorySource* source, const std::shared_ptr<RecordBatchMessage>& metadata) :
-      source_(source),
-      metadata_(metadata) {
+  Impl(MemorySource* source, const std::shared_ptr<RecordBatchMessage>& metadata)
+      : source_(source), metadata_(metadata) {
     num_buffers_ = metadata->num_buffers();
     num_flattened_fields_ = metadata->num_fields();
   }
 
-  Status AssembleBatch(const std::shared_ptr<Schema>& schema,
-      std::shared_ptr<RowBatch>* out) {
+  Status AssembleBatch(
+      const std::shared_ptr<Schema>& schema, std::shared_ptr<RowBatch>* out) {
     std::vector<std::shared_ptr<Array>> arrays(schema->num_fields());
 
     // The field_index and buffer_index are incremented in NextArray based on
@@ -208,8 +206,7 @@ class RowBatchReader::Impl {
       RETURN_NOT_OK(NextArray(field, &arrays[i]));
     }
 
-    *out = std::make_shared<RowBatch>(schema, metadata_->length(),
-        arrays);
+    *out = std::make_shared<RowBatch>(schema, metadata_->length(), arrays);
     return Status::OK();
   }
 
@@ -243,11 +240,10 @@ class RowBatchReader::Impl {
       } else {
         data.reset(new Buffer(nullptr, 0));
       }
-      return MakePrimitiveArray(type, field_meta.length, data,
-          field_meta.null_count, null_bitmap, out);
-    } else {
-      return Status::NotImplemented("Non-primitive types not complete yet");
+      return MakePrimitiveArray(
+          type, field_meta.length, data, field_meta.null_count, null_bitmap, out);
     }
+    return Status::NotImplemented("Non-primitive types not complete yet");
   }
 
   Status GetBuffer(int buffer_index, std::shared_ptr<Buffer>* out) {
@@ -264,8 +260,8 @@ class RowBatchReader::Impl {
   int num_flattened_fields_;
 };
 
-Status RowBatchReader::Open(MemorySource* source, int64_t position,
-    std::shared_ptr<RowBatchReader>* out) {
+Status RowBatchReader::Open(
+    MemorySource* source, int64_t position, std::shared_ptr<RowBatchReader>* out) {
   std::shared_ptr<Buffer> metadata;
   RETURN_NOT_OK(source->ReadAt(position, INIT_METADATA_SIZE, &metadata));
 
@@ -274,8 +270,7 @@ Status RowBatchReader::Open(MemorySource* source, int64_t position,
   // We may not need to call source->ReadAt again
   if (metadata_size > static_cast<int>(INIT_METADATA_SIZE - sizeof(int32_t))) {
     // We don't have enough data, read the indicated metadata size.
-    RETURN_NOT_OK(source->ReadAt(position + sizeof(int32_t),
-            metadata_size, &metadata));
+    RETURN_NOT_OK(source->ReadAt(position + sizeof(int32_t), metadata_size, &metadata));
   }
 
   // TODO(wesm): buffer slicing here would be better in case ReadAt returns
@@ -297,11 +292,10 @@ Status RowBatchReader::Open(MemorySource* source, int64_t position,
   return Status::OK();
 }
 
-Status RowBatchReader::GetRowBatch(const std::shared_ptr<Schema>& schema,
-    std::shared_ptr<RowBatch>* out) {
+Status RowBatchReader::GetRowBatch(
+    const std::shared_ptr<Schema>& schema, std::shared_ptr<RowBatch>* out) {
   return impl_->AssembleBatch(schema, out);
 }
 
-
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/adapter.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/adapter.h b/cpp/src/arrow/ipc/adapter.h
index 26dea6d..d453fa0 100644
--- a/cpp/src/arrow/ipc/adapter.h
+++ b/cpp/src/arrow/ipc/adapter.h
@@ -52,8 +52,8 @@ class RecordBatchMessage;
 //
 // Finally, the memory offset to the start of the metadata / data header is
 // returned in an out-variable
-Status WriteRowBatch(MemorySource* dst, const RowBatch* batch, int64_t position,
-    int64_t* header_offset);
+Status WriteRowBatch(
+    MemorySource* dst, const RowBatch* batch, int64_t position, int64_t* header_offset);
 
 // int64_t GetRowBatchMetadata(const RowBatch* batch);
 
@@ -67,20 +67,20 @@ int64_t GetRowBatchSize(const RowBatch* batch);
 
 class RowBatchReader {
  public:
-  static Status Open(MemorySource* source, int64_t position,
-      std::shared_ptr<RowBatchReader>* out);
+  static Status Open(
+      MemorySource* source, int64_t position, std::shared_ptr<RowBatchReader>* out);
 
   // Reassemble the row batch. A Schema is required to be able to construct the
   // right array containers
-  Status GetRowBatch(const std::shared_ptr<Schema>& schema,
-      std::shared_ptr<RowBatch>* out);
+  Status GetRowBatch(
+      const std::shared_ptr<Schema>& schema, std::shared_ptr<RowBatch>* out);
 
  private:
   class Impl;
   std::unique_ptr<Impl> impl_;
 };
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow
 
-#endif // ARROW_IPC_MEMORY_H
+#endif  // ARROW_IPC_MEMORY_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/ipc-adapter-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/ipc-adapter-test.cc b/cpp/src/arrow/ipc/ipc-adapter-test.cc
index 79b4d71..fbdda77 100644
--- a/cpp/src/arrow/ipc/ipc-adapter-test.cc
+++ b/cpp/src/arrow/ipc/ipc-adapter-test.cc
@@ -42,12 +42,8 @@ namespace ipc {
 
 class TestWriteRowBatch : public ::testing::Test, public MemoryMapFixture {
  public:
-  void SetUp() {
-    pool_ = default_memory_pool();
-  }
-  void TearDown() {
-    MemoryMapFixture::TearDown();
-  }
+  void SetUp() { pool_ = default_memory_pool(); }
+  void TearDown() { MemoryMapFixture::TearDown(); }
 
   void InitMemoryMap(int64_t size) {
     std::string path = "test-write-row-batch";
@@ -83,8 +79,8 @@ TEST_F(TestWriteRowBatch, IntegerRoundTrip) {
   test::random_bytes(null_bytes, 0, null_bitmap->mutable_data());
 
   auto a0 = std::make_shared<Int32Array>(length, data);
-  auto a1 = std::make_shared<Int32Array>(length, data,
-      test::bitmap_popcount(null_bitmap->data(), length), null_bitmap);
+  auto a1 = std::make_shared<Int32Array>(
+      length, data, test::bitmap_popcount(null_bitmap->data(), length), null_bitmap);
 
   RowBatch batch(schema, length, {a0, a1});
 
@@ -103,10 +99,10 @@ TEST_F(TestWriteRowBatch, IntegerRoundTrip) {
   EXPECT_EQ(batch.num_rows(), batch_result->num_rows());
 
   for (int i = 0; i < batch.num_columns(); ++i) {
-    EXPECT_TRUE(batch.column(i)->Equals(batch_result->column(i)))
-      << i << batch.column_name(i);
+    EXPECT_TRUE(batch.column(i)->Equals(batch_result->column(i))) << i
+                                                                  << batch.column_name(i);
   }
 }
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/ipc-memory-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/ipc-memory-test.cc b/cpp/src/arrow/ipc/ipc-memory-test.cc
index 332ad2a..1933921 100644
--- a/cpp/src/arrow/ipc/ipc-memory-test.cc
+++ b/cpp/src/arrow/ipc/ipc-memory-test.cc
@@ -35,13 +35,10 @@ namespace ipc {
 
 class TestMemoryMappedSource : public ::testing::Test, public MemoryMapFixture {
  public:
-  void TearDown() {
-    MemoryMapFixture::TearDown();
-  }
+  void TearDown() { MemoryMapFixture::TearDown(); }
 };
 
-TEST_F(TestMemoryMappedSource, InvalidUsages) {
-}
+TEST_F(TestMemoryMappedSource, InvalidUsages) {}
 
 TEST_F(TestMemoryMappedSource, WriteRead) {
   const int64_t buffer_size = 1024;
@@ -74,9 +71,9 @@ TEST_F(TestMemoryMappedSource, InvalidFile) {
   std::string non_existent_path = "invalid-file-name-asfd";
 
   std::shared_ptr<MemoryMappedSource> result;
-  ASSERT_RAISES(IOError, MemoryMappedSource::Open(non_existent_path,
-          MemorySource::READ_ONLY, &result));
+  ASSERT_RAISES(IOError,
+      MemoryMappedSource::Open(non_existent_path, MemorySource::READ_ONLY, &result));
 }
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/ipc-metadata-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/ipc-metadata-test.cc b/cpp/src/arrow/ipc/ipc-metadata-test.cc
index ceabec0..51d79cf 100644
--- a/cpp/src/arrow/ipc/ipc-metadata-test.cc
+++ b/cpp/src/arrow/ipc/ipc-metadata-test.cc
@@ -86,14 +86,12 @@ TEST_F(TestSchemaMessage, NestedFields) {
   auto type = std::make_shared<ListType>(std::make_shared<Int32Type>());
   auto f0 = std::make_shared<Field>("f0", type);
 
-  std::shared_ptr<StructType> type2(new StructType({
-            std::make_shared<Field>("k1", INT32),
-              std::make_shared<Field>("k2", INT32),
-              std::make_shared<Field>("k3", INT32)}));
+  std::shared_ptr<StructType> type2(new StructType({std::make_shared<Field>("k1", INT32),
+      std::make_shared<Field>("k2", INT32), std::make_shared<Field>("k3", INT32)}));
   auto f1 = std::make_shared<Field>("f1", type2);
 
   Schema schema({f0, f1});
   CheckRoundtrip(&schema);
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/memory.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/memory.cc b/cpp/src/arrow/ipc/memory.cc
index e630ccd..2b077e9 100644
--- a/cpp/src/arrow/ipc/memory.cc
+++ b/cpp/src/arrow/ipc/memory.cc
@@ -17,7 +17,7 @@
 
 #include "arrow/ipc/memory.h"
 
-#include <sys/mman.h> // For memory-mapping
+#include <sys/mman.h>  // For memory-mapping
 #include <algorithm>
 #include <cerrno>
 #include <cstdint>
@@ -32,8 +32,7 @@
 namespace arrow {
 namespace ipc {
 
-MemorySource::MemorySource(AccessMode access_mode) :
-    access_mode_(access_mode) {}
+MemorySource::MemorySource(AccessMode access_mode) : access_mode_(access_mode) {}
 
 MemorySource::~MemorySource() {}
 
@@ -41,10 +40,7 @@ MemorySource::~MemorySource() {}
 
 class MemoryMappedSource::Impl {
  public:
-  Impl() :
-      file_(nullptr),
-      is_open_(false),
-      data_(nullptr) {}
+  Impl() : file_(nullptr), is_open_(false), data_(nullptr) {}
 
   ~Impl() {
     if (is_open_) {
@@ -54,9 +50,7 @@ class MemoryMappedSource::Impl {
   }
 
   Status Open(const std::string& path, MemorySource::AccessMode mode) {
-    if (is_open_) {
-      return Status::IOError("A file is already open");
-    }
+    if (is_open_) { return Status::IOError("A file is already open"); }
 
     path_ = path;
 
@@ -72,18 +66,15 @@ class MemoryMappedSource::Impl {
     }
 
     fseek(file_, 0L, SEEK_END);
-    if (ferror(file_)) {
-      return Status::IOError("Unable to seek to end of file");
-    }
+    if (ferror(file_)) { return Status::IOError("Unable to seek to end of file"); }
     size_ = ftell(file_);
 
     fseek(file_, 0L, SEEK_SET);
     is_open_ = true;
 
     // TODO(wesm): Add read-only version of this
-    data_ = reinterpret_cast<uint8_t*>(mmap(nullptr, size_,
-            PROT_READ | PROT_WRITE,
-            MAP_SHARED, fileno(file_), 0));
+    data_ = reinterpret_cast<uint8_t*>(
+        mmap(nullptr, size_, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file_), 0));
     if (data_ == nullptr) {
       std::stringstream ss;
       ss << "Memory mapping file failed, errno: " << errno;
@@ -93,13 +84,9 @@ class MemoryMappedSource::Impl {
     return Status::OK();
   }
 
-  int64_t size() const {
-    return size_;
-  }
+  int64_t size() const { return size_; }
 
-  uint8_t* data() {
-    return data_;
-  }
+  uint8_t* data() { return data_; }
 
  private:
   std::string path_;
@@ -111,8 +98,8 @@ class MemoryMappedSource::Impl {
   uint8_t* data_;
 };
 
-MemoryMappedSource::MemoryMappedSource(AccessMode access_mode) :
-    MemorySource(access_mode) {}
+MemoryMappedSource::MemoryMappedSource(AccessMode access_mode)
+    : MemorySource(access_mode) {}
 
 Status MemoryMappedSource::Open(const std::string& path, AccessMode access_mode,
     std::shared_ptr<MemoryMappedSource>* out) {
@@ -134,8 +121,8 @@ Status MemoryMappedSource::Close() {
   return Status::OK();
 }
 
-Status MemoryMappedSource::ReadAt(int64_t position, int64_t nbytes,
-    std::shared_ptr<Buffer>* out) {
+Status MemoryMappedSource::ReadAt(
+    int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out) {
   if (position < 0 || position >= impl_->size()) {
     return Status::Invalid("position is out of bounds");
   }
@@ -145,8 +132,7 @@ Status MemoryMappedSource::ReadAt(int64_t position, int64_t nbytes,
   return Status::OK();
 }
 
-Status MemoryMappedSource::Write(int64_t position, const uint8_t* data,
-    int64_t nbytes) {
+Status MemoryMappedSource::Write(int64_t position, const uint8_t* data, int64_t nbytes) {
   if (position < 0 || position >= impl_->size()) {
     return Status::Invalid("position is out of bounds");
   }
@@ -158,5 +144,5 @@ Status MemoryMappedSource::Write(int64_t position, const uint8_t* data,
   return Status::OK();
 }
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/memory.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/memory.h b/cpp/src/arrow/ipc/memory.h
index 0b4d834..e529603 100644
--- a/cpp/src/arrow/ipc/memory.h
+++ b/cpp/src/arrow/ipc/memory.h
@@ -52,8 +52,8 @@ class OutputStream {
 // memory map
 class BufferOutputStream : public OutputStream {
  public:
-  explicit BufferOutputStream(const std::shared_ptr<MutableBuffer>& buffer):
-      buffer_(buffer) {}
+  explicit BufferOutputStream(const std::shared_ptr<MutableBuffer>& buffer)
+      : buffer_(buffer) {}
 
   // Implement the OutputStream interface
   Status Close() override;
@@ -72,10 +72,7 @@ class BufferOutputStream : public OutputStream {
 class MemorySource {
  public:
   // Indicates the access permissions of the memory source
-  enum AccessMode {
-    READ_ONLY,
-    READ_WRITE
-  };
+  enum AccessMode { READ_ONLY, READ_WRITE };
 
   virtual ~MemorySource();
 
@@ -83,8 +80,8 @@ class MemorySource {
   // the indicated location
   // @returns: arrow::Status indicating success / failure. The buffer is set
   // into the *out argument
-  virtual Status ReadAt(int64_t position, int64_t nbytes,
-      std::shared_ptr<Buffer>* out) = 0;
+  virtual Status ReadAt(
+      int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out) = 0;
 
   virtual Status Close() = 0;
 
@@ -110,8 +107,7 @@ class MemoryMappedSource : public MemorySource {
 
   Status Close() override;
 
-  Status ReadAt(int64_t position, int64_t nbytes,
-      std::shared_ptr<Buffer>* out) override;
+  Status ReadAt(int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out) override;
 
   Status Write(int64_t position, const uint8_t* data, int64_t nbytes) override;
 
@@ -125,7 +121,7 @@ class MemoryMappedSource : public MemorySource {
   std::unique_ptr<Impl> impl_;
 };
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow
 
-#endif // ARROW_IPC_MEMORY_H
+#endif  // ARROW_IPC_MEMORY_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/metadata-internal.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc
index 14b1869..ad5951d 100644
--- a/cpp/src/arrow/ipc/metadata-internal.cc
+++ b/cpp/src/arrow/ipc/metadata-internal.cc
@@ -52,11 +52,12 @@ const std::shared_ptr<DataType> UINT64 = std::make_shared<UInt64Type>();
 const std::shared_ptr<DataType> FLOAT = std::make_shared<FloatType>();
 const std::shared_ptr<DataType> DOUBLE = std::make_shared<DoubleType>();
 
-static Status IntFromFlatbuffer(const flatbuf::Int* int_data,
-    std::shared_ptr<DataType>* out) {
+static Status IntFromFlatbuffer(
+    const flatbuf::Int* int_data, std::shared_ptr<DataType>* out) {
   if (int_data->bitWidth() % 8 != 0) {
     return Status::NotImplemented("Integers not in cstdint are not implemented");
-  } else if (int_data->bitWidth() > 64) {
+  }
+  if (int_data->bitWidth() > 64) {
     return Status::NotImplemented("Integers with more than 64 bits not implemented");
   }
 
@@ -80,8 +81,8 @@ static Status IntFromFlatbuffer(const flatbuf::Int* int_data,
   return Status::OK();
 }
 
-static Status FloatFromFlatuffer(const flatbuf::FloatingPoint* float_data,
-    std::shared_ptr<DataType>* out) {
+static Status FloatFromFlatuffer(
+    const flatbuf::FloatingPoint* float_data, std::shared_ptr<DataType>* out) {
   if (float_data->precision() == flatbuf::Precision_SINGLE) {
     *out = FLOAT;
   } else {
@@ -90,9 +91,8 @@ static Status FloatFromFlatuffer(const flatbuf::FloatingPoint* float_data,
   return Status::OK();
 }
 
-static Status TypeFromFlatbuffer(flatbuf::Type type,
-    const void* type_data, const std::vector<std::shared_ptr<Field>>& children,
-    std::shared_ptr<DataType>* out) {
+static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
+    const std::vector<std::shared_ptr<Field>>& children, std::shared_ptr<DataType>* out) {
   switch (type) {
     case flatbuf::Type_NONE:
       return Status::Invalid("Type metadata cannot be none");
@@ -101,8 +101,8 @@ static Status TypeFromFlatbuffer(flatbuf::Type type,
     case flatbuf::Type_Bit:
       return Status::NotImplemented("Type is not implemented");
     case flatbuf::Type_FloatingPoint:
-      return FloatFromFlatuffer(static_cast<const flatbuf::FloatingPoint*>(type_data),
-          out);
+      return FloatFromFlatuffer(
+          static_cast<const flatbuf::FloatingPoint*>(type_data), out);
     case flatbuf::Type_Binary:
     case flatbuf::Type_Utf8:
       return Status::NotImplemented("Type is not implemented");
@@ -128,16 +128,14 @@ static Status TypeFromFlatbuffer(flatbuf::Type type,
 }
 
 // Forward declaration
-static Status FieldToFlatbuffer(FBB& fbb, const std::shared_ptr<Field>& field,
-    FieldOffset* offset);
+static Status FieldToFlatbuffer(
+    FBB& fbb, const std::shared_ptr<Field>& field, FieldOffset* offset);
 
-static Offset IntToFlatbuffer(FBB& fbb, int bitWidth,
-    bool is_signed) {
+static Offset IntToFlatbuffer(FBB& fbb, int bitWidth, bool is_signed) {
   return flatbuf::CreateInt(fbb, bitWidth, is_signed).Union();
 }
 
-static Offset FloatToFlatbuffer(FBB& fbb,
-    flatbuf::Precision precision) {
+static Offset FloatToFlatbuffer(FBB& fbb, flatbuf::Precision precision) {
   return flatbuf::CreateFloatingPoint(fbb, precision).Union();
 }
 
@@ -166,10 +164,8 @@ static Status StructToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type
   *offset = IntToFlatbuffer(fbb, BIT_WIDTH, IS_SIGNED); \
   break;
 
-
 static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
-    std::vector<FieldOffset>* children,
-    flatbuf::Type* out_type, Offset* offset) {
+    std::vector<FieldOffset>* children, flatbuf::Type* out_type, Offset* offset) {
   switch (type->type) {
     case Type::BOOL:
       *out_type = flatbuf::Type_Bool;
@@ -206,16 +202,16 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
       *out_type = flatbuf::Type_Tuple;
       return StructToFlatbuffer(fbb, type, children, offset);
     default:
+      *out_type = flatbuf::Type_NONE;  // Make clang-tidy happy
       std::stringstream ss;
-      ss << "Unable to convert type: " << type->ToString()
-         << std::endl;
+      ss << "Unable to convert type: " << type->ToString() << std::endl;
       return Status::NotImplemented(ss.str());
   }
   return Status::OK();
 }
 
-static Status FieldToFlatbuffer(FBB& fbb, const std::shared_ptr<Field>& field,
-    FieldOffset* offset) {
+static Status FieldToFlatbuffer(
+    FBB& fbb, const std::shared_ptr<Field>& field, FieldOffset* offset) {
   auto fb_name = fbb.CreateString(field->name);
 
   flatbuf::Type type_enum;
@@ -225,14 +221,13 @@ static Status FieldToFlatbuffer(FBB& fbb, const std::shared_ptr<Field>& field,
   RETURN_NOT_OK(TypeToFlatbuffer(fbb, field->type, &children, &type_enum, &type_data));
   auto fb_children = fbb.CreateVector(children);
 
-  *offset = flatbuf::CreateField(fbb, fb_name, field->nullable, type_enum,
-      type_data, fb_children);
+  *offset = flatbuf::CreateField(
+      fbb, fb_name, field->nullable, type_enum, type_data, fb_children);
 
   return Status::OK();
 }
 
-Status FieldFromFlatbuffer(const flatbuf::Field* field,
-    std::shared_ptr<Field>* out) {
+Status FieldFromFlatbuffer(const flatbuf::Field* field, std::shared_ptr<Field>* out) {
   std::shared_ptr<DataType> type;
 
   auto children = field->children();
@@ -241,8 +236,8 @@ Status FieldFromFlatbuffer(const flatbuf::Field* field,
     RETURN_NOT_OK(FieldFromFlatbuffer(children->Get(i), &child_fields[i]));
   }
 
-  RETURN_NOT_OK(TypeFromFlatbuffer(field->type_type(),
-          field->type(), child_fields, &type));
+  RETURN_NOT_OK(
+      TypeFromFlatbuffer(field->type_type(), field->type(), child_fields, &type));
 
   *out = std::make_shared<Field>(field->name()->str(), type);
   return Status::OK();
@@ -270,19 +265,17 @@ Status MessageBuilder::SetRecordBatch(int32_t length, int64_t body_length,
     const std::vector<flatbuf::FieldNode>& nodes,
     const std::vector<flatbuf::Buffer>& buffers) {
   header_type_ = flatbuf::MessageHeader_RecordBatch;
-  header_ = flatbuf::CreateRecordBatch(fbb_, length,
-      fbb_.CreateVectorOfStructs(nodes),
-      fbb_.CreateVectorOfStructs(buffers)).Union();
+  header_ = flatbuf::CreateRecordBatch(fbb_, length, fbb_.CreateVectorOfStructs(nodes),
+                fbb_.CreateVectorOfStructs(buffers))
+                .Union();
   body_length_ = body_length;
 
   return Status::OK();
 }
 
-
 Status WriteDataHeader(int32_t length, int64_t body_length,
     const std::vector<flatbuf::FieldNode>& nodes,
-    const std::vector<flatbuf::Buffer>& buffers,
-    std::shared_ptr<Buffer>* out) {
+    const std::vector<flatbuf::Buffer>& buffers, std::shared_ptr<Buffer>* out) {
   MessageBuilder message;
   RETURN_NOT_OK(message.SetRecordBatch(length, body_length, nodes, buffers));
   RETURN_NOT_OK(message.Finish());
@@ -290,8 +283,7 @@ Status WriteDataHeader(int32_t length, int64_t body_length,
 }
 
 Status MessageBuilder::Finish() {
-  auto message = flatbuf::CreateMessage(fbb_, header_type_, header_,
-      body_length_);
+  auto message = flatbuf::CreateMessage(fbb_, header_type_, header_, body_length_);
   fbb_.Finish(message);
   return Status::OK();
 }
@@ -313,5 +305,5 @@ Status MessageBuilder::GetBuffer(std::shared_ptr<Buffer>* out) {
   return Status::OK();
 }
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/metadata-internal.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/metadata-internal.h b/cpp/src/arrow/ipc/metadata-internal.h
index f7365d2..779c5a3 100644
--- a/cpp/src/arrow/ipc/metadata-internal.h
+++ b/cpp/src/arrow/ipc/metadata-internal.h
@@ -36,8 +36,7 @@ class Status;
 
 namespace ipc {
 
-Status FieldFromFlatbuffer(const flatbuf::Field* field,
-    std::shared_ptr<Field>* out);
+Status FieldFromFlatbuffer(const flatbuf::Field* field, std::shared_ptr<Field>* out);
 
 class MessageBuilder {
  public:
@@ -60,10 +59,9 @@ class MessageBuilder {
 
 Status WriteDataHeader(int32_t length, int64_t body_length,
     const std::vector<flatbuf::FieldNode>& nodes,
-    const std::vector<flatbuf::Buffer>& buffers,
-    std::shared_ptr<Buffer>* out);
+    const std::vector<flatbuf::Buffer>& buffers, std::shared_ptr<Buffer>* out);
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow
 
-#endif // ARROW_IPC_METADATA_INTERNAL_H
+#endif  // ARROW_IPC_METADATA_INTERNAL_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/metadata.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/metadata.cc b/cpp/src/arrow/ipc/metadata.cc
index 642f21a..bcf104f 100644
--- a/cpp/src/arrow/ipc/metadata.cc
+++ b/cpp/src/arrow/ipc/metadata.cc
@@ -48,10 +48,8 @@ Status WriteSchema(const Schema* schema, std::shared_ptr<Buffer>* out) {
 
 class Message::Impl {
  public:
-  explicit Impl(const std::shared_ptr<Buffer>& buffer,
-      const flatbuf::Message* message) :
-      buffer_(buffer),
-      message_(message) {}
+  explicit Impl(const std::shared_ptr<Buffer>& buffer, const flatbuf::Message* message)
+      : buffer_(buffer), message_(message) {}
 
   Message::Type type() const {
     switch (message_->header_type()) {
@@ -66,13 +64,9 @@ class Message::Impl {
     }
   }
 
-  const void* header() const {
-    return message_->header();
-  }
+  const void* header() const { return message_->header(); }
 
-  int64_t body_length() const {
-    return message_->bodyLength();
-  }
+  int64_t body_length() const { return message_->bodyLength(); }
 
  private:
   // Owns the memory this message accesses
@@ -83,16 +77,12 @@ class Message::Impl {
 
 class SchemaMessage::Impl {
  public:
-  explicit Impl(const void* schema) :
-      schema_(static_cast<const flatbuf::Schema*>(schema)) {}
+  explicit Impl(const void* schema)
+      : schema_(static_cast<const flatbuf::Schema*>(schema)) {}
 
-  const flatbuf::Field* field(int i) const {
-    return schema_->fields()->Get(i);
-  }
+  const flatbuf::Field* field(int i) const { return schema_->fields()->Get(i); }
 
-  int num_fields() const {
-    return schema_->fields()->size();
-  }
+  int num_fields() const { return schema_->fields()->size(); }
 
  private:
   const flatbuf::Schema* schema_;
@@ -100,8 +90,8 @@ class SchemaMessage::Impl {
 
 Message::Message() {}
 
-Status Message::Open(const std::shared_ptr<Buffer>& buffer,
-    std::shared_ptr<Message>* out) {
+Status Message::Open(
+    const std::shared_ptr<Buffer>& buffer, std::shared_ptr<Message>* out) {
   std::shared_ptr<Message> result(new Message());
 
   // The buffer is prefixed by its size as int32_t
@@ -128,12 +118,11 @@ std::shared_ptr<Message> Message::get_shared_ptr() {
 }
 
 std::shared_ptr<SchemaMessage> Message::GetSchema() {
-  return std::make_shared<SchemaMessage>(this->shared_from_this(),
-      impl_->header());
+  return std::make_shared<SchemaMessage>(this->shared_from_this(), impl_->header());
 }
 
-SchemaMessage::SchemaMessage(const std::shared_ptr<Message>& message,
-    const void* schema) {
+SchemaMessage::SchemaMessage(
+    const std::shared_ptr<Message>& message, const void* schema) {
   message_ = message;
   impl_.reset(new Impl(schema));
 }
@@ -158,31 +147,21 @@ Status SchemaMessage::GetSchema(std::shared_ptr<Schema>* out) const {
 
 class RecordBatchMessage::Impl {
  public:
-  explicit Impl(const void* batch) :
-      batch_(static_cast<const flatbuf::RecordBatch*>(batch)) {
+  explicit Impl(const void* batch)
+      : batch_(static_cast<const flatbuf::RecordBatch*>(batch)) {
     nodes_ = batch_->nodes();
     buffers_ = batch_->buffers();
   }
 
-  const flatbuf::FieldNode* field(int i) const {
-    return nodes_->Get(i);
-  }
+  const flatbuf::FieldNode* field(int i) const { return nodes_->Get(i); }
 
-  const flatbuf::Buffer* buffer(int i) const {
-    return buffers_->Get(i);
-  }
+  const flatbuf::Buffer* buffer(int i) const { return buffers_->Get(i); }
 
-  int32_t length() const {
-    return batch_->length();
-  }
+  int32_t length() const { return batch_->length(); }
 
-  int num_buffers() const {
-    return batch_->buffers()->size();
-  }
+  int num_buffers() const { return batch_->buffers()->size(); }
 
-  int num_fields() const {
-    return batch_->nodes()->size();
-  }
+  int num_fields() const { return batch_->nodes()->size(); }
 
  private:
   const flatbuf::RecordBatch* batch_;
@@ -191,12 +170,11 @@ class RecordBatchMessage::Impl {
 };
 
 std::shared_ptr<RecordBatchMessage> Message::GetRecordBatch() {
-  return std::make_shared<RecordBatchMessage>(this->shared_from_this(),
-      impl_->header());
+  return std::make_shared<RecordBatchMessage>(this->shared_from_this(), impl_->header());
 }
 
-RecordBatchMessage::RecordBatchMessage(const std::shared_ptr<Message>& message,
-    const void* batch) {
+RecordBatchMessage::RecordBatchMessage(
+    const std::shared_ptr<Message>& message, const void* batch) {
   message_ = message;
   impl_.reset(new Impl(batch));
 }
@@ -234,5 +212,5 @@ int RecordBatchMessage::num_fields() const {
   return impl_->num_fields();
 }
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/metadata.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/metadata.h b/cpp/src/arrow/ipc/metadata.h
index c728852..838a4a6 100644
--- a/cpp/src/arrow/ipc/metadata.h
+++ b/cpp/src/arrow/ipc/metadata.h
@@ -85,8 +85,7 @@ struct BufferMetadata {
 class RecordBatchMessage {
  public:
   // Accepts an opaque flatbuffer pointer
-  RecordBatchMessage(const std::shared_ptr<Message>& message,
-      const void* batch_meta);
+  RecordBatchMessage(const std::shared_ptr<Message>& message, const void* batch_meta);
 
   FieldMetadata field(int i) const;
   BufferMetadata buffer(int i) const;
@@ -111,15 +110,10 @@ class DictionaryBatchMessage {
 
 class Message : public std::enable_shared_from_this<Message> {
  public:
-  enum Type {
-    NONE,
-    SCHEMA,
-    DICTIONARY_BATCH,
-    RECORD_BATCH
-  };
+  enum Type { NONE, SCHEMA, DICTIONARY_BATCH, RECORD_BATCH };
 
-  static Status Open(const std::shared_ptr<Buffer>& buffer,
-    std::shared_ptr<Message>* out);
+  static Status Open(
+      const std::shared_ptr<Buffer>& buffer, std::shared_ptr<Message>* out);
 
   std::shared_ptr<Message> get_shared_ptr();
 
@@ -140,7 +134,7 @@ class Message : public std::enable_shared_from_this<Message> {
   std::unique_ptr<Impl> impl_;
 };
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow
 
-#endif // ARROW_IPC_METADATA_H
+#endif  // ARROW_IPC_METADATA_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/ipc/test-common.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/test-common.h b/cpp/src/arrow/ipc/test-common.h
index 0fccce9..65c837d 100644
--- a/cpp/src/arrow/ipc/test-common.h
+++ b/cpp/src/arrow/ipc/test-common.h
@@ -36,9 +36,7 @@ class MemoryMapFixture {
 
   void CreateFile(const std::string path, int64_t size) {
     FILE* file = fopen(path.c_str(), "w");
-    if (file != nullptr) {
-      tmp_files_.push_back(path);
-    }
+    if (file != nullptr) { tmp_files_.push_back(path); }
     ftruncate(fileno(file), size);
     fclose(file);
   }
@@ -47,7 +45,7 @@ class MemoryMapFixture {
   std::vector<std::string> tmp_files_;
 };
 
-} // namespace ipc
-} // namespace arrow
+}  // namespace ipc
+}  // namespace arrow
 
-#endif // ARROW_IPC_TEST_COMMON_H
+#endif  // ARROW_IPC_TEST_COMMON_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/parquet/parquet-schema-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/parquet/parquet-schema-test.cc b/cpp/src/arrow/parquet/parquet-schema-test.cc
index a289ddb..e2280f4 100644
--- a/cpp/src/arrow/parquet/parquet-schema-test.cc
+++ b/cpp/src/arrow/parquet/parquet-schema-test.cc
@@ -45,8 +45,7 @@ const auto INT64 = std::make_shared<Int64Type>();
 const auto FLOAT = std::make_shared<FloatType>();
 const auto DOUBLE = std::make_shared<DoubleType>();
 const auto UTF8 = std::make_shared<StringType>();
-const auto BINARY = std::make_shared<ListType>(
-    std::make_shared<Field>("", UINT8));
+const auto BINARY = std::make_shared<ListType>(std::make_shared<Field>("", UINT8));
 const auto DECIMAL_8_4 = std::make_shared<DecimalType>(8, 4);
 
 class TestConvertParquetSchema : public ::testing::Test {
@@ -58,8 +57,8 @@ class TestConvertParquetSchema : public ::testing::Test {
     for (int i = 0; i < expected_schema->num_fields(); ++i) {
       auto lhs = result_schema_->field(i);
       auto rhs = expected_schema->field(i);
-      EXPECT_TRUE(lhs->Equals(rhs))
-        << i << " " << lhs->ToString() << " != " << rhs->ToString();
+      EXPECT_TRUE(lhs->Equals(rhs)) << i << " " << lhs->ToString()
+                                    << " != " << rhs->ToString();
     }
   }
 
@@ -99,20 +98,15 @@ TEST_F(TestConvertParquetSchema, ParquetFlatPrimitives) {
   arrow_fields.push_back(std::make_shared<Field>("double", DOUBLE));
 
   parquet_fields.push_back(
-      PrimitiveNode::Make("binary", Repetition::OPTIONAL,
-          ParquetType::BYTE_ARRAY));
+      PrimitiveNode::Make("binary", Repetition::OPTIONAL, ParquetType::BYTE_ARRAY));
   arrow_fields.push_back(std::make_shared<Field>("binary", BINARY));
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("string", Repetition::OPTIONAL,
-          ParquetType::BYTE_ARRAY,
-          LogicalType::UTF8));
+  parquet_fields.push_back(PrimitiveNode::Make(
+      "string", Repetition::OPTIONAL, ParquetType::BYTE_ARRAY, LogicalType::UTF8));
   arrow_fields.push_back(std::make_shared<Field>("string", UTF8));
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("flba-binary", Repetition::OPTIONAL,
-          ParquetType::FIXED_LEN_BYTE_ARRAY,
-          LogicalType::NONE, 12));
+  parquet_fields.push_back(PrimitiveNode::Make("flba-binary", Repetition::OPTIONAL,
+      ParquetType::FIXED_LEN_BYTE_ARRAY, LogicalType::NONE, 12));
   arrow_fields.push_back(std::make_shared<Field>("flba-binary", BINARY));
 
   auto arrow_schema = std::make_shared<Schema>(arrow_fields);
@@ -125,28 +119,20 @@ TEST_F(TestConvertParquetSchema, ParquetFlatDecimals) {
   std::vector<NodePtr> parquet_fields;
   std::vector<std::shared_ptr<Field>> arrow_fields;
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("flba-decimal", Repetition::OPTIONAL,
-          ParquetType::FIXED_LEN_BYTE_ARRAY,
-          LogicalType::DECIMAL, 4, 8, 4));
+  parquet_fields.push_back(PrimitiveNode::Make("flba-decimal", Repetition::OPTIONAL,
+      ParquetType::FIXED_LEN_BYTE_ARRAY, LogicalType::DECIMAL, 4, 8, 4));
   arrow_fields.push_back(std::make_shared<Field>("flba-decimal", DECIMAL_8_4));
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("binary-decimal", Repetition::OPTIONAL,
-          ParquetType::BYTE_ARRAY,
-          LogicalType::DECIMAL, -1, 8, 4));
+  parquet_fields.push_back(PrimitiveNode::Make("binary-decimal", Repetition::OPTIONAL,
+      ParquetType::BYTE_ARRAY, LogicalType::DECIMAL, -1, 8, 4));
   arrow_fields.push_back(std::make_shared<Field>("binary-decimal", DECIMAL_8_4));
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("int32-decimal", Repetition::OPTIONAL,
-          ParquetType::INT32,
-          LogicalType::DECIMAL, -1, 8, 4));
+  parquet_fields.push_back(PrimitiveNode::Make("int32-decimal", Repetition::OPTIONAL,
+      ParquetType::INT32, LogicalType::DECIMAL, -1, 8, 4));
   arrow_fields.push_back(std::make_shared<Field>("int32-decimal", DECIMAL_8_4));
 
-  parquet_fields.push_back(
-      PrimitiveNode::Make("int64-decimal", Repetition::OPTIONAL,
-          ParquetType::INT64,
-          LogicalType::DECIMAL, -1, 8, 4));
+  parquet_fields.push_back(PrimitiveNode::Make("int64-decimal", Repetition::OPTIONAL,
+      ParquetType::INT64, LogicalType::DECIMAL, -1, 8, 4));
   arrow_fields.push_back(std::make_shared<Field>("int64-decimal", DECIMAL_8_4));
 
   auto arrow_schema = std::make_shared<Schema>(arrow_fields);
@@ -164,22 +150,19 @@ TEST_F(TestConvertParquetSchema, UnsupportedThings) {
   unsupported_nodes.push_back(
       GroupNode::Make("repeated-group", Repetition::REPEATED, {}));
 
-  unsupported_nodes.push_back(
-      PrimitiveNode::Make("int32", Repetition::OPTIONAL,
-          ParquetType::INT32, LogicalType::DATE));
+  unsupported_nodes.push_back(PrimitiveNode::Make(
+      "int32", Repetition::OPTIONAL, ParquetType::INT32, LogicalType::DATE));
 
-  unsupported_nodes.push_back(
-      PrimitiveNode::Make("int64", Repetition::OPTIONAL,
-          ParquetType::INT64, LogicalType::TIMESTAMP_MILLIS));
+  unsupported_nodes.push_back(PrimitiveNode::Make(
+      "int64", Repetition::OPTIONAL, ParquetType::INT64, LogicalType::TIMESTAMP_MILLIS));
 
   for (const NodePtr& node : unsupported_nodes) {
     ASSERT_RAISES(NotImplemented, ConvertSchema({node}));
   }
 }
 
-TEST(TestNodeConversion, DateAndTime) {
-}
+TEST(TestNodeConversion, DateAndTime) {}
 
-} // namespace parquet
+}  // namespace parquet
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/parquet/schema.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/parquet/schema.cc b/cpp/src/arrow/parquet/schema.cc
index 14f4f5b..066388b 100644
--- a/cpp/src/arrow/parquet/schema.cc
+++ b/cpp/src/arrow/parquet/schema.cc
@@ -43,8 +43,7 @@ const auto INT64 = std::make_shared<Int64Type>();
 const auto FLOAT = std::make_shared<FloatType>();
 const auto DOUBLE = std::make_shared<DoubleType>();
 const auto UTF8 = std::make_shared<StringType>();
-const auto BINARY = std::make_shared<ListType>(
-    std::make_shared<Field>("", UINT8));
+const auto BINARY = std::make_shared<ListType>(std::make_shared<Field>("", UINT8));
 
 TypePtr MakeDecimalType(const PrimitiveNode* node) {
   int precision = node->decimal_metadata().precision;
@@ -167,12 +166,12 @@ Status NodeToField(const NodePtr& node, std::shared_ptr<Field>* out) {
   return Status::OK();
 }
 
-Status FromParquetSchema(const ::parquet::SchemaDescriptor* parquet_schema,
-    std::shared_ptr<Schema>* out) {
+Status FromParquetSchema(
+    const ::parquet::SchemaDescriptor* parquet_schema, std::shared_ptr<Schema>* out) {
   // TODO(wesm): Consider adding an arrow::Schema name attribute, which comes
   // from the root Parquet node
-  const GroupNode* schema_node = static_cast<const GroupNode*>(
-      parquet_schema->schema().get());
+  const GroupNode* schema_node =
+      static_cast<const GroupNode*>(parquet_schema->schema().get());
 
   std::vector<std::shared_ptr<Field>> fields(schema_node->field_count());
   for (int i = 0; i < schema_node->field_count(); i++) {
@@ -183,6 +182,6 @@ Status FromParquetSchema(const ::parquet::SchemaDescriptor* parquet_schema,
   return Status::OK();
 }
 
-} // namespace parquet
+}  // namespace parquet
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/parquet/schema.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/parquet/schema.h b/cpp/src/arrow/parquet/schema.h
index a840897..a44a9a4 100644
--- a/cpp/src/arrow/parquet/schema.h
+++ b/cpp/src/arrow/parquet/schema.h
@@ -31,14 +31,13 @@ class Status;
 
 namespace parquet {
 
-Status NodeToField(const ::parquet::schema::NodePtr& node,
-    std::shared_ptr<Field>* out);
+Status NodeToField(const ::parquet::schema::NodePtr& node, std::shared_ptr<Field>* out);
 
-Status FromParquetSchema(const ::parquet::SchemaDescriptor* parquet_schema,
-    std::shared_ptr<Schema>* out);
+Status FromParquetSchema(
+    const ::parquet::SchemaDescriptor* parquet_schema, std::shared_ptr<Schema>* out);
 
-} // namespace parquet
+}  // namespace parquet
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/schema-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/schema-test.cc b/cpp/src/arrow/schema-test.cc
index a1de1dc..8cc80be 100644
--- a/cpp/src/arrow/schema-test.cc
+++ b/cpp/src/arrow/schema-test.cc
@@ -86,8 +86,8 @@ TEST_F(TestSchema, ToString) {
   auto f0 = std::make_shared<Field>("f0", INT32);
   auto f1 = std::make_shared<Field>("f1", std::make_shared<UInt8Type>(), false);
   auto f2 = std::make_shared<Field>("f2", std::make_shared<StringType>());
-  auto f3 = std::make_shared<Field>("f3",
-      std::make_shared<ListType>(std::make_shared<Int16Type>()));
+  auto f3 = std::make_shared<Field>(
+      "f3", std::make_shared<ListType>(std::make_shared<Int16Type>()));
 
   vector<shared_ptr<Field>> fields = {f0, f1, f2, f3};
   auto schema = std::make_shared<Schema>(fields);
@@ -101,4 +101,4 @@ f3: list<item: int16>)";
   ASSERT_EQ(expected, result);
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/schema.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/schema.cc b/cpp/src/arrow/schema.cc
index 18aad0e..a38acaa 100644
--- a/cpp/src/arrow/schema.cc
+++ b/cpp/src/arrow/schema.cc
@@ -26,18 +26,14 @@
 
 namespace arrow {
 
-Schema::Schema(const std::vector<std::shared_ptr<Field>>& fields) :
-    fields_(fields) {}
+Schema::Schema(const std::vector<std::shared_ptr<Field>>& fields) : fields_(fields) {}
 
 bool Schema::Equals(const Schema& other) const {
-  if (this == &other) return true;
-  if (num_fields() != other.num_fields()) {
-    return false;
-  }
+  if (this == &other) { return true; }
+
+  if (num_fields() != other.num_fields()) { return false; }
   for (int i = 0; i < num_fields(); ++i) {
-    if (!field(i)->Equals(*other.field(i).get())) {
-      return false;
-    }
+    if (!field(i)->Equals(*other.field(i).get())) { return false; }
   }
   return true;
 }
@@ -51,13 +47,11 @@ std::string Schema::ToString() const {
 
   int i = 0;
   for (auto field : fields_) {
-    if (i > 0) {
-      buffer << std::endl;
-    }
+    if (i > 0) { buffer << std::endl; }
     buffer << field->ToString();
     ++i;
   }
   return buffer.str();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/schema.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/schema.h b/cpp/src/arrow/schema.h
index 52f3c1c..a8b0d84 100644
--- a/cpp/src/arrow/schema.h
+++ b/cpp/src/arrow/schema.h
@@ -35,21 +35,17 @@ class Schema {
   bool Equals(const std::shared_ptr<Schema>& other) const;
 
   // Return the ith schema element. Does not boundscheck
-  const std::shared_ptr<Field>& field(int i) const {
-    return fields_[i];
-  }
+  const std::shared_ptr<Field>& field(int i) const { return fields_[i]; }
 
   // Render a string representation of the schema suitable for debugging
   std::string ToString() const;
 
-  int num_fields() const {
-    return fields_.size();
-  }
+  int num_fields() const { return fields_.size(); }
 
  private:
   std::vector<std::shared_ptr<Field>> fields_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_FIELD_H

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/table-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/table-test.cc b/cpp/src/arrow/table-test.cc
index 4c7b8f8..385e7d8 100644
--- a/cpp/src/arrow/table-test.cc
+++ b/cpp/src/arrow/table-test.cc
@@ -49,10 +49,9 @@ class TestTable : public TestBase {
     schema_ = std::make_shared<Schema>(fields);
 
     columns_ = {
-      std::make_shared<Column>(schema_->field(0), MakePrimitive<Int32Array>(length)),
-      std::make_shared<Column>(schema_->field(1), MakePrimitive<UInt8Array>(length)),
-      std::make_shared<Column>(schema_->field(2), MakePrimitive<Int16Array>(length))
-    };
+        std::make_shared<Column>(schema_->field(0), MakePrimitive<Int32Array>(length)),
+        std::make_shared<Column>(schema_->field(1), MakePrimitive<UInt8Array>(length)),
+        std::make_shared<Column>(schema_->field(2), MakePrimitive<Int16Array>(length))};
   }
 
  protected:
@@ -116,13 +115,12 @@ TEST_F(TestTable, InvalidColumns) {
   ASSERT_RAISES(Invalid, table_->ValidateColumns());
 
   columns_ = {
-    std::make_shared<Column>(schema_->field(0), MakePrimitive<Int32Array>(length)),
-    std::make_shared<Column>(schema_->field(1), MakePrimitive<UInt8Array>(length)),
-    std::make_shared<Column>(schema_->field(2), MakePrimitive<Int16Array>(length - 1))
-  };
+      std::make_shared<Column>(schema_->field(0), MakePrimitive<Int32Array>(length)),
+      std::make_shared<Column>(schema_->field(1), MakePrimitive<UInt8Array>(length)),
+      std::make_shared<Column>(schema_->field(2), MakePrimitive<Int16Array>(length - 1))};
 
   table_.reset(new Table("data", schema_, columns_, length));
   ASSERT_RAISES(Invalid, table_->ValidateColumns());
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/table.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/table.cc b/cpp/src/arrow/table.cc
index e405c1d..d9573ea 100644
--- a/cpp/src/arrow/table.cc
+++ b/cpp/src/arrow/table.cc
@@ -28,20 +28,16 @@
 namespace arrow {
 
 RowBatch::RowBatch(const std::shared_ptr<Schema>& schema, int num_rows,
-    const std::vector<std::shared_ptr<Array>>& columns) :
-    schema_(schema),
-    num_rows_(num_rows),
-    columns_(columns) {}
+    const std::vector<std::shared_ptr<Array>>& columns)
+    : schema_(schema), num_rows_(num_rows), columns_(columns) {}
 
 const std::string& RowBatch::column_name(int i) const {
   return schema_->field(i)->name;
 }
 
 Table::Table(const std::string& name, const std::shared_ptr<Schema>& schema,
-    const std::vector<std::shared_ptr<Column>>& columns) :
-    name_(name),
-    schema_(schema),
-    columns_(columns) {
+    const std::vector<std::shared_ptr<Column>>& columns)
+    : name_(name), schema_(schema), columns_(columns) {
   if (columns.size() == 0) {
     num_rows_ = 0;
   } else {
@@ -50,11 +46,8 @@ Table::Table(const std::string& name, const std::shared_ptr<Schema>& schema,
 }
 
 Table::Table(const std::string& name, const std::shared_ptr<Schema>& schema,
-    const std::vector<std::shared_ptr<Column>>& columns, int64_t num_rows) :
-    name_(name),
-    schema_(schema),
-    columns_(columns),
-    num_rows_(num_rows) {}
+    const std::vector<std::shared_ptr<Column>>& columns, int64_t num_rows)
+    : name_(name), schema_(schema), columns_(columns), num_rows_(num_rows) {}
 
 Status Table::ValidateColumns() const {
   if (num_columns() != schema_->num_fields()) {
@@ -66,21 +59,17 @@ Status Table::ValidateColumns() const {
     const Column* col = columns_[i].get();
     if (col == nullptr) {
       std::stringstream ss;
-      ss << "Column " << i << " named " << col->name()
-         << " was null";
+      ss << "Column " << i << " was null";
       return Status::Invalid(ss.str());
     }
     if (col->length() != num_rows_) {
       std::stringstream ss;
-      ss << "Column " << i << " named " << col->name()
-         << " expected length "
-         << num_rows_
-         << " but got length "
-         << col->length();
+      ss << "Column " << i << " named " << col->name() << " expected length " << num_rows_
+         << " but got length " << col->length();
       return Status::Invalid(ss.str());
     }
   }
   return Status::OK();
 }
 
-} // namespace arrow
+}  // namespace arrow

http://git-wip-us.apache.org/repos/asf/arrow/blob/5d129991/cpp/src/arrow/table.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/table.h b/cpp/src/arrow/table.h
index e2f73a2..756b2a1 100644
--- a/cpp/src/arrow/table.h
+++ b/cpp/src/arrow/table.h
@@ -42,27 +42,19 @@ class RowBatch {
       const std::vector<std::shared_ptr<Array>>& columns);
 
   // @returns: the table's schema
-  const std::shared_ptr<Schema>& schema() const {
-    return schema_;
-  }
+  const std::shared_ptr<Schema>& schema() const { return schema_; }
 
   // @returns: the i-th column
   // Note: Does not boundscheck
-  const std::shared_ptr<Array>& column(int i) const {
-    return columns_[i];
-  }
+  const std::shared_ptr<Array>& column(int i) const { return columns_[i]; }
 
   const std::string& column_name(int i) const;
 
   // @returns: the number of columns in the table
-  int num_columns() const {
-    return columns_.size();
-  }
+  int num_columns() const { return columns_.size(); }
 
   // @returns: the number of rows (the corresponding length of each column)
-  int64_t num_rows() const {
-    return num_rows_;
-  }
+  int64_t num_rows() const { return num_rows_; }
 
  private:
   std::shared_ptr<Schema> schema_;
@@ -85,30 +77,20 @@ class Table {
       const std::vector<std::shared_ptr<Column>>& columns, int64_t num_rows);
 
   // @returns: the table's name, if any (may be length 0)
-  const std::string& name() const {
-    return name_;
-  }
+  const std::string& name() const { return name_; }
 
   // @returns: the table's schema
-  const std::shared_ptr<Schema>& schema() const {
-    return schema_;
-  }
+  const std::shared_ptr<Schema>& schema() const { return schema_; }
 
   // Note: Does not boundscheck
   // @returns: the i-th column
-  const std::shared_ptr<Column>& column(int i) const {
-    return columns_[i];
-  }
+  const std::shared_ptr<Column>& column(int i) const { return columns_[i]; }
 
   // @returns: the number of columns in the table
-  int num_columns() const {
-    return columns_.size();
-  }
+  int num_columns() const { return columns_.size(); }
 
   // @returns: the number of rows (the corresponding length of each column)
-  int64_t num_rows() const {
-    return num_rows_;
-  }
+  int64_t num_rows() const { return num_rows_; }
 
   // After construction, perform any checks to validate the input arguments
   Status ValidateColumns() const;
@@ -123,6 +105,6 @@ class Table {
   int64_t num_rows_;
 };
 
-} // namespace arrow
+}  // namespace arrow
 
 #endif  // ARROW_TABLE_H


Mime
View raw message