2025-07-16 06:42:16 +00:00
/*
* Copyright ( c ) 2019 TAOS Data , Inc . < jhtao @ taosdata . com >
*
* This program is free software : you can use , redistribute , and / or modify
* it under the terms of the GNU Affero General Public License , version 3
* or later ( " AGPL " ) , AS published by the Free Software Foundation .
*
* This program is distributed in the hope that it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE .
*
* You should have received a copy of the GNU Affero General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# include <fstream>
# include "cJSON.h"
# include "parTestUtil.h"
using namespace std ;
namespace ParserTest {
class ParserStreamTest : public ParserDdlTest { } ;
/*
* CREATE STREAM [ IF NOT EXISTS ] stream_name stream_options [ INTO [ db_name . ] table_name ] [ OUTPUT_SUBTABLE ( tbname_expr ) ] [ ( column_name1 , column_name2 [ PRIMARY KEY ] [ , . . . ] ) ] [ TAGS ( tag_definition [ , . . . ] ) ] [ AS subquery ]
*
* stream_options : {
2025-07-31 03:30:50 +00:00
* trigger_type [ FROM [ db_name . ] table_name ] [ PARTITION BY col1 [ , . . . ] ] [ stream_options ( stream_option [ | . . . ] ) ] [ notification_definition ]
2025-07-16 06:42:16 +00:00
* }
*
* trigger_type : {
* SESSION ( ts_col , session_val )
* | STATE_WINDOW ( col ) [ TRUE_FOR ( duration_time ) ]
* | [ INTERVAL ( interval_val [ , interval_offset ] ) ] SLIDING ( sliding_val [ , offset_time ] )
* | EVENT_WINDOW ( START WITH start_condition END WITH end_condition ) [ TRUE_FOR ( duration_time ) ]
* | COUNT_WINDOW ( count_val [ , sliding_val ] [ , col1 [ , . . . ] ] )
* | PERIOD ( period_time [ , offset_time ] )
* }
*
* event_types :
* event_type [ | event_type ]
*
* event_type : { WINDOW_OPEN | WINDOW_CLOSE }
*
* stream_option : { WATERMARK ( duration_time ) | EXPIRED_TIME ( exp_time ) | IGNORE_DISORDER | DELETE_RECALC | DELETE_OUTPUT_TABLE | FILL_HISTORY ( start_time ) | FILL_HISTORY_FIRST ( start_time ) | CALC_NOTIFY_ONLY | LOW_LATENCY_CALC | PRE_FILTER ( expr ) | FORCE_OUTPUT | MAX_DELAY ( delay_time ) | EVENT_TYPE ( event_types ) }
*
* notification_definition :
2025-07-31 03:30:50 +00:00
* NOTIFY ( url [ , . . . ] ) [ ON ( event_types ) ] [ WHERE condition ] [ notify_options ( notify_option [ | notify_option ] ) ]
2025-07-16 06:42:16 +00:00
*
* notify_option : [ NOTIFY_HISTORY | ON_FAILURE_PAUSE ]
*
* tag_definition :
* tag_name type_name [ COMMENT ' string_value ' ] AS expr
*/
void setCreateStreamStreamName ( SCMCreateStreamReq * expect , const char * pStream , const char * pStreamDb ) {
expect - > name = taosStrdup ( pStream ) ;
expect - > streamDB = taosStrdup ( pStreamDb ) ;
}
// trigger part
void setCreateStreamTriggerType ( SCMCreateStreamReq * expect , int8_t triggerType ) {
expect - > triggerType = triggerType ;
}
void setCreateStreamTriggerTableType ( SCMCreateStreamReq * expect , int8_t triggerTableType ) {
expect - > triggerTblType = triggerTableType ;
}
void setCreateStreamTriggerTableSuid ( SCMCreateStreamReq * expect , uint64_t triggerTblSUid ) {
expect - > triggerTblSuid = triggerTblSUid ;
}
void setCreateStreamTriggerTblUid ( SCMCreateStreamReq * expect , uint64_t triggerTblUid ) {
expect - > triggerTblUid = triggerTblUid ;
}
void setCreateStreamTriggerTblVgid ( SCMCreateStreamReq * expect , int8_t triggerTblVgid ) {
expect - > triggerTblVgId = triggerTblVgid ;
}
void setCreateStreamTriggerName ( SCMCreateStreamReq * expect , const char * pTriggerDb , const char * pTriggerTblName ) {
expect - > triggerDB = taosStrdup ( pTriggerDb ) ;
expect - > triggerTblName = taosStrdup ( pTriggerTblName ) ;
}
void setCreateStreamTriggerTable ( SCMCreateStreamReq * expect , const char * pTriggerDb , const char * pTriggerTblName ,
int8_t triggerType , int8_t triggerTblType , uint64_t triggerTblUid , uint64_t triggerTblSuid , int8_t triggerTblVgid ) {
setCreateStreamTriggerName ( expect , pTriggerDb , pTriggerTblName ) ;
setCreateStreamTriggerType ( expect , triggerType ) ;
setCreateStreamTriggerTblUid ( expect , triggerTblUid ) ;
setCreateStreamTriggerTableType ( expect , triggerTblType ) ;
setCreateStreamTriggerTableSuid ( expect , triggerTblSuid ) ;
setCreateStreamTriggerTblVgid ( expect , triggerTblVgid ) ;
}
// out table part
void setCreateStreamOutName ( SCMCreateStreamReq * expect , const char * pOutDb , const char * pOutTbleName ) {
expect - > outDB = taosStrdup ( pOutDb ) ;
expect - > outTblName = taosStrdup ( pOutTbleName ) ;
}
void setCreateStreamOutTblType ( SCMCreateStreamReq * expect , int8_t outTblType ) {
expect - > outTblType = outTblType ;
}
void setCreateStreamOutStbExists ( SCMCreateStreamReq * expect , int8_t outStbExists ) {
expect - > outStbExists = outStbExists ;
}
void setCreateStreamOutStbUid ( SCMCreateStreamReq * expect , uint64_t outStbUid ) {
expect - > outStbUid = outStbUid ;
}
void setCreateStreamOutStbSversion ( SCMCreateStreamReq * expect , int32_t outStbSversion ) {
expect - > outStbSversion = outStbSversion ;
}
void setCreateStreamOutTbleVgid ( SCMCreateStreamReq * expect , int32_t outTblVgid ) {
expect - > outTblVgId = outTblVgid ;
}
void setCreateStreamOutTable ( SCMCreateStreamReq * expect , const char * pOutDb , const char * pOutTbleName , int8_t outTblType ,
int8_t outStbExists , uint64_t outStbUid , int32_t outStbSversion , int32_t outTblVgid ) {
setCreateStreamOutName ( expect , pOutDb , pOutTbleName ) ;
setCreateStreamOutTblType ( expect , outTblType ) ;
setCreateStreamOutStbExists ( expect , outStbExists ) ;
setCreateStreamOutStbUid ( expect , outStbUid ) ;
setCreateStreamOutStbSversion ( expect , outStbSversion ) ;
setCreateStreamOutTbleVgid ( expect , outTblVgid ) ;
}
void setCreateStreamCalcDb ( SCMCreateStreamReq * expect , const char * pCalcDb ) {
if ( expect - > calcDB ! = nullptr ) {
2026-01-12 11:11:51 +00:00
for ( int32_t i = 0 ; i < expect - > calcDB - > size ; i + + ) {
char * tmpCalcDb = * ( char * * ) taosArrayGet ( expect - > calcDB , i ) ;
taosMemoryFreeClear ( tmpCalcDb ) ;
}
taosArrayDestroy ( expect - > calcDB ) ;
expect - > calcDB = nullptr ;
2025-07-16 06:42:16 +00:00
}
expect - > calcDB = taosArrayInit ( 1 , POINTER_BYTES ) ;
char * tmpCalcDb = taosStrdup ( pCalcDb ) ;
ASSERT_TRUE ( taosArrayPush ( expect - > calcDB , & tmpCalcDb ) ) ;
}
void setCreateStreamSql ( SCMCreateStreamReq * expect , const char * pSql ) {
2026-01-12 11:11:51 +00:00
if ( expect - > sql ! = nullptr ) {
taosMemoryFreeClear ( expect - > sql ) ;
}
2025-07-16 06:42:16 +00:00
expect - > sql = taosStrdup ( pSql ) ;
}
void setCreateStreamIgExists ( SCMCreateStreamReq * expect , int8_t igExists ) {
expect - > igExists = igExists ;
}
void setCreateStreamReq ( SCMCreateStreamReq * expect , const char * pStream , const char * pStreamDb , const char * pCalcDb ,
const char * pSql , int8_t igExists ) {
setCreateStreamStreamName ( expect , pStream , pStreamDb ) ;
setCreateStreamCalcDb ( expect , pCalcDb ) ;
setCreateStreamSql ( expect , pSql ) ;
setCreateStreamIgExists ( expect , igExists ) ;
}
void setCreateStreamTriggerScanPlan ( SCMCreateStreamReq * expect , const char * pTriggerScanPlan ) {
2026-01-12 11:11:51 +00:00
if ( expect - > triggerScanPlan ! = nullptr ) {
taosMemoryFreeClear ( expect - > triggerScanPlan ) ;
}
2025-07-16 06:42:16 +00:00
expect - > triggerScanPlan = taosStrdup ( pTriggerScanPlan ) ;
}
void setCreateStreamQueryCalcPlan ( SCMCreateStreamReq * expect , const char * pStreamQueryCalcPlan ) {
2026-01-12 11:11:51 +00:00
if ( expect - > calcPlan ! = nullptr ) {
taosMemoryFreeClear ( expect - > calcPlan ) ;
}
2025-07-16 06:42:16 +00:00
expect - > calcPlan = taosStrdup ( pStreamQueryCalcPlan ) ;
}
void setCreateStreamSubTblNameExpr ( SCMCreateStreamReq * expect , const char * pSubTblNameExpr ) {
expect - > subTblNameExpr = taosStrdup ( pSubTblNameExpr ) ;
}
void resetCreateStreamSubTblNameExpr ( SCMCreateStreamReq * expect ) {
expect - > subTblNameExpr = nullptr ;
}
void setCreateStreamTagValueExpr ( SCMCreateStreamReq * expect , const char * pTagValueExpr ) {
2026-01-12 11:11:51 +00:00
if ( expect - > tagValueExpr ! = nullptr ) {
taosMemoryFreeClear ( expect - > tagValueExpr ) ;
}
2025-07-16 06:42:16 +00:00
expect - > tagValueExpr = taosStrdup ( pTagValueExpr ) ;
}
void resetCreateStreamTagValueExpr ( SCMCreateStreamReq * expect ) {
expect - > tagValueExpr = nullptr ;
}
void setCreateStreamIgDisorder ( SCMCreateStreamReq * expect , int8_t igDisorder ) {
expect - > igDisorder = igDisorder ;
}
void setCreateStreamDeleteReCalc ( SCMCreateStreamReq * expect , int8_t deleteReCalc ) {
expect - > deleteReCalc = deleteReCalc ;
}
void setCreateStreamDeleteOutTbl ( SCMCreateStreamReq * expect , int8_t deleteOutTbl ) {
expect - > deleteOutTbl = deleteOutTbl ;
}
void setCreateStreamFillHistory ( SCMCreateStreamReq * expect , int8_t fillHistory ) {
expect - > fillHistory = fillHistory ;
}
void setCreateStreamFillHistoryFirst ( SCMCreateStreamReq * expect , int8_t fillHistoryFirst ) {
expect - > fillHistoryFirst = fillHistoryFirst ;
}
void setCreateStreamCalcNotifyOnly ( SCMCreateStreamReq * expect , int8_t calcNotifyOnly ) {
expect - > calcNotifyOnly = calcNotifyOnly ;
}
void setCreateStreamLowLatencyCalc ( SCMCreateStreamReq * expect , int8_t lowLatencyCalc ) {
expect - > lowLatencyCalc = lowLatencyCalc ;
}
void setCreateStreamMaxDelay ( SCMCreateStreamReq * expect , int64_t maxDelay ) {
expect - > maxDelay = maxDelay ;
}
void setCreateStreamFillHistoryStartTime ( SCMCreateStreamReq * expect , int64_t fillHistoryStartTime ) {
expect - > fillHistoryStartTime = fillHistoryStartTime ;
}
void setCreateStreamWatermark ( SCMCreateStreamReq * expect , int64_t watermark ) {
expect - > watermark = watermark ;
}
void setCreateStreamExpiredTime ( SCMCreateStreamReq * expect , int64_t expiredTime ) {
expect - > expiredTime = expiredTime ;
}
void setCreateStreamEventTypes ( SCMCreateStreamReq * expect , int64_t eventTypes ) {
expect - > eventTypes = eventTypes ;
}
void setCreateStreamFlags ( SCMCreateStreamReq * expect , int64_t flags ) {
expect - > flags = flags ;
}
void setCreateStreamTsmaId ( SCMCreateStreamReq * expect , int64_t tsmaId ) {
expect - > tsmaId = tsmaId ;
}
void setCreateStreamPlaceHolderBitmap ( SCMCreateStreamReq * expect , int64_t placeHolderBitmap ) {
expect - > placeHolderBitmap = placeHolderBitmap ;
}
void setCreateStreamCalcTsSlotId ( SCMCreateStreamReq * expect , int16_t calcTsSlotId ) {
expect - > calcTsSlotId = calcTsSlotId ;
}
void setCreateStreamOption ( SCMCreateStreamReq * expect , int8_t igExists , int8_t igDisorder , int8_t deleteReCalc ,
int8_t deleteOutTbl , int8_t fillHistory , int8_t fillHistoryFirst , int8_t calcNotifyOnly , int8_t lowLatencyCalc ,
int64_t maxDelay , int64_t fillHistoryStartTime , int64_t watermark , int64_t expiredTime ,
int64_t eventTypes , int64_t flags , int64_t tsmaId , int64_t placeHolderBitmap , int16_t tsSlotId ) {
expect - > igExists = igExists ;
setCreateStreamIgDisorder ( expect , igDisorder ) ;
setCreateStreamDeleteReCalc ( expect , deleteReCalc ) ;
setCreateStreamDeleteOutTbl ( expect , deleteOutTbl ) ;
setCreateStreamFillHistory ( expect , fillHistory ) ;
setCreateStreamFillHistoryFirst ( expect , fillHistoryFirst ) ;
setCreateStreamCalcNotifyOnly ( expect , calcNotifyOnly ) ;
setCreateStreamLowLatencyCalc ( expect , lowLatencyCalc ) ;
setCreateStreamMaxDelay ( expect , maxDelay ) ;
setCreateStreamFillHistoryStartTime ( expect , fillHistoryStartTime ) ;
setCreateStreamWatermark ( expect , watermark ) ;
setCreateStreamExpiredTime ( expect , expiredTime ) ;
setCreateStreamEventTypes ( expect , eventTypes ) ;
setCreateStreamFlags ( expect , flags ) ;
setCreateStreamTsmaId ( expect , tsmaId ) ;
setCreateStreamPlaceHolderBitmap ( expect , placeHolderBitmap ) ;
setCreateStreamCalcTsSlotId ( expect , tsSlotId ) ;
}
void addCreateStreamOutCols ( SCMCreateStreamReq * expect , const char * name , uint8_t type , int8_t flag , int32_t bytes , uint32_t compress , STypeMod typeMod ) {
SFieldWithOptions outCol = { 0 } ;
strcpy ( outCol . name , name ) ;
outCol . type = type ;
outCol . bytes = bytes ;
outCol . compress = compress ;
outCol . typeMod = typeMod ;
outCol . flags = flag ;
if ( expect - > outCols = = nullptr ) {
expect - > outCols = taosArrayInit ( TARRAY_MIN_SIZE , sizeof ( SFieldWithOptions ) ) ;
ASSERT_TRUE ( expect - > outCols ! = nullptr ) ;
}
ASSERT_TRUE ( taosArrayPush ( expect - > outCols , & outCol ) ! = nullptr ) ;
}
void resetCreateStreamOutCols ( SCMCreateStreamReq * expect ) {
if ( expect - > outCols ) {
taosArrayDestroy ( expect - > outCols ) ;
expect - > outCols = nullptr ;
}
}
void addCreateStreamOutTags ( SCMCreateStreamReq * expect , const char * name , uint8_t type , int8_t flag , int32_t bytes , uint32_t compress , STypeMod typeMod ) {
SFieldWithOptions outTags = { 0 } ;
strcpy ( outTags . name , name ) ;
outTags . type = type ;
outTags . bytes = bytes ;
outTags . compress = compress ;
outTags . typeMod = typeMod ;
outTags . flags = flag ;
if ( expect - > outTags = = nullptr ) {
expect - > outTags = taosArrayInit ( TARRAY_MIN_SIZE , sizeof ( SFieldWithOptions ) ) ;
ASSERT_TRUE ( expect - > outTags ! = nullptr ) ;
}
ASSERT_TRUE ( taosArrayPush ( expect - > outTags , & outTags ) ! = nullptr ) ;
}
void resetCreateStreamOutTags ( SCMCreateStreamReq * expect ) {
if ( expect - > outTags ) {
taosArrayDestroy ( expect - > outTags ) ;
expect - > outTags = nullptr ;
}
}
void setCreateStreamTriggerCols ( SCMCreateStreamReq * expect , const char * pCols ) {
expect - > triggerCols = taosStrdup ( pCols ) ;
}
void resetCreateStreamTriggerCols ( SCMCreateStreamReq * expect ) {
if ( expect - > triggerCols ) {
taosMemoryFree ( expect - > triggerCols ) ;
expect - > triggerCols = nullptr ;
}
}
2026-01-12 11:11:51 +00:00
void resetCreateStreamPartitionCols ( SCMCreateStreamReq * expect ) {
if ( expect - > partitionCols ! = nullptr ) {
taosMemoryFreeClear ( expect - > partitionCols ) ;
}
2025-07-16 06:42:16 +00:00
}
2026-01-12 11:11:51 +00:00
void setCreateStreamPartitionCols ( SCMCreateStreamReq * expect , const char * pCols ) {
resetCreateStreamPartitionCols ( expect ) ;
expect - > partitionCols = taosStrdup ( pCols ) ;
2025-07-16 06:42:16 +00:00
}
typedef enum EWindowType {
WINDOW_TYPE_INTERVAL = 1 ,
WINDOW_TYPE_SESSION ,
WINDOW_TYPE_STATE ,
WINDOW_TYPE_EVENT ,
WINDOW_TYPE_COUNT ,
WINDOW_TYPE_ANOMALY ,
WINDOW_TYPE_EXTERNAL ,
WINDOW_TYPE_PERIOD
} EWindowType ;
void setCreateStreamTriggerSliding ( SCMCreateStreamReq * expect , int8_t intervalUnit , int8_t slidingUnit ,
int8_t offsetUnit , int8_t soffsetUnit , int8_t precision , int64_t interval , int64_t offset , int64_t sliding ,
int64_t soffset ) {
expect - > trigger . sliding . intervalUnit = intervalUnit ;
expect - > trigger . sliding . slidingUnit = slidingUnit ;
expect - > trigger . sliding . offsetUnit = offsetUnit ;
expect - > trigger . sliding . soffsetUnit = soffsetUnit ;
expect - > trigger . sliding . precision = precision ;
expect - > trigger . sliding . interval = interval ;
expect - > trigger . sliding . offset = offset ;
expect - > trigger . sliding . sliding = sliding ;
expect - > trigger . sliding . soffset = soffset ;
}
void setCreateStreamTriggerSession ( SCMCreateStreamReq * expect , int64_t pSessionVal , int16_t slotId ) {
expect - > trigger . session . sessionVal = pSessionVal ;
expect - > trigger . session . slotId = slotId ;
}
void setCreateStreamTriggerCount ( SCMCreateStreamReq * expect , int64_t countVal , int64_t sliding ) {
expect - > trigger . count . countVal = countVal ;
expect - > trigger . count . sliding = sliding ;
}
void setCreateStreamTriggerEvent ( SCMCreateStreamReq * expect , const char * startCond , const char * endCond , int64_t trueForDuration ) {
expect - > trigger . event . startCond = taosStrdup ( startCond ) ;
expect - > trigger . event . endCond = taosStrdup ( endCond ) ;
expect - > trigger . event . trueForDuration = trueForDuration ;
}
void setCreateStreamTriggerState ( SCMCreateStreamReq * expect , int16_t slotId , int64_t trueForDuration ) {
expect - > trigger . stateWin . slotId = slotId ;
expect - > trigger . stateWin . trueForDuration = trueForDuration ;
}
void setCreateStreamTriggerPeriod ( SCMCreateStreamReq * expect , int8_t offsetUnit , int8_t periodUnit , int8_t precision , int64_t offset , int64_t period ) {
expect - > trigger . period . offsetUnit = offsetUnit ;
expect - > trigger . period . periodUnit = periodUnit ;
expect - > trigger . period . precision = precision ;
expect - > trigger . period . offset = offset ;
expect - > trigger . period . period = period ;
}
void addCreateStreamNotifyUrl ( SCMCreateStreamReq * expect , const char * pUrl ) {
if ( nullptr = = expect - > pNotifyAddrUrls ) {
expect - > pNotifyAddrUrls = taosArrayInit ( TARRAY_MIN_SIZE , POINTER_BYTES ) ;
ASSERT_TRUE ( expect - > pNotifyAddrUrls ! = nullptr ) ;
}
char * tmpUrl = taosStrdup ( pUrl ) ;
ASSERT_TRUE ( taosArrayPush ( expect - > pNotifyAddrUrls , & tmpUrl ) ) ;
} ;
void setCreateStreamNotify ( SCMCreateStreamReq * expect , int8_t notifyEventTypes , int8_t notifyErrorHandle , int8_t notifyHistory ) {
expect - > notifyEventTypes = notifyEventTypes ;
2025-09-25 07:48:14 +00:00
expect - > addOptions = notifyErrorHandle ;
2025-07-16 06:42:16 +00:00
expect - > notifyHistory = notifyHistory ;
}
void setCreateStreamForceOutputCols ( SCMCreateStreamReq * expect , uint8_t type , uint8_t precision , uint8_t scale , int32_t bytes , const char * expr ) {
SStreamOutCol outCol = { 0 } ;
outCol . type . type = type ;
outCol . type . precision = precision ;
outCol . type . scale = scale ;
outCol . type . bytes = bytes ;
outCol . expr = taosStrdup ( expr ) ;
if ( expect - > outCols = = nullptr ) {
expect - > outCols = taosArrayInit ( TARRAY_MIN_SIZE , sizeof ( SStreamOutCol ) ) ;
ASSERT_TRUE ( expect - > outCols ! = nullptr ) ;
}
ASSERT_TRUE ( taosArrayPush ( expect - > outCols , & outCol ) ! = nullptr ) ;
}
2026-01-12 11:11:51 +00:00
void destroyStreamCalcScan ( void * ptr ) {
SStreamCalcScan * pScan = ( SStreamCalcScan * ) ptr ;
if ( pScan & & pScan - > scanPlan ) {
taosMemoryFreeClear ( pScan - > scanPlan ) ;
}
}
2025-07-16 06:42:16 +00:00
void resetCreateStreamQueryScanPlan ( SCMCreateStreamReq * expect ) {
2026-01-12 11:11:51 +00:00
taosArrayDestroyEx ( expect - > calcScanPlanList , destroyStreamCalcScan ) ;
2025-07-16 06:42:16 +00:00
expect - > calcScanPlanList = nullptr ;
}
void addCreateStreamQueryScanPlan ( SCMCreateStreamReq * expect , bool readFromCache , const char * pStreamQueryScanPlan ) {
SStreamCalcScan scan = { 0 } ;
scan . readFromCache = ( int8_t ) readFromCache ;
scan . scanPlan = taosStrdup ( pStreamQueryScanPlan ) ;
if ( expect - > calcScanPlanList = = nullptr ) {
expect - > calcScanPlanList = taosArrayInit ( TARRAY_MIN_SIZE , sizeof ( SStreamCalcScan ) ) ;
ASSERT_TRUE ( expect - > calcScanPlanList ! = nullptr ) ;
}
ASSERT_TRUE ( taosArrayPush ( expect - > calcScanPlanList , & scan ) ! = nullptr ) ;
}
void delete_all_specified_fields ( cJSON * node , const char * fieldName ) {
if ( ! node ) return ;
if ( cJSON_IsObject ( node ) ) {
cJSON * item = node - > child ;
cJSON * next = NULL ;
while ( item ) {
next = item - > next ;
if ( strcmp ( item - > string , fieldName ) = = 0 ) {
cJSON_DeleteItemFromObject ( node , fieldName ) ;
} else {
delete_all_specified_fields ( item , fieldName ) ;
}
item = next ;
}
} else if ( cJSON_IsArray ( node ) ) {
int32_t size = cJSON_GetArraySize ( node ) ;
for ( int i = 0 ; i < size ; + + i ) {
delete_all_specified_fields ( cJSON_GetArrayItem ( node , i ) , fieldName ) ;
}
}
}
void checkCreateStreamTriggerScanPlan ( SCMCreateStreamReq * expect , SCMCreateStreamReq * req ) {
cJSON * j1 = cJSON_Parse ( ( char * ) expect - > triggerScanPlan ) ;
cJSON * j2 = cJSON_Parse ( ( char * ) req - > triggerScanPlan ) ;
if ( ! j1 | | ! j2 ) {
printf ( " Invalid JSON input. \n " ) ;
ASSERT_TRUE ( false ) ;
}
// Since projection's slot name is not fixed, we need to delete all "Name" fields
delete_all_specified_fields ( j1 , " NodeAddr " ) ;
delete_all_specified_fields ( j2 , " NodeAddr " ) ;
delete_all_specified_fields ( j1 , " GroupId " ) ;
delete_all_specified_fields ( j2 , " GroupId " ) ;
delete_all_specified_fields ( j1 , " SubplanId " ) ;
delete_all_specified_fields ( j2 , " SubplanId " ) ;
delete_all_specified_fields ( j1 , " DataBlockId " ) ;
delete_all_specified_fields ( j2 , " DataBlockId " ) ;
delete_all_specified_fields ( j1 , " Level " ) ;
delete_all_specified_fields ( j2 , " Level " ) ;
2025-07-31 03:30:50 +00:00
char * expectTriggerScanStr = cJSON_PrintUnformatted ( j1 ) ;
char * reqTriggerScanStr = cJSON_PrintUnformatted ( j2 ) ;
2025-07-16 06:42:16 +00:00
2025-07-31 03:30:50 +00:00
ASSERT_EQ ( std : : string ( expectTriggerScanStr ) , std : : string ( reqTriggerScanStr ) ) ;
2025-07-16 06:42:16 +00:00
cJSON_Delete ( j1 ) ;
cJSON_Delete ( j2 ) ;
2025-07-31 03:30:50 +00:00
free ( expectTriggerScanStr ) ;
free ( reqTriggerScanStr ) ;
2025-07-16 06:42:16 +00:00
}
void checkCreateStreamCalcPlan ( SCMCreateStreamReq * expect , SCMCreateStreamReq * req ) {
cJSON * j1 = cJSON_Parse ( ( char * ) expect - > calcPlan ) ;
cJSON * j2 = cJSON_Parse ( ( char * ) req - > calcPlan ) ;
if ( ! j1 | | ! j2 ) {
printf ( " Invalid JSON input. \n " ) ;
ASSERT_TRUE ( false ) ;
}
// Since projection's slot name is not fixed, we need to delete all "Name" fields
delete_all_specified_fields ( j1 , " Name " ) ;
delete_all_specified_fields ( j2 , " Name " ) ;
delete_all_specified_fields ( j1 , " AliasName " ) ;
delete_all_specified_fields ( j2 , " AliasName " ) ;
delete_all_specified_fields ( j1 , " ColName " ) ;
delete_all_specified_fields ( j2 , " ColName " ) ;
2025-07-31 03:30:50 +00:00
char * expectCalcPlan = cJSON_PrintUnformatted ( j1 ) ;
char * reqCalcPlan = cJSON_PrintUnformatted ( j2 ) ;
2025-07-16 06:42:16 +00:00
2025-07-31 03:30:50 +00:00
ASSERT_EQ ( std : : string ( expectCalcPlan ) , std : : string ( reqCalcPlan ) ) ;
2025-07-16 06:42:16 +00:00
cJSON_Delete ( j1 ) ;
cJSON_Delete ( j2 ) ;
2025-07-31 03:30:50 +00:00
free ( expectCalcPlan ) ;
free ( reqCalcPlan ) ;
2025-07-16 06:42:16 +00:00
}
void checkCreateStreamReq ( SCMCreateStreamReq * expect , SCMCreateStreamReq * req ) {
// stream name part
cout < < " checkCreateStreamReq: " < < expect - > sql < < endl ;
ASSERT_NE ( req - > streamId , 0 ) ;
ASSERT_EQ ( std : : string ( req - > name ) , std : : string ( expect - > name ) ) ;
ASSERT_EQ ( std : : string ( req - > sql ) , std : : string ( expect - > sql ) ) ;
ASSERT_EQ ( std : : string ( req - > streamDB ) , std : : string ( expect - > streamDB ) ) ;
ASSERT_EQ ( std : : string ( req - > triggerDB ) , std : : string ( expect - > triggerDB ) ) ;
ASSERT_EQ ( std : : string ( req - > outDB ) , std : : string ( expect - > outDB ) ) ;
ASSERT_EQ ( std : : string ( req - > triggerTblName ) , std : : string ( expect - > triggerTblName ) ) ;
ASSERT_EQ ( std : : string ( req - > outTblName ) , std : : string ( expect - > outTblName ) ) ;
ASSERT_EQ ( taosArrayGetSize ( req - > calcDB ) , taosArrayGetSize ( expect - > calcDB ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > calcDB ) ; i + + ) {
char * pCalcDb = ( char * ) taosArrayGetP ( req - > calcDB , i ) ;
char * pExpectCalcDb = ( char * ) taosArrayGetP ( expect - > calcDB , i ) ;
ASSERT_EQ ( std : : string ( pCalcDb ) , std : : string ( pExpectCalcDb ) ) ;
}
// stream trigger option part
ASSERT_EQ ( req - > igExists , expect - > igExists ) ;
ASSERT_EQ ( req - > triggerType , expect - > triggerType ) ;
ASSERT_EQ ( req - > igDisorder , expect - > igDisorder ) ;
ASSERT_EQ ( req - > deleteReCalc , expect - > deleteReCalc ) ;
ASSERT_EQ ( req - > deleteOutTbl , expect - > deleteOutTbl ) ;
ASSERT_EQ ( req - > fillHistory , expect - > fillHistory ) ;
ASSERT_EQ ( req - > fillHistoryFirst , expect - > fillHistoryFirst ) ;
ASSERT_EQ ( req - > calcNotifyOnly , expect - > calcNotifyOnly ) ;
ASSERT_EQ ( req - > lowLatencyCalc , expect - > lowLatencyCalc ) ;
// stream notify part
if ( req - > pNotifyAddrUrls = = nullptr ) {
ASSERT_TRUE ( expect - > pNotifyAddrUrls = = nullptr ) ;
} else {
ASSERT_TRUE ( expect - > pNotifyAddrUrls ! = nullptr ) ;
ASSERT_EQ ( taosArrayGetSize ( req - > pNotifyAddrUrls ) , taosArrayGetSize ( expect - > pNotifyAddrUrls ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > pNotifyAddrUrls ) ; i + + ) {
char * pUrl = ( char * ) taosArrayGetP ( req - > pNotifyAddrUrls , i ) ;
char * pExpectUrl = ( char * ) taosArrayGetP ( expect - > pNotifyAddrUrls , i ) ;
ASSERT_EQ ( std : : string ( pUrl ) , std : : string ( pExpectUrl ) ) ;
}
}
ASSERT_EQ ( req - > notifyEventTypes , expect - > notifyEventTypes ) ;
2025-09-25 07:48:14 +00:00
ASSERT_EQ ( req - > addOptions , expect - > addOptions ) ;
2025-07-16 06:42:16 +00:00
ASSERT_EQ ( req - > notifyHistory , expect - > notifyHistory ) ;
if ( req - > triggerCols = = nullptr ) {
ASSERT_TRUE ( expect - > triggerCols = = nullptr ) ;
} else {
ASSERT_EQ ( std : : string ( ( char * ) req - > triggerCols ) , std : : string ( ( char * ) expect - > triggerCols ) ) ;
}
if ( req - > partitionCols = = nullptr ) {
ASSERT_TRUE ( expect - > partitionCols = = nullptr ) ;
} else {
ASSERT_TRUE ( expect - > partitionCols ! = nullptr ) ;
ASSERT_EQ ( std : : string ( ( char * ) req - > partitionCols ) , std : : string ( ( char * ) expect - > partitionCols ) ) ;
}
ASSERT_EQ ( taosArrayGetSize ( req - > outCols ) , taosArrayGetSize ( expect - > outCols ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > outCols ) ; i + + ) {
auto pOutCols = ( SFieldWithOptions * ) taosArrayGet ( req - > outCols , i ) ;
auto expectOutCols = ( SFieldWithOptions * ) taosArrayGet ( expect - > outCols , i ) ;
ASSERT_EQ ( pOutCols - > type , expectOutCols - > type ) ;
ASSERT_EQ ( pOutCols - > bytes , expectOutCols - > bytes ) ;
ASSERT_EQ ( pOutCols - > compress , expectOutCols - > compress ) ;
ASSERT_EQ ( pOutCols - > flags , expectOutCols - > flags ) ;
ASSERT_EQ ( pOutCols - > typeMod , expectOutCols - > typeMod ) ;
ASSERT_EQ ( std : : string ( pOutCols - > name ) , std : : string ( expectOutCols - > name ) ) ;
}
ASSERT_EQ ( taosArrayGetSize ( req - > outTags ) , taosArrayGetSize ( expect - > outTags ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > outTags ) ; i + + ) {
auto pOutTags = ( SFieldWithOptions * ) taosArrayGet ( req - > outTags , i ) ;
auto expectOutTags = ( SFieldWithOptions * ) taosArrayGet ( expect - > outTags , i ) ;
ASSERT_EQ ( pOutTags - > type , expectOutTags - > type ) ;
ASSERT_EQ ( pOutTags - > bytes , expectOutTags - > bytes ) ;
ASSERT_EQ ( pOutTags - > compress , expectOutTags - > compress ) ;
ASSERT_EQ ( pOutTags - > flags , expectOutTags - > flags ) ;
ASSERT_EQ ( pOutTags - > typeMod , expectOutTags - > typeMod ) ;
ASSERT_EQ ( std : : string ( pOutTags - > name ) , std : : string ( expectOutTags - > name ) ) ;
}
ASSERT_EQ ( req - > maxDelay , expect - > maxDelay ) ;
ASSERT_EQ ( req - > fillHistoryStartTime , expect - > fillHistoryStartTime ) ;
ASSERT_EQ ( req - > watermark , expect - > watermark ) ;
ASSERT_EQ ( req - > expiredTime , expect - > expiredTime ) ;
switch ( req - > triggerType ) {
case WINDOW_TYPE_INTERVAL : {
ASSERT_EQ ( req - > trigger . sliding . sliding , expect - > trigger . sliding . sliding ) ;
ASSERT_EQ ( req - > trigger . sliding . interval , expect - > trigger . sliding . interval ) ;
ASSERT_EQ ( req - > trigger . sliding . offset , expect - > trigger . sliding . offset ) ;
ASSERT_EQ ( req - > trigger . sliding . soffset , expect - > trigger . sliding . soffset ) ;
ASSERT_EQ ( req - > trigger . sliding . intervalUnit , expect - > trigger . sliding . intervalUnit ) ;
ASSERT_EQ ( req - > trigger . sliding . slidingUnit , expect - > trigger . sliding . slidingUnit ) ;
ASSERT_EQ ( req - > trigger . sliding . offsetUnit , expect - > trigger . sliding . offsetUnit ) ;
ASSERT_EQ ( req - > trigger . sliding . soffsetUnit , expect - > trigger . sliding . soffsetUnit ) ;
ASSERT_EQ ( req - > trigger . sliding . precision , expect - > trigger . sliding . precision ) ;
break ;
}
case WINDOW_TYPE_SESSION : {
ASSERT_EQ ( req - > trigger . session . sessionVal , expect - > trigger . session . sessionVal ) ;
ASSERT_EQ ( req - > trigger . session . slotId , expect - > trigger . session . slotId ) ;
break ;
}
case WINDOW_TYPE_STATE : {
ASSERT_EQ ( req - > trigger . stateWin . trueForDuration , expect - > trigger . stateWin . trueForDuration ) ;
ASSERT_EQ ( req - > trigger . stateWin . slotId , expect - > trigger . stateWin . slotId ) ;
break ;
}
case WINDOW_TYPE_EVENT : {
ASSERT_EQ ( std : : string ( ( char * ) req - > trigger . event . startCond ) , std : : string ( ( char * ) expect - > trigger . event . startCond ) ) ;
ASSERT_EQ ( std : : string ( ( char * ) req - > trigger . event . endCond ) , std : : string ( ( char * ) expect - > trigger . event . endCond ) ) ;
ASSERT_EQ ( req - > trigger . event . trueForDuration , expect - > trigger . event . trueForDuration ) ;
break ;
}
case WINDOW_TYPE_COUNT : {
ASSERT_EQ ( req - > trigger . count . sliding , expect - > trigger . count . sliding ) ;
ASSERT_EQ ( req - > trigger . count . countVal , expect - > trigger . count . countVal ) ;
break ;
}
case WINDOW_TYPE_PERIOD : {
ASSERT_EQ ( req - > trigger . period . offset , expect - > trigger . period . offset ) ;
ASSERT_EQ ( req - > trigger . period . offsetUnit , expect - > trigger . period . offsetUnit ) ;
ASSERT_EQ ( req - > trigger . period . period , expect - > trigger . period . period ) ;
ASSERT_EQ ( req - > trigger . period . periodUnit , expect - > trigger . period . periodUnit ) ;
ASSERT_EQ ( req - > trigger . period . precision , expect - > trigger . period . precision ) ;
break ;
}
default :
ASSERT_TRUE ( false ) ;
}
ASSERT_EQ ( req - > triggerTblType , expect - > triggerTblType ) ;
ASSERT_EQ ( req - > triggerTblUid , expect - > triggerTblUid ) ;
ASSERT_EQ ( req - > outTblType , expect - > outTblType ) ;
ASSERT_EQ ( req - > outStbExists , expect - > outStbExists ) ;
ASSERT_EQ ( req - > outStbUid , expect - > outStbUid ) ;
ASSERT_EQ ( req - > outStbSversion , expect - > outStbSversion ) ;
ASSERT_EQ ( req - > eventTypes , expect - > eventTypes ) ;
ASSERT_EQ ( req - > flags , expect - > flags ) ;
ASSERT_EQ ( req - > tsmaId , expect - > tsmaId ) ;
ASSERT_EQ ( req - > placeHolderBitmap , expect - > placeHolderBitmap ) ;
if ( BIT_FLAG_TEST_MASK ( req - > placeHolderBitmap , PLACE_HOLDER_PARTITION_ROWS ) ) {
ASSERT_EQ ( req - > calcTsSlotId , expect - > calcTsSlotId ) ;
}
ASSERT_EQ ( req - > triggerTblVgId , expect - > triggerTblVgId ) ;
ASSERT_EQ ( req - > outTblVgId , expect - > outTblVgId ) ;
checkCreateStreamTriggerScanPlan ( expect , req ) ;
checkCreateStreamCalcPlan ( expect , req ) ;
ASSERT_EQ ( taosArrayGetSize ( req - > calcScanPlanList ) , taosArrayGetSize ( expect - > calcScanPlanList ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > calcScanPlanList ) ; i + + ) {
auto pCalcScan = ( SStreamCalcScan * ) taosArrayGet ( req - > calcScanPlanList , i ) ;
auto expectScan = ( SStreamCalcScan * ) taosArrayGet ( expect - > calcScanPlanList , i ) ;
ASSERT_EQ ( pCalcScan - > readFromCache , expectScan - > readFromCache ) ;
ASSERT_EQ ( std : : string ( ( char * ) pCalcScan - > scanPlan ) , std : : string ( ( char * ) expectScan - > scanPlan ) ) ;
}
if ( req - > subTblNameExpr = = nullptr ) {
ASSERT_TRUE ( expect - > subTblNameExpr = = nullptr ) ;
} else {
ASSERT_TRUE ( expect - > subTblNameExpr ! = nullptr ) ;
ASSERT_EQ ( std : : string ( ( char * ) req - > subTblNameExpr ) , std : : string ( ( char * ) expect - > subTblNameExpr ) ) ;
}
if ( req - > tagValueExpr = = nullptr ) {
ASSERT_TRUE ( expect - > tagValueExpr = = nullptr ) ;
} else {
ASSERT_TRUE ( expect - > tagValueExpr ! = nullptr ) ;
ASSERT_EQ ( std : : string ( ( char * ) req - > tagValueExpr ) , std : : string ( ( char * ) expect - > tagValueExpr ) ) ;
}
if ( req - > forceOutCols = = nullptr ) {
ASSERT_TRUE ( expect - > forceOutCols = = nullptr ) ;
} else {
ASSERT_TRUE ( expect - > forceOutCols ! = nullptr ) ;
ASSERT_EQ ( taosArrayGetSize ( req - > forceOutCols ) , taosArrayGetSize ( expect - > forceOutCols ) ) ;
for ( int32_t i = 0 ; i < taosArrayGetSize ( req - > forceOutCols ) ; i + + ) {
auto pOutCols = ( SStreamOutCol * ) taosArrayGet ( req - > forceOutCols , i ) ;
auto expectOutCols = ( SStreamOutCol * ) taosArrayGet ( expect - > forceOutCols , i ) ;
ASSERT_EQ ( pOutCols - > type . type , expectOutCols - > type . type ) ;
ASSERT_EQ ( pOutCols - > type . bytes , expectOutCols - > type . bytes ) ;
ASSERT_EQ ( pOutCols - > type . precision , expectOutCols - > type . precision ) ;
ASSERT_EQ ( pOutCols - > type . scale , expectOutCols - > type . scale ) ;
ASSERT_EQ ( std : : string ( ( char * ) pOutCols - > expr ) , std : : string ( ( char * ) expectOutCols - > expr ) ) ;
}
}
}
2025-07-31 03:30:50 +00:00
TEST_F ( ParserStreamTest , TestName ) {
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " stream_t1 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 49 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 8 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _twstart " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// stream db name
setCreateStreamStreamName ( & expect , " 0.stream_streamdb_2.s1 " , " 0.stream_streamdb_2 " ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb_2.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb_2.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// stream name
setCreateStreamStreamName ( & expect , " 0.stream_streamdb.s1_2 " , " 0.stream_streamdb " ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// trigger db name
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb_2 " , " stream_t1 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 59 , 0 , 1 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 59 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb_2 \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 59 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 59 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
2025-07-31 03:30:50 +00:00
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// trigger table name
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb_2 " , " stream_t2 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 60 , 0 , 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ; setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 59 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }}] " ) ;
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 60 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb_2 \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 60 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 60 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb_2 \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
2025-07-31 03:30:50 +00:00
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// out db name
setCreateStreamOutName ( & expect , " 0.stream_outdb_2 " , " stream_out " ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// out table name
setCreateStreamOutName ( & expect , " 0.stream_outdb_2 " , " stream_out " ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// query db name
setCreateStreamCalcDb ( & expect , " 0.stream_querydb_2 " ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 40 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \
2025-07-31 03:30:50 +00:00
resetCreateStreamQueryScanPlan ( & expect ) ;
2026-01-22 05:39:05 +00:00
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb_2 \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 40 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 40 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 40 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precis
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.stream_t2 " ) ;
// query table name
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 39 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \
2025-07-31 03:30:50 +00:00
resetCreateStreamQueryScanPlan ( & expect ) ;
2026-01-22 05:39:05 +00:00
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb_2 \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 11336080860969511580 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 39 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 39 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 39 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb_2 \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Preci
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.stream_t1 " ) ;
run ( " create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.stream_t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.stream_t1 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestTriggerOption ) {
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " stream_t1 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 49 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 8 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _twstart " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// test water mark
setCreateStreamWatermark ( & expect , 1000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(watermark(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(watermark(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamWatermark ( & expect , 1000000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(watermark(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(watermark(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamWatermark ( & expect , 0 ) ;
// expired_time
setCreateStreamExpiredTime ( & expect , 1000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamExpiredTime ( & expect , 1000000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamExpiredTime ( & expect , 0 ) ;
// ignore disorder
setCreateStreamIgDisorder ( & expect , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamIgDisorder ( & expect , false ) ;
// delete recalc
setCreateStreamDeleteReCalc ( & expect , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(delete_recalc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(delete_recalc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamDeleteReCalc ( & expect , false ) ;
// delete output table
setCreateStreamDeleteOutTbl ( & expect , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(delete_output_table ) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(delete_output_table ) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamDeleteOutTbl ( & expect , false ) ;
// fill history
setCreateStreamFillHistory ( & expect , true ) ;
setCreateStreamFillHistoryStartTime ( & expect , 1749626234000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(fill_history('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(fill_history('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamFillHistory ( & expect , false ) ;
setCreateStreamFillHistoryStartTime ( & expect , 0 ) ;
// fill history first
setCreateStreamFillHistoryFirst ( & expect , true ) ;
setCreateStreamFillHistoryStartTime ( & expect , 1749626234000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(fill_history_first('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(fill_history_first('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamFillHistoryFirst ( & expect , false ) ;
setCreateStreamFillHistoryStartTime ( & expect , 0 ) ;
// calc notify only
setCreateStreamCalcNotifyOnly ( & expect , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(calc_notify_only) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(calc_notify_only) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamCalcNotifyOnly ( & expect , false ) ;
// low latency calc
setCreateStreamLowLatencyCalc ( & expect , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(low_latency_calc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(low_latency_calc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamLowLatencyCalc ( & expect , false ) ;
// force output
// TODO(smj) : add later
//setCreateStreamForceOutputCols(&expect, true);
// pre filter
// TODO(smj) : add later
// max delay
setCreateStreamMaxDelay ( & expect , 3000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(3s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(3s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamMaxDelay ( & expect , 1000000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamMaxDelay ( & expect , 0 ) ;
// event type
setCreateStreamEventTypes ( & expect , EVENT_WINDOW_CLOSE ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamEventTypes ( & expect , EVENT_WINDOW_OPEN ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_open)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_open)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamEventTypes ( & expect , EVENT_WINDOW_OPEN | EVENT_WINDOW_CLOSE ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_open | window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(window_open | window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestTriggerType ) {
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " stream_t1 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 49 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// test session window
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_SESSION ) ;
setCreateStreamTriggerSession ( & expect , 1 , 0 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 session(ts, 1a) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 session(ts, 1a) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerSession ( & expect , 1000 , 0 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 session(ts, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 session(ts, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// test state window
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_STATE ) ;
2025-08-21 07:46:57 +00:00
setCreateStreamTriggerState ( & expect , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 284 \" , \" OutputRowSize \" : \" 284 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 11336080860969511580 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_3 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 state_window(c1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 state_window(c1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-08-21 07:46:57 +00:00
setCreateStreamTriggerState ( & expect , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 300 \" , \" OutputRowSize \" : \" 300 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1887832667250888763 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_3 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatc
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 state_window(c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 state_window(c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-08-21 07:46:57 +00:00
setCreateStreamTriggerState ( & expect , 0 , 1 ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 state_window(c2) true_for(1a) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 state_window(c2) true_for(1a) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-08-21 07:46:57 +00:00
setCreateStreamTriggerState ( & expect , 0 , 1000 ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 state_window(c2) true_for(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 state_window(c2) true_for(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// interval window
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_INTERVAL ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamTriggerSliding ( & expect , 0 , ' s ' , 0 , 0 , 0 , 0 , 0 , 1000 , 0 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerSliding ( & expect , 0 , ' s ' , 0 , ' s ' , 0 , 0 , 0 , 100000 , 1000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 sliding(100s, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 sliding(100s, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-08-26 06:42:06 +00:00
setCreateStreamTriggerSliding ( & expect , ' h ' , ' s ' , 0 , 0 , 0 , 3600000 , 0 , 100000 , 0 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1h) sliding(100s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1h) sliding(100s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-07-31 03:30:50 +00:00
2025-08-26 06:42:06 +00:00
setCreateStreamTriggerSliding ( & expect , ' h ' , ' s ' , ' m ' , 0 , 0 , 3600000 , 60000 , 100000 , 0 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1h, 1m) sliding(100s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1h, 1m) sliding(100s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-07-31 03:30:50 +00:00
// event window
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_EVENT ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 304 \" , \" OutputRowSize \" : \" 304 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 11336080860969511580 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1887832667250888763 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_4 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_4 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMerg
2025-07-31 03:30:50 +00:00
setCreateStreamTriggerEvent ( & expect ,
2026-03-06 06:45:30 +00:00
" { \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" 3831883314967181845 \" , \" UserAlias \" : \" c1 > 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 40 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5001870860487857737 \" , \" UserAlias \" : \" 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" 1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}}} " ,
" { \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" 8823744644992822608 \" , \" UserAlias \" : \" c2 < 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 42 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5001870860487857737 \" , \" UserAlias \" : \" 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" 1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}}} " ,
2025-07-31 03:30:50 +00:00
0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerEvent ( & expect ,
2026-03-06 06:45:30 +00:00
" { \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" 3831883314967181845 \" , \" UserAlias \" : \" c1 > 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 40 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5001870860487857737 \" , \" UserAlias \" : \" 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" 1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}}} " ,
" { \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" 8823744644992822608 \" , \" UserAlias \" : \" c2 < 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 42 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5001870860487857737 \" , \" UserAlias \" : \" 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" 1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}}} " ,
2025-07-31 03:30:50 +00:00
3600000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) true_for(1h) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) true_for(1h) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// count window
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_COUNT ) ;
setCreateStreamTriggerCount ( & expect , 10 , 10 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 count_window(10) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 count_window(10) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerCount ( & expect , 20 , 10 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 count_window(20, 10) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 count_window(20, 10) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerCount ( & expect , 20 , 20 ) ;
2026-03-06 06:45:30 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 304 \" , \" OutputRowSize \" : \" 304 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 11336080860969511580 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1887832667250888763 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_4 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Conditions \" :{ \" NodeType \" : \" 4 \" , \" Name \" : \" LogicCondition \" , \" LogicCondition \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" CondType \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 101 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 101 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" ,
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 count_window(20, c1, c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 count_window(20, c1, c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerCount ( & expect , 20 , 10 ) ;
2026-03-06 06:45:30 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 304 \" , \" OutputRowSize \" : \" 304 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 11336080860969511580 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1887832667250888763 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_4 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Conditions \" :{ \" NodeType \" : \" 4 \" , \" Name \" : \" LogicCondition \" , \" LogicCondition \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" CondType \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 101 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}, \" Right \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 1 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 101 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" ,
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" c2 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 count_window(20, 10, c1, c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 count_window(20, 10, c1, c2) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// period window
resetCreateStreamTriggerCols ( & expect ) ;
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_PERIOD ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 272 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_1 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :true, \" Output \" :false, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 272 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :true, \" Output \" :false, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamTriggerPeriod ( & expect , 0 , ' s ' , 0 , 0 , 1000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamTriggerPeriod ( & expect , ' s ' , ' m ' , 0 , 1000 , 60000 ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1m, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1m, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestTriggerPartition ) {
setAsyncFlag ( " -1 " ) ;
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " st1 " , WINDOW_TYPE_INTERVAL , TSDB_SUPER_TABLE , 42 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_SUPER_TABLE , 0 , 0 , 1 , 0 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 44 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 42 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.stream_out \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.stream_out \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
resetCreateStreamOutTags ( & expect ) ;
addCreateStreamOutTags ( & expect , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 312 \" , \" OutputRowSize \" : \" 312 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_5 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" exp
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 3 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Val
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestNotify ) {
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " stream_t1 " , WINDOW_TYPE_INTERVAL , TSDB_NORMAL_TABLE , 49 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6954351318876756469 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 49 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 49 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" stream_t1 \" , \" TableAlias \" : \" stream_t1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// url
addCreateStreamNotifyUrl ( & expect , " ws://localhost:8080 " ) ;
setCreateStreamNotify ( & expect , EVENT_WINDOW_CLOSE , false , false ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
addCreateStreamNotifyUrl ( & expect , " ws://localhost:8080/notify " ) ;
setCreateStreamNotify ( & expect , EVENT_WINDOW_CLOSE , false , false ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// ON EVENT
setCreateStreamNotify ( & expect , EVENT_WINDOW_CLOSE , false , false ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamNotify ( & expect , EVENT_WINDOW_OPEN , false , false ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_open) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_open) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
setCreateStreamNotify ( & expect , EVENT_WINDOW_OPEN | EVENT_WINDOW_CLOSE , false , false ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close|window_open) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close|window_open) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// where condition
// TODO(smj) add later
// notify stream_options
setCreateStreamNotify ( & expect , EVENT_WINDOW_CLOSE , false , true ) ;
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(notify_history) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(notify_history) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestOutTable ) {
setAsyncFlag ( " -1 " ) ;
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " st1 " , WINDOW_TYPE_INTERVAL , TSDB_SUPER_TABLE , 42 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// out table type
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_SUPER_TABLE , 0 , 0 , 1 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 312 \" , \" OutputRowSize \" : \" 312 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_5 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" exp
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutTags ( & expect , " tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 44 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 42 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.stream_out \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.stream_out \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 3 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3, tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3, tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamOutTags ( & expect ) ;
resetCreateStreamQueryScanPlan ( & expect ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " st1 " , TSDB_SUPER_TABLE , 1 , 0 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 312 \" , \" OutputRowSize \" : \" 312 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_5 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" exp
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutTags ( & expect , " tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " ts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " c1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " c2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 32 \" , \" OutputRowSize \" : \" 32 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 32 \" , \" OutputRowSize \" : \" 32 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" Projections \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}},{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 32 \" , \" OutputRowSize \" : \" 32 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14225662052965797447 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 2 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 2 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 2 \" , \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" c2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 37 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 35 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.st1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.st1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 3 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.st1 as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.st1 as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
resetCreateStreamOutTags ( & expect ) ;
resetCreateStreamPartitionCols ( & expect ) ;
resetCreateStreamSubTblNameExpr ( & expect ) ;
resetCreateStreamTagValueExpr ( & expect ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_t1 " , TSDB_NORMAL_TABLE , 0 , 0 , 1 , 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.stream_t1 as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.stream_t1 as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
// sub table name expr
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_SUPER_TABLE , 0 , 0 , 1 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutTags ( & expect , " tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 312 \" , \" OutputRowSize \" : \" 312 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_5 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" exp
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 3 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 24 \" }, \" AliasName \" : \" 18423646831753367078 \" , \" UserAlias \" : \" concat('t_', tag2) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" 11067635649471498840 \" , \" UserAlias \" : \" 't_' \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" t_ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" t_ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out output_subtable(concat('t_', tag2)) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out output_subtable(concat('t_', tag2)) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
// out columns
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " out_ts " , TSDB_DATA_TYPE_TIMESTAMP , 1 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " out_c1 " , TSDB_DATA_TYPE_INT , 5 , 4 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " out_c2 " , TSDB_DATA_TYPE_BINARY , 1 , 20 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 44 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 42 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.stream_out \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.stream_out \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out (out_ts, out_c1 primary key, out_c2) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out (out_ts, out_c1 primary key, out_c2) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
// out tag
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamOutTags ( & expect ) ;
addCreateStreamOutCols ( & expect , " ts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " c1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " c2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " out_tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " out_tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 22 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " out_tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
2026-03-06 06:45:30 +00:00
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" 7080784029850824542 \" , \" UserAlias \" : \" cast(tag1 + 1 as int) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 3 \" , \" Name \" : \" Operator \" , \" Operator \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5102575358876116143 \" , \" UserAlias \" : \" tag1 + 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" OpType \" : \" 1 \" , \" OpFlag \" : \" 0 \" , \" Left \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}, \" Right \" :{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" 5001870860487857737 \" , \" UserAlias \" : \" 1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" 1 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" 2506531902696159022 \" , \" UserAlias \" : \" upper(tag2) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" upper \" , \" Id \" : \" 73 \" , \" Type \" : \" 1505 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out tags(out_tag1 int as cast(tag1 + 1 as int), out_tag2 varchar(20) as upper(tag2), out_tag3 timestamp as tag3) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.stream_out tags(out_tag1 int as cast(tag1 + 1 as int), out_tag2 varchar(20) as upper(tag2), out_tag3 timestamp as tag3) as select ts, c1, c2 from stream_querydb.stream_t2 " ) ;
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestQuery ) {
setAsyncFlag ( " -1 " ) ;
useDb ( " root " , " stream_streamdb " ) ;
SCMCreateStreamReq expect = { 0 } ;
2026-01-12 11:11:51 +00:00
SCMCreateStreamReq expectOrderBy = { 0 } ;
2025-07-31 03:30:50 +00:00
auto clearCreateStreamReq = [ & ] ( ) {
tFreeSCMCreateStreamReq ( & expect ) ;
memset ( & expect , 0 , sizeof ( SCMCreateStreamReq ) ) ;
2026-01-12 11:11:51 +00:00
tFreeSCMCreateStreamReq ( & expectOrderBy ) ;
memset ( & expectOrderBy , 0 , sizeof ( SCMCreateStreamReq ) ) ;
2025-07-31 03:30:50 +00:00
} ;
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expect , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expect , " 0.stream_triggerdb " , " st1 " , WINDOW_TYPE_INTERVAL , TSDB_SUPER_TABLE , 42 , 0 , 1 ) ;
setCreateStreamOutTable ( & expect , " 0.stream_outdb " , " stream_out " , TSDB_SUPER_TABLE , 0 , 0 , 1 , 0 ) ;
setCreateStreamReq ( & expect , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expect , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" :
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
setCreateStreamTriggerCols ( & expect , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSubTblNameExpr ( & expect , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 44 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 42 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.stream_out \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.stream_out \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2025-07-31 03:30:50 +00:00
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// placeholder type
// _tprev_ts
resetCreateStreamOutCols ( & expect ) ;
2025-09-25 07:48:14 +00:00
setCreateStreamTriggerSliding ( & expect , 0 , ' s ' , 0 , 0 , 0 , 0 , 0 , 1000 , 0 ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _tprev_ts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_PREV_TS ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-09-25 07:48:14 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tprev_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tprev_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-07-31 03:30:50 +00:00
// _tcurrent_ts
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tcurrent_ts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_CURRENT_TS ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-09-25 07:48:14 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tcurrent_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tcurrent_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-07-31 03:30:50 +00:00
// _tnext_ts
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tnext_ts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_NEXT_TS ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-09-25 07:48:14 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_ts, avg(c1) from stream_querydb.stream_t2 " ) ;
2025-07-31 03:30:50 +00:00
// _twstart
resetCreateStreamOutCols ( & expect ) ;
2025-09-25 07:48:14 +00:00
setCreateStreamTriggerSliding ( & expect , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
2025-07-31 03:30:50 +00:00
addCreateStreamOutCols ( & expect , " _twstart " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_WSTART ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// _twend
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _twend " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_WEND ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.stream_t2 " ) ;
// _twduration
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _twend " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " _twduration " , TSDB_DATA_TYPE_BIGINT , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_WEND | PLACE_HOLDER_WDURATION ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 24 \" , \" OutputRowSize \" : \" 24 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncIn
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, _twduration, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, _twduration, avg(c1) from stream_querydb.stream_t2 " ) ;
// _twrownum
resetCreateStreamOutCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _twend " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " _twrownum " , TSDB_DATA_TYPE_BIGINT , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_WEND | PLACE_HOLDER_WROWNUM ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 24 \" , \" OutputRowSize \" : \" 24 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncIn
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, _twrownum, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twend, _twrownum, avg(c1) from stream_querydb.stream_t2 " ) ;
// _tprev_localtime
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tprev_localtime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_PERIOD ) ;
setCreateStreamTriggerPeriod ( & expect , 0 , ' s ' , 0 , 0 , 1000 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_1 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
2025-07-31 03:30:50 +00:00
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_PREV_LOCAL ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 2 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tprev_localtime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tprev_localtime, avg(c1) from stream_querydb.stream_t2 " ) ;
// _tnext_localtime
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tnext_localtime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_PERIOD ) ;
setCreateStreamTriggerPeriod ( & expect , 0 , ' s ' , 0 , 0 , 1000 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_NEXT_LOCAL ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 2 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_localtime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_localtime, avg(c1) from stream_querydb.stream_t2 " ) ;
// _tgrpid
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tnext_localtime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " _tgrpid " , TSDB_DATA_TYPE_BIGINT , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamTriggerType ( & expect , WINDOW_TYPE_PERIOD ) ;
setCreateStreamTriggerPeriod ( & expect , 0 , ' s ' , 0 , 0 , 1000 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_NEXT_LOCAL | PLACE_HOLDER_GRPID ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 24 \" , \" OutputRowSize \" : \" 24 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 2 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncIn
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_localtime, _tgrpid, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tnext_localtime, _tgrpid, avg(c1) from stream_querydb.stream_t2 " ) ;
// _tlocaltime
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_LOCALTIME ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" InputOrder \" : \" 0
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " ) ;
// %%n
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
resetCreateStreamOutTags ( & expect ) ;
setCreateStreamCalcDb ( & expect , " 0.stream_triggerdb " ) ;
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " %%1 " , TSDB_DATA_TYPE_VARCHAR , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag1 " , TSDB_DATA_TYPE_INT , 0 , 4 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag2 " , TSDB_DATA_TYPE_BINARY , 0 , 20 , 0 , 0 ) ;
addCreateStreamOutTags ( & expect , " tag3 " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_IDX | PLACE_HOLDER_PARTITION_TBNAME ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTagValueExpr ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 2 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 3 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Val
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 4 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 5 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }}] " ) ;
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1128 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 288 \" , \" OutputRowSize \" : \" 288 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true}}], \" Precision \" : \" 0 \" }}, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false}}], \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }}}}}], \" MergeDataBlock \" :true, \" GroupKeyOptimized \" :false, \" HasCountFunc \" :false}}], \" Projections \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 2 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%1, avg(c1) from %%tbname " ) ;
//run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%1, avg(c1) from %%tbname");
// %%tbname
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
setCreateStreamCalcDb ( & expect , " 0.stream_querydb " ) ;
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " %%tbname " , TSDB_DATA_TYPE_VARCHAR , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_TBNAME ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 312 \" , \" OutputRowSize \" : \" 312 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_4 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_3 \" , \" UserAlias \" : \" t
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 1 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 288 \" , \" OutputRowSize \" : \" 288 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFu
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from stream_querydb.stream_t2 " ) ;
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
resetCreateStreamQueryScanPlan ( & expect ) ;
setCreateStreamCalcDb ( & expect , " 0.stream_triggerdb " ) ;
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " %%tbname " , TSDB_DATA_TYPE_VARCHAR , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_TBNAME ) ;
2026-01-22 05:39:05 +00:00
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 2 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 3 \" , \" Eps \" :[{ \" Fqdn \" : \" dnode_1 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_2 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_3 \" , \" Port \" : \" 6030 \" }]}, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" S
addCreateStreamQueryScanPlan ( & expect , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 3 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 3 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 3 \" , \" Eps \" :[{ \" Fqdn \" : \" dnode_1 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_2 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_3 \" , \" Port \" : \" 6030 \" }]}, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 4 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 4 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 4 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 4 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" S
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }},{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934595 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 288 \" , \" OutputRowSize \" : \" 288 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :true, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" DataB
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from %%tbname " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from %%tbname " ) ;
// %%trows
resetCreateStreamOutCols ( & expect ) ;
resetCreateStreamTriggerCols ( & expect ) ;
resetCreateStreamQueryScanPlan ( & expect ) ;
setCreateStreamCalcTsSlotId ( & expect , 1 ) ;
addCreateStreamOutCols ( & expect , " _tlocaltime " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " %%tbname " , TSDB_DATA_TYPE_VARCHAR , 0 , 272 , 0 , 0 ) ;
addCreateStreamOutCols ( & expect , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expect , PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_TBNAME | PLACE_HOLDER_PARTITION_ROWS ) ;
2026-01-22 05:39:05 +00:00
addCreateStreamQueryScanPlan ( & expect , true , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 2 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 3 \" , \" Eps \" :[{ \" Fqdn \" : \" dnode_1 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_2 \" , \" Port \" : \" 6030 \" },{ \" Fqdn \" : \" dnode_3 \" , \" Port \" : \" 6030 \" }]}, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 3 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Sc
2025-07-31 03:30:50 +00:00
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 316 \" , \" OutputRowSize \" : \" 316 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 5 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_4 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 2 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Na
setCreateStreamPartitionCols ( & expect , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" tag1 \" , \" UserAlias \" : \" tag1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 4 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 2 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" AliasName \" : \" tag2 \" , \" UserAlias \" : \" tag2 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 5 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 3 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}},{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" tag3 \" , \" UserAlias \" : \" tag3 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 6 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 2 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" tag3 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 4 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}] " ) ;
setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 288 \" , \" OutputRowSize \" : \" 288 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDat
2025-07-31 03:30:50 +00:00
setCreateStreamSql ( & expect , " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from %%trows " ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2, tag3 into stream_outdb.stream_out as select _tlocaltime, %%tbname, avg(c1) from %%trows " ) ;
2026-01-12 11:11:51 +00:00
// order by place holder
setCheckDdlFunc ( [ & ] ( const SQuery * pQuery , ParserStage stage ) {
ASSERT_EQ ( nodeType ( pQuery - > pRoot ) , QUERY_NODE_CREATE_STREAM_STMT ) ;
SCMCreateStreamReq req = { 0 } ;
ASSERT_TRUE ( TSDB_CODE_SUCCESS = =
tDeserializeSCMCreateStreamReq ( pQuery - > pCmdMsg - > pMsg , pQuery - > pCmdMsg - > msgLen , & req ) ) ;
checkCreateStreamReq ( & expectOrderBy , & req ) ;
tFreeSCMCreateStreamReq ( & req ) ;
} ) ;
setCreateStreamTriggerTable ( & expectOrderBy , " 0.stream_triggerdb " , " st1 " , WINDOW_TYPE_INTERVAL , TSDB_SUPER_TABLE , 42 , 0 , 1 ) ;
setCreateStreamOutTable ( & expectOrderBy , " 0.stream_outdb " , " stream_out " , TSDB_SUPER_TABLE , 0 , 0 , 1 , 0 ) ;
setCreateStreamReq ( & expectOrderBy , " 0.stream_streamdb.s1 " , " 0.stream_streamdb " , " 0.stream_querydb " , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.stream_t2 " , 0 ) ;
setCreateStreamOption ( & expectOrderBy , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , EVENT_WINDOW_CLOSE , 0 , 0 , 512 , - 1 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamTriggerScanPlan ( & expectOrderBy , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" DbFName \" : \" 0.stream_triggerdb \" , \" User \" : \" \" , \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_2 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 1 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" expr_2 \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}}}], \" TableId \" : \" 42 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 1 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" TotalRowSize \" : \" 280 \" , \" OutputRowSize \" : \" 280 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}}}, \" ShowRewrite \" :false, \" IsView \" :false, \" IsAudit \" :false, \" RowThreshold \" : \" 4096 \" , \" DyRowThreshold \" :false, \" DynTbname \" :false, \" ProcessOneBlock \" :false}} " ) ;
addCreateStreamQueryScanPlan ( & expectOrderBy , false , " { \" NodeType \" : \" 1137 \" , \" Name \" : \" PhysiSubplan \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 2 \" , \" SubplanId \" : \" 2 \" }, \" SubplanType \" : \" 3 \" , \" MsgType \" : \" 769 \" , \" Level \" : \" 1 \" , \" DbFName \" : \" 0.stream_querydb \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 1 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" RootNode \" :{ \" NodeType \" : \" 1101 \" , \" Name \" : \" PhysiTableScan \" , \" PhysiTableScan \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 4 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 7606375837463693085 \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 1011735779866557034 \" , \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" ScanCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 4 \" , \" SlotId \" : \" 1 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 0 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}},{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" DataBlockId \" : \" 4 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" c1 \" , \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" ColName \" : \" c1 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :false}}}}], \" TableId \" : \" 30 \" , \" STableId \" : \" 0 \" , \" TableType \" : \" 3 \" , \" TableName \" :{ \" NameType \" : \" 2 \" , \" AcctId \" : \" 0 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" }, \" GroupOrderScan \" :false, \" VirtualStableScan \" :false, \" ScanCount \" : \" 1 \" , \" ReverseScanCount \" : \" 0 \" , \" StartKey \" : \" -9223372036854775808 \" , \" EndKey \" : \" 9223372036854775807 \" , \" Ratio \" :1, \" DataRequired \" : \" 1 \" , \" Interval \" : \" 0 \" , \" Offset \" : \" 0 \" , \" Sliding \" : \" 0 \" , \" IntervalUnit \" : \" 0 \" , \" SlidingUnit \" : \" 0 \" , \" TriggerType \" : \" 0 \" , \" Watermark \" : \" 0 \" , \" IgnoreExpired \" : \" 0 \" , \" GroupSort \" :false, \" AssignBlockUid \" :false, \" IgnoreUpdate \" : \" 0 \" , \" FilesetDelimited \" :false, \" NeedCountEmptyTable \" :false, \" ParaTablesSort \" :false, \" SmallDataTsSort \" :false}}, \" DataSink \" :{ \" NodeType \" : \" 1133 \" , \" Name \" : \" PhysiDispatch \" , \" PhysiDispatch \" :{ \" InputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" Name \" : \" DataBlockDesc \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 4 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" \" , \" Tag \" :false}}], \" Preci
setCreateStreamTriggerCols ( & expectOrderBy , " [{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" ts \" , \" UserAlias \" : \" ts \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 1 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" ts \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep \" :false, \" HasRef \" :false, \" RefDb \" : \" \" , \" RefTable \" : \" \" , \" RefCol \" : \" \" , \" IsPrimTs \" :true}}] " ) ;
setCreateStreamPartitionCols ( & expectOrderBy , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" tbname \" , \" UserAlias \" : \" tbname \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" tbname \" , \" Id \" : \" 85 \" , \" Type \" : \" 3501 \" , \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2026-01-12 11:11:51 +00:00
addCreateStreamOutTags ( & expectOrderBy , " tag_tbname " , TSDB_DATA_TYPE_BINARY , 0 , 272 , 0 , 0 ) ;
2026-01-22 05:39:05 +00:00
setCreateStreamSubTblNameExpr ( & expectOrderBy , " { \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 63 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" concat \" , \" Id \" : \" 70 \" , \" Type \" : \" 1502 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 2 \" , \" Literal \" : \" _t \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _t \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 34 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" md5 \" , \" Id \" : \" 134 \" , \" Type \" : \" 1509 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 44 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 42 \" , \" Literal \" : \" stream_streamdb.s1.stream_outdb.stream_out \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" stream_streamdb.s1.stream_outdb.stream_out \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 3 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 1 \" , \" Literal \" : \" _ \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" _ \" }},{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 22 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" cast \" , \" Id \" : \" 77 \" , \" Type \" : \" 2000 \" , \" Parameters \" :[{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _tgrpid \" , \" Id \" : \" 185 \" , \" Type \" : \" 3531 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 2 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 1 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :true, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 0 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}} " ) ;
setCreateStreamTagValueExpr ( & expectOrderBy , " [{ \" NodeType \" : \" 5 \" , \" Name \" : \" Function \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Name \" : \" _placeholder_column \" , \" Id \" : \" 186 \" , \" Type \" : \" 3532 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :false, \" NotReserved \" :true, \" IsNull \" :true, \" Unit \" : \" 0 \" }},{ \" NodeType \" : \" 2 \" , \" Name \" : \" Value \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" \" , \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 1 \" }}], \" UdfBufSize \" : \" 0 \" , \" HasPk \" :false, \" PkBytes \" : \" 0 \" , \" IsMergeFunc \" :false, \" MergeFuncOf \" : \" 0 \" , \" TrimType \" : \" 0 \" , \" SrcFuncInputDataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }}}] " ) ;
2026-01-12 11:11:51 +00:00
setCreateStreamTriggerSliding ( & expectOrderBy , ' s ' , ' s ' , 0 , 0 , 0 , 1000 , 0 , 1000 , 0 ) ;
addCreateStreamOutCols ( & expectOrderBy , " _twstart " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expectOrderBy , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamPlaceHolderBitmap ( & expectOrderBy , PLACE_HOLDER_WSTART ) ;
2026-02-26 06:06:02 +00:00
setCreateStreamQueryCalcPlan ( & expectOrderBy , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1113 \" , \" PhysiSort \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep
2026-01-12 11:11:51 +00:00
setCreateStreamSql ( & expectOrderBy , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 order by _twstart " ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 order by _twstart " ) ;
resetCreateStreamOutCols ( & expectOrderBy ) ;
addCreateStreamOutCols ( & expectOrderBy , " newts " , TSDB_DATA_TYPE_TIMESTAMP , 0 , 8 , 0 , 0 ) ;
addCreateStreamOutCols ( & expectOrderBy , " avg(c1) " , TSDB_DATA_TYPE_DOUBLE , 0 , 8 , 0 , 0 ) ;
setCreateStreamSql ( & expectOrderBy , " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart newts, avg(c1) from stream_querydb.stream_t2 order by newts " ) ;
2026-02-26 06:06:02 +00:00
setCreateStreamQueryCalcPlan ( & expectOrderBy , " { \" NodeType \" : \" 1138 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 0 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" NodeList \" :[{ \" NodeType \" : \" 1137 \" , \" PhysiSubplan \" :{ \" Id \" :{ \" QueryId \" : \" 0 \" , \" GroupId \" : \" 1 \" , \" SubplanId \" : \" 1 \" }, \" SubplanType \" : \" 5 \" , \" MsgType \" : \" 771 \" , \" Level \" : \" 0 \" , \" DbFName \" : \" \" , \" User \" : \" \" , \" NodeAddr \" :{ \" Id \" : \" 0 \" , \" InUse \" : \" 0 \" , \" NumOfEps \" : \" 0 \" }, \" Child \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" LiteralSize \" : \" 0 \" , \" Flag \" :false, \" Translate \" :true, \" NotReserved \" :false, \" IsNull \" :false, \" Unit \" : \" 0 \" , \" Datum \" : \" 8589934594 \" }}], \" RootNode \" :{ \" NodeType \" : \" 1108 \" , \" PhysiProject \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 3 \" , \" TotalRowSize \" : \" 16 \" , \" OutputRowSize \" : \" 16 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1113 \" , \" PhysiSort \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 2 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1110 \" , \" PhysiAgg \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 1 \" , \" TotalRowSize \" : \" 8 \" , \" OutputRowSize \" : \" 8 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" Children \" :[{ \" NodeType \" : \" 1111 \" , \" PhysiExchange \" :{ \" OutputDataBlockDesc \" :{ \" NodeType \" : \" 19 \" , \" DataBlockDesc \" :{ \" DataBlockId \" : \" 0 \" , \" TotalRowSize \" : \" 12 \" , \" OutputRowSize \" : \" 12 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Tag \" :false}}], \" Precision \" : \" 0 \" }}, \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" SrcStartGroupId \" : \" 2 \" , \" SrcEndGroupId \" : \" 2 \" , \" SeqRecvData \" :false, \" DynTbname \" :false, \" GrpSingleChannel \" :false, \" SingleSource \" :false}}], \" InputOrder \" : \" 0 \" , \" OutputOrder \" : \" 0 \" , \" DynamicOp \" :false, \" ForceCreateNonBlockingOptr \" :false, \" AggFuncs \" :[{ \" NodeType \" : \" 18 \" , \" Target \" :{ \" DataBlockId \" : \" 1 \" , \" SlotId \" : \" 0 \" , \" Expr \" :{ \" NodeType \" : \" 5 \" , \" Function \" :{ \" DataType \" :{ \" Type \" : \" 7 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" UserAlias \" : \" avg(c1) \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 8 \" , \" Type \" : \" 2 \" , \" Parameters \" :[{ \" NodeType \" : \" 1 \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" UserAlias \" : \" c1 \" , \" HasNull \" :false, \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" stream_t2 \" , \" TableAlias \" : \" stream_t2 \" , \" DataBlockId \" : \" 0 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" , \" HasDep
2026-01-12 11:11:51 +00:00
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname into stream_outdb.stream_out as select _twstart newts, avg(c1) from stream_querydb.stream_t2 order by newts " ) ;
2025-07-31 03:30:50 +00:00
clearCreateStreamReq ( ) ;
}
TEST_F ( ParserStreamTest , TestErrorName ) {
setAsyncFlag ( " -1 " ) ;
//run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2");
// db not exists
run ( " create stream non_exist_db.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_FAILED ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into non_exist_db.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_FAILED ) ;
// table not exists
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from non_exist_db.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TABLE_NOT_EXIST ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from non_exist_db.stream_t2 " , TSDB_CODE_PAR_TABLE_NOT_EXIST ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.non_exist_stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TABLE_NOT_EXIST ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from non_exist_db.non_exist_stream_t2 " , TSDB_CODE_PAR_TABLE_NOT_EXIST ) ;
}
TEST_F ( ParserStreamTest , TestErrorTriggerWindow ) {
setAsyncFlag ( " -1 " ) ;
// wrong trigger window
run ( " create stream stream_streamdb.s1 invalid_window(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid session window
// missing session_val
run ( " create stream stream_streamdb.s1 session(ts) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// not ts cols
run ( " create stream stream_streamdb.s1 session(c1, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SESSION_COL ) ;
// invalid time unit
run ( " create stream stream_streamdb.s1 session(ts, 1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SESSION_GAP ) ;
run ( " create stream stream_streamdb.s1 session(ts, 1n) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SESSION_GAP ) ;
run ( " create stream stream_streamdb.s1 session(ts, 0s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SESSION_GAP ) ;
// invalid state window
// invalid col type
run ( " create stream stream_streamdb.s1 state_window(ts) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE ) ;
// invalid true for less than 0
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(-1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid true for unit
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TRUE_FOR_UNIT ) ;
run ( " create stream stream_streamdb.s1 state_window(c1) true_for('1y') from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TRUE_FOR_UNIT ) ;
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(1x) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 state_window(c1) true_for('1x') from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid interval window
// interval without sliding
run ( " create stream stream_streamdb.s1 interval(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 interval(2s, 1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid sliding unit
run ( " create stream stream_streamdb.s1 sliding(1n) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SLIDING_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_SLIDING_UNIT ) ;
// invalid sliding offset unit
run ( " create stream stream_streamdb.s1 sliding(1s, 1n) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1s, 1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1s, 1u) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1s, 1d) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1s, 1w) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
run ( " create stream stream_streamdb.s1 sliding(1s, 1b) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
// sliding offset bigger than sliding
run ( " create stream stream_streamdb.s1 sliding(1s, 2s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG ) ;
// invalid interval val
run ( " create stream stream_streamdb.s1 interval(0) sliding(3s, 2s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL ) ;
// invalid interval offset unit
2025-08-26 06:42:06 +00:00
run ( " create stream stream_streamdb.s1 interval(20n, 1y) sliding(3s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_UNIT ) ;
2025-07-31 03:30:50 +00:00
// interval offset bigger than interval
2025-08-26 06:42:06 +00:00
run ( " create stream stream_streamdb.s1 interval(1s, 2s) sliding(3s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG ) ;
// sliding offset with interval
run ( " create stream stream_streamdb.s1 interval(3s, 2s) sliding(3s, 2s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_SLIDING_OFFSET ) ;
2025-07-31 03:30:50 +00:00
// invalid event window
// non exist col
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c10 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_COLUMN ) ;
// invalid psedo col
run ( " create stream stream_streamdb.s1 event_window(start with _wstart > 1 end with c1 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_WINDOW_PC ) ;
run ( " create stream stream_streamdb.s1 event_window(start with _wend > 1 end with c1 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_WINDOW_PC ) ;
run ( " create stream stream_streamdb.s1 event_window(start with _wduration > 1 end with c1 < 1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_WINDOW_PC ) ;
// true for less than 0
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(-1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid true for unit
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TRUE_FOR_UNIT ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for('1y') from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_TRUE_FOR_UNIT ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(1x) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for('1x') from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
2026-01-29 06:54:28 +00:00
// TRUE_FOR COUNT-only syntax tests (T009-T010)
// Valid COUNT-only syntax
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(count 100) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(count 100) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// COUNT 0 is valid (condition always satisfied)
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(count 0) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " ) ;
// COUNT -1 should be rejected
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(count -1) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// COUNT > INT32_MAX should be rejected
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(count 2147483648) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_TRUE_FOR_COUNT , PARSER_STAGE_PARSE ) ;
// Missing COUNT keyword in AND/OR syntax should be rejected
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(10s and 5) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 state_window(c1) true_for(10s or 5) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(10s and 5) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c1 < 1) true_for(10s or 5) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
2025-07-31 03:30:50 +00:00
// invalid count window
// count val greater equal than INT32_MAX
run ( " create stream stream_streamdb.s1 count_window(2147483647) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_STREAM_QUERY ) ;
run ( " create stream stream_streamdb.s1 count_window(2147483648) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_STREAM_QUERY ) ;
// invalid period window
// invalid period unit
run ( " create stream stream_streamdb.s1 period(1u) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_UNIT ) ;
run ( " create stream stream_streamdb.s1 period(1b) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_UNIT ) ;
run ( " create stream stream_streamdb.s1 period(1w) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_UNIT ) ;
run ( " create stream stream_streamdb.s1 period(1n) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_UNIT ) ;
run ( " create stream stream_streamdb.s1 period(1y) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_UNIT ) ;
// period val out of [10a, 3650d]
run ( " create stream stream_streamdb.s1 period(9a) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_RANGE ) ;
run ( " create stream stream_streamdb.s1 period(3660d) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_PERIOD_RANGE ) ;
}
TEST_F ( ParserStreamTest , TestErrorTriggerTable ) {
setAsyncFlag ( " -1 " ) ;
// wrong trigger table type
//run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from information_schema.ins_tables into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2", TSDB_CODE_PAR_PERMISSION_DENIED);
// no trigger table and not period trigger
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_NO_TRIGGER_TABLE ) ;
}
TEST_F ( ParserStreamTest , TestErrorTriggerPartition ) {
setAsyncFlag ( " -1 " ) ;
// partition by not exist tag
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag4 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_COLUMN ) ;
// partition by col
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by c1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TRIGGER ) ;
}
TEST_F ( ParserStreamTest , TestErrorTriggerstream_options ) {
setAsyncFlag ( " -1 " ) ;
// invalid expired time
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1u)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1b)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1w)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1n)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(expired_time(1y)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
// use fill_history with fill_history_first
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(fill_history('2022-02-02 11:11:11') | fill_history_first('2022-02-02 11:11:11')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid max delay
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1u)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1b)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1w)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1n)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(max_delay(1y)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_TIME_UNIT ) ;
// invalid event type
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type('invalid')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(event_type(EVENT_TYPE_INVALID)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid pre filter
// non exist col
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(pre_filter(c10 > 1)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_INVALID_COLUMN ) ;
// no trigger table
run ( " create stream stream_streamdb.s1 period(1s) stream_options(pre_filter(c1 > 1)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PRE_FILTER ) ;
// repeat same option
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(pre_filter(c1 > 1) | pre_filter(c2 < 2)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 stream_options(ignore_disorder|ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
}
TEST_F ( ParserStreamTest , TestErrorNotify ) {
setAsyncFlag ( " -1 " ) ;
// no notify url
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 on(WINDOW_OPEN) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// invalid event type
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') on(INVALID_EVENT) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// event type must be specified when trigger is not period or sliding without interval
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_NOTIFY ) ;
// where condition include cols not from query
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') where c1 > 1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_NOTIFY_COND ) ;
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') where c1 + 2 + 1 into stream_outdb.stream_out as select _twstart, avg(c1), c1 + 1 from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_NOTIFY_COND ) ;
// invalid notify stream_options
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') notify_options(notify_what) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_SYNTAX_ERROR , PARSER_STAGE_PARSE ) ;
// no query but has condition
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 NOTIFY('ws://localhost:8080') where c1 + 2 + 1 " , TSDB_CODE_STREAM_INVALID_NOTIFY_COND ) ;
}
TEST_F ( ParserStreamTest , TestErrorOutTable ) {
setAsyncFlag ( " -1 " ) ;
// no out table (when only notify no query / CALC_NOTIFY_ONLY is valid)
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// out table type not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.st1 as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 partition by tbname into stream_outdb.stream_t1 as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// first column is not ts
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select c1, c2 from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specify sub table when no partition
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out output_subtable('a') as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_SUBTABLE ) ;
// sub table expr using column not in partition list
2025-09-28 07:39:55 +00:00
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 partition by tbname into stream_outdb.stream_out output_subtable(c1) as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_SUBTABLE ) ;
2025-07-31 03:30:50 +00:00
// sub table expr is not string expr
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1 into stream_outdb.stream_out output_subtable(tag1) as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// out col name not match
// default name and exists out table not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_t1 as select _twstart, avg(c1) as c2 from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specified name and exists out table not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_t1(tts, cc1, cc2) as select _twstart, avg(c1) as c2 from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// out col wrong primary key
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out(tts PRIMARY KEY, c1, c2) as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out(tts, c1, c2 PRIMARY KEY) as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specify tags whe no partition
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out tags(tag1 int as 1) as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_OUT_TAGS ) ;
// partition same col multi times
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.stream_t1 partition by tbname, tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_PAR_DUPLICATED_COLUMN ) ;
// tag name not match
// default tag and exists out table not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2 into stream_outdb.st1 as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag3, tag1, tag2 into stream_outdb.st1 as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tbname, tag1, tag2 into stream_outdb.st1 as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specified tag name and exists out table not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.st1 tags(tag6 int as tag1, tag7 varchar(18) as tag2, tag8 timestamp as tag3) as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specified tag type and exists out table not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.st1 tags(tag1 int as tag1, tag2 varchar(18) as tag2, tag3 int as tag3) as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// specified tag expr's type and specified tag type not match
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3 into stream_outdb.st1 tags(tag1 int as cos(tag1), tag2 varchar(18) as tag2, tag3 int as tag3) as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_OUT_TABLE ) ;
// out tag expr using column not in partition list
2025-09-28 07:39:55 +00:00
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2 into stream_outdb.stream_out tags(tag3 int as tag3) as select * from stream_querydb.stream_t1 " , TSDB_CODE_STREAM_INVALID_SUBTABLE ) ;
2025-07-31 03:30:50 +00:00
}
TEST_F ( ParserStreamTest , TestErrorQueryPlaceHolder ) {
setAsyncFlag ( " -1 " ) ;
// _tprev_ts must be used with sliding
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tprev_ts, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _tcurrent_ts must be used with sliding
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tcurrent_ts, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _tnext_ts must be used with sliding
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tnext_ts, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _twstart must be used with trigger with window(not period or sliding without interval)
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _twend must be used with trigger with window(not period or sliding without interval)
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _twduration must be used with trigger with window(not period or sliding without interval)
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, _twduration, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, _twduration, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _twrownum must be used with trigger with window(not period or sliding without interval)
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, _twrownum, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
run ( " create stream stream_streamdb.s1 period(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tlocaltime, _twrownum, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _tprev_localtime must be used with period
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tprev_localtime, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// _tnext_localtime must be used with period
run ( " create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.stream_t1 into stream_outdb.stream_out as select _tnext_localtime, avg(c1) from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// %%n can not greater than list length of partition
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3, tbname into stream_outdb.stream_out as select _tlocaltime, %%1, %%2, %%3, %%5 from %%tbname " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// %%n can not less than 1
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1, tag2, tag3, tbname into stream_outdb.stream_out as select _tlocaltime, %%0, %%1, %%2 from %%tbname " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// %%n must be used with partition
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.stream_out as select _tlocaltime, %%1 from stream_triggerdb.st1 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
// %%tbname can only be used when partition by tbname
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1 into stream_outdb.stream_out as select _tlocaltime, %%tbname from stream_querydb.stream_t2 " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
run ( " create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 partition by tag1 into stream_outdb.stream_out as select _tlocaltime, c1 from %%tbname " , TSDB_CODE_STREAM_INVALID_PLACE_HOLDER ) ;
}
2025-07-16 06:42:16 +00:00
} // namespace ParserTest