eneskeles commented on code in PR #2088:
URL: https://github.com/apache/iceberg-go/pull/2088#discussion_r4159152784
##########
literals.go:
##########
@@ -1529,9 +1529,17 @@ func (v VariantLiteral) To(typ Type) (Literal, error) {
return v, nil
}
- // TODO: improve by getting the actual value (using .Type()) and
attempting
- // to convert, or returning an error if it can't.
- return nil, fmt.Errorf("%w: VariantLiteral to %s", ErrBadCast, typ)
+ lit, ok := literalFromVariant(variant.Value(v))
+ if !ok {
+ return nil, fmt.Errorf("%w: VariantLiteral to %s", ErrBadCast,
typ)
+ }
+
+ out, err := lit.To(typ)
+ if err != nil {
+ return nil, fmt.Errorf("VariantLiteral: %w", err)
+ }
Review Comment:
Applied the suggestion
--
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]