Commit e2e67b0
fix(connector): make testSchema tolerant of non-shaded Avro and JSON whole-number doubles
Two pre-existing failures in the connector PulsarCassandraSourceTests.testSchema
(across Avro and JSON variants), surfaced by running the suite on jdk 17 as
well as 11. Neither is caused by the Kafka work; they stem from the
messaging-abstraction migration and were partially addressed before (see
51f872b, which made assertMapsEqual tolerant of shaded/non-shaded Avro Utf8).
1) Avro: java.lang.ClassCastException casting org.apache.avro.generic.GenericData$Array
to the Pulsar-shaded GenericData$Array. Pulsar's GenericRecord.getField()
returns collection (array) columns as NON-shaded Avro objects even though
nested records come back shaded, so the shaded-typed assertions throw.
Fix: normalizeToShadedAvro() round-trips any non-shaded Avro GenericContainer
through binary Avro into the shaded type in genericRecordToMap(), deeply
converting arrays and everything nested (records, maps, strings, CQL
logical-type records) so the existing shaded assertions work unchanged. The
writer uses GenericData.get() (no registered conversions) so raw datums are
written verbatim. Also make the map-of-tuple assertion look up its key by
string and normalize the tuple value.
2) JSON: "double expected:<1.0> but was:<1>". A whole-number double/float is
serialized to JSON as `1`, which Jackson reads as an IntNode, so a
type-sensitive equals against the expected Double fails. Compare double/float
numerically (via asDouble) instead.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent ebdc30f commit e2e67b0
7 files changed
Lines changed: 57 additions & 2362 deletions
File tree
- connector/src/test/java/com/datastax/oss/pulsar/source
- docs
Lines changed: 57 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
777 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
778 | 786 | | |
779 | 787 | | |
780 | 788 | | |
| |||
943 | 951 | | |
944 | 952 | | |
945 | 953 | | |
946 | | - | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
947 | 958 | | |
948 | 959 | | |
949 | | - | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
950 | 965 | | |
951 | 966 | | |
952 | 967 | | |
| |||
1347 | 1362 | | |
1348 | 1363 | | |
1349 | 1364 | | |
1350 | | - | |
| 1365 | + | |
1351 | 1366 | | |
1352 | 1367 | | |
1353 | 1368 | | |
1354 | 1369 | | |
1355 | 1370 | | |
1356 | 1371 | | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1357 | 1410 | | |
1358 | 1411 | | |
1359 | 1412 | | |
| |||
0 commit comments