Repository navigation
refactor: decouple sink type dispatch from PG source OIDs - #98
Merged
dariomazzitellireplik-coder merged 2 commits intoMay 16, 2026
Merged
dariomazzitellireplik-coder merged 2 commits into
dariomazzitellireplik-coder merged 2 commits into
Conversation
Sinks now dispatch on DataType (source-agnostic) instead of pg_type_id. SourceColumn::pg_type_id becomes Option<u32>, populated by Postgres sources only; non-PG sources (MySQL today) populate None. The previous magic-zero sentinel coupled every sink to PG OID semantics and silently broke MySQL-Snowflake type fidelity. Also fixes Value::Timestamp serialization in the PG sink raw table (was raw int64, now ISO-8601 string, parity with SR/SF sinks), and extends pg_type_to_data_type to map 1082/1083/1266 to Date/Time so non-PG sources can stop falling back to OID-only refinement. _dbmazz._schema_tracking schema auto-migrates from v1 to v2 on first daemon start: adds nullable data_type JSONB column, drops NOT NULL on pg_type_id, backfills data_type for existing rows. Idempotent and forward-compatible. Verify matrix run: PG-PG / PG-SR / MySQL-PG / MySQL-SR — 0 regressions. Two C11 failures are pre-existing CLI/MySQL-beta limitations outside this change's scope. Renames internal connectors::sinks::postgres::types::mysql_data_type_to_pg to data_type_to_pg (never was MySQL-specific).
dariomazzitellireplik-coder
requested review from
dariomazzitelli-sys and
tanokl
as code owners
May 16, 2026 18:54
dariomazzitellireplik-coder
deleted the
refactor/decouple-sinks-from-pg-source-types
branch
May 16, 2026 19:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sinks now dispatch primarily on
DataType(source-agnostic) instead ofpg_type_id. PostgreSQL OIDs become an optional refinement carried by Postgres sources only; non-PG sources (MySQL today) populateNone. The previous magic-zero (pg_type_id == 0) sentinel coupled every sink to PG OID semantics and silently broke MySQL → Snowflake type fidelity.Tagging this
v2.4.0at merge.OpenSpec change:
decouple-sinks-from-pg-source-types.Changes
Shape change
SourceColumn::pg_type_id: u32→Option<u32>. PG sources populateSome(oid), MySQL populatesNone. No more magic zero.Sink-side dispatch
variant_extract_expr(col_name, &DataType, Option<u32>). DataType is the primary axis; OID is consulted only for cases the PG→DataType boundary collapses (arrays, money).pg_type_to_starrocks/pg_text_to_jsonas legacy refinement-only.column_type(&SourceColumn)to dispatch on DataType, with OID refinement only forString/Text(varchar/inet/cidr fidelity). Renamedmysql_data_type_to_pg→data_type_to_pg.Bugs fixed
Value::Timestampin PG sink raw table now serializes as ISO-8601 string (was raw int64). Parity with SR/SF sinks; unblocks MySQL TIMESTAMP→PG once MySQL emitsValue::Timestamp.pg_type_to_data_typenow maps1082(date),1083/1266(time/timetz) toDataType::Date/Timeinstead of collapsing toString. Sinks dispatching on DataType produce accurate DDL without consulting OIDs.Migration
_dbmazz._schema_trackingauto-migrates from v1 to v2 on first daemon start: adds nullabledata_type JSONB, dropsNOT NULLonpg_type_id, backfillsdata_typefor existing rows. Idempotent. Forward-compatible — old binaries still read the v2 schema (NULLdata_typefalls back topg_type_to_data_type(pg_type_id)).Verification
Local matrix via
ez-cdc verify:created_atTZ display (pre-existing CLI test bug — column wastimestamp with time zoneon source)SchemaChangeevents (known BETA limitation)Zero regressions from this refactor. Both C11 failures are pre-existing issues outside scope.
Static checks:
cargo fmt --all -- --checkcleancargo clippy --features mysql-source -- -D warningscleancargo clippy -- -D warningscleancargo test --features mysql-source→ 248 passed / 0 failedcargo test→ 158 passed / 0 failedTest plan
cargo fmt --all -- --checkcargo clippy --features mysql-source -- -D warningscargo clippy -- -D warningscargo test --features mysql-sourcecargo testez-cdc verify --source demo-pg --sink demo-pg-targetez-cdc verify --source demo-pg --sink demo-starrocksez-cdc verify --source local-mysql --sink demo-pg-targetez-cdc verify --source local-mysql --sink demo-starrocksez-cdc verifyagainst MySQL → Snowflake (deferred — no SF creds in dev-stack)_schema_trackingmigration tested against a synthetic v1 table (deferred to follow-up integration test)