You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/10/22 15:44:24 UTC

[GitHub] [beam] lukecwik commented on a change in pull request #13166: [BEAM-11091] Allow to specify coder for HadoopFormatIO.Read

lukecwik commented on a change in pull request #13166:
URL: https://github.com/apache/beam/pull/13166#discussion_r510266391



##########
File path: sdks/java/io/hadoop-format/src/main/java/org/apache/beam/sdk/io/hadoop/format/HadoopFormatIO.java
##########
@@ -437,6 +445,12 @@
           .build();
     }
 
+    /** Transforms the keys read from the source using the given key translation function. */
+    public Read<K, V> withKeyTranslation(SimpleFunction<?, K> function, Coder<K> coder) {

Review comment:
       Since we don't need the type information anymore, we should use SerializableFunction instead of SimpleFunction.

##########
File path: sdks/java/io/hadoop-format/src/main/java/org/apache/beam/sdk/io/hadoop/format/HadoopFormatIO.java
##########
@@ -437,6 +445,12 @@
           .build();
     }
 
+    /** Transforms the keys read from the source using the given key translation function. */
+    public Read<K, V> withKeyTranslation(SimpleFunction<?, K> function, Coder<K> coder) {

Review comment:
       You need to clear the keyCoder/valueCoder in the non coder based variants otherwise we won't honor the typedescriptor when the user changes the translation function




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org