[IOTDB-17798] Implement table model NEXT fill#17810
Open
DaZuiZui wants to merge 1 commit into
Open
Conversation
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.
Description
Add table-model NEXT fill syntax and planning
This PR implements
FILL METHOD NEXTfor the table model.NEXTfills a null value with the nearest non-null value that appears later in the current operator input order. It directly copies the future value, does not interpolate, and does not search by timestamp order. If no next value exists, the value remains null.The implementation supports:
FILL METHOD NEXTTIME_BOUNDTIME_COLUMNFILL_GROUPPlain
NEXTdoes not require a helper/time column. A helper/time column is only required or inferred whenTIME_BOUNDorFILL_GROUPneeds it.FillPolicy.NEXTis appended after existing enum values to keep existing byte/ordinal compatibility, andTABLE_NEXT_FILL_NODEuses a new plan node type id.Add NEXT fill plan node and optimizer support
This PR adds
NextFillNodeand wires it through serde, plan visitors, plan graph printing, pruning, symbol rewrite, analyzer, and planner logic.For
TIME_BOUNDorFILL_GROUP, the analyzer resolves the required helper/time column similarly toPREVIOUS. For grouped fill, the planner reuses the existing fill-group sorting and grouping-symbol path.PushLimitOffsetIntoTableScantreatsNEXTlikeLINEARand avoids pushing downLIMIT/OFFSET, because NEXT fill may need future rows that would otherwise be removed before filling.Add NEXT fill execution path
This PR adds table NEXT fill operators and the generated fill implementation.
The execution layer reuses
AbstractLinearFillOperatorfor cross-TsBlocklook-ahead caching and grouped slicing. The NEXT fill algorithm scans the current value column from right to left, uses the nearest non-null candidate in the current block when available, and otherwise uses the first non-null candidate found in later cached blocks.For grouped fill, group boundaries reset the next-value state so values are not filled across groups.
Tests
This PR adds and updates tests for:
FILL METHOD NEXTNextFillNodeserdeTIME_BOUNDTIME_COLUMNFILL_GROUPTIME_BOUND + TIME_COLUMN + FILL_GROUPTsBlockfill behaviorLIMITbehavior without losing future next valuesCloses #17798
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
RelationalSql.g4FillPolicyFillAstBuilderStatementAnalyzerAnalysis.NextFillAnalysisQueryPlannerNextFillNodePlanNodeTypeCommonPlanNodeDeserializerICoreQueryPlanVisitorPlanGraphPrinterPruneFillColumnsPushLimitOffsetIntoTableScanUnaliasSymbolReferencesCommonOperatorUtilsTableOperatorGeneratorTableNextFillOperatorTableNextFillWithGroupOperatorfill/next/NextFillnextFill.ftlFillStatementTestNextFillNodeSerdeTestNextFillTestIoTDBFillTableIT