@@ -2182,39 +2182,35 @@ TEST(TestArrowReadWrite, TimestampCoercionOverflow) {
21822182 using ::arrow::ArrayFromVector;
21832183 using ::arrow::field;
21842184 using ::arrow::schema;
2185-
21862185 auto t_s = ::arrow::timestamp (TimeUnit::SECOND );
2187-
21882186 std::vector<int64_t > overflow_values = {9223372036854776LL };
21892187 std::vector<bool > is_valid = {true };
2190-
21912188 std::shared_ptr<Array> a_s;
21922189 ArrayFromVector<::arrow::TimestampType, int64_t >(t_s, is_valid, overflow_values, &a_s);
21932190
21942191 auto s = schema ({field (" timestamp" , t_s)});
21952192 auto table = Table::Make (s, {a_s});
21962193
2197- ASSERT_RAISES (Invalid, WriteTable (*table, default_memory_pool (),
2198- CreateOutputStream (), table-> num_rows ()));
2199-
2200- for ( auto unit : {TimeUnit:: MILLI , TimeUnit:: MICRO , TimeUnit:: NANO }) {
2201- auto coerce_props =
2202- ArrowWriterProperties::Builder (). coerce_timestamps (unit)-> build ();
2203- ASSERT_RAISES (
2204- Invalid ,
2205- WriteTable (*table, default_memory_pool (), CreateOutputStream (),
2206- table-> num_rows (), default_writer_properties (),
2207- coerce_props));
2194+ for ( auto unit : {TimeUnit:: SECOND , TimeUnit:: MILLI , TimeUnit:: MICRO , TimeUnit:: NANO }) {
2195+ if (unit == TimeUnit:: SECOND ) {
2196+ ASSERT_RAISES (Invalid, WriteTable (*table, default_memory_pool (),
2197+ CreateOutputStream (), table-> num_rows ()));
2198+ } else {
2199+ auto coerce_props =
2200+ ArrowWriterProperties::Builder (). coerce_timestamps (unit)-> build ();
2201+ ASSERT_RAISES (Invalid, WriteTable (*table, default_memory_pool () ,
2202+ CreateOutputStream (), table-> num_rows (),
2203+ default_writer_properties (), coerce_props));
2204+ }
22082205 }
22092206
2210- std::vector<int64_t > null_overflow_values = {9223372036854776LL };
22112207 std::vector<bool > null_valid = {false };
22122208 std::shared_ptr<Array> a_null;
2213- ArrayFromVector<::arrow::TimestampType, int64_t >(t_s, null_valid, null_overflow_values ,
2209+ ArrayFromVector<::arrow::TimestampType, int64_t >(t_s, null_valid, overflow_values ,
22142210 &a_null);
22152211 auto null_table = Table::Make (s, {a_null});
2216- ASSERT_OK_NO_THROW (WriteTable (*null_table, default_memory_pool (),
2217- CreateOutputStream (), null_table->num_rows ()));
2212+ ASSERT_OK_NO_THROW (WriteTable (*null_table, default_memory_pool (), CreateOutputStream (),
2213+ null_table->num_rows ()));
22182214}
22192215
22202216TEST (TestArrowReadWrite, ParquetVersionTimestampDifferences) {
0 commit comments