You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "westonpace (via GitHub)" <gi...@apache.org> on 2023/07/20 17:26:09 UTC

[GitHub] [arrow] westonpace opened a new issue, #36792: [C++] Serializing to Substrait does not include all field names if there is a list with structs

westonpace opened a new issue, #36792:
URL: https://github.com/apache/arrow/issues/36792

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   Currently field names are figured out using this method:
   
   ```
   void ToProtoGetDepthFirstNames(const FieldVector& fields,
                                  google::protobuf::RepeatedPtrField<std::string>* names) {
     for (const auto& field : fields) {
       *names->Add() = field->name();
   
       if (field->type()->id() == Type::STRUCT) {
         ToProtoGetDepthFirstNames(field->type()->fields(), names);
       }
     }
   }
   ```
   
   If there is a list / large list / map (dictionary? extension?) that has children then their names will not be included in the result.
   
   For example, given the schema:
   
   ```
     auto schema = arrow::schema(
         {arrow::field("preceding_field", arrow::int32()),
          arrow::field("points",
                       arrow::list(arrow::field(
                           "point", arrow::struct_(
                                        {arrow::field("x", arrow::float64()),
                                         arrow::field("y", arrow::float64())})))),
          arrow::field("trailing_field", arrow::int32())});
   ```
   
   I would expect the names to be `["preceding_field", "points", "x", "y", "trailing_field"]` but I only get `["preceding_field", "points", "trailing_field"]`.
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org