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


##########
src/iceberg/util/type_util.cc:
##########
@@ -294,4 +305,87 @@ std::unordered_map<int32_t, int32_t> IndexParents(const 
StructType& root_struct)
   return id_to_parent;
 }
 
+AssignFreshIdVisitor::AssignFreshIdVisitor(std::function<int32_t()> next_id)
+    : next_id_(std::move(next_id)) {}
+
+std::shared_ptr<Type> AssignFreshIdVisitor::Visit(
+    const std::shared_ptr<Type>& type) const {
+  switch (type->type_id()) {
+    case TypeId::kStruct:
+      return Visit(*internal::checked_pointer_cast<StructType>(type));
+    case TypeId::kMap:
+      return Visit(*internal::checked_pointer_cast<MapType>(type));
+    case TypeId::kList:
+      return Visit(*internal::checked_pointer_cast<ListType>(type));
+    default:
+      return type;
+  }
+}
+
+std::shared_ptr<StructType> AssignFreshIdVisitor::Visit(const StructType& 
type) const {
+  auto fresh_ids = type.fields() |

Review Comment:
   FYI: there is a discussion thread for orders to generate these ids: 
https://lists.apache.org/thread/kwfy80s2nm6xcpohkrzznsmhqsmz32c3



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