wgtmac commented on code in PR #158:
URL: https://github.com/apache/iceberg-cpp/pull/158#discussion_r2250261452
##########
src/iceberg/parquet/parquet_schema_util.cc:
##########
@@ -30,8 +33,21 @@ Result<std::vector<int>> SelectedColumnIndices(const
SchemaProjection& projectio
return NotImplemented("NYI");
}
-Result<bool> HasFieldIds(const ::parquet::schema::NodePtr& root_node) {
- return NotImplemented("NYI");
+bool HasFieldIds(const ::parquet::schema::NodePtr& node) {
+ if (node->field_id() >= 0) {
+ return true;
+ }
+
+ if (node->is_group()) {
+ auto group_node =
internal::checked_pointer_cast<::parquet::schema::GroupNode>(node);
+ for (int i = 0; i < group_node->field_count(); i++) {
+ if (HasFieldIds(group_node->field(i))) {
+ return true;
+ }
+ }
Review Comment:
I think we cannot blindly check if all fields have ids because it is valid
to have some fields that do not have ids, especially when variant type is
supported.
--
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]