Skip to content

feat: add StructLikeSet#598

Open
wgtmac wants to merge 2 commits intoapache:mainfrom
wgtmac:struct_like_set
Open

feat: add StructLikeSet#598
wgtmac wants to merge 2 commits intoapache:mainfrom
wgtmac:struct_like_set

Conversation

@wgtmac
Copy link
Member

@wgtmac wgtmac commented Mar 23, 2026

Adds StructLikeSet, a hash set for StructLike rows backed by an internal arena allocator.

Key design points:

  • Deep-copies inserted rows into a monotonic_buffer_resource arena; string data and nested struct/list/map scalars are fully materialized so the set owns its memory independently of the caller
  • Transparent heterogeneous lookup: Contains() does not allocate a temporary key
  • Hash and equality semantics match the Java reference implementation (String.hashCode, StructLikeHash, ListHash; float/double use canonical NaN bits and distinguish ±0.0)
  • Schema validation (field count + scalar type) on Insert/Contains; can be disabled via kValidate=false (UncheckedStructLikeSet) when the caller guarantees conformance
  • Internal Arena wrapper containers use std::pmr::vector

Adds StructLikeSet<bool kValidate = true>, a hash set for StructLike
rows backed by an internal arena allocator.

Key design points:
- Deep-copies inserted rows into a monotonic_buffer_resource arena;
  string data and nested struct/list/map scalars are fully materialized
  so the set owns its memory independently of the caller
- Transparent heterogeneous lookup: Contains() does not allocate a
  temporary key
- Hash and equality semantics match the Java reference implementation
  (String.hashCode, StructLikeHash, ListHash; float/double use
  canonical NaN bits and distinguish ±0.0)
- Schema validation (field count + scalar type) on Insert/Contains;
  can be disabled via kValidate=false (UncheckedStructLikeSet) when
  the caller guarantees conformance
- Internal Arena wrapper containers use std::pmr::vector
@wgtmac wgtmac force-pushed the struct_like_set branch 3 times, most recently from 78b5c16 to 589b7f0 Compare March 24, 2026 04:05
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