hutiefang76 opened a new pull request, #12905:
URL: https://github.com/apache/seatunnel/pull/12905

   ### Purpose of this pull request
   
   Yes, contributing this fix to Apache SeaTunnel.
   
   Fixes #12901. Seven format readers currently call `toString()` on an 
`Optional<TablePath>` when stamping row metadata. A configured table such as 
`database.schema.table` becomes `Optional[database.schema.table]`.
   
   Unwrap the existing, presence-checked value in Avro, JSON, CSV, Text, 
Protobuf and the native/compatible Kafka Connect readers. This is the same 
correction at eight stamping sites across six modules. Constructor signatures, 
null guards, row kinds and event-time handling are unchanged.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Collected/deserialized rows carry the actual catalog table path instead 
of the malformed Optional text. For ordinary JSON, the change applies to 
`collect(...)`; direct `deserialize(byte[])` retains its existing metadata 
behavior.
   
   Decoded field values and connector routing priority are unchanged. Consumers 
that matched the malformed identifier need to use the plain path. Downstream 
sinks and CDC serializers that derive database/table names from `tableId` now 
receive the correct identifier, so the metadata they generate can change. The 
new EN/ZH compatibility notes describe this impact. This does not claim to 
change a connector's choice between its configured topic and a row's tableId.
   
   ### How was this patch tested?
   
   Before changing each affected reader, the targeted baseline tests executed 
12 cases: 8 metadata assertion failures and 4 passing controls, with no errors 
or skips. The failures cover five ordinary formats plus Kafka Connect native 
records, compatible object payloads and compatible array payloads.
   
   After the fix, all six affected module suites passed: Avro 9, JSON 57, CSV 
17, Text 13, Protobuf 20 and compatible-connect-json 4 — 120 tests total, with 
no failures, errors or skips. These include all 12 new regressions/controls, 
both Protobuf input overloads, no-catalog controls for supported constructors, 
and null ConsumerRecord controls. An ordinary JSON-to-Maxwell case also checks 
the resulting database/table metadata.
   
   The tests use actual serializers/deserializers, Kafka `ConsumerRecord` 
instances and Kafka's `JsonConverter` to produce schema-bearing object/array 
messages. No broker is needed to establish this metadata conversion bug. The 
compatible-connect-json module previously had no tests, so it receives its 
first focused test class; the other tests extend existing classes without 
relaxing old assertions.
   
   Suites ran on JDK 17. Protobuf ran on Linux x86_64 using the existing 
embedded protoc 3.11.4, avoiding the separate native macOS ARM compiler issue 
#12897. The initial Linux reactor completed JSON/Text/CSV/Protobuf but could 
not resolve Avro from its offline Maven cache; the complete Avro suite was then 
run successfully online. JSON and compatible-connect-json were rerun after the 
final extension. These are separate executed module suites, not a claim that 
the initial offline reactor passed.
   
   Representative final commands:
   
   ```sh
   ./mvnw -B -pl 
seatunnel-formats/seatunnel-format-json,seatunnel-formats/seatunnel-format-compatible-connect-json
 -am package
   ./mvnw -B -pl seatunnel-formats/seatunnel-format-avro -am -Dtest=Avro*Test 
-Dsurefire.failIfNoSpecifiedTests=false package
   ./mvnw spotless:apply
   ./mvnw -q -DskipTests verify
   ```
   
   Root formatting and verification passed. The separate nullable-ROW proposal 
#12900 and macOS compiler fix #12902 are not included or required by this 
branch.
   
   AI assistance was used for implementation and review. The test results above 
were actually executed.
   
   ### Check list
   
   * [x] No new JAR dependency or binary package is added.
   * [x] EN/ZH compatibility notes describe the metadata change.
   * [x] Existing tests are retained and all affected module suites are 
exercised.
   * [x] No new connector or registration change is involved.
   


-- 
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]

Reply via email to