Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parquet: ColumnOrder not being written when writing parquet files #5152

Closed
Jefffrey opened this issue Nov 30, 2023 · 2 comments · Fixed by #5158
Closed

Parquet: ColumnOrder not being written when writing parquet files #5152

Jefffrey opened this issue Nov 30, 2023 · 2 comments · Fixed by #5158
Labels
bug parquet Changes to the parquet crate

Comments

@Jefffrey
Copy link
Contributor

Describe the bug

Column order needs to be written in FileMetadata, see thrift spec:

https://github.com/apache/parquet-format/blob/066f9817332da32bdc6dc6dea833b6ee9c269934/src/main/thrift/parquet.thrift#L1133-L1149

To Reproduce

In arrow_writer/mod.rs:

    #[test]
    fn test_123() {
        let a = Int32Array::from(vec![1, 2, 3, 4, 5]);
        let b = IntervalDayTimeArray::from(vec![0; 5]);
        let batch = RecordBatch::try_from_iter(vec![
            ("a", Arc::new(a) as ArrayRef),
            ("b", Arc::new(b) as ArrayRef),
        ])
        .unwrap();

        let mut buf = Vec::with_capacity(1024);
        let mut writer = ArrowWriter::try_new(&mut buf, batch.schema(), None).unwrap();
        writer.write(&batch).unwrap();
        writer.close().unwrap();

        let bytes = Bytes::from(buf);
        let options = ReadOptionsBuilder::new().with_page_index().build();
        let reader = SerializedFileReader::new_with_options(bytes, options).unwrap();
        dbg!(reader.metadata().file_metadata().column_orders());
    }

Currently outputting None

Expected behavior

Should write ColumnOrder for each column

Additional context

See here:

let file_metadata = parquet::FileMetaData {
num_rows,
row_groups,
key_value_metadata,
version: self.props.writer_version().as_num(),
schema: types::to_thrift(self.schema.as_ref())?,
created_by: Some(self.props.created_by().to_owned()),
column_orders: None,
encryption_algorithm: None,
footer_signing_key_metadata: None,
};

Currently being set to None always when writing

@Jefffrey
Copy link
Contributor Author

Jefffrey commented Dec 1, 2023

Planning to take a shot at this

@tustvold tustvold added the parquet Changes to the parquet crate label Jan 5, 2024
@tustvold
Copy link
Contributor

tustvold commented Jan 5, 2024

label_issue.py automatically added labels {'parquet'} from #5147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants