Skip to content

Fix YDB connector semantics, native JOINs and write lifecycle - #270

Merged
KirillKurdyukov merged 13 commits into
mainfrom
fix/ydb-connector-review
Oct 1, 2026
Merged

KirillKurdyukov merged 13 commits into
mainfrom
fix/ydb-connector-review

Conversation

@KirillKurdyukov

@KirillKurdyukov KirillKurdyukov commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Supersedes the closed connector work in #269 and #267. This PR targets
ydb-platform/ydb-java-dialects, not trinodb/trino.

  • Extend equality JOIN pushdown beyond Int64 with native-type guards, UInt64
    range preservation, NaN/signed-zero normalization and INNER/LEFT/RIGHT/FULL
    coverage. Keep unsafe expressions, conversions and native decimal joins in Trino.
  • Correct expression parameter order, Unicode strpos, overflow fallback,
    unsigned/decimal writes, UTC temporal mapping and floating Top-N, including
    all NULL-placement/direction combinations and representable Date32 predicates.
  • Keep signed-minimum modulo by -1 in Trino and bound Timestamp64 predicate
    parameters and writes. Add the missing behavioral boundary cases found by
    independent review. Preserve the inclusive Timestamp64 endpoint through
    native SDK values, including NOT NULL writes; disable JDBC 2.4.1's incompatible
    IN-list rewrite while retaining IN predicate pushdown.
  • Fix default INSERT staging metadata identity. Reject physical-key updates.
    Make row-level writes explicitly non-transactional and preserve native types,
    operation order, nullable composite keys and owned batch resource cleanup.
  • Add production-client write tests, a 19-native-type JOIN matrix and unit
    regressions. Fail rather than silently skip when Docker is unavailable.
  • Avoid JDBC 2.4.1's cached-context open/last-close race by defaulting to
    per-connection contexts, without retrying writes.
  • Document the comparison with pinned upstream Trino, the separate prototype's
    failed CI/review, and the remaining upstream port requirements in
    ydb-trino-adapter/UPSTREAM-READINESS.md.

Write contract

MERGE and row-level UPDATE/DELETE require
merge.non-transactional-merge.enabled=true or the corresponding session
property. Previously committed batches can remain after failure or cancellation.
The connector does not claim statement-atomic MERGE or replay failed writes.
Fully pushed UPDATE/DELETE continue to use one YQL RETURNING statement.

Validation

Trino 483, Temurin 25.0.2:

mvn -B -ntp -f ydb-trino-adapter/pom.xml \
  -Dtest=TestYdbExpressionRewrites,TestYdbColumnMappings,TestYdbJoinMappings,TestYdbMergeSink,TestYdbWriteMetadata,TestYdbPlugin \
  verify

24 passed; 0 failures, errors or skips. This includes actual production
connector bootstrap. All integration sources compiled.

The complete real-YDB CI run
passed for current head 2a443c1909b244e2d102d01414567f6ef9f17ed3:
364 tests, 279 passed, 85 skipped, zero failures/errors.
GitHub executes the PR-merge checkout for this head.

This includes the modulo and Timestamp64 boundary gaps found by independent
review. Intermediate runs exposed the SDK endpoint check, SQL CAST nullability,
and optimized IN-list binding; those failures drove the native-value correction
and explicit endpoint IN coverage.

Group Tests Skipped
Inherited connector contract 273 81
Inherited smoke contract 35 4
Production native JOIN and boundary cases 26 0
Production CREATE/INSERT/DML 6 0
Unit and plugin-bootstrap tests 24 0

The local full clean test had 18 passed and 4 integration-class setup
failures, with 0 errors/skips: the Colima Docker socket was unavailable.
Docker/Colima was not restarted or repaired. The primary checkout was untouched.
Java LSP was unavailable; Maven compilation completed successfully.

The local current-Trino prototype at dce9fe0f11 also passed fresh
clean verify -P errorprone-compiler with all 21 unit/API tests. Its full Trino 484
integration suite and upstream CI remain unverified; the standalone 483 CI
does not replace them. Legacy JOIN API deprecation warnings and an existing
text-block advisory remain unsuppressed.

Independent review of exact commits 2a443c1909b244e2d102d01414567f6ef9f17ed3
and local target dce9fe0f112e2341d645ed8282dbc61173e78864 returned APPROVE,
with no remaining blockers. It rechecked both semantic findings from the
earlier whole-connector review, the native SDK/IN parameter paths, current
CI logs and packaged-source identity. Approval covers canonical code-readiness
and the limited local handoff, not unverified Trino 484 runtime or upstream
merge readiness.
Historical upstream CI is not presented as a pass for this branch.

No merge is requested automatically. The actual upstream Trino submission is
left to the designated student's handoff.

Use explicit non-transactional MERGE batches with nullable composite keys. Fix default INSERT staging and reject physical-key updates.

Add native JOIN and production-write coverage. Unit validation passes; local integration setup fails because Docker is unavailable.
Match NaN ordering to Trino sort operators and admit Date32 predicates
only when their bound values are representable by YDB.

Disable the JDBC 2.4.1 shared-context cache by default to avoid a race
between connection registration and last-close shutdown. Add a real
connector bootstrap check and correct H2 reference-query syntax.

All 20 local regressions pass; full real-YDB CI remains required.
Keep signed-minimum modulo by minus one in Trino. Bound Timestamp64
predicate parameters and writes to the native YDB range.

Add behavioral filter, projection and JOIN cases plus native timestamp
endpoint and just-outside comparisons. All 24 local regressions pass;
complete real-YDB CI must validate the new boundary scenarios.
Use an Int64 parameter with CAST(? AS Timestamp64), preserving the full
native range and typed NULL values. Add live nullable and NOT NULL
endpoint writes. All 24 local regression tests pass.
Avoid the Optional result introduced by SQL CAST. Pass native SDK values
through the driver and encode the inclusive maximum without the SDK
off-by-one check. Test real required and optional driver conversion.

All 24 standalone regression tests pass.
Disable the JDBC IN-to-list rewrite, which bypasses native SDK values.
Keep predicate pushdown with scalar parameters and cover both native
Timestamp64 endpoints in the live IN regression.

All 24 standalone regression tests pass.
@KirillKurdyukov
KirillKurdyukov marked this pull request as ready for review September 30, 2026 17:51
@KirillKurdyukov
KirillKurdyukov merged commit 94955bb into main Oct 1, 2026
1 check passed
@KirillKurdyukov
KirillKurdyukov deleted the fix/ydb-connector-review branch October 1, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant