tanmayrauth commented on code in PR #1590:
URL: https://github.com/apache/iceberg-go/pull/1590#discussion_r3678324365


##########
table/substrait/substrait.go:
##########
@@ -318,6 +319,21 @@ func toSubstraitLiteral(typ iceberg.Type, lit 
iceberg.Literal) expr.Literal {
                }
 
                return toPrimitiveSubstraitLiteral(types.Timestamp(lit))
+       case iceberg.TimestampNsLiteral:
+               var (
+                       result expr.Literal
+                       err    error
+               )
+               if typ.Equals(iceberg.PrimitiveTypes.TimestampTzNs) {
+                       result, err = 
literal.NewPrecisionTimestampTz(types.PrecisionNanoSeconds, int64(lit), false)
+               } else {
+                       result, err = 
literal.NewPrecisionTimestamp(types.PrecisionNanoSeconds, int64(lit), false)
+               }
+               if err != nil {
+                       panic(err)

Review Comment:
   panic(err) here turns a library error into a process-crashing panic, whereas 
the enclosing ConvertExpr/VisitExpr both return error — so on the one path that 
could fail, a caller of the public ConvertExpr gets a panic instead of an err. 
It's effectively unreachable since PrecisionNanoSeconds is a valid constant and 
NewPrecisionTimestamp won't error on it, and it matches the existing panic 
style in this file (default case, getRef), so this is just a consistency note 
rather than a fix I'd block on — surfacing it in case you'd rather thread the 
error out to match the function's contract.



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