waterWang opened a new pull request, #39734:
URL: https://github.com/apache/beam/pull/39734
### Problem
`AttributeValueCoder.encode` cannot encode a DynamoDB attribute whose value
is an **empty list** or an **empty map** — it throws `CoderException("Unknown
Type")`.
The `L` and `M` branches are guarded with `size() > 0`:
```java
} else if (value.l() != null && value.l().size() > 0) { // wrong:
DynamoDB allows an empty L
} else if (value.m() != null && value.m().size() > 0) { // wrong:
DynamoDB allows an empty M
```
### Fix
Remove the `size() > 0` guard for `L` and `M` branches. The `decode` side
already handles empty lists and maps correctly via `ListCoder`/`MapCoder` —
only `encode` rejects them.
### Blast radius
A single empty list nested anywhere inside an item makes the whole item
unencodable, because `MAP_ATTRIBUTE_CODER` re-enters this coder for every child.
Fixes #39730
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]