Skip to content

perf: optimize map validation for common key types#20805

Open
lyne7-sc wants to merge 5 commits intoapache:mainfrom
lyne7-sc:pref/map
Open

perf: optimize map validation for common key types#20805
lyne7-sc wants to merge 5 commits intoapache:mainfrom
lyne7-sc:pref/map

Conversation

@lyne7-sc
Copy link
Contributor

@lyne7-sc lyne7-sc commented Mar 8, 2026

Which issue does this PR close?

  • Closes #.

Rationale for this change

This PR optimizes map key validation for common key types.

Previously, map validation always used the generic ScalarValue::try_from_array path, which is more expensive than necessary for common key types such as primitive integers, strings, and binary values.

What changes are included in this PR?

  • specialize map key validation for primitive, string, and binary key types
  • keep the generic fallback for unsupported key types

Are these changes tested?

Yes. current unit tests and slts test passed. benchmark added.

Are there any user-facing changes?

No.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Mar 8, 2026
@lyne7-sc
Copy link
Contributor Author

lyne7-sc commented Mar 8, 2026

Benchmarks:

group                                                main                                   optimized
-----                                                ----                                   ---------
map_1000_binary                                      11.46    75.1±2.47ms        ? ?/sec    1.00      6.6±0.25ms        ? ?/sec
map_1000_int32                                       7.85     32.4±0.61ms        ? ?/sec    1.00      4.1±0.17ms        ? ?/sec
map_1000_utf8                                        9.63     76.0±2.30ms        ? ?/sec    1.00      7.9±0.28ms        ? ?/sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant