westonpace commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1018538923


##########
cpp/src/arrow/engine/substrait/expression_internal.cc:
##########
@@ -170,9 +170,10 @@ Result<compute::Expression> FromProto(const 
substrait::Expression& expr,
               out = compute::field_ref(FieldRef(*out_ref, index));
             } else if (out->call() && out->call()->function_name == 
"struct_field") {
               // Nested StructFields on top of an arbitrary expression
-              std::static_pointer_cast<arrow::compute::StructFieldOptions>(
-                  out->call()->options)
-                  ->indices.push_back(index);
+              auto* field_options =
+                  
checked_cast<compute::StructFieldOptions*>(out->call()->options.get());
+              field_options->field_ref =
+                  FieldRef(std::move(field_options->field_ref), index);

Review Comment:
   Yes, `FromProto` will always have integer indices (note that `index` comes 
from `ref->struct_field().field()` which is `int`).  So I don't see any harm 
here.  This looks good to me.



-- 
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]

Reply via email to