| 152 | } |
| 153 | |
| 154 | Status StructToNode(const std::shared_ptr<::arrow::StructType>& type, |
| 155 | const std::string& name, bool nullable, int field_id, |
| 156 | const WriterProperties& properties, |
| 157 | const ArrowWriterProperties& arrow_properties, NodePtr* out) { |
| 158 | std::vector<NodePtr> children(type->num_fields()); |
| 159 | if (type->num_fields() != 0) { |
| 160 | for (int i = 0; i < type->num_fields(); i++) { |
| 161 | RETURN_NOT_OK(FieldToNode(type->field(i)->name(), type->field(i), properties, |
| 162 | arrow_properties, &children[i])); |
| 163 | } |
| 164 | } else { |
| 165 | // XXX (ARROW-10928) We could add a dummy primitive node but that would |
| 166 | // require special handling when writing and reading, to avoid column index |
| 167 | // mismatches. |
| 168 | return Status::NotImplemented("Cannot write struct type '", name, |
| 169 | "' with no child field to Parquet. " |
| 170 | "Consider adding a dummy child field."); |
| 171 | } |
| 172 | |
| 173 | *out = GroupNode::Make(name, RepetitionFromNullable(nullable), children, nullptr, |
| 174 | field_id); |
| 175 | return Status::OK(); |
| 176 | } |
| 177 | |
| 178 | static std::shared_ptr<const LogicalType> TimestampLogicalTypeFromArrowTimestamp( |
| 179 | const ::arrow::TimestampType& timestamp_type, ::arrow::TimeUnit::type time_unit) { |
no test coverage detected