zhjwpku commented on code in PR #132:
URL: https://github.com/apache/iceberg-cpp/pull/132#discussion_r2174339367


##########
src/iceberg/transform_function.cc:
##########
@@ -48,7 +48,27 @@ Result<ArrowArray> BucketTransform::Transform(const 
ArrowArray& input) {
 }
 
 Result<std::shared_ptr<Type>> BucketTransform::ResultType() const {
-  return NotImplemented("BucketTransform::result_type");
+  auto src_type = source_type();
+  if (!src_type) {
+    return NotSupported("null is not a valid input type for bucket transform");
+  }
+  switch (src_type->type_id()) {
+    case TypeId::kInt:
+    case TypeId::kLong:
+    case TypeId::kDecimal:
+    case TypeId::kDate:
+    case TypeId::kTime:
+    case TypeId::kTimestamp:
+    case TypeId::kTimestampTz:
+    case TypeId::kString:
+    case TypeId::kUuid:
+    case TypeId::kFixed:
+    case TypeId::kBinary:
+      return std::make_shared<IntType>();

Review Comment:
   I've always wanted to add a singleton for each primitive type. If we reach a 
consensus, I can create a separate PR to implement that. WDYT @wgtmac @lidavidm 
@gty404 @mapleFU @Fokko @raulcd 



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