2025-05-12 10:18:00 +00:00
/*
2025-06-10 10:56:01 +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/>.
*/
2025-05-12 10:18:00 +00:00
# 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-05-16 09:00:14 +00:00
* trigger_type [ FROM [ db_name . ] table_name ] [ PARTITION BY col1 [ , . . . ] ] [ OPTIONS ( stream_option [ | . . . ] ) ] [ notification_definition ]
2025-05-12 10:18:00 +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-05-16 09:00:14 +00:00
* NOTIFY ( url [ , . . . ] ) [ ON ( event_types ) ] [ WHERE condition ] [ NOTIFY_OPTIONS ( notify_option [ | notify_option ] ) ]
2025-05-12 10:18:00 +00:00
*
* notify_option : [ NOTIFY_HISTORY | ON_FAILURE_PAUSE ]
*
* tag_definition :
* tag_name type_name [ COMMENT ' string_value ' ] AS expr
*/
2025-06-10 10:56:01 +00:00
void setCreateStreamStreamName ( SCMCreateStreamReq * expect , const char * pStream , const char * pStreamDb ) {
2025-05-12 10:18:00 +00:00
expect - > name = taosStrdup ( pStream ) ;
expect - > streamDB = taosStrdup ( pStreamDb ) ;
2025-06-10 10:56:01 +00:00
}
// 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 ) {
2025-05-12 10:18:00 +00:00
expect - > triggerDB = taosStrdup ( pTriggerDb ) ;
expect - > triggerTblName = taosStrdup ( pTriggerTblName ) ;
2025-06-10 10:56:01 +00:00
}
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 ) {
2025-06-10 00:35:50 +00:00
if ( expect - > calcDB ! = nullptr ) {
2025-06-10 10:56:01 +00:00
taosArrayClearP ( expect - > calcDB , nullptr ) ;
taosMemoryFreeClear ( expect - > calcDB ) ;
2025-05-12 10:18:00 +00:00
}
2025-06-10 00:35:50 +00:00
expect - > calcDB = taosArrayInit ( 1 , POINTER_BYTES ) ;
2025-05-12 10:18:00 +00:00
char * tmpCalcDb = taosStrdup ( pCalcDb ) ;
ASSERT_TRUE ( taosArrayPush ( expect - > calcDB , & tmpCalcDb ) ) ;
}
2025-06-10 10:56:01 +00:00
void setCreateStreamSql ( SCMCreateStreamReq * expect , const char * pSql ) {
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 ) ;
}
2025-05-12 10:18:00 +00:00
void setCreateStreamTriggerScanPlan ( SCMCreateStreamReq * expect , const char * pTriggerScanPlan ) {
expect - > triggerScanPlan = taosStrdup ( pTriggerScanPlan ) ;
}
void setCreateStreamQueryCalcPlan ( SCMCreateStreamReq * expect , const char * pStreamQueryCalcPlan ) {
expect - > calcPlan = taosStrdup ( pStreamQueryCalcPlan ) ;
}
void setCreateStreamSubTblNameExpr ( SCMCreateStreamReq * expect , const char * pSubTblNameExpr ) {
expect - > subTblNameExpr = taosStrdup ( pSubTblNameExpr ) ;
}
2025-06-12 07:37:03 +00:00
void resetCreateStreamSubTblNameExpr ( SCMCreateStreamReq * expect ) {
expect - > subTblNameExpr = nullptr ;
}
2025-05-12 10:18:00 +00:00
void setCreateStreamTagValueExpr ( SCMCreateStreamReq * expect , const char * pTagValueExpr ) {
expect - > tagValueExpr = taosStrdup ( pTagValueExpr ) ;
}
2025-06-12 07:37:03 +00:00
void resetCreateStreamTagValueExpr ( SCMCreateStreamReq * expect ) {
expect - > tagValueExpr = nullptr ;
}
2025-06-10 10:56:01 +00:00
void setCreateStreamIgDisorder ( SCMCreateStreamReq * expect , int8_t igDisorder ) {
2025-05-12 10:18:00 +00:00
expect - > igDisorder = igDisorder ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamDeleteReCalc ( SCMCreateStreamReq * expect , int8_t deleteReCalc ) {
2025-05-12 10:18:00 +00:00
expect - > deleteReCalc = deleteReCalc ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamDeleteOutTbl ( SCMCreateStreamReq * expect , int8_t deleteOutTbl ) {
2025-05-12 10:18:00 +00:00
expect - > deleteOutTbl = deleteOutTbl ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamFillHistory ( SCMCreateStreamReq * expect , int8_t fillHistory ) {
2025-05-12 10:18:00 +00:00
expect - > fillHistory = fillHistory ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamFillHistoryFirst ( SCMCreateStreamReq * expect , int8_t fillHistoryFirst ) {
2025-05-12 10:18:00 +00:00
expect - > fillHistoryFirst = fillHistoryFirst ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamCalcNotifyOnly ( SCMCreateStreamReq * expect , int8_t calcNotifyOnly ) {
2025-05-12 10:18:00 +00:00
expect - > calcNotifyOnly = calcNotifyOnly ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamLowLatencyCalc ( SCMCreateStreamReq * expect , int8_t lowLatencyCalc ) {
2025-05-12 10:18:00 +00:00
expect - > lowLatencyCalc = lowLatencyCalc ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamMaxDelay ( SCMCreateStreamReq * expect , int64_t maxDelay ) {
2025-05-12 10:18:00 +00:00
expect - > maxDelay = maxDelay ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamFillHistoryStartTime ( SCMCreateStreamReq * expect , int64_t fillHistoryStartTime ) {
2025-05-12 10:18:00 +00:00
expect - > fillHistoryStartTime = fillHistoryStartTime ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamWatermark ( SCMCreateStreamReq * expect , int64_t watermark ) {
2025-05-12 10:18:00 +00:00
expect - > watermark = watermark ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamExpiredTime ( SCMCreateStreamReq * expect , int64_t expiredTime ) {
2025-05-12 10:18:00 +00:00
expect - > expiredTime = expiredTime ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamEventTypes ( SCMCreateStreamReq * expect , int64_t eventTypes ) {
2025-05-12 10:18:00 +00:00
expect - > eventTypes = eventTypes ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamFlags ( SCMCreateStreamReq * expect , int64_t flags ) {
2025-05-12 10:18:00 +00:00
expect - > flags = flags ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamTsmaId ( SCMCreateStreamReq * expect , int64_t tsmaId ) {
2025-05-12 10:18:00 +00:00
expect - > tsmaId = tsmaId ;
2025-06-10 10:56:01 +00:00
}
void setCreateStreamPlaceHolderBitmap ( SCMCreateStreamReq * expect , int64_t placeHolderBitmap ) {
2025-05-12 10:18:00 +00:00
expect - > placeHolderBitmap = placeHolderBitmap ;
2025-06-10 10:56:01 +00:00
}
2025-07-05 02:07:11 +00:00
void setCreateStreamCalcTsSlotId ( SCMCreateStreamReq * expect , int16_t calcTsSlotId ) {
expect - > calcTsSlotId = calcTsSlotId ;
2025-05-12 10:18:00 +00:00
}
2025-06-10 10:56:01 +00:00
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 ) ;
2025-07-05 02:07:11 +00:00
setCreateStreamCalcTsSlotId ( expect , tsSlotId ) ;
2025-06-10 10:56:01 +00:00
}
2025-05-12 10:18:00 +00:00
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 ) ;
}
2025-06-12 07:37:03 +00:00
void resetCreateStreamOutCols ( SCMCreateStreamReq * expect ) {
if ( expect - > outCols ) {
taosArrayDestroy ( expect - > outCols ) ;
expect - > outCols = nullptr ;
}
}
2025-05-12 10:18:00 +00:00
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 ) ;
}
2025-06-12 07:37:03 +00:00
void resetCreateStreamOutTags ( SCMCreateStreamReq * expect ) {
if ( expect - > outTags ) {
taosArrayDestroy ( expect - > outTags ) ;
expect - > outTags = nullptr ;
}
}
2025-05-12 10:18:00 +00:00
void setCreateStreamTriggerCols ( SCMCreateStreamReq * expect , const char * pCols ) {
expect - > triggerCols = taosStrdup ( pCols ) ;
}
2025-06-10 10:56:01 +00:00
void resetCreateStreamTriggerCols ( SCMCreateStreamReq * expect ) {
2025-06-12 07:37:03 +00:00
if ( expect - > triggerCols ) {
taosMemoryFree ( expect - > triggerCols ) ;
expect - > triggerCols = nullptr ;
}
2025-06-10 10:56:01 +00:00
}
2025-05-12 10:18:00 +00:00
void setCreateStreamPartitionCols ( SCMCreateStreamReq * expect , const char * pCols ) {
expect - > partitionCols = taosStrdup ( pCols ) ;
}
2025-06-12 07:37:03 +00:00
void resetCreateStreamPartitionCols ( SCMCreateStreamReq * expect ) {
expect - > partitionCols = nullptr ;
}
2025-05-12 10:18:00 +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 ;
}
2025-06-10 10:56:01 +00:00
void setCreateStreamTriggerCount ( SCMCreateStreamReq * expect , int64_t countVal , int64_t sliding ) {
2025-05-12 10:18:00 +00:00
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 ) ;
2025-06-10 10:56:01 +00:00
ASSERT_TRUE ( taosArrayPush ( expect - > pNotifyAddrUrls , & tmpUrl ) ) ;
2025-05-12 10:18:00 +00:00
} ;
void setCreateStreamNotify ( SCMCreateStreamReq * expect , int8_t notifyEventTypes , int8_t notifyErrorHandle , int8_t notifyHistory ) {
expect - > notifyEventTypes = notifyEventTypes ;
expect - > notifyErrorHandle = notifyErrorHandle ;
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 ) ;
}
2025-06-10 10:56:01 +00:00
void resetCreateStreamQueryScanPlan ( SCMCreateStreamReq * expect ) {
taosArrayDestroyP ( expect - > calcScanPlanList , nullptr ) ;
expect - > calcScanPlanList = nullptr ;
}
2025-05-12 10:18:00 +00:00
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 ) ;
}
2025-06-12 07:37:03 +00:00
void delete_all_specified_fields ( cJSON * node , const char * fieldName ) {
2025-05-12 10:18:00 +00:00
if ( ! node ) return ;
if ( cJSON_IsObject ( node ) ) {
cJSON * item = node - > child ;
cJSON * next = NULL ;
while ( item ) {
next = item - > next ;
2025-06-12 07:37:03 +00:00
if ( strcmp ( item - > string , fieldName ) = = 0 ) {
cJSON_DeleteItemFromObject ( node , fieldName ) ;
2025-05-12 10:18:00 +00:00
} else {
2025-06-12 07:37:03 +00:00
delete_all_specified_fields ( item , fieldName ) ;
2025-05-12 10:18:00 +00:00
}
item = next ;
}
} else if ( cJSON_IsArray ( node ) ) {
int32_t size = cJSON_GetArraySize ( node ) ;
for ( int i = 0 ; i < size ; + + i ) {
2025-06-12 07:37:03 +00:00
delete_all_specified_fields ( cJSON_GetArrayItem ( node , i ) , fieldName ) ;
2025-05-12 10:18:00 +00:00
}
}
}
2025-06-12 07:37:03 +00:00
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 " ) ;
char * j1Str = cJSON_PrintUnformatted ( j1 ) ;
char * j2Str = cJSON_PrintUnformatted ( j2 ) ;
ASSERT_EQ ( std : : string ( j1Str ) , std : : string ( j2Str ) ) ;
cJSON_Delete ( j1 ) ;
cJSON_Delete ( j2 ) ;
2025-06-17 01:26:48 +00:00
free ( j1Str ) ;
free ( j2Str ) ;
2025-06-12 07:37:03 +00:00
}
2025-05-12 10:18:00 +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
2025-06-12 07:37:03 +00:00
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-05-12 10:18:00 +00:00
char * j1Str = cJSON_PrintUnformatted ( j1 ) ;
char * j2Str = cJSON_PrintUnformatted ( j2 ) ;
ASSERT_EQ ( std : : string ( j1Str ) , std : : string ( j2Str ) ) ;
cJSON_Delete ( j1 ) ;
cJSON_Delete ( j2 ) ;
2025-06-17 01:26:48 +00:00
free ( j1Str ) ;
free ( j2Str ) ;
2025-05-12 10:18:00 +00:00
}
void checkCreateStreamReq ( SCMCreateStreamReq * expect , SCMCreateStreamReq * req ) {
// stream name part
2025-06-10 10:56:01 +00:00
cout < < " checkCreateStreamReq: " < < expect - > sql < < endl ;
2025-05-12 10:18:00 +00:00
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
2025-06-12 07:37:03 +00:00
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 ) ) ;
}
2025-05-12 10:18:00 +00:00
}
2025-06-12 07:37:03 +00:00
2025-05-12 10:18:00 +00:00
ASSERT_EQ ( req - > notifyEventTypes , expect - > notifyEventTypes ) ;
ASSERT_EQ ( req - > notifyErrorHandle , expect - > notifyErrorHandle ) ;
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 {
2025-06-12 07:37:03 +00:00
ASSERT_TRUE ( expect - > partitionCols ! = nullptr ) ;
2025-05-12 10:18:00 +00:00
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 ) ;
2025-06-10 00:35:50 +00:00
if ( BIT_FLAG_TEST_MASK ( req - > placeHolderBitmap , PLACE_HOLDER_PARTITION_ROWS ) ) {
2025-07-05 02:07:11 +00:00
ASSERT_EQ ( req - > calcTsSlotId , expect - > calcTsSlotId ) ;
2025-05-12 10:18:00 +00:00
}
2025-06-10 10:56:01 +00:00
ASSERT_EQ ( req - > triggerTblVgId , expect - > triggerTblVgId ) ;
ASSERT_EQ ( req - > outTblVgId , expect - > outTblVgId ) ;
2025-06-12 07:37:03 +00:00
checkCreateStreamTriggerScanPlan ( expect , req ) ;
2025-05-12 10:18:00 +00:00
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 ) ) ;
}
2025-06-10 10:56:01 +00:00
if ( req - > subTblNameExpr = = nullptr ) {
ASSERT_TRUE ( expect - > subTblNameExpr = = nullptr ) ;
} else {
2025-06-12 07:37:03 +00:00
ASSERT_TRUE ( expect - > subTblNameExpr ! = nullptr ) ;
2025-06-10 10:56:01 +00:00
ASSERT_EQ ( std : : string ( ( char * ) req - > subTblNameExpr ) , std : : string ( ( char * ) expect - > subTblNameExpr ) ) ;
}
2025-05-12 10:18:00 +00:00
if ( req - > tagValueExpr = = nullptr ) {
ASSERT_TRUE ( expect - > tagValueExpr = = nullptr ) ;
} else {
2025-06-12 07:37:03 +00:00
ASSERT_TRUE ( expect - > tagValueExpr ! = nullptr ) ;
2025-05-12 10:18:00 +00:00
ASSERT_EQ ( std : : string ( ( char * ) req - > tagValueExpr ) , std : : string ( ( char * ) expect - > tagValueExpr ) ) ;
}
2025-06-12 07:37:03 +00:00
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-05-12 10:18:00 +00:00
}
}
2025-07-15 08:23:25 +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", "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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", 0);
//
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 8, -1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\":\"strea
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
/ / setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 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 \" : \" \" , \" 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}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" 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_2 \" , \" UserAlias \" : \" avg(c1) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _twstart \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 178 \" , \" Type \" : \" 3524 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// 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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb_2.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// // trigger db name
// setCreateStreamTriggerTable(&expect, "0.stream_triggerdb_2", "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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"59\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb_2\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"59\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"59\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"59\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\"
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// // trigger table name
// setCreateStreamTriggerTable(&expect, "0.stream_triggerdb_2", "t2", WINDOW_TYPE_INTERVAL, TSDB_NORMAL_TABLE, 60, 0, 1);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"59\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t1\",\"TableAlias\":\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"60\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb_2\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"281596734614822715\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"7068875265887176256\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"15470507899942139204\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"4\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_5\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"60\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"60\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"60\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"c3\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"60\",\"TableType\":\"3\",\"ColId\":\"4\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c3\",\"DataBl
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.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.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// // query db name
// setCreateStreamCalcDb(&expect, "0.stream_querydb_2");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"40\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_twstart\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"178\",\"Type\":\"3524\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlia
// resetCreateStreamQueryScanPlan(&expect);
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"40\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"40\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"40\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.t2");
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.t2");
//
// // query table name
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"39\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_twstart\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"178\",\"Type\":\"3524\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlia
// resetCreateStreamQueryScanPlan(&expect);
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"8280654498900312045\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"39\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"39\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"39\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb_2\",\"TableName\":\"t1\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.t1");
// run("create stream stream_streamdb.s1_2 interval(1s) sliding(1s) from stream_triggerdb_2.t2 into stream_outdb_2.stream_out as select _twstart, avg(c1) from stream_querydb_2.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", "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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", 0);
//
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 8, -1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\":\"strea
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
/ / setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 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 \" : \" \" , \" 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}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" 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_2 \" , \" UserAlias \" : \" avg(c1) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _twstart \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 178 \" , \" Type \" : \" 3524 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// 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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// // test water mark
// setCreateStreamWatermark(&expect, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(watermark(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(watermark(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// setCreateStreamWatermark(&expect, 1000000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(watermark(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(watermark(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamWatermark(&expect, 0);
//
// // expired_time
// setCreateStreamExpiredTime(&expect, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// setCreateStreamExpiredTime(&expect, 1000000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamExpiredTime(&expect, 0);
//
// // ignore disorder
// setCreateStreamIgDisorder(&expect, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamIgDisorder(&expect, false);
//
// // delete recalc
// setCreateStreamDeleteReCalc(&expect, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(delete_recalc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(delete_recalc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamDeleteReCalc(&expect, false);
//
// // delete output table
// setCreateStreamDeleteOutTbl(&expect, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(delete_output_table ) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(delete_output_table ) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 options(fill_history('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(fill_history('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 options(fill_history_first('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(fill_history_first('2025-06-11 15:17:14')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 options(calc_notify_only) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(calc_notify_only) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamCalcNotifyOnly(&expect, false);
//
// // low latency calc
// setCreateStreamLowLatencyCalc(&expect, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(low_latency_calc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(low_latency_calc) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// setCreateStreamLowLatencyCalc(&expect, false);
//
// // force output
// // TODO(smj) : add later
// //setCreateStreamForceOutputCols(&expect, true);
//
// // pre filter
// // TODO(smj) : add later
//
// // max delay
// setCreateStreamMaxDelay(&expect, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1000a)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// setCreateStreamMaxDelay(&expect, 1000000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1000s)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 options(event_type(window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
//
// setCreateStreamEventTypes(&expect, EVENT_WINDOW_OPEN);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(window_open)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2 ");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(window_open)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2 ");
//
// setCreateStreamEventTypes(&expect, EVENT_WINDOW_OPEN | EVENT_WINDOW_CLOSE);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(window_open | window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2 ");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(window_open | window_close)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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", "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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2", 0);
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 512, -1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\":\"strea
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// 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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 session(ts, 1a) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerSession(&expect, 1000, 0);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 session(ts, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 session(ts, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
//
// // test state window
// setCreateStreamTriggerType(&expect, WINDOW_TYPE_STATE);
// setCreateStreamTriggerState(&expect, 1, 0);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 state_window(c1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 state_window(c1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerState(&expect, 2, 0);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 state_window(c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 state_window(c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerState(&expect, 2, 1);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 state_window(c2) true_for(1a) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 state_window(c2) true_for(1a) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerState(&expect, 2, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 state_window(c2) true_for(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 state_window(c2) true_for(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// // interval window
// setCreateStreamTriggerType(&expect, WINDOW_TYPE_INTERVAL);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamTriggerSliding(&expect, 0, 's', 0, 0, 0, 0, 0, 1000, 0);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 sliding(100s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerSliding(&expect, 'h', 's', 0, 's', 0, 3600000, 0, 100000, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1h) sliding(100s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1h) sliding(100s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerSliding(&expect, 'h', 's', 'm', 's', 0, 3600000, 60000, 100000, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1h, 1m) sliding(100s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1h, 1m) sliding(100s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// // event window
// setCreateStreamTriggerType(&expect, WINDOW_TYPE_EVENT);
// setCreateStreamTriggerEvent(&expect,
// "{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"3831883314967181845\",\"UserAlias\":\"c1 > 1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"40\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"5001870860487857737\",\"UserAlias\":\"1\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"42\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"5001870860487857737\",\"UserAlias\":\"1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"1\",\"Literal\":\"1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"1\"}}}}",
// 0);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerEvent(&expect,
// "{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"3831883314967181845\",\"UserAlias\":\"c1 > 1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"40\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"5001870860487857737\",\"UserAlias\":\"1\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"42\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"5001870860487857737\",\"UserAlias\":\"1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"1\",\"Literal\":\"1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"1\"}}}}",
// 3600000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) true_for(1h) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 event_window(start with c1 > 1 end with c2 < 1) true_for(1h) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
//
// // count window
// setCreateStreamTriggerType(&expect, WINDOW_TYPE_COUNT);
// setCreateStreamTriggerCount(&expect, 10, 10);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 count_window(10) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 count_window(10) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerCount(&expect, 20, 10);
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 count_window(20, 10) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 count_window(20, 10) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerCount(&expect, 20, 20);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"Conditions\":{\"NodeType\":\"4\",\"Name\":\"LogicCondition\",\"LogicCondition\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"CondType\":\"2\",\"Parameters\":[{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"101\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"101\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"C
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 count_window(20, c1, c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 count_window(20, c1, c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerCount(&expect, 20, 10);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"Conditions\":{\"NodeType\":\"4\",\"Name\":\"LogicCondition\",\"LogicCondition\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"CondType\":\"2\",\"Parameters\":[{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"101\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"3\",\"Name\":\"Operator\",\"Operator\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"101\",\"Left\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}},\"Right\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"C
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 count_window(20, 10, c1, c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 count_window(20, 10, c1, c2) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// // period window
// resetCreateStreamTriggerCols(&expect);
// setCreateStreamTriggerType(&expect, WINDOW_TYPE_PERIOD);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\":\"strea
// setCreateStreamTriggerPeriod(&expect, 0, 's', 0, 0, 1000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamTriggerPeriod(&expect, 's', 'm', 0, 1000, 60000);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 period(1m, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 period(1m, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.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.t2", 0);
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 512, -1);
/ / setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1128 \" , \" 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 \" : \" 336 \" , \" OutputRowSize \" : \" 336 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14571649193271883137 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 5 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 6 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_7 \" }}], \" Precision \" : \" 0 \" }}, \" 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 \" , \" 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 \" }}}},{ \" 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 \" , \" 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 \" }}}},{ \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_4 \" , \" UserAlias \" : \" tag1 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"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\"}}]");
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// 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, 274, 0, 0);
// setCreateStreamSubTblNameExpr(&expect, "{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"59\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"concat\",\"Id\":\"70\",\"Type\":\"1502\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"34\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"md5\",\"Id\":\"134\",\"Type\":\"1509\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"18\",\"Literal\":\"stream_streamdb.s1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"stream_streamdb.s1\"}}],\"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\":\"\",\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"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\":\"\",\"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\"}}}");
// setCreateStreamTriggerSliding(&expect, 's', 's', 0, 0, 0, 1000, 0, 1000, 0);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// 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.t2");
//
//
// resetCreateStreamOutTags(&expect);
// addCreateStreamOutTags(&expect, "tag_tbname", TSDB_DATA_TYPE_BINARY, 0, 274, 0, 0);
// addCreateStreamOutTags(&expect, "tag1", TSDB_DATA_TYPE_INT, 0, 4, 0, 0);
// addCreateStreamOutTags(&expect, "tag2", TSDB_DATA_TYPE_BINARY, 0, 22, 0, 0);
// addCreateStreamOutTags(&expect, "tag3", TSDB_DATA_TYPE_TIMESTAMP, 0, 8, 0, 0);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Litera
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\",\"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\",\"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\",\"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\"}}]");
// 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.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.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", "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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2", 0);
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 512, -1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"1\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"0\",\"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\":\"8280654498900312045\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3557205140367942817\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6164016115312601301\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_4\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"3\",\"Expr\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"expr_4\",\"UserAlias\":\"tbname\",\"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\":\"strea
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"49\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"t1\",\"TableAlias\":\"t1\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}]");
// 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.t1 into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.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.t1 notify('ws://localhost:8080') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 notify('ws://localhost:8080') on (window_close) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.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.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.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
//
// // ON EVENT
// setCreateStreamNotify(&expect, EVENT_WINDOW_CLOSE, false, false);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
//
// setCreateStreamNotify(&expect, EVENT_WINDOW_OPEN, false, false);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.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.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.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
//
// // where condition
// // TODO(smj) add later
//
// // notify options
// setCreateStreamNotify(&expect, EVENT_WINDOW_CLOSE, false, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.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.t2");
//
// setCreateStreamNotify(&expect, EVENT_WINDOW_CLOSE, true, false);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(on_failure_pause) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(on_failure_pause) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// setCreateStreamNotify(&expect, EVENT_WINDOW_CLOSE, true, true);
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(notify_history|on_failure_pause) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 notify('ws://localhost:8080', 'ws://localhost:8080/notify') on (window_close) notify_options(notify_history|on_failure_pause) into stream_outdb.stream_out as select _tlocaltime, avg(c1) from stream_querydb.t2");
//
// clearCreateStreamReq();
//}
//
//TEST_F(ParserStreamTest, TestOutTable) {
// 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);
// //memset(&req, 0, sizeof(SCMCreateStreamReq));
// });
//
// 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.t2", 0);
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 512, -1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"3\",\"SubplanId\":\"4\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"2\",\"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\":\"6\",\"TotalRowSize\":\"336\",\"OutputRowSize\":\"336\",\"Slots\":[{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"4536029962895989025\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14571649193271883137\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6624793664427087962\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"4\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14710156417485655547\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"5\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6560904107297596314\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"6\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_7\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"6\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"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\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"6\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"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\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"6\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"42\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\",\"TableAlias\":\"st1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"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\"}}]");
// 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.t2");
//
// // out table type
// setCreateStreamOutTable(&expect, "0.stream_outdb", "stream_out", TSDB_SUPER_TABLE, 0, 0, 1, 0);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"2\",\"SubplanId\":\"2\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"1\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"2\",\"TotalRowSize\":\"336\",\"OutputRowSize\":\"336\",\"Slots\":[{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"4536029962895989025\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14571649193271883137\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6624793664427087962\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"4\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14710156417485655547\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"5\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6560904107297596314\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"6\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_7\"}}],\"Precision\":\"0\"}},\"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\",\"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\"}}}},{\"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\",\"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\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"42\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\",\"TableAlias\":\"st1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"T
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"tag1\",\"UserAlias\":\"tag1\",\"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\",\"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\",\"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\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// addCreateStreamOutTags(&expect, "tag1", TSDB_DATA_TYPE_INT, 0, 4, 0, 0);
// addCreateStreamOutTags(&expect, "tag2", TSDB_DATA_TYPE_BINARY, 0, 22, 0, 0);
// addCreateStreamOutTags(&expect, "tag3", TSDB_DATA_TYPE_TIMESTAMP, 0, 8, 0, 0);
// addCreateStreamOutTags(&expect, "tag_tbname", TSDB_DATA_TYPE_BINARY, 0, 274, 0, 0);
// setCreateStreamSubTblNameExpr(&expect, "{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"59\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"concat\",\"Id\":\"70\",\"Type\":\"1502\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"34\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"md5\",\"Id\":\"134\",\"Type\":\"1509\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"18\",\"Literal\":\"stream_streamdb.s1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"stream_streamdb.s1\"}}],\"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\":\"\",\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Litera
// 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.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.t2");
//
// resetCreateStreamOutCols(&expect);
// resetCreateStreamOutTags(&expect);
// resetCreateStreamQueryScanPlan(&expect);
// setCreateStreamOutTable(&expect, "0.stream_outdb", "st1", TSDB_SUPER_TABLE, 1, 0, 0, 0);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"2\",\"SubplanId\":\"2\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"1\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"2\",\"TotalRowSize\":\"336\",\"OutputRowSize\":\"336\",\"Slots\":[{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"4536029962895989025\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14571649193271883137\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6624793664427087962\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"4\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14710156417485655547\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"5\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6560904107297596314\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"6\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_7\"}}],\"Precision\":\"0\"}},\"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\",\"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\"}}}},{\"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\",\"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\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"42\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\",\"TableAlias\":\"st1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"T
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"tag1\",\"UserAlias\":\"tag1\",\"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\",\"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\",\"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\"}}]");
// addCreateStreamOutTags(&expect, "tag1", TSDB_DATA_TYPE_INT, 0, 4, 0, 0);
// addCreateStreamOutTags(&expect, "tag2", TSDB_DATA_TYPE_BINARY, 0, 22, 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, 22, 0, 0);
// setCreateStreamPlaceHolderBitmap(&expect, 0);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"0\"}}");
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"0\",\"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\":\"0\",\"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\":\"281596734614822715\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"7068875265887176256\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"expr_2\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"0\",\"SlotId\":\"2\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"expr_3\",\"UserAlias\":\"c2\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"Name\":\"PhysiDispatch\",\"PhysiDispatch\":{\"InputDataBlockDesc\":{\"Nod
// setCreateStreamSubTblNameExpr(&expect, "{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"59\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"concat\",\"Id\":\"70\",\"Type\":\"1502\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"34\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"md5\",\"Id\":\"134\",\"Type\":\"1509\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"18\",\"Literal\":\"stream_streamdb.s1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"stream_streamdb.s1\"}}],\"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\":\"\",\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// 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.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.t2");
//
// resetCreateStreamOutTags(&expect);
// resetCreateStreamPartitionCols(&expect);
// resetCreateStreamSubTblNameExpr(&expect);
// resetCreateStreamTagValueExpr(&expect);
// setCreateStreamOutTable(&expect, "0.stream_outdb", "t1", TSDB_NORMAL_TABLE, 0, 0, 1, 1);
// setCreateStreamTriggerScanPlan(&expect, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"2\",\"SubplanId\":\"2\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"1\",\"DbFName\":\"0.stream_triggerdb\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"RootNode\":{\"NodeType\":\"1101\",\"Name\":\"PhysiTableScan\",\"PhysiTableScan\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"2\",\"TotalRowSize\":\"336\",\"OutputRowSize\":\"336\",\"Slots\":[{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"4536029962895989025\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"2\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14571649193271883137\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"3\",\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6624793664427087962\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"4\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"Reserve\":false,\"Output\":true,\"Name\":\"14710156417485655547\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"5\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"6560904107297596314\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"6\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"Reserve\":false,\"Output\":true,\"Name\":\"expr_7\"}}],\"Precision\":\"0\"}},\"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\",\"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\"}}}},{\"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\",\"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\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"42\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\",\"TableAlias\":\"st1\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"ScanPseudoCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"T
// setCreateStreamSql(&expect, "create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.t1 as select ts, c1, c2 from stream_querydb.t2");
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.st1 into stream_outdb.t1 as select ts, c1, c2 from stream_querydb.t2");
//
// // sub table name expr
// setCreateStreamOutTable(&expect, "0.stream_outdb", "stream_out", TSDB_SUPER_TABLE, 0, 0, 1, 0);
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"tag1\",\"UserAlias\":\"tag1\",\"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\",\"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\",\"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\"}}]");
// addCreateStreamOutTags(&expect, "tag1", TSDB_DATA_TYPE_INT, 0, 4, 0, 0);
// addCreateStreamOutTags(&expect, "tag2", TSDB_DATA_TYPE_BINARY, 0, 22, 0, 0);
// addCreateStreamOutTags(&expect, "tag3", TSDB_DATA_TYPE_TIMESTAMP, 0, 8, 0, 0);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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)\",\"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_'\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}");
// 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.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.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, 22, 0, 0);
// setCreateStreamSubTblNameExpr(&expect, "{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"59\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"concat\",\"Id\":\"70\",\"Type\":\"1502\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"34\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"md5\",\"Id\":\"134\",\"Type\":\"1509\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"18\",\"Literal\":\"stream_streamdb.s1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"stream_streamdb.s1\"}}],\"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\":\"\",\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"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\":\"\",\"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\"}}}");
// 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.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.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, 22, 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);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"7080784029850824542\",\"UserAlias\":\"cast(tag1 + 1 as int)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"OpType\":\"1\",\"Left\":{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\",\"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\":\"\",\"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)\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"2\"}}],\"UdfBufSize\":\"0\",\"HasPk\":false,\"PkBytes\":\"0\",\"IsMer
// 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.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.t2");
//
// clearCreateStreamReq();
//}
//
//TEST_F(ParserStreamTest, TestQuery) {
// 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.t2", 0);
// setCreateStreamOption(&expect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EVENT_WINDOW_CLOSE, 0, 0, 512, -1);
/ / setCreateStreamTriggerScanPlan ( & expect , " { \" NodeType \" : \" 1128 \" , \" 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 \" : \" 336 \" , \" OutputRowSize \" : \" 336 \" , \" Slots \" :[{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 0 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 3785532846947205635 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 4536029962895989025 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 2 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14571649193271883137 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 3 \" , \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6624793664427087962 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 4 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 20 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 14710156417485655547 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 5 \" , \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" 6560904107297596314 \" }},{ \" NodeType \" : \" 20 \" , \" Name \" : \" SlotDesc \" , \" SlotDesc \" :{ \" SlotId \" : \" 6 \" , \" DataType \" :{ \" Type \" : \" 8 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 272 \" }, \" Reserve \" :false, \" Output \" :true, \" Name \" : \" expr_7 \" }}], \" Precision \" : \" 0 \" }}, \" 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 \" , \" 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 \" }}}},{ \" 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 \" , \" 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 \" }}}},{ \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 42 \" , \" TableType \" : \" 1 \" , \" ColId \" : \" 3 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_triggerdb \" , \" TableName \" : \" st1 \" , \" TableAlias \" : \" st1 \" , \" ColName \" : \" c2 \" , \" SlotId \" : \" 0 \" , \" TableHasPk \" :false, \" IsPk \" :false, \" NumOfPKs \" : \" 0 \" }}}}], \" ScanPseudoCols \" :[{ \" NodeType \" : \" 18 \" , \" Name \" : \" Target \" , \" Target \" :{ \" SlotId \" : \" 3 \" , \" Expr \" :{ \" NodeType \" : \" 1 \" , \" Name \" : \" Column \" , \" Column \" :{ \" DataType \" :{ \" Type \" : \" 4 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 4 \" }, \" AliasName \" : \" expr_4 \" , \" UserAlias \" : \" tag1 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\":\"3612687029497005528\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"281596734614822715\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"0\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}},{\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"t2\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}}}],\"TableId\":\"30\",\"STableId\":\"0\",\"TableType\":\"3\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// setCreateStreamTriggerCols(&expect, "[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"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\"}}]");
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// 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, 274, 0, 0);
// setCreateStreamSubTblNameExpr(&expect, "{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"59\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"concat\",\"Id\":\"70\",\"Type\":\"1502\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"34\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Name\":\"md5\",\"Id\":\"134\",\"Type\":\"1509\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"20\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"18\",\"Literal\":\"stream_streamdb.s1\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"stream_streamdb.s1\"}}],\"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\":\"\",\"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\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"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\":\"\",\"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\"}}}");
// setCreateStreamTriggerSliding(&expect, 's', 's', 0, 0, 0, 1000, 0, 1000, 0);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}]");
// 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.t2");
//
// // placeholder type
// // _tprev_ts
// resetCreateStreamOutCols(&expect);
// 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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tprev_ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"175\",\"Type\":\"3521\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias
// 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 _tprev_ts, avg(c1) from stream_querydb.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 _tprev_ts, avg(c1) from stream_querydb.t2");
//
// // _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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tcurrent_ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"176\",\"Type\":\"3522\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAl
// 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 _tcurrent_ts, avg(c1) from stream_querydb.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 _tcurrent_ts, avg(c1) from stream_querydb.t2");
//
// // _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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tnext_ts\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"177\",\"Type\":\"3523\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias
// 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 _tnext_ts, avg(c1) from stream_querydb.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 _tnext_ts, avg(c1) from stream_querydb.t2");
//
// // _twstart
// resetCreateStreamOutCols(&expect);
// 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);
/ / setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 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 \" : \" \" , \" 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}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" 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_2 \" , \" UserAlias \" : \" avg(c1) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _twstart \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 178 \" , \" Type \" : \" 3524 \" , \" Parameters \" :[{ \" NodeType \" : \" 2 \" , \" Value \" :{ \" DataType \" :{ \" Type \" : \" 9 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" \" , \" UserAlias \
// 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.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.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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_twend\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"179\",\"Type\":\"3525\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":
// 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.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.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);
/ / setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 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 \" : \" \" , \" 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}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" 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) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _twend \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 179 \" , \" Type \" : \
// 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.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.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);
/ / setCreateStreamQueryCalcPlan ( & expect , " { \" NodeType \" : \" 1129 \" , \" PhysiPlan \" :{ \" QueryId \" : \" 0 \" , \" NumOfSubplans \" : \" 1 \" , \" Subplans \" :{ \" NodeType \" : \" 15 \" , \" NodeList \" :{ \" DataType \" :{ \" Type \" : \" 0 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 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 \" : \" \" , \" 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}},{ \" NodeType \" : \" 20 \" , \" SlotDesc \" :{ \" SlotId \" : \" 1 \" , \" DataType \" :{ \" Type \" : \" 5 \" , \" Precision \" : \" 0 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" 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) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _twend \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 179 \" , \" Type \" : \
// 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.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.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);
// setCreateStreamPlaceHolderBitmap(&expect, PLACE_HOLDER_PREV_LOCAL);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\":\"2\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tprev_localtime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"182\",\"Type\":\"3528\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"Us
// 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.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.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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\":\"2\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tnext_localtime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"183\",\"Type\":\"3529\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"Us
// 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.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.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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"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)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\":\"2\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tnext_localtime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"183\",
// 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.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.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);
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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}},{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"1\",\"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_2\",\"UserAlias\":\"avg(c1)\",\"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\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"30\",\"TableType\":\"3\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_querydb\",\"TableName\":\"t2\",\"TableAlias\":\"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\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"expr_1\",\"UserAlias\":\"_tlocaltime\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"184\",\"Type\":\"3530\",\"Parameters\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAli
// 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.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.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, 274, 0, 0);
// addCreateStreamOutCols(&expect, "avg(c1)", TSDB_DATA_TYPE_DOUBLE, 0, 8, 0, 0);
// addCreateStreamOutTags(&expect, "tag_tbname", TSDB_DATA_TYPE_BINARY, 0, 274, 0, 0);
// addCreateStreamOutTags(&expect, "tag1", TSDB_DATA_TYPE_INT, 0, 4, 0, 0);
// addCreateStreamOutTags(&expect, "tag2", TSDB_DATA_TYPE_BINARY, 0, 22, 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);
// setCreateStreamTagValueExpr(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\":\"\",\"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\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Litera
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\",\"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\",\"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\",\"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 \" }, \" 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 \" : \" \" , \" 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) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _tlocaltime \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 184 \" , \
// 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, 274, 0, 0);
// addCreateStreamOutCols(&expect, "avg(c1)", TSDB_DATA_TYPE_DOUBLE, 0, 8, 0, 0);
// setCreateStreamPlaceHolderBitmap(&expect, PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_TBNAME);
// setCreateStreamPartitionCols(&expect, "[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"272\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\",\"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\",\"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\",\"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 \" }, \" 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 \" : \" \" , \" 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) \" , \" 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 \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" TableId \" : \" 30 \" , \" TableType \" : \" 3 \" , \" ColId \" : \" 2 \" , \" ProjId \" : \" 0 \" , \" ColType \" : \" 1 \" , \" DbName \" : \" stream_querydb \" , \" TableName \" : \" t2 \" , \" TableAlias \" : \" 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 \" , \" Scale \" : \" 0 \" , \" Bytes \" : \" 8 \" }, \" AliasName \" : \" expr_1 \" , \" UserAlias \" : \" _tlocaltime \" , \" RelatedTo \" : \" 0 \" , \" BindExprID \" : \" 0 \" , \" Id \" : \" 184 \" , \
// 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.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.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, 274, 0, 0);
// addCreateStreamOutCols(&expect, "avg(c1)", TSDB_DATA_TYPE_DOUBLE, 0, 8, 0, 0);
// setCreateStreamPlaceHolderBitmap(&expect, PLACE_HOLDER_LOCALTIME | PLACE_HOLDER_PARTITION_TBNAME);
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"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\"}}}},{\"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\",\"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\"}}}}],\"TableId\":\"42\",\"STableId\":\"0\",\"TableType\":\"1\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// addCreateStreamQueryScanPlan(&expect, false, "{\"NodeType\":\"1128\",\"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\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}}],\"Precision\":\"0\"}},\"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\":\"\",\"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\"}}}},{\"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\",\"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\"}}}}],\"TableId\":\"42\",\"STableId\":\"0\",\"TableType\":\"1\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"1\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"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\":\"\",\"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\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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}},{\"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\":true}}],\"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)\",\"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\",\"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\"}}],\"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\":fal
// 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, 274, 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);
// addCreateStreamQueryScanPlan(&expect, true, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"3\",\"SubplanId\":\"4\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"2\",\"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\":\"5\",\"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\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"5\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"5\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"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\"}}}}],\"TableId\":\"42\",\"STableId\":\"0\",\"TableType\":\"1\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"Name\":\"PhysiDispatch\",\"PhysiDispatch\":{\"InputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"5\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
// addCreateStreamQueryScanPlan(&expect, true, "{\"NodeType\":\"1128\",\"Name\":\"PhysiSubplan\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"3\",\"SubplanId\":\"5\"},\"SubplanType\":\"3\",\"MsgType\":\"769\",\"Level\":\"2\",\"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\":\"8\",\"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\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"3785532846947205635\"}}],\"Precision\":\"0\"}},\"ScanCols\":[{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"8\",\"SlotId\":\"1\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"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\"}}}},{\"NodeType\":\"18\",\"Name\":\"Target\",\"Target\":{\"DataBlockId\":\"8\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"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\"}}}}],\"TableId\":\"42\",\"STableId\":\"0\",\"TableType\":\"1\",\"TableName\":{\"NameType\":\"2\",\"AcctId\":\"0\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\"},\"GroupOrderScan\":false,\"ScanCount\":\"1\",\"ReverseScanCount\":\"0\",\"StartKey\":\"-9223372036854775808\",\"EndKey\":\"9223372036854775807\",\"Ratio\":1,\"DataRequired\":\"2\",\"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,\"StreamResInfoStbFullName\":\"\",\"StreamResInfoWstartName\":\"\",\"StreamResInfoWendName\":\"\",\"StreamResInfoGroupIdName\":\"\",\"StreamResInfoIsWindowFilledName\":\"\"}},\"DataSink\":{\"NodeType\":\"1124\",\"Name\":\"PhysiDispatch\",\"PhysiDispatch\":{\"InputDataBlockDesc\":{\"NodeType\":\"19\",\"Name\":\"DataBlockDesc\",\"DataBlockDesc\":{\"DataBlockId\":\"8\",\"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\":\"\"}},{\"NodeType\":\"20\",\"Name\":\"SlotDesc\",\"SlotDesc\":{\"SlotId\":\"1\",\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"Reserve\":false,\"Output\":true,\"Name\":\"\"}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}}");
//
// setCreateStreamQueryCalcPlan(&expect, "{\"NodeType\":\"1129\",\"PhysiPlan\":{\"QueryId\":\"0\",\"NumOfSubplans\":\"3\",\"Subplans\":{\"NodeType\":\"15\",\"NodeList\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"0\"},\"NodeList\":[{\"NodeType\":\"1128\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"1\",\"SubplanId\":\"1\"},\"SubplanType\":\"1\",\"MsgType\":\"771\",\"Level\":\"0\",\"DbFName\":\"\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"Child\":[{\"NodeType\":\"1128\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"2\",\"SubplanId\":\"2\"},\"SubplanType\":\"5\",\"MsgType\":\"771\",\"Level\":\"1\",\"DbFName\":\"\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"Child\":[{\"NodeType\":\"2\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"LiteralSize\":\"0\",\"Flag\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"12884901892\"}}],\"RootNode\":{\"NodeType\":\"1110\",\"PhysiAgg\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"DataBlockDesc\":{\"DataBlockId\":\"4\",\"TotalRowSize\":\"58\",\"OutputRowSize\":\"58\",\"Slots\":[{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"58\"},\"Reserve\":false,\"Output\":true}}],\"Precision\":\"0\"}},\"Children\":[{\"NodeType\":\"1111\",\"PhysiExchange\":{\"OutputDataBlockDesc\":{\"NodeType\":\"19\",\"DataBlockDesc\":{\"DataBlockId\":\"3\",\"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\":\"3\",\"SrcEndGroupId\":\"3\",\"SeqRecvData\":false,\"DynTbname\":false}}],\"AggFuncs\":[{\"NodeType\":\"18\",\"Target\":{\"DataBlockId\":\"4\",\"SlotId\":\"0\",\"Expr\":{\"NodeType\":\"5\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"58\"},\"AliasName\":\"8398271948806314415\",\"UserAlias\":\"\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"Id\":\"9\",\"Type\":\"4018\",\"Parameters\":[{\"NodeType\":\"1\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"RelatedTo\":\"0\",\"BindExprID\":\"0\",\"TableId\":\"42\",\"TableType\":\"1\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"stream_triggerdb\",\"TableName\":\"st1\",\"TableAlias\":\"st1\",\"ColName\":\"c1\",\"DataBlockId\":\"3\",\"SlotId\":\"0\",\"TableHasPk\":false,\"IsPk\":false,\"NumOfPKs\":\"0\"}}],\"UdfBufSize\":\"0\",\"HasPk\":false,\"PkBytes\":\"0\",\"IsMergeFunc\":true,\"MergeFuncOf\":\"8\",\"TrimType\":\"0\",\"SrcFuncInputDataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"}}}}}],\"MergeDataBlock\":false,\"GroupKeyOptimized\":false,\"HasCountFunc\":false}},\"DataSink\":{\"NodeType\":\"1124\",\"PhysiDispatch\":{\"InputDataBlockDesc\":{\"NodeType\":\"19\",\"DataBlockDesc\":{\"DataBlockId\":\"4\",\"TotalRowSize\":\"58\",\"OutputRowSize\":\"58\",\"Slots\":[{\"NodeType\":\"20\",\"SlotDesc\":{\"SlotId\":\"0\",\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"58\"},\"Reserve\":false,\"Output\":true}}],\"Precision\":\"0\"}}}},\"ShowRewrite\":false,\"IsView\":false,\"IsAudit\":false,\"RowThreshold\":\"4096\",\"DyRowThreshold\":false}},{\"NodeType\":\"1128\",\"PhysiSubplan\":{\"Id\":{\"QueryId\":\"0\",\"GroupId\":\"2\",\"SubplanId\":\"3\"},\"SubplanType\":\"5\",\"MsgType\":\"771\",\"Level\":\"1\",\"DbFName\":\"\",\"User\":\"\",\"NodeAddr\":{\"Id\":\"0\",\"InUse\":\"0\",\"NumOfEps\":\"0\"},\"Child\":[{\"
// 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");
//
//
// clearCreateStreamReq();
//}
//
//TEST_F(ParserStreamTest, TestErrorName) {
// setAsyncFlag("-1");
//
// //run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2");
// // db not exists
// run("create stream non_exist_db.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_FAILED);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into non_exist_db.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_FAILED);
//
// // table not exists
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from non_exist_db.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_TABLE_NOT_EXIST);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from non_exist_db.t2", TSDB_CODE_PAR_TABLE_NOT_EXIST);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.non_exist_t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_TABLE_NOT_EXIST);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from non_exist_db.non_exist_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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
//
// // not ts cols
// run("create stream stream_streamdb.s1 session(c1, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_SESSION_COL);
//
// // invalid time unit
// run("create stream stream_streamdb.s1 session(ts, 1y) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_SESSION_GAP);
// run("create stream stream_streamdb.s1 session(ts, 1n) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_SESSION_GAP);
// run("create stream stream_streamdb.s1 session(ts, 0s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE);
//
// // invalid using tag
// run("create stream stream_streamdb.s1 state_window(tag1) from stream_triggerdb.st1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STATE_WIN_COL);
//
// // invalid true for less than 0
// run("create stream stream_streamdb.s1 state_window(c1) true_for(-1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_TRUE_FOR_UNIT);
// run("create stream stream_streamdb.s1 state_window(c1) true_for('1y') from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_TRUE_FOR_UNIT);
// run("create stream stream_streamdb.s1 state_window(c1) true_for(1x) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
// run("create stream stream_streamdb.s1 state_window(c1) true_for('1x') from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
// run("create stream stream_streamdb.s1 interval(2s, 1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
//
// // invalid sliding unit
// run("create stream stream_streamdb.s1 sliding(1n) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_SLIDING_UNIT);
// run("create stream stream_streamdb.s1 sliding(1y) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_SLIDING_UNIT);
//
// // invalid sliding offset unit
// run("create stream stream_streamdb.s1 sliding(1s, 1n) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
// run("create stream stream_streamdb.s1 sliding(1s, 1y) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
// run("create stream stream_streamdb.s1 sliding(1s, 1u) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
// run("create stream stream_streamdb.s1 sliding(1s, 1d) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
// run("create stream stream_streamdb.s1 sliding(1s, 1w) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
// run("create stream stream_streamdb.s1 sliding(1s, 1b) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
//
// // sliding offset bigger than sliding
// run("create stream stream_streamdb.s1 sliding(1s, 2s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL);
//
// // invalid interval offset unit
// run("create stream stream_streamdb.s1 interval(20n, 1y) sliding(3s, 2s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_UNIT);
//
// // interval offset bigger than interval
// run("create stream stream_streamdb.s1 interval(1s, 2s) sliding(3s, 2s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG);
//
// // 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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
//
// // invalid count window
//
// // count val less equal than 1
// run("create stream stream_streamdb.s1 count_window(1) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
//
// // count sliding less equal than 0
// run("create stream stream_streamdb.s1 count_window(2, 0) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
//
// // count sliding bigger than count val
// run("create stream stream_streamdb.s1 count_window(2, 3) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
//
// // count val greater equal than INT32_MAX
// run("create stream stream_streamdb.s1 count_window(2147483647) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
// run("create stream stream_streamdb.s1 count_window(2147483648) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_STREAM_QUERY);
//
// // invalid period window
//
// // invalid period unit
// run("create stream stream_streamdb.s1 period(1u) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_UNIT);
// run("create stream stream_streamdb.s1 period(1b) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_UNIT);
// run("create stream stream_streamdb.s1 period(1w) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_UNIT);
// run("create stream stream_streamdb.s1 period(1n) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_UNIT);
// run("create stream stream_streamdb.s1 period(1y) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_UNIT);
//
// // period val out of [10a, 3650d]
// run("create stream stream_streamdb.s1 period(9a) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_PERIOD_RANGE);
// run("create stream stream_streamdb.s1 period(3660d) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t2", TSDB_CODE_STREAM_INVALID_TRIGGER);
//
// // 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.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.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.t2", TSDB_CODE_STREAM_INVALID_TRIGGER);
//}
//
//TEST_F(ParserStreamTest, TestErrorTriggerOptions) {
// setAsyncFlag("-1");
//
// // invalid expired time
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1u)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1b)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1w)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1n)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(expired_time(1y)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 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.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.t1 options(max_delay(1u)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1b)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1w)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1n)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(max_delay(1y)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_TIME_UNIT);
//
// // invalid event type
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type('invalid')) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(event_type(EVENT_TYPE_INVALID)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 options(pre_filter(c10 > 1)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_COLUMN);
//
// // no trigger table
// run("create stream stream_streamdb.s1 period(1s) options(pre_filter(c1 > 1)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_PRE_FILTER);
//
// // repeat same option
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(pre_filter(c1 > 1) | pre_filter(c2 < 2)) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 options(ignore_disorder|ignore_disorder) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 on(WINDOW_OPEN) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 NOTIFY('ws://localhost:8080') on(INVALID_EVENT) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 NOTIFY('ws://localhost:8080') into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_NOTIFY);
//
// // where condition include cols not from query
// run("create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.t1 NOTIFY('ws://localhost:8080') where c1 > 1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_NOTIFY_COND);
// run("create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.t1 NOTIFY('ws://localhost:8080') where c1 + 2 + 1 into stream_outdb.stream_out as select _twstart, avg(c1), c1 + 1 from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_NOTIFY_COND);
//
// // invalid notify options
// run("create stream stream_streamdb.s1 sliding(1s) from stream_triggerdb.t1 NOTIFY('ws://localhost:8080') notify_options(notify_what) into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.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.t1 as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.st1 as select * from stream_querydb.t1", TSDB_CODE_STREAM_INVALID_OUT_TABLE);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 partition by tbname into stream_outdb.t1 as select * from stream_querydb.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.t1 into stream_outdb.stream_out as select c1, c2 from stream_querydb.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.t1 into stream_outdb.stream_out output_subtable('a') as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_SUBTABLE);
//
// // sub table expr using column not in partition list
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 partition by tbname into stream_outdb.stream_out output_subtable(c1) as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_PAR_INVALID_COLUMN);
//
// // 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.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.t1 into stream_outdb.t1 as select _twstart, avg(c1) as c2 from stream_querydb.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.t1 into stream_outdb.t1(tts, cc1, cc2) as select _twstart, avg(c1) as c2 from stream_querydb.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.t1 into stream_outdb.stream_out(tts PRIMARY KEY, c1, c2) as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_OUT_TABLE);
// run("create stream stream_streamdb.s1 interval(1s) sliding(1s) from stream_triggerdb.t1 into stream_outdb.stream_out(tts, c1, c2 PRIMARY KEY) as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out tags(tag1 int as 1) as select _twstart, avg(c1) from stream_querydb.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.t1 partition by tbname, tbname into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.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.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.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.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.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.t1", TSDB_CODE_STREAM_INVALID_OUT_TABLE);
//
// // out tag expr using column not in partition list
// 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.t1", TSDB_CODE_PAR_INVALID_COLUMN);
//}
//
//TEST_F(ParserStreamTest, TestErrorQueryPlaceHolder) {
// setAsyncFlag("-1");
//
// // _tprev_ts must be used with sliding
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tprev_ts, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tcurrent_ts, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tnext_ts, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_PLACE_HOLDER);
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twstart, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_PLACE_HOLDER);
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _twend, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tlocaltime, _twduration, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_PLACE_HOLDER);
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, _twduration, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tlocaltime, _twrownum, avg(c1) from stream_querydb.t2", TSDB_CODE_STREAM_INVALID_PLACE_HOLDER);
// run("create stream stream_streamdb.s1 period(1s) from stream_triggerdb.t1 into stream_outdb.stream_out as select _tlocaltime, _twrownum, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tprev_localtime, avg(c1) from stream_querydb.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.t1 into stream_outdb.stream_out as select _tnext_localtime, avg(c1) from stream_querydb.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.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-06-12 07:37:03 +00:00
2025-05-12 10:18:00 +00:00
} // namespace ParserTest