-
Notifications
You must be signed in to change notification settings - Fork 5k
enh: interp supports using non-null prev/next values to fill #34220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.0
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Tony2h, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a key enhancement to the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant enhancement to the INTERP function, allowing it to use non-null previous/next values for filling, controlled by the ignore_null_values parameter. This is a valuable feature for time-series interpolation. The changes are extensive, touching documentation, messaging, the execution engine, and storage, and also include a new notification mechanism to optimize scans. The implementation is mostly solid, with good additions of test cases. I've found a few minor issues in the documentation and a potential memory leak in the executor logic that should be addressed.
| if (pNotify->paramType != HYBRID_TYPE_SCAN_PARAM) { | ||
| pOperator->pOperatorGetParam = NULL; | ||
| } |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| - `RANGE('2023-10-01T00:00:00.000', '2023-10-01T23:59:59.999', 1h)` | ||
| - EVERY: Time interval range, with every_val being a positive value and precision options of 1n, 1u, 1a, 1s, 1m, 1h, 1d, and 1w, such as EVERY (1s). | ||
| - FILL: Types can be selected as NONE (unfilled), VALUE (filled with specified value), PREV (previous non NULL value), NEXT (next non NULL value), NEAR (nearest non NULL value before and after). | ||
| - FILL: Types can be selected as NONE (unfilled), VALUE (filled with specified value), PREV (previous valid value), NEXT (next valid value), NEAR (nearest valid value before and after), LINEAR (linear interpolation). Note: whether a NULL value is considered valid data depends on the ignore_null_values parameter of the interp function. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| - The output time range for INTERP is specified by the RANGE(timestamp1, timestamp2) field, which must satisfy timestamp1 \<= timestamp2. Here, timestamp1 is the start value of the output time range, i.e., if the conditions for interpolation are met at timestamp1, then timestamp1 is the first record output, and timestamp2 is the end value of the output time range, i.e., the timestamp of the last record output cannot be greater than timestamp2. | ||
| - INTERP determines the number of results within the output time range based on the EVERY(time_unit) field, starting from timestamp1 and interpolating at fixed intervals of time (time_unit value), where time_unit can be time units: 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), 1w (weeks). For example, EVERY(500a) will interpolate the specified data every 500 milliseconds. | ||
| - INTERP determines how to interpolate at each time point that meets the output conditions based on the FILL field. For how to use the FILL clause, refer to [FILL Clause](../time-series-extensions/) | ||
| - INTERP determines how to interpolate at each time point that meets the output conditions based on the FILL field. For how to use the FILL clause, refer to [FILL Clause](../time-series-extensions/). Note: The sampled data used for interpolation is not limited to the constraints of the RANGE field, but rather to all data that meets the conditions of the WHERE clause; if no WHERE clause is specified, the entire table data is used. When the parameter of the FILL clause is PREV/NEXT/NEAR, adjacent valid data will be used for interpolation. Whether NULL data is considered valid data depends on the ignore_null_values parameter of the INTERP function. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the INTERP function to support using non-null previous/next values for filling. The key improvement is that when ignore_null_values parameter is set to 1, the fill operations (PREV/NEXT/NEAR/LINEAR) will skip NULL values and continue searching for non-NULL data points.
Key changes:
- Added notification mechanism for table scan operators to mark scanning steps as done
- Enhanced timeslice operator to handle ignoring NULL values during interpolation
- Added extensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/cases/09-DataQuerying/12-Interp/test_query_interp_fill.py | Added comprehensive test cases for interp fill with non-null values |
| test/cases/09-DataQuerying/12-Interp/in/interp_fill_ignore_null.in | Test input SQL statements for various fill scenarios |
| test/cases/09-DataQuerying/12-Interp/ans/interp_fill_ignore_null.csv | Expected test results |
| source/libs/executor/src/timesliceoperator.c | Core implementation of non-null value filling logic and notification mechanism |
| source/libs/executor/src/scanoperator.c | Added prepareTableScan to handle step done notifications |
| source/libs/executor/src/exchangeoperator.c | Enhanced to support notification parameters |
| source/dnode/vnode/src/tsdb/tsdbRead2.c | Enhanced reader to support step completion tracking |
| source/common/src/msg/tmsg.c | Updated message serialization for new parameter types |
| docs/* | Updated documentation in Chinese and English |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
13f9bf5 to
e243d2e
Compare
| TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pScan->type)); | ||
| TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pScan->dynType)); | ||
|
|
||
| // notify info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里 notify 和 DYN_TYPE_SCAN_PARAM 参数能否共存?如果不能就各自序列化各自的,如果能paramType 的定义支持不了
| return code; | ||
| } | ||
|
|
||
| int32_t notifyTableScanTask(qTaskInfo_t tinfo, TSKEY notifyTs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数是不是没用了?没看到调用的地方
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.