reuvenlax commented on code in PR #32081:
URL: https://github.com/apache/beam/pull/32081#discussion_r1817565801


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/FieldValueGetter.java:
##########
@@ -29,7 +30,7 @@
  * <p>Implementations of this interface are generated at runtime to map object 
fields to Row fields.
  */
 @Internal
-public interface FieldValueGetter<ObjectT, ValueT> extends Serializable {
+public interface FieldValueGetter<ObjectT extends @NonNull Object, ValueT> 
extends Serializable {

Review Comment:
   Generally in Beam I've mostly seen us using @Nullable, not @NonNull. I 
believe that NonNull is assumed unless @Nullable is specified. Are you not 
finding that to be the case?



##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/GetterBasedSchemaProvider.java:
##########
@@ -112,22 +111,28 @@ public SchemaUserTypeCreator schemaTypeCreator(
     return schemaTypeCreator(targetTypeDescriptor.getRawType(), schema);
   }
 
-  private class ToRowWithValueGetters<T> implements SerializableFunction<T, 
Row> {
+  private class ToRowWithValueGetters<T extends @NonNull Object>
+      implements SerializableFunction<T, Row> {
     private final Schema schema;
-    private final Factory<List<FieldValueGetter>> getterFactory;
+    private final Factory<List<FieldValueGetter<?, ?>>> getterFactory;
 
     public ToRowWithValueGetters(Schema schema) {
       this.schema = schema;
       // Since we know that this factory is always called from inside the 
lambda with the same
       // schema, return a caching factory that caches the first value seen for 
each class. This
       // prevents having to lookup the getter list each time createGetters is 
called.
       this.getterFactory =
-          
RowValueGettersFactory.of(GetterBasedSchemaProvider.this::fieldValueGetters);
+          RowValueGettersFactory.of(
+              (Factory<List<FieldValueGetter<?, ?>>>)
+                  (typeDescriptor, schema1) ->
+                      (List)
+                          GetterBasedSchemaProvider.this.fieldValueGetters(
+                              typeDescriptor, schema1));
     }
 
     @Override
     public Row apply(T input) {
-      return Row.withSchema(schema).withFieldValueGetters(getterFactory, 
input);
+      return Row.withSchema(schema).withFieldValueGetters((Factory) 
getterFactory, input);

Review Comment:
   ok



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

Reply via email to