Skip to content

Conversation

chenkovsky
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

partition columns should exclude file schema in listing table

What changes are included in this PR?

  1. update partition column type in proto
  2. remove partition columns from ListingTableScanNode schema.

Are these changes tested?

UT

Are there any user-facing changes?

No

@github-actions github-actions bot added the proto Related to proto crate label Apr 16, 2025
@milenkovicm
Copy link
Contributor

Thanks @chenkovsky i think changes make sense, very clean implementation

@milenkovicm milenkovicm requested a review from alamb April 17, 2025 11:23
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chenkovsky and @milenkovicm . I have one suggestion for your consideration, but I think this is better than what is on main

Comment on lines 465 to 471
let arrow_type =
col.arrow_type.as_ref().unwrap().try_into().map_err(|e| {
proto_error(format!(
"Received an unknown ArrowType: {}",
e
))
})?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to avoid an unwrap here as that will panic rather than returning an error on invalid protobuf

Suggested change
let arrow_type =
col.arrow_type.as_ref().unwrap().try_into().map_err(|e| {
proto_error(format!(
"Received an unknown ArrowType: {}",
e
))
})?;
let Some(arrow_type) = col.arrow_type.as_ref() else {
return Err(proto_error(format!(
"Missing Arrow type in partition columns"
)));
};
let arrow_type = DataType::try_from(arrow_type).map_err(|e| {
proto_error(format!("Received an unknown ArrowType: {}", e))
})?;

@alamb
Copy link
Contributor

alamb commented Apr 17, 2025

Thanks again @chenkovsky

@alamb alamb merged commit a4d494c into apache:main Apr 17, 2025
27 checks passed
nirnayroy pushed a commit to nirnayroy/datafusion that referenced this pull request May 2, 2025
* fix: serialize listing table without partition column

* remove unwrap

* format

* clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proto Related to proto crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partitioned ListingTable read fails after logical plan ser/de
3 participants