You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Moritz Mack (Jira)" <ji...@apache.org> on 2021/10/22 12:59:00 UTC

[jira] [Commented] (BEAM-10071) TableFieldSchema Conversion fails for beamschema

    [ https://issues.apache.org/jira/browse/BEAM-10071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17432960#comment-17432960 ] 

Moritz Mack commented on BEAM-10071:
------------------------------------

This was fixed in BEAM-10490, no NPEs are thrown anymore.

Also looks like all supported datatypes are handled adequately. 
{code:java}
ret = BEAM_TO_BIGQUERY_TYPE_MAPPING.get(fieldType.getTypeName());
if (ret == null) {
  throw new IllegalArgumentException("Cannot convert Beam type: " + fieldType.getTypeName() + " to BigQuery type.");
}
{code}

> TableFieldSchema Conversion fails for beamschema
> ------------------------------------------------
>
>                 Key: BEAM-10071
>                 URL: https://issues.apache.org/jira/browse/BEAM-10071
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-gcp
>    Affects Versions: 2.20.0
>            Reporter: Jasper Duizendstra
>            Priority: P3
>              Labels: GCP, easy-fix, patch
>             Fix For: Not applicable
>
>
> field.setType(toStandardSQLTypeName(type).toString()); [on line 310 of BigQueryUtils.java|https://github.com/apache/beam/blob/455fca5ab79f74d4e79a81e66942878f35aaa08c/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java#L314] will fail with a java.lang.NullPointerException.
> The cause is the construction around line [210 return BEAM_TO_BIGQUERY_TYPE_MAPPING.get(fieldType.getTypeName()); |https://github.com/apache/beam/blob/455fca5ab79f74d4e79a81e66942878f35aaa08c/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java#L210]
> I believe the issue can be solved by adding the missing datatypes (CHAR, VARCHAR, NUMERIC, DATE, and BIT to the items on row [189|https://github.com/apache/beam/blob/455fca5ab79f74d4e79a81e66942878f35aaa08c/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java#L189]



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