vbarua commented on code in PR #23672:
URL: https://github.com/apache/datafusion/pull/23672#discussion_r3687096701
##########
datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:
##########
@@ -148,19 +148,45 @@ pub async fn from_read_rel(
let values = if !vt.expressions.is_empty() {
let mut exprs = vec![];
for row in &vt.expressions {
+ if row.fields.len() != substrait_schema.fields().len() {
+ return substrait_err!(
+ "Field count mismatch: expected {} fields but
found {} in virtual table row",
+ substrait_schema.fields().len(),
+ row.fields.len()
+ );
+ }
+
let mut row_exprs = vec![];
+ let mut name_idx = 0;
for expression in &row.fields {
- let expr = consumer
- .consume_expression(expression, &substrait_schema)
- .await?;
+ let expr = match expression.rex_type.as_ref() {
Review Comment:
Both branches increment `name_idx` by 1. I think we can extract that out out
before the match and expand on the comment with something like
```rust
// Top-level names are provided through schema
// Each expression consumes at least one name, and Literals may consume
additional names.
name_idx += 1;
```
to provide a bit more context about what is happening.
--
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]