|
28 | 28 | #include <functional> |
29 | 29 | #include <set> |
30 | 30 | #include <sstream> |
| 31 | +#include <utility> |
31 | 32 | #include <vector> |
32 | 33 |
|
33 | 34 | #include "arrow/array/builder_binary.h" |
@@ -376,19 +377,19 @@ const double test_traits<::arrow::DoubleType>::value(4.2); |
376 | 377 | template <> |
377 | 378 | struct test_traits<::arrow::StringType> { |
378 | 379 | static constexpr ParquetType::type parquet_enum = ParquetType::BYTE_ARRAY; |
379 | | - static std::string const value; |
| 380 | + static const std::string value; |
380 | 381 | }; |
381 | 382 |
|
382 | 383 | template <> |
383 | 384 | struct test_traits<::arrow::BinaryType> { |
384 | 385 | static constexpr ParquetType::type parquet_enum = ParquetType::BYTE_ARRAY; |
385 | | - static std::string const value; |
| 386 | + static const std::string value; |
386 | 387 | }; |
387 | 388 |
|
388 | 389 | template <> |
389 | 390 | struct test_traits<::arrow::FixedSizeBinaryType> { |
390 | 391 | static constexpr ParquetType::type parquet_enum = ParquetType::FIXED_LEN_BYTE_ARRAY; |
391 | | - static std::string const value; |
| 392 | + static const std::string value; |
392 | 393 | }; |
393 | 394 |
|
394 | 395 | const std::string test_traits<::arrow::StringType>::value("Test"); // NOLINT |
@@ -4150,20 +4151,23 @@ INSTANTIATE_TEST_SUITE_P(Repetition_type, TestNestedSchemaRead, |
4150 | 4151 | ::testing::Values(Repetition::REQUIRED, Repetition::OPTIONAL)); |
4151 | 4152 |
|
4152 | 4153 | TEST(TestImpalaConversion, ArrowTimestampToImpalaTimestamp) { |
4153 | | - { |
4154 | | - // June 20, 2017 16:32:56 and 123456789 nanoseconds |
4155 | | - int64_t timestamp = INT64_C(1497976376123456789); |
4156 | | - Int96 impala_timestamp = {{UINT32_C(632093973), UINT32_C(13871), UINT32_C(2457925)}}; |
4157 | | - ASSERT_EQ(timestamp, ::parquet::Int96GetNanoSeconds(impala_timestamp)); |
| 4154 | + std::vector<std::pair<int64_t, Int96>> test_cases = { |
| 4155 | + // June 20, 2017 16:32:56 and 123456789 nanoseconds |
| 4156 | + {INT64_C(1497976376123456789), |
| 4157 | + {{UINT32_C(632093973), UINT32_C(13871), UINT32_C(2457925)}}}, |
| 4158 | + // January 1, 1970 00:00:00 and 000000000 nanoseconds |
| 4159 | + {INT64_C(0), {{UINT32_C(0), UINT32_C(0), UINT32_C(2440588)}}}, |
| 4160 | + // December 31, 1969 23:59:59 and 999999000 nanoseconds |
| 4161 | + {INT64_C(-1000), {{UINT32_C(2437872664), UINT32_C(20116), UINT32_C(2440587)}}}, |
| 4162 | + // December 31, 1969 00:00:00 and 000000000 nanoseconds |
| 4163 | + {INT64_C(-86400000000000), {{UINT32_C(0), UINT32_C(0), UINT32_C(2440587)}}}, |
| 4164 | + // January 1, 1970 00:00:00 and 000001000 nanoseconds |
| 4165 | + {INT64_C(1000), {{UINT32_C(1000), UINT32_C(0), UINT32_C(2440588)}}}, |
| 4166 | + // January 2, 1970 00:00:00 and 000000000 nanoseconds |
| 4167 | + {INT64_C(86400000000000), {{UINT32_C(0), UINT32_C(0), UINT32_C(2440589)}}}, |
| 4168 | + }; |
4158 | 4169 |
|
4159 | | - Int96 calculated; |
4160 | | - ::parquet::internal::NanosecondsToImpalaTimestamp(timestamp, &calculated); |
4161 | | - ASSERT_EQ(impala_timestamp, calculated); |
4162 | | - } |
4163 | | - { |
4164 | | - // January 1, 1970 07:59:59 and 999999000 nanoseconds |
4165 | | - int64_t timestamp = INT64_C(-1000); |
4166 | | - Int96 impala_timestamp = {{UINT32_C(2437872664), UINT32_C(20116), UINT32_C(2440587)}}; |
| 4170 | + for (auto& [timestamp, impala_timestamp] : test_cases) { |
4167 | 4171 | ASSERT_EQ(timestamp, ::parquet::Int96GetNanoSeconds(impala_timestamp)); |
4168 | 4172 |
|
4169 | 4173 | Int96 calculated; |
|
0 commit comments