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


##########
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:
   yeah, good question - I'm playing with that code right now and I think I 
could get rid of it actually



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