Skip to content

Commit de95a7b

Browse files
committed
chore: simplified name_idx advancement
1 parent e3d3aca commit de95a7b

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

  • datafusion/substrait/src/logical_plan/consumer/rel

datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use crate::logical_plan::consumer::SubstraitConsumer;
1919
use crate::logical_plan::consumer::from_substrait_literal;
2020
use crate::logical_plan::consumer::from_substrait_named_struct;
21-
use crate::logical_plan::consumer::utils::{ensure_schema_compatibility, rename_field};
21+
use crate::logical_plan::consumer::utils::ensure_schema_compatibility;
2222
use datafusion::common::{
2323
DFSchema, DFSchemaRef, TableReference, not_impl_err, plan_err,
2424
substrait_datafusion_err, substrait_err,
@@ -158,12 +158,10 @@ pub async fn from_read_rel(
158158

159159
let mut row_exprs = vec![];
160160
let mut name_idx = 0;
161-
for (field_idx, expression) in row.fields.iter().enumerate() {
161+
for expression in &row.fields {
162162
let expr = match expression.rex_type.as_ref() {
163163
Some(substrait::proto::expression::RexType::Literal(lit)) => {
164-
if !named_struct.names.is_empty() {
165-
name_idx += 1; // top-level names are provided through schema
166-
}
164+
name_idx += 1; // top-level names are provided through schema
167165
Expr::Literal(
168166
from_substrait_literal(
169167
consumer,
@@ -175,12 +173,7 @@ pub async fn from_read_rel(
175173
)
176174
}
177175
_ => {
178-
rename_field(
179-
substrait_schema.field(field_idx).as_ref(),
180-
&named_struct.names,
181-
field_idx,
182-
&mut name_idx,
183-
)?;
176+
name_idx += 1; // top-level names are provided through schema
184177
consumer
185178
.consume_expression(expression, &substrait_schema)
186179
.await?

0 commit comments

Comments
 (0)