You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "doyong365 (via GitHub)" <gi...@apache.org> on 2026/04/08 07:07:51 UTC
[PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp… [seatunnel]
doyong365 opened a new pull request, #10724:
URL: https://github.com/apache/seatunnel/pull/10724
Purpose of this pull request
Fixes #10685
JDBC connector could not distinguish between `TIMESTAMP` (NTZ, No Time Zone) and `TIMESTAMP_TZ` (LTZ, Local Time Zone) types when reading from databases. Previously, both timezone-naive and timezone-aware timestamp columns were mapped to SeaTunnel's internal `TIMESTAMP` type, causing timezone information to be lost when writing to timezone-aware sinks such as Iceberg. This PR explicitly separates them by fixing the `TypeConverter` and `JdbcRowConverter` for MySQL, PostgreSQL, Oracle, and SQL Server:
| DB Column Type | Before (wrong) | After (correct) |
|---|---|---|
| MySQL `DATETIME` | `TIMESTAMP` | `TIMESTAMP` (NTZ) ✅ |
| MySQL `TIMESTAMP` | `TIMESTAMP` | `TIMESTAMP_TZ` (LTZ) ✅ |
| PostgreSQL `timestamp` | `TIMESTAMP` | `TIMESTAMP` (NTZ) ✅ |
| PostgreSQL `timestamptz` | `TIMESTAMP` | `TIMESTAMP_TZ` (LTZ) ✅ |
| Oracle `TIMESTAMP` | `TIMESTAMP` | `TIMESTAMP` (NTZ) ✅ |
| Oracle `TIMESTAMP WITH LOCAL TIME ZONE` | `TIMESTAMP` | `TIMESTAMP_TZ` (LTZ) ✅ |
| SQL Server `datetime` | `TIMESTAMP` | `TIMESTAMP` (NTZ) ✅ |
| SQL Server `datetimeoffset` | `TIMESTAMP` | `TIMESTAMP_TZ` (LTZ) ✅ |
Also fixes `IcebergTypeMapper` and `DefaultDeserializer` in `connector-iceberg` to correctly map `TIMESTAMP_TZ` → Iceberg `timestamptz` (withZone).
Does this PR introduce _any_ user-facing change?
Yes.
**Previous behavior:**
Both `DATETIME` (NTZ) and `TIMESTAMP` (LTZ) columns from MySQL were read as SeaTunnel's `TIMESTAMP` type. When written to Iceberg, both were stored as `timestamp` (without timezone), losing timezone semantics.
**New behavior:**
- `DATETIME` → SeaTunnel `TIMESTAMP` → Iceberg `timestamp` (without timezone)
- `TIMESTAMP` → SeaTunnel `TIMESTAMP_TZ` → Iceberg `timestamptz` (with timezone)
*(Note: These breaking changes have been documented in `incompatible-changes.md`.)*
**Affected engines:** Zeta, Flink (Spark is excluded — see note below)
> ⚠️ **Known Limitation (Spark):**
> Spark's translation layer maps `TIMESTAMP_TZ` to a custom Decimal struct (`OffsetDateTimeUtils.OFFSET_DATETIME_WITH_DECIMAL`) rather than a native Spark timestamp type.
> This makes `TIMESTAMP_TZ` incompatible with standard Sink connectors on the Spark engine. The new E2E tests are therefore disabled on Spark via `@DisabledOnContainer(type = {EngineType.SPARK})`.
> Spark support for `TIMESTAMP_TZ` is a separate concern and left for a follow-up issue.
How was this patch tested?
1. Unit Tests (TypeConverter & RowConverter)
Existing unit tests were updated to reflect the new NTZ/LTZ type separation:
- `MySqlTypeConverterTest` — verifies `DATETIME` → `TIMESTAMP`, `TIMESTAMP` → `TIMESTAMP_TZ`
- `OracleTypeConverterTest` — verifies NTZ/LTZ split for Oracle timestamp types
- `SqlServerTypeConverterTest` — verifies NTZ/LTZ split for SQL Server timestamp types
- `JdbcFieldTypeUtilsTest` — verifies `getLocalDateTime()` and `getOffsetDateTime()` helpers
- `OracleCreateTableSqlBuilderTest` — updated DDL expectation to match new NTZ mapping
- `IcebergTypeMapperTest` — verifies `TIMESTAMP` → `withoutZone()`, `TIMESTAMP_TZ` → `withZone()`
Run with:
./mvnw test -Dskip.spotless=true \
-pl seatunnel-connectors-v2/connector-jdbc,seatunnel-connectors-v2/connector-iceberg \
--no-transfer-progress
2. E2E Tests (real DB containers + Assert sink)
New E2E tests were added to verify the fix end-to-end using real database containers. The Assert sink's field_type rule is used to strictly validate the SeaTunnel internal type. If the type mapping is wrong, the Assert sink throws a field type mismatch error and fails the build.
Pre-requisite — build connectors first:
./mvnw clean install -DskipTests -Dskip.spotless=true \
-pl seatunnel-connectors-v2/connector-jdbc,seatunnel-connectors-v2/connector-iceberg \
-am --no-transfer-progress
MySQL (NTZ/LTZ mapping):
RUN_ALL_CONTAINER=false RUN_ZETA_CONTAINER=true \
./mvnw -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1 \
-DskipUT -DskipIT=false -Dit.test="JdbcMysqlTimestampIT" \
-Dskip.spotless=true verify --no-transfer-progress
Expected BUILD SUCCESS — Assert sink verifies:
- MySQL DATETIME → SeaTunnel TIMESTAMP (NTZ)
- MySQL TIMESTAMP → SeaTunnel TIMESTAMP_TZ (LTZ)
PostgreSQL (NTZ/LTZ mapping):
RUN_ALL_CONTAINER=false RUN_ZETA_CONTAINER=true \
./mvnw -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3 \
-DskipUT -DskipIT=false -Dit.test="JdbcPostgresTimestampIT" \
-Dskip.spotless=true verify --no-transfer-progress
Expected BUILD SUCCESS — Assert sink verifies:
- PostgreSQL timestamp → SeaTunnel TIMESTAMP (NTZ)
- PostgreSQL timestamptz → SeaTunnel TIMESTAMP_TZ (LTZ)
MySQL → Iceberg (end-to-end type persistence):
RUN_ALL_CONTAINER=false RUN_ZETA_CONTAINER=true \
./mvnw -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e \
-DskipUT -DskipIT=false -Dit.test="JdbcToIcebergTimestampIT#testMysqlDatetimeToIcebergNtz" \
-Dskip.spotless=true verify --no-transfer-progress
Expected BUILD SUCCESS — Iceberg metadata JSON confirms:
- MySQL DATETIME → Iceberg timestamp (without timezone)
- MySQL TIMESTAMP → Iceberg timestamptz (with timezone)
> Note: Local test commands above use RUN_ZETA_CONTAINER=true to avoid Docker port conflicts with Flink's fixed 8081 binding. In CI, both Zeta and Flink engines are tested automatically. Spark is explicitly excluded via @DisabledOnContainer(type = {EngineType.SPARK}).
Check list
* [x] If any new Jar binary package adding in your PR, please add License Notice according
New License Guide (https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [x] If necessary, please update incompatible-changes.md to describe the incompatibility caused by this PR.
* [x] If you are contributing the connector code, please check that the following files are updated:
1. Update plugin-mapping.properties — not applicable (no new connector)
2. Update seatunnel-dist pom.xml — not applicable (no new connector)
3. Add ci label — not applicable (no new connector)
4. ✅ E2E testcases added in seatunnel-e2e
5. Update plugin_config — not applicable (no new connector)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4303322021
Hi @doyong365, thanks for taking on this timestamp semantics fix. I reviewed the latest head locally on `seatunnel-review-10724` (`ab827c17c`, base `60f1007ab`) and traced the JDBC/CDC -> SeaTunnel type -> sink mapping path.
# What This PR Fixes
- User pain point: timezone-aware database columns could be treated like plain `TIMESTAMP`, then written to Iceberg or other sinks as timezone-naive values.
- Fix approach: map timezone-aware source types to SeaTunnel `TIMESTAMP_TZ`, convert row values to `OffsetDateTime`, and update sink-side type/serialization mappings.
- One-sentence value: SeaTunnel now preserves the difference between timestamp-with-zone and timestamp-without-zone across the main JDBC/CDC writing paths.
# Core Flow Reviewed
```text
JDBC source path
-> dialect type converter maps timezone-aware DB columns to TIMESTAMP_TZ
-> AbstractJdbcRowConverter reads the field according to SeaTunnelRowType
-> JdbcFieldTypeUtils.getOffsetDateTime() returns OffsetDateTime [JdbcFieldTypeUtils.java:152-188]
-> SeaTunnelRow carries TIMESTAMP_TZ
Iceberg sink path
-> IcebergTypeMapper sees TIMESTAMP_TZ
-> returns Types.TimestampType.withZone() [IcebergTypeMapper.java:181-186]
CDC/TiDB path
-> SeaTunnelRowDebeziumDeserializationConverters.convertToTimestampTz() handles Debezium values [SeaTunnelRowDebeziumDeserializationConverters.java:421-436]
-> TiDB DefaultDataConverter.convertToOffsetDateTime() handles Timestamp/Long/LocalDateTime/String [DefaultDataConverter.java:269-305]
```
# Findings
I did not find a blocking code issue in the latest implementation.
The important compatibility note is real and already documented: some downstream sinks that previously saw `TIMESTAMP` may now see `TIMESTAMP_TZ`. The English and Chinese incompatible-change docs capture this at `docs/en/introduction/concepts/incompatible-changes.md:10-18` and the matching Chinese section.
# Compatibility
- API/config/defaults: no removed or renamed user config.
- Behavior: partially incompatible by design. Timezone-aware columns now keep timezone semantics instead of being collapsed into plain `TIMESTAMP`.
- Migration: users whose sinks do not support `TIMESTAMP_TZ` may need to cast in SQL Transform or adjust sink configuration/table schema.
# Performance And Side Effects
- CPU/object allocation increases slightly for timestamp fields because `OffsetDateTime` and string parsing can be used.
- No additional network, lock contention, or resource lifecycle changes.
- Conversion failures are surfaced with context instead of silently writing the wrong type.
# Tests And Docs
The PR adds broad type-mapping and serialization coverage, including JDBC dialect tests, `JdbcFieldTypeUtilsTest`, CDC converter tests, and Iceberg timestamp E2E resources. One useful future hardening point would be stronger non-UTC session value assertions, not only type assertions.
# Merge Conclusion
### Conclusion: merge after fixes
1. Blocking items:
- I did not find a code blocker.
- CI: the Build check is still IN_PROGRESS (`72640522630`), so it must pass before merge.
2. Non-blocking suggestions:
- Consider keeping or adding value-level assertions for non-UTC timestamp cases in CI, since this area is naturally sensitive to driver/session timezone behavior.
Overall, this is a meaningful semantic correction with the right compatibility documentation. Once CI is green, I think it can move forward.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4229117468
Hi @doyong365!
Thanks for your hard work on this!
I'd like to share some detailed observations with the hope that we can grow together:
1. Redshift
According to the AWS documentation, Redshift supports the timestamp ntz type.
Could you verify if this type is being handled correctly in the converter?
> seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/redshift/RedshiftTypeConverter.java
<img width="840" height="436" alt="image" src="https://github.com/user-attachments/assets/1a185286-924d-42b8-8e4b-1f6cef44d351" />
> Reference: https://docs.aws.amazon.com/us_en/redshift/latest/dg/r_Datetime_types.html#r_Datetime_types-timestamp
2. DuckDB
Could you double-check the DuckDB type converter as well?
> seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java
<img width="636" height="93" alt="image" src="https://github.com/user-attachments/assets/c58a64fa-0896-4cc1-ba05-f2e76f4a3692" />
> Reference: https://duckdb.org/docs/current/sql/data_types/timestamp
3. OceanBase
<img width="667" height="131" alt="image" src="https://github.com/user-attachments/assets/54670a91-2df6-498e-a4d3-bc7ec60a4b36" />
It might be better to align the implementation with the MySQL-style approach, like below:
```java
case MYSQL_DATETIME:
builder.dataType(LocalTimeType.LOCAL_DATE_TIME_TYPE);
builder.scale(typeDefine.getScale());
break;
case MYSQL_TIMESTAMP:
builder.dataType(LocalTimeType.OFFSET_DATE_TIME_TYPE);
builder.scale(typeDefine.getScale());
break;
```
> Reference: https://en.oceanbase.com/docs/common-oceanbase-database-10000000001033311#2-title-TIMESTAMP
4. Kingbase
The Kingbase implementation looks a bit complex. The PostgreSQL part seems to be
properly handled through inheritance from PostgresTypeConverter.
However, I noticed that the following dialects may need to be reviewed:
## mysql
<img width="825" height="408" alt="image" src="https://github.com/user-attachments/assets/1c92d69a-b6b1-458d-a49d-4204d9db9160" />
## oracle
I couldn't find any timestamp ntz related handling for Oracle.
If this is an issue, it might be better addressed in a separate ticket rather than here.
## sql server
<img width="802" height="380" alt="image" src="https://github.com/user-attachments/assets/db420055-9b2a-4a16-abd5-134477c5d4b0" />
Please let me know if you have any questions or if I've missed something!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4476475841
@davidzollo Thank you for the thorough review! Here is a summary of how each blocking point was addressed:
1. Clarify and verify the Iceberg upgrade path for existing tables
The IcebergTypeMapper already maps withZone() → TIMESTAMP_TZ and withoutZone() → TIMESTAMP. To make this explicit and verifiable, two upgrade-path regression tests were added to IcebergTypeMapperTest:
- upgradePath_legacyWithZoneColumnIsReadAsTimestampTz() — asserts that existing Iceberg tables written by the old SeaTunnel (which incorrectly used withZone() for TIMESTAMP) are now read back as TIMESTAMP_TZ
- upgradePath_newTimestampWrittenAsWithoutZoneIsReadAsTimestamp() — asserts that new tables written with withoutZone() are read back as TIMESTAMP
The upgrade impact and migration guidance are documented in incompatible-changes.md.
2. Unify the downgrade contract for TIMESTAMP_TZ
The contract is now clearly defined in two tiers and documented in incompatible-changes.md:
- DB-typed sinks without native timezone support (Text, Doris, StarRocks, Xugu): timezone offset is dropped and the wall-clock value is stored. Text previously converted to UTC before dropping the offset, which was inconsistent; it now uses toLocalDateTime() to match Doris and StarRocks.
- JSON-based messaging sinks (Kafka, Pulsar, RocketMQ, etc.): the full ISO 8601 offset is preserved (e.g., "2024-01-01T03:00:00+09:00"). Changing the JSON default to wall-clock would be a large breaking change affecting all messaging connectors, so the two-tier contract is intentional and explicitly documented.
3. Make the Xugu TIMESTAMP_TZ path honest
XuguJdbcRowConverter now has an explicit log-once WARN (via AtomicBoolean) on the first write, with a strong inline comment explaining that this is a known Xugu JDBC driver limitation (bug [E19138]) and not silent data loss. The limitation is also documented in incompatible-changes.md.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4302532007
Hi, @yzeng1618
Thank you for the detailed review.
I have made all the corrections you suggested.
PTAL !
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128565624
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleJdbcRowConverter.java:
##########
@@ -66,6 +68,11 @@ protected void setValueToStatementByDataType(
} else {
statement.setString(statementIndex, (String) value);
}
+ } else if (seaTunnelDataType.getSqlType().equals(SqlType.TIMESTAMP_TZ)) {
+ // Oracle JDBC does not support OffsetDateTime directly via setObject in all drivers.
+ // Convert to java.sql.Timestamp using the UTC instant to preserve the correct moment.
+ OffsetDateTime odt = (OffsetDateTime) value;
+ statement.setTimestamp(statementIndex, Timestamp.from(odt.toInstant()));
Review Comment:
`Timestamp.from(odt.toInstant())` without a Calendar lets the driver apply the JVM default timezone, silently corrupting the offset in non-UTC environments.
Fixed in two places:
- **`AbstractJdbcRowConverter`**: fallback now passes an explicit UTC `Calendar` to `setTimestamp`, so older drivers are safe regardless of JVM timezone.
- **`OracleJdbcRowConverter`**: removed the bespoke `Timestamp.from()` call and delegated to `super`, which already carries the correct `setObject → UTC Calendar fallback` chain.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4778494703
Thanks for the ping.
I checked the current PR head again before replying. The latest `Build` is green now, and there is still no new code after Daniel's previous approval on `4cf2f72e7e026fd30d6b17951096e2cd07475e62`.
So from Daniel's side, the existing approval still stands on the current head. I do not have a reopened source-level blocker here.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp… [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4205779054
Also, the PR title was truncated and moved to the main body.
PTAL ~
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4323857976
Hi @doyong365, thanks for continuing to work on this timestamp issue. I pulled the current head locally again and rechecked the full diff against `upstream/dev`.
What this PR is trying to solve
- User pain: `timestamp_ntz` should not silently drift into `timestamp_ltz` semantics across JDBC / CDC / downstream conversion paths.
- Fix approach: the original direction appears to be keeping the timestamp-without-zone semantic consistent and backing it with regression coverage.
- One-line summary: the problem is worth solving, but the current PR head is no longer reviewable as a clean timestamp-only fix.
Runtime / scope chain I checked
```text
intended fix scope
-> timestamp conversion files
-> directly related JDBC / CDC / sink tests
current PR head
-> intended timestamp files
-> plus many unrelated common / connector / docs changes
-> review scope no longer maps to one isolated runtime problem
```
Merge conclusion
### Conclusion: do not merge yet
1. Blocking items
- The current head is heavily scope-contaminated: `git diff --stat upstream/dev...HEAD` is now 77 files changed.
- I can confirm unrelated changes in files such as `seatunnel-common/.../JsonUtils.java`, `connector-elasticsearch/.../EsRestClient.java`, `connector-hudi/.../RowDataToAvroConverters.java`, `connector-starrocks/.../StarRocksBaseSerializer.java`, and `docs/.../incompatible-changes.md`.
- Because of that, I cannot give a safe merge decision for “the timestamp fix” anymore — this PR now carries too much unrelated surface area.
2. Suggested follow-ups
- Please rebuild this PR on top of the latest `upstream/dev` and keep only the timestamp-related code and directly related tests.
I’m happy to re-review once the branch is cleaned up. The original timestamp problem is worth fixing, but the current mixed diff is the blocker from Daniel’s side.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4317465458
Hi @doyong365, thanks for the clear follow-up explanation. I rechecked the latest head locally.
# What changed after Daniel's previous review
- The new delta is limited to `seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcOracleIT.java:171-183`.
- That change only disables the Oracle `testJdbcDb()` path on Spark, with an explicit reason that Oracle `TIMESTAMP WITH LOCAL TIME ZONE` is now mapped to `TIMESTAMP_TZ` / `OffsetDateTime`, while Spark still cannot round-trip that shape correctly.
# Runtime chain I rechecked
~~~text
JDBC row read
-> AbstractJdbcRowConverter
-> JdbcFieldTypeUtils.getOffsetDateTime()
-> preserve timezone-aware semantic as TIMESTAMP_TZ
-> SeaTunnelRow carries OffsetDateTime
-> downstream sink keeps the timezone-aware boundary
Validation path after this follow-up
-> JdbcOracleIT.testJdbcDb()
-> disabled on Spark only
-> because Spark still cannot round-trip Oracle TIMESTAMP_TZ correctly
~~~
# Findings
1. The latest follow-up does not reopen the production conversion logic. It only makes the Spark Oracle test limitation explicit.
2. That is aligned with the existing strategy already used for other Spark `TIMESTAMP_TZ` limitations.
3. I do not see a reopened code blocker from the latest source delta.
4. The current `Build` check is still red, so the PR is not merge-ready yet.
# Merge conclusion
### Conclusion: merge after fixes
Blocking item:
- Please get the latest `Build` green before merge.
Non-blocking note:
- Once Spark really supports the Oracle `OffsetDateTime` round-trip, this disable can be removed and the test matrix can be tightened again.
From a source-level review perspective, the latest follow-up looks reasonable and consistent with the already-reviewed `TIMESTAMP_TZ` direction.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4219092611
> Please enable CI following the [instructions.](https://github.com/apache/seatunnel/pull/10724/checks?check_run_id=70379943766)
@dybyte I have checked instruction and enabled CI :)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4469906852
```markdown
Thanks for the work on this.
The overall direction is valuable and I see three blocking issues :
1. Iceberg compatibility is still broken for existing tables
- Location: `seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/data/IcebergTypeMapper.java:57-64,181-186`, `.../DefaultDeserializer.java:90-97`, `.../SchemaUtils.java:79-88`
- Before this PR, SeaTunnel `TIMESTAMP` was written to Iceberg as `withZone()`. After this PR, SeaTunnel `TIMESTAMP` is written as `withoutZone()`, while Iceberg `withZone()` is now read back as SeaTunnel `TIMESTAMP_TZ`.
- That means this PR is not only adding `TIMESTAMP_TZ` support. It is also redefining the historical meaning of plain `TIMESTAMP` for Iceberg.
- The current E2E only proves the fresh-table happy path (`JdbcToIcebergTimestampIT`). It does not prove upgrade safety for existing Iceberg tables that were created by older SeaTunnel versions.
- `SchemaUtils.needsDataTypeUpdate(...)` also does not handle this kind of timestamp zone transition, so schema evolution does not rescue the upgrade path here.
- In practice, existing Iceberg tables written by older SeaTunnel versions can be reinterpreted differently after upgrade, and some downstream pipelines may see type/schema mismatches.
2. `TIMESTAMP_TZ` is still downgraded inconsistently across sink/format boundaries
- Location: `seatunnel-formats/seatunnel-format-text/src/main/java/org/apache/seatunnel/format/text/TextSerializationSchema.java:178-183`, `seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/RowToJsonConverters.java:198-214`, `seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/serialize/SeaTunnelRowSerializer.java:89-101`, `seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/serialize/StarRocksBaseSerializer.java:67-70`
- The same `OffsetDateTime` does not have one stable downgrade contract today:
- Text serialization normalizes to UTC first, then drops the offset.
- Doris JSON and StarRocks preserve the local wall-clock value and drop the offset.
- So the same `TIMESTAMP_TZ` value can produce different outputs depending on which sink or even which format path is used.
- This is a correctness problem, not just a style difference. The PR needs one explicit contract for timezone-aware values written into targets that do not have a native timezone-aware type: preserve instant, preserve wall-clock, or fail explicitly. Right now the implementation mixes both strategies.
3. Xugu still silently drops the offset on the normal sink write path
- Location: `seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/xugu/XuguTypeConverter.java:192-205,385-405`, `seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/xugu/XuguJdbcRowConverter.java:47-54`
- The type layer now exposes Xugu timezone-aware columns as SeaTunnel `TIMESTAMP_TZ`, and reverse mapping also generates `TIMESTAMP ... WITH TIME ZONE`.
- But the actual sink write path does not use the abstract class fallback here. It explicitly does:
- `OffsetDateTime -> toLocalDateTime() -> setTimestamp(...)`
- The code comment already admits that timezone information is lost. This is not an unreachable fallback branch; it is the real Xugu sink write path for `TIMESTAMP_TZ`.
- If the driver cannot preserve timezone-aware values safely, this should fail fast or be documented as an explicit lossy limitation. It should not look like successful timezone-preserving support.
Non-blocking follow-up:
- The IANA zone fallback in `SeaTunnelRowDebeziumDeserializationConverters.parseOffsetDateTimeFromString()` is still brittle. The current `replaceFirst(...).replace(" ", "/")` normalization works for the tested `2024-01-01T12:00:00 Asia/Shanghai` form, but it rewrites remaining spaces globally. Please tighten that normalization logic or add one more regression test proving the exact supported IANA-zone input shapes.
Conclusion: merge after fixes
Blocking items:
1. Clarify and verify the Iceberg upgrade path for existing tables, not just new tables.
2. Unify the downgrade contract for `TIMESTAMP_TZ` across Text/JSON/Doris/StarRocks style sinks.
3. Make the Xugu `TIMESTAMP_TZ` path honest: preserve the offset, or fail/document the limitation explicitly.
The remaining blockers are runtime semantics and upgrade compatibility.
```
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4656330124
@davidzollo
The branch has been rebased on the latest dev and the merge conflict in RowConverter.java is resolved. Could you take another look when you have a chance? Thanks!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128567236
##########
docs/zh/introduction/concepts/incompatible-changes.md:
##########
@@ -4,6 +4,13 @@
## dev
+### JDBC Connector
+
+- **破坏性变更:带时区的时间戳列映射为 `TIMESTAMP_TZ` 类型**
+ - **影响范围**:`seatunnel-connectors-v2/connector-jdbc`,`seatunnel-connectors-v2/connector-iceberg`
+ - **变更说明**:以前,JDBC Source 将无时区(如 MySQL `DATETIME`)和带时区(如 MySQL `TIMESTAMP`)的时间戳列都映射为 SeaTunnel 内部的 `TIMESTAMP` 类型。现在,带时区的列(如 MySQL `TIMESTAMP`、PostgreSQL `timestamptz`、Oracle `TIMESTAMP WITH LOCAL TIME ZONE` 和 SQL Server `datetimeoffset`)被显式映射为 `TIMESTAMP_TZ`。这确保了在写入 Iceberg 等格式时,时区语义得到准确保留(在 Iceberg 中 `TIMESTAMP` 存为无时区的 `timestamp`,`TIMESTAMP_TZ` 存为带时区的 `timestamptz`)。
+ - **影响**:如果您的下游 Sink 依赖接收 `TIMESTAMP` 类型且不支持 `TIMESTAMP_TZ`,您可能会遇到类型不匹配错误。对于 Iceberg 用户,这意味着以前作为 `timestamp`(无时区)写入的列现在可能会作为 `timestamptz`(带时区)写入,从而改变表结构。您可能需要在 SQL Transform 中转换该列或更新您的 Sink 配置。(#10685)
+
Review Comment:
I added CDC (Debezium, TiDB), Doris, StarRocks, Hudi, Paimon, and Snowflake in the document (en, zh)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4265690982
@davidzollo @dybyte
I'd like to share our perspective on this tradeoff and ask for the committer's guidance.
The Core Tradeoff
**Option A (Keep silent fallback — current behavior):**
- ✅ CI passes
- ✅ Xugu pipelines continue to work
- ✅ No job failures for existing Xugu users
- ⚠️ TIMESTAMP WITH TIME ZONE values silently lose timezone offset on Xugu Sink
- (e.g., `2026-04-17T09:00+08:00` and `2026-04-17T09:00Z` may become the same wall-clock value)
**Option B (Explicit failure):**
- ❌ CI fails for Xugu E2E tests
- ❌ All Xugu pipelines that include TIMESTAMP WITH TIME ZONE columns will fail at runtime
- ✅ No silent data corruption
- ✅ The driver bug is surfaced clearly to users
Our Position
This is a **confirmed Xugu JDBC driver bug** ([E19138]), not a SeaTunnel implementation issue. The driver crashes during `executeBatch()` for `TIMESTAMP WITH TIME ZONE` columns, regardless of the binding method used (`setObject(OffsetDateTime)`, `setString("...+08:00")`, and `setTimestamp()` with UTC all trigger the crash in batch mode).
**Before this PR**, Xugu users were silently losing timezone semantics anyway (everything was mapped to `LOCAL_DATE_TIME_TYPE`). **After this PR**, at least the Source side correctly identifies `TIMESTAMP WITH TIME ZONE` as `TIMESTAMP_TZ`. The Sink fallback preserves the existing behavior (no worse than before for Xugu users), while all other connectors (MySQL, PostgreSQL, Oracle, Iceberg, etc.) now correctly preserve timezone semantics end-to-end.
We agree that silent data loss is not ideal. However, switching to explicit failure would break all existing Xugu pipelines until the driver is fixed — which is outside SeaTunnel's control.
Request
Could a committer () please weigh in on which tradeoff is acceptable for this PR? We are happy to proceed in either direction based on the committer's decision.
Thank you!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4332406583
@davidzollo
Hi, Ci passed. PTAL !
CC. @yzeng1618 @och5351
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4670920801
Thanks for the follow-up here.
I see a few issues:
1. Spark `TIMESTAMP_TZ` serialization still looks unsafe for negative offsets. The current decimal encoding for `OffsetDateTime` appears to produce an invalid `BigDecimal` for values like `-08:00`, so this path can fail once more JDBC timestamp columns start flowing through Spark.
2. The new non-UTC MySQL E2E test only checks the field type, not the actual instant/value, so it would not catch the timezone-shift regression this PR is trying to prevent.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4776103477
@davidzollo @yzeng1618
CI passed. PTAL !
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4264056905
Hi @DanielLeens Thank you for the detailed analysis.
This is indeed a Xugu JDBC driver bug, not a SeaTunnel issue. The driver throws [E19138] regardless of the binding method used — setObject(OffsetDateTime), setString("...+08:00"), or setTimestamp() with UTC instant all trigger the crash during executeBatch(). We've confirmed this with batch_mode=false as well.
Since the Xugu JDBC driver cannot safely handle TIMESTAMP WITH TIME ZONE writes without crashing, the current fallback (toLocalDateTime) prevents job failures while maintaining data flow. We acknowledge the timezone precision trade-off and will track Xugu driver support as a separate follow-up issue.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128564699
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
@@ -330,8 +333,22 @@ public BasicTypeDefine reconvert(Column column) {
9,
9);
}
- builder.columnType(SNOWFLAKE_TIMESTAMP);
- builder.dataType(SNOWFLAKE_TIMESTAMP);
+ builder.columnType(SNOWFLAKE_TIMESTAMP_NTZ);
+ builder.dataType(SNOWFLAKE_TIMESTAMP_NTZ);
+ break;
+ case TIMESTAMP_TZ:
+ if (column.getScale() > 9) {
Review Comment:
Fixed it.
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
Review Comment:
Fixed it.
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
Review Comment:
Fixed it.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4278517387
Hi @doyong365, I re-pulled the latest head locally as `seatunnel-review-10724` at `3a8ebbde08fc6f1ce63f881235909aa1d8b09709`.
The newest delta expands the timestamp handling beyond the earlier JDBC/Iceberg path:
```text
JDBC read path
-> JdbcFieldTypeUtils.getLocalDateTime()
-> getObject(LocalDateTime) first
-> per-call UTC Calendar fallback
-> plain getTimestamp() only when the driver does not support Calendar
connector/format conversion paths
-> Doris type mapping
-> Paimon TIMESTAMP_TZ read/write mapping
-> text serialization for TIMESTAMP_TZ
```
The per-call UTC `Calendar` removes the shared mutable calendar concern, and the additional converter coverage is a good step. I do not see a new static blocker in the latest delta itself.
### Conclusion: can merge after fixes
Blocking item:
1. The latest `Build` check is still queued/in progress, so this should wait for a green CI result before merge.
Suggested follow-up:
- Please keep an eye on the `TIMESTAMP_TZ` text/Paimon assertions in CI, because this PR now touches several connector-format boundaries rather than only JDBC/Iceberg.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4588566182
@davidzollo
it's ready for review whenever you have time
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4470773439
Thanks for the recheck.
I re-read the current PR state before replying. The head is still `1768be3982320148f8914b57454f8095c0591230`, which is the same revision Daniel already reviewed on the latest source-level pass, so I do not want to pretend a brand-new full Daniel rereview happened on this unchanged head.
From Daniel's side, the current blocking position is still the same core runtime issue on the normal Xugu sink write path: `TIMESTAMP_TZ` is still written through `OffsetDateTime -> toLocalDateTime() -> setTimestamp(...)`, which silently drops the offset instead of preserving it or failing explicitly.
Your additional concerns around:
- the Iceberg upgrade path for existing tables, and
- the inconsistent downgrade contract across Text / JSON / Doris / StarRocks style sinks
are reasonable things for the author to take seriously as well. The `Build` is green now, so the remaining gate is clearly runtime / compatibility semantics rather than CI.
Because there is still no new code head after Daniel's latest review, I am keeping this as a reply on the existing position rather than issuing a new full Daniel review record in this round. Once there is a new commit, I will re-review the latest head end to end and fold all still-open runtime-contract concerns into one updated review.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4410480508
@davidzollo
Just a friendly ping - CI is green and ready whenever you have bandwidth!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128566366
##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/converter/DefaultDataConverter.java:
##########
@@ -259,6 +266,16 @@ private static Object convertToTime(Object value) {
return TemporalConversions.toLocalTime(value);
}
+ private static Object convertToOffsetDateTime(
+ Object value, org.tikv.common.types.DataType dataType) {
+ if (value instanceof Timestamp) {
+ // TiDB TIMESTAMP is stored in UTC; convert to OffsetDateTime with UTC zone.
+ Instant instant = ((Timestamp) value).toInstant();
+ return OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
+ }
+ return value;
Review Comment:
Thank you for pointing this out. You are correct — the previous `return value` fallback was a silent no-op that would cause a `ClassCastException` with no useful context downstream.
We have replaced it with an explicit handling chain covering all realistic TiDB value types for `TIMESTAMP_TZ`:
- **`Timestamp`** — converted to `OffsetDateTime` via `toInstant()` (existing behavior, unchanged)
- **`Long`** — treated as epoch milliseconds, converted to UTC `OffsetDateTime`
- **`LocalDateTime`** — treated as UTC wall-clock, wrapped with `ZoneOffset.UTC`
- **`String`** — ISO-8601 parse attempted; on failure, throws `IllegalArgumentException` with the raw value and dataType included
- **Unknown types** — immediately throws `IllegalArgumentException` with class name, value, and dataType for clear diagnosis instead of silently falling through to a `ClassCastException` downstream
PTAL!
##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/debezium/row/SeaTunnelRowDebeziumDeserializationConverters.java:
##########
@@ -392,6 +394,26 @@ public Object convert(Object dbzObj, Schema schema) {
};
}
+ private static DebeziumDeserializationConverter convertToTimestampTz(ZoneId serverTimeZone) {
+ return new DebeziumDeserializationConverter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Object convert(Object dbzObj, Schema schema) {
+ if (dbzObj instanceof String) {
+ return java.time.OffsetDateTime.parse((String) dbzObj)
+ .withOffsetSameInstant(java.time.ZoneOffset.UTC);
+ }
Review Comment:
Thank you for the detailed review on the `convertToTimestampTz` implementation.
You are right that `OffsetDateTime.parse` alone is too strict for real-world Debezium output. We have refactored it into a `parseOffsetDateTimeFromString` method with a 4-step fallback chain to handle all the variants you identified:
1. **`OffsetDateTime.parse`** — standard ISO-8601 with numeric offset (e.g. `2024-01-01T12:00:00+08:00`)
2. **`ZonedDateTime.parse`** — IANA zone-region id emitted by Oracle (e.g. `2024-01-01T12:00:00 Asia/Shanghai`)
3. **`FLEXIBLE_OFFSET_FORMATTER`** — space date/time separator (MySQL) or short-form hour-only offset (PostgreSQL), e.g. `2024-01-01 12:00:00+08:00` or `2024-01-01T12:00:00+08`
4. **`Instant.parse`** — UTC epoch literal (e.g. `2024-01-01T12:00:00Z`)
If all four attempts fail, an `IllegalArgumentException` is thrown with the raw value included so the failing CDC task carries enough context for diagnosis.
We also added unit tests covering all four variants (and an unknown-format failure case) in `SeaTunnelRowDebeziumDeserializationConvertersTest`. PTAL!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4367974397
Hi @doyong365, thanks for the follow-up. I checked the current PR head again: the GitHub Build is green now, but there still has not been a new commit after Daniels latest source-level review on April 27.
So Daniels current blocker is still the same one from that latest review: the branch is still carrying a broad mixed diff instead of a clean timestamp-only fix. I rechecked the current range against `upstream/dev`, and it is still 74 files, not just the timestamp / JDBC / CDC path plus directly related tests/docs.
Once you push a cleaned-up branch or a new commit that narrows the PR back to the timestamp semantics fix and its directly related coverage, Im happy to re-review quickly.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4591810328
Thanks for the follow-up. I checked the current PR state before replying, and the head is still `9a4e6f1fa5f1be26e2818920b1c724e1333d248a`, which is the same revision Daniel already reviewed on May 21.
So from Daniel's side this is still a reply-only follow-up rather than a new full re-review on a changed head. The current blocker remains the same one from the latest Daniel review: `TextSerializationSchema` still drops the `TIMESTAMP_TZ` offset on the normal text-output path by converting `OffsetDateTime` to `LocalDateTime`.
Once there is a new commit that preserves the offset on that text serialization path (or fails explicitly instead of silently degrading it), I will re-review the latest head again.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3071242544
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -376,8 +385,9 @@ public BasicTypeDefine reconvert(Column column) {
builder.dataType(ORACLE_DATE);
break;
case TIMESTAMP:
+ // NTZ: maps to ORACLE_TIMESTAMP (without timezone)
if (column.getScale() == null || column.getScale() <= 0) {
- builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ builder.columnType(ORACLE_TIMESTAMP);
} else {
int timestampScale = column.getScale();
if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
It's same too.
However, this part appears to be the original code. It would be better to avoid duplicate calls and align it with the existing code on line 415.
Therefore, if you could commit and upload this section with a title such as `[Hotfix] Preventing duplicate method calls in OracleTypeConverter Case Timestamps`, it will help others review it.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4410996405
Hi @doyong365, thanks for the ping.
I checked the current PR head again. The Build is green now, but there still has not been a new commit after my latest source-level review on May 4, 2026. So I am not doing a new full re-review yet in this round.
My blocker from that latest review is still the same one:
- the normal Xugu sink write path still converts `OffsetDateTime` to `LocalDateTime` before `PreparedStatement.setTimestamp(...)`, so `TIMESTAMP_TZ` can still lose the offset on write.
Once there is a new commit that either preserves that value correctly, or explicitly fails/documents the downgrade instead of writing it silently, I am happy to re-review quickly.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4670927621
@yzeng1618 Please help review this PR, thank you.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4671867365
Thanks for flagging these two points. I rechecked the current head again and I agree both concerns are valid.
1. The Spark `TIMESTAMP_TZ` serialization path is still unsafe for negative offsets. In `seatunnel-translation/.../OffsetDateTimeUtils.java:35-38`, the current code builds a `BigDecimal` from `time.toInstant().toEpochMilli() + "." + time.getOffset().getTotalSeconds()`. For offsets like `-08:00`, that can produce malformed decimal text such as `123.-28800`, so this still needs a real fix.
2. The new MySQL non-UTC E2E does not verify the actual timestamp value yet. `JdbcMysqlTimestampIT.java:180-186` only checks job success, and `jdbc_mysql_timestamp_non_utc_to_assert.conf:54-66` only asserts the field type / non-null contract, not the stored instant or offset semantics.
There is still no new code after my last full review on this PR, so I do not want to post another full review on the same head. Please address these in the next commit, and once you push an update I will re-review the latest head from scratch.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4234465868
Ah! Additional please add a testcase about new changes.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4233314511
@och5351 Thank you so much for the detailed observations! Your insights were incredibly helpful.
I have thoroughly reviewed and updated the converters for all the dialects you mentioned, along with a few others that had similar issues.
Here is the summary of the latest updates:
1. **Redshift:** `REDSHIFT_TIMESTAMPTZ` is now mapped to `OFFSET_DATE_TIME_TYPE`. Reverse mapping (`reconvert`) is also added.
2. **DuckDB:** `DUCKDB_TIMESTAMP_WITH_TZ` is now explicitly mapped to `OFFSET_DATE_TIME_TYPE`. Reverse mapping is added.
3. **OceanBase:** `MYSQL_TIMESTAMP` is updated to `OFFSET_DATE_TIME_TYPE`, mirroring the fix in MySQL.
4. **Kingbase:** Separated the compatibility parsing for SQL Server `DATETIMEOFFSET` and MySQL `TIMESTAMP` to correctly resolve as `OFFSET_DATE_TIME_TYPE`.
5. **Additional Fixes:** I also proactively patched `DmdbTypeConverter` and `XuguTypeConverter` where `DATETIME WITH TIME ZONE` and `TIMESTAMP WITH TIME ZONE` types were similarly misclassified as NTZ.
Unit tests have been passed locally for all these converters. The PR has been updated with these comprehensive fixes! PTAL. Thanks!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3071214218
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -391,10 +401,32 @@ public BasicTypeDefine reconvert(Column column) {
MAX_TIMESTAMP_SCALE,
timestampScale);
}
- builder.columnType(
- String.format("TIMESTAMP(%s) WITH LOCAL TIME ZONE", timestampScale));
+ builder.columnType(String.format("TIMESTAMP(%s)", timestampScale));
builder.scale(timestampScale);
}
+ builder.dataType(ORACLE_TIMESTAMP);
+ break;
+ case TIMESTAMP_TZ:
+ // LTZ: maps to ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE
+ if (column.getScale() == null || column.getScale() <= 0) {
+ builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ } else {
+ int timestampTzScale = column.getScale();
+ if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
column.getScale() -> timestampScale
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -376,8 +385,9 @@ public BasicTypeDefine reconvert(Column column) {
builder.dataType(ORACLE_DATE);
break;
case TIMESTAMP:
+ // NTZ: maps to ORACLE_TIMESTAMP (without timezone)
if (column.getScale() == null || column.getScale() <= 0) {
- builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ builder.columnType(ORACLE_TIMESTAMP);
} else {
int timestampScale = column.getScale();
if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
It's same too.
However, this part appears to be the original code. It would be better to avoid duplicate calls and align it with the existing code on line 415.
Therefore, if you could separate this part into a commit titled `[hotfix] Prevent duplicate method calls` and upload it, it will help others review it.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3071242544
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -376,8 +385,9 @@ public BasicTypeDefine reconvert(Column column) {
builder.dataType(ORACLE_DATE);
break;
case TIMESTAMP:
+ // NTZ: maps to ORACLE_TIMESTAMP (without timezone)
if (column.getScale() == null || column.getScale() <= 0) {
- builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ builder.columnType(ORACLE_TIMESTAMP);
} else {
int timestampScale = column.getScale();
if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
It's same too.
However, this part appears to be the original code. It would be better to avoid duplicate calls and align it with the existing code on line 415.
Therefore, if you could commit and upload this section with a title such as `[hotfix] Preventing duplicate method calls in OracleTypeConverter Case Timestamps`, it will help others review it.
---
Hi, @dybyte !
It looks good to me.
Could you please review about this PR?
Thank you.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4289831063
Hi @doyong365, I rechecked the current PR head locally as `seatunnel-review-10724` at `f99b5f252be1`. I reviewed the full diff against `upstream/dev` and did not run local Maven/tests in this batch; this is a source-level review.
I rechecked the timestamp handling chain after the latest head update:
```text
JDBC read path
-> JdbcFieldTypeUtils.getLocalDateTime()
-> getObject(LocalDateTime) first
-> per-call UTC Calendar fallback
-> plain getTimestamp() only when Calendar is unsupported
connector/format boundaries
-> Doris type mapping
-> Paimon TIMESTAMP_TZ mapping
-> text serialization for TIMESTAMP_TZ
```
The per-call UTC `Calendar` avoids the shared mutable calendar concern, and the broader converter coverage is directionally good. The remaining gate is CI: fetched metadata reports `Build: FAILURE`.
### Conclusion: can merge after fixes
Blocking item:
1. Fix/rerun the failing `Build` check before merge.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4318613846
Hi @doyong365, I rechecked the current head locally again after the latest review activity.
My conclusion on the source-level logic is unchanged:
- I do not see a reopened blocker in the Oracle `TIMESTAMP_TZ` direction
- the latest follow-up still looks like an explicit test-matrix limitation, not a production-path regression
Runtime chain I am still using for this judgment
```text
Oracle JDBC row read
-> JDBC converter
-> preserve timezone-aware semantic as OffsetDateTime / TIMESTAMP_TZ
-> downstream row keeps that boundary
Spark Oracle E2E
-> currently disabled explicitly
-> because Spark still cannot round-trip this type correctly
```
Remaining issue:
- The current GitHub `Build` check is still red.
### Conclusion: merge after fixes
Blocking item:
- Please get the latest `Build` green before merge.
From a source-level review perspective, I do not currently see a reopened code blocker.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4311848378
@davidzollo @yzeng1618
The `JdbcOracleIT#testJdbcDb` test now fails on Spark 2.4.6 and Spark 3.3.0 after this PR's change.
**Root cause:**
Before this PR, `TIMESTAMP WITH LOCAL TIME ZONE` was mapped to `LocalTimeType` (NTZ), so the data flowed as `LocalDateTime` through the Spark engine without any timezone conversion — the round-trip was lossless.
After this PR, it is correctly mapped to `TIMESTAMP_TZ` (LTZ / `OffsetDateTime`). However, SeaTunnel's Spark translation layer has no native `OffsetDateTime` type and encodes it as `DecimalType(18, 5)` (epoch-millis + offset-seconds). This encoding causes byte-level mismatch when writing back to Oracle's `TIMESTAMP WITH LOCAL TIME ZONE` column.
This is the same structural limitation documented in:
- `JdbcMysqlTimestampIT`
- `JdbcPostgresTimestampIT`
- `JdbcToIcebergTimestampIT`
All three are already annotated with `@DisabledOnContainer(type = SPARK)` for the same reason.
**Fix applied:** Added `@DisabledOnContainer(type = {EngineType.SPARK})` to `testJdbcDb` in `JdbcOracleIT`.
The correct fix for Spark engine TIMESTAMP_TZ support is a separate concern (would require changing the encoding in `OffsetDateTimeUtils`) and is out of scope for this PR.
I can address this in a follow-up PR, along with upgrading the supported Spark version beyond 3.3.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128563681
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/mysql_iceberg_to_assert.conf:
##########
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+env {
+ parallelism = 1
+ job.mode = "BATCH"
+}
+
+source {
+ Iceberg {
+ catalog_name = "seatunnel_test"
+ iceberg.catalog.config = {
+ "type" = "hadoop"
+ "warehouse" = "file:///tmp/seatunnel_mnt/iceberg/hadoop-ts-mysql/"
+ }
+ namespace = "seatunnel_namespace"
+ table = "mysql_ts_sink"
+ }
+}
+
+sink {
+ Assert {
+ rules = {
+ row_rules = [
+ { rule_type = MIN_ROW, rule_value = 1 },
+ { rule_type = MAX_ROW, rule_value = 1 }
+ ]
+ field_rules = [
+ {
+ field_name = dt_col
+ field_type = timestamp
+ field_value = [
+ { rule_type = NOT_NULL, equals_to = "2026-01-01T00:00:00" }
+ ]
+ },
+ {
+ field_name = ts_col
+ field_type = timestamp_tz
+ field_value = [
+ { rule_type = NOT_NULL }
Review Comment:
`NOT_NULL` alone does not verify that the stored instant is actually correct. Added `equals_to` for both `timestamp_tz` fields so the assertion now validates the exact UTC value end-to-end:
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/java/org/apache/seatunnel/e2e/connector/iceberg/JdbcToIcebergTimestampIT.java:
##########
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.e2e.connector.iceberg;
+
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.stream.Stream;
+
+/**
+ * E2E test verifying that NTZ (No Time Zone) and LTZ (Local Time Zone) timestamp columns from JDBC
+ * sources are stored with the correct Iceberg timestamp type:
+ *
+ * <ul>
+ * <li>NTZ → Iceberg {@code TimestampType.withoutZone()} (e.g. MySQL DATETIME, PG timestamp)
+ * <li>LTZ → Iceberg {@code TimestampType.withZone()} (e.g. MySQL TIMESTAMP, PG timestamptz)
+ * </ul>
+ *
+ * <p>Covers the fix for https://github.com/apache/seatunnel/issues/10685
+ */
+@DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason =
+ "Spark engine does not support TIMESTAMP_TZ (OffsetDateTime) natively; "
+ + "TIMESTAMP_TZ is serialized as a custom Decimal struct in Spark translation layer, "
+ + "which is incompatible with standard Sink connectors. "
+ + "Tested on Zeta and Flink engines only.")
+@DisabledOnOs(OS.WINDOWS)
+public class JdbcToIcebergTimestampIT extends TestSuiteBase implements TestResource {
+
+ private static final Logger log = LoggerFactory.getLogger(JdbcToIcebergTimestampIT.class);
+
+ // -------------------------------------------------------------------------
+ // Catalog directories (inside the SeaTunnel container)
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_CATALOG_DIR = "/tmp/seatunnel_mnt/iceberg/hadoop-ts-mysql/";
+
+ private static final String PG_CATALOG_DIR = "/tmp/seatunnel_mnt/iceberg/hadoop-ts-pg/";
+
+ // -------------------------------------------------------------------------
+ // MySQL container
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_IMAGE = "mysql:8.0";
+ private static final String MYSQL_HOST = "mysql_timestamp_e2e";
+ private static final String MYSQL_DATABASE = "ts_test";
+ private static final String MYSQL_USER = "root";
+ private static final String MYSQL_PASSWORD = "root";
+
+ private static final MySQLContainer<?> MYSQL_CONTAINER =
+ new MySQLContainer<>(DockerImageName.parse(MYSQL_IMAGE))
+ .withDatabaseName(MYSQL_DATABASE)
+ .withUsername(MYSQL_USER)
+ .withPassword(MYSQL_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(MYSQL_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger("mysql-timestamp-image")));
+
+ // -------------------------------------------------------------------------
+ // PostgreSQL container
+ // -------------------------------------------------------------------------
+ private static final String PG_IMAGE = "postgres:14-alpine";
+ private static final String PG_HOST = "pg_timestamp_e2e";
+ private static final String PG_DATABASE = "ts_test";
+ private static final String PG_USER = "postgres";
+ private static final String PG_PASSWORD = "postgres";
+
+ private static final PostgreSQLContainer<?> PG_CONTAINER =
+ new PostgreSQLContainer<>(DockerImageName.parse(PG_IMAGE))
+ .withDatabaseName(PG_DATABASE)
+ .withUsername(PG_USER)
+ .withPassword(PG_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(PG_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger("pg-timestamp-image")));
+
+ // -------------------------------------------------------------------------
+ // Driver / plugin JARs downloaded into the SeaTunnel container
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_DRIVER_URL =
+ "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.32/mysql-connector-j-8.0.32.jar";
+
+ private static final String PG_DRIVER_URL =
+ "https://repo1.maven.org/maven2/org/postgresql/postgresql/42.3.3/postgresql-42.3.3.jar";
+
+ private static final String ZSTD_URL =
+ "https://repo1.maven.org/maven2/com/github/luben/zstd-jni/1.5.5-5/zstd-jni-1.5.5-5.jar";
+
+ // -------------------------------------------------------------------------
+ // Container setup: create Iceberg dirs + download driver JARs
+ // -------------------------------------------------------------------------
+ @TestContainerExtension
+ protected final ContainerExtendedFactory extendedFactory =
+ container -> {
+ for (String dir :
+ new String[] {
+ MYSQL_CATALOG_DIR + "seatunnel_namespace/mysql_ts_sink/data",
+ MYSQL_CATALOG_DIR + "seatunnel_namespace/mysql_ts_sink/metadata",
+ PG_CATALOG_DIR + "seatunnel_namespace/pg_ts_sink/data",
+ PG_CATALOG_DIR + "seatunnel_namespace/pg_ts_sink/metadata",
+ }) {
+ container.execInContainer("sh", "-c", "mkdir -p " + dir);
+ }
+ container.execInContainer("sh", "-c", "chmod -R 777 /tmp/seatunnel_mnt/iceberg/");
+
+ // Download Iceberg compression codec
+ container.execInContainer(
+ "sh",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Iceberg/lib"
+ + " && cd /tmp/seatunnel/plugins/Iceberg/lib"
+ + " && wget -q "
+ + ZSTD_URL);
+
+ // Download JDBC drivers into the Jdbc plugin directory
+ container.execInContainer(
+ "sh",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && cd /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && wget -q "
+ + MYSQL_DRIVER_URL
+ + " && wget -q "
+ + PG_DRIVER_URL);
+ };
+
+ // -------------------------------------------------------------------------
+ // Lifecycle
+ // -------------------------------------------------------------------------
+ @BeforeAll
+ @Override
+ public void startUp() throws Exception {
+ log.info("Starting MySQL and PostgreSQL containers...");
+ Startables.deepStart(Stream.of(MYSQL_CONTAINER, PG_CONTAINER)).join();
+ log.info("DB containers started. Initializing test data...");
+ initMysqlData();
+ initPostgresData();
+ log.info("Test data initialised.");
+ }
+
+ @AfterAll
+ @Override
+ public void tearDown() {
+ if (MYSQL_CONTAINER != null) {
+ MYSQL_CONTAINER.close();
+ }
+ if (PG_CONTAINER != null) {
+ PG_CONTAINER.close();
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // Test: MySQL DATETIME (NTZ) → Iceberg withoutZone()
+ // -------------------------------------------------------------------------
+ @TestTemplate
+ public void testMysqlDatetimeToIcebergNtz(TestContainer container)
+ throws IOException, InterruptedException {
+ // Step 1: Run job to write data from MySQL to Iceberg
+ org.testcontainers.containers.Container.ExecResult result =
+ container.executeJob("/iceberg/mysql_jdbc_to_iceberg_timestamp.conf");
+ Assertions.assertEquals(
+ 0, result.getExitCode(), "Write job failed:\n" + result.getStderr());
+
+ // Step 2: Run verification job (Iceberg -> Assert)
+ // This job verifies that the data in Iceberg matches expected types and values
+ org.testcontainers.containers.Container.ExecResult verifyResult =
+ container.executeJob("/iceberg/mysql_iceberg_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ verifyResult.getExitCode(),
+ "Verification job failed:\n" + verifyResult.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Test: PostgreSQL timestamp (NTZ) → Iceberg withoutZone()
+ // PostgreSQL timestamptz (LTZ) → Iceberg withZone()
+ // -------------------------------------------------------------------------
+ @TestTemplate
+ public void testPgTimestampToIceberg(TestContainer container)
+ throws IOException, InterruptedException {
+ // Step 1: Run job to write data from PostgreSQL to Iceberg
+ org.testcontainers.containers.Container.ExecResult result =
+ container.executeJob("/iceberg/pg_jdbc_to_iceberg_timestamp.conf");
+ Assertions.assertEquals(
+ 0, result.getExitCode(), "Write job failed:\n" + result.getStderr());
+
+ // Step 2: Run verification job (Iceberg -> Assert)
+ org.testcontainers.containers.Container.ExecResult verifyResult =
+ container.executeJob("/iceberg/pg_iceberg_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ verifyResult.getExitCode(),
+ "Verification job failed:\n" + verifyResult.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Helpers
+ // -------------------------------------------------------------------------
+ private void initMysqlData() throws Exception {
+ try (Connection conn =
+ DriverManager.getConnection(
+ MYSQL_CONTAINER.getJdbcUrl(), MYSQL_USER, MYSQL_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_table ("
+ + " id INT PRIMARY KEY,"
+ + " dt_col DATETIME,"
+ + " ts_col TIMESTAMP"
+ + ")");
+ stmt.execute(
+ "INSERT INTO ts_table (id, dt_col, ts_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00')");
+ }
+ }
+
+ private void initPostgresData() throws Exception {
+ try (Connection conn =
+ DriverManager.getConnection(
+ PG_CONTAINER.getJdbcUrl(), PG_USER, PG_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_table ("
+ + " id INT PRIMARY KEY,"
+ + " ts_col TIMESTAMP WITHOUT TIME ZONE,"
+ + " tstz_col TIMESTAMP WITH TIME ZONE"
+ + ")");
+ stmt.execute(
+ "INSERT INTO ts_table (id, ts_col, tstz_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00+00')");
Review Comment:
Thanks ! I added not-UTC timezone test.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128562936
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlTimestampIT.java:
##########
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.jdbc;
+
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import static org.awaitility.Awaitility.given;
+
+/**
+ * E2E test verifying that MySQL NTZ/LTZ timestamp types are correctly distinguished by the JDBC
+ * connector after the fix for https://github.com/apache/seatunnel/issues/10685.
+ *
+ * <ul>
+ * <li>MySQL {@code DATETIME} (NTZ) → SeaTunnel internal {@code TIMESTAMP} type
+ * <li>MySQL {@code TIMESTAMP} (LTZ) → SeaTunnel internal {@code TIMESTAMP_TZ} type
+ * </ul>
+ *
+ * <p>The Assert sink's {@code field_type} check is used to validate the internal type mapping.
+ */
+@DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason =
+ "Spark engine does not support TIMESTAMP_TZ (OffsetDateTime) natively; "
+ + "TIMESTAMP_TZ is serialized as a custom Decimal struct in Spark translation layer, "
+ + "which is incompatible with standard Sink connectors. "
+ + "Tested on Zeta and Flink engines only.")
+@Slf4j
+public class JdbcMysqlTimestampIT extends TestSuiteBase implements TestResource {
+
+ private static final String MYSQL_IMAGE = "mysql:8.0";
+ private static final String MYSQL_HOST = "mysql_ts_e2e";
+ private static final String MYSQL_DATABASE = "ts_test";
+ private static final String MYSQL_USER = "root";
+ private static final String MYSQL_PASSWORD = "Abc!@#135_seatunnel";
+
+ private static final String MYSQL_DRIVER_URL =
+ "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.32/mysql-connector-j-8.0.32.jar";
+
+ private MySQLContainer<?> mysqlContainer;
+
+ @TestContainerExtension
+ private final ContainerExtendedFactory extendedFactory =
+ container -> {
+ Container.ExecResult result =
+ container.execInContainer(
+ "bash",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && cd /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && wget -q "
+ + MYSQL_DRIVER_URL);
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "Failed to download MySQL driver: " + result.getStderr());
+ };
+
+ @BeforeAll
+ @Override
+ public void startUp() throws Exception {
+ mysqlContainer =
+ new MySQLContainer<>(DockerImageName.parse(MYSQL_IMAGE))
+ .withDatabaseName(MYSQL_DATABASE)
+ .withUsername(MYSQL_USER)
+ .withPassword(MYSQL_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(MYSQL_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(DockerLoggerFactory.getLogger(MYSQL_IMAGE)));
+
+ Startables.deepStart(Stream.of(mysqlContainer)).join();
+
+ given().ignoreExceptions()
+ .await()
+ .atMost(60, TimeUnit.SECONDS)
+ .untilAsserted(() -> initMysqlData());
+ log.info("MySQL container started and test data initialised.");
+ }
+
+ @AfterAll
+ @Override
+ public void tearDown() {
+ if (mysqlContainer != null) {
+ mysqlContainer.close();
+ }
+ }
+
+ /**
+ * Verifies that MySQL {@code DATETIME} (NTZ) columns are read as SeaTunnel {@code TIMESTAMP}
+ * (i.e. {@code LOCAL_DATE_TIME_TYPE}), not {@code TIMESTAMP_TZ}.
+ *
+ * <p>The Assert sink's {@code field_type = timestamp} assertion will fail if the connector
+ * incorrectly maps {@code DATETIME} to {@code TIMESTAMP_TZ}.
+ */
+ @TestTemplate
+ public void testMysqlDatetimeIsNtz(TestContainer container)
+ throws IOException, InterruptedException {
+ Container.ExecResult result = container.executeJob("/jdbc_mysql_datetime_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "MySQL DATETIME (NTZ) assertion failed:\n" + result.getStderr());
+ }
+
+ /**
+ * Verifies that MySQL {@code TIMESTAMP} (LTZ) columns are read as SeaTunnel {@code
+ * TIMESTAMP_TZ} (i.e. {@code OFFSET_DATE_TIME_TYPE}).
+ *
+ * <p>The Assert sink's {@code field_type = timestamp_tz} assertion will fail if the connector
+ * incorrectly maps {@code TIMESTAMP} to plain {@code TIMESTAMP}.
+ */
+ @TestTemplate
+ public void testMysqlTimestampIsLtz(TestContainer container)
+ throws IOException, InterruptedException {
+ Container.ExecResult result = container.executeJob("/jdbc_mysql_timestamp_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "MySQL TIMESTAMP (LTZ) assertion failed:\n" + result.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Helpers
+ // -------------------------------------------------------------------------
+
+ private void initMysqlData() throws Exception {
+ String jdbcUrl =
+ String.format(
+ "jdbc:mysql://%s:%d/%s?useSSL=false&serverTimezone=UTC",
+ mysqlContainer.getHost(),
+ mysqlContainer.getFirstMappedPort(),
+ MYSQL_DATABASE);
+ try (Connection conn = DriverManager.getConnection(jdbcUrl, MYSQL_USER, MYSQL_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_source ("
+ + " id INT PRIMARY KEY,"
+ + " dt_col DATETIME,"
+ + " ts_col TIMESTAMP NULL"
+ + ")");
+ // Insert a fixed wall-clock value: 2026-01-01 00:00:00
+ // DATETIME stores it as-is (NTZ); TIMESTAMP stores UTC and displays in session TZ.
+ stmt.execute(
+ "INSERT INTO ts_source (id, dt_col, ts_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00')");
Review Comment:
Thanks ! I added not-UTC timezone test.
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/pg_iceberg_to_assert.conf:
##########
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+env {
+ parallelism = 1
+ job.mode = "BATCH"
+}
+
+source {
+ Iceberg {
+ catalog_name = "seatunnel_test"
+ iceberg.catalog.config = {
+ "type" = "hadoop"
+ "warehouse" = "file:///tmp/seatunnel_mnt/iceberg/hadoop-ts-pg/"
+ }
+ namespace = "seatunnel_namespace"
+ table = "pg_ts_sink"
+ }
+}
+
+sink {
+ Assert {
+ rules = {
+ row_rules = [
+ { rule_type = MIN_ROW, rule_value = 1 },
+ { rule_type = MAX_ROW, rule_value = 1 }
+ ]
+ field_rules = [
+ {
+ field_name = ts_col
+ field_type = timestamp
+ field_value = [
+ { rule_type = NOT_NULL, equals_to = "2026-01-01T00:00:00" }
+ ]
+ },
+ {
+ field_name = tstz_col
+ field_type = timestamp_tz
+ field_value = [
+ { rule_type = NOT_NULL }
Review Comment:
`NOT_NULL` alone does not verify that the stored instant is actually correct. Added `equals_to` for both `timestamp_tz` fields so the assertion now validates the exact UTC value end-to-end:
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4309655323
# What This PR Fixes
- User pain point: timezone-aware timestamp values could lose the correct semantic boundary while crossing JDBC / CDC / sink conversion paths, especially before landing in sinks such as Iceberg.
- Fix approach: the original PR already moved many paths to `TIMESTAMP_TZ`; this latest hotfix tightens the `JdbcFieldTypeUtils.getOffsetDateTime()` fallback behavior for the `java.sql.Timestamp` branch.
- One-line summary: I did not find a new blocking code issue in the latest hotfix, and Daniel's earlier positive merge assessment still holds.
## Local Review Basis
I rechecked the latest PR head `1d81998e1cc0` locally against the previously reviewed head and against the existing PR diff. The new delta is limited to `JdbcFieldTypeUtils.java`.
## Current Runtime Chain
```text
JDBC row read
-> AbstractJdbcRowConverter
-> JdbcFieldTypeUtils.getOffsetDateTime()
-> Timestamp branch prefers the original string form first
-> fallback only if string parsing fails
-> SeaTunnelRow carries TIMESTAMP_TZ / OffsetDateTime
-> downstream sink keeps the timezone-aware semantic
```
## Findings
1. The latest follow-up only changes `seatunnel-connectors-v2/connector-jdbc/.../JdbcFieldTypeUtils.java:174-188`.
2. The hotfix adds a safer `strVal == null` guard and keeps the already-reviewed semantic direction intact.
3. I did not find a new blocking code issue in the current head.
## Conclusion: can merge
Blocking items:
- I did not find a new code blocker in the latest hotfix.
Suggested non-blocking note:
- The current `Build` check (`72798843046`) is still pending, so I would still wait for that result before pressing merge.
Thank you for the quick follow-up. From a source-level review perspective, the latest hotfix still looks ready.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp… [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3050242252
##########
docs/en/introduction/concepts/incompatible-changes.md:
##########
@@ -5,6 +5,13 @@ You need to check this document before you upgrade to related version.
## dev
+### JDBC Connector
+
Review Comment:
This is just my personal opinion. Please let me know if you have a better suggestion.
If the JDBC connector is modified further, I think other connectors should be added here as well.
##########
docs/zh/introduction/concepts/incompatible-changes.md:
##########
@@ -4,6 +4,13 @@
## dev
+### JDBC Connector
+
Review Comment:
ditto
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp… [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4204822388
Hi, @doyong365!
Thank you for your hard work.
It seems we need to take a closer look at all connectors that use the timestamp_ntz type, like Snowflake
<img width="494" height="103" alt="image" src="https://github.com/user-attachments/assets/ee699c90-d8ff-4534-999c-7f014de1ef18" />
> src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect
Please let me know if I am mistaken.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3071890535
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -391,10 +401,32 @@ public BasicTypeDefine reconvert(Column column) {
MAX_TIMESTAMP_SCALE,
timestampScale);
}
- builder.columnType(
- String.format("TIMESTAMP(%s) WITH LOCAL TIME ZONE", timestampScale));
+ builder.columnType(String.format("TIMESTAMP(%s)", timestampScale));
builder.scale(timestampScale);
}
+ builder.dataType(ORACLE_TIMESTAMP);
+ break;
+ case TIMESTAMP_TZ:
+ // LTZ: maps to ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE
+ if (column.getScale() == null || column.getScale() <= 0) {
+ builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ } else {
+ int timestampTzScale = column.getScale();
+ if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
Thanks. I missed it.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4265583736
> Hi @doyong365, thank you for the follow-up and for explaining the Xugu JDBC driver behavior. I re-pulled the latest head locally (`seatunnel-review-10724`, `39bc1c7b84`) and reviewed the whole timestamp path again, not only the latest diff.
>
> Runtime path I checked:
>
> ```
> JDBC/CDC source metadata mapping
> -> TypeConverter.convert(): TIMESTAMP WITH TIME ZONE -> TIMESTAMP_TZ / OffsetDateTime
> -> SeaTunnelRow carries OffsetDateTime
> -> JdbcSink writer
> -> AbstractJdbcRowConverter.toExternal() [205-225]
> -> XuguJdbcRowConverter.setValueToStatementByDataType() [47-55]
> -> OffsetDateTime.toLocalDateTime() drops offset
> -> PreparedStatement.setTimestamp(...)
> ```
>
> ### Conclusion: can merge after fixes
> Blocker:
>
> 1. `XuguJdbcRowConverter` still silently loses the timezone offset for `TIMESTAMP_TZ`.
>
> * Location: `seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/xugu/XuguJdbcRowConverter.java:47`
> * The current workaround avoids the driver crash, but it turns a hard failure into silent data corruption. For example, `2026-04-17T09:00+08:00` and `2026-04-17T09:00Z` can be written as the same local timestamp. That breaks the PR's timezone-preservation contract.
>
> Suggested direction:
>
> * Option A: use a Xugu-supported binding that preserves the offset, and add a regression test that writes and reads back a non-UTC offset.
> * Option B: if the driver cannot preserve this value today, please do not advertise or generate Xugu `TIMESTAMP_TZ` sink support yet. Map it to a non-timezone type only with explicit docs, or fail clearly instead of silently dropping the offset.
>
> Non-blocking:
>
> * The `Build` check is still queued from GitHub at the time of this review, so it will still need a clean run before merge.
>
> Overall, the broader PR is moving in the right direction, and the main JDBC/CDC timestamp chain is valuable. This one Xugu fallback is the remaining merge blocker because successful execution with wrong time semantics is more dangerous than an explicit failure.
In my opinion, this does not seem to be within the scope of the seatunnel issue.
How about asking the committers about this problem? @doyong365
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "och5351 (via GitHub)" <gi...@apache.org>.
och5351 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3071214218
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleTypeConverter.java:
##########
@@ -391,10 +401,32 @@ public BasicTypeDefine reconvert(Column column) {
MAX_TIMESTAMP_SCALE,
timestampScale);
}
- builder.columnType(
- String.format("TIMESTAMP(%s) WITH LOCAL TIME ZONE", timestampScale));
+ builder.columnType(String.format("TIMESTAMP(%s)", timestampScale));
builder.scale(timestampScale);
}
+ builder.dataType(ORACLE_TIMESTAMP);
+ break;
+ case TIMESTAMP_TZ:
+ // LTZ: maps to ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE
+ if (column.getScale() == null || column.getScale() <= 0) {
+ builder.columnType(ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE);
+ } else {
+ int timestampTzScale = column.getScale();
+ if (column.getScale() > MAX_TIMESTAMP_SCALE) {
Review Comment:
column.getScale() -> timestampTzScale
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4218812937
> Hi, @doyong365!
>
> Thank you for your hard work.
>
> The changes regarding Oracle, MySQL, PostgreSQL, and SQL Server all look good. And the e2e testing for these sources also looks good too.
>
> BTW, It seems we need to take a closer look at all connectors that use the timestamp_ntz type, like Snowflake
>
> <img alt="image" width="499" height="344" src="https://private-user-images.githubusercontent.com/45858414/575155132-cb0dd20e-603c-4c74-b785-a25b204d854a.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU3Nzg1MjYsIm5iZiI6MTc3NTc3ODIyNiwicGF0aCI6Ii80NTg1ODQxNC81NzUxNTUxMzItY2IwZGQyMGUtNjAzYy00Yzc0LWI3ODUtYTI1YjIwNGQ4NTRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA5VDIzNDM0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ5ZDZiNmZkZTgxM2I2MDhmMjNjMTIzYmE5YTY2OGU0ZjZlZGJlYWUzYjdlM2M1NjA2MmE2NWUwYWY2ODE1M2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.X1hyHUQ17L0ZEE9ZokVycCxVAZisLWEZPbk1Xj_AjPk">
> > src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java
>
> > src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect
>
> Please let me know if I am mistaken.
@och5351 Thank you for your reviewing
I have updated `SnowflakeTypeConverter.java` and `SnowflakeDataTypeConvertor.java` to correctly split and map `TIMESTAMP_LTZ` and `TIMESTAMP_TZ` into SeaTunnel's `OFFSET_DATE_TIME_TYPE` (`TIMESTAMP_TZ`), bringing them in line with the other JDBC dialects. The `reconvert` methods have also been patched to seamlessly convert back to Snowflake's native timezone-aware types.
The latest commit includes this end-to-end fix for Snowflake. PTAL!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4675705544
@davidzollo
Thanks for the review! I'll update the commit based on your feedback. Appreciate the follow-up!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4367592293
@davidzollo
Just following up on this PR - CI passed and it's ready for review whenever you have time!
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4477881985
@/tmp/pr-10724-reply-en.md
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "doyong365 (via GitHub)" <gi...@apache.org>.
doyong365 commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4300745804
@davidzollo
Thanks ! I solved it.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#discussion_r3128013848
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
Review Comment:
if (column.getScale() != null && column.getScale() > 9)
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/mysql_iceberg_to_assert.conf:
##########
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+env {
+ parallelism = 1
+ job.mode = "BATCH"
+}
+
+source {
+ Iceberg {
+ catalog_name = "seatunnel_test"
+ iceberg.catalog.config = {
+ "type" = "hadoop"
+ "warehouse" = "file:///tmp/seatunnel_mnt/iceberg/hadoop-ts-mysql/"
+ }
+ namespace = "seatunnel_namespace"
+ table = "mysql_ts_sink"
+ }
+}
+
+sink {
+ Assert {
+ rules = {
+ row_rules = [
+ { rule_type = MIN_ROW, rule_value = 1 },
+ { rule_type = MAX_ROW, rule_value = 1 }
+ ]
+ field_rules = [
+ {
+ field_name = dt_col
+ field_type = timestamp
+ field_value = [
+ { rule_type = NOT_NULL, equals_to = "2026-01-01T00:00:00" }
+ ]
+ },
+ {
+ field_name = ts_col
+ field_type = timestamp_tz
+ field_value = [
+ { rule_type = NOT_NULL }
Review Comment:
It is recommended to add the `equals_to` assertion.
##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/debezium/row/SeaTunnelRowDebeziumDeserializationConverters.java:
##########
@@ -392,6 +394,26 @@ public Object convert(Object dbzObj, Schema schema) {
};
}
+ private static DebeziumDeserializationConverter convertToTimestampTz(ZoneId serverTimeZone) {
+ return new DebeziumDeserializationConverter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Object convert(Object dbzObj, Schema schema) {
+ if (dbzObj instanceof String) {
+ return java.time.OffsetDateTime.parse((String) dbzObj)
+ .withOffsetSameInstant(java.time.ZoneOffset.UTC);
+ }
Review Comment:
OffsetDateTime.parse is too strict here — Debezium may emit zone-region names or non-ISO literals, which will crash the whole CDC task. Please add a fallback chain (OffsetDateTime → ZonedDateTime → Instant) and throw a typed error with the field name on failure.
- Oracle TIMESTAMP WITH LOCAL TIME ZONE → 2024-01-01T12:00:00 Asia/Shanghai — Debezium emits a zone region name (Asia/Shanghai) instead of a numeric offset. OffsetDateTime.parse only understands +HH:MM / -HH:MM / Z, so it rejects any IANA zone id.
- MySQL TIMESTAMP (certain schema-history modes) → 2024-01-01 12:00:00+08:00 — the date and time are separated by a space, not the mandatory ISO-8601 T. Strict ISO parsing fails immediately on the space.
- PostgreSQL timestamptz via Debezium → 2024-01-01T12:00:00+08 — the offset is written in the "hours only" short form (+08). OffsetDateTime.parse requires a full +HH:MM (e.g. +08:00) and rejects the truncated form.
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleJdbcRowConverter.java:
##########
@@ -66,6 +68,11 @@ protected void setValueToStatementByDataType(
} else {
statement.setString(statementIndex, (String) value);
}
+ } else if (seaTunnelDataType.getSqlType().equals(SqlType.TIMESTAMP_TZ)) {
+ // Oracle JDBC does not support OffsetDateTime directly via setObject in all drivers.
+ // Convert to java.sql.Timestamp using the UTC instant to preserve the correct moment.
+ OffsetDateTime odt = (OffsetDateTime) value;
+ statement.setTimestamp(statementIndex, Timestamp.from(odt.toInstant()));
Review Comment:
Timestamp.from(odt.toInstant()) strips the offset — java.sql.Timestamp carries no timezone info, so the JDBC driver falls back to the JVM default timezone when writing to TIMESTAMP WITH TIME ZONE. This silently corrupts the offset in any non-UTC environment.
##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/converter/DefaultDataConverter.java:
##########
@@ -259,6 +266,16 @@ private static Object convertToTime(Object value) {
return TemporalConversions.toLocalTime(value);
}
+ private static Object convertToOffsetDateTime(
+ Object value, org.tikv.common.types.DataType dataType) {
+ if (value instanceof Timestamp) {
+ // TiDB TIMESTAMP is stored in UTC; convert to OffsetDateTime with UTC zone.
+ Instant instant = ((Timestamp) value).toInstant();
+ return OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
+ }
+ return value;
Review Comment:
return value here is a silent no-op for anything that isn't a Timestamp — Long, LocalDateTime, String all fall through and will blow up downstream with a ClassCastException that gives no context.
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
@@ -330,8 +333,22 @@ public BasicTypeDefine reconvert(Column column) {
9,
9);
}
- builder.columnType(SNOWFLAKE_TIMESTAMP);
- builder.dataType(SNOWFLAKE_TIMESTAMP);
+ builder.columnType(SNOWFLAKE_TIMESTAMP_NTZ);
+ builder.dataType(SNOWFLAKE_TIMESTAMP_NTZ);
+ break;
+ case TIMESTAMP_TZ:
+ if (column.getScale() > 9) {
Review Comment:
ditto
##########
docs/zh/introduction/concepts/incompatible-changes.md:
##########
@@ -4,6 +4,13 @@
## dev
+### JDBC Connector
+
+- **破坏性变更:带时区的时间戳列映射为 `TIMESTAMP_TZ` 类型**
+ - **影响范围**:`seatunnel-connectors-v2/connector-jdbc`,`seatunnel-connectors-v2/connector-iceberg`
+ - **变更说明**:以前,JDBC Source 将无时区(如 MySQL `DATETIME`)和带时区(如 MySQL `TIMESTAMP`)的时间戳列都映射为 SeaTunnel 内部的 `TIMESTAMP` 类型。现在,带时区的列(如 MySQL `TIMESTAMP`、PostgreSQL `timestamptz`、Oracle `TIMESTAMP WITH LOCAL TIME ZONE` 和 SQL Server `datetimeoffset`)被显式映射为 `TIMESTAMP_TZ`。这确保了在写入 Iceberg 等格式时,时区语义得到准确保留(在 Iceberg 中 `TIMESTAMP` 存为无时区的 `timestamp`,`TIMESTAMP_TZ` 存为带时区的 `timestamptz`)。
+ - **影响**:如果您的下游 Sink 依赖接收 `TIMESTAMP` 类型且不支持 `TIMESTAMP_TZ`,您可能会遇到类型不匹配错误。对于 Iceberg 用户,这意味着以前作为 `timestamp`(无时区)写入的列现在可能会作为 `timestamptz`(带时区)写入,从而改变表结构。您可能需要在 SQL Transform 中转换该列或更新您的 Sink 配置。(#10685)
+
Review Comment:
Do we need to supplement the behavior change documentation for CDC (Debezium, TiDB), Doris, StarRocks, Hudi, Paimon, and Snowflake?
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java:
##########
Review Comment:
if (column.getScale() != null && column.getScale() > 9)
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/resources/iceberg/pg_iceberg_to_assert.conf:
##########
@@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+env {
+ parallelism = 1
+ job.mode = "BATCH"
+}
+
+source {
+ Iceberg {
+ catalog_name = "seatunnel_test"
+ iceberg.catalog.config = {
+ "type" = "hadoop"
+ "warehouse" = "file:///tmp/seatunnel_mnt/iceberg/hadoop-ts-pg/"
+ }
+ namespace = "seatunnel_namespace"
+ table = "pg_ts_sink"
+ }
+}
+
+sink {
+ Assert {
+ rules = {
+ row_rules = [
+ { rule_type = MIN_ROW, rule_value = 1 },
+ { rule_type = MAX_ROW, rule_value = 1 }
+ ]
+ field_rules = [
+ {
+ field_name = ts_col
+ field_type = timestamp
+ field_value = [
+ { rule_type = NOT_NULL, equals_to = "2026-01-01T00:00:00" }
+ ]
+ },
+ {
+ field_name = tstz_col
+ field_type = timestamp_tz
+ field_value = [
+ { rule_type = NOT_NULL }
Review Comment:
ditto
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/java/org/apache/seatunnel/e2e/connector/iceberg/JdbcToIcebergTimestampIT.java:
##########
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.e2e.connector.iceberg;
+
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.stream.Stream;
+
+/**
+ * E2E test verifying that NTZ (No Time Zone) and LTZ (Local Time Zone) timestamp columns from JDBC
+ * sources are stored with the correct Iceberg timestamp type:
+ *
+ * <ul>
+ * <li>NTZ → Iceberg {@code TimestampType.withoutZone()} (e.g. MySQL DATETIME, PG timestamp)
+ * <li>LTZ → Iceberg {@code TimestampType.withZone()} (e.g. MySQL TIMESTAMP, PG timestamptz)
+ * </ul>
+ *
+ * <p>Covers the fix for https://github.com/apache/seatunnel/issues/10685
+ */
+@DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason =
+ "Spark engine does not support TIMESTAMP_TZ (OffsetDateTime) natively; "
+ + "TIMESTAMP_TZ is serialized as a custom Decimal struct in Spark translation layer, "
+ + "which is incompatible with standard Sink connectors. "
+ + "Tested on Zeta and Flink engines only.")
+@DisabledOnOs(OS.WINDOWS)
+public class JdbcToIcebergTimestampIT extends TestSuiteBase implements TestResource {
+
+ private static final Logger log = LoggerFactory.getLogger(JdbcToIcebergTimestampIT.class);
+
+ // -------------------------------------------------------------------------
+ // Catalog directories (inside the SeaTunnel container)
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_CATALOG_DIR = "/tmp/seatunnel_mnt/iceberg/hadoop-ts-mysql/";
+
+ private static final String PG_CATALOG_DIR = "/tmp/seatunnel_mnt/iceberg/hadoop-ts-pg/";
+
+ // -------------------------------------------------------------------------
+ // MySQL container
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_IMAGE = "mysql:8.0";
+ private static final String MYSQL_HOST = "mysql_timestamp_e2e";
+ private static final String MYSQL_DATABASE = "ts_test";
+ private static final String MYSQL_USER = "root";
+ private static final String MYSQL_PASSWORD = "root";
+
+ private static final MySQLContainer<?> MYSQL_CONTAINER =
+ new MySQLContainer<>(DockerImageName.parse(MYSQL_IMAGE))
+ .withDatabaseName(MYSQL_DATABASE)
+ .withUsername(MYSQL_USER)
+ .withPassword(MYSQL_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(MYSQL_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger("mysql-timestamp-image")));
+
+ // -------------------------------------------------------------------------
+ // PostgreSQL container
+ // -------------------------------------------------------------------------
+ private static final String PG_IMAGE = "postgres:14-alpine";
+ private static final String PG_HOST = "pg_timestamp_e2e";
+ private static final String PG_DATABASE = "ts_test";
+ private static final String PG_USER = "postgres";
+ private static final String PG_PASSWORD = "postgres";
+
+ private static final PostgreSQLContainer<?> PG_CONTAINER =
+ new PostgreSQLContainer<>(DockerImageName.parse(PG_IMAGE))
+ .withDatabaseName(PG_DATABASE)
+ .withUsername(PG_USER)
+ .withPassword(PG_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(PG_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(
+ DockerLoggerFactory.getLogger("pg-timestamp-image")));
+
+ // -------------------------------------------------------------------------
+ // Driver / plugin JARs downloaded into the SeaTunnel container
+ // -------------------------------------------------------------------------
+ private static final String MYSQL_DRIVER_URL =
+ "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.32/mysql-connector-j-8.0.32.jar";
+
+ private static final String PG_DRIVER_URL =
+ "https://repo1.maven.org/maven2/org/postgresql/postgresql/42.3.3/postgresql-42.3.3.jar";
+
+ private static final String ZSTD_URL =
+ "https://repo1.maven.org/maven2/com/github/luben/zstd-jni/1.5.5-5/zstd-jni-1.5.5-5.jar";
+
+ // -------------------------------------------------------------------------
+ // Container setup: create Iceberg dirs + download driver JARs
+ // -------------------------------------------------------------------------
+ @TestContainerExtension
+ protected final ContainerExtendedFactory extendedFactory =
+ container -> {
+ for (String dir :
+ new String[] {
+ MYSQL_CATALOG_DIR + "seatunnel_namespace/mysql_ts_sink/data",
+ MYSQL_CATALOG_DIR + "seatunnel_namespace/mysql_ts_sink/metadata",
+ PG_CATALOG_DIR + "seatunnel_namespace/pg_ts_sink/data",
+ PG_CATALOG_DIR + "seatunnel_namespace/pg_ts_sink/metadata",
+ }) {
+ container.execInContainer("sh", "-c", "mkdir -p " + dir);
+ }
+ container.execInContainer("sh", "-c", "chmod -R 777 /tmp/seatunnel_mnt/iceberg/");
+
+ // Download Iceberg compression codec
+ container.execInContainer(
+ "sh",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Iceberg/lib"
+ + " && cd /tmp/seatunnel/plugins/Iceberg/lib"
+ + " && wget -q "
+ + ZSTD_URL);
+
+ // Download JDBC drivers into the Jdbc plugin directory
+ container.execInContainer(
+ "sh",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && cd /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && wget -q "
+ + MYSQL_DRIVER_URL
+ + " && wget -q "
+ + PG_DRIVER_URL);
+ };
+
+ // -------------------------------------------------------------------------
+ // Lifecycle
+ // -------------------------------------------------------------------------
+ @BeforeAll
+ @Override
+ public void startUp() throws Exception {
+ log.info("Starting MySQL and PostgreSQL containers...");
+ Startables.deepStart(Stream.of(MYSQL_CONTAINER, PG_CONTAINER)).join();
+ log.info("DB containers started. Initializing test data...");
+ initMysqlData();
+ initPostgresData();
+ log.info("Test data initialised.");
+ }
+
+ @AfterAll
+ @Override
+ public void tearDown() {
+ if (MYSQL_CONTAINER != null) {
+ MYSQL_CONTAINER.close();
+ }
+ if (PG_CONTAINER != null) {
+ PG_CONTAINER.close();
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // Test: MySQL DATETIME (NTZ) → Iceberg withoutZone()
+ // -------------------------------------------------------------------------
+ @TestTemplate
+ public void testMysqlDatetimeToIcebergNtz(TestContainer container)
+ throws IOException, InterruptedException {
+ // Step 1: Run job to write data from MySQL to Iceberg
+ org.testcontainers.containers.Container.ExecResult result =
+ container.executeJob("/iceberg/mysql_jdbc_to_iceberg_timestamp.conf");
+ Assertions.assertEquals(
+ 0, result.getExitCode(), "Write job failed:\n" + result.getStderr());
+
+ // Step 2: Run verification job (Iceberg -> Assert)
+ // This job verifies that the data in Iceberg matches expected types and values
+ org.testcontainers.containers.Container.ExecResult verifyResult =
+ container.executeJob("/iceberg/mysql_iceberg_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ verifyResult.getExitCode(),
+ "Verification job failed:\n" + verifyResult.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Test: PostgreSQL timestamp (NTZ) → Iceberg withoutZone()
+ // PostgreSQL timestamptz (LTZ) → Iceberg withZone()
+ // -------------------------------------------------------------------------
+ @TestTemplate
+ public void testPgTimestampToIceberg(TestContainer container)
+ throws IOException, InterruptedException {
+ // Step 1: Run job to write data from PostgreSQL to Iceberg
+ org.testcontainers.containers.Container.ExecResult result =
+ container.executeJob("/iceberg/pg_jdbc_to_iceberg_timestamp.conf");
+ Assertions.assertEquals(
+ 0, result.getExitCode(), "Write job failed:\n" + result.getStderr());
+
+ // Step 2: Run verification job (Iceberg -> Assert)
+ org.testcontainers.containers.Container.ExecResult verifyResult =
+ container.executeJob("/iceberg/pg_iceberg_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ verifyResult.getExitCode(),
+ "Verification job failed:\n" + verifyResult.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Helpers
+ // -------------------------------------------------------------------------
+ private void initMysqlData() throws Exception {
+ try (Connection conn =
+ DriverManager.getConnection(
+ MYSQL_CONTAINER.getJdbcUrl(), MYSQL_USER, MYSQL_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_table ("
+ + " id INT PRIMARY KEY,"
+ + " dt_col DATETIME,"
+ + " ts_col TIMESTAMP"
+ + ")");
+ stmt.execute(
+ "INSERT INTO ts_table (id, dt_col, ts_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00')");
+ }
+ }
+
+ private void initPostgresData() throws Exception {
+ try (Connection conn =
+ DriverManager.getConnection(
+ PG_CONTAINER.getJdbcUrl(), PG_USER, PG_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_table ("
+ + " id INT PRIMARY KEY,"
+ + " ts_col TIMESTAMP WITHOUT TIME ZONE,"
+ + " tstz_col TIMESTAMP WITH TIME ZONE"
+ + ")");
+ stmt.execute(
+ "INSERT INTO ts_table (id, ts_col, tstz_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00+00')");
Review Comment:
add a non-UTC timezone test to validate the core fix scenario
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlTimestampIT.java:
##########
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.jdbc;
+
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.ContainerExtendedFactory;
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+import org.apache.seatunnel.e2e.common.junit.TestContainerExtension;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import static org.awaitility.Awaitility.given;
+
+/**
+ * E2E test verifying that MySQL NTZ/LTZ timestamp types are correctly distinguished by the JDBC
+ * connector after the fix for https://github.com/apache/seatunnel/issues/10685.
+ *
+ * <ul>
+ * <li>MySQL {@code DATETIME} (NTZ) → SeaTunnel internal {@code TIMESTAMP} type
+ * <li>MySQL {@code TIMESTAMP} (LTZ) → SeaTunnel internal {@code TIMESTAMP_TZ} type
+ * </ul>
+ *
+ * <p>The Assert sink's {@code field_type} check is used to validate the internal type mapping.
+ */
+@DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason =
+ "Spark engine does not support TIMESTAMP_TZ (OffsetDateTime) natively; "
+ + "TIMESTAMP_TZ is serialized as a custom Decimal struct in Spark translation layer, "
+ + "which is incompatible with standard Sink connectors. "
+ + "Tested on Zeta and Flink engines only.")
+@Slf4j
+public class JdbcMysqlTimestampIT extends TestSuiteBase implements TestResource {
+
+ private static final String MYSQL_IMAGE = "mysql:8.0";
+ private static final String MYSQL_HOST = "mysql_ts_e2e";
+ private static final String MYSQL_DATABASE = "ts_test";
+ private static final String MYSQL_USER = "root";
+ private static final String MYSQL_PASSWORD = "Abc!@#135_seatunnel";
+
+ private static final String MYSQL_DRIVER_URL =
+ "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.32/mysql-connector-j-8.0.32.jar";
+
+ private MySQLContainer<?> mysqlContainer;
+
+ @TestContainerExtension
+ private final ContainerExtendedFactory extendedFactory =
+ container -> {
+ Container.ExecResult result =
+ container.execInContainer(
+ "bash",
+ "-c",
+ "mkdir -p /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && cd /tmp/seatunnel/plugins/Jdbc/lib"
+ + " && wget -q "
+ + MYSQL_DRIVER_URL);
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "Failed to download MySQL driver: " + result.getStderr());
+ };
+
+ @BeforeAll
+ @Override
+ public void startUp() throws Exception {
+ mysqlContainer =
+ new MySQLContainer<>(DockerImageName.parse(MYSQL_IMAGE))
+ .withDatabaseName(MYSQL_DATABASE)
+ .withUsername(MYSQL_USER)
+ .withPassword(MYSQL_PASSWORD)
+ .withNetwork(NETWORK)
+ .withNetworkAliases(MYSQL_HOST)
+ .withLogConsumer(
+ new Slf4jLogConsumer(DockerLoggerFactory.getLogger(MYSQL_IMAGE)));
+
+ Startables.deepStart(Stream.of(mysqlContainer)).join();
+
+ given().ignoreExceptions()
+ .await()
+ .atMost(60, TimeUnit.SECONDS)
+ .untilAsserted(() -> initMysqlData());
+ log.info("MySQL container started and test data initialised.");
+ }
+
+ @AfterAll
+ @Override
+ public void tearDown() {
+ if (mysqlContainer != null) {
+ mysqlContainer.close();
+ }
+ }
+
+ /**
+ * Verifies that MySQL {@code DATETIME} (NTZ) columns are read as SeaTunnel {@code TIMESTAMP}
+ * (i.e. {@code LOCAL_DATE_TIME_TYPE}), not {@code TIMESTAMP_TZ}.
+ *
+ * <p>The Assert sink's {@code field_type = timestamp} assertion will fail if the connector
+ * incorrectly maps {@code DATETIME} to {@code TIMESTAMP_TZ}.
+ */
+ @TestTemplate
+ public void testMysqlDatetimeIsNtz(TestContainer container)
+ throws IOException, InterruptedException {
+ Container.ExecResult result = container.executeJob("/jdbc_mysql_datetime_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "MySQL DATETIME (NTZ) assertion failed:\n" + result.getStderr());
+ }
+
+ /**
+ * Verifies that MySQL {@code TIMESTAMP} (LTZ) columns are read as SeaTunnel {@code
+ * TIMESTAMP_TZ} (i.e. {@code OFFSET_DATE_TIME_TYPE}).
+ *
+ * <p>The Assert sink's {@code field_type = timestamp_tz} assertion will fail if the connector
+ * incorrectly maps {@code TIMESTAMP} to plain {@code TIMESTAMP}.
+ */
+ @TestTemplate
+ public void testMysqlTimestampIsLtz(TestContainer container)
+ throws IOException, InterruptedException {
+ Container.ExecResult result = container.executeJob("/jdbc_mysql_timestamp_to_assert.conf");
+ Assertions.assertEquals(
+ 0,
+ result.getExitCode(),
+ "MySQL TIMESTAMP (LTZ) assertion failed:\n" + result.getStderr());
+ }
+
+ // -------------------------------------------------------------------------
+ // Helpers
+ // -------------------------------------------------------------------------
+
+ private void initMysqlData() throws Exception {
+ String jdbcUrl =
+ String.format(
+ "jdbc:mysql://%s:%d/%s?useSSL=false&serverTimezone=UTC",
+ mysqlContainer.getHost(),
+ mysqlContainer.getFirstMappedPort(),
+ MYSQL_DATABASE);
+ try (Connection conn = DriverManager.getConnection(jdbcUrl, MYSQL_USER, MYSQL_PASSWORD);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute(
+ "CREATE TABLE IF NOT EXISTS ts_source ("
+ + " id INT PRIMARY KEY,"
+ + " dt_col DATETIME,"
+ + " ts_col TIMESTAMP NULL"
+ + ")");
+ // Insert a fixed wall-clock value: 2026-01-01 00:00:00
+ // DATETIME stores it as-is (NTZ); TIMESTAMP stores UTC and displays in session TZ.
+ stmt.execute(
+ "INSERT INTO ts_source (id, dt_col, ts_col) VALUES"
+ + " (1, '2026-01-01 00:00:00', '2026-01-01 00:00:00')");
Review Comment:
add a non-UTC timezone test to validate the core fix scenario
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp… [seatunnel]
Posted by "dybyte (via GitHub)" <gi...@apache.org>.
dybyte commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4206314171
Please enable CI following the [instructions.](https://github.com/apache/seatunnel/pull/10724/checks?check_run_id=70379943766)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEATUNNEL-10685] prevent timestamp_ntz from being saved as timestamp_ltz [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #10724:
URL: https://github.com/apache/seatunnel/pull/10724#issuecomment-4297066496
Good job, thank you for add new data type for SeaTunel. Please solve conflicts firstly.
<img width="1288" height="224" alt="image" src="https://github.com/user-attachments/assets/e86b0bdd-6f5f-4e7d-bf19-789152a93140" />
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org