PranjalChaitanya commented on code in PR #779:
URL: https://github.com/apache/iceberg-go/pull/779#discussion_r2943266198
##########
table/arrow_utils.go:
##########
@@ -715,12 +718,131 @@ func retOrPanic[T any](v T, err error) T {
return v
}
+// numericDefault converts v to T, accepting either the typed iceberg form or
+// the float64 that encoding/json produces when deserializing into any.
+func numericDefault[T ~int32 | ~int64 | ~float32 | ~float64](v any) T {
+ switch val := v.(type) {
+ case T:
+ return val
+ case float64:
+ return T(val)
+ }
Review Comment:
Yeah. The point of this is that when we are unmarshalling, it will always
produce a float 64 instead of an actual value.
If the value passed in programatically through Go, then you don't need to
unmarshall it and you just return the value.
If it is a float64 from JSON unmarshalling, you want to cast it.
--
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]