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


##########
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 knew that for 3-levels complex type, fieldId might not exists, but here I 
don't fully understand the purpose, so any leaf has field-id means writer is 
field-id aware?



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