MCPcopy Create free account
hub / github.com/apache/arrow / DownsampleInt96RoundTrip

Function DownsampleInt96RoundTrip

cpp/src/parquet/arrow/arrow_reader_writer_test.cc:619–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617}
618
619void 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
649class ParquetIOTestBase : public ::testing::Test {

Callers 1

TESTFunction · 0.85

Calls 11

DoRoundtripFunction · 0.85
AssertTablesEqualFunction · 0.85
fieldFunction · 0.70
schemaFunction · 0.50
timestampFunction · 0.50
MakeFunction · 0.50
BuilderFunction · 0.50
num_rowsMethod · 0.45
buildMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected