zhangshenghang opened a new pull request, #12157:
URL: https://github.com/apache/seatunnel/pull/12157
## Purpose
This PR fixes a runtime serialization failure observed when DB2 catalog
metadata containing a non-null column default value is loaded into a SeaTunnel
job.
The DB2 catalog previously read the column default value via
`ResultSet#getObject`, which on IBM DB2 JDBC driver returns driver-specific
objects such as `com.ibm.db2.jcc.am.c9`. These objects are stored in
`Column.defaultValue` and later fail Hazelcast serialization of `SourceAction`,
throwing:
```
java.io.NotSerializableException: com.ibm.db2.jcc.am.c9
```
The fix switches the default value lookup to `ResultSet#getString` so the
value is stored as a plain `String`. The string form is what downstream
catalog/JSON paths already expect, and it can be safely serialized,
deserialized, and used for schema inference.
## Changes
- `DB2Catalog#buildColumn`: read `DEFAULT_VALUE` via `ResultSet#getString`
instead of `ResultSet#getObject`.
- `DB2CatalogTest`: add `testBuildColumnReadsDefaultValueAsString` that
mocks the result set and verifies
- `getString("DEFAULT_VALUE")` is called,
- `getObject("DEFAULT_VALUE")` is never called,
- the produced `Column#getDefaultValue()` equals the string returned by
the driver.
## Validation
- `./mvnw -pl seatunnel-connectors-v2/connector-jdbc -Dtest=DB2CatalogTest
test -Dcheckstyle.skip -Dspotless.check.skip`
- `Tests run: 2, Failures: 0, Errors: 0, Skipped: 0`
## Impact
- Behavior change: the value stored in `Column.defaultValue` is now a string
(or `null`) for DB2 catalog introspection. For sinks that re-emit the default
value back to the database, the existing string-based handling already covers
this. Other JDBC catalogs are unaffected.
- No new public API, no configuration change.
--
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]