emkornfield commented on a change in pull request #8939:
URL: https://github.com/apache/arrow/pull/8939#discussion_r544474457
##########
File path: cpp/src/parquet/arrow/schema.cc
##########
@@ -113,12 +114,21 @@ Status StructToNode(const
std::shared_ptr<::arrow::StructType>& type,
const WriterProperties& properties,
const ArrowWriterProperties& arrow_properties, NodePtr*
out) {
std::vector<NodePtr> children(type->num_fields());
- for (int i = 0; i < type->num_fields(); i++) {
- RETURN_NOT_OK(FieldToNode(type->field(i)->name(), type->field(i),
properties,
- arrow_properties, &children[i]));
+ if (type->num_fields() != 0) {
+ for (int i = 0; i < type->num_fields(); i++) {
+ RETURN_NOT_OK(FieldToNode(type->field(i)->name(), type->field(i),
properties,
+ arrow_properties, &children[i]));
+ }
+ } else {
+ // XXX (ARROW-10928) We could add a dummy primitive node but that would
+ // require special handling when writing and reading, to avoid column index
+ // mismatches.
+ return Status::NotImplemented(
+ "Cannot write struct type with no child fields to Parquet. "
Review comment:
would the struct field have a name here? Consider removing "dummy" from
the message.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]