Skip to content

test: pin variant literal set edge cases - #2139

Merged
laskoviymishka merged 1 commit into
apache:mainfrom
Revanth14:test/variant-literal-set-followups
Oct 7, 2026
Merged

laskoviymishka merged 1 commit into
apache:mainfrom
Revanth14:test/variant-literal-set-followups

Conversation

@Revanth14

Copy link
Copy Markdown
Contributor

Follow-up to #2097, addressing the nits

Changes

  • Length-prefix test (literal_set_internal_test.go): adds a case with two distinct variants whose metadata and value bytes concatenate to the same sequence, using @zeroshade's example (metadata accepts trailing bytes). addliteral overwrites on a key match without calling Equals, so the length prefix in variantKey is what keeps both members. Previously no test failed if the prefix was removed; this one does (1 member instead of 2).
  • variantKey comment (utils.go): states that it must hash exactly what VariantLiteral.Equals compares, why the length prefix matters for correctness, and that a genuine 64-bit collision still drops the earlier member, as for Binary, Fixed, and Geo.
  • Subtest rename (exprs_test.go): now bind to variant column keeps distinct members, and the ErrType assertion stays. With two distinct values, ErrType is only reachable if the bind-time set still holds both. If they collapsed to one, binding would take the single-literal path and fail with ErrInvalidArgument (I checked this).
  • Test helpers: the build closures captured the parent t, so a failure inside a subtest produced subtest may have called FailNow on a parent test. They now use helpers that take the subtest's t: the existing variantLiteralOf, and a small wrapper over the existing scalarVariant.

Validation

gofmt, go vet ., and go test -race . pass.

@Revanth14
Revanth14 requested a review from zeroshade as a code owner October 7, 2026 00:39

@laskoviymishka laskoviymishka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@laskoviymishka
laskoviymishka merged commit ace9bf7 into apache:main Oct 7, 2026
15 checks passed
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.

2 participants