You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/12 09:48:12 UTC

[GitHub] [arrow-rs] tustvold commented on issue #4397: arrow::compute::filter_record_batch drops timezone

tustvold commented on issue #4397:
URL: https://github.com/apache/arrow-rs/issues/4397#issuecomment-1586981286

   I think this is actually a bug in StructBuilder
   
   ```
   #[test]
   fn filter_record_batch_maintains_timezones() {
       let fields = vec![Field::new(
           "timestamp",
           DataType::Timestamp(TimeUnit::Nanosecond, Some("UTC".to_owned().into())),
           false,
       )];
   
       let field_builders: Vec<Box<dyn ArrayBuilder>> =
           vec![Box::new(TimestampNanosecondBuilder::new())];
   
       let mut sa = StructBuilder::new(fields, field_builders);
   
       for i in 0..100 {
           sa.field_builder::<TimestampNanosecondBuilder>(0)
               .unwrap()
               .append_value(i);
           sa.append(true);
       }
   
       let struct_array = sa.finish();
       assert_eq!(
           struct_array.fields()[0].data_type(),
           &DataType::Timestamp(TimeUnit::Nanosecond, Some("UTC".to_owned().into())),
       );
       // FAILS
       assert_eq!(
           struct_array.column(0).data_type(),
           &DataType::Timestamp(TimeUnit::Nanosecond, Some("UTC".to_owned().into()))
       );
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org