From 8eaf1e7613dbe16a0f879fa6a4e890210f99964b Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Tue, 9 Aug 2016 21:25:24 +0000 Subject: [PATCH 1/7] fix formatting --- cpp/src/arrow/util/memory-pool-test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/util/memory-pool-test.cc b/cpp/src/arrow/util/memory-pool-test.cc index 919f3740982..deb7ffd03ba 100644 --- a/cpp/src/arrow/util/memory-pool-test.cc +++ b/cpp/src/arrow/util/memory-pool-test.cc @@ -54,7 +54,7 @@ TEST(DefaultMemoryPoolDeathTest, FreeLargeMemory) { #ifndef NDEBUG EXPECT_EXIT(pool->Free(data, 120), ::testing::ExitedWithCode(1), - ".*Check failed: \\(bytes_allocated_\\) >= \\(size\\)"); + ".*Check failed: \\(bytes_allocated_\\) >= \\(size\\)"); #endif pool->Free(data, 100); From 3e01e7fc3a69c20d2a9c1bf6f2f61df2d29fcab5 Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Thu, 11 Aug 2016 18:28:31 +0000 Subject: [PATCH 2/7] Implement struct round-trip. Fix unit test for non null to have consistent batch sizes --- cpp/src/arrow/ipc/adapter.cc | 22 ++++++++++++-- cpp/src/arrow/ipc/ipc-adapter-test.cc | 41 +++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/cpp/src/arrow/ipc/adapter.cc b/cpp/src/arrow/ipc/adapter.cc index 84f7830092c..8b52ec813ab 100644 --- a/cpp/src/arrow/ipc/adapter.cc +++ b/cpp/src/arrow/ipc/adapter.cc @@ -34,6 +34,7 @@ #include "arrow/types/list.h" #include "arrow/types/primitive.h" #include "arrow/types/string.h" +#include "arrow/types/struct.h" #include "arrow/util/buffer.h" #include "arrow/util/logging.h" #include "arrow/util/status.h" @@ -118,8 +119,10 @@ Status VisitArray(const Array* arr, std::vector* field_nodes RETURN_NOT_OK(VisitArray( list_arr->values().get(), field_nodes, buffers, max_recursion_depth - 1)); } else if (arr->type_enum() == Type::STRUCT) { - // TODO(wesm) - return Status::NotImplemented("Struct type"); + const auto struct_arr = static_cast(arr); + for (auto& field : struct_arr->fields()) { + RETURN_NOT_OK(VisitArray(field.get(), field_nodes, buffers, max_recursion_depth - 1)); + } } else { return Status::NotImplemented("Unrecognized type"); } @@ -313,6 +316,21 @@ class RowBatchReader::Impl { return MakeListArray(type, field_meta.length, offsets, values_array, field_meta.null_count, null_bitmap, out); } + + if (type->type == Type::STRUCT) { + const int num_children = type->num_children(); + std::vector fields; + fields.reserve(num_children); + for (int child_idx = 0; child_idx < num_children; ++child_idx) { + std::shared_ptr field_array; + RETURN_NOT_OK( + NextArray(type->child(child_idx).get(), max_recursion_depth - 1, &field_array)); + fields.push_back(field_array); + } + out->reset(new StructArray(type, field_meta.length, fields, field_meta.null_count, null_bitmap)); + return Status::OK(); + } + return Status::NotImplemented("Non-primitive types not complete yet"); } diff --git a/cpp/src/arrow/ipc/ipc-adapter-test.cc b/cpp/src/arrow/ipc/ipc-adapter-test.cc index 2bfb459d6e0..888f38e99ad 100644 --- a/cpp/src/arrow/ipc/ipc-adapter-test.cc +++ b/cpp/src/arrow/ipc/ipc-adapter-test.cc @@ -32,6 +32,7 @@ #include "arrow/types/list.h" #include "arrow/types/primitive.h" #include "arrow/types/string.h" +#include "arrow/types/struct.h" #include "arrow/util/bit-util.h" #include "arrow/util/buffer.h" #include "arrow/util/memory-pool.h" @@ -205,15 +206,15 @@ Status MakeNonNullRowBatch(std::shared_ptr* out) { // Example data MemoryPool* pool = default_memory_pool(); - const int length = 200; + const int length = 50; std::shared_ptr leaf_values, list_array, list_list_array, flat_array; RETURN_NOT_OK(MakeRandomInt32Array(1000, true, pool, &leaf_values)); bool include_nulls = false; - RETURN_NOT_OK(MakeRandomListArray(leaf_values, 50, include_nulls, pool, &list_array)); + RETURN_NOT_OK(MakeRandomListArray(leaf_values, length, include_nulls, pool, &list_array)); RETURN_NOT_OK( - MakeRandomListArray(list_array, 50, include_nulls, pool, &list_list_array)); - RETURN_NOT_OK(MakeRandomInt32Array(0, include_nulls, pool, &flat_array)); + MakeRandomListArray(list_array, length, include_nulls, pool, &list_list_array)); + RETURN_NOT_OK(MakeRandomInt32Array(length, include_nulls, pool, &flat_array)); out->reset(new RowBatch(schema, length, {list_array, list_list_array, flat_array})); return Status::OK(); } @@ -238,10 +239,40 @@ Status MakeDeeplyNestedList(std::shared_ptr* out) { return Status::OK(); } +Status MakeStruct(std::shared_ptr* out) { + // reuse constructed list columns + std::shared_ptr list_batch; + RETURN_NOT_OK(MakeListRowBatch(&list_batch)); + std::vector columns = {list_batch->column(0), list_batch->column(1), list_batch->column(2)}; + auto list_schema = list_batch->schema(); + + // Define schema + std::shared_ptr type(new StructType({list_schema->field(0), + list_schema->field(1), list_schema->field(2)})); + auto f0 = std::make_shared("non_null_struct", type); + auto f1 = std::make_shared("null_struct", type); + std::shared_ptr schema(new Schema({f0, f1})); + + + // construct individual nullable/non-nullable struct arrays + ArrayPtr no_nulls(new StructArray(type, list_batch->num_rows(), columns)); + std::vector null_bytes(list_batch->num_rows(), 1); + null_bytes[0] = 0; + std::shared_ptr null_bitmask; + RETURN_NOT_OK(util::bytes_to_bits(null_bytes, &null_bitmask)); + ArrayPtr with_nulls(new StructArray(type, list_batch->num_rows(), columns, 1, null_bitmask)); + + // construct batch + std::vector arrays = {no_nulls, with_nulls}; + out->reset(new RowBatch(schema, list_batch->num_rows(), arrays)); + return Status::OK(); +} + INSTANTIATE_TEST_CASE_P( RoundTripTests, TestWriteRowBatch, ::testing::Values(&MakeIntRowBatch, &MakeListRowBatch, &MakeNonNullRowBatch, - &MakeZeroLengthRowBatch, &MakeDeeplyNestedList, &MakeStringTypesRowBatch)); + &MakeZeroLengthRowBatch, &MakeDeeplyNestedList, &MakeStringTypesRowBatch, + &MakeStruct)); void TestGetRowBatchSize(std::shared_ptr batch) { MockMemorySource mock_source(1 << 16); From 9aa972bc70edf9837cf955b861c513282907fcce Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Sat, 13 Aug 2016 04:00:13 +0000 Subject: [PATCH 3/7] change macro to templates instead (makes debugging easier) --- cpp/src/arrow/types/primitive.h | 76 +++++++++++++++++---------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h index 18f954adc08..59100608fdc 100644 --- a/cpp/src/arrow/types/primitive.h +++ b/cpp/src/arrow/types/primitive.h @@ -53,43 +53,45 @@ class ARROW_EXPORT PrimitiveArray : public Array { const uint8_t* raw_data_; }; -#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) \ - class ARROW_EXPORT NAME : public PrimitiveArray { \ - public: \ - using value_type = T; \ - \ - NAME(int32_t length, const std::shared_ptr& data, int32_t null_count = 0, \ - const std::shared_ptr& null_bitmap = nullptr) \ - : PrimitiveArray( \ - std::make_shared(), length, data, null_count, null_bitmap) {} \ - NAME(const TypePtr& type, int32_t length, const std::shared_ptr& data, \ - int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) \ - : PrimitiveArray(type, length, data, null_count, null_bitmap) {} \ - \ - bool EqualsExact(const NAME& other) const { \ - return PrimitiveArray::EqualsExact(*static_cast(&other)); \ - } \ - \ - bool RangeEquals(int32_t start_idx, int32_t end_idx, int32_t other_start_idx, \ - const ArrayPtr& arr) const override { \ - if (this == arr.get()) { return true; } \ - if (!arr) { return false; } \ - if (this->type_enum() != arr->type_enum()) { return false; } \ - const auto other = static_cast(arr.get()); \ - for (int32_t i = start_idx, o_i = other_start_idx; i < end_idx; ++i, ++o_i) { \ - const bool is_null = IsNull(i); \ - if (is_null != arr->IsNull(o_i) || \ - (!is_null && Value(i) != other->Value(o_i))) { \ - return false; \ - } \ - } \ - return true; \ - } \ - \ - const T* raw_data() const { return reinterpret_cast(raw_data_); } \ - \ - T Value(int i) const { return raw_data()[i]; } \ - }; + +template +class ARROW_EXPORT NumericArray : public PrimitiveArray { + public: + using value_type = T; + NumericArray(int32_t length, const std::shared_ptr& data, int32_t null_count = 0, + const std::shared_ptr& null_bitmap = nullptr) + : PrimitiveArray( + std::make_shared(), length, data, null_count, null_bitmap) {} + NumericArray(const TypePtr& type, int32_t length, const std::shared_ptr& data, + int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) + : PrimitiveArray(type, length, data, null_count, null_bitmap) {} + + bool EqualsExact(const NumericArray& other) const { + return PrimitiveArray::EqualsExact(*static_cast(&other)); + } + + bool RangeEquals(int32_t start_idx, int32_t end_idx, int32_t other_start_idx, + const ArrayPtr& arr) const override { + if (this == arr.get()) { return true; } + if (!arr) { return false; } + if (this->type_enum() != arr->type_enum()) { return false; } + const auto other = static_cast*>(arr.get()); + for (int32_t i = start_idx, o_i = other_start_idx; i < end_idx; ++i, ++o_i) { + const bool is_null = IsNull(i); + if (is_null != arr->IsNull(o_i) || + (!is_null && Value(i) != other->Value(o_i))) { + return false; + } + } + return true; + } + const T* raw_data() const { return reinterpret_cast(raw_data_); } + + T Value(int i) const { return raw_data()[i]; } +}; + +#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) \ + using NAME = NumericArray; NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type, uint8_t); NUMERIC_ARRAY_DECL(Int8Array, Int8Type, int8_t); From fc63bffdc613d3109f0cca38ca5a39ea22a58e45 Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Sat, 13 Aug 2016 04:03:01 +0000 Subject: [PATCH 4/7] make lint and make format --- cpp/src/arrow/ipc/adapter.cc | 24 +++++++++++++----------- cpp/src/arrow/ipc/ipc-adapter-test.cc | 21 +++++++++++---------- cpp/src/arrow/types/primitive.h | 17 +++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/cpp/src/arrow/ipc/adapter.cc b/cpp/src/arrow/ipc/adapter.cc index 8b52ec813ab..3259980058b 100644 --- a/cpp/src/arrow/ipc/adapter.cc +++ b/cpp/src/arrow/ipc/adapter.cc @@ -121,7 +121,8 @@ Status VisitArray(const Array* arr, std::vector* field_nodes } else if (arr->type_enum() == Type::STRUCT) { const auto struct_arr = static_cast(arr); for (auto& field : struct_arr->fields()) { - RETURN_NOT_OK(VisitArray(field.get(), field_nodes, buffers, max_recursion_depth - 1)); + RETURN_NOT_OK( + VisitArray(field.get(), field_nodes, buffers, max_recursion_depth - 1)); } } else { return Status::NotImplemented("Unrecognized type"); @@ -318,17 +319,18 @@ class RowBatchReader::Impl { } if (type->type == Type::STRUCT) { - const int num_children = type->num_children(); - std::vector fields; - fields.reserve(num_children); - for (int child_idx = 0; child_idx < num_children; ++child_idx) { + const int num_children = type->num_children(); + std::vector fields; + fields.reserve(num_children); + for (int child_idx = 0; child_idx < num_children; ++child_idx) { std::shared_ptr field_array; - RETURN_NOT_OK( - NextArray(type->child(child_idx).get(), max_recursion_depth - 1, &field_array)); - fields.push_back(field_array); - } - out->reset(new StructArray(type, field_meta.length, fields, field_meta.null_count, null_bitmap)); - return Status::OK(); + RETURN_NOT_OK(NextArray( + type->child(child_idx).get(), max_recursion_depth - 1, &field_array)); + fields.push_back(field_array); + } + out->reset(new StructArray( + type, field_meta.length, fields, field_meta.null_count, null_bitmap)); + return Status::OK(); } return Status::NotImplemented("Non-primitive types not complete yet"); diff --git a/cpp/src/arrow/ipc/ipc-adapter-test.cc b/cpp/src/arrow/ipc/ipc-adapter-test.cc index 888f38e99ad..6740e0fc5ac 100644 --- a/cpp/src/arrow/ipc/ipc-adapter-test.cc +++ b/cpp/src/arrow/ipc/ipc-adapter-test.cc @@ -211,7 +211,8 @@ Status MakeNonNullRowBatch(std::shared_ptr* out) { RETURN_NOT_OK(MakeRandomInt32Array(1000, true, pool, &leaf_values)); bool include_nulls = false; - RETURN_NOT_OK(MakeRandomListArray(leaf_values, length, include_nulls, pool, &list_array)); + RETURN_NOT_OK( + MakeRandomListArray(leaf_values, length, include_nulls, pool, &list_array)); RETURN_NOT_OK( MakeRandomListArray(list_array, length, include_nulls, pool, &list_list_array)); RETURN_NOT_OK(MakeRandomInt32Array(length, include_nulls, pool, &flat_array)); @@ -243,24 +244,25 @@ Status MakeStruct(std::shared_ptr* out) { // reuse constructed list columns std::shared_ptr list_batch; RETURN_NOT_OK(MakeListRowBatch(&list_batch)); - std::vector columns = {list_batch->column(0), list_batch->column(1), list_batch->column(2)}; + std::vector columns = { + list_batch->column(0), list_batch->column(1), list_batch->column(2)}; auto list_schema = list_batch->schema(); // Define schema - std::shared_ptr type(new StructType({list_schema->field(0), - list_schema->field(1), list_schema->field(2)})); + std::shared_ptr type(new StructType( + {list_schema->field(0), list_schema->field(1), list_schema->field(2)})); auto f0 = std::make_shared("non_null_struct", type); auto f1 = std::make_shared("null_struct", type); std::shared_ptr schema(new Schema({f0, f1})); - // construct individual nullable/non-nullable struct arrays ArrayPtr no_nulls(new StructArray(type, list_batch->num_rows(), columns)); std::vector null_bytes(list_batch->num_rows(), 1); null_bytes[0] = 0; std::shared_ptr null_bitmask; RETURN_NOT_OK(util::bytes_to_bits(null_bytes, &null_bitmask)); - ArrayPtr with_nulls(new StructArray(type, list_batch->num_rows(), columns, 1, null_bitmask)); + ArrayPtr with_nulls( + new StructArray(type, list_batch->num_rows(), columns, 1, null_bitmask)); // construct batch std::vector arrays = {no_nulls, with_nulls}; @@ -268,11 +270,10 @@ Status MakeStruct(std::shared_ptr* out) { return Status::OK(); } -INSTANTIATE_TEST_CASE_P( - RoundTripTests, TestWriteRowBatch, +INSTANTIATE_TEST_CASE_P(RoundTripTests, TestWriteRowBatch, ::testing::Values(&MakeIntRowBatch, &MakeListRowBatch, &MakeNonNullRowBatch, - &MakeZeroLengthRowBatch, &MakeDeeplyNestedList, &MakeStringTypesRowBatch, - &MakeStruct)); + &MakeZeroLengthRowBatch, &MakeDeeplyNestedList, + &MakeStringTypesRowBatch, &MakeStruct)); void TestGetRowBatchSize(std::shared_ptr batch) { MockMemorySource mock_source(1 << 16); diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h index 59100608fdc..597b392ee92 100644 --- a/cpp/src/arrow/types/primitive.h +++ b/cpp/src/arrow/types/primitive.h @@ -53,17 +53,16 @@ class ARROW_EXPORT PrimitiveArray : public Array { const uint8_t* raw_data_; }; - -template +template class ARROW_EXPORT NumericArray : public PrimitiveArray { public: using value_type = T; - NumericArray(int32_t length, const std::shared_ptr& data, int32_t null_count = 0, - const std::shared_ptr& null_bitmap = nullptr) + NumericArray(int32_t length, const std::shared_ptr& data, + int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) : PrimitiveArray( std::make_shared(), length, data, null_count, null_bitmap) {} - NumericArray(const TypePtr& type, int32_t length, const std::shared_ptr& data, - int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) + NumericArray(const TypePtr& type, int32_t length, const std::shared_ptr& data, + int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) : PrimitiveArray(type, length, data, null_count, null_bitmap) {} bool EqualsExact(const NumericArray& other) const { @@ -78,8 +77,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { const auto other = static_cast*>(arr.get()); for (int32_t i = start_idx, o_i = other_start_idx; i < end_idx; ++i, ++o_i) { const bool is_null = IsNull(i); - if (is_null != arr->IsNull(o_i) || - (!is_null && Value(i) != other->Value(o_i))) { + if (is_null != arr->IsNull(o_i) || (!is_null && Value(i) != other->Value(o_i))) { return false; } } @@ -90,8 +88,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { T Value(int i) const { return raw_data()[i]; } }; -#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) \ - using NAME = NumericArray; +#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) using NAME = NumericArray; NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type, uint8_t); NUMERIC_ARRAY_DECL(Int8Array, Int8Type, int8_t); From e46b0d857a2a92d23239b79128d7e7cc6deae1ed Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Sat, 13 Aug 2016 04:15:14 +0000 Subject: [PATCH 5/7] add skip for memory pool test --- cpp/src/.clang-tidy-ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/.clang-tidy-ignore b/cpp/src/.clang-tidy-ignore index a128c388896..5ab4d20d619 100644 --- a/cpp/src/.clang-tidy-ignore +++ b/cpp/src/.clang-tidy-ignore @@ -1 +1,2 @@ ipc-adapter-test.cc +memory-pool-test.cc From 90080461851e0bd84d929427510b3d1902a6933d Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Mon, 15 Aug 2016 22:31:58 +0000 Subject: [PATCH 6/7] use TypeClass::c_type --- cpp/src/arrow/types/primitive.h | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h index 597b392ee92..0addcb3d872 100644 --- a/cpp/src/arrow/types/primitive.h +++ b/cpp/src/arrow/types/primitive.h @@ -53,10 +53,10 @@ class ARROW_EXPORT PrimitiveArray : public Array { const uint8_t* raw_data_; }; -template +template class ARROW_EXPORT NumericArray : public PrimitiveArray { public: - using value_type = T; + using value_type = typename TypeClass::c_type; NumericArray(int32_t length, const std::shared_ptr& data, int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) : PrimitiveArray( @@ -65,7 +65,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { int32_t null_count = 0, const std::shared_ptr& null_bitmap = nullptr) : PrimitiveArray(type, length, data, null_count, null_bitmap) {} - bool EqualsExact(const NumericArray& other) const { + bool EqualsExact(const NumericArray& other) const { return PrimitiveArray::EqualsExact(*static_cast(&other)); } @@ -74,7 +74,7 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { if (this == arr.get()) { return true; } if (!arr) { return false; } if (this->type_enum() != arr->type_enum()) { return false; } - const auto other = static_cast*>(arr.get()); + const auto other = static_cast*>(arr.get()); for (int32_t i = start_idx, o_i = other_start_idx; i < end_idx; ++i, ++o_i) { const bool is_null = IsNull(i); if (is_null != arr->IsNull(o_i) || (!is_null && Value(i) != other->Value(o_i))) { @@ -83,23 +83,23 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { } return true; } - const T* raw_data() const { return reinterpret_cast(raw_data_); } + const value_type* raw_data() const { return reinterpret_cast(raw_data_); } - T Value(int i) const { return raw_data()[i]; } + value_type Value(int i) const { return raw_data()[i]; } }; -#define NUMERIC_ARRAY_DECL(NAME, TypeClass, T) using NAME = NumericArray; - -NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type, uint8_t); -NUMERIC_ARRAY_DECL(Int8Array, Int8Type, int8_t); -NUMERIC_ARRAY_DECL(UInt16Array, UInt16Type, uint16_t); -NUMERIC_ARRAY_DECL(Int16Array, Int16Type, int16_t); -NUMERIC_ARRAY_DECL(UInt32Array, UInt32Type, uint32_t); -NUMERIC_ARRAY_DECL(Int32Array, Int32Type, int32_t); -NUMERIC_ARRAY_DECL(UInt64Array, UInt64Type, uint64_t); -NUMERIC_ARRAY_DECL(Int64Array, Int64Type, int64_t); -NUMERIC_ARRAY_DECL(FloatArray, FloatType, float); -NUMERIC_ARRAY_DECL(DoubleArray, DoubleType, double); +#define NUMERIC_ARRAY_DECL(NAME, TypeClass) using NAME = NumericArray; + +NUMERIC_ARRAY_DECL(UInt8Array, UInt8Type); +NUMERIC_ARRAY_DECL(Int8Array, Int8Type); +NUMERIC_ARRAY_DECL(UInt16Array, UInt16Type); +NUMERIC_ARRAY_DECL(Int16Array, Int16Type); +NUMERIC_ARRAY_DECL(UInt32Array, UInt32Type); +NUMERIC_ARRAY_DECL(Int32Array, Int32Type); +NUMERIC_ARRAY_DECL(UInt64Array, UInt64Type); +NUMERIC_ARRAY_DECL(Int64Array, Int64Type); +NUMERIC_ARRAY_DECL(FloatArray, FloatType); +NUMERIC_ARRAY_DECL(DoubleArray, DoubleType); template class ARROW_EXPORT PrimitiveBuilder : public ArrayBuilder { From 777e3388bdf841813c13fa1f07c43a066db96d01 Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Mon, 15 Aug 2016 22:36:06 +0000 Subject: [PATCH 7/7] fix formatting --- cpp/src/arrow/ipc/metadata-internal.cc | 10 +++------- cpp/src/arrow/types/primitive.h | 4 +++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc index 1d3edf0117f..8cd416ff585 100644 --- a/cpp/src/arrow/ipc/metadata-internal.cc +++ b/cpp/src/arrow/ipc/metadata-internal.cc @@ -265,11 +265,8 @@ Status MessageBuilder::SetSchema(const Schema* schema) { field_offsets.push_back(offset); } - header_ = flatbuf::CreateSchema( - fbb_, - endianness(), - fbb_.CreateVector(field_offsets)) - .Union(); + header_ = + flatbuf::CreateSchema(fbb_, endianness(), fbb_.CreateVector(field_offsets)).Union(); body_length_ = 0; return Status::OK(); } @@ -278,8 +275,7 @@ Status MessageBuilder::SetRecordBatch(int32_t length, int64_t body_length, const std::vector& nodes, const std::vector& buffers) { header_type_ = flatbuf::MessageHeader_RecordBatch; - header_ = flatbuf::CreateRecordBatch(fbb_, length, - fbb_.CreateVectorOfStructs(nodes), + header_ = flatbuf::CreateRecordBatch(fbb_, length, fbb_.CreateVectorOfStructs(nodes), fbb_.CreateVectorOfStructs(buffers)) .Union(); body_length_ = body_length; diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h index 0addcb3d872..770de765f1f 100644 --- a/cpp/src/arrow/types/primitive.h +++ b/cpp/src/arrow/types/primitive.h @@ -83,7 +83,9 @@ class ARROW_EXPORT NumericArray : public PrimitiveArray { } return true; } - const value_type* raw_data() const { return reinterpret_cast(raw_data_); } + const value_type* raw_data() const { + return reinterpret_cast(raw_data_); + } value_type Value(int i) const { return raw_data()[i]; } };