Copilot commented on code in PR #15175:
URL: https://github.com/apache/iceberg/pull/15175#discussion_r2739610273


##########
api/src/main/java/org/apache/iceberg/util/StructProjection.java:
##########
@@ -179,12 +180,21 @@ public int projectedFields() {
   }
 
   public StructProjection wrap(StructLike newStruct) {
+    return wrap(newStruct, null);
+  }
+
+  public StructProjection wrap(StructLike newStruct, String description) {
     this.struct = newStruct;
+    this.description = description;
     return this;
   }
 

Review Comment:
   The public method `getDescription()` lacks documentation explaining what the 
description represents, when it may be null, and its intended use case. 
Consider adding a Javadoc comment.
   ```suggestion
   
     /**
      * Returns the optional description associated with the currently wrapped 
{@link StructLike}.
      *
      * <p>The description is a human-readable identifier or context string 
supplied when calling
      * {@link #wrap(StructLike, String)}. It may be {@code null}, for example 
when
      * {@link #wrap(StructLike)} is used or when {@code null} is explicitly 
passed as the
      * description.
      *
      * <p>The description, if present, is propagated to projections created via
      * {@link #copyFor(StructLike)}.
      *
      * @return the description for the wrapped struct, or {@code null} if no 
description was set
      */
   ```



##########
api/src/main/java/org/apache/iceberg/util/StructProjection.java:
##########
@@ -179,12 +180,21 @@ public int projectedFields() {
   }
 
   public StructProjection wrap(StructLike newStruct) {
+    return wrap(newStruct, null);
+  }
+

Review Comment:
   The overloaded `wrap` method with description parameter lacks documentation 
explaining the purpose of the description parameter and when it should be 
provided versus using the no-argument version.
   ```suggestion
   
     /**
      * Wraps a new {@link StructLike} instance in this projection.
      *
      * <p>The {@code description} is an optional, human-readable label for the 
wrapped struct,
      * which may be used in diagnostics such as error messages or logging. 
Callers that do not
      * need to associate a description with the struct can use {@link 
#wrap(StructLike)} instead,
      * which is equivalent to passing {@code null} for this parameter.
      *
      * @param newStruct   the struct to wrap with this projection, or {@code 
null}
      * @param description an optional description of the wrapped struct, or 
{@code null}
      * @return this projection, wrapping the given struct
      */
   ```



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