| 617 | } |
| 618 | |
| 619 | void DownsampleInt96RoundTrip(std::shared_ptr<Array> arrow_vector_in, |
| 620 | std::shared_ptr<Array> arrow_vector_out, |
| 621 | ::arrow::TimeUnit::type unit) { |
| 622 | // Create single input table of NS to be written to parquet with INT96 |
| 623 | auto input_schema = |
| 624 | ::arrow::schema({::arrow::field("f", ::arrow::timestamp(TimeUnit::NANO))}); |
| 625 | auto input = Table::Make(input_schema, {arrow_vector_in}); |
| 626 | |
| 627 | // Create an expected schema for each resulting table (one for each "downsampled" ts) |
| 628 | auto ex_schema = ::arrow::schema({::arrow::field("f", ::arrow::timestamp(unit))}); |
| 629 | auto ex_result = Table::Make(ex_schema, {arrow_vector_out}); |
| 630 | |
| 631 | std::shared_ptr<Table> result; |
| 632 | |
| 633 | ArrowReaderProperties arrow_reader_prop; |
| 634 | arrow_reader_prop.set_coerce_int96_timestamp_unit(unit); |
| 635 | |
| 636 | ASSERT_NO_FATAL_FAILURE(DoRoundtrip( |
| 637 | input, input->num_rows(), &result, default_writer_properties(), |
| 638 | ArrowWriterProperties::Builder().enable_deprecated_int96_timestamps()->build(), |
| 639 | arrow_reader_prop)); |
| 640 | |
| 641 | ASSERT_NO_FATAL_FAILURE(::arrow::AssertSchemaEqual(*ex_result->schema(), |
| 642 | *result->schema(), |
| 643 | /*check_metadata=*/false)); |
| 644 | |
| 645 | ASSERT_NO_FATAL_FAILURE(::arrow::AssertTablesEqual(*ex_result, *result)); |
| 646 | } |
| 647 | |
| 648 | // Non-template base class for TestParquetIO, to avoid code duplication |
| 649 | class ParquetIOTestBase : public ::testing::Test { |
no test coverage detected