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


##########
src/iceberg/sort_order.cc:
##########
@@ -113,20 +113,9 @@ Result<std::unique_ptr<SortOrder>> SortOrder::Make(const 
Schema& schema, int32_t
     return InvalidArgument("Sort order must have at least one sort field");
   }
 
-  for (const auto& field : fields) {
-    ICEBERG_ASSIGN_OR_RAISE(auto schema_field, 
schema.FindFieldById(field.source_id()));
-    if (schema_field == std::nullopt) {
-      return InvalidArgument("Cannot find source column for sort field: {}", 
field);
-    }
-
-    const auto& source_type = schema_field.value().get().type();
-    if (field.transform()->CanTransform(*source_type) == false) {
-      return InvalidArgument("Invalid source type {} for transform {}",
-                             source_type->ToString(), 
field.transform()->ToString());
-    }
-  }
-
-  return std::make_unique<SortOrder>(sort_id, std::move(fields));
+  auto sort_order = std::make_unique<SortOrder>(sort_id, std::move(fields));
+  ICEBERG_RETURN_UNEXPECTED(sort_order->Validate(schema));

Review Comment:
   cc @zhjwpku 



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