aokolnychyi commented on code in PR #7517:
URL: https://github.com/apache/iceberg/pull/7517#discussion_r1186431977


##########
api/src/main/java/org/apache/iceberg/util/StructProjection.java:
##########
@@ -189,16 +189,12 @@ public int size() {
 
   @Override
   public <T> T get(int pos, Class<T> javaClass) {
-    if (struct == null) {
-      // Return a null struct when projecting a nested required field from an 
optional struct.
-      // See more details in issue #2738.
-      return null;
-    }
-
     int structPos = positionMap[pos];
-
     if (nestedProjections[pos] != null) {
-      return javaClass.cast(nestedProjections[pos].wrap(struct.get(structPos, 
StructLike.class)));
+      StructLike nestedStruct = struct.get(structPos, StructLike.class);
+      return nestedStruct == null

Review Comment:
   minor: ternary operators split on multiple lines are bit hard to read, in my 
view. I'd consider using `if`.



##########
api/src/main/java/org/apache/iceberg/util/StructProjection.java:
##########
@@ -189,16 +189,12 @@ public int size() {
 
   @Override
   public <T> T get(int pos, Class<T> javaClass) {
-    if (struct == null) {
-      // Return a null struct when projecting a nested required field from an 
optional struct.
-      // See more details in issue #2738.
-      return null;
-    }
-
     int structPos = positionMap[pos];
-
     if (nestedProjections[pos] != null) {
-      return javaClass.cast(nestedProjections[pos].wrap(struct.get(structPos, 
StructLike.class)));
+      StructLike nestedStruct = struct.get(structPos, StructLike.class);
+      return nestedStruct == null

Review Comment:
   minor: Ternary operators split on multiple lines are bit hard to read, in my 
view. I'd consider using `if`.



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