Skip to content

fix time column seeking for time ordered projections#17711

Merged
clintropolis merged 1 commit intoapache:masterfrom
clintropolis:fix-projections-time-inspector
Feb 12, 2025
Merged

fix time column seeking for time ordered projections#17711
clintropolis merged 1 commit intoapache:masterfrom
clintropolis:fix-projections-time-inspector

Conversation

@clintropolis
Copy link
Copy Markdown
Member

Description

Fixes a bug in time ordered projections resulting from #17397. The changes in that PR resulted in a QueryableIndexCursorHolder of a projection using a QueryableIndexTimeBoundaryInspector that was pointing to the base table __time column instead of the projections time column, which could result in seeking to the incorrect the starting offset when the time column of a projection is transformed due to the code checking the time column against the 'start' timestamp of the base table instead of the projection table.

For example, imagine we have a base table which has a first row with a __time value of 2025-02-10T00:01:01Z or whatever, and a time ordered projection exists which does TIME_FLOOR(__time, 'PT1H'), so the first value of the projection time column would be 2025-02-10T00:00:00Z. The seek logic in the asCursor method of QueryableIndexCursorHolder would be reading 2025-02-10T00:00:00Z from the projection time column, but moving the offset ahead checking for a value greater than or equal to 2025-02-10T00:01:01Z which it got from the QueryableIndexTimeBoundaryInspector of the base table, instead of the correct value it would have from using an inspector of the projection. As a result, the offset is moved forward until the row with next granularity bucket that is larger than __time.

Existing tests missed this because the test data starting timestamp lined up evenly with the granularity buckets, so the first row of the __time column was always identical to the first row of projection time columns, so added a new one that targets this scenario specifically and fails without the change to make the projection cursor holder use a projection time boundary inspector.

@clintropolis clintropolis merged commit af1ad90 into apache:master Feb 12, 2025
@clintropolis clintropolis deleted the fix-projections-time-inspector branch February 12, 2025 03:06
@kgyrtkirk kgyrtkirk added this to the 33.0.0 milestone Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants