apache / apache/beam

[Bug]: JdbcIO.readRows() incompatible with AvroUtils for DECIMAL\NUMERIC(10,2)

Open
#27,380 3 comments 0 reactions 0 assignees View on GitHub
awaiting triage bug java P3 stale
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

### What happened?

1. use `JdbcIO.readRows()` for table with `DECIMAL(10,2)`
2. it reads BigDecimals fine but Schema has just DECIMAL type without scale
3. then, when I attempt to serialise these rows into Avro, I got
` AvroTypeException("Cannot encode decimal with scale 2 as scale 0 without rounding")
from org.apache.avro.Conversions.DecimalConversion.validate() `

mailing list https://lists.apache.org/thread/qxwron01myf5fzrb3d8tsh71grt5cpzk
PR fixes #27333

### Issue Priority

Priority: 3 (minor)

### Issue Components

- [ ] Component: Python SDK
- [X] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.