feat: add cost model framework with deref/array support#84
Merged
JohannesLichtenberger merged 2 commits intomasterfrom Jan 29, 2026
Merged
feat: add cost model framework with deref/array support#84JohannesLichtenberger merged 2 commits intomasterfrom
JohannesLichtenberger merged 2 commits intomasterfrom
Conversation
added 2 commits
January 25, 2026 23:33
Implement a cost model framework for query optimization with support for JSON/JSONiq-specific operations. Components: - CostModel interface with cost estimation and comparison methods - OperatorContext for HFT-style zero-allocation context passing - SimpleCostModel with calibrated cost factors for: - Basic operations: scan, selection, join, sort, group-by - Deref operations: field navigation with depth-based costing - Array operations: access, unboxing, slicing costs Design principles: - ThreadLocal pooling for OperatorContext (no allocation in hot paths) - Primitive fields to avoid boxing overhead - Configurable cost factors via system properties - Cost clamping for robustness (NaN, infinity, negative) Includes comprehensive unit tests for all cost estimation methods.
- Convert SimpleCostModelTest from JUnit 5 to JUnit 4 (project uses JUnit 4) - Fix test pattern for ThreadLocal pooling: compute costs immediately after configuring context since acquire() returns same pooled instance - Fix bug in OperatorContext.forArrayAccess: isArrayAccess should be false for single access, true for full unboxing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement a cost model framework for query optimization with support for JSON/JSONiq-specific operations.
Components:
Design principles:
Includes comprehensive unit tests for all cost estimation methods.