wgtmac commented on code in PR #158:
URL: https://github.com/apache/iceberg-cpp/pull/158#discussion_r2250258374


##########
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:
   Just simply check if any field (whether leaf or non-leaf) has field-id. This 
is in sync with the Java impl.



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

Reply via email to