optimisation: replace per-module row copying with shared map enrichment#149
Merged
optimisation: replace per-module row copying with shared map enrichment#149
Conversation
Each enrichment module previously created a new Row (copying all column values) for every update. With 6 modules and a 108-column schema, this meant 6 full array copies per input row. The new approach has modules read/write enrichment values via a shared Map<Column, Object>, with a single Row materialised at the end of the pipeline (~4.4x speedup). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
Author
|
In practice this does not make a huge difference. Tried both locally and on EMR 0.8 this PR "totalResourceUtilization": { The question of whether it should be adopted is then primarily about whether it makes things cleaner conceptually and nicer code. |
…added utility method to SPRUCEcolumns Signed-off-by: Julien Nioche <julien@digitalpebble.com>
Signed-off-by: Julien Nioche <julien@digitalpebble.com>
jnioche
added a commit
that referenced
this pull request
Feb 21, 2026
Signed-off-by: Julien Nioche <julien@digitalpebble.com>
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.
Summary
Map<Column, Object>— modules now read CUR columns from the immutable original Row and read/write Spruce enrichment columnsvia a shared map. A single
GenericRowWithSchemais materialised at the end of the pipeline instead of one per module.EnrichmentStrategyBenchmark.java.Row process(Row)replaced byvoid enrich(Row inputRow, Map<Column, Object> enrichedValues). All 11 modules and 14 test classes updated. 112 testspass.
Changes
EnrichmentModule.javaprocess()and static helpers (withUpdatedValue,withUpdatedValues); addedenrich(Row, Map)EnrichmentPipeline.javaHashMapper row, callsenrich()on each module, materialises single Row at endmodules/enrich(row, map)pattern; assertions check map contentsEnrichmentStrategyBenchmark.javaHow it works
Before (N row copies per input row)