[ 
https://issues.apache.org/jira/browse/BEAM-960?focusedWorklogId=684106&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-684106
 ]

ASF GitHub Bot logged work on BEAM-960:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Nov/21 20:46
            Start Date: 19/Nov/21 20:46
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on a change in pull request 
#15954:
URL: https://github.com/apache/beam/pull/15954#discussion_r753520835



##########
File path: 
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
##########
@@ -900,8 +913,32 @@ public void populateDisplayData(DisplayData.Builder 
builder) {
       return 
toBuilder().setOutputParallelization(outputParallelization).build();
     }
 
+    private Coder<OutputT> inferCoder(CoderRegistry registry) {
+      if (getCoder() != null) {
+        return getCoder();
+      } else {
+        RowMapper<OutputT> rowMapper = getRowMapper();
+        TypeDescriptor<OutputT> outputType =
+            TypeDescriptors.extractFromTypeParameters(
+                rowMapper,
+                RowMapper.class,
+                new TypeVariableExtractor<RowMapper<OutputT>, OutputT>() {});
+        try {
+          return registry.getCoder(outputType);
+        } catch (CannotProvideCoderException e) {

Review comment:
       LOG the error as well ?




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 684106)
    Time Spent: 1h 40m  (was: 1.5h)

> JdbcIO should infer coder when possible (such as via RowMapper)
> ---------------------------------------------------------------
>
>                 Key: BEAM-960
>                 URL: https://issues.apache.org/jira/browse/BEAM-960
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-jdbc
>            Reporter: Kenneth Knowles
>            Priority: P3
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> There are a few ways that we typically do this:
> # Inspect the static args of the class implementing {{RowMapper}} to 
> determine the output type, then consult the coder registry. This method is 
> more limited and not lambda-friendly.
> # For the a "functional interface" version, like {{RowMapper}} that allows 
> setting the output type descriptor.
> # Also provide an abstract class-based version, for example accepting a 
> {{SimpleFunction}} that will automatically have a rich output type descriptor.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to