Skip to content

[Bug]: Change reflection-based schema generation to generate deterministic schemas #29245

@scwhittle

Description

@scwhittle

What happened?

Currently schema fields are assigned ordering based upon ordering of ReflectUtils.getMethods and ReflectUtils.getFields.

ReflectUtils.getMethods ordering is based upon Class.getDeclaredMethods which has no specified ordering and may differ across JVMs. It appears that it must be somewhat consistent ordering in our test environment because changing the ordering to sort breaks tests relying on the current ordering.

ReflectUtils.getFields returns ordering based upon HashMap iteration over field names. There are tests that depend on this hash ordering as well (which might not be consistent if hashes are randomized as in some JVMs).

We should modify these methods to return a consistent ordering so that generated schemas for unmodified classes are consistent and not depending on unspecified ordering.

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

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions