Repository navigation
fix(load): keep empty ENUM member and empty SET distinct from NULL - #29854
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
End-to-end verification Setup: built Table
Explicit BVT (mo-tester |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of 234f6ee42bdb6f2ce7ffe026baab8b78c9966341 against base/merge-base 4022729da24d71b082c22b52aaed3faba2b77ea5: REQUEST_CHANGES. Two silent wrong-result cases remain in the issue's explicitly requested acceptance boundary, and the new membership check adds avoidable per-field allocation cost. Details and concrete reproductions are inline.
Design: the existing external reader should identify explicit NULL and preserve the logical ENUM/SET input; the existing type parser should own its interpretation. This patch adds an exception after two generic physical-type transformations (trim and numeric zero-fill). Those earlier assumptions still apply to ENUM / SET-as-uint64, so the new branch does not systematically fix the contract. No new state machine, storage path or concurrency owner is introduced, and a separate architecture document is unnecessary for this focused fix. Parquet SET support is explicitly excluded by the author and is not being reopened here.
Validation performed on this head: the author's focused tests pass; reviewer owner-level probes pass strict-serial empty SET and all explicit-NULL controls, but fail requested-parallel and LOCAL non-strict empty SET, plus a declared whitespace ENUM member. A real embedded cluster and authenticated MySQL connection reproduce the same wrong readbacks through LOAD DATA. Native INSERT is the independent control: it preserves empty SET and the whitespace ENUM member. The public probe finished in 8.61s (package 10.405s): strict-serial control passes; the other three subcases fail their value assertions after LOAD succeeds. The small PARALLEL 'true' case proves requested-parallel initialization, not split-file/multi-worker execution. No timing, resource-leak or race claim is inferred from this test.
Required test closure: commit a small SQL regression through actual CSV/JSONLINE LOAD and readback with native INSERT controls, including the two counterexamples, explicit NULL/null_map semantics and the applicable LOAD modes. The new 86-line unit test uses decimal256ExternalParam, whose ExternType is EXTERNAL_TB; switching the format label does not execute either reader or LOAD initialization. That is why it misses the zero-fill branch. Its whitespace-equals-empty assertion also misses a schema that declares both members. There is no committed BVT delta. The author's manual common-value SQL evidence is useful, but neither it nor unchanged load_data/dtype cases protects these changed contracts in CI.
Performance evidence: identical getColData benchmark, same fixture/vector reuse/NULL oracle, three 300ms samples on Go1.27.1 Darwin/arm64 Apple M4; the only base substitution is external.go from the merge-base via Go overlay. Base: 29.52-30.02 ns/op, 0 B/op, 0 allocs/op. Head: 804.5-815.1 ns/op, 760 B/op, 14 allocs/op. This measures the empty-field conversion path only, not end-to-end LOAD throughput or TP/prepared-statement latency.
Change accounting: implementation +17/-1; tests +86/-0; documentation 0. Both production hunks and the entire new test were reviewed, including reader/Prepare/cast consumers and the native type-parser counterpart. No prior substantive review threads exist to resolve. No production source was changed and no subagents were used.
|
Addressed review 5482067478 in 7c3f114 (inline replies on all three threads).
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep follow-up review of ebf1975ec815cd911c837b15fbf0ed7da8930c23 against base/merge-base f09d4788fd4d1aa30aae0e2f49d014589e7566c0: REQUEST_CHANGES — two P2 blockers.
- Valid Unicode-whitespace SET members still silently become another member. The ASCII-only guard is narrower than
strings.TrimSpace. Real CSV/JSONLINE LOAD and both requested-parallel variants store plaina(bitmap 32) instead of the declared NBSP/ideographic-space members (bitmaps 2/4/8). Details and controls are added to the existing SET preservation thread. The same exact-base probe fails: this is an incomplete repair within #29840's stated contract, not a new correctness regression. - The new padded-SET check adds discarded-error work to accepted input. For
SET('a','b'), input" a "still yields bitmap 1, but real conversion changes from ~60 ns/16 B/1 allocation to ~913 ns/688 B/15 allocations per field. The new inline comment contains the base/head experiment and repair direction. This is a new local conversion regression; no whole-LOAD, TP or prepared-latency multiplier is claimed.
Design: keeping logical SET out of physical-uint64 normalization, preserving declared ENUM members, and retaining explicit NULL/null-map priority are appropriate. The external reader owns field normalization; the existing type parser owns member/bitmap semantics. The new SET guard should align with the transformation's full domain and avoid creating errors merely to answer a membership question. No new state machine, storage or execution path is warranted. No separate architecture document is needed for this focused fix.
Previous comments: the first three findings (SET numeric rewrite, ENUM whitespace, empty-ENUM allocation) remain fixed/resolved. The fourth SET whitespace finding is only partially fixed: its ASCII witness now passes, but the Unicode witness above does not. Keep that thread open.
Validation and test quality: inspected all six changed files and their actual reader/cast/parser consumers. Reused exact-head CI run 38141361383: the compose artifact explicitly runs the changed SQL case, 39/39 successful, zero failed/ignored/abnormal; the UT checkpoint selects the external package in the successful race stage. The regression's explicit values/ordinals/bitmaps, native INSERT control and SQL-mode restoration are useful, but do not cover these two counterexamples. Fresh public probes use the real embedded server and MySQL frontend, preserve all rows, and fail 12 SET value assertions while adjacent controls pass; exact-base comparison distinguishes historical failure from new regression. Small requested-parallel fixtures do not establish split-file/multiworker coverage. Parquet SET remains outside the agreed scope.
Increment reviewed: implementation +50/-4; Go tests +186; SQL case +50, expected output +98, fixtures +12; documentation 0. The recovery fixture repair is now in the base and is not counted in this PR. No production changes or subagents were used in this review. Disclosure: I contributed to an earlier repair round; this is follow-up review with fresh probes, not independent third-party certification.
aunjgr
left a comment
There was a problem hiding this comment.
APPROVE at ebf1975 against base f09d478. No confirmed blocker.
Reviewed the six-file LOAD change. Logical SET is recognized before numeric empty-to-zero and LOCAL prefix rewriting; a declared ENUM/valid padded SET input is preserved before trimming. Explicit NULL markers and NULLIF mappings retain precedence. Conversion stays with the existing ENUM/SET parsers, and undeclared empty ENUM input keeps the prior NULL behavior. The membership predicate avoids allocating discarded conversion errors on the ordinary path.
Tests use exact ordinals/bitmaps, whitespace and member0 controls, NULL/NULLIF and INSERT-versus-LOAD comparisons across CSV/JSONLINE, LOCAL and requested parallel modes, with saved/restored SQL mode and teardown. Requested parallel on small fixtures is not counted as split-reader validation. Current-head required CI, UT/SCA/coverage and proxy/pessimistic BVT are green; author normal/race/public39/39 evidence was reused, not rerun locally. Diff whitespace checks pass. Single-empty-member type-domain admission and Parquet SET behavior are not claimed by this fix.
Address review on matrixorigin#29854: - isPaddedSetInput now checks the boundary runes with unicode.IsSpace, the same whitespace domain strings.TrimSpace removes, so declared members such as '\u00a0a', '\u3000a' and 'a\u00a0' are not trimmed into 'a'. - Membership is answered by the new non-throwing types.MatchSetName (same descriptor/parseName as ParseSet) instead of ParseSet+discarded moerr; parseName walks items with strings.Cut so it does not allocate. - UT: Unicode SET block across strict/parallel/local-nonstrict, padded accepted/fallback inputs in the zero-alloc guard. SQL case: NBSP/U+3000 members (rows 7-10) for INSERT vs CSV/JSONLINE LOAD modes.
|
@XuPeng-SH both P2s from review 5483691319 are addressed in c75a281 (details in the two threads): the SET preservation guard now covers Unicode whitespace like TrimSpace, and padded input is matched without building errors (padded fallback 688 B / 15 allocs -> 0 B / 0 allocs). Case 39/39 (previous head 32/39), load_data 1289/0 failed, dtype 7712/0 failed. Could you take another look? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep follow-up review of c75a281a08c34e1e9e4614993195a94f365198d4 against merge-base f09d4788fd4d1aa30aae0e2f49d014589e7566c0: APPROVE. Both remaining P2 findings are closed, and the earlier three fixes remain intact.
Design: logical SET is classified before physical uint64 normalization, explicit NULL/NullMap retains priority, and declared ENUM/SET members are preserved before lossy trimming. The padding guard now covers exactly unicode.IsSpace, including NBSP and ideographic boundaries. Recognition delegates to the existing SET descriptor/parseName owner via MatchSetName; it neither duplicates the parser/cache nor constructs a discarded conversion error. The strings.Cut traversal preserves Split's item boundaries (including empty/trailing items) while removing its temporary slice. Numeric fallback, invalid bitmap checks and case/trailing-ASCII normalization remain owned by ParseSet. This is a focused behavior repair, not a new lifecycle or architecture requiring a separate design.
Fresh local evidence: reran the previous real embedded-cluster/MySQL-frontend counterexample unchanged on this exact head. CSV, requested-parallel CSV, JSONLINE and requested-parallel JSONLINE now all match independently inserted values for six ASCII/Unicode boundary members, with exact ENUM ordinals and SET bitmaps. All four subcases pass (test body 8.50s; package 11.161s), with ordinary cleanup completing. The same probe's previously recorded exact-base failures remain valid counterfactual evidence; no claim that these historical wrong results were introduced by this PR. Focused external/types tests pass, including empty/NULL/mapped-NULL and three LOAD modes.
Performance closure: reused the exact real getColData benchmark with a reused vector and bitmap/NULL oracle, three 300ms samples. Both unpadded a and accepted padded fallback a now report 0 B/op, 0 allocs/op. The previous head's padded path was 688 B/op/15 allocations; the discarded-error regression is gone. Timing samples are not used to claim end-to-end LOAD or TP speedup. An extra nonthrowing lookup remains only for padded SET input and buys preservation of otherwise lossy valid members; no new cache or per-row error object is warranted or present.
Public regression evidence: exact-head successful CI run 38158699646, pessimistic BVT execution artifact selects issue_29840_load_empty_enum_set.sql: 39/39, zero failed/ignored/abnormal. Read all SQL/resource/result additions: exact labels/ordinals/bitmaps, NULLIF precedence, five LOAD variants and SQL-mode restoration are meaningful oracles. The explicit row readbacks also protect cardinality beyond the inner-join parity count. Small fixtures establish requested-mode semantics, not split-reader execution; no Parquet SET claim.
Accounting: implementation 2 files +74/-6; Go tests 1 file +206/-0; SQL/results/resources 4 files +197/-0; documentation 0. All changed hunks and direct parser/loader consumers reviewed. No production edits or subagents.
Merge Queue Status
This pull request spent 3 minutes 23 seconds in the queue, with no time running CI. ReasonPull request #29854 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #29840
Fixes #29840
What this PR does / why we need it:
CSV/JSONLINE LOAD preserves valid empty SET and declared empty/whitespace ENUM members while explicit NULL markers and NULLIF mappings still win. Logical SET is identified before numeric empty-to-zero or LOCAL numeric-prefix normalization; declared ENUM members survive trimming. The loader membership predicate avoids allocating discarded conversion errors and leaves value conversion to the existing type parser.
Tests compare INSERT with CSV/JSONLINE, requested parallel and LOCAL modes, exact ENUM ordinals and SET bitmaps, explicit NULL and NULLIF mapping. SQL mode is saved/restored. A separate test-only commit starts
TestCrossTargetUpgradeRecovery's five-minute SQL budget after initial successful cluster startup, avoiding expiry while waiting for fixture admission. Cleanup remains registered before construction/start assertions, and restarts share one recovery budget.Validation
Full external normal/race tests; incremental external/embed SCA; all four cross-target recovery scenarios in normal, race and coverage modes; public LOAD comparison: 39/39, zero ignored/failed/abnormal. All four recovery subcases pass in normal (109.93s), race (110.5s) and coverage (87.53s) runs. Requested parallel on small fixtures does not establish split-reader execution; no Parquet SET claim.
Rebased onto main
42d42546fd2c2b2449cb81cea47f81d300139753(the requested base snapshot). Current GitHub CI is reported separately from local validation.