Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 251262a

Browse files
committed
Style fixes
1 parent e0e1518 commit 251262a

9 files changed

Lines changed: 61 additions & 46 deletions

File tree

src/parquet/arrow/arrow-reader-writer-test.cc

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,9 @@ class TestParquetIO : public ::testing::Test {
265265
// There we write an UInt32 Array but receive an Int64 Array as result for
266266
// Parquet version 1.0.
267267

268-
typedef ::testing::Types<::arrow::BooleanType, ::arrow::UInt8Type, ::arrow::Int8Type, ::arrow::UInt16Type, ::arrow::Int16Type,
269-
::arrow::Int32Type, ::arrow::UInt64Type, ::arrow::Int64Type, ::arrow::TimestampType, ::arrow::FloatType, ::arrow::DoubleType,
268+
typedef ::testing::Types<::arrow::BooleanType, ::arrow::UInt8Type, ::arrow::Int8Type,
269+
::arrow::UInt16Type, ::arrow::Int16Type, ::arrow::Int32Type, ::arrow::UInt64Type,
270+
::arrow::Int64Type, ::arrow::TimestampType, ::arrow::FloatType, ::arrow::DoubleType,
270271
::arrow::StringType> TestTypes;
271272

272273
TYPED_TEST_CASE(TestParquetIO, TestTypes);
@@ -284,8 +285,8 @@ TYPED_TEST(TestParquetIO, SingleColumnTableRequiredWrite) {
284285
auto values = NonNullArray<TypeParam>(SMALL_SIZE);
285286
std::shared_ptr<Table> table = MakeSimpleTable(values, false);
286287
this->sink_ = std::make_shared<InMemoryOutputStream>();
287-
ASSERT_OK_NO_THROW(WriteFlatTable(table.get(), ::arrow::default_memory_pool(), this->sink_,
288-
values->length(), default_writer_properties()));
288+
ASSERT_OK_NO_THROW(WriteFlatTable(table.get(), ::arrow::default_memory_pool(),
289+
this->sink_, values->length(), default_writer_properties()));
289290

290291
std::shared_ptr<Table> out;
291292
this->ReadTableFromFile(this->ReaderFromSink(), &out);
@@ -312,8 +313,8 @@ TYPED_TEST(TestParquetIO, SingleColumnTableOptionalReadWrite) {
312313
std::shared_ptr<Array> values = NullableArray<TypeParam>(SMALL_SIZE, 10);
313314
std::shared_ptr<Table> table = MakeSimpleTable(values, true);
314315
this->sink_ = std::make_shared<InMemoryOutputStream>();
315-
ASSERT_OK_NO_THROW(WriteFlatTable(table.get(), ::arrow::default_memory_pool(), this->sink_,
316-
values->length(), default_writer_properties()));
316+
ASSERT_OK_NO_THROW(WriteFlatTable(table.get(), ::arrow::default_memory_pool(),
317+
this->sink_, values->length(), default_writer_properties()));
317318

318319
this->ReadAndCheckSingleColumnTable(values);
319320
}
@@ -365,8 +366,8 @@ TYPED_TEST(TestParquetIO, SingleColumnTableOptionalChunkedWrite) {
365366
auto values = NullableArray<TypeParam>(LARGE_SIZE, 100);
366367
std::shared_ptr<Table> table = MakeSimpleTable(values, true);
367368
this->sink_ = std::make_shared<InMemoryOutputStream>();
368-
ASSERT_OK_NO_THROW(WriteFlatTable(
369-
table.get(), ::arrow::default_memory_pool(), this->sink_, 512, default_writer_properties()));
369+
ASSERT_OK_NO_THROW(WriteFlatTable(table.get(), ::arrow::default_memory_pool(),
370+
this->sink_, 512, default_writer_properties()));
370371

371372
this->ReadAndCheckSingleColumnTable(values);
372373
}
@@ -375,7 +376,8 @@ using TestUInt32ParquetIO = TestParquetIO<::arrow::UInt32Type>;
375376

376377
TEST_F(TestUInt32ParquetIO, Parquet_2_0_Compability) {
377378
// This also tests max_definition_level = 1
378-
std::shared_ptr<PrimitiveArray> values = NullableArray<::arrow::UInt32Type>(LARGE_SIZE, 100);
379+
std::shared_ptr<PrimitiveArray> values =
380+
NullableArray<::arrow::UInt32Type>(LARGE_SIZE, 100);
379381
std::shared_ptr<Table> table = MakeSimpleTable(values, true);
380382

381383
// Parquet 2.0 roundtrip should yield an uint32_t column again
@@ -391,7 +393,8 @@ TEST_F(TestUInt32ParquetIO, Parquet_2_0_Compability) {
391393

392394
TEST_F(TestUInt32ParquetIO, Parquet_1_0_Compability) {
393395
// This also tests max_definition_level = 1
394-
std::shared_ptr<PrimitiveArray> values = NullableArray<::arrow::UInt32Type>(LARGE_SIZE, 100);
396+
std::shared_ptr<PrimitiveArray> values =
397+
NullableArray<::arrow::UInt32Type>(LARGE_SIZE, 100);
395398
std::shared_ptr<Table> table = MakeSimpleTable(values, true);
396399

397400
// Parquet 1.0 returns an int64_t column as there is no way to tell a Parquet 1.0
@@ -401,8 +404,8 @@ TEST_F(TestUInt32ParquetIO, Parquet_1_0_Compability) {
401404
::parquet::WriterProperties::Builder()
402405
.version(ParquetVersion::PARQUET_1_0)
403406
->build();
404-
ASSERT_OK_NO_THROW(
405-
WriteFlatTable(table.get(), ::arrow::default_memory_pool(), this->sink_, 512, properties));
407+
ASSERT_OK_NO_THROW(WriteFlatTable(
408+
table.get(), ::arrow::default_memory_pool(), this->sink_, 512, properties));
406409

407410
std::shared_ptr<Array> expected_values;
408411
std::shared_ptr<PoolBuffer> int64_data =
@@ -481,8 +484,9 @@ class TestPrimitiveParquetIO : public TestParquetIO<TestType> {
481484
}
482485
};
483486

484-
typedef ::testing::Types<::arrow::BooleanType, ::arrow::UInt8Type, ::arrow::Int8Type, ::arrow::UInt16Type, ::arrow::Int16Type,
485-
::arrow::UInt32Type, ::arrow::Int32Type, ::arrow::UInt64Type, ::arrow::Int64Type, ::arrow::FloatType,
487+
typedef ::testing::Types<::arrow::BooleanType, ::arrow::UInt8Type, ::arrow::Int8Type,
488+
::arrow::UInt16Type, ::arrow::Int16Type, ::arrow::UInt32Type, ::arrow::Int32Type,
489+
::arrow::UInt64Type, ::arrow::Int64Type, ::arrow::FloatType,
486490
::arrow::DoubleType> PrimitiveTestTypes;
487491

488492
TYPED_TEST_CASE(TestPrimitiveParquetIO, PrimitiveTestTypes);

src/parquet/arrow/arrow-schema-test.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ const auto INT64 = std::make_shared<::arrow::Int64Type>();
4848
const auto FLOAT = std::make_shared<::arrow::FloatType>();
4949
const auto DOUBLE = std::make_shared<::arrow::DoubleType>();
5050
const auto UTF8 = std::make_shared<::arrow::StringType>();
51-
const auto TIMESTAMP_MS = std::make_shared<::arrow::TimestampType>(::arrow::TimestampType::Unit::MILLI);
51+
const auto TIMESTAMP_MS =
52+
std::make_shared<::arrow::TimestampType>(::arrow::TimestampType::Unit::MILLI);
5253
// TODO: This requires parquet-cpp implementing the MICROS enum value
5354
// const auto TIMESTAMP_US = std::make_shared<TimestampType>(TimestampType::Unit::MICRO);
54-
const auto BINARY = std::make_shared<::arrow::ListType>(std::make_shared<Field>("", UINT8));
55+
const auto BINARY =
56+
std::make_shared<::arrow::ListType>(std::make_shared<Field>("", UINT8));
5557
const auto DECIMAL_8_4 = std::make_shared<::arrow::DecimalType>(8, 4);
5658

5759
class TestConvertParquetSchema : public ::testing::Test {
@@ -180,8 +182,7 @@ class TestConvertArrowSchema : public ::testing::Test {
180182
NodePtr schema_node = GroupNode::Make("schema", Repetition::REPEATED, nodes);
181183
const GroupNode* expected_schema_node =
182184
static_cast<const GroupNode*>(schema_node.get());
183-
const GroupNode* result_schema_node =
184-
result_schema_->group_node();
185+
const GroupNode* result_schema_node = result_schema_->group_node();
185186

186187
ASSERT_EQ(expected_schema_node->field_count(), result_schema_node->field_count());
187188

src/parquet/arrow/io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace arrow {
3232

3333
class MemoryPool;
3434

35-
} // namespace arrow
35+
} // namespace arrow
3636

3737
namespace parquet {
3838

src/parquet/arrow/reader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class MemoryPool;
3333
class RowBatch;
3434
class Status;
3535
class Table;
36-
3736
}
3837

3938
namespace parquet {

src/parquet/arrow/schema.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
#include <memory>
2222

23+
#include "arrow/schema.h"
24+
#include "arrow/type.h"
25+
#include "arrow/util/visibility.h"
26+
2327
#include "parquet/api/schema.h"
2428
#include "parquet/api/writer.h"
2529

26-
#include <arrow/schema.h>
27-
#include <arrow/type.h>
28-
#include <arrow/util/visibility.h>
29-
3030
namespace arrow {
3131

3232
class Status;

src/parquet/arrow/test-util.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ typename std::enable_if<is_arrow_float<ArrowType>::value,
4141
NonNullArray(size_t size) {
4242
std::vector<typename ArrowType::c_type> values;
4343
::arrow::test::random_real<typename ArrowType::c_type>(size, 0, 0, 1, &values);
44-
::arrow::NumericBuilder<ArrowType> builder(::arrow::default_memory_pool(), std::make_shared<ArrowType>());
44+
::arrow::NumericBuilder<ArrowType> builder(
45+
::arrow::default_memory_pool(), std::make_shared<ArrowType>());
4546
builder.Append(values.data(), values.size());
4647
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
4748
}
@@ -52,7 +53,8 @@ typename std::enable_if<is_arrow_int<ArrowType>::value,
5253
NonNullArray(size_t size) {
5354
std::vector<typename ArrowType::c_type> values;
5455
::arrow::test::randint<typename ArrowType::c_type>(size, 0, 64, &values);
55-
::arrow::NumericBuilder<ArrowType> builder(::arrow::default_memory_pool(), std::make_shared<ArrowType>());
56+
::arrow::NumericBuilder<ArrowType> builder(
57+
::arrow::default_memory_pool(), std::make_shared<ArrowType>());
5658
builder.Append(values.data(), values.size());
5759
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
5860
}
@@ -61,7 +63,8 @@ template <class ArrowType>
6163
typename std::enable_if<is_arrow_string<ArrowType>::value,
6264
std::shared_ptr<::arrow::StringArray>>::type
6365
NonNullArray(size_t size) {
64-
::arrow::StringBuilder builder(::arrow::default_memory_pool(), std::make_shared<::arrow::StringType>());
66+
::arrow::StringBuilder builder(
67+
::arrow::default_memory_pool(), std::make_shared<::arrow::StringType>());
6568
for (size_t i = 0; i < size; i++) {
6669
builder.Append("test-string");
6770
}
@@ -72,7 +75,8 @@ template <>
7275
std::shared_ptr<::arrow::PrimitiveArray> NonNullArray<::arrow::BooleanType>(size_t size) {
7376
std::vector<uint8_t> values;
7477
::arrow::test::randint<uint8_t>(size, 0, 1, &values);
75-
::arrow::BooleanBuilder builder(::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
78+
::arrow::BooleanBuilder builder(
79+
::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
7680
builder.Append(values.data(), values.size());
7781
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
7882
}
@@ -90,7 +94,8 @@ NullableArray(size_t size, size_t num_nulls) {
9094
valid_bytes[i * 2] = 0;
9195
}
9296

93-
::arrow::NumericBuilder<ArrowType> builder(::arrow::default_memory_pool(), std::make_shared<ArrowType>());
97+
::arrow::NumericBuilder<ArrowType> builder(
98+
::arrow::default_memory_pool(), std::make_shared<ArrowType>());
9499
builder.Append(values.data(), values.size(), valid_bytes.data());
95100
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
96101
}
@@ -108,7 +113,8 @@ NullableArray(size_t size, size_t num_nulls) {
108113
valid_bytes[i * 2] = 0;
109114
}
110115

111-
::arrow::NumericBuilder<ArrowType> builder(::arrow::default_memory_pool(), std::make_shared<ArrowType>());
116+
::arrow::NumericBuilder<ArrowType> builder(
117+
::arrow::default_memory_pool(), std::make_shared<ArrowType>());
112118
builder.Append(values.data(), values.size(), valid_bytes.data());
113119
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
114120
}
@@ -124,7 +130,8 @@ NullableArray(size_t size, size_t num_nulls) {
124130
valid_bytes[i * 2] = 0;
125131
}
126132

127-
::arrow::StringBuilder builder(::arrow::default_memory_pool(), std::make_shared<::arrow::StringType>());
133+
::arrow::StringBuilder builder(
134+
::arrow::default_memory_pool(), std::make_shared<::arrow::StringType>());
128135
for (size_t i = 0; i < size; i++) {
129136
builder.Append("test-string");
130137
}
@@ -143,13 +150,14 @@ std::shared_ptr<::arrow::PrimitiveArray> NullableArray<::arrow::BooleanType>(
143150
valid_bytes[i * 2] = 0;
144151
}
145152

146-
::arrow::BooleanBuilder builder(::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
153+
::arrow::BooleanBuilder builder(
154+
::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
147155
builder.Append(values.data(), values.size(), valid_bytes.data());
148156
return std::static_pointer_cast<::arrow::PrimitiveArray>(builder.Finish());
149157
}
150158

151-
std::shared_ptr<::arrow::Column> MakeColumn(
152-
const std::string& name, const std::shared_ptr<::arrow::Array>& array, bool nullable) {
159+
std::shared_ptr<::arrow::Column> MakeColumn(const std::string& name,
160+
const std::shared_ptr<::arrow::Array>& array, bool nullable) {
153161
auto field = std::make_shared<::arrow::Field>(name, array->type(), nullable);
154162
return std::make_shared<::arrow::Column>(field, array);
155163
}
@@ -182,7 +190,8 @@ void ExpectArray(typename ArrowType::c_type* expected, ::arrow::Array* result) {
182190

183191
template <>
184192
void ExpectArray<::arrow::BooleanType>(uint8_t* expected, ::arrow::Array* result) {
185-
::arrow::BooleanBuilder builder(::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
193+
::arrow::BooleanBuilder builder(
194+
::arrow::default_memory_pool(), std::make_shared<::arrow::BooleanType>());
186195
builder.Append(expected, result->length());
187196
std::shared_ptr<::arrow::Array> expected_array = builder.Finish();
188197
EXPECT_TRUE(result->Equals(expected_array));

src/parquet/arrow/utils.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
namespace parquet {
2727
namespace arrow {
2828

29-
#define PARQUET_CATCH_NOT_OK(s) \
30-
try { \
31-
(s); \
32-
} catch (const ::parquet::ParquetException& e) { return ::arrow::Status::Invalid(e.what()); }
29+
#define PARQUET_CATCH_NOT_OK(s) \
30+
try { \
31+
(s); \
32+
} catch (const ::parquet::ParquetException& e) { \
33+
return ::arrow::Status::Invalid(e.what()); \
34+
}
3335

3436
#define PARQUET_IGNORE_NOT_OK(s) \
3537
try { \

src/parquet/arrow/writer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Status FileWriter::Impl::Close() {
221221
}
222222

223223
#define TYPED_BATCH_CASE(ENUM, ArrowType, ParquetType) \
224-
case ::arrow::Type::ENUM: \
224+
case ::arrow::Type::ENUM: \
225225
return TypedWriteBatch<ParquetType, ArrowType>(writer, data, offset, length); \
226226
break;
227227

src/parquet/arrow/writer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class RowBatch;
3232
class Status;
3333
class StringArray;
3434
class Table;
35-
3635
}
3736

3837
namespace parquet {
@@ -49,7 +48,8 @@ class PARQUET_EXPORT FileWriter {
4948
FileWriter(::arrow::MemoryPool* pool, std::unique_ptr<ParquetFileWriter> writer);
5049

5150
::arrow::Status NewRowGroup(int64_t chunk_size);
52-
::arrow::Status WriteFlatColumnChunk(const ::arrow::Array* data, int64_t offset = 0, int64_t length = -1);
51+
::arrow::Status WriteFlatColumnChunk(
52+
const ::arrow::Array* data, int64_t offset = 0, int64_t length = -1);
5353
::arrow::Status Close();
5454

5555
virtual ~FileWriter();
@@ -66,10 +66,10 @@ class PARQUET_EXPORT FileWriter {
6666
*
6767
* The table shall only consist of nullable, non-repeated columns of primitive type.
6868
*/
69-
::arrow::Status PARQUET_EXPORT WriteFlatTable(const ::arrow::Table* table, ::arrow::MemoryPool* pool,
70-
const std::shared_ptr<OutputStream>& sink, int64_t chunk_size,
71-
const std::shared_ptr<WriterProperties>& properties =
72-
default_writer_properties());
69+
::arrow::Status PARQUET_EXPORT WriteFlatTable(const ::arrow::Table* table,
70+
::arrow::MemoryPool* pool, const std::shared_ptr<OutputStream>& sink,
71+
int64_t chunk_size,
72+
const std::shared_ptr<WriterProperties>& properties = default_writer_properties());
7373

7474
} // namespace arrow
7575

0 commit comments

Comments
 (0)