- Notifications
You must be signed in to change notification settings - Fork5k
test: add test case#33759
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 ourterms of service andprivacy 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?
test: add test case#33759
Conversation
Summary of ChangesHello@facetosea, 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 significantly enhances the test coverage for several time-series window functions, including Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on ourdocumentation 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 uphere. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with theGemini 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 enables window queries without requiring aggregate functions, a valuable feature enhancement. The core logic change inparTranslater.c is well-supported by a comprehensive suite of new test cases for various window types.
My review primarily focuses on improving code maintainability and style. I've suggested removing commented-out code in the C source file. For the Python test files, my recommendations include removing unused variables, adopting more idiomatic Python loops, ensuring consistent SQL query formatting, and refactoring duplicated test logic to improve readability and ease of maintenance.
Overall, the changes are solid and the tests are thorough. Addressing these minor points will further enhance the quality of the codebase.
| //if (NULL != pSelect->pWindow && !pSelect->hasAggFuncs && !pSelect->hasStateKey) { | ||
| // return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN); | ||
| //} |
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.
| mtPrefix="m_in_mt" | ||
| tbNum=10 | ||
| rowNum=20 | ||
| totalNum=200 |
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.
| i=0 | ||
| whilei<tbNum: | ||
| tb=tbPrefix+str(i) | ||
| tdSql.execute(f"create table{tb} using{mt} tags({i} )") | ||
| x=0 | ||
| whilex<rowNum: | ||
| cc=x*60000 | ||
| ms=1601481600000+cc | ||
| tdSql.execute(f"insert into{tb} values ({ms} ,{x} )") | ||
| x=x+1 | ||
| i=i+1 |
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.
For better readability and to follow Python best practices, thesewhile loops with manual incrementing can be replaced withfor loops usingrange().
| i=0 | |
| whilei<tbNum: | |
| tb=tbPrefix+str(i) | |
| tdSql.execute(f"create table{tb} using{mt} tags({i} )") | |
| x=0 | |
| whilex<rowNum: | |
| cc=x*60000 | |
| ms=1601481600000+cc | |
| tdSql.execute(f"insert into{tb} values ({ms} ,{x} )") | |
| x=x+1 | |
| i=i+1 | |
| foriinrange(tbNum): | |
| tb=tbPrefix+str(i) | |
| tdSql.execute(f"create table{tb} using{mt} tags({i} )") | |
| forxinrange(rowNum): | |
| cc=x*60000 | |
| ms=1601481600000+cc | |
| tdSql.execute(f"insert into{tb} values ({ms} ,{x} )") |
| sql="select _wstart, 1, tgcol, count(tbcol) from m_in_mt0 partition by tbname interval(5m);" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(40) | ||
| sql="select _wstart, _wend, tbname, 1, tgcol, count(tbcol) from m_in_mt0 partition by tbname interval(5m);" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(40) | ||
| sql="select _wstart, tbcol, tbname, 1, tgcol, count(tbcol) from m_in_mt0 partition by tbname interval(5m);" | ||
| tdSql.error(sql) | ||
| sql="select _wstart, ts, tbname, 1, tgcol, count(tbcol) from m_in_mt0 partition by tbname interval(5m);" | ||
| tdSql.error(sql) |
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.
| tdSql.checkData(3,0,"2025-09-01 10:00:10.001") | ||
| tdSql.checkData(3,1,2999) | ||
| tdSql.checkData(3,2,"2025-09-01 10:00:13.000") | ||
| tdSql.checkData(3,3,"b") |
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.
| tdSql.checkData(0,3,'xx') | ||
| tdLog.info(f"======== test_event successfully executed") | ||
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.
| sql="select _wstart, _wend, 1, count(*) from dev_001 session(ts,1d)" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(4) | ||
| tdSql.checkData(0,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(0,1,"2020-05-14 13:00:00.001") | ||
| tdSql.checkData(0,2,1) | ||
| tdSql.checkData(0,3,13) | ||
| tdSql.checkData(1,0,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,1,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,2,1) | ||
| tdSql.checkData(2,0,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,1,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,2,1) | ||
| tdSql.checkData(3,0,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,1,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,2,1) | ||
| sql="select _wstart, _wend, 1 from dev_001 session(ts,1d)" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(4) | ||
| tdSql.checkData(0,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(0,1,"2020-05-14 13:00:00.001") | ||
| tdSql.checkData(0,2,1) | ||
| tdSql.checkData(1,0,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,1,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,2,1) | ||
| tdSql.checkData(2,0,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,1,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,2,1) | ||
| tdSql.checkData(3,0,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,1,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,2,1) |
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.
| sql="select _wstart, _wend, 1, tbname, count(*) from st partition by tbname session(ts,1d) order by tbname;" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(5) | ||
| tdSql.checkData(0,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(0,1,"2020-05-14 13:00:00.001") | ||
| tdSql.checkData(0,2,1) | ||
| tdSql.checkData(0,3,"dev_001") | ||
| tdSql.checkData(1,0,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,1,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,2,1) | ||
| tdSql.checkData(1,3,"dev_001") | ||
| tdSql.checkData(2,0,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,1,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,2,1) | ||
| tdSql.checkData(2,3,"dev_001") | ||
| tdSql.checkData(3,0,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,1,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,2,1) | ||
| tdSql.checkData(3,3,"dev_001") | ||
| tdSql.checkData(4,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(4,1,"2020-05-13 10:00:00.510") | ||
| tdSql.checkData(4,2,1) | ||
| tdSql.checkData(4,3,"dev_002") | ||
| sql="select _wstart, _wend, 1, tbname from st partition by tbname session(ts,1d) order by tbname;" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(5) | ||
| tdSql.checkData(0,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(0,1,"2020-05-14 13:00:00.001") | ||
| tdSql.checkData(0,2,1) | ||
| tdSql.checkData(0,3,"dev_001") | ||
| tdSql.checkData(1,0,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,1,"2020-05-15 14:00:00.000") | ||
| tdSql.checkData(1,2,1) | ||
| tdSql.checkData(1,3,"dev_001") | ||
| tdSql.checkData(2,0,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,1,"2020-05-20 10:00:00.000") | ||
| tdSql.checkData(2,2,1) | ||
| tdSql.checkData(2,3,"dev_001") | ||
| tdSql.checkData(3,0,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,1,"2020-05-27 10:00:00.001") | ||
| tdSql.checkData(3,2,1) | ||
| tdSql.checkData(3,3,"dev_001") | ||
| tdSql.checkData(4,0,"2020-05-13 10:00:00.000") | ||
| tdSql.checkData(4,1,"2020-05-13 10:00:00.510") | ||
| tdSql.checkData(4,2,1) | ||
| tdSql.checkData(4,3,"dev_002") |
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.
| sql=f"select _wstart, 1, ta, tb, tc, tbname from t1 partition by tbname count_window(2) slimit 2 limit 2;" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(2) | ||
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.
| sql=f"select _wstart, 1, ta, tb, tc, tbname from t1 count_window(2) slimit 2 limit 2;" | ||
| tdSql.error(sql) | ||
| sql=f"select _wstart, 1, ta, tb, tc, count(*), tbname from t1 count_window(2) slimit 2 limit 2;" | ||
| tdSql.error(sql) | ||
| sql=f"select _wstart, 1 from t1 count_window(2);" | ||
| tdSql.query(sql) | ||
| tdSql.checkRows(3) | ||
| sql=f"select _wstart, 1, count(*) from t1 count_window(2);" | ||
| tdSql.query(sql) |
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
Please briefly describe the code changes in this pull request.
Jira:https://jira.taosdata.com:18080/browse/TD-
Checklist
Please check the items in the checklist if applicable.