Skip to content

[Bug]: Unable to use @FieldAccess in DoFn for fetching Nullable Schema Fields #30053

@R1421

Description

@R1421

What happened?

This is not my issue, but I have the same issue for java.lang.String and STRING. The full stack overflow post is here:

I'm attempting to do the following in my DoFn to extract a double value from an existing nullable field in my schema:
@FieldAccess("field1") Double field1
However I'm getting the following exception:
java.lang.IllegalArgumentException: Element argument type java.lang.Double does not work with expected schema field type DOUBLE
On debugging, the issue seems to be in ConvertHelpers.getConvertPrimitive(). Specifically, StaticSchemaInference.fieldFromType() seems to return FieldType DOUBLE NOT NULL regardless of whether a Double object or a primitive double is specified. This also then seems to cause a mismatch to the schema type which is only DOUBLE (i.e, without the NOT NULL).

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions