Skip to content

Commit

Permalink
only apply if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Lanham committed Sep 12, 2024
1 parent b4efe2f commit 57f3c96
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/src/engine/arrow_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,10 @@ impl ExpressionEvaluator for DefaultExpressionEvaluator {
let sa: &StructArray = array_ref
.as_struct_opt()
.ok_or(Error::unexpected_column_type("Expected a struct array"))?;
apply_schema(sa, &self.output_type)?
match ensure_data_types(&self.output_type, sa.data_type()) {
Ok(_) => sa.into(),
Err(_) => apply_schema(sa, &self.output_type)?
}
} else {
let schema = ArrowSchema::new(vec![ArrowField::new("output", arrow_type, true)]);
RecordBatch::try_new(Arc::new(schema), vec![array_ref])?
Expand Down

0 comments on commit 57f3c96

Please sign in to comment.