msalib commented on issue #1932:
URL: https://github.com/apache/arrow-rs/issues/1932#issuecomment-1165079359
This slightly simplified example shows different behavior when depending on
`arrow=14.0.0,parquet=14.0.0` versus `arrow=15.0.0,parquet=15.0.0`. The
difference is visible both from `pandas` and `pqrs schema`.
```rust
use std::sync::Arc;
use arrow::{
array::{StringArray, TimestampMillisecondArray},
datatypes::{DataType, Field, Schema, TimeUnit},
record_batch::RecordBatch,
};
use parquet::arrow::arrow_writer::ArrowWriter;
fn main() {
let tz = Some("UTC".to_owned());
let fields = vec![
Field::new(
"metric_date",
DataType::Timestamp(TimeUnit::Millisecond, tz.clone()),
false,
),
Field::new("my_id", DataType::Utf8, false),
];
let schema = Arc::new(Schema::new(fields));
let my_ids = Arc::new(StringArray::from(vec!["hi", "there"]));
let dates = Arc::new(TimestampMillisecondArray::from_vec(
vec![1234532523, 1234124],
tz,
));
let batch = RecordBatch::try_new(schema.clone(), vec![dates,
my_ids]).unwrap();
let f = std::fs::File::create("/tmp/q.parquet").unwrap();
let mut writer = ArrowWriter::try_new(f, schema, None).unwrap();
writer.write(&batch).unwrap();
writer.close().unwrap();
println!("Hello, world!");
}
```
Given the unfortunate state of the specification, I understand that the
changes in version 15 might be better in many ways and fix all manner of
issues, but in this regard, they constitute a regression.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]