Skip to content

Clean up YDB adapter internals and regression fixtures - #272

Merged
KirillKurdyukov merged 8 commits into
mainfrom
fix/ydb-adapter-cleanup
Oct 1, 2026
Merged

KirillKurdyukov merged 8 commits into
mainfrom
fix/ydb-adapter-cleanup

Conversation

@KirillKurdyukov

@KirillKurdyukov KirillKurdyukov commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Targeted cleanup approved after the independent maintainability review of #270.
This remains on Trino 483, based on main 94955bb; the separate 484 draft
#271 is unchanged.

  • Remove unreachable non-Decimal JDBC fallback branches, the orphan varchar
    helper, unused type aliases and unreachable Decimal AVG registration.
  • Inline the one-caller RewriteUtils; use existing unary pattern guarantees.
  • Reuse UPDATE primary-key metadata for RETURNING without changing key-update
    rejection, row counts or transaction ownership.
  • Reuse production Guice wiring in fixtures, overriding only the fixture
    client; remove the empty metadata subclass while preserving the custom
    factory's false policy and caching lifecycle.
  • Replace SQL-substring PK detection in fixtures. Preserve the synthetic DDL
    case for primary key, assert YDB rejects this forbidden name, and exercise
    real CREATE/INSERT/SELECT with the valid quoted name primary_key.
  • Strengthen parameter-order fixtures with distinct operands, clarify the
    unsupported timestamp-literal contract and exercise both real bootstrap
    variants and Decimal metadata mapping.
  • Fix example launcher paths and documented CLI service invocation.

16 files changed: 167 insertions, 257 deletions. Two unnecessary classes removed.
Native type guards, JOIN semantics, MERGE resource/failure coverage, capabilities
and existing inherited suites remain intact. No tests are skipped to go green.

Verification

JDK: Temurin 25.0.2.

JAVA_HOME=$(/usr/libexec/java_home -v 25) mvn -B -ntp \
  -f ydb-trino-adapter/pom.xml \
  -Dtest=TestYdbExpressionRewrites,TestYdbColumnMappings,TestYdbJoinMappings,TestYdbMergeSink,TestYdbWriteMetadata,TestYdbPlugin \
  clean verify

Final local result: 27 passed, 0 failures/errors/skips, fresh package built.
All integration sources compile. The actual public connector factory starts
and shuts down for production and fixture module variants.

Regression evidence

  • Temporarily swapped NULLIF/strpos operand parameter groups and wrongly
    admitted an in-range timestamp predicate: exactly the three intended tests
    failed by assertion. Restored production code: all six then-current
    expression tests passed. No mutation remains.
  • The new fixture DDL case failed before its fix with a missing hidden PK;
    the same case passes after removing substring detection.
  • Existing Decimal writer assertions now exercise the actual client mapping,
    including TYPE_NAME precedence over generic JDBC precision/scale.

Example preparation

Executed the real start.sh and both real Maven commands. Only Docker
state-changing commands were intercepted; the interceptor recorded their
working directory/arguments and invoked the real Compose config validator.
Old script failed because docker/ had no Compose file. Fixed script staged
79 JARs under examples/trino/plugin, validated the actual config and
confirmed service trino. bash -n, Compose validation and git diff --check
pass; the executable bit is preserved.

This proves packaging/config preparation, not running example containers.
Docker/Colima was not restarted or repaired. All temporary shims, staged JARs,
mutations and the unused worker worktree were removed.

Java/Bash language servers are unavailable; compiler and shell/Compose
validation were used. The pre-existing obsolete Compose version warning
remains. Local real-YDB execution requires the unavailable Colima daemon;
the ordinary full canonical CI is the final runtime gate.

Final full CI result

Run 36858049165
passed for exact head 49ebcb4d4363b71b986c96d22e73586e7f8ed838.
Actions tested merge checkout dd3931c against unchanged main 94955bb.
Temurin 25.0.4; ordinary workflow command in ydb-trino-adapter:
mvn $MAVEN_ARGS clean test.

368 total, 283 passed, 85 skipped, 0 failures/errors; BUILD SUCCESS.
The 85 exclusions are unchanged from the baseline, not added by this cleanup.

Group Total Passed Skipped
Inherited connector contract plus custom cases 274 193 81
Smoke contract 35 31 4
Native JOIN/type/boundary cases 26 26 0
Production CREATE/INSERT/DML 6 6 0
Unit/API/bootstrap regressions 27 27 0

Both final live identifier outcomes passed: quoted primary_key
CREATE/INSERT/SELECT and exact rejection of the forbidden primary key.

Initial failure and correction

Run 36853742332
on 9570b6169afd0b549584ce190e1c947593c15f8f: 368 total, 282 passed,
85 skipped, 1 error
. The sole error is the newly added positive live test
for the column primary key. YDB rejects spaces in column names even when
quoted: Invalid name for user column 'primary key'. Its generated DDL
correctly contains the hidden PK, so generator correctness and backend name
acceptance must be tested separately.

The documented naming rules
allow Latin letters, digits, - and _, at most 255 characters, excluding the
system prefix __ydb_. The task owner approved correcting the mistaken new
test expectation. Commit 49ebcb4d4363b71b986c96d22e73586e7f8ed838 preserves
the synthetic DDL regression, asserts the exact real rejection, and uses
quoted primary_key for CREATE/INSERT/SELECT, with cleanup on all outcomes.
All 27 local regressions, clean packaging and the final full CI pass.
No skip or name-remapping feature was introduced.

Review and delivery

The complete integrated diff was self-reviewed against the approved scope.
No new dependency, generic framework, type-support expansion, retry or
statement-atomic MERGE claim is introduced. An attempted isolated wiring
worker failed before execution; the primary agent implemented and verified
that work instead.

Final-head CI and recorded self-review are complete. Ready for review;
not merged and no automatic merge requested.

Distinguish parameter groups from both operands and clarify the existing
timestamp-literal fallback contract with an in-range control.

All six expression tests pass. Temporary order and timestamp-pushdown
mutations produced the three intended assertion failures, then were restored.
Inline the sole binary helper and use the unary rule pattern guarantees.
Preserve divisor guards and parameter order, and exercise successful
arithmetic/case rewrites alongside the existing fallback cases.

Fresh package verification passes all 25 unit/API tests.
Keep native type admission and Decimal metadata handling while deleting
branches excluded by the existing non-Decimal guard. Remove unused rewrite
registrations and exercise Decimal writers through the actual client mapping.

All 19 related mapping, JOIN and expression tests pass.
Pass the keys already checked by UPDATE to the RETURNING executor.
DELETE still obtains its key metadata once after preparing the statement.
Keep key-update rejection and exact RETURNING row counting unchanged.

Compilation and six adjacent write/metadata/bootstrap tests pass; the full
real-YDB CI remains the final DML behavior check.
Override only the fixture JdbcClient instead of copying production Guice
bindings. Inline the empty metadata subclass while preserving the custom
factory caching lifecycle and false policy argument.

Both real connector bootstrap variants and the metadata regression pass.
Keep explicit hidden-key handling without mistaking a quoted column name
for a table constraint. Add a failing-then-passing DDL regression and a
real CREATE/INSERT/SELECT case for the full CI suite.

Metadata/bootstrap tests pass, and all integration sources compile. Remove
unused fixture imports and correct the stale INSERT staging comment.
Stage the plugin under the checked-in examples layout and use the Compose
service for CLI access. Resolve the script directory and fail on errors.

Real Maven packaging staged 79 JARs and the real Compose validator passed.
Only Docker state-changing dispatch was intercepted during local QA.
YDB rejects spaces in column names even when quoted. Keep the synthetic
DDL regression, assert the real invalid-name rejection, and exercise
CREATE/INSERT/SELECT with the permitted primary_key identifier.

The initial full CI exposed this incorrect new test expectation. All 27
local regressions and fresh packaging pass; full CI verifies both live cases.
@KirillKurdyukov
KirillKurdyukov marked this pull request as ready for review October 1, 2026 12:02
@KirillKurdyukov
KirillKurdyukov merged commit dce6882 into main Oct 1, 2026
1 check passed
@KirillKurdyukov
KirillKurdyukov deleted the fix/ydb-adapter-cleanup branch October 1, 2026 12:08
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