fix: polygon filtered index per layer, instead of per dataset#3452
Open
igorDykhta wants to merge 2 commits into
Open
fix: polygon filtered index per layer, instead of per dataset#3452igorDykhta wants to merge 2 commits into
igorDykhta wants to merge 2 commits into
Conversation
Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes polygon filtering behavior so that polygon filters are applied per-layer rather than at the shared dataset level, preventing unintended cross-layer filtering when multiple layers share a dataset (and avoiding the prior “AND across layers” behavior when multiple layers are selected).
Changes:
- Excludes polygon filters from the dataset-level CPU filter pipeline so
dataset.filteredIndexis no longer impacted by polygon filtering. - Adds
filteredIndexByLayerto datasets and computes per-layer polygon-filtered indices inKeplerTable.filterTable. - Updates layer data/update triggers to use the per-layer filtered index when present, and adjusts unit tests/helpers accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/node/reducers/vis-state-test.js | Updates polygon filter tests to assert per-layer filtering and unchanged dataset filteredIndex. |
| test/helpers/comparison-utils.js | Adjusts dataset comparisons to optionally ignore the new internal filteredIndexByLayer field. |
| src/utils/src/filter-utils.ts | Removes polygon filters from dataset CPU filtering via getFilterRecord while keeping them tracked in the record. |
| src/table/src/kepler-table.ts | Introduces filteredIndexByLayer and computes per-layer polygon-filtered indices during dataset filtering. |
| src/layers/src/mapboxgl-layer.ts | Uses per-layer filtered index for update triggers / data building in Mapbox GL layer. |
| src/layers/src/base-layer.ts | Uses per-layer filtered index when updating meta and calculating data attributes for a layer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Compute per-layer filtered indices for polygon filters. | ||
| * Polygon filters are layer-specific: they should only affect the layers listed in filter.layerId. | ||
| * For each layer on this dataset, compute a filtered index that applies only the polygon filters | ||
| * targeting that specific layer (using OR logic when multiple layers on the same dataset are selected). |
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.
For #3277
Polygon filters were applied at the dataset level, modifying a shared filteredIndex that ALL layers on that dataset use. When two layers (e.g., "pickup" and "dropoff") share the same dataset:
Polygon filtering was moved from the dataset level to a per-layer level: