Commit c733f0d
fix(connector): type assertGenericMap keys as Object for shaded/non-shaded Avro
Follow-up to the testSchema Avro tolerance fix. After normalizing non-shaded
Avro arrays to shaded, testSchema failed one layer deeper at assertGenericMap:
ClassCastException: org.apache.avro.util.Utf8 cannot be cast to
org.apache.pulsar.shade.org.apache.avro.util.Utf8
A map column (e.g. map<text,double>) comes back from Pulsar as a plain
java.util.Map whose keys are non-shaded Avro Utf8. The parameter type
Map<Utf8,Object> (shaded Utf8) made the compiler insert a checkcast to the
shaded Utf8 on getKey(), which threw even though keys are compared via
toString(). Type the parameter as Map<Object,Object> (as assertMapsEqual
already does) so no checkcast is inserted.
Top-level maps (ymap, ymapoftuple) are the only ones needing this -- maps
nested inside arrays (e.g. zmap inside ysetofudt) are already converted to
shaded by the binary round-trip in normalizeToShadedAvro.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent e2e67b0 commit c733f0d
1 file changed
Lines changed: 5 additions & 1 deletion
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
763 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
764 | 768 | | |
765 | 769 | | |
766 | 770 | | |
| |||
0 commit comments