gbrgr commented on code in PR #1824:
URL: https://github.com/apache/iceberg-rust/pull/1824#discussion_r2517729036
##########
crates/iceberg/src/arrow/record_batch_transformer.rs:
##########
@@ -270,11 +302,21 @@ impl RecordBatchTransformer {
snapshot_schema: &IcebergSchema,
projected_iceberg_field_ids: &[i32],
field_id_to_mapped_schema_map: HashMap<i32, (FieldRef, usize)>,
+ constants_map: &HashMap<i32, PrimitiveLiteral>,
) -> Result<Vec<ColumnSource>> {
let field_id_to_source_schema_map =
Self::build_field_id_to_arrow_schema_map(source_schema)?;
projected_iceberg_field_ids.iter().map(|field_id|{
+ // Check if this is a constant/virtual field first
+ if let Some(constant_value) = constants_map.get(field_id) {
+ // This is a virtual field - add it with the constant value
+ return Ok(ColumnSource::Add {
+ value: Some(constant_value.clone()),
+ target_type:
Self::primitive_literal_to_arrow_type(constant_value)?,
Review Comment:
I store fields now instead of constants, the double lookup is not easily
avoidable in the current grand scheme of things, and should not hurt.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]