zeroshade commented on code in PR #524:
URL: https://github.com/apache/iceberg-go/pull/524#discussion_r2325606358


##########
exprs.go:
##########
@@ -482,8 +482,33 @@ func (b *boundRef[T]) Equals(other BoundTerm) bool {
 }
 
 func (b *boundRef[T]) Ref() BoundReference { return b }
-func (b *boundRef[T]) Field() NestedField  { return b.field }
-func (b *boundRef[T]) Type() Type          { return b.field.Type }
+
+func unwrapLogicalTypeValue(v any) any {
+       if m, ok := v.(map[string]any); ok {
+               if val, exists := m["long.timestamp-micros"]; exists {
+                       if microseconds, ok := val.(int64); ok {
+                               return Timestamp(microseconds)
+                       }
+               }
+
+               if val, exists := m["int.date"]; exists {
+                       if days, ok := val.(int32); ok {
+                               return days
+                       }
+               }
+
+               if val, exists := m["long.time-micros"]; exists {
+                       if microseconds, ok := val.(int64); ok {
+                               return Time(microseconds)
+                       }
+               }
+       }
+
+       return v

Review Comment:
   Could we limit the usage of the `map[string]any{....}` to the path where we 
actually write the Avro? and use the `iceberg.Literal` everywhere else in the 
this lib? (i.e. on read we convert to `iceberg.Literal` and on write we convert 
from `Literal` -> the map). That's mostly my issue here, I don't want the 
`map[string]any` portion to leak to the expression handling



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to