@@ -1794,21 +1794,18 @@ TEST_F(TestConvertArrowSchema, ParquetTimeAdjustedToUTC) {
17941794 int physical_length;
17951795 };
17961796
1797- auto make_cases_fcn = []( bool write_time_utc_adjusted ) {
1797+ auto run_test = [this ]( const std::shared_ptr<ArrowWriterProperties>& arrow_writer_properties, bool time_adjusted_to_utc ) {
17981798 std::vector<FieldConstructionArguments> cases = {
17991799 {" time32" , ::arrow::time32 (::arrow::TimeUnit::MILLI),
1800- LogicalType::Time (write_time_utc_adjusted , LogicalType::TimeUnit::MILLIS),
1800+ LogicalType::Time (time_adjusted_to_utc , LogicalType::TimeUnit::MILLIS),
18011801 ParquetType::INT32, -1 },
18021802 {" time64(microsecond)" , ::arrow::time64 (::arrow::TimeUnit::MICRO),
1803- LogicalType::Time (write_time_utc_adjusted , LogicalType::TimeUnit::MICROS),
1803+ LogicalType::Time (time_adjusted_to_utc , LogicalType::TimeUnit::MICROS),
18041804 ParquetType::INT64, -1 },
18051805 {" time64(nanosecond)" , ::arrow::time64 (::arrow::TimeUnit::NANO),
1806- LogicalType::Time (write_time_utc_adjusted , LogicalType::TimeUnit::NANOS),
1806+ LogicalType::Time (time_adjusted_to_utc , LogicalType::TimeUnit::NANOS),
18071807 ParquetType::INT64, -1 }};
1808- return cases;
1809- };
18101808
1811- auto make_fields_schema_fcn = [](const std::vector<FieldConstructionArguments>& cases) {
18121809 std::vector<std::shared_ptr<Field>> arrow_fields;
18131810 std::vector<NodePtr> parquet_fields;
18141811 for (const FieldConstructionArguments& c : cases) {
@@ -1817,30 +1814,23 @@ TEST_F(TestConvertArrowSchema, ParquetTimeAdjustedToUTC) {
18171814 c.logical_type , c.physical_type ,
18181815 c.physical_length ));
18191816 }
1820- return std::make_pair (arrow_fields, parquet_fields);
1817+
1818+ EXPECT_EQ (arrow_writer_properties->write_time_adjusted_to_utc (), time_adjusted_to_utc);
1819+ ASSERT_OK (ConvertSchema (arrow_fields, arrow_writer_properties));
1820+ CheckFlatSchema (parquet_fields);
18211821 };
18221822
1823+ // Verify write_time_adjusted_to_utc is false by default.
18231824 ArrowWriterProperties::Builder builder;
1824-
18251825 auto arrow_writer_properties = builder.build ();
1826- // Verify write_time_adjusted_to_utc is false by default.
1827- EXPECT_FALSE (arrow_writer_properties->write_time_adjusted_to_utc ());
1828- auto cases = make_cases_fcn (false );
1829- auto arrow_parquet_fields = make_fields_schema_fcn (cases);
1830- ASSERT_OK (ConvertSchema (arrow_parquet_fields.first , arrow_writer_properties));
1831- CheckFlatSchema (arrow_parquet_fields.second );
1832-
1833- arrow_writer_properties = builder.enable_time_adjusted_to_utc ()->build ();
1834- // Verify write_time_adjusted_to_utc is true.
1835- EXPECT_TRUE (arrow_writer_properties->write_time_adjusted_to_utc ());
1836- cases = make_cases_fcn (true );
1837- arrow_parquet_fields = make_fields_schema_fcn (cases);
1838- ASSERT_OK (ConvertSchema (arrow_parquet_fields.first , arrow_writer_properties));
1839- CheckFlatSchema (arrow_parquet_fields.second );
1840-
1841- arrow_writer_properties = builder.disable_time_adjusted_to_utc ()->build ();
1842- // Verify write_time_adjusted_to_utc is false.
1843- EXPECT_FALSE (arrow_writer_properties->write_time_adjusted_to_utc ());
1826+ run_test (arrow_writer_properties, false );
1827+
1828+ arrow_writer_properties = builder.set_time_adjusted_to_utc (true )->build ();
1829+ run_test (arrow_writer_properties, true );
1830+
1831+ arrow_writer_properties = builder.set_time_adjusted_to_utc (false )->build ();
1832+ run_test (arrow_writer_properties, false );
1833+
18441834}
18451835
18461836class TestConvertRoundTrip : public ::testing::Test {
0 commit comments