Skip to content

Commit

Permalink
feat: support arrow_struct_to_iceberg_struct (#731)
Browse files Browse the repository at this point in the history
This PR introduces the function to convert arrow struct to iceberg
struct. This function is needed when we add fanout partition writer: In
this writer, we need to compute the partition value using record batch
and convert them into struct value finally and set into data file.

---------

Co-authored-by: ZENOTME <[email protected]>
  • Loading branch information
ZENOTME and ZENOTME authored Feb 27, 2025
1 parent eb4c668 commit ba71eea
Show file tree
Hide file tree
Showing 6 changed files with 1,399 additions and 4 deletions.
3 changes: 2 additions & 1 deletion crates/iceberg/src/arrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ pub use schema::*;
mod reader;
pub(crate) mod record_batch_projector;
pub(crate) mod record_batch_transformer;

mod value;
pub use reader::*;
pub use value::*;
2 changes: 1 addition & 1 deletion crates/iceberg/src/arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn arrow_type_to_type(ty: &DataType) -> Result<Type> {

const ARROW_FIELD_DOC_KEY: &str = "doc";

fn get_field_id(field: &Field) -> Result<i32> {
pub(super) fn get_field_id(field: &Field) -> Result<i32> {
if let Some(value) = field.metadata().get(PARQUET_FIELD_ID_META_KEY) {
return value.parse::<i32>().map_err(|e| {
Error::new(
Expand Down
Loading

0 comments on commit ba71eea

Please sign in to comment.