fix(stream): tolerate existing output table on submit;fix stream out-column timestamp precision checks#35044
Conversation
…ut-column precision checks
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
This PR fixes stream creation/insertion behavior when the output table already exists (notably with NODELAY_CREATE_SUBTABLE) and refines CREATE STREAM output-table column validation to handle timestamp/decimal precision more correctly.
Changes:
- Treat
TSDB_CODE_TDB_TABLE_ALREADY_EXISTas a non-fatal result for the embedded output-table create step during stream submit. - Adjust
CREATE STREAMout-table column validation: timestamp precision is checked against table time precision; decimal columns still require matching precision; other types no longer fail purely on precision mismatch. - Extend stream processing tests to cover auto-creating output normal tables and writing into a pre-created normal output table.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/cases/18-StreamProcessing/99-Others/test_auto_create_output_table.py |
Adds coverage for NODELAY_CREATE_SUBTABLE streams writing into newly-created and pre-created normal output tables. |
source/libs/parser/src/parTranslater.c |
Refines output-column compatibility checks for streams (timestamp precision vs table precision; decimal precision enforcement). |
source/libs/executor/src/dataInserter.c |
Allows “table already exists” responses during embedded create to be treated as success for stream submit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,3 +1,4 @@ | |||
| import time | |||
| from new_test_framework.utils import tdSql, tdLog, tdStream, StreamItem | |||
There was a problem hiding this comment.
StreamItem is imported from new_test_framework.utils but never used (the test uses the nested self.StreamItem class instead). This also creates a confusing name collision between the imported symbol and the nested class; consider removing the import or renaming the nested helper class to avoid shadowing.
| from new_test_framework.utils import tdSql, tdLog, tdStream, StreamItem | |
| from new_test_framework.utils import tdSql, tdLog, tdStream |
| tdSql.execute("insert into tb1 values ('2025-01-01 00:00:02', 10003);") | ||
| time.sleep(5) | ||
|
|
There was a problem hiding this comment.
The explicit time.sleep(5) makes the test slower and can still be flaky. Since tdSql.checkResultsByFunc already retries/polls (up to 300s by default), it should be sufficient to rely on that retry loop (or pass its delay/retry params) instead of a fixed sleep.
|
|
||
| tdSql.execute("insert into tb1 values ('2025-01-01 00:00:02', 10003);") | ||
| time.sleep(5) | ||
|
|
There was a problem hiding this comment.
tdSql.checkResultsByFunc() 已经会轮询重试最多 300 次,所以这里再写死一个 time.sleep(5) 只会增加测试耗时,不会让断言更可靠。更干净的做法是删掉这个 sleep,直接依赖现有轮询;如果确实要调等待行为,就显式传 delay/retry 给 checkResultsByFunc()。
|
代码审查更正: 当前仍然成立的问题只有 1 个:
|
…column timestamp precision checks (#35044)
…column timestamp precision checks (#35044)
…ut-column precision checks
Description
Fixes stream writes to pre-created normal output tables when NODELAY_CREATE_SUBTABLE is used: the vnode can return TSDB_CODE_TDB_TABLE_ALREADY_EXIST for the embedded create step, which must be treated as success on the client. Also adjusts CREATE STREAM validation so timestamp precision is checked against the table time precision, and decimal columns still require matching precision; other types are no longer rejected solely on column-level precision mismatch.
Issue(s)
https://project.feishu.cn/taosdata_td/defect/detail/6931571628
Checklist
Please check the items in the checklist if applicable.