|
74 | 74 | #include "parquet/page_index.h" |
75 | 75 | #include "parquet/properties.h" |
76 | 76 | #include "parquet/test_util.h" |
| 77 | +#include "parquet/types.h" |
77 | 78 |
|
78 | 79 | using arrow::Array; |
79 | 80 | using arrow::ArrayData; |
@@ -4149,14 +4150,26 @@ INSTANTIATE_TEST_SUITE_P(Repetition_type, TestNestedSchemaRead, |
4149 | 4150 | ::testing::Values(Repetition::REQUIRED, Repetition::OPTIONAL)); |
4150 | 4151 |
|
4151 | 4152 | TEST(TestImpalaConversion, ArrowTimestampToImpalaTimestamp) { |
4152 | | - // June 20, 2017 16:32:56 and 123456789 nanoseconds |
4153 | | - int64_t nanoseconds = INT64_C(1497976376123456789); |
| 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 | 4158 |
|
4155 | | - Int96 calculated; |
| 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)}}; |
| 4167 | + ASSERT_EQ(timestamp, ::parquet::Int96GetNanoSeconds(impala_timestamp)); |
4156 | 4168 |
|
4157 | | - Int96 expected = {{UINT32_C(632093973), UINT32_C(13871), UINT32_C(2457925)}}; |
4158 | | - ::parquet::internal::NanosecondsToImpalaTimestamp(nanoseconds, &calculated); |
4159 | | - ASSERT_EQ(expected, calculated); |
| 4169 | + Int96 calculated; |
| 4170 | + ::parquet::internal::NanosecondsToImpalaTimestamp(timestamp, &calculated); |
| 4171 | + ASSERT_EQ(impala_timestamp, calculated); |
| 4172 | + } |
4160 | 4173 | } |
4161 | 4174 |
|
4162 | 4175 | void TryReadDataFile(const std::string& path, |
|
0 commit comments