zhjwpku commented on code in PR #156:
URL: https://github.com/apache/iceberg-cpp/pull/156#discussion_r2249939683
##########
src/iceberg/transform_function.cc:
##########
@@ -51,6 +60,57 @@ Result<ArrowArray> BucketTransform::Transform(const
ArrowArray& input) {
return NotImplemented("BucketTransform::Transform");
}
+Result<std::optional<Literal>> BucketTransform::Transform(const Literal&
literal) {
+ assert(literal.type() == source_type());
+ if (literal.IsBelowMin() || literal.IsAboveMax()) {
+ return InvalidArgument(
+ "Cannot apply bucket transform to literal with value {} of type {}",
+ literal.ToString(), source_type()->ToString());
+ }
+ int32_t hash_value = 0;
+ switch (source_type()->type_id()) {
Review Comment:
I've implemented this idea in `BucketTransform::Transform`. Since we're not
handling all of the variant's alternative types, I added a branch with
std::unreachable(). I'm not sure if this is the best approach, please take
another look when you have a chance. @lidavidm @mapleFU @wgtmac
--
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]