TDengine/test/cases/13-StreamProcessing/07-SubQuery/test_subquery_period.py
Pan Wei f0df7a26d7
Feat/ts 6100 3.0.0722m (#32103)
* migrate system-test/2-query

* revert file

* update case.task

* resolve script migrate

* run new test framework on new_testcases

* migrate system-test/2-query

* format docstring

* fix test validation

* fix test validation

* fix error

* migrate army case

* migrate army case

* fix error

* migrate system-test/2-query

* migrate system-test/2-query

* migrate system-test/2-query

* migrate system-test/2-query

* test exe time

* fix ci error

* migrate system-test/1-insert

* new common function

* migrate system-test/1-insert

* fix ci error

* migrate system-test/1-insert

* feat: add configuration and script for memory allocator settings

* fix: correct HEAPPROFILE path and remove redundant metadata_thp setting in memory allocator script

* fix ci error

* migrate system-test/1-insert, 2-query

* feat:insert into subquery (#31401) (#31710)

* migrate system-test/99-TDcase

* feat(gpt): add grant check for gpt. (#31708)

* migrate system-test/99-TDcase

* migrate system-test/99-TDcase

* migrate system-test/99-TDcase

* fix/send-heartbeat-statis (#31680)

* migrate system-test/7-tmq

* chore: support cmake option TAOSWS_GIT_TAG like taosadapter [skip ci] (#31486)

* add system-test/6/cluster test

* chore: move default branch from main to 3.3.6 for adapter/taosws

* fix docstring validation

* migrate system-test/7-tmq

* migrate system-test/7-tmq

* feat: add set_taos_malloc_env configuration and update related scripts

* Update 03-kubernetes.md

* enh: add log for snapshot (#31681)

* simple test

* more

* migrate system-test/7-tmq

* migrate system-test 0-others cases

* migrate system-test/7-tmq

* fix docstring validation

* migrate system-test/7-tmq

* fix docstring validation

* fix: invalid queue

* fix docstring validation

* refactor: reorganize memory allocator script constants and improve mode descriptions

* enh: TD-36324-improve-sync-heartbeat-log (#31727)

* recover log level

* fix: taosd crush in query when insufficient memory (#31746)

Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>

* fix: overflow check in snprintf (#31780)

* migrate system-test/7-tmq

* migrate some cases

* migrate system-test/7-tmq

* fix failed cases

* fix failed cases

* migrate some cases

* fix failed cases

* fix failed cases

* migrate testcases

* fix: update environment file path in taosd.service and adjust set_taos_malloc.sh configuration

* fix: set lcn before do s3 migrate. (#31782)

* migrate testcases

* fix failed cases

* fix: add condition to set default malloc config for taosd service

* fix: update usage message in set_taos_malloc.sh to include quiet mode option

* fix: add quiet mode option to set malloc config in install script

* fix: update set_taos_malloc.sh to improve output messages and adjust default malloc config invocation

* recover log level

* fix(tmq): [TS-6569]tdb error if write tmq meta data in multi thread (#31808)

* fix: the calculation of dnode uptime (#31832)

* migrate testcase

* fix: correct timediff function bug and redress docs (#31798)

* fix: enhance malloc configuration for taosd and taosadapter in install script

* fix: TD-36442 show full condition (#31796)

* enh/TD-36466-sync-heartbeat (#31805)

* fix(plan) virtual table support BI moudle when use in select (#31787)

* fix failed cases

* enh: TS-5926-force-repair-wal (#31828)

* migrate testcase

* rename taos & taosd (#31855)

* migrate testcase

* migrate testcase

* fix failed cases

* fix: update environment file paths in taosd.service and set_taos_malloc.sh

* feat: add performance tuning documentation for memory optimization and set_taos_malloc.sh usage

* fix: update file paths in performance tuning documentation for consistency

* feat: add performance tuning documentation for memory allocator configuration script

* fix: add missing line breaks for improved readability in performance tuning documentation

* fix: adjust heading levels for consistency in performance tuning documentation

* fix cases

* fix new_testcases

* fix failed cases

* fix(query): support show tags on virtual table (#31831)

* fix failed cases

* docs: replace mysql screenshot (#31888)

* feat: use the new TDengine product name (#31859)

* merge 3.0

* fix failed cases

* fix failed cases

* merge 3.0

* fix cases

* fix cases

* doc: Update 03-stream.md (#31675)

* chore(deps): bump requests from 2.27.1 to 2.32.4 in /test (#31326)

Bumps [requests](https://github.com/psf/requests) from 2.27.1 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.27.1...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix new cases

* fix:Convert line endings from LF to CRLF for ans file

* build(deps): bump golang.org/x/net in /tools/keeper (#30811)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump urllib3 from 1.26.20 to 2.5.0 in /test (#31414)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.20 to 2.5.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.20...2.5.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.5.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31392)

Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106.

---
updated-dependencies:
- dependency-name: org.apache.tomcat.embed:tomcat-embed-core
  dependency-version: 9.0.106
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.apache.tomcat.embed:tomcat-embed-core (#31393)

Bumps org.apache.tomcat.embed:tomcat-embed-core from 9.0.104 to 9.0.106.

---
updated-dependencies:
- dependency-name: org.apache.tomcat.embed:tomcat-embed-core
  dependency-version: 9.0.106
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.apache.kafka:kafka-clients (#31341)

Bumps org.apache.kafka:kafka-clients from 3.9.0 to 3.9.1.

---
updated-dependencies:
- dependency-name: org.apache.kafka:kafka-clients
  dependency-version: 3.9.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: add lock when calculating log buffer start/end (#31883)

* fix new cases

* fix new cases

* fix failed cases

* feat: new stream (#31678)

* fix: windows compile issue

* test: add vtable cases (#31829)

* fix: windows compile issues

* test:add test cases

* fix: windows compile issue

* case: em-4 stream case submit

* test: stream4_sub1 found bug2

* test: submit test_scene_meters_bug2.py

* add stream parameters example

* feat: [TS-6100] Do not translate const value as column.

* Feat/ts 6100 3.0 zlv (#31747)

* modify asan exampel

* modify asan exampel

* add example

* add example

* modify case example

---------

Co-authored-by: zelv01 <1101510017@qq.com>

* feat(stream): fix memory leak

* modify sliding example

* test: update test case.

* feat(stream): fix conflicts

* fix: add offset case 10a 10s 10m 10h 10d

* feat(stream): fix conflicts

* chore(stream): rename case name #TS-6100

* add case

* modify example

* fix: windows compile issues

* fix: data null check

* feat: [TS-6100] Forbid where when using %%trows (#31827)

* feat: [TS-6100] Forbid where when using %%trows

* test: update cases

* feat: [TS-6100] Fix leaks.

---------

Co-authored-by: Simon Guan <guanshengliang@qq.com>

* test: reproduce bugs

* test: update test case.

* test: update test case.

* feat: [TS-6100] Fix leaks.

* test: add cases

* Feat/ts 6100 3.0.pw10 (#31841)

* enh: add operator reset func

* fix: merge join reset issue

* fix: memory issues

* fix: add debug assert

* fix: memory issues

* fix: memory leak

* fix: memory issues

* fix taos log miss

* fix: case issue

* fix: case issue

* fix: case issues

* fix: drop dnode issue

* fix: memory issues

* fix: memory issues

* fix: memory leak issues

* fix: recalculate time range issue

* fix: add debug log

* fix: memory issues

* fix: enable case asan

* Update streamlist_for_ci.task

* fix: case asan issue

* fix: stream name issue

* fix: external window compile issues

* fix: deploy memory issue

* fix: ahandle issue

* fix: ahandle issue

* fix: ahandle issue

* fix: virtual table reader list issue

* fix: log info

* fix: msg error

* fix: virtual table addr list issue

* fix: memory issues

* fix: memory leak issue

* fix: memory issues

* fix: memory free issues

* fix: memory issues

* fix: snode deploy issue

* fix: mnode reader issue

* fix: memory issues

* fix: add debug test

* enh: add ignore nodata trigger

* fix: memory leaks

* fix: configuration issue

* fix: memory issue

* fix: external window issue

* fix: external window issues

* fix: external window placeholder issue

* fix: placeholder function init issues

* fix: memory leak issue

* fix: add debug log

* fix: compile issues

* fix: double free issue

* fix: runner addr update issue

* fix: msg rsp issue

* fix: external window reset issue

* fix: configuration issue

* fix: deploy msg issue

* fix: compile issue

---------

Co-authored-by: huohong <sallyhuo@taosdata.com>

* test: reproduce bugs

* fix: add sliding interval combine case

* test: add cases

* test: add recalc test.

* test: reproduce bugs

* case : add vt ts is null check

* modify case

* bug: submit test_idmp_meters_bug3.py

* test: add test for recalc.

* test: add cases

* fix: error code check

* test: add cases

* fix(stream): scan wal with schema in that version

* add case

* test: add cases

* test: update test case.

* fix: windows compile issues

* add case

* test: add cases (#31845)

* modify case

* fix: reset interpPrev

* test: add test_idmp_meters bug4 and bug3

* add case

* fix(stream): opti wal interface

* fix: remove test_idmp_meters_bug5.py

* test: add cases

* fix(stream): fix ts data fetch for virtual tables

* cancel asan case

* test: update test case.

* test: update test case.

* add case

* test: add cases

* test: add cases

* test: add case test_idmp_meters_bug5.py

* test: update test case.

* fix(stream): tmq error

* test: add cases

* feat: [TS-6100] Restore deleted code in mndSma.c since they are still in use.

* fix(stream): optimize val scan logic

* test: add test_recalc_expired_time.py  to ci.

* test: update test case.

* test: update test case.

* feat: [TS-6100] Fix fill range check

* fix(stream): optimize val scan logic

* add case

* test: modify for partition by %%1

* test: add fun case stream4_sub7

* fix(stream): optimize val scan logic

* add case

* feat: [TS-6100] Rename OPTIONS to STREAM_OPTIONS.

* test: add test for recalc.

* test: use stream_options.

* fix: some cases error.

* test: remove recalc from ci.

* fix: ci case issues (#31880)

* enh: add operator reset func

* fix: merge join reset issue

* fix: memory issues

* fix: add debug assert

* fix: memory issues

* fix: memory leak

* fix: memory issues

* fix taos log miss

* fix: case issue

* fix: case issue

* fix: case issues

* fix: drop dnode issue

* fix: memory issues

* fix: memory issues

* fix: memory leak issues

* fix: recalculate time range issue

* fix: add debug log

* fix: memory issues

* fix: enable case asan

* Update streamlist_for_ci.task

* fix: case asan issue

* fix: stream name issue

* fix: external window compile issues

* fix: deploy memory issue

* fix: ahandle issue

* fix: ahandle issue

* fix: ahandle issue

* fix: virtual table reader list issue

* fix: log info

* fix: msg error

* fix: virtual table addr list issue

* fix: memory issues

* fix: memory leak issue

* fix: memory issues

* fix: memory free issues

* fix: memory issues

* fix: snode deploy issue

* fix: mnode reader issue

* fix: memory issues

* fix: add debug test

* enh: add ignore nodata trigger

* fix: memory leaks

* fix: configuration issue

* fix: memory issue

* fix: external window issue

* fix: external window issues

* fix: external window placeholder issue

* fix: placeholder function init issues

* fix: memory leak issue

* fix: add debug log

* fix: compile issues

* fix: double free issue

* fix: runner addr update issue

* fix: msg rsp issue

* fix: external window reset issue

* fix: configuration issue

* fix: deploy msg issue

* fix: compile issue

* fix: external window idx issue

* fix: ci issues

---------

Co-authored-by: huohong <sallyhuo@taosdata.com>

* fix(stream): fix compilation error

* fix(stream): optimize val scan logic

* test:add test cases

* test: modify case

* fix: external agg error

* test(stream): tobacco scene testing #TD-36514

* test: add stream cases (#31885)

* fix: windows compile issue

* fix: calc timerange

* fix: windows compile issue

* modify case

* fix(stream): compile error

* test: remove one debug test case file

* test: modify

* test: add test cases

* test: reproduce bugs

* test: reproduce bugs

* feat: [TS-6100] Placeholder function should only appera in SELECT and… (#31868)

* feat: [TS-6100] Placeholder function should only appera in SELECT and WHERE and FROM.

* test: update case

---------

Co-authored-by: Simon Guan <guanshengliang@qq.com>

* add example

* add example

* modify case example

* modify case

* test:alter sql

* test: add stream5 case

* fix(stream): get schema error with version

* test: add delete recalc test py.

* test: remove bug cases

* test: stream5 case test passed

* test: add state cases (#31893)

* fix(stream): compile error

* test: modify case

* test: add cases

* test: add test.

* test: update test case.

* chore(test): fix case err

* test: update test case.

* fix: align data get

* fix(stream): fix row index of datablock written into data cache

* fix: put align data

* test: update test case.

* test: add test cases for virtual table

* chore(test): fix case err #TD-36514

* add case

* test: add test for water mark.

* test: add meters bug6 for stream5

* test: add cases (#31903)

* test: add test for recalc.

* feat: [TS-6100] %%trows can only be used when event type is window close.

* test: add precision of database for ms/us/ns

* modify case

* add case

* add case

* test: add test to ci.

* modify case

* fix: ci case issues (#31904)

* enh: add operator reset func

* fix: merge join reset issue

* fix: memory issues

* fix: add debug assert

* fix: memory issues

* fix: memory leak

* fix: memory issues

* fix taos log miss

* fix: case issue

* fix: case issue

* fix: case issues

* fix: drop dnode issue

* fix: memory issues

* fix: memory issues

* fix: memory leak issues

* fix: recalculate time range issue

* fix: add debug log

* fix: memory issues

* fix: enable case asan

* Update streamlist_for_ci.task

* fix: case asan issue

* fix: stream name issue

* fix: external window compile issues

* fix: deploy memory issue

* fix: ahandle issue

* fix: ahandle issue

* fix: ahandle issue

* fix: virtual table reader list issue

* fix: log info

* fix: msg error

* fix: virtual table addr list issue

* fix: memory issues

* fix: memory leak issue

* fix: memory issues

* fix: memory free issues

* fix: memory issues

* fix: snode deploy issue

* fix: mnode reader issue

* fix: memory issues

* fix: add debug test

* enh: add ignore nodata trigger

* fix: memory leaks

* fix: configuration issue

* fix: memory issue

* fix: external window issue

* fix: external window issues

* fix: external window placeholder issue

* fix: placeholder function init issues

* fix: memory leak issue

* fix: add debug log

* fix: compile issues

* fix: double free issue

* fix: runner addr update issue

* fix: msg rsp issue

* fix: external window reset issue

* fix: configuration issue

* fix: deploy msg issue

* fix: compile issue

* fix: external window idx issue

* fix: ci issues

* fix: ci case issues

* fix: drop dnode issue

---------

Co-authored-by: huohong <sallyhuo@taosdata.com>

* fix(stream): ci error

* test: update test case.

* feat: [TS-6100] Disable some failed UT.

* feat: [TS-6100] Fix virtual table

* test: add bug 5.

* test: add test delete recalc to ci.

* test: add bug 6.

* test(stream): tobacco scene #TD-36514

* fix: reqCids,reqCols memory leak in SSTriggerRealtimeContext

Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>

* test: add case stream6

* fix(stream): implement some pending features in trigger task

* modify case

* modify case

* fix: case issues

* modify case

* test: add recalc for warter mark.

* fix(stream): fix count window trigger of virtual tables

* fix(stream): memory leak

* test: fix run err.

* test: add stream6 bug7

* fix: adjust format

* test(stream): tobacco scene testing #TD-36514

* test: change bug7 with update window1 and 2

* test: add test bug 7.

* case: restore write 3 window

* fix: windows compile issue

* fix: notify

* test: add cases

* modify case

* test: update test case.

* test(stream): toobacco scene testing #TD-36514

---------

Co-authored-by: Simon Guan <slguan@taosdata.com>
Co-authored-by: plum-lihui <huili@taosdata.com>
Co-authored-by: Alex Duan <417921451@qq.com>
Co-authored-by: zelv01 <1101510017@qq.com>
Co-authored-by: Jing Sima <simondominic9997@outlook.com>
Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com>
Co-authored-by: wangmm0220 <wangmm0220@gmail.com>
Co-authored-by: Haojun Liao <hjliao@taosdata.com>
Co-authored-by: zyyang90 <zyyang@taosdata.com>
Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com>
Co-authored-by: facetosea <285808407@qq.com>
Co-authored-by: Simon Guan <guanshengliang@qq.com>
Co-authored-by: huohong <sallyhuo@taosdata.com>
Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com>
Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com>
Co-authored-by: xiao-77 <berylbao@taosdata.com>
Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com>
Co-authored-by: happyguoxy <happy_guoxy@163.com>
Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com>
Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>

* test: rename TSDB

* docs: fix rust examples (#31908)

* docs: modify rust native test case

* docs: modify rust ws test case

* docs: modify rust examples

* docs: update rust pool docs

* fix new cases

* migrate test case

* feat: support reading sub table names and tag values from CSV files to create sub tables (#31909)

* feat: add obtaining table names from tag files

* feat: add write data table control

* feat: add table params to write

* feat: delete log file

* feat: modify test case csv path

* feat: resolve memory leakage in the table building thread

* feat: resolve compilation errors

* feat: resolve table name copy len error

* feat: modify create table log level

* feat: modifying query configuration parameter array out of bounds

* feat: support custom primary key names

* feat: modify log level

* feat: add set primary key name case

* feat: add column  keywords case

* feat: add keywords case data

* feat: modify primaryKeyName value len

* feat: modify primaryKeyName value define

* feat: modify primaryKeyName value size

* fix: compile issue (#31943)

Co-authored-by: taos-support <it@taosdata.com>

* package: fix error

* package: fix error

* fix failed cases

* merge 3.0

* rename create_table_keywords.py to test_create_table_keywords.py

* fix failed cases

* fix new cases

* docs: update stream (#31957)

* docs: update jdbc out-dated descripiton (#31959)

* fix: TD-36560 refactor arbitrator group function name and log (#31852)

* feat: support BLOB data type (#31704)

* rename 0-others/mounts.py to 0-others/test_mounts.py

* fix failed cases

* docs: update gpt (#31975)

* fix failed cases

* fix failed cases

* package: fix error

* feat: add taosBenchmark command line parameters (#31967)

* feat: add command line parameters

* feat: add command line parameter test cases

* fix: tableName len error

* enh: set TD Release build in tdengine-build.yml

* Update tdengine-build.yml

* fix: add json file path log

* fix: streamline TD_CONFIG export in build steps

* fix: Restore the build configuration

---------

Co-authored-by: haoranchen <haoran920c@163.com>

* fix: tableName len error (#31977)

* fix: tableName len error

* fix: modify TD_CONFIG=Release

* fix: code format

* fix: Restore the build configuration

* enh: set TD Release build in tdengine-build.yml (#31980)

* enh: set TD Release build in tdengine-build.yml

* Update tdengine-build.yml

* fix: update cache key for externals to include debug build version

* fix: remove verbose flag from build commands in tdengine-build.yml

* skip memleak cases

* fix failed case

* fix failed cases

* package: fix error

* fix(stmt2):tbname error output (#31997)

* fix: possible memory leak (#31972)

* feat: create connect add dbname params (#32002)

* feat: create connect add dbname params

* fix: connect param error

* skip failed cases

* fix cases on windows

* fix cases

* support connect bi mode and fix log level

* unique sql connect username and password

* fix log level

* enh: mounted vnode may have no tq (#31916)

* fix: subquery memleak (#32024)

* fix failed case

* fix cases

* rename 2-query/test_insert_select.py to 2-query/test_system_insert_select.py

* skip memleak cases

* enh: rename data forecast/detect to forecasting/anomaly detection (#32021)

* package: unique product name

* package: update for main

* skip tsim cases

* chore: update jdbc connection pool validation query sql (#32056)

* refactor: quotes usage in bash scripts

Signed-off-by: WANG Xu <feici02@outlook.com>

* enhn(mqtt/rawblock): new format for msg payload (#31801)

* fix: fix broken link in 14-stream.md

* docs: 15-spark.md is missing end semicolon (#32068)

* chore: bump dev version to 3.3.7.0.alpha (#32066)

* fix: blob test (#32020)

* fix blob query error

* fix blob query error

* fix blob query error

* fix blob query error

* fix blob query error

* opt query

* opt write

* opt write

* opt write

* opt bse

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* opt write

* add cache

* opt query

* opt query

* opt bse

* add data iter

* add data iter

* add more compress

* add more compress

* add more compress

* add more compress

* add more compress

* add more compress

* opt blob transfer

* opt blob transfer

* opt blob transfer

* opt write

* avoid unordered data write

* avoid unordered data write

* opt read

* refactor log

* fix invalid write

* refactor code

* fix merge error

* fix merge error

* add error code

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* support blob type len

* Merge remote-tracking branch 'origin/3.0' into enh/blob

* refactor code

* support blob type len

* refactor code

* refactor code

* benchmark support blob type

* benchmark support blob type

* add log

* handle sort and merge row

* change file set

* change file set

* change file set

* change file set

* change file set

* change file set

* change file set

* opt code

* opt read

* add restart error and add unit test

* add restart error and add unit test

* add restart error and add unit test

* add restart error and add unit test

* add restart error and add unit test

* refactor code

* add restart error and add unit test

* opt code

* refactor code

* fix invalid write

* blob test

* blob test

* blob test

* blob test

* blob test

* support blob

* add str trim

* add str trim

* Merge remote-tracking branch 'origin/3.0' into feat/blob

* Merge remote-tracking branch 'origin/3.0' into feat/blob

* update test case

* fix invalid read

* fix invalid read

* fix invalid read

* add stmt2

* add stmt2

* add stmt2

* update parameter

* refactor test case

* refactor test case

* support blob

* support stmt2

* add sub

* support blob

* support blob

* support sub

* fix tmq crash

* support windows/darwin

* fix stmt2 bind row

* fix blob crash

* fix blob crash

* fix blob query error

* fix blob crash

* fix merge error

* refactor bse

* add blob transfer

* add blob transfer

* add transfer snapshot

* refactor code

* change log level

* change log level

* add test case

* refactor code

* revert taosBenchmark

* revert taosbench

* fix: improve error handling and encoding for file reading in grep_asserts_in_file function

* rm assert

* fix mem leak

* fix compile error

* fix conflict

* fix conflict

* fix compile error

* fix compile error

* fix pre check error

* fix pre check error

* fix compile error on windows

* fix error on window

* fix error on windows

* fix error on windows

* opt no-blob sql

* fix compile error on dawain

* fix compile error on dawain

* fix invalid read

* fix mem leak

* fix invalid read

* fix invalid read

* fix error on windows

* remove unused code

* refactor code

* fix mem leak

* fix mem leak

* rm unused code

* rm unused code

* fix invalid copy

* fix invalid copy

* fix invalid copy

* fix invalid copy

* fix invalid copy

* refactor code

* make ci happy

* refactor code

* change make

* update test case

* update ignore code

* update bse snapshot and test case

* update bse snapshot and test case

* refactor code

* change unit test

* update bse snapshot

* update bse snapshot

* fix test case

* fix bse snapshot

* fix bse snapshot

* fix snapshot transfer

* remove unused log

* support func query

* add test case

* forbidden  unsupport code

* merge 3.0

* merge 3.0

* change test case

* add forbidden code

* add forbidden code

* add code

* support length func

* support length func

* taosBenchmark support  blob

* support blob raw block

* support write raw block

* support more query

* Merge branch 'feat/blob' into feat/blob_test

* SBlobRow2

* change bse commit change

* refactor code

* rm exe test

* refactor code

* checke return code

* rename blob name

* refactor code

* refactor code

* refactor code

* refactor code

* fix unordere write

* fix unordere write

* fix row merge error

* fix row merge error

* fix row merge error

* fix row merge error

* support ordered data

* support ordered data

* Merge remote-tracking branch 'origin/3.0' into feat/blob_test

* fix stmt2 blob crash

* add not support write type

* add not support write type

* add not support write type

* rm exe

* fix col-formate error

* fix col-formate error

* fix mem leak

* refactor code

* add error code for single blob column restriction and update error message

* add error code for single blob column restriction and update error message

* add error code for single blob column restriction and update error message

* refactor code

* change error code

* make ci happy

---------

Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
Co-authored-by: chenhaoran <haoran920c@163.com>

* package: update for main (#32091)

* fix compile error on windows (#32089)

* fix: source code merge issues

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: WANG Xu <feici02@outlook.com>
Co-authored-by: minhuinie <nminhui@163.com>
Co-authored-by: huohong <sallyhuo@taosdata.com>
Co-authored-by: chenhaoran <haoran920c@163.com>
Co-authored-by: Nie Minhui <143420805+minhuinie@users.noreply.github.com>
Co-authored-by: Mario Peng <48949600+Pengrongkun@users.noreply.github.com>
Co-authored-by: Haojun Liao <hjxilinx@users.noreply.github.com>
Co-authored-by: dongming chen <cademfly@hotmail.com>
Co-authored-by: Linhe Huo <linhehuo@gmail.com>
Co-authored-by: huohong <346479823@qq.com>
Co-authored-by: Joel Brass <joel@jbrass.com>
Co-authored-by: WANG Xu <feici02@outlook.com>
Co-authored-by: Hongze Cheng <hzcheng@taosdata.com>
Co-authored-by: Tony Zhang <34825804+Tony2h@users.noreply.github.com>
Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>
Co-authored-by: Kaili Xu <klxu@taosdata.com>
Co-authored-by: Zhixiao Bao <62235797+xiao-77@users.noreply.github.com>
Co-authored-by: WANG MINGMING <wangmm0220@gmail.com>
Co-authored-by: hongzhenliu <wluckyjob@gmail.com>
Co-authored-by: Daniel Clow <106956386+danielclow@users.noreply.github.com>
Co-authored-by: She Yanjie <57549981+sheyanjie-qq@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Simon Guan <slguan@taosdata.com>
Co-authored-by: plum-lihui <huili@taosdata.com>
Co-authored-by: Alex Duan <417921451@qq.com>
Co-authored-by: zelv01 <1101510017@qq.com>
Co-authored-by: Jing Sima <simondominic9997@outlook.com>
Co-authored-by: xiangyang guo <66111494+happyguoxy@users.noreply.github.com>
Co-authored-by: Haojun Liao <hjliao@taosdata.com>
Co-authored-by: zyyang90 <zyyang@taosdata.com>
Co-authored-by: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com>
Co-authored-by: facetosea <285808407@qq.com>
Co-authored-by: Simon Guan <guanshengliang@qq.com>
Co-authored-by: Li Hui <52318143+plum-lihui@users.noreply.github.com>
Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com>
Co-authored-by: xiao-77 <berylbao@taosdata.com>
Co-authored-by: happyguoxy <happy_guoxy@163.com>
Co-authored-by: guozhenwei <2227465945@qq.com>
Co-authored-by: kevin men <men_shi_bin@163.com>
Co-authored-by: taos-support <it@taosdata.com>
Co-authored-by: Yihao Deng <luomoxyz@126.com>
Co-authored-by: Minglei Jin <49711132+stephenkgu@users.noreply.github.com>
Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-07-22 13:25:21 +08:00

1612 lines
111 KiB
Python

import time
from new_test_framework.utils import tdLog, tdSql, clusterComCheck, tdStream, StreamItem
class TestStreamSubqueryPeriod:
def setup_class(cls):
tdLog.debug(f"start to execute {__file__}")
def test_stream_subquery_period(self):
"""Subquery in Period
1. Use period trigger mode
2. Output results include 4 dimensions:
No grouping
Group by table name
Group by tags
Group by ordinary columns
3. Generate 100 SQL statements using the following syntax combinations:
Tables: system tables, super tables, child tables, normal tables, virtual super tables, virtual child tables
Functions:
Single-row functions (math/string/conversion/time functions)
Aggregate functions
Selection functions
Time-series-specific functions
Geometry functions
System functions
Queries: projection queries, nested queries, join queries, window queries (time/event/count/session/state), SHOW commands, GROUP BY, PARTITION BY, ORDER BY, LIMIT, SLIMIT, UNION, etc.
Filters: time comparisons, ordinary column comparisons, tag column comparisons
Operators: arithmetic, string, bitwise, comparison, logical, JSON operators
Others:
Queries on databases/tables same as/different from the trigger table
View queries
4. Include the following combinations in step 3 query results:
Use all data types: numeric, binary, string, geometry, json, etc.
Use all pseudo-columns: _qstart, _qend, _wstart, _wend, _wduration, _c0, _rowts, irowts, _irowtsorigin, tbname, etc.
Include data columns and tag columns
Randomly include None and NULL in result sets
Result set sizes: 1 row, n rows
Include duplicate timestamp in result sets
5. Test placeholder usage in step 3's queries, including:
Placeholders in various positions like FROM, SELECT, WHERE
Each placeholder: _twstart, _twend, _twduration, _twrownum, _tcurrent_ts, _tgrpid, _tlocaltime, %%n, %%tbname, %%tbrows
6. Validation checks:
Verify table structures and table counts
Validate correctness of calculation results
Validate the accuracy of placeholder data, such as %%trows
Catalog:
- Streams:SubQuery
Since: v3.0.0.0
Labels: common,ci
Jira: None
History:
- 2025-5-30 Simon Guan Create Case
"""
self.createSnode()
self.createDatabase()
self.prepareQueryData()
self.prepareTriggerTable()
self.createStreams()
self.checkStreamStatus()
self.writeTriggerData()
self.checkResults()
def createSnode(self):
tdLog.info("create snode")
tdStream.createSnode(1)
def createDatabase(self):
tdLog.info(f"create database")
tdSql.prepare(dbname="qdb", vgroups=1)
tdSql.prepare(dbname="tdb", vgroups=1)
tdSql.prepare(dbname="rdb", vgroups=1)
clusterComCheck.checkDbReady("qdb")
clusterComCheck.checkDbReady("tdb")
clusterComCheck.checkDbReady("rdb")
def prepareQueryData(self):
tdLog.info("prepare child tables for query")
tdStream.prepareChildTables(tbBatch=1, rowBatch=1, rowsPerBatch=400)
tdLog.info("prepare normal tables for query")
tdStream.prepareNormalTables(tables=10, rowBatch=1)
tdLog.info("prepare virtual tables for query")
tdStream.prepareVirtualTables(tables=10)
tdLog.info("prepare json tag tables for query, include None and primary key")
tdStream.prepareJsonTables(tbBatch=1, tbPerBatch=10)
tdLog.info("prepare view")
tdStream.prepareViews(views=5)
def prepareTriggerTable(self):
tdLog.info("prepare tables for trigger")
stb = "create table tdb.triggers (ts timestamp, c1 int, c2 int) tags(id int, name varchar(16));"
ctb = "create table tdb.t1 using tdb.triggers tags(1, '1') tdb.t2 using tdb.triggers tags(2, '2') tdb.t3 using tdb.triggers tags(3, '3')"
tdSql.execute(stb)
tdSql.execute(ctb)
ntb = "create table tdb.n1 (ts timestamp, c1 int, c2 int)"
tdSql.execute(ntb)
vstb = "create stable tdb.vtriggers (ts timestamp, c1 int, c2 int) tags(id int) VIRTUAL 1"
vctb = "create vtable tdb.v1 (tdb.t1.c1, tdb.t1.c2) using tdb.vtriggers tags(1)"
tdSql.execute(vstb)
tdSql.execute(vctb)
def writeTriggerData(self):
tdLog.info("write data to trigger table")
sqls = [
"insert into tdb.t1 values ('2025-01-01 00:00:00', 0, 0 ) ('2025-01-01 00:05:00', 5, 50 ) ('2025-01-01 00:10:00', 10, 100)",
"insert into tdb.t2 values ('2025-01-01 00:11:00', 11, 110) ('2025-01-01 00:12:00', 12, 120) ('2025-01-01 00:15:00', 15, 150)",
"insert into tdb.t3 values ('2025-01-01 00:21:00', 21, 210)",
"insert into tdb.n1 values ('2025-01-01 00:25:00', 25, 250) ('2025-01-01 00:26:00', 26, 260) ('2025-01-01 00:27:00', 27, 270)",
"insert into tdb.t1 values ('2025-01-01 00:30:00', 30, 300) ('2025-01-01 00:32:00', 32, 320) ('2025-01-01 00:36:00', 36, 360)",
"insert into tdb.n1 values ('2025-01-01 00:40:00', 40, 400) ('2025-01-01 00:42:00', 42, 420)",
]
tdSql.executes(sqls)
def checkStreamStatus(self):
tdLog.info(f"wait total:{len(self.streams)} streams run finish")
tdStream.checkStreamStatus()
def checkResults(self):
tdLog.info(f"check total:{len(self.streams)} streams result")
for stream in self.streams:
stream.checkResults()
tdLog.info(f"check total:{len(self.streams)} streams result successfully")
def createStreams(self):
self.streams = []
stream = StreamItem(
id=0,
stream="create stream rdb.s0 session(ts, 4m) from tdb.triggers into rdb.r0 as select _twstart ts, _twstart + 5m te, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m;",
res_query="select ts, c1, c2 from rdb.r0 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:15:00';",
exp_query="select _wstart ts, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:15:00' interval(5m);",
check_func=self.check0,
)
self.streams.append(stream)
stream = StreamItem(
id=1,
stream="create stream rdb.s1 session(ts, 4m) from tdb.triggers into rdb.r1 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, cast(_tlocaltime as bigint) tl, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null;",
res_query="select ts, te, td, tg, c1, c2 from rdb.r1;",
exp_query="select _wstart ts, _wend te, _wduration td, 0 tg, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
check_func=self.check1,
)
# self.streams.append(stream)
stream = StreamItem(
id=2,
stream="create stream rdb.s2 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r2 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, _tlocaltime tl, tbname tb, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null partition by tbname",
res_query="select ts, te, td, c1, tag_tbname from rdb.r2 where tag_tbname='t1';",
exp_query="select _wstart ts, _wend te, _wduration td, count(cint) c1, 't1' from qdb.t1 where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
check_func=self.check2,
)
# self.streams.append(stream)
stream = StreamItem(
id=3,
stream="create stream rdb.s3 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r3 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, _tlocaltime tl, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null;",
res_query="select ts, te, td, c1, tag_tbname from rdb.r3 where tag_tbname='t1';",
exp_query="select _wstart ts, _wend te, _wduration td, count(cint) c1, 't1' from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
check_func=self.check3,
)
# self.streams.append(stream)
stream = StreamItem(
id=4,
stream="create stream rdb.s4 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r4 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, _tlocaltime tl, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null and tbname=%%tbname",
res_query="select ts, te, td, c1, tag_tbname from rdb.r4 where tag_tbname='t1';",
exp_query="select _wstart ts, _wend te, _wduration td, count(cint) c1, 't1' from qdb.t1 where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
check_func=self.check4,
)
# self.streams.append(stream)
stream = StreamItem(
id=5,
stream="create stream rdb.s5 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r5 as select _twstart ts, _twend te, _twduration td, _twrownum tw, %%tbname as tb, count(c1) c1, avg(c2) c2 from %%tbname where ts >= _twstart and ts < _twend",
res_query="select ts, te, td, tw, tb, c1, c2, tag_tbname from rdb.r5 where tag_tbname='t1';",
exp_query="select _wstart, _wend, _wduration, count(c1), 't1', count(c1), avg(c2), 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' interval(5m) fill(value, 0, 0, null);",
check_func=self.check5,
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=6,
stream="create stream rdb.s6 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r6 as select _twstart ts, count(c1), avg(c2) from %%trows where ts >= _twstart and ts < _twend partition by tbname",
res_query="select *, tag_tbname from rdb.r6 where tag_tbname='t1'",
exp_query="select _wstart, count(c1), avg(c2), 't1', 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=7,
stream="create stream rdb.s7 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r7 as select _twstart ts, count(c1), avg(c2) from %%tbname where ts >= _twstart and ts < _twend and %%tbname = tbname",
res_query="select *, tag_tbname from rdb.r7 where tag_tbname='t1'",
exp_query="select _wstart, count(c1), avg(c2), 't1', 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=8,
stream="create stream rdb.s8 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r8 as select _twstart ts, count(c1), avg(c2) from %%trows where ts >= _twstart and ts < _twend partition by %%1",
res_query="select *, tag_tbname from rdb.r8 where tag_tbname='t1'",
exp_query="select _wstart, count(c1), avg(c2), 't1', 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=9,
stream="create stream rdb.s9 session(ts, 4m) from tdb.triggers partition by id into rdb.r9 tags(gid bigint as _tgrpid, id int as %%1) as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, _tlocaltime tl, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null;",
res_query="select ts, te, c1, c2, id from rdb.r9 where id=1;",
exp_query="select _wstart, _wend, count(cint) c1, avg(cint) c2, 1 from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=10,
stream="create stream rdb.s10 session(ts, 4m) from tdb.triggers partition by id, tbname into rdb.r10 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, cast(_tlocaltime % 1000000 as timestamp) tl, %%1 t1_data, %%2 t2_data, %%tbname tb_data, count(cint) c1_data, avg(cint) c2_data from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null and tbname = %%2;",
res_query="select ts, t1_data, t2_data, tb_data, c1_data, c2_data, id, tag_tbname from rdb.r10 where id=1;",
exp_query="select _wstart, 1, 't1', 't1', count(cint) c1, avg(cint) c2, 1, 't1' from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' and tbname='t1' interval(5m);",
check_func=self.check10,
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=11,
stream="create stream rdb.s11 session(ts, 4m) from tdb.n1 into rdb.r11 as select _tcurrent_ts tc, _tprev_ts tp, _tnext_ts tn, _tgrpid tg, _tlocaltime tl, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _tcurrent_ts and cts < _tnext_ts and _tgrpid is not null and _tlocaltime is not null and tbname != 't1';",
res_query="select tc, tp, tn, tg, c1, c2 from rdb.r11;",
exp_query="select _wstart, _wstart - 5m, _wend, 0, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= '2025-01-01 00:25:00.000' and cts < '2025-01-01 00:45:00.000' and tbname != 't1' interval(5m);",
check_func=self.check11,
)
# self.streams.append(stream)
stream = StreamItem(
id=12,
stream="create stream rdb.s12 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r12 as select _twstart ts, %%tbname tb, %%1, count(*) v1, avg(c1) v2, first(c1) v3, last(c1) v4 from %%trows where c2 > 0;",
res_query="select ts, tb, `%%1`, v2, v3, v4, tag_tbname from rdb.r12 where tb='t1'",
exp_query="select _wstart, 't1', 't1', avg(c1) v2, first(c1) v3, last(c1) v4, 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' and c2 > 0 interval(5m);",
check_func=self.check12,
)
# self.streams.append(stream)
stream = StreamItem(
id=13,
stream="create stream rdb.s13 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r13 as select _twstart ts, _twend te, _twduration td, _twrownum tw, _tgrpid tg, _tlocaltime tl, %%1 t1 , %%tbname t2, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _twduration is not null and _twrownum is not null and _tgrpid is not null and _tlocaltime is not null and %%1 = tbname and %%tbname = tbname;",
res_query="select ts, t1, t2, c1, c2 from rdb.r13 where tag_tbname = 't1'",
exp_query="select _wstart ts, 't1', 't1', count(cint) c1, avg(cint) c2 from qdb.meters where cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname = 't1' interval(5m)",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=14,
stream="create stream rdb.s14 session(ts, 4m) from tdb.triggers partition by id, tbname into rdb.r14 as select _twstart ts, %%tbname t1, %%1 t2, count(*) c1, avg(c1) c2, first(c1) c3, last(c1) c4 from %%trows;",
res_query="select ts, t1, t2, c1, c2, c3, c4 from rdb.r14 where id = 1",
exp_query="select _wstart ts, 't1', 1, count(*) c1, avg(c1) c2, first(c1) c3, last(c1) c4 from tdb.t1 where ts >='2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' interval(5m) fill(value, 0, null, null, null);",
)
# # self.streams.append(stream) TD-35989
stream = StreamItem(
id=15,
stream="create stream rdb.s15 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r15 as select _wstart, sum(cint), FIRST(cint) from qdb.meters where cts >= _twstart and cts <_twend interval(150s)",
res_query="select * from rdb.r15 where tag_tbname='t1';",
exp_query="select _wstart, sum(cint), FIRST(cint), 't1' from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(150s);",
)
# self.streams.append(stream)
stream = StreamItem(
id=16,
stream="create stream rdb.s16 session(ts, 4m) from tdb.n1 into rdb.r16 as select _tcurrent_ts ts, count(*) c1, avg(cint) c2, _tcurrent_ts + 1 as ts2, _tgrpid from qdb.meters where tbname = 't1' partition by tbname;",
res_query="select * from rdb.r16 limit 1;",
exp_query="select cast('2025-01-01 00:25:00.000' as timestamp), count(*), avg(cint), cast('2025-01-01 00:25:00.001' as timestamp), 0 from qdb.meters where tbname = 't1'",
check_func=self.check16,
)
# self.streams.append(stream)
stream = StreamItem(
id=17,
stream="create stream rdb.s17 session(ts, 4m) from tdb.triggers into rdb.r17 as select _wstart, sum(cint), FIRST(cint) from qdb.meters interval(5m)",
res_query="select * from rdb.r17",
exp_query="select _wstart, sum(cint), FIRST(cint) from qdb.meters interval(5m)",
)
# self.streams.append(stream)
stream = StreamItem(
id=18,
stream="create stream rdb.s18 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r18 tags(t1 int as %%1, t2 int as cast(%%2 as int)) as select _twstart c1, first(tw) c2, last(te) c3, count(tb) c4, sum(cnt) c5 from (select _wstart tw, _wend te, tbname tb, count(*) cnt from qdb.meters where cts >= _twstart and cts <_twend and tint=%%1 partition by tbname count_window(1000))",
res_query="select * from rdb.r18 where t1=1 limit 1",
exp_query="select first(tw), first(tw), last(te), count(tb), sum(cnt), 1, 1 from (select _wstart tw, _wend te, tbname tb, count(*) cnt from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and tint=1 partition by tbname count_window(1000));",
)
# self.streams.append(stream)
stream = StreamItem(
id=19,
stream="create stream rdb.s19 session(ts, 4m) from tdb.triggers partition by id into rdb.r19 as select _twend tw, sum(c1) sumcnt from (select tbname, count(*) c1 from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and tint=%%1 partition by tbname)",
res_query="select tw, sumcnt from rdb.r19 where id = 1",
exp_query="select _wend, count(*) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tint=1 interval(5m)",
)
# # self.streams.append(stream) TD-35956
stream = StreamItem(
id=20,
stream="create stream rdb.s20 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r20 as select _twend tw, count(*) c1, _tgrpid tg, _tlocaltime tl from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and tint=%%1;",
res_query="select tw, c1, id, name from rdb.r20 where id=1",
exp_query="select _wend, count(*) cnt, 1, '1' from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tint=1 interval(5m)",
)
# # self.streams.append(stream) TD-35956
stream = StreamItem(
id=21,
stream="create stream rdb.s21 session(ts, 4m) from tdb.n1 into rdb.r21 as select _tcurrent_ts tw, count(*) c1, _tgrpid tg, _tlocaltime tl from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
res_query="select tw, c1, tg from rdb.r21",
exp_query="select _wstart, count(*) cnt, 0 from qdb.meters where cts >= '2025-01-01 00:25:00.000' and cts < '2025-01-01 00:45:00.000' interval(5m);",
)
# # self.streams.append(stream) TD-35956
stream = StreamItem(
id=22,
stream="create stream rdb.s22 session(ts, 4m) from tdb.triggers into rdb.r22 as select _twend tw, sum(cint) c1, _tgrpid tg, _tlocaltime tl from qdb.meters where cts >= _twstart and cts < _twstart + 5m",
res_query="select tw, c1 from rdb.r22;",
exp_query="select _wend, sum(cint) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=23,
stream="create stream rdb.s23 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r23 as select _twend tw, sum(cint) c1, _tgrpid tg, _tlocaltime tl from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tbname=%%tbname partition by tbname",
res_query="select tw, c1, tag_tbname from rdb.r23 where tag_tbname='t1';",
exp_query="select _wend, sum(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=24,
stream="create stream rdb.s24 session(ts, 4m) from tdb.triggers partition by id into rdb.r24 as select _twend tw, sum(cint) c1, %%1 c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tint=%%1 partition by tint",
res_query="select tw, c1, c2, id from rdb.r24 where id=1;",
exp_query="select _wend, sum(cint), tint, tint from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tint=1 partition by tint interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=25,
stream="create stream rdb.s25 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r25 as select _twstart tw, sum(cint) c1, %%1 c2, %%2 c3 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tint=%%1",
res_query="select tw, c1, c2, c3, id, name from rdb.r25 where id=1;",
exp_query="select _wstart, sum(cint), tint, cast(tint as varchar(8)), tint, cast(tint as varchar(8)) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tint=1 partition by tint interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=26,
stream="create stream rdb.s26 session(ts, 4m) from tdb.triggers into rdb.r26 as select _twstart tw, sum(cint) c1, tbname from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tbname='t18' partition by tbname",
res_query="select * from rdb.r26",
exp_query="select _wstart, sum(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t18' partition by tbname interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=27,
stream="create stream rdb.s27 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r27 as select _tcurrent_ts tw, sum(cint) c1, count(cint) c2 from qdb.meters where cts >= _tcurrent_ts and cts < _tnext_ts and tbname=%%1",
res_query="select * from rdb.r27 where tag_tbname='t1'",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:40:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=28,
stream="create stream rdb.s28 session(ts, 4m) from tdb.triggers partition by id into rdb.r28 as select _twstart ts, `name` as cname, `super` csuper, create_time cctime, %%1 from information_schema.ins_users",
res_query="select ts, cname, csuper, 1000 from rdb.r28 where id = 1",
exp_query="select _wstart ts, 'root', 1, count(cint) from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=29,
stream="create stream rdb.s29 session(ts, 4m) from tdb.t1 into rdb.r29 as select _wstart, sum(cint), avg(cint) from qdb.meters where cts >= _twstart and cts < _twstart + 5m interval(1m);",
res_query="select * from rdb.r29",
exp_query="select _wstart ts, sum(cint), avg(cint) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(1m)",
)
# self.streams.append(stream)
stream = StreamItem(
id=30,
stream="create stream rdb.s30 session(ts, 4m) from tdb.n1 into rdb.r30 as select _wstart, sum(cint), FIRST(cint) from qdb.meters interval(2m)",
res_query="select * from rdb.r30",
exp_query="select _wstart, sum(cint), FIRST(cint) from qdb.meters interval(2m)",
)
# self.streams.append(stream)
stream = StreamItem(
id=31,
stream="create stream rdb.s31 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r31 as select _tprev_ts tp, _tcurrent_ts tc, _tnext_ts tn, _tgrpid tg, cast(_tlocaltime as bigint) tl, %%1 tg1, %%tbname tb, count(cint) c1, avg(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and _tprev_ts > '2024-12-30' and _tcurrent_ts > '2024-12-30' and _tnext_ts > '2024-12-30' and _tgrpid is not null and _tlocaltime is not null and %%1 != '1' and %%tbname != '1';",
res_query="select tp, tc, tn, tg1, tb, c1, c2, tag_tbname from rdb.r31 where tag_tbname = 't1'",
exp_query="select _wstart, _wstart + 5m, _wstart + 10m, 't1', 't1', count(cint) c1, avg(cint) c2, 't1' from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=32,
stream="create stream rdb.s32 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r32 as select _wstart, sum(cint), avg(cint) from qdb.meters where tbname != %%tbname and cts >= _twstart and cts < _twstart + 5m interval(1m);",
res_query="select * from rdb.r32 where tag_tbname='t1'",
exp_query="select _wstart ts, sum(cint) c1, avg(cint) c2, 't1' from qdb.meters where tbname != 't1' and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(1m)",
)
# self.streams.append(stream)
stream = StreamItem(
id=33,
stream="create stream rdb.s33 session(ts, 4m) from tdb.triggers partition by id into rdb.r33 tags(tbn varchar(128) as cast(%%1 as varchar)) as select _twstart, sum(cint), avg(cint) from qdb.meters where tint=%%1 and cts >= _twstart and cts < _twstart + 5m interval(1m);",
res_query="select `sum(cint)`, `avg(cint)` from rdb.r33 where tbn = 1 limit 1",
exp_query="select sum(cint), avg(cint) from qdb.meters where tint=1 and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(1m) limit 1 offset 4",
)
# self.streams.append(stream)
stream = StreamItem(
id=34,
stream="create stream rdb.s34 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r34 as select _tprev_ts tc, TIMEDIFF(_tprev_ts, _tnext_ts) tx, %%tbname tb, %%1 tg1, sum(c1) c1, avg(c2) c2, first(c1) c3, last(c2) c4 from %%trows where c1 > 0;",
res_query="select * from rdb.r34 where tag_tbname = 't1';",
exp_query="select _wstart, TIMEDIFF(_wstart, _wend) * 2, 't1', 't1', sum(c1) c1, avg(c2) c2, first(c1) c3, last(c2) c4 , 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' and c1 > 0 interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=35,
stream="create stream rdb.s35 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r35 as select _wstart ts, count(c1) c1, sum(c2) c2, %%1 c3, %%2 c4, cast(_tlocaltime / 1000000 as timestamp) c5, _tgrpid c6 from %%trows count_window(2);",
res_query="select ts, c1, c2, c3, c4, id, name from rdb.r35 where id = 1",
exp_query="select _wstart ts, count(c1) c1, sum(c2) c2, 1, '1', 1, '1' from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=36,
stream="create stream rdb.s36 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r36 as select _tprev_ts t1, _tcurrent_ts t2, _tnext_ts + 1 as t3, TIMEDIFF(_tcurrent_ts, _tprev_ts) tx1, TIMEDIFF(_tnext_ts, _tcurrent_ts) tx2, sum(cint) c1, avg(cuint) c2, _tgrpid from qdb.meters where tint=%%1 and cts >= _twstart and cts < _twstart + 5m;",
res_query="select t1, t2, t3, tx1, tx2, c1, c2 from rdb.r36 where id = 1",
exp_query="select _wstart, _wend, _wend + 5m + 1, TIMEDIFF(_wend, _wstart), TIMEDIFF(_wend, _wstart), sum(cint), avg(cuint) from qdb.meters where tint=1 and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m)",
)
# self.streams.append(stream)
stream = StreamItem(
id=37,
stream="create stream rdb.s37 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r37 as select _twstart ts, _twend, count(c1), sum(c2) from %%trows",
res_query="select * from rdb.r37 where id == 1",
exp_query="select _wstart, _wend, count(c1), sum(c2), 1, '1' from tdb.triggers where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' and id = 1 interval(5m) fill(value, 0, NULL);",
)
# self.streams.append(stream)
stream = StreamItem(
id=38,
stream="create stream rdb.s38 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r38 as select _twstart ts, _irowts, _isfilled, interp(c1), _irowtsorigin, _twend, _twduration, _twrownum from %%trows RANGE(_twend) FILL(linear);",
res_query="select * from rdb.r38 where tag_tbname='t1' limit 1",
exp_query="select _irowts , _isfilled , interp(c1) from tdb.t1 RANGE('2025-01-01 00:05:00.000') FILL(linear);",
)
# # self.streams.append(stream) TD-36112 todo
stream = StreamItem(
id=39,
stream="create stream rdb.s39 session(ts, 4m) from tdb.triggers into rdb.r39 as select _tnext_ts tn, TIMETRUNCATE(_tnext_ts, 1d) tnt, sum(cint) c1, _tgrpid tg, TIMETRUNCATE(cast(_tlocaltime /1000000 as timestamp), 1d) tl from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tint = 1 partition by tint",
res_query="select * from rdb.r39",
exp_query="select _wstart + 10m, timetruncate(_wstart, 1d), sum(cint), 0, timetruncate(now(), 1d) from qdb.meters where tint=1 and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=40,
stream="create stream rdb.s40 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r40 as select _twstart, table_name, db_name, stable_name, tag_name, tag_value from information_schema.ins_tags where table_name='j0' and stable_name='jmeters' and tag_name='tjson'",
res_query="select `_twstart`, `db_name`, `stable_name`, `tag_name`, `tag_value` from rdb.r40 where tag_tbname='t1' limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp) ts, db_name, stable_name, tag_name, tag_value from information_schema.ins_tags where table_name='j0' and stable_name='jmeters' and tag_name='tjson';",
check_func=self.check40,
)
# self.streams.append(stream)
stream = StreamItem(
id=41,
stream="create stream rdb.s41 session(ts, 4m) from tdb.triggers partition by id into rdb.r41 as select cts, cint, cbool, cast(tjson->'k1' as varchar(8)) cjson, _twstart from qdb.j0 where cts >= _twstart and cts < _twstart + 5m and cbool = %%1 order by cts limit 2, 3",
res_query="select * from rdb.r41 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and id = 1",
exp_query="select cts, cint, cbool, cast(tjson->'k1' as varchar(8)) cjson, cast('2025-01-01 00:00:00.000' as timestamp), 1 from qdb.j0 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and cbool = 1 order by cts limit 2, 3",
check_func=self.check41,
)
# self.streams.append(stream)
stream = StreamItem(
id=42,
stream="create stream rdb.s42 session(ts, 4m) from tdb.triggers partition by id into rdb.r42 as select _twstart ts, cts, %%1 tt, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary, cdecimal8, cdecimal16 from qdb.t1 where cts >= _twstart and cts < _twstart + 5m order by cts limit 1",
res_query="select ts, cts, tt, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from rdb.r42 where id = 1 limit 1 offset 1",
exp_query="select cts, cts, 1, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from qdb.t1 where cts = '2025-01-01 00:05:00.000';",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=43,
stream="create stream rdb.s43 session(ts, 4m) from tdb.triggers partition by id into rdb.r43 as select _twstart ts, cts, %%1 tt, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from qdb.v1 where cts >= _twstart and cts < _twstart + 5m order by cts limit 1",
res_query="select ts, cts, tt, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from rdb.r43 where id = 1 limit 1 offset 1",
exp_query="select cts, cts, 1, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from qdb.v1 where cts = '2025-01-01 00:05:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=44,
stream="create stream rdb.s44 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r44 as select _twstart ts, cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary, cgeometry from qdb.v1 order by cts limit 1 _qstart, _qend, _c0, rowts",
res_query="select * from rdb.r44",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=45,
stream="create stream rdb.s45 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r45 as select _twstart ts, cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary, cdecimal8, cdecimal16 from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tbname='t2' order by cts limit 1",
res_query="select ts, cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary, cdecimal8, cdecimal16 from rdb.r45 limit 1",
exp_query="select cts, cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary, cdecimal8, cdecimal16 from qdb.t2 where cts = '2025-01-01 00:00:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=46,
stream="create stream rdb.s46 session(ts, 4m) from tdb.triggers into rdb.r46 as select _twstart ts, count(c1) ccnt, sum(c2) csum, first(id) cfirst from %%trows",
res_query="select ts, ccnt, csum, cfirst from rdb.r46 limit 1 offset 1",
exp_query="select ts, 1, c2, 1 from tdb.t1 where ts='2025-01-01 00:05:00.000'",
check_func=self.check46,
)
# self.streams.append(stream)
stream = StreamItem(
id=47,
stream="create stream rdb.s47 session(ts, 4m) from tdb.triggers into rdb.r47 as select _twstart ts, sum(`vgroups`) c1, sum(ntables) c2 from information_schema.ins_databases where name != 'information_schema' and name != 'performance_schema'",
res_query="select ts, c1, c2 >= 100, 1000 from rdb.r47",
exp_query="select _wstart ts, 3, true, count(cint) from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=48,
stream="create stream rdb.s48 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r48 as select _twstart ts, ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar) from qdb.meters where cts >=_twstart and cts <= _twend and tbname=%%1 order by cts limit 1;",
res_query="select * from rdb.r48 where tag_tbname='t1' limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar), tbname from qdb.meters where cts='2025-01-01 00:15:00.000' and tbname='t1'",
)
# self.streams.append(stream)
stream = StreamItem(
id=49,
stream="create stream rdb.s49 session(ts, 4m) from tdb.triggers into rdb.r49 as select _twstart ts, ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar) from qdb.meters where cts >=_twstart and cts <= _twend and tbname='t1' order by cts limit 1",
res_query="select * from rdb.r49 limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar) from qdb.meters where cts='2025-01-01 00:15:00.000' and tbname='t1';",
)
# self.streams.append(stream)
stream = StreamItem(
id=50,
stream="create stream rdb.s50 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r50 as select _tcurrent_ts ts, ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar) from qdb.meters where cts >=_tcurrent_ts and cts <= _tnext_ts and tbname=%%1 order by cts limit 1;",
res_query="select * from rdb.r50 where tag_tbname='t1' limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ABS(cint), ACOS(cuint), ASIN(cbigint), ATAN(cubigint), CEIL(cfloat), COS(cdouble), DEGREES(csmallint), EXP(cusmallint), FLOOR(ctinyint), LN(cutinyint), LOG(cfloat), MOD(cbigint, cint), PI(), POW(cuint, 2), RADIANS(cbigint), ROUND(cfloat), SIGN(cdouble), SQRT(csmallint), TAN(cfloat), TRUNCATE(cdouble, 1), CRC32(cvarchar), tbname from qdb.meters where cts='2025-01-01 00:15:00.000' and tbname='t1'",
)
# self.streams.append(stream)
stream = StreamItem(
id=51,
stream="create stream rdb.s51 session(ts, 4m) from tdb.triggers partition by id into rdb.r51 as select _twstart ts, ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH(cast(%%1 as varchar)), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar) from qdb.n1 where cts >=_twstart and cts <= _twend order by cts limit 1;",
res_query="select * from rdb.r51 where id='1' limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH(cast(1 as varchar)), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar), 1 from qdb.n1 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=52,
stream="create stream rdb.s52 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r52 as select _twstart ts, ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH(%%tbname), CHAR_LENGTH(cast(%%1 as varchar)), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar) from qdb.n1 where cts >=_twstart and cts <= _twend order by cts limit 1;",
res_query="select * from rdb.r52 where tag_tbname='t1' limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH('t1'), CHAR_LENGTH(cast('t1' as varchar)), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar), 't1' from qdb.n1 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=53,
stream="create stream rdb.s53 session(ts, 4m) from tdb.triggers into rdb.r53 as select _tprev_ts ts, ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar) from qdb.n1 where cts >=_tcurrent_ts and cts <= _tnext_ts order by cts limit 1;",
res_query="select * from rdb.r53 limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:10:00.000' as timestamp), ASCII(cvarchar), CHAR(cnchar), CHAR_LENGTH(cvarchar), CONCAT(cvarchar, cnchar), CONCAT_WS('--', cvarchar, cnchar), LENGTH(cnchar), LOWER(cvarchar), LTRIM(cnchar), POSITION('a' in cvarchar), REPEAT(cnchar, 3), REPLACE(cvarchar, 'a', 'b'), RTRIM(cnchar), SUBSTRING(cvarchar, 1), SUBSTR(cvarchar, 1), SUBSTRING_INDEX(cnchar, 'a', 1), TRIM(cvarchar), UPPER(cnchar) from qdb.n1 where cts='2025-01-01 00:10:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=54,
stream="create stream rdb.s54 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r54 as select _twstart ts, cint, CAST(cint as varchar(20)) c1, cuint, cts, TO_CHAR(cts, 'yyyy-mm-dd hh24:mi:ss') c2, TO_ISO8601(cts) c3, TO_TIMESTAMP(TO_CHAR(cts, 'yyyy-mm-dd'), 'yyyy-mm-dd') c4, TO_UNIXTIMESTAMP(TO_CHAR(cts, 'yyyy-mm-dd')) c5 from qdb.v1 where cts >= _twstart and cts <_twend and _tlocaltime > '2024-12-30' order by cts limit 1",
res_query="select * from rdb.r54 where tag_tbname='t1' limit 1 offset 3;",
exp_query="select cts ts, cint, CAST(cint as varchar(20)) c1, cuint, cts, TO_CHAR(cts, 'yyyy-mm-dd hh24:mi:ss') c2, TO_ISO8601(cts) c3, TO_TIMESTAMP(TO_CHAR(cts, 'yyyy-mm-dd'), 'yyyy-mm-dd') c4, TO_UNIXTIMESTAMP(TO_CHAR(cts, 'yyyy-mm-dd')) c5, 't1' from qdb.v1 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=55,
stream="create stream rdb.s55 session(ts, 4m) from tdb.t1 into rdb.r55 as select _irowts , _isfilled , _irowts_origin, interp(cts), interp(cint), interp(cuint), interp(cbigint), interp(cubigint), interp(cfloat), interp(cdouble), interp(csmallint), interp(cusmallint), interp(ctinyint) from qdb.meters partition by %%1 RANGE(_twstart) fill(linear)",
res_query="select * from rdb.r55",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36112 todo
stream = StreamItem(
id=56,
stream="create stream rdb.s56 session(ts, 4m) from tdb.v1 into rdb.r56 as select _wstart ws, _wend we, _twstart tws, _twend twe, first(c1) cf, last(c1) cl, count(c1) cc from %%trows where ts >= _twstart and ts < _twend interval(1m) fill(prev)",
res_query="select * from rdb.r56 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:05:00.000' ",
exp_query="select _wstart ws, _wend we, cast('2025-01-01 00:00:00.000' as timestamp) tws, cast('2025-01-01 00:05:00.000' as timestamp) twe, first(c1) cf, last(c1) cl, count(c1) cc from tdb.v1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:05:00.000' interval(1m) fill(prev);",
)
# # self.streams.append(stream) todo
stream = StreamItem(
id=57,
stream="create stream rdb.s57 session(ts, 4m) from tdb.triggers into rdb.r57 as select _twstart ts, cts, DAYOFWEEK(_twstart) c1, DAYOFWEEK(_twend) c2, DAYOFWEEK(cast(_tlocaltime/1000000 as timestamp)) c3, TIMEDIFF(_twstart, _twend) c4, _twduration c5, DAYOFWEEK(cvarchar) c6, TIMEDIFF(_twstart, cts) c7, TIMETRUNCATE(cts, 1d, 1) c8, WEEK(cts) c9, WEEKDAY(cts) c10, WEEKOFYEAR(cts) c11 from qdb.v5 order by cts desc limit 1",
res_query="select ts, cts, c1, c2, c4, c5, c7, c8, c9, c10, c11 from rdb.r57 limit 1 offset 2;",
exp_query="select cast('2025-01-01 00:10:00.000' as timestamp) ts, cts, DAYOFWEEK(cast('2025-01-01 00:10:00.000' as timestamp)) c1, DAYOFWEEK(cast('2025-01-01 00:15:00.000' as timestamp)) c2, -300000 c4, 300000 c5, TIMEDIFF(cast('2025-01-01 00:10:00.000' as timestamp), cts) c7, TIMETRUNCATE(cts, 1d, 1) c8, WEEK(cts) c9, WEEKDAY(cts) c10, WEEKOFYEAR(cts) c11 from qdb.v5 order by cts desc limit 1;",
)
# self.streams.append(stream)
stream = StreamItem(
id=58,
stream="create stream rdb.s58 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r58 as select interp(cbigint) from qdb.v1 where ctinyint > 0 and cint > 2 RANGE('2025-01-01 00:02:00.000', '2025-01-01 00:08:00.000') EVERY (1m) FILL(linear) limit 50;",
res_query="select * from rdb.r58",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36112 todo
stream = StreamItem(
id=59,
stream="create stream rdb.s59 session(ts, 4m) from tdb.triggers partition by id into rdb.r59 as select interp(csmallint) from qdb.meters partition by tbname where ctinyint > 0 and cint > 2 RANGE('2025-01-01 00:02:00.000') EVERY (1m) FILL(linear)",
res_query="select * from rdb.r59",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36112 todo
stream = StreamItem(
id=60,
stream="create stream rdb.s60 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r60 as select _twstart ts, RAND(), NOW(), TODAY(), TIMEZONE() from qdb.n2 where _tgrpid != 0 order by cts desc limit 1",
res_query="select ts, `timezone()`, tag_tbname from rdb.r60 where tag_tbname='t1' limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), timezone(), 't1' from qdb.n2 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=61,
stream="create stream rdb.s61 session(ts, 4m) from tdb.triggers partition by id into rdb.r61 as select _twstart ts, RAND(), NOW(), TODAY(), TIMEZONE() from qdb.n2 where _tgrpid != 0 order by cts desc limit 1",
res_query="select ts, `timezone()`, id from rdb.r61 where id=1 limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), timezone(), 1 from qdb.n2 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=62,
stream="create stream rdb.s62 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r62 as select _twstart ts, RAND(), NOW(), TODAY(), TIMEZONE() from qdb.n2 where _tgrpid != 0 order by cts desc limit 1",
res_query="select ts, `timezone()`, id, name from rdb.r62 where id=1 limit 1 offset 3;",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), timezone(), 1, '1' from qdb.n2 where cts='2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=63,
stream="create stream rdb.s63 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r63 as select _twstart ts, APERCENTILE(cint, 25) c1, AVG(cuint) c2, SUM(cint) c3, COUNT(cbigint) c4, ELAPSED(cts) c5, HYPERLOGLOG(cdouble) c6, LEASTSQUARES(csmallint, 1, 2) c7, SPREAD(ctinyint) c8, STDDEV(cutinyint) c9, STDDEV_POP(cfloat) c10, SUM(cdecimal8) c11, VAR_POP(cbigint) c12 from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select ts, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 from rdb.r63 where tag_tbname='t1'",
exp_query="select _wstart, APERCENTILE(cint, 25), AVG(cuint), SUM(cint), COUNT(cbigint), 270000, HYPERLOGLOG(cdouble), LEASTSQUARES(csmallint, 1, 2), SPREAD(ctinyint), STDDEV(cutinyint), STDDEV_POP(cfloat), VAR_POP(cbigint) from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=64,
stream="create stream rdb.s64 session(ts, 4m) from tdb.triggers partition by id into rdb.r64 as select cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from qdb.view1 where cts >= _twstart and cts < _twstart + 5m limit 1",
res_query="select cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from rdb.r64 where id = 1 limit 1",
exp_query="select cts, cint, cuint, cbigint, cubigint, cfloat, cdouble, cvarchar, csmallint, cusmallint, ctinyint, cutinyint, cbool, cnchar, cvarbinary from qdb.view1 where cts = '2025-01-01 00:00:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=65,
stream="create stream rdb.s65 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r65 as select _twstart ts, HISTOGRAM(cfloat, 'user_input', '[1, 7]', 1) th from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select ts, th from rdb.r65 where tag_tbname='t1'",
exp_query="select _wstart, HISTOGRAM(cfloat, 'user_input', '[1, 7]', 1) th from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=66,
stream="create stream rdb.s66 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r66 as select _twstart ts, FIRST(cuint), LAST(cbigint), LAST_ROW(cubigint) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r66 where tag_tbname='t1'",
exp_query="select _wstart, FIRST(cuint), LAST(cbigint), LAST_ROW(cubigint), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m) fill(null);",
)
# self.streams.append(stream)
stream = StreamItem(
id=67,
stream="create stream rdb.s67 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r67 as select _twstart ts, MAX(ctinyint), MIN(cutinyint) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r67 where tag_tbname='t1'",
exp_query="select _wstart, MAX(ctinyint), MIN(cutinyint), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m) fill(null);",
)
# self.streams.append(stream)
stream = StreamItem(
id=68,
stream="create stream rdb.s68 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r68 as select _twstart ts, mode(cint) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r68 where tag_tbname='t1'",
exp_query="select _wstart, mode(cint), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m) fill(null);",
)
# self.streams.append(stream)
stream = StreamItem(
id=69,
stream="create stream rdb.s69 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r69 as select _twstart ts, SAMPLE(cdecimal8, 1) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select count(*) from (select * from rdb.r69 where tag_tbname='t1')",
exp_query="select count(*) from (select _wstart, SAMPLE(cdecimal8, 1), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m))",
)
# self.streams.append(stream)
stream = StreamItem(
id=70,
stream="create stream rdb.s70 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r70 as select _twstart ts, BOTTOM(cint, 1) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r70 where tag_tbname='t1'",
exp_query="select _wstart, BOTTOM(cint, 1), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=71,
stream="create stream rdb.s71 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r71 as select _twstart ts, TAIL(cbigint, 1) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r71 where tag_tbname='t1' limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp), TAIL(cbigint, 1) , 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# self.streams.append(stream)
stream = StreamItem(
id=72,
stream="create stream rdb.s72 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r72 as select _twstart ts, TOP(cint, 1) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r72 where tag_tbname='t1'",
exp_query="select _wstart, TOP(cint, 1), 't1' from qdb.meters where tbname='t1' and cts >='2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=73,
stream="create stream rdb.s73 session(ts, 4m) from tdb.triggers into rdb.r73 as select _rowts, _twstart ts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r73 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=74,
stream="create stream rdb.s74 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r74 as select first(cts), _twstart, %%tbname, cint, avg(cfloat), count(cdouble), sum(cfloat), twa(cdouble) from qdb.meters where cts >= _twstart and cts < _twstart + 5m and tbname = %%1 group by cint having count(cdouble) == 1 order by first(cts);",
res_query="select `first(cts)`, cint, `avg(cfloat)`, `count(cdouble)`, `sum(cfloat)`, `twa(cdouble)` from rdb.r74 where tag_tbname='t1'",
exp_query="select first(cts), cint, avg(cfloat), count(cdouble), sum(cfloat), twa(cdouble) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname = 't1' group by cint having count(cdouble) == 1 order by first(cts);",
)
# self.streams.append(stream)
stream = StreamItem(
id=75,
stream="create stream rdb.s75 session(ts, 4m) from tdb.vtriggers partition by id into rdb.r75 as select _wstart, twa(k),avg(k),count(1) from tdb.vtriggers where id=%%1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) fill(prev)",
res_query="select * from rdb.r75",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=76,
stream="create stream rdb.s76 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r76 as select _twstart ts, ST_GeomFromText('POINT (2.000000 2.000000)'), ST_AsText(cgeometry), ST_Contains(cgeometry, cgeometry), ST_ContainsProperly(cgeometry, cgeometry), ST_Covers(cgeometry, cgeometry), ST_Equals(cgeometry, cgeometry), ST_Intersects(cgeometry, cgeometry), ST_Touches(cgeometry, cgeometry) from qdb.meters where tbname='t4' and cts >=_tcurrent_ts and cts <= _tnext_ts order by cts limit 1;",
res_query="select * from rdb.r76 limit 1 offset 3",
exp_query="select cast('2025-01-01 00:15:00.000' as timestamp), ST_GeomFromText('POINT (2.000000 2.000000)'), ST_AsText(cgeometry), ST_Contains(cgeometry, cgeometry), ST_ContainsProperly(cgeometry, cgeometry), ST_Covers(cgeometry, cgeometry), ST_Equals(cgeometry, cgeometry), ST_Intersects(cgeometry, cgeometry), ST_Touches(cgeometry, cgeometry), 1, '1' from qdb.t4 where cts='2025-01-01 00:15:00.000';",
)
# # self.streams.append(stream)TD-35766 todo
stream = StreamItem(
id=77,
stream="create stream rdb.s77 session(ts, 4m) from tdb.vtriggers partition by id into rdb.r77 as select _twstart ts, count(*) c1 from information_schema.ins_streams where stream_name='s77'",
res_query="select ts, c1 > 0, 1000 from rdb.r77 where id='1'",
exp_query="select _wstart ts, true, count(cint) from qdb.meters where cts >= '2025-01-01 00:00:00' and cts < '2025-01-01 00:35:00' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=78,
stream="create stream rdb.s78 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r78 as select _twstart, _twrownum, count(*), sum(cdecimal8) from qdb.meters where tbname !=%%1 and cts >= _twstart and cts < _twstart + 5m and _twrownum > 0;",
check_func=self.check78,
)
# self.streams.append(stream)
stream = StreamItem(
id=79,
stream="create stream rdb.s79 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r79 as select _twstart, sum(cdecimal8), count(*), _twrownum from qdb.meters where tbname=%%1 and cts >= _twstart and cts < _twstart + 5m and _twrownum > 0;",
res_query="select `_twstart`, `sum(cdecimal8)`, `count(*)` from rdb.r79 where tag_tbname='t1' limit 3",
exp_query="select _wstart ts, sum(cdecimal8), count(*) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m) limit 3",
check_func=self.check79,
)
# self.streams.append(stream)
stream = StreamItem(
id=80,
stream="create stream rdb.s80 session(ts, 4m) from tdb.triggers into rdb.r80 as select _twstart, sum(v1), sum(v2) from (select count(c1) v1, sum(c2) v2 from %%trows)",
check_func=self.check80,
)
# self.streams.append(stream)
stream = StreamItem(
id=81,
stream="create stream rdb.s81 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r81 as select cts, diff(cint) c3, _twstart, _twend, _twrownum from qdb.meters where tbname=%%1 and cts >= _twstart and cts <= _twend and cint > 5 and _twrownum > 0 ",
res_query="select cts, c3 from rdb.r81 where tag_tbname='t1' and cts <= '2025-01-01 00:14:30.000';",
exp_query="select cts, diff(cint) c3 from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts <= '2025-01-01 00:14:30.000' and tbname='t1' and cint > 5;",
check_func=self.check81,
)
# self.streams.append(stream)
stream = StreamItem(
id=82,
stream="create stream rdb.s82 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r82 as select cts, diff(cint) c3, _twstart, _twend, _twrownum from qdb.meters where tbname=%%1 and cts >= _twstart and cts <= _twend and cint > 5",
res_query="select cts, c3 from rdb.r82 where tag_tbname='t1';",
exp_query="select cts, diff(cint) c3 from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts <= '2025-01-01 00:35:00.000' and tbname='t1' and cint > 5;",
)
# self.streams.append(stream)
stream = StreamItem(
id=83,
stream="create stream rdb.s83 session(ts, 4m) from tdb.t1 into rdb.r83 as select ts, diff(c1) c3 from %%trows ",
res_query="select * from rdb.r83",
exp_query="select ts, diff(c1) from tdb.t1 where ts >= '2025-01-01 00:30:00.000' and ts <= '2025-01-01 00:32:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=84,
stream="create stream rdb.s84 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r84 as select cts, top(cint, 5) from qdb.meters where tbname=%%1 and cts >= _twstart and cts <= _twend order by cint limit 2 offset 2;",
res_query="select cts, `top(cint, 5)` from rdb.r84 where tag_tbname='t1' limit 2",
exp_query="select cts, top(cint, 5) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts <= '2025-01-01 00:05:00.000' and tbname='t1' order by cint limit 2 offset 2;",
)
# self.streams.append(stream)
stream = StreamItem(
id=85,
stream="create stream rdb.s85 session(ts, 4m) from tdb.triggers partition by id into rdb.r85 as select cts, top(cint, 5) from qdb.meters where tint=%%1 and cts >= _twstart and cts < _twstart + 5m order by cint limit 2 offset 2;",
res_query="select cts, `top(cint, 5)` from rdb.r85 where id=1 limit 1",
exp_query="select cts, top(cint, 5) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and tint=1 order by cint limit 1 offset 2;",
)
# self.streams.append(stream)
stream = StreamItem(
id=86,
stream="create stream rdb.s86 session(ts, 4m) from tdb.n1 into rdb.r86 as select ts, top(c1, 5) from %%trows limit 1 offset 1;",
res_query="select * from rdb.r86",
exp_query="select ts, top(c1, 5) from tdb.n1 where ts >= '2025-01-01 00:25:00.000' and ts <= '2025-01-01 00:27:00.000' limit 1 offset 1;",
)
# self.streams.append(stream)
stream = StreamItem(
id=87,
stream="create stream rdb.s87 session(ts, 4m) from tdb.t1 into rdb.r87 as select last(cts, cint, cuint) from qdb.t1 where cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r87",
exp_query="select last(cts, cint, cuint) from qdb.t1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=88,
stream="create stream rdb.s88 session(ts, 4m) from tdb.v1 into rdb.r88 as select from select cast(avg(f) as int) b from view1 group by a having avg(f) > 100111 order by b",
res_query="select * from rdb.r88",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=89,
stream="create stream rdb.s89 session(ts, 4m) from tdb.v1 into rdb.r89 as select rand() from %%trows where rand() >= 0 and rand() < 1 _c0, _rowts;",
res_query="select * from rdb.r89",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=90,
stream="create stream rdb.s90 session(ts, 4m) from tdb.triggers partition by id into rdb.r90 as select _twstart ts, sum(tint), sum(t1), sum(t2) from (select _twstart, tint, count(val) t1, sum(val) t2 from (select _wstart, tint, count(cint) val from qdb.meters where tint=%%1 and (cts between _twstart and _twend) partition by tint interval(1m) having (count(cint) > 0)) tb partition by tint having count(tint) > 0)",
res_query="select ts, `sum(tint)`, `sum(t1)`, `sum(t2)` from rdb.r90 where id=1 limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp) ts, sum(tint), sum(t1), sum(t2) from (select cast('2025-01-01 00:00:00.000' as timestamp) ts, tint, count(val) t1, sum(val) t2 from (select _wstart, tint, count(cint) val from qdb.meters where tint=1 and (cts between '2025-01-01 00:00:00.000' and '2025-01-01 00:05:00.000') partition by tint interval(1m) having (count(cint) > 0)) tb partition by tint having count(tint) > 0);",
)
# self.streams.append(stream)
stream = StreamItem(
id=91,
stream="create stream rdb.s91 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r91 as select _twstart, id cid, name cname, sum(c1) amount from %%trows where ts between _twstart and _twend and id=%%1 and name=%%1 partition by id, name having sum(c1) <= 5;",
res_query="select * from rdb.r91",
exp_query="select _wstart, id, name, sum(c1), id, name from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' partition by tbname interval(5m) having sum(c1) <= 5;",
)
# self.streams.append(stream)
stream = StreamItem(
id=92,
stream="create stream rdb.s92 session(ts, 4m) from tdb.n1 as select _twstart, tint, %%tbname, sum(cint) amount from qdb.meters where tbname=%%tbname and ts between _twstart and _twend partition by tbname having sum(cint) > 50",
res_query="select * from rdb.r92",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=93,
stream="create stream rdb.s93 session(ts, 4m) from tdb.v1 into rdb.r93 as select _twstart, sum(cnt) from (select _twstart ts, count(*) cnt from information_schema.ins_tables where db_name='qdb' union all select _twstart ts, count(*) cnt from information_schema.ins_tables where db_name='tdb')",
res_query="select `_twstart`, `sum(cnt)`, 10 from rdb.r93",
exp_query="select _wstart, 135, count(cint) from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=94,
stream="create stream rdb.s94 session(ts, 4m) from tdb.v1 into rdb.r94 as select diff(faev) from (select _ts, faev, deviceid from demo union all select _ts + 1s, faev, deviceid from %%trows order by faev, _ts, deviceid) partition by faev",
res_query="select * from rdb.r94",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=95,
stream="create stream rdb.s95 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r95 as select _twstart, _twend, last(cts, cint, cuint) from qdb.meters where tbname=%%1 and cts >= _twstart and cts < _twstart + 5m",
res_query="select * from rdb.r95 where tag_tbname='t1'",
exp_query="select _wstart, _wend, last(cts, cint, cuint), 't1' from qdb.t1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=96,
stream="create stream rdb.s96 session(ts, 4m) from tdb.t1 into rdb.r96(ts timestamp, te timestamp, ti int composite key, tx bigint, ty bigint) as select _twstart ts, _twend te, tint ti, sum(c1) tx, count(c2) ty from (select tbname, tint, count(cint) c1, sum(cint) c2 from qdb.meters where cts >= _twstart and cts < _twstart + 5m partition by tbname, tint)",
res_query="select * from rdb.r96",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=97,
stream="create stream rdb.s97 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r97 as select _twstart, cts, cint, cuint, cbool from qdb.meters where tbname=%%1 and cint > 1 and cint >= 1 and cint < 10000 and cint <= 100000 and cint <> 1 and cint != 1 and cint is NOT NULL and cts BETWEEN _twstart AND _twend order by cts desc limit 1",
res_query="select * from rdb.r97 where tag_tbname='t1' limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp), cts, cint, cuint, cbool, tbname from qdb.meters where tbname='t1' and cint > 1 and cint >= 1 and cint < 10000 and cint <= 100000 and cint <> 1 and cint != 1 and cint is NOT NULL and cts BETWEEN '2025-01-01 00:00:00.000' AND '2025-01-01 00:05:00.000' order by cts desc limit 1",
)
# self.streams.append(stream)
stream = StreamItem(
id=98,
stream="create stream rdb.s98 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r98 as select last(cts, cint, cbool) from qdb.jmeters where cts >= _twstart and cts < _twstart + 5m and tjson->'k1'='v1' partition by tjson->'k1'",
res_query="select `last(cts)`, `last(cint)`, `last(cbool)` from rdb.r98 where id=1",
exp_query="select last(cts, cint, cbool) from qdb.jmeters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tjson->'k1'='v1' partition by tjson->'k1' interval(5m);",
)
# self.streams.append(stream)
stream = StreamItem(
id=99,
stream="create stream rdb.s99 session(ts, 4m) from tdb.triggers into rdb.r99 as (select cts, cint from qdb.t1 where cts >= _twstart and cts <= _twend limit 1 offset 0) union all (select cts, cint from qdb.t2 where cts >= _twstart and cts <= _twend limit 1 offset 2) union all (select cts, cint from qdb.t3 where cts >= _twstart and cts <= _twend limit 1 offset 4)",
res_query="select * from rdb.r99 limit 3",
exp_query="select * from (select cts, cint from qdb.t1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' limit 1 offset 0) union all (select cts, cint from qdb.t2 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' limit 1 offset 2) union all (select cts, cint from qdb.t3 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' limit 1 offset 4) order by cts;",
)
# self.streams.append(stream)
stream = StreamItem(
id=100,
stream="create stream rdb.s100 session(ts, 4m) from tdb.v1 into rdb.r100 as select json, to_json from %%trows where BETWEEN AND",
res_query="select * from rdb.r100",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=101,
stream="create stream rdb.s101 session(ts, 4m) from tdb.v1 into rdb.r101 as select 1&2, 2|3 and or && || case from tdb.v1 limit 1 offset 1 ",
res_query="select * from rdb.r101",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=102,
stream="create stream rdb.s102 session(ts, 4m) from tdb.t1 into rdb.r102 as select cols(last(ts), ts, c0), count(1) {t1} from {from_table} group by t1 order by t1",
res_query="select * from rdb.r102",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=103,
stream="create stream rdb.s103 session(ts, 4m) from tdb.vtriggers partition by tbname into rdb.r103 as select cvarchar like 'a', not like, regexp, not regexp from tdb.vtriggers where tbname=%%tbname limit 1 offset 1 ",
res_query="select * from rdb.r103",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=104,
stream="create stream rdb.s104 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r104 as select _wstart ts, CASE c1 WHEN 0 THEN 'Running' WHEN 5 THEN 'Warning' ELSE 'Unknown' END t1, c1 & c2 t2, c1 | c2 t3, (c1 != 0 or c2 <> 0) t4 from %%trows",
res_query="select ts, t1, t2, t3, t4 from rdb.r104 where tag_tbname='t1' limit 3",
exp_query="select ts, CASE c1 WHEN 0 THEN 'Running' WHEN 5 THEN 'Warning' ELSE 'Unknown' END t1, c1 & c2 t2, c1 | c2 t3, (c1 != 0 or c2 <> 0) t4 from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:15:00.000';",
)
# self.streams.append(stream)
stream = StreamItem(
id=105,
stream="create stream rdb.s105 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r105 as select t1, c11, c12, t2, c21, c22, _twstart, _twend from (select cols(last_row(cint), cts as t1, cuint as c11), last_row(cint) c12, cols(first(cint), cts as t2, cuint c21), first(cint) c22 from qdb.meters where tbname='t1' and cts >= _twstart and cts < _twstart + 5m)",
check_func=self.check105,
)
# self.streams.append(stream)
stream = StreamItem(
id=106,
stream="create stream rdb.s106 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r106 as select _twstart, cts, concat(cvarchar, cnchar), cint + cuint, ctinyint - cdouble, cfloat * cdouble, cbigint * 12, -ctinyint from qdb.meters where tbname=%%tbname limit 1 offset 1;",
res_query="select * from rdb.r106 where tag_tbname='t1' limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp) ts, cts, concat(cvarchar, cnchar), cint + cuint, ctinyint - cdouble, cfloat * cdouble, cbigint * 12, -ctinyint, tbname from qdb.t1 limit 1 offset 1;",
)
# self.streams.append(stream)
stream = StreamItem(
id=107,
stream="create stream rdb.s107 session(ts, 4m) from tdb.triggers into rdb.r107 as select _twstart, cts, cvarchar like 'SanFrancisco', cnchar not like 'SanFrancisco', cvarchar regexp '%co', cnchar not regexp '%co' from qdb.t5 limit 1 offset 2;",
res_query="select * from rdb.r107 limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp) ts, cts, cvarchar like 'SanFrancisco', cnchar not like 'SanFrancisco', cvarchar regexp '%co', cnchar not regexp '%co' from qdb.t5 limit 1 offset 2;",
)
# self.streams.append(stream)
stream = StreamItem(
id=108,
stream="create stream rdb.s108 session(ts, 4m) from tdb.t1 into rdb.r108 as select _twstart, count(cts), first(cuint), last(cuint), sum(cuint), tbname from qdb.meters where tbname in ('t1', 't2', 't3', 't4') and cts >= _twstart and cts < _twstart + 5m partition by tbname slimit 1 soffset 2",
res_query="select * from rdb.r108 limit 1",
exp_query="select cast('2025-01-01 00:00:00.000' as timestamp) ts, count(cts), first(cuint), last(cuint), sum(cuint), tbname from qdb.meters where tbname in ('t1', 't2', 't3', 't4') and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' partition by tbname slimit 1 soffset 2",
)
# self.streams.append(stream)
stream = StreamItem(
id=109,
stream="create stream rdb.s109 session(ts, 4m) from tdb.v1 into rdb.r109 as select tb1.nchar_16_col from test_vtable_join.vtb_virtual_ctb_1 as tb1 join test_vtable_join.vtb_virtual_ctb_2 as tb2 on tb1.ts=tb2.ts where tb1.nchar_16_col is not null group by tb1.nchar_16_col having tb1.nchar_16_col is not null order by 1 slimit 20 limit 20",
res_query="select * from rdb.r109",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=110,
stream="create stream rdb.s110 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r110 as (select _twstart, count(cts), first(cuint), last(cuint), sum(cuint), tbname from qdb.meters where tbname in ('t1', 't2', 't3', 't4') and cts >= _twstart and cts < _twstart + 5m partition by tbname slimit 1 soffset 2) union (select _twstart + 1m, count(cts), first(cuint), last(cuint), sum(cuint), tbname from qdb.meters where tbname in ('t1', 't2', 't3', 't4') and cts >= _twstart and cts < _twstart + 5m partition by tbname slimit 1 soffset 3)",
res_query="select `_twstart`, `count(cts)`, `first(cuint)`, `last(cuint)`, `sum(cuint)` from rdb.r110 where tag_tbname='t1' limit 1 offset 1",
exp_query="select cast('2025-01-01 00:01:00.000' as timestamp) ts, count(cts), first(cuint), last(cuint), sum(cuint) from qdb.meters where tbname in ('t1', 't2', 't3', 't4') and cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' partition by tbname slimit 1 soffset 3",
)
# self.streams.append(stream)
stream = StreamItem(
id=111,
stream="create stream rdb.s111 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r111 as select _wstart, _wend, _twstart, _twend, csmallint, count(cts), count(cbool) from qdb.meters where cts >= _twstart and cts < _twstart + 5m partition by tbname state_window(csmallint)",
res_query="select * from rdb.r111 where `_wstart` >= '2025-01-01 00:00:00.000' and `_wstart` < '2025-01-01 00:05:00.000' and tag_tbname='t1';",
exp_query="select _wstart, _wend, cast('2025-01-01 00:00:00.000' as timestamp) t1, cast('2025-01-01 00:05:00.000' as timestamp) t2, csmallint, count(cts), count(cbool), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and tbname='t1' partition by tbname STATE_WINDOW(csmallint);",
)
# self.streams.append(stream)
stream = StreamItem(
id=112,
stream="create stream rdb.s112 session(ts, 4m) from tdb.t1 into rdb.r112 as select tb1.nchar_16_col from test_vtable_join.vtb_virtual_ctb_1 as tb1 join test_vtable_join.vtb_virtual_ctb_2 as tb2 on tb1.ts=tb2.ts where tb1.nchar_16_col is not null group by tb1.nchar_16_col having tb1.nchar_16_col is not null order by 1 slimit 20 limit 20",
res_query="select * from rdb.r112",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=113,
stream="create stream rdb.s113 session(ts, 4m) from tdb.t1 into rdb.r113 as select _wstart, _wend, _twstart, _twend, first(csmallint), count(cts), count(cbool) from qdb.t1 where cts >= _twstart and cts < _twstart + 5m and csmallint = 2 session(cts, 40s);",
res_query="select * from rdb.r113 where `_wstart` >= '2025-01-01 00:00:00.000' and `_wstart` < '2025-01-01 00:05:00.000' ",
exp_query="select _wstart, _wend, cast('2025-01-01 00:00:00.000' as timestamp) t1, cast('2025-01-01 00:05:00.000' as timestamp) t2, first(csmallint), count(cts), count(cbool) from qdb.t1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' and csmallint = 2 partition by tbname session(cts, 40s);",
)
# self.streams.append(stream)
stream = StreamItem(
id=114,
stream="create stream rdb.s114 session(ts, 4m) from tdb.v1 into rdb.r114 as show dnode 1 variables like 'bypassFlag'",
res_query="select * from rdb.r114",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=115,
stream="create stream rdb.s115 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r115 as SELECT a.voltage, sum(cint) FROM ct_join_1 a left JOIN ct_join_2 b ON a.ts = b.ts group by a.voltage having b.voltage > 14;",
res_query="select * from rdb.r115",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=116,
stream="create stream rdb.s116 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r116 as select _wstart, _wend, _twstart, _twend, _wduration, first(csmallint), count(cts), count(cbool) from qdb.meters where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m partition by tbname event_window start with csmallint = 1 end with csmallint = 2;",
res_query="select * from rdb.r116 where tag_tbname='t1' and `_wstart` >= '2025-01-01 00:00:00.000' and `_wstart` < '2025-01-01 00:05:00.000';",
exp_query="select _wstart, _wend, cast('2025-01-01 00:00:00.000' as timestamp) t1, cast('2025-01-01 00:05:00.000' as timestamp) t2, _wduration, first(csmallint), count(cts), count(cbool), 't1' from qdb.t1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000' event_window start with csmallint = 1 end with csmallint = 2;",
)
# self.streams.append(stream)
stream = StreamItem(
id=117,
stream="create stream rdb.s117 session(ts, 4m) from tdb.t1 into rdb.r117 as select t1.ts, t2.ts from db1_st1 t1 right asof join db1_st2 t2 where t1.v_int >= 0 and (cos(t2.t_double) >= 0 or cos(t2.t_double) < 0) order by t1.ts, t2.ts;",
res_query="select * from rdb.r117",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) cases/13-StreamProcessing/07-SubQuery/test_subquery_sliding_bug5.py
stream = StreamItem(
id=118,
stream="create stream rdb.s118 session(ts, 4m) from tdb.v1 into rdb.r118 as select t1.ts, t2.ts from qdb.v1 t1 right asof join from qdb.v2 t2 where t1.v_int >= 0 and (cos(t2.t_double) >= 0 or cos(t2.t_double) < 0) order by t1.ts, t2.ts;",
res_query="select * from rdb.r118",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=119,
stream="create stream rdb.s119 session(ts, 4m) from tdb.v1 into rdb.r119 as select dictintc from qdb.meters where tbname in(%%tbname) _qstart, _qend, _c0, _rowts",
res_query="select * from rdb.r119",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=120,
stream="create stream rdb.s120 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r120 as select _wend, sum(cint) from (select t1.ts ts1, t2.ts ts2, t1.v_bigint v_bigint1, t2.v_bigint v_bigint2, t1.tbname from db1_st1 t1 left window join db1_st2 t2 window_offset(-100a, 100a) jlimit 10 order by t1.ts) where v_bigint1 + v_bigint2 > 0 and ts1 between '2025-01-01 12:00:00.400' and now and ts2 != '2025-01-01 12:00:00.300' partition by tbname interval(1s) order by _wend;",
res_query="select * from rdb.r120",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) cases/13-StreamProcessing/07-SubQuery/test_subquery_sliding_bug5.py todo
stream = StreamItem(
id=121,
stream="create stream rdb.s121 session(ts, 4m) from tdb.triggers partition by id into rdb.r121 as select first(ts2), tbname, sum(v_int) from (select t1.ts ts1, t2.ts ts2, t2.v_int, t2.tbname from db1_st1 t1 right join db1_st2 t2 on t1.ts=t2.ts and t2.ts <= now and (t2.v_binary like '%abc%' or t2.v_binary not like '%abc%') where t2.v_binary like '%abc%' or t2.v_binary not like '%abc%') group by tbname order by tbname;",
res_query="select * from rdb.r121",
exp_query="select _wstart, sum(cint), count(cint), tbname from qdb.meters where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:35:00.000' and tbname='t1' partition by tbname interval(5m);",
)
# # self.streams.append(stream) TD-36111
stream = StreamItem(
id=122,
stream="create stream rdb.s122 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r122 as select first(tats), last(tbts), count(tat1), sum(tat1), first(tbt1), last(tbt1) from (select ta.cts tats, tb.cts tbts, ta.cint tat1, tb.cint tbt1 from qdb.t1 ta left join qdb.t2 tb on ta.cts=tb.cts and (ta.cint >= tb.cint) order by ta.cts) where tats >= _twstart and tats < _twend",
res_query="select * from rdb.r122 where tag_tbname='t1';",
exp_query="select first(tats), last(tbts), count(tat1), sum(tat1), first(tbt1), last(tbt1), 't1' from (select ta.cts tats, tb.cts tbts, ta.cint tat1, tb.cint tbt1 from qdb.t1 ta left join qdb.t2 tb on ta.cts=tb.cts and (ta.cint >= tb.cint) order by ta.cts) where tats >= '2025-01-01 00:00:00.000' and tats < '2025-01-01 00:35:00.000' interval(5m);",
)
# # self.streams.append(stream) cases/13-StreamProcessing/07-SubQuery/test_subquery_sliding_bug5.py
stream = StreamItem(
id=123,
stream="create stream rdb.s123 session(ts, 4m) from tdb.triggers partition by id, name into rdb.r123 as select _wstart tw, _wend te, _twstart, _twend, count(c1) c1, sum(c2) c2 from %%trows interval(1m)",
res_query="select tw, te, c1, c2 from rdb.r123 where id=1",
exp_query="select _wstart, _wend, count(c1), sum(c2) from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:35:00.000' interval(1m);",
check_func=self.check123,
)
# self.streams.append(stream)
stream = StreamItem(
id=124,
stream="create stream rdb.s124 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r124 as select _wstart ts, count(c1), sum(c2) from %%trows where ts >= _twstart and ts < _twend interval(1m) fill(prev)",
res_query="select * from rdb.r124 where tag_tbname='t1' limit 15;",
exp_query="select _wstart, count(c1), sum(c2), 't1' from tdb.t1 where ts >= '2025-01-01 00:00:00.000' and ts < '2025-01-01 00:15:00.000' interval(1m) fill(prev);",
)
# self.streams.append(stream)
stream = StreamItem(
id=125,
stream="create stream rdb.s125 session(ts, 4m) from tdb.v1 into rdb.r125 as select _rowts, _twstart ts, DERIVATIVE(cbigint, 5, 0) from qdb.v1 where cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r125 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=126,
stream="create stream rdb.s126 session(ts, 4m) from tdb.v1 into rdb.r126 as select _rowts, _twstart ts, IRATE(cubigint) from %%trows where cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r126 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=127,
stream="create stream rdb.s127 session(ts, 4m) from tdb.vtriggers into rdb.r127 as select _rowts, _twstart ts, MAVG(cfloat, 1) from %%trows where cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r127 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=128,
stream="create stream rdb.s128 session(ts, 4m) from tdb.triggers partition by tbname into rdb.r128 as select _rowts, _twstart ts, STATECOUNT(cdouble, 'LT', 5) from vdb.triggers where tbname=%%tbname and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r128 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=129,
stream="create stream rdb.s129 session(ts, 4m) from tdb.triggers partition by id into rdb.r129 as select _c0, _twstart ts, STATEDURATION(cusmallint, 'LT', 5, 1m) from vdb.triggers where tint=%%1 and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r129 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
stream = StreamItem(
id=130,
stream="create stream rdb.s130 session(ts, 4m) from tdb.vtriggers partition by tbname into rdb.r130 as select _c0, _twstart ts, TWA(ctinyint) from vdb.triggers where tbname=%%1 and cts >= _twstart and cts < _twstart + 5m;",
res_query="select * from rdb.r130 limit 1 offset 3",
exp_query="select _rowts, CSUM(cint) + CSUM(cuint) from qdb.v1 where cts >= '2025-01-01 00:00:00.000' and cts < '2025-01-01 00:05:00.000'",
)
# # self.streams.append(stream) TD-36397
tdLog.info(f"create total:{len(self.streams)} streams")
for stream in self.streams:
stream.createStream()
def check0(self):
tdSql.checkTableType(
dbname="rdb", tbname="r0", typename="NORMAL_TABLE", columns=4
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r0",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
],
)
def check1(self):
tdSql.checkTableType(
dbname="rdb", tbname="r1", typename="NORMAL_TABLE", columns=8
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r1",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["td", "BIGINT", 8, ""],
["tw", "BIGINT", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "BIGINT", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
],
)
tdSql.checkResultsBySql(
sql="select ts, tw from rdb.r1;",
exp_sql="select _wstart, count(*) from tdb.triggers where ts >= '2025-01-01 00:00:00' and ts < '2025-01-01 00:35:00' interval(5m) fill(value, 0);",
)
def check2(self):
tdSql.checkTableType(
dbname="rdb",
stbname="r2",
columns=9,
tags=1,
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r2",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["td", "BIGINT", 8, ""],
["tw", "BIGINT", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "TIMESTAMP", 8, ""],
["tb", "VARCHAR", 270, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
["tag_tbname", "VARCHAR", 270, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tags where db_name='rdb' and stable_name='r2' and tag_name='tag_tbname' and (tag_value='t1' or tag_value='t2');",
func=lambda: tdSql.getRows() == 2,
)
tdSql.checkResultsByFunc(
sql="select ts, te, td, c1, tag_tbname from rdb.r2 where tag_tbname='t2'",
func=lambda: tdSql.getRows() == 1
and tdSql.compareData(0, 0, "2025-01-01 00:10:00.000")
and tdSql.compareData(0, 1, "2025-01-01 00:15:00.000")
and tdSql.compareData(0, 2, 300000)
and tdSql.compareData(0, 3, 10)
and tdSql.compareData(0, 4, "t2"),
)
def check3(self):
tdSql.checkTableType(
dbname="rdb",
stbname="r3",
columns=8,
tags=1,
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r3",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["td", "BIGINT", 8, ""],
["tw", "BIGINT", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "TIMESTAMP", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
["tag_tbname", "VARCHAR", 270, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tags where db_name='rdb' and stable_name='r3' and tag_name='tag_tbname';",
func=lambda: tdSql.getRows() == 2,
)
tdSql.checkResultsByFunc(
sql="select ts, te, td, c1, tag_tbname from rdb.r3 where tag_tbname='t2'",
func=lambda: tdSql.getRows() == 1
and tdSql.compareData(0, 0, "2025-01-01 00:10:00.000")
and tdSql.compareData(0, 1, "2025-01-01 00:15:00.000")
and tdSql.compareData(0, 2, 300000)
and tdSql.compareData(0, 3, 1000)
and tdSql.compareData(0, 4, "t2"),
)
def check4(self):
tdSql.checkTableType(
dbname="rdb",
stbname="r4",
columns=8,
tags=1,
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r4",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["td", "BIGINT", 8, ""],
["tw", "BIGINT", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "TIMESTAMP", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
["tag_tbname", "VARCHAR", 270, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tags where db_name='rdb' and stable_name='r4' and tag_name='tag_tbname';",
func=lambda: tdSql.getRows() == 2,
)
tdSql.checkResultsByFunc(
sql="select ts, te, td, c1, tag_tbname from rdb.r4 where tag_tbname='t2'",
func=lambda: tdSql.getRows() == 1
and tdSql.compareData(0, 0, "2025-01-01 00:10:00.000")
and tdSql.compareData(0, 1, "2025-01-01 00:15:00.000")
and tdSql.compareData(0, 2, 300000)
and tdSql.compareData(0, 3, 10)
and tdSql.compareData(0, 4, "t2"),
)
def check5(self):
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tags where db_name='rdb' and stable_name='r5' and tag_name='tag_tbname';",
func=lambda: tdSql.getRows() == 2,
)
tdSql.checkResultsByFunc(
sql="select ts, te, td, c1, tag_tbname from rdb.r5 where tag_tbname='t2'",
func=lambda: tdSql.getRows() == 1
and tdSql.compareData(0, 0, "2025-01-01 00:10:00.000")
and tdSql.compareData(0, 1, "2025-01-01 00:15:00.000")
and tdSql.compareData(0, 2, 300000)
and tdSql.compareData(0, 3, 2)
and tdSql.compareData(0, 4, "t2"),
)
def check10(self):
tdSql.checkTableSchema(
dbname="rdb",
tbname="r10",
schema=[
["ts", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["td", "BIGINT", 8, ""],
["tw", "BIGINT", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "TIMESTAMP", 8, ""],
["t1_data", "INT", 4, ""],
["t2_data", "VARCHAR", 270, ""],
["tb_data", "VARCHAR", 270, ""],
["c1_data", "BIGINT", 8, ""],
["c2_data", "DOUBLE", 8, ""],
["id", "INT", 4, "TAG"],
["tag_tbname", "VARCHAR", 270, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tags where db_name='rdb' and stable_name='r10' and tag_name='tag_tbname';",
func=lambda: tdSql.getRows() == 2,
)
tdSql.checkResultsByFunc(
sql="select * from rdb.r10 where tag_tbname='t2'",
func=lambda: tdSql.getRows() == 1,
)
def check11(self):
tdSql.checkTableSchema(
dbname="rdb",
tbname="r11",
schema=[
["tc", "TIMESTAMP", 8, ""],
["tp", "TIMESTAMP", 8, ""],
["tn", "TIMESTAMP", 8, ""],
["tg", "BIGINT", 8, ""],
["tl", "TIMESTAMP", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "DOUBLE", 8, ""],
],
)
def check12(self):
tdSql.checkTableType(
dbname="rdb",
stbname="r12",
columns=7,
tags=1,
)
tdSql.checkTableSchema(
dbname="rdb",
tbname="r12",
schema=[
["ts", "TIMESTAMP", 8, ""],
["tb", "VARCHAR", 270, ""],
["%%1", "VARCHAR", 270, ""],
["v1", "BIGINT", 8, ""],
["v2", "DOUBLE", 8, ""],
["v3", "INT", 4, ""],
["v4", "INT", 4, ""],
["tag_tbname", "VARCHAR", 270, "TAG"],
],
)
def check16(self):
tdSql.checkResultsByFunc(
sql="select * from rdb.r16",
func=lambda: tdSql.getRows() == 4,
)
def check40(self):
tdSql.checkResultsByFunc(
"select * from rdb.r40;", func=lambda: tdSql.getRows() == 8
)
def check41(self):
tdSql.checkTableSchema(
dbname="rdb",
tbname="r41",
schema=[
["cts", "TIMESTAMP", 8, ""],
["cint", "INT", 4, ""],
["cbool", "BOOL", 1, ""],
["cjson", "VARCHAR", 8, ""],
["_twstart", "TIMESTAMP", 8, ""],
["id", "INT", 4, "TAG"],
],
)
def check46(self):
tdSql.checkResultsByFunc(
sql="select ts, ccnt, csum from rdb.r46;",
func=lambda: tdSql.getRows() == 7
and tdSql.compareData(0, 0, "2025-01-01 00:00:00.000")
and tdSql.compareData(0, 1, 1)
and tdSql.compareData(0, 2, 0)
and tdSql.compareData(1, 0, "2025-01-01 00:05:00.000")
and tdSql.compareData(1, 1, 1)
and tdSql.compareData(1, 2, 50)
and tdSql.compareData(6, 0, "2025-01-01 00:30:00.000")
and tdSql.compareData(6, 1, 2)
and tdSql.compareData(6, 2, 620),
)
def check78(self):
tdSql.checkTableSchema(
dbname="rdb",
tbname="r78",
schema=[
["_twstart", "TIMESTAMP", 8, ""],
["_twrownum", "BIGINT", 8, ""],
["count(*)", "BIGINT", 8, ""],
["sum(cdecimal8)", "DECIMAL(38, 0)", 16, ""],
["id", "INT", 4, "TAG"],
["name", "VARCHAR", 16, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select count(*) from rdb.r78 where id != 2;",
func=lambda: tdSql.compareData(0, 0, 7),
)
def check79(self):
tdSql.checkResultsByFunc(
sql="select `_twstart`, `sum(cdecimal8)`, `count(*)` from rdb.r79 where tag_tbname='t1';",
func=lambda: tdSql.getRows() == 7
and tdSql.compareData(3, 0, "2025-01-01 00:15:00.000")
and tdSql.compareData(3, 1, None)
and tdSql.compareData(3, 2, 0)
and tdSql.compareData(4, 0, "2025-01-01 00:20:00.000")
and tdSql.compareData(4, 1, None)
and tdSql.compareData(4, 2, 0)
and tdSql.compareData(5, 0, "2025-01-01 00:25:00.000")
and tdSql.compareData(5, 1, None)
and tdSql.compareData(5, 2, 0)
and tdSql.compareData(6, 0, "2025-01-01 00:30:00.000")
and tdSql.compareData(6, 1, 56)
and tdSql.compareData(6, 2, 10),
)
def check80(self):
tdSql.checkResultsByFunc(
sql="select * from rdb.r80;",
func=lambda: tdSql.getRows() == 7
and tdSql.compareData(0, 0, "2025-01-01 00:00:00.000")
and tdSql.compareData(0, 1, 1)
and tdSql.compareData(0, 2, 0)
and tdSql.compareData(1, 0, "2025-01-01 00:05:00.000")
and tdSql.compareData(1, 1, 1)
and tdSql.compareData(1, 2, 50)
and tdSql.compareData(6, 0, "2025-01-01 00:30:00.000")
and tdSql.compareData(6, 1, 2)
and tdSql.compareData(6, 2, 620),
)
def check81(self):
tdSql.checkResultsByFunc(
sql="select count(*) from rdb.r81 where tag_tbname='t1';",
func=lambda: tdSql.compareData(0, 0, 34),
)
def check84(self):
tdSql.checkResultsByFunc(
sql="select * from rdb.r84 where tag_tbname='t1';",
func=lambda: tdSql.getRows() == 14,
)
def check123(self):
tdSql.checkTableSchema(
dbname="rdb",
tbname="r123",
schema=[
["tw", "TIMESTAMP", 8, ""],
["te", "TIMESTAMP", 8, ""],
["_twstart", "TIMESTAMP", 8, ""],
["_twend", "TIMESTAMP", 8, ""],
["c1", "BIGINT", 8, ""],
["c2", "BIGINT", 8, ""],
["id", "INT", 4, "TAG"],
["name", "VARCHAR", 16, "TAG"],
],
)
tdSql.checkResultsByFunc(
sql="select * from information_schema.ins_tables where db_name='rdb' and stable_name='r123';",
func=lambda: tdSql.getRows() == 2,
)
def check105(self):
tdSql.checkResultsByFunc(
sql="select t1, c11, c12, t2, c21, c22 from rdb.r105 where tag_tbname='t1';",
func=lambda: tdSql.getRows() == 7
and tdSql.compareData(0, 0, "2025-01-01 00:04:30.000")
and tdSql.compareData(0, 1, 1)
and tdSql.compareData(0, 2, 9)
and tdSql.compareData(0, 3, "2025-01-01 00:00:00.000")
and tdSql.compareData(0, 4, 0)
and tdSql.compareData(0, 5, 0)
and tdSql.compareData(1, 0, "2025-01-01 00:09:30.000")
and tdSql.compareData(1, 1, 3)
and tdSql.compareData(1, 2, 19)
and tdSql.compareData(1, 3, "2025-01-01 00:05:00.000")
and tdSql.compareData(1, 4, 2)
and tdSql.compareData(1, 5, 10)
and tdSql.compareData(2, 0, "2025-01-01 00:14:30.000")
and tdSql.compareData(2, 1, 1)
and tdSql.compareData(2, 2, 29)
and tdSql.compareData(2, 3, "2025-01-01 00:10:00.000")
and tdSql.compareData(2, 4, 0)
and tdSql.compareData(2, 5, 20)
and tdSql.compareData(3, 0, "2025-01-01 00:19:30.000")
and tdSql.compareData(3, 1, 3)
and tdSql.compareData(3, 2, 39)
and tdSql.compareData(3, 3, "2025-01-01 00:15:00.000")
and tdSql.compareData(3, 4, 2)
and tdSql.compareData(3, 5, 30)
and tdSql.compareData(4, 0, "2025-01-01 00:24:30.000")
and tdSql.compareData(4, 1, 1)
and tdSql.compareData(4, 2, 49)
and tdSql.compareData(4, 3, "2025-01-01 00:20:00.000")
and tdSql.compareData(4, 4, 0)
and tdSql.compareData(4, 5, 40)
and tdSql.compareData(5, 0, "2025-01-01 00:29:30.000")
and tdSql.compareData(5, 1, 3)
and tdSql.compareData(5, 2, 59)
and tdSql.compareData(5, 3, "2025-01-01 00:25:00.000")
and tdSql.compareData(5, 4, 2)
and tdSql.compareData(5, 5, 50)
and tdSql.compareData(6, 0, "2025-01-01 00:34:30.000")
and tdSql.compareData(6, 1, 1)
and tdSql.compareData(6, 2, 69)
and tdSql.compareData(6, 3, "2025-01-01 00:30:00.000")
and tdSql.compareData(6, 4, 0)
and tdSql.compareData(6, 5, 60),
)