Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: numpy.int64 types are not serialized correctly #33020

Open
1 of 17 tasks
jrmccluskey opened this issue Nov 5, 2024 · 1 comment
Open
1 of 17 tasks

[Bug]: numpy.int64 types are not serialized correctly #33020

jrmccluskey opened this issue Nov 5, 2024 · 1 comment

Comments

@jrmccluskey
Copy link
Contributor

What happened?

Relevant repro of the problem:

image

Relevant error:

WARNING:apache_beam.coders.coder_impl:Using fallback deterministic coder for type '<class 'numpy.int64'>' in '[7]: Create/MaybeReshuffle/Reshuffle/ReshufflePerKey/GroupByKey'.
ERROR:apache_beam.runners.common:Unable to deterministically encode '0' of type '<class 'numpy.int64'>', please provide a type hint for the input of '[7]: Create/MaybeReshuffle/Reshuffle/ReshufflePerKey/GroupByKey' [while running '[7]: Create/Map(decode)']

The problem appears to be that the coder does not know how to handle the numpy int64 type and the fallback coder (PickleCoder, I believe) cannot encode the type deterministically so it clobbers the content inside the class to its base value of 0.

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: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@shoyer
Copy link
Contributor

shoyer commented Nov 5, 2024

Here's an another case which is clearly broken:

>>> [(np.int64(1), 'first'), (np.int64(2), 'second')] | beam.GroupByKey()
[(0, ['first', 'second'])]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants