in crates/iceberg/src/spec/schema/prune_columns.rs [171:194]
fn list(&mut self, list: &ListType, value: Option<Type>) -> Result<Option<Type>> {
if self.selected.contains(&list.element_field.id) {
if self.select_full_types {
Ok(Some(Type::List(list.clone())))
} else if list.element_field.field_type.is_struct() {
let projected_struct = PruneColumn::project_selected_struct(value).unwrap();
return Ok(Some(Type::List(PruneColumn::project_list(
list,
Type::Struct(projected_struct),
)?)));
} else if list.element_field.field_type.is_primitive() {
return Ok(Some(Type::List(list.clone())));
} else {
return Err(Error::new(
ErrorKind::DataInvalid,
format!("Cannot explicitly project List or Map types, List element {} of type {} was selected", list.element_field.id, list.element_field.field_type),
));
}
} else if let Some(result) = value {
Ok(Some(Type::List(PruneColumn::project_list(list, result)?)))
} else {
Ok(None)
}
}