RussellSpitzer commented on code in PR #13780:
URL: https://github.com/apache/iceberg/pull/13780#discussion_r2279909936


##########
core/src/main/java/org/apache/iceberg/SchemaParser.java:
##########
@@ -197,7 +197,12 @@ private static Type typeFromJson(JsonNode json) {
 
   private static Literal<?> defaultFromJson(String defaultField, Type type, 
JsonNode json) {
     if (json.has(defaultField)) {
-      return Expressions.lit(SingleValueParser.fromJson(type, 
json.get(defaultField)));
+      Object value = SingleValueParser.fromJson(type, json.get(defaultField));
+      if (type instanceof Types.TimestampNanoType) {
+        return Expressions.nanos((long) value);

Review Comment:
   We could precondition this, we will have slightly divergent behavior though. 
The normal path would bail out here
   
   
https://github.com/apache/iceberg/blob/d5476cae1b4e9b560f0126b7b9117630da9a37ca/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L58C6-L61C101
   
   So as written this would throw an NPE at a different spot only for nanos



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