Replies: 1 comment 2 replies
-
|
@LeiRui Thanks for the proposal. However, operator is the core part of Bolt compute engine itself so blackbox-like Are you open to create a pull request containing the source code of SVE-optimized version of |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Enhancing Extensibility for subOp-style Plugin Optimizations
Hi Bolt community!
We're working on ARM SVE optimizations for Hash Aggregation and would like to discuss with the community about enhancing Bolt's extensibility to better support plugin-based optimizations. We've implemented a Hash Aggregation subOp (part of our broader "subOp" plugin framework) that extends Velox-style hash aggregation with SVE vectorization. We're exploring opportunities to work more closely with the Bolt community, and we hope both sides could benefit from enhanced extensibility that enables plugin-based optimizations.
1 Background
1.1 What We've Built: Hash Aggregation subOp
.solibrary) and uses runtime operator replacement via the adapter pattern: we register aDriverAdapterthat intercepts query plan execution and replacesHashAggregationoperators with ourEnhancedHashAggregationimplementation.1.2 The Challenge We Face
To implement our SVE optimizations, we need to:
prepareForGroupProbefor deciding hash table mode and computing hashes, probe methods likearrayGroupProbethat haven't been optimized with SVE yet)Our optimization granularity creates a challenge:
1.3 Why Plugin Architecture?
We chose a plugin architecture (similar to Velox's Cudf adapter pattern) because it:
Why not directly modify core code? Because our optimizations involve:
Direct inline modifications would require substantial changes across multiple layers, mix experimental optimizations with stable core code, and require maintainers to review architecture-specific code they may not use.
2 Current Challenge: Code Duplication
However, unlike Cudf (which replaces entire operators independently), our subOp needs to partially reuse core infrastructure. Currently, because many critical members are
private, we've had to duplicate ~5000+ lines of code to access the infrastructure we need to reuse. This creates high maintenance burden, duplicates bug fixes, and makes upgrades difficult. Specifically, we replaces the entire call chain:EnhancedHashAggregation→EnhancedGroupingSet→EnhancedHashTable→EnhancedAggregate, where we replace core algorithms (group probing, aggregate updates) with SVE-optimized versions while reusing surrounding infrastructure.Example: Our SVE-optimized group probing algorithm may require different hash table layout/sizing, so we need to customize
allocateTables(). If we inheritHashTableand overridesetHashMode(virtual), we can call our customizedcheckSize(private) →allocateTables(private) → finally needs to modifycapacity_,numBuckets_, etc (all private). We can't modify these private members ofHashTable, so we'd maintain our own copies, leading to two sets of state that get out of sync. This is why we currently duplicate code instead of inheritHashTable.3 Our Thinking and Questions
We're exploring whether Bolt could make small changes to its core code to enable third-party plugins to reuse Bolt code through inheritance, rather than duplicating it.
Preliminary approaches we're considering:
privatemembers toprotected(e.g.,HashAggregation::groupingSet_,GroupingSet::table_,HashTable::capacity_,HashTable::numBuckets_)privatemethods toprotected virtual(e.g.,HashTable::checkSize(),HashTable::allocateTables()) to allow derived classes to customize behavior when neededprotected virtualfactory methods to allow derived classes to customize component creation (e.g.,HashAggregation::createGroupingSet(),GroupingSet::createHashTable())We're not proposing a fully-baked solution yet - we'd like to understand the community's perspective and constraints first, then work together to find the best approach that fits Bolt's design philosophy. For example, are there concerns about changing
privatetoprotected(encapsulation, API stability)? Are there existing patterns in Bolt for similar extension needs?We're committed to actively participating and contributing code. We'd love to hear the community's thoughts!
Beta Was this translation helpful? Give feedback.
All reactions