You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Anant Damle (Jira)" <ji...@apache.org> on 2021/05/21 14:26:00 UTC

[jira] [Updated] (BEAM-12385) AvroUtils exception when converting JDBC Row to GenericRecord

     [ https://issues.apache.org/jira/browse/BEAM-12385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anant Damle updated BEAM-12385:
-------------------------------
    Description: 
`{{AvroUtils.toAvroSchema()}}` and `{{AvroUtils.toGenericRecord()}}` throw exception for JDBC specific logical types like: `{{DATE}}`, `{{NVARCHAR}}`, `{{VARCHAR}}`, `{{LONGVARCHAR}}` etc.

 
{code:java}
pipeline
  .apply(JdbcIO.readRows()...)
  .apply(MapElements.via(
        (Row row) -> {
         // This statement throws Exception "Unhandled Logical Type"
          org.apache.avro.Schema schema = AvroUtils.toAvroSchema(row.getSchema());
        }));
{code}
 

 

This can be handled by adding additional case-statements in AvroUtils:

  was:
`AvroUtils.toAvroSchema()` and `AvroUtils.toGenericRecord()` throw exception for JDBC specific logical types like: `Date`, `NVARCHAR`, `VARCHAR`, `LONGVARCHAR` etc.

 
{code:java}
pipeline
  .apply(JdbcIO.readRows()...)
  .apply(MapElements.via(
        (Row row) -> {
         // This statement throws Exception "Unhandled Logical Type"
          org.apache.avro.Schema schema = AvroUtils.toAvroSchema(row.getSchema());
        }));
{code}
 

 

This can be handled by adding additional case-statements in AvroUtils:


> AvroUtils exception when converting JDBC Row to GenericRecord
> -------------------------------------------------------------
>
>                 Key: BEAM-12385
>                 URL: https://issues.apache.org/jira/browse/BEAM-12385
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Anant Damle
>            Priority: P2
>
> `{{AvroUtils.toAvroSchema()}}` and `{{AvroUtils.toGenericRecord()}}` throw exception for JDBC specific logical types like: `{{DATE}}`, `{{NVARCHAR}}`, `{{VARCHAR}}`, `{{LONGVARCHAR}}` etc.
>  
> {code:java}
> pipeline
>   .apply(JdbcIO.readRows()...)
>   .apply(MapElements.via(
>         (Row row) -> {
>          // This statement throws Exception "Unhandled Logical Type"
>           org.apache.avro.Schema schema = AvroUtils.toAvroSchema(row.getSchema());
>         }));
> {code}
>  
>  
> This can be handled by adding additional case-statements in AvroUtils:



--
This message was sent by Atlassian Jira
(v8.3.4#803005)