Skip to content

[Feature Request]: Support kw_only=True python dataclasses encoding/decoding #36978

@assaf127

Description

@assaf127

What would you like to happen?

Currently, python dataclasses are decoded by passing their encoded fields by position. This behavior does not work for dataclasses that are defined with kw_only=True (or has any kw_only fields).
Additionally, all dataclass fields are encoded and passed to the dataclass constructor, where only fields marked with init=True are accepted by the __init__ method of the dataclass.

Encoding the dataclass fields together with their field names and passing them by-keyword to the __init__ function should make handling of these type of dataclasses possible.
Encoding only the fields with init=True should make it possible to support dataclasses with init=False fields.

Issue Priority

Priority: 2 (default / most feature requests 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: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions