TDengine/source/libs/parser/inc/sql.y

2095 lines
199 KiB
Text
Raw Normal View History

2021-10-08 14:40:51 +00:00
//lemon parser file to generate sql parse by using finite-state-machine code used to parse sql
//usage: lemon sql.y
2022-03-10 07:36:06 +00:00
%token_prefix TK_
%token_type { SToken }
%default_type { SNode* }
%default_destructor { nodesDestroyNode($$); }
2021-10-08 14:40:51 +00:00
2022-03-10 07:36:06 +00:00
%extra_argument { SAstCreateContext* pCxt }
2021-10-08 14:40:51 +00:00
%include {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
2022-03-10 07:36:06 +00:00
2022-06-01 06:39:40 +00:00
#define ALLOW_FORBID_FUNC
#include "functionMgt.h"
2022-03-10 07:36:06 +00:00
#include "nodes.h"
#include "parToken.h"
2021-10-08 14:40:51 +00:00
#include "ttokendef.h"
2022-03-10 07:36:06 +00:00
#include "parAst.h"
2022-06-01 06:39:40 +00:00
#define YYSTACKDEPTH 0
#define JOINED_TABLE_MK(jt, st, A, B, E, F, G, H) \
{ \
A = createJoinTableNode(pCxt, jt, st, B, E, F); \
A = addWindowOffsetClause(pCxt, A, G); \
A = addJLimitClause(pCxt, A, H); \
}
2021-10-08 14:40:51 +00:00
}
%syntax_error {
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
if(TOKEN.z) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
} else {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL);
}
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
2021-10-08 14:40:51 +00:00
}
}
2022-03-10 07:36:06 +00:00
%left OR.
%left AND.
%left UNION ALL MINUS EXCEPT INTERSECT.
%left NK_BITAND NK_BITOR NK_LSHIFT NK_RSHIFT NK_PH.
%left NK_LT NK_GT NK_LE NK_GE NK_EQ NK_NE LIKE MATCH NMATCH REGEXP CONTAINS BETWEEN IS IN.
2022-03-10 07:36:06 +00:00
%left NK_PLUS NK_MINUS.
%left NK_STAR NK_SLASH NK_REM.
2022-03-10 07:36:06 +00:00
%left NK_CONCAT.
%right NOT.
%left NK_ARROW.
%right INNER LEFT RIGHT FULL OUTER SEMI ANTI ASOF WINDOW JOIN ON WINDOW_OFFSET JLIMIT.
/************************************************ create/alter account *****************************************/
cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
cmd ::= ALTER ACCOUNT NK_ID alter_account_options. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
%type account_options { int32_t }
%destructor account_options { }
account_options ::= . { }
account_options ::= account_options PPS literal. { }
account_options ::= account_options TSERIES literal. { }
account_options ::= account_options STORAGE literal. { }
account_options ::= account_options STREAMS literal. { }
account_options ::= account_options QTIME literal. { }
account_options ::= account_options DBS literal. { }
account_options ::= account_options USERS literal. { }
account_options ::= account_options CONNS literal. { }
account_options ::= account_options STATE literal. { }
%type alter_account_options { int32_t }
%destructor alter_account_options { }
alter_account_options ::= alter_account_option. { }
alter_account_options ::= alter_account_options alter_account_option. { }
%type alter_account_option { int32_t }
%destructor alter_account_option { }
alter_account_option ::= PASS literal. { }
alter_account_option ::= PPS literal. { }
alter_account_option ::= TSERIES literal. { }
alter_account_option ::= STORAGE literal. { }
alter_account_option ::= STREAMS literal. { }
alter_account_option ::= QTIME literal. { }
alter_account_option ::= DBS literal. { }
alter_account_option ::= USERS literal. { }
alter_account_option ::= CONNS literal. { }
alter_account_option ::= STATE literal. { }
2023-08-24 07:54:10 +00:00
%type ip_range_list { SNodeList* }
%destructor ip_range_list { nodesDestroyList($$); }
ip_range_list(A) ::= NK_STRING(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); }
ip_range_list(A) ::= ip_range_list(B) NK_COMMA NK_STRING(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C)); }
%type white_list { SNodeList* }
%destructor white_list { nodesDestroyList($$); }
white_list(A) ::= HOST ip_range_list(B). { A = B; }
%type white_list_opt { SNodeList* }
%destructor white_list_opt { nodesDestroyList($$); }
white_list_opt(A) ::= . { A = NULL; }
white_list_opt(A) ::= white_list(B). { A = B; }
2024-06-17 06:31:39 +00:00
%type is_import_opt { int8_t }
%destructor is_import_opt { }
is_import_opt(A) ::= . { A = 0; }
is_import_opt(A) ::= IS_IMPORT NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
%type is_createdb_opt { int8_t }
%destructor is_createdb_opt { }
is_createdb_opt(A) ::= . { A = 0; }
is_createdb_opt(A) ::= CREATEDB NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
/************************************************ create/alter/drop user **********************************************/
2025-02-17 02:09:57 +00:00
cmd ::= CREATE USER user_name(A) PASS NK_STRING(B) sysinfo_opt(C) is_createdb_opt(E) is_import_opt(F)
white_list_opt(D). {
2024-06-17 06:31:39 +00:00
pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B, C, E, F);
pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, D);
2023-08-24 07:54:10 +00:00
}
cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); }
2022-06-22 08:35:14 +00:00
cmd ::= ALTER USER user_name(A) ENABLE NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_ENABLE, &B); }
cmd ::= ALTER USER user_name(A) SYSINFO NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_SYSINFO, &B); }
2024-05-22 11:00:47 +00:00
cmd ::= ALTER USER user_name(A) CREATEDB NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_CREATEDB, &B); }
2023-08-24 07:54:10 +00:00
cmd ::= ALTER USER user_name(A) ADD white_list(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_ADD_WHITE_LIST, B); }
cmd ::= ALTER USER user_name(A) DROP white_list(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_DROP_WHITE_LIST, B); }
2022-03-10 07:36:06 +00:00
cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); }
2022-06-22 08:35:14 +00:00
%type sysinfo_opt { int8_t }
%destructor sysinfo_opt { }
sysinfo_opt(A) ::= . { A = 1; }
sysinfo_opt(A) ::= SYSINFO NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
/************************************************ grant/revoke ********************************************************/
2024-09-12 08:12:52 +00:00
cmd ::= GRANT privileges(A) ON priv_level(B) with_clause_opt(D) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C, D); }
cmd ::= REVOKE privileges(A) ON priv_level(B) with_clause_opt(D) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C, D); }
%type privileges { int64_t }
%destructor privileges { }
privileges(A) ::= ALL. { A = PRIVILEGE_TYPE_ALL; }
privileges(A) ::= priv_type_list(B). { A = B; }
privileges(A) ::= SUBSCRIBE. { A = PRIVILEGE_TYPE_SUBSCRIBE; }
%type priv_type_list { int64_t }
%destructor priv_type_list { }
priv_type_list(A) ::= priv_type(B). { A = B; }
priv_type_list(A) ::= priv_type_list(B) NK_COMMA priv_type(C). { A = B | C; }
%type priv_type { int64_t }
%destructor priv_type { }
priv_type(A) ::= READ. { A = PRIVILEGE_TYPE_READ; }
priv_type(A) ::= WRITE. { A = PRIVILEGE_TYPE_WRITE; }
2023-10-16 11:53:08 +00:00
priv_type(A) ::= ALTER. { A = PRIVILEGE_TYPE_ALTER; }
2023-03-28 10:43:58 +00:00
%type priv_level { STokenPair }
%destructor priv_level { }
2023-03-28 10:43:58 +00:00
priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; }
priv_level(A) ::= db_name(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; }
priv_level(A) ::= db_name(B) NK_DOT table_name(C). { A.first = B; A.second = C; }
priv_level(A) ::= topic_name(B). { A.first = B; A.second = nil_token; }
2024-09-12 08:12:52 +00:00
with_clause_opt(A) ::= . { A = NULL; }
with_clause_opt(A) ::= WITH search_condition(B). { A = B; }
2024-03-26 11:56:15 +00:00
/************************************************ create encrypt_key *********************************************/
cmd ::= CREATE ENCRYPT_KEY NK_STRING(A). { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &A); }
2024-10-15 02:00:38 +00:00
/************************************************ create drop update anode ***************************************/
cmd ::= CREATE ANODE NK_STRING(A). { pCxt->pRootNode = createCreateAnodeStmt(pCxt, &A); }
cmd ::= UPDATE ANODE NK_INTEGER(A). { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &A, false); }
cmd ::= UPDATE ALL ANODES. { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); }
cmd ::= DROP ANODE NK_INTEGER(A). { pCxt->pRootNode = createDropAnodeStmt(pCxt, &A); }
2023-05-09 11:19:14 +00:00
/************************************************ create/drop/alter/restore dnode *********************************************/
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); }
2023-05-16 01:50:10 +00:00
cmd ::= DROP DNODE NK_INTEGER(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B, false); }
cmd ::= DROP DNODE dnode_endpoint(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B, false); }
cmd ::= DROP DNODE NK_INTEGER(A) unsafe_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, false, B); }
cmd ::= DROP DNODE dnode_endpoint(A) unsafe_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, false, B); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, NULL); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B) NK_STRING(C). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, &C); }
cmd ::= ALTER ALL DNODES NK_STRING(A). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, NULL); }
cmd ::= ALTER ALL DNODES NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, &B); }
2023-05-09 11:19:14 +00:00
cmd ::= RESTORE DNODE NK_INTEGER(A). { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &A); }
2022-03-10 07:36:06 +00:00
%type dnode_endpoint { SToken }
%destructor dnode_endpoint { }
dnode_endpoint(A) ::= NK_STRING(B). { A = B; }
dnode_endpoint(A) ::= NK_ID(B). { A = B; }
dnode_endpoint(A) ::= NK_IPTOKEN(B). { A = B; }
2022-03-10 07:36:06 +00:00
%type force_opt { bool }
%destructor force_opt { }
force_opt(A) ::= . { A = false; }
force_opt(A) ::= FORCE. { A = true; }
2023-05-16 01:50:10 +00:00
%type unsafe_opt { bool }
%destructor unsafe_opt { }
unsafe_opt(A) ::= UNSAFE. { A = true; }
2023-12-18 06:18:52 +00:00
/************************************************ alter cluster *********************************************************/
cmd ::= ALTER CLUSTER NK_STRING(A). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, NULL); }
2023-12-18 08:34:31 +00:00
cmd ::= ALTER CLUSTER NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, &B); }
2023-12-18 06:18:52 +00:00
/************************************************ alter local *********************************************************/
cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); }
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
2023-05-09 11:19:14 +00:00
/************************************************ create/drop/restore qnode ***************************************************/
cmd ::= CREATE QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &A); }
cmd ::= DROP QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &A); }
2023-05-09 11:19:14 +00:00
cmd ::= RESTORE QNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &A); }
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
/************************************************ create/drop backup node ***************************************************/
// cmd ::= CREATE BACKUPNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BACKUP_NODE_STMT, &A); }
// cmd ::= DROP BACKUPNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BACKUP_NODE_STMT, &A); }
/************************************************ create/drop snode ***************************************************/
cmd ::= CREATE SNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &A); }
cmd ::= DROP SNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &A); }
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
/************************************************ create/drop bnode ***************************************/
cmd ::= CREATE BNODE ON DNODE NK_INTEGER(A) bnode_options(B). { pCxt->pRootNode = createCreateBnodeStmt(pCxt, &A, B); }
cmd ::= DROP BNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropBnodeStmt(pCxt, &A); }
bnode_options(A) ::= . { A = createDefaultBnodeOptions(pCxt); }
bnode_options(A) ::= bnode_options(B) NK_ID(C) NK_STRING(D). { A = setBnodeOption(pCxt, B, &C, &D); }
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
2023-05-09 11:19:14 +00:00
/************************************************ create/drop/restore mnode ***************************************************/
cmd ::= CREATE MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &A); }
cmd ::= DROP MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &A); }
2023-05-09 11:19:14 +00:00
cmd ::= RESTORE MNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &A); }
/************************************************ restore vnode ***************************************************/
cmd ::= RESTORE VNODE ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &A); }
2022-03-15 12:04:52 +00:00
/************************************************ create/drop/use database ********************************************/
cmd ::= CREATE DATABASE not_exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C); }
2025-06-06 01:09:40 +00:00
cmd ::= DROP DATABASE exists_opt(A) db_name(B) force_opt(C). { pCxt->pRootNode = createDropDatabaseStmt(pCxt, A, &B, C); }
cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A); }
cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); }
2022-06-29 10:20:27 +00:00
cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); }
cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); }
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
cmd ::= SSMIGRATE DATABASE db_name(A). { pCxt->pRootNode = createSsMigrateDatabaseStmt(pCxt, &A); }
2025-02-25 08:48:43 +00:00
cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C) meta_only(D). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C, D); }
cmd ::= COMPACT db_name_cond_opt(A) VGROUPS IN NK_LP integer_list(B) NK_RP start_opt(C) end_opt(D) meta_only(E). { pCxt->pRootNode = createCompactVgroupsStmt(pCxt, A, B, C, D, E); }
cmd ::= SCAN DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createScanStmt(pCxt, &A, B, C); }
cmd ::= SCAN db_name_cond_opt(A) VGROUPS IN NK_LP integer_list(B) NK_RP start_opt(C) end_opt(D). { pCxt->pRootNode = createScanVgroupsStmt(pCxt, A, B, C, D); }
2025-02-25 08:48:43 +00:00
%type meta_only { bool }
%destructor meta_only { }
meta_only(A) ::= . { A = false; }
2025-02-25 09:57:25 +00:00
meta_only(A) ::= META_ONLY. { A = true; }
2022-03-10 07:36:06 +00:00
%type not_exists_opt { bool }
%destructor not_exists_opt { }
not_exists_opt(A) ::= IF NOT EXISTS. { A = true; }
not_exists_opt(A) ::= . { A = false; }
%type exists_opt { bool }
%destructor exists_opt { }
exists_opt(A) ::= IF EXISTS. { A = true; }
exists_opt(A) ::= . { A = false; }
2022-04-27 10:18:37 +00:00
db_options(A) ::= . { A = createDefaultDatabaseOptions(pCxt); }
db_options(A) ::= db_options(B) BUFFER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BUFFER, &C); }
db_options(A) ::= db_options(B) CACHEMODEL NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHEMODEL, &C); }
db_options(A) ::= db_options(B) CACHESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHESIZE, &C); }
2022-04-27 10:18:37 +00:00
db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); }
2022-06-15 05:49:29 +00:00
db_options(A) ::= db_options(B) DURATION NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) DURATION NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
2022-04-27 10:18:37 +00:00
db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); }
db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); }
db_options(A) ::= db_options(B) KEEP integer_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, C); }
db_options(A) ::= db_options(B) KEEP variable_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, C); }
db_options(A) ::= db_options(B) PAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGES, &C); }
db_options(A) ::= db_options(B) PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PAGESIZE, &C); }
2022-09-13 06:19:50 +00:00
db_options(A) ::= db_options(B) TSDB_PAGESIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TSDB_PAGESIZE, &C); }
2022-04-27 10:18:37 +00:00
db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); }
db_options(A) ::= db_options(B) REPLICAS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); }
2022-04-27 10:18:37 +00:00
db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); }
//db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); }
2022-04-27 10:18:37 +00:00
db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); }
db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLE_STABLE, &C); }
db_options(A) ::= db_options(B) RETENTIONS retention_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, C); }
2022-05-25 13:20:11 +00:00
db_options(A) ::= db_options(B) SCHEMALESS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SCHEMALESS, &C); }
2022-07-27 03:55:19 +00:00
db_options(A) ::= db_options(B) WAL_LEVEL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); }
db_options(A) ::= db_options(B) WAL_FSYNC_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); }
2022-07-25 13:09:06 +00:00
db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_PERIOD, &C); }
db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_MINUS(D) NK_INTEGER(C). {
2022-07-25 13:09:06 +00:00
SToken t = D;
t.n = (C.z + C.n) - D.z;
A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_SIZE, &C); }
db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C). {
2022-07-25 13:09:06 +00:00
SToken t = D;
t.n = (C.z + C.n) - D.z;
A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); }
db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); }
2022-09-13 06:19:50 +00:00
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
db_options(A) ::= db_options(B) TABLE_PREFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, C); }
db_options(A) ::= db_options(B) TABLE_SUFFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, C); }
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
db_options(A) ::= db_options(B) SS_CHUNKPAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SS_CHUNKPAGES, &C); }
db_options(A) ::= db_options(B) SS_KEEPLOCAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SS_KEEPLOCAL, &C); }
db_options(A) ::= db_options(B) SS_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SS_KEEPLOCAL, &C); }
db_options(A) ::= db_options(B) SS_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SS_COMPACT, &C); }
db_options(A) ::= db_options(B) KEEP_TIME_OFFSET NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP_TIME_OFFSET, &C); }
db_options(A) ::= db_options(B) KEEP_TIME_OFFSET NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP_TIME_OFFSET, &C); }
2024-03-26 11:56:15 +00:00
db_options(A) ::= db_options(B) ENCRYPT_ALGORITHM NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_ENCRYPT_ALGORITHM, &C); }
2024-10-26 12:58:02 +00:00
db_options(A) ::= db_options(B) DNODES NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DNODES, &C); }
2024-11-26 11:46:48 +00:00
db_options(A) ::= db_options(B) COMPACT_INTERVAL NK_INTEGER (C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMPACT_INTERVAL, &C); }
db_options(A) ::= db_options(B) COMPACT_INTERVAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMPACT_INTERVAL, &C); }
2024-12-29 07:13:38 +00:00
db_options(A) ::= db_options(B) COMPACT_TIME_RANGE signed_duration_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMPACT_TIME_RANGE, C); }
2024-11-26 11:46:48 +00:00
db_options(A) ::= db_options(B) COMPACT_TIME_OFFSET NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMPACT_TIME_OFFSET, &C); }
db_options(A) ::= db_options(B) COMPACT_TIME_OFFSET NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMPACT_TIME_OFFSET, &C); }
2022-04-27 10:18:37 +00:00
alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); }
alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); }
%type alter_db_option { SAlterOption }
%destructor alter_db_option { }
alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; }
alter_db_option(A) ::= CACHEMODEL NK_STRING(B). { A.type = DB_OPTION_CACHEMODEL; A.val = B; }
alter_db_option(A) ::= CACHESIZE NK_INTEGER(B). { A.type = DB_OPTION_CACHESIZE; A.val = B; }
2022-07-27 03:55:19 +00:00
alter_db_option(A) ::= WAL_FSYNC_PERIOD NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; }
2022-04-07 10:19:20 +00:00
alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; }
alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; }
alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; }
2022-10-20 09:02:57 +00:00
alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
alter_db_option(A) ::= REPLICAS NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; }
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
2022-07-27 03:55:19 +00:00
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
2022-09-13 06:19:50 +00:00
alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }
alter_db_option(A) ::= MINROWS NK_INTEGER(B). { A.type = DB_OPTION_MINROWS; A.val = B; }
alter_db_option(A) ::= WAL_RETENTION_PERIOD NK_INTEGER(B). { A.type = DB_OPTION_WAL_RETENTION_PERIOD; A.val = B; }
alter_db_option(A) ::= WAL_RETENTION_PERIOD NK_MINUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A.type = DB_OPTION_WAL_RETENTION_PERIOD; A.val = t;
}
alter_db_option(A) ::= WAL_RETENTION_SIZE NK_INTEGER(B). { A.type = DB_OPTION_WAL_RETENTION_SIZE; A.val = B; }
alter_db_option(A) ::= WAL_RETENTION_SIZE NK_MINUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A.type = DB_OPTION_WAL_RETENTION_SIZE; A.val = t;
}
feat[ts-6107]: shared storage (#31552) * add API to use s3 as shared storage * support using local file system as shared storage * upload file to shared storage * support read, compact and drop * finish basic mnode & vnode msg processing * follower sync migration state * implement mnode transaction, and improve log * send migration progress msg to dnode to avoid deadlock * implement following migration * remove mcount * avoid redo migration on startup * avoid follower deadlock when leader is down * trigger migrate by timer, avoid compact after migration * comment out the usage of 'tcs' functions in stream * change config item prefix from s3 to ss * change db option prefix from s3 to ss * rename s3 data struct, function, file to ss * rename s3 macro to ss * update s3 sql to ss * rename remaining s3 items to ss * check ss configruation, improve s3 retry * grant object storage -> shared storage, check ssEnabled * fix memory leaks * update build options * omit sensitive information when dump config * fix backward compatibility issue * fix issues found in ci-checks * fix some failed test cases * avoid follower timeout and improve log * fix: follower timeout because migration status not updated * refuse migration if there's an in progress one * fix ss test case * remove garbage files and other minor improvement * fix failed test cases * update unit test * fix failed test case * fix failed test case * update document * update document and fix failed test cases * fix minor issues in code, test and document * check new commit after migration task is scheduled * fix several issus 1. migrate information cannot be dropped sometimes because progress response was put into read queue. 2. memory leak in rare cases 3. data corruption in rare cases 4. failed test case * add shared storage upgrade tool * fix compile error
2025-07-14 08:33:53 +00:00
alter_db_option(A) ::= SS_KEEPLOCAL NK_INTEGER(B). { A.type = DB_OPTION_SS_KEEPLOCAL; A.val = B; }
alter_db_option(A) ::= SS_KEEPLOCAL NK_VARIABLE(B). { A.type = DB_OPTION_SS_KEEPLOCAL; A.val = B; }
alter_db_option(A) ::= SS_COMPACT NK_INTEGER(B). { A.type = DB_OPTION_SS_COMPACT, A.val = B; }
alter_db_option(A) ::= KEEP_TIME_OFFSET NK_INTEGER(B). { A.type = DB_OPTION_KEEP_TIME_OFFSET; A.val = B; }
alter_db_option(A) ::= KEEP_TIME_OFFSET NK_VARIABLE(B). { A.type = DB_OPTION_KEEP_TIME_OFFSET; A.val = B; }
2024-04-01 05:58:13 +00:00
alter_db_option(A) ::= ENCRYPT_ALGORITHM NK_STRING(B). { A.type = DB_OPTION_ENCRYPT_ALGORITHM; A.val = B; }
2024-11-27 08:27:14 +00:00
alter_db_option(A) ::= COMPACT_INTERVAL NK_INTEGER(B). { A.type = DB_OPTION_COMPACT_INTERVAL; A.val = B; }
alter_db_option(A) ::= COMPACT_INTERVAL NK_VARIABLE(B). { A.type = DB_OPTION_COMPACT_INTERVAL; A.val = B; }
2024-12-29 07:13:38 +00:00
alter_db_option(A) ::= COMPACT_TIME_RANGE signed_duration_list(B). { A.type = DB_OPTION_COMPACT_TIME_RANGE; A.pList = B; }
2024-11-26 11:46:48 +00:00
alter_db_option(A) ::= COMPACT_TIME_OFFSET NK_INTEGER(B). { A.type = DB_OPTION_COMPACT_TIME_OFFSET; A.val = B; }
2024-12-05 05:06:53 +00:00
alter_db_option(A) ::= COMPACT_TIME_OFFSET NK_VARIABLE(B). { A.type = DB_OPTION_COMPACT_TIME_OFFSET; A.val = B; }
2022-03-10 07:36:06 +00:00
2022-03-31 11:38:17 +00:00
%type integer_list { SNodeList* }
%destructor integer_list { nodesDestroyList($$); }
integer_list(A) ::= NK_INTEGER(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); }
integer_list(A) ::= integer_list(B) NK_COMMA NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); }
2022-04-07 10:19:20 +00:00
%type variable_list { SNodeList* }
%destructor variable_list { nodesDestroyList($$); }
variable_list(A) ::= NK_VARIABLE(B). { A = createNodeList(pCxt, createDurationValueNode(pCxt, &B)); }
variable_list(A) ::= variable_list(B) NK_COMMA NK_VARIABLE(C). { A = addNodeToList(pCxt, B, createDurationValueNode(pCxt, &C)); }
2024-12-29 07:13:38 +00:00
%type signed_duration_list { SNodeList* }
%destructor signed_duration_list { nodesDestroyList($$); }
signed_duration_list(A) ::= signed_variable(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
signed_duration_list(A) ::= signed_integer(B). { A = createNodeList(pCxt, B); }
signed_duration_list(A) ::= signed_duration_list(B) NK_COMMA signed_integer(C). { A = addNodeToList(pCxt, B, C); }
signed_duration_list(A) ::= signed_duration_list(B) NK_COMMA signed_variable(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
2024-11-27 08:27:14 +00:00
2022-04-07 10:19:20 +00:00
%type retention_list { SNodeList* }
%destructor retention_list { nodesDestroyList($$); }
retention_list(A) ::= retention(B). { A = createNodeList(pCxt, B); }
retention_list(A) ::= retention_list(B) NK_COMMA retention(C). { A = addNodeToList(pCxt, B, C); }
retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); }
retention(A) ::= NK_MINUS(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); }
2022-04-07 10:19:20 +00:00
%type speed_opt { int32_t }
%destructor speed_opt { }
speed_opt(A) ::= . { A = 0; }
speed_opt(A) ::= BWLIMIT NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); }
start_opt(A) ::= . { A = NULL; }
start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); }
start_opt(A) ::= START WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
start_opt(A) ::= START WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
end_opt(A) ::= . { A = NULL; }
end_opt(A) ::= END WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); }
end_opt(A) ::= END WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
/************************************************ create/drop table/stable ********************************************/
2022-03-10 07:36:06 +00:00
cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); }
cmd ::= CREATE TABLE multi_create_clause(A). { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, A); }
cmd ::= CREATE TABLE not_exists_opt(B) USING full_table_name(C)
NK_LP tag_list_opt(D) NK_RP FILE NK_STRING(E). { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, B, C, D, &E); }
2022-03-10 07:36:06 +00:00
cmd ::= CREATE STABLE not_exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP tags_def(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); }
cmd ::= CREATE VTABLE not_exists_opt(A) full_table_name(B)
NK_LP column_def_list(C) NK_RP. { pCxt->pRootNode = createCreateVTableStmt(pCxt, A, B, C); }
cmd ::= CREATE VTABLE not_exists_opt(A) full_table_name(B)
NK_LP specific_column_ref_list(C) NK_RP USING full_table_name(D)
specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP. { pCxt->pRootNode = createCreateVSubTableStmt(pCxt, A, B, C, NULL, D, E, F); }
cmd ::= CREATE VTABLE not_exists_opt(A) full_table_name(B)
NK_LP column_ref_list(C) NK_RP USING full_table_name(D)
specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP. { pCxt->pRootNode = createCreateVSubTableStmt(pCxt, A, B, NULL, C, D, E, F); }
cmd ::= CREATE VTABLE not_exists_opt(A) full_table_name(B) USING full_table_name(C)
specific_cols_opt(D) TAGS NK_LP tags_literal_list(E) NK_RP. { pCxt->pRootNode = createCreateVSubTableStmt(pCxt, A, B, NULL, NULL, C, D, E); }
2024-09-12 08:12:52 +00:00
cmd ::= DROP TABLE with_opt(A) multi_drop_clause(B). { pCxt->pRootNode = createDropTableStmt(pCxt, A, B); }
cmd ::= DROP STABLE with_opt(A) exists_opt(B) full_table_name(C). { pCxt->pRootNode = createDropSuperTableStmt(pCxt, A, B, C); }
cmd ::= DROP VTABLE with_opt(A) exists_opt(B) full_table_name(C). { pCxt->pRootNode = createDropVirtualTableStmt(pCxt, A, B, C); }
2022-03-10 07:36:06 +00:00
cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; }
cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode = setAlterSuperTableType(A); }
cmd ::= ALTER VTABLE alter_table_clause(A). { pCxt->pRootNode = setAlterVirtualTableType(A); }
2024-11-23 14:18:30 +00:00
2022-04-27 10:18:37 +00:00
alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); }
alter_table_clause(A) ::=
full_table_name(B) ADD COLUMN column_name(C) type_name(D) column_options(E). { A = createAlterTableAddModifyColOptions2(pCxt, B, TSDB_ALTER_TABLE_ADD_COLUMN, &C, D, E); }
alter_table_clause(A) ::= full_table_name(B) DROP COLUMN column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_COLUMN, &C); }
alter_table_clause(A) ::=
full_table_name(B) MODIFY COLUMN column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &C, D); }
2024-03-07 10:06:15 +00:00
alter_table_clause(A) ::=
2024-03-11 03:39:19 +00:00
full_table_name(B) MODIFY COLUMN column_name(C) column_options(D). { A = createAlterTableAddModifyColOptions(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &C, D); }
alter_table_clause(A) ::=
full_table_name(B) RENAME COLUMN column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &C, &D); }
alter_table_clause(A) ::=
full_table_name(B) ADD TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_ADD_TAG, &C, D); }
alter_table_clause(A) ::= full_table_name(B) DROP TAG column_name(C). { A = createAlterTableDropCol(pCxt, B, TSDB_ALTER_TABLE_DROP_TAG, &C); }
alter_table_clause(A) ::=
full_table_name(B) MODIFY TAG column_name(C) type_name(D). { A = createAlterTableAddModifyCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &C, D); }
alter_table_clause(A) ::=
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
alter_table_clause(A) ::=
full_table_name(B) ALTER COLUMN column_name(C) SET column_ref(D).
{ A = createAlterTableAlterColRef(pCxt, B, TSDB_ALTER_TABLE_ALTER_COLUMN_REF, &C, D); }
2024-11-23 14:18:30 +00:00
alter_table_clause(A) ::=
full_table_name(B) ALTER COLUMN column_name(C) SET NULL(D). { A = createAlterTableRemoveColRef(pCxt, B, TSDB_ALTER_TABLE_REMOVE_COLUMN_REF, &C, &D); }
2024-11-23 14:18:30 +00:00
%type column_tag_value_list { SNodeList* }
%destructor column_tag_value_list { nodesDestroyList($$); }
column_tag_value(A) ::= column_name(C) NK_EQ tags_literal(D). { A = createAlterSingleTagColumnNode(pCxt, &C, D); }
2024-11-25 07:22:53 +00:00
column_tag_value_list(A) ::= column_tag_value(B). { A = createNodeList(pCxt, B); }
column_tag_value_list(A) ::= column_tag_value_list(B) NK_COMMA column_tag_value(C). { A = addNodeToList(pCxt, B, C);}
2024-11-23 14:18:30 +00:00
alter_table_clause(A) ::=
full_table_name(B) SET TAG column_tag_value_list(C). { A = createAlterTableSetMultiTagValue(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
%type multi_create_clause { SNodeList* }
%destructor multi_create_clause { nodesDestroyList($$); }
multi_create_clause(A) ::= create_subtable_clause(B). { A = createNodeList(pCxt, B); }
multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). { A = addNodeToList(pCxt, B, C); }
create_subtable_clause(A) ::=
not_exists_opt(B) full_table_name(C) USING full_table_name(D)
2024-03-10 14:14:57 +00:00
specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
2022-03-10 07:36:06 +00:00
%type multi_drop_clause { SNodeList* }
%destructor multi_drop_clause { nodesDestroyList($$); }
multi_drop_clause(A) ::= drop_table_clause(B). { A = createNodeList(pCxt, B); }
2023-02-22 07:16:16 +00:00
multi_drop_clause(A) ::= multi_drop_clause(B) NK_COMMA drop_table_clause(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
drop_table_clause(A) ::= exists_opt(B) full_table_name(C). { A = createDropTableClause(pCxt, B, C); }
2024-09-12 08:12:52 +00:00
%type with_opt { bool }
%destructor with_opt { }
with_opt(A) ::= . { A = false; }
with_opt(A) ::= WITH. { A = true; }
2022-07-05 13:12:10 +00:00
%type specific_cols_opt { SNodeList* }
%destructor specific_cols_opt { nodesDestroyList($$); }
specific_cols_opt(A) ::= . { A = NULL; }
specific_cols_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; }
2022-03-10 07:36:06 +00:00
full_table_name(A) ::= table_name(B). { A = createRealTableNode(pCxt, NULL, &B, NULL); }
full_table_name(A) ::= db_name(B) NK_DOT table_name(C). { A = createRealTableNode(pCxt, &B, &C, NULL); }
2024-03-07 10:06:15 +00:00
%type tag_def_list { SNodeList* }
%destructor tag_def_list { nodesDestroyList($$); }
tag_def_list(A) ::= tag_def(B). { A = createNodeList(pCxt, B); }
tag_def_list(A) ::= tag_def_list(B) NK_COMMA tag_def(C). { A = addNodeToList(pCxt, B, C); }
tag_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); }
2022-03-10 07:36:06 +00:00
%type column_def_list { SNodeList* }
%destructor column_def_list { nodesDestroyList($$); }
column_def_list(A) ::= column_def(B). { A = createNodeList(pCxt, B); }
column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); }
2024-03-07 10:06:15 +00:00
// column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); }
column_def(A) ::= column_name(B) type_name(C) column_options(D). { A = createColumnDefNode(pCxt, &B, C, D); }
2022-03-10 07:36:06 +00:00
%type specific_column_ref_list { SNodeList* }
%destructor specific_column_ref_list { nodesDestroyList($$); }
specific_column_ref_list(A) ::= specific_column_ref(B). { A = createNodeList(pCxt, B); }
specific_column_ref_list(A) ::= specific_column_ref_list(B) NK_COMMA specific_column_ref(C). { A = addNodeToList(pCxt, B, C); }
specific_column_ref(A) ::= column_name(B) FROM column_ref(C). { A = createColumnRefNodeByNode(pCxt, &B, C); }
%type column_ref_list { SNodeList* }
%destructor column_ref_list { nodesDestroyList($$); }
column_ref_list(A) ::= column_ref(B). { A = createNodeList(pCxt, B); }
column_ref_list(A) ::= column_ref_list(B) NK_COMMA column_ref(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
%type type_name { SDataType }
%destructor type_name { }
type_name(A) ::= BOOL. { A = createDataType(TSDB_DATA_TYPE_BOOL); }
type_name(A) ::= TINYINT. { A = createDataType(TSDB_DATA_TYPE_TINYINT); }
type_name(A) ::= SMALLINT. { A = createDataType(TSDB_DATA_TYPE_SMALLINT); }
type_name(A) ::= INT. { A = createDataType(TSDB_DATA_TYPE_INT); }
type_name(A) ::= INTEGER. { A = createDataType(TSDB_DATA_TYPE_INT); }
type_name(A) ::= BIGINT. { A = createDataType(TSDB_DATA_TYPE_BIGINT); }
type_name(A) ::= FLOAT. { A = createDataType(TSDB_DATA_TYPE_FLOAT); }
type_name(A) ::= DOUBLE. { A = createDataType(TSDB_DATA_TYPE_DOUBLE); }
type_name(A) ::= BINARY NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &B); }
type_name(A) ::= TIMESTAMP. { A = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
type_name(A) ::= NCHAR NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &B); }
type_name(A) ::= TINYINT UNSIGNED. { A = createDataType(TSDB_DATA_TYPE_UTINYINT); }
type_name(A) ::= SMALLINT UNSIGNED. { A = createDataType(TSDB_DATA_TYPE_USMALLINT); }
type_name(A) ::= INT UNSIGNED. { A = createDataType(TSDB_DATA_TYPE_UINT); }
type_name(A) ::= BIGINT UNSIGNED. { A = createDataType(TSDB_DATA_TYPE_UBIGINT); }
type_name(A) ::= JSON. { A = createDataType(TSDB_DATA_TYPE_JSON); }
type_name(A) ::= VARCHAR NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &B); }
type_name(A) ::= MEDIUMBLOB. { A = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
type_name(A) ::= BLOB. { A = createDataType(TSDB_DATA_TYPE_BLOB); }
type_name(A) ::= VARBINARY NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &B); }
Feature/3.0 geometry (#21037) * Add GEOMETRY data type and make sql.c able to parse it. The GEMETRY works like BINARY so far. * add GEOMETRY type into gConvertTypes to fix some issues like DELETE calling * change some test cases to make sure no same timestamp is inserted, and add my smoketest.sh * Add a function MakePoint() and introduce a lib geometry * implement sql functions GeomFromText() and AsText() * Use GEOS *_r funcions instead for thread safety * Handle with TSDB_DATA_TYPE_GEOMETRY when INSERT geometry data by converting WKT. Add geosWrapper to wrap the basic GEOS functions for TDEngine. * refactor AsText and MakePoint functions to be like GeomFromText * Show WKT when print geometry data in screen Dump hex data when dump geometry data in a file * define TYPE_BYTES item for TSDB_DATA_TYPE_GEOMETRY, which casued some strange issues. * set number of decimals of WKT to 6 * Implement SQL function Intersects() * refactor geometry sql functions * Add geosErrMsgeHandler() to get the GEOS error detail * use threadlocal to instantiate SGeosContext call destroyGeosContext() only if the thread exists * remove SGeosContext *context param for all geometry functions since we use thread local one, so that all caller do not need to know the context. * Modify Intersects() to call PreparedIntersects() when one of param is a constant, which has higher performance. * rename prepareFn() to initCtxFn() to avoid confusion with PreparedFn * Add prefix "ST_" for all geometry functions * move getThreadLocalGeosCtx() and destroyThreadLocalGeosCtx() into util, so that all unit test tools can compile * Add unit test for geometry lib, only test MakePoint so far * refactor and enhance existing cases in geomFuncTest * implement NULL type and NULL value test for geomFuncTest * add test on geomFromText() * add unit test on AsText() in geomFuncTest * combine some makePointFunction test items * add intersectsFunctionTwoColumns test refactor on callGeomFromTextWrapper functions * enhance intersectsFunction test to add cases like input constant , NULL type, NULL value, or wrong content * add more cases into intersectsFunction test * Add basic test on geometry in system test * Add ST_GeomFromText and ST_AsText function test in system test on geometry * add ST_Intersects function test in system test on geometry * support to check expectedErrno in system test on geometry * adjust geomTest unit test and geometry system test * add geometry data type and functions in doc english version * implement touchesFunction() in geometry lib refactor geometry relation functions model * separate gemFuncTest into several src files * add unit test on touchesFunction * support sql function ST_Touches() add system test on ST_Touches * add docs for ST_Touches() * Add ST_Contains() * Add ST_Covers() * Add ST_Equals() * add swapAllowed param for geomRelationFunction() read geom2 earlier intead of at doGeosRelation() * Add ST_ContainsProperly() * build on windows * Merge from 3.0 to 3.0_geometry * change macro definition TSDB_DATA_TYPE_GEOMETRY as the last one for compatibility * change '\\NULL' to 'NULL' back in shellDumpFieldToFile() * add /usr/local/include into include directory * add /usr/local/inlcude and /usr/local/lib in cmake.platform for DARWIN
2023-05-24 07:36:46 +00:00
type_name(A) ::= GEOMETRY NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &B); }
feat(decimal): support decimal data type (#30060) * decimal: create table * decimal: add test case decimal.py * decimal: add decimal.c * support input decimal * decimal test * refactor svalue * fix test cases * add decimal unit test * add decimal test cmake * support insert and query decimal type * define wide integer, support decimal128 * support decimal128 divide * set decimal type expr res types * scalar decimal * convert to decimal * fix decimal64/128 from str and to str * fix decimal from str and decimal to str * decimal simple conversion * unit test for decimal * decimal conversion and unit tests * decimal + - * / * decimal scalar ops and comparision * start to refactor GET_TYPED_DATA * support decimal max func, cast func * refactor GET_TYPED_DATA interface * decimal scalar comparision * start to implement sum for decimal * support sum and avg for decimal type * decimal tests * add decimal test * decimal add test cases * decimal use int256/int128 * decimal testing * fix decimal table meta and add tests for decimal col streams * fix create stream and create tsma * test insert decimal values * decimal from str * test decimal input * test parse decimal from string * add taos_fetch_field_e api * decimal insert tests * test decimal operators * decimal operator test * feat:support decimal in raw block * decimal operator tests * decimal test * feat:support decimal in raw block * feat:support decimal in raw block * feat:add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * feat:remove add schemaExt to SMqDataRsp * decimal test operators * decimal operator test * test decimal operators * test decimal compare operators * decimal unary operator test * decimal col with decimal col oper test * test decimal col filtering * fix decimal float operator test * decimal test where filtering * fix decimal filtering * fix decimal order by * fix decimal op test * test decimal agg funcs * test decimal functions * remove assert * fix ci build for ret check * fix decimal windows build * fix ci ret check * skip decimal ret check * skip decimal ret check * fix decimal tests * fix decimal ci test * decimal test * fix(tmq): heap user after free * fix(tmq): double free * fix(tmq): double free * fix decimal tests * fix(decimal): decimal test ci build * fix(decimal): windows build * fix(decimal): decimal test build * fix(decimal): fix decimal build and tests * fix(decimal): fix decimal tests * fix(decimal): fix taos_fetch_fields_e api * fix(decimal): fix decimal taos_fetch_fields_e api * fix(decimal): rebase 3.0 * fix(decimal): fix decimal functions * fix(decimal): fix decimal test case memory leak * fix(decimal): fix decimal tests * fix(decimal): fix decimal test case * fix(decimal): fix decimal tests * feat(decimal): fix unit tests * feat(decimal): fix deicmal unit test --------- Co-authored-by: wangmm0220 <wangmm0220@gmail.com> Co-authored-by: yihaoDeng <yhdeng@taosdata.com>
2025-03-14 10:08:07 +00:00
// type_name(A) ::= DECIMAL. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); }
type_name(A) ::= DECIMAL NK_LP NK_INTEGER(B) NK_RP. { A = createDecimalDataType(TSDB_DATA_TYPE_DECIMAL, &B, NULL); }
type_name(A) ::= DECIMAL NK_LP NK_INTEGER(B) NK_COMMA NK_INTEGER(C) NK_RP. { A = createDecimalDataType(TSDB_DATA_TYPE_DECIMAL, &B, &C); }
2022-03-10 07:36:06 +00:00
2024-04-10 03:48:50 +00:00
%type type_name_default_len { SDataType }
%destructor type_name_default_len { }
type_name_default_len(A) ::= BINARY. { A = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); }
type_name_default_len(A) ::= NCHAR. { A = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); }
type_name_default_len(A) ::= VARCHAR. { A = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); }
type_name_default_len(A) ::= VARBINARY. { A = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); }
2024-04-09 10:00:48 +00:00
2022-03-10 07:36:06 +00:00
%type tags_def_opt { SNodeList* }
%destructor tags_def_opt { nodesDestroyList($$); }
tags_def_opt(A) ::= . { A = NULL; }
tags_def_opt(A) ::= tags_def(B). { A = B; }
%type tags_def { SNodeList* }
%destructor tags_def { nodesDestroyList($$); }
tags_def(A) ::= TAGS NK_LP tag_def_list(B) NK_RP. { A = B; }
2022-03-10 07:36:06 +00:00
2022-04-27 10:18:37 +00:00
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
2022-06-17 09:27:42 +00:00
table_options(A) ::= table_options(B) MAX_DELAY duration_list(C). { A = setTableOption(pCxt, B, TABLE_OPTION_MAXDELAY, C); }
table_options(A) ::= table_options(B) WATERMARK duration_list(C). { A = setTableOption(pCxt, B, TABLE_OPTION_WATERMARK, C); }
2022-06-15 05:49:29 +00:00
table_options(A) ::= table_options(B) ROLLUP NK_LP rollup_func_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
2022-04-27 10:18:37 +00:00
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_SMA, C); }
2022-12-06 08:07:11 +00:00
table_options(A) ::= table_options(B) DELETE_MARK duration_list(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELETE_MARK, C); }
table_options(A) ::= table_options(B) KEEP NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_KEEP, &C); }
table_options(A) ::= table_options(B) KEEP NK_VARIABLE(C). { A = setTableOption(pCxt, B, TABLE_OPTION_KEEP, &C); }
table_options(A) ::= table_options(B) VIRTUAL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_VIRTUAL, &C); }
2022-04-27 10:18:37 +00:00
alter_table_options(A) ::= alter_table_option(B). { A = createAlterTableOptions(pCxt); A = setTableOption(pCxt, A, B.type, &B.val); }
alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). { A = setTableOption(pCxt, B, C.type, &C.val); }
%type alter_table_option { SAlterOption }
%destructor alter_table_option { }
2022-04-27 10:18:37 +00:00
alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.val = B; }
alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.val = B; }
alter_table_option(A) ::= KEEP NK_INTEGER(B). { A.type = TABLE_OPTION_KEEP; A.val = B; }
alter_table_option(A) ::= KEEP NK_VARIABLE(B). { A.type = TABLE_OPTION_KEEP; A.val = B; }
2022-03-10 07:36:06 +00:00
2022-06-17 09:27:42 +00:00
%type duration_list { SNodeList* }
%destructor duration_list { nodesDestroyList($$); }
duration_list(A) ::= duration_literal(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
duration_list(A) ::= duration_list(B) NK_COMMA duration_literal(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
2022-06-15 05:49:29 +00:00
%type rollup_func_list { SNodeList* }
%destructor rollup_func_list { nodesDestroyList($$); }
rollup_func_list(A) ::= rollup_func_name(B). { A = createNodeList(pCxt, B); }
rollup_func_list(A) ::= rollup_func_list(B) NK_COMMA rollup_func_name(C). { A = addNodeToList(pCxt, B, C); }
rollup_func_name(A) ::= function_name(B). { A = createFunctionNode(pCxt, &B, NULL); }
rollup_func_name(A) ::= FIRST(B). { A = createFunctionNode(pCxt, &B, NULL); }
rollup_func_name(A) ::= LAST(B). { A = createFunctionNode(pCxt, &B, NULL); }
2022-03-10 07:36:06 +00:00
%type col_name_list { SNodeList* }
%destructor col_name_list { nodesDestroyList($$); }
col_name_list(A) ::= col_name(B). { A = createNodeList(pCxt, B); }
col_name_list(A) ::= col_name_list(B) NK_COMMA col_name(C). { A = addNodeToList(pCxt, B, C); }
col_name(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); }
2025-03-13 09:30:01 +00:00
col_name(A) ::= TBNAME(B). { A = createColumnNode(pCxt, NULL, &B); }
2022-03-10 07:36:06 +00:00
2025-07-12 07:39:29 +00:00
/************************************************ create/drop mount ********************************************/
cmd ::= CREATE MOUNT not_exists_opt(A) mount_name(B) ON DNODE NK_INTEGER(C) FROM NK_STRING(D). { pCxt->pRootNode = createCreateMountStmt(pCxt, A, &B, &C, &D); }
cmd ::= DROP MOUNT exists_opt(A) mount_name(B). { pCxt->pRootNode = createDropMountStmt(pCxt, A, &B); }
/************************************************ show ****************************************************************/
cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
2024-06-17 06:31:39 +00:00
cmd ::= SHOW USERS FULL. { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); }
cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
2023-09-18 08:59:07 +00:00
cmd ::= SHOW db_kind_opt(A) DATABASES. {
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
2024-07-16 10:08:34 +00:00
(void)setShowKind(pCxt, pCxt->pRootNode, A);
2023-09-18 08:59:07 +00:00
}
cmd ::= SHOW table_kind_db_name_cond_opt(A) TABLES like_pattern_opt(B). {
2023-09-20 05:25:26 +00:00
pCxt->pRootNode = createShowTablesStmt(pCxt, A, B, OP_TYPE_LIKE);
2023-09-18 08:59:07 +00:00
}
cmd ::= SHOW table_kind_db_name_cond_opt(A) VTABLES like_pattern_opt(B). {
pCxt->pRootNode = createShowVTablesStmt(pCxt, A, B, OP_TYPE_LIKE);
}
cmd ::= SHOW table_kind_db_name_cond_opt(A) STABLES like_pattern_opt(B). {
pCxt->pRootNode = createShowSTablesStmt(pCxt, A, B, OP_TYPE_LIKE);
}
cmd ::= SHOW db_name_cond_opt(A) VGROUPS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, A, NULL, OP_TYPE_LIKE); }
cmd ::= SHOW MNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
2022-10-12 02:16:29 +00:00
//cmd ::= SHOW MODULES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); }
cmd ::= SHOW QNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
2024-10-15 02:00:38 +00:00
cmd ::= SHOW ANODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); }
cmd ::= SHOW ANODES FULL. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); }
cmd ::= SHOW ARBGROUPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); }
cmd ::= SHOW FUNCTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
cmd ::= SHOW INDEXES FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, B, A, OP_TYPE_EQUAL); }
cmd ::= SHOW INDEXES FROM db_name(B) NK_DOT table_name(A). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &B), createIdentifierValueNode(pCxt, &A), OP_TYPE_EQUAL); }
2025-06-07 02:56:03 +00:00
cmd ::= SHOW db_name_cond_opt(A) STREAMS. { pCxt->pRootNode = createShowStreamsStmt(pCxt, A, QUERY_NODE_SHOW_STREAMS_STMT); }
cmd ::= SHOW ACCOUNTS. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
cmd ::= SHOW APPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
cmd ::= SHOW CONNECTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
2022-08-11 07:37:26 +00:00
cmd ::= SHOW LICENCES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
cmd ::= SHOW GRANTS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
2024-01-18 07:23:38 +00:00
cmd ::= SHOW GRANTS FULL. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); }
2024-01-31 05:52:03 +00:00
cmd ::= SHOW GRANTS LOGS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); }
2024-01-18 09:49:11 +00:00
cmd ::= SHOW CLUSTER MACHINES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
2025-07-12 07:39:29 +00:00
cmd ::= SHOW MOUNTS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MOUNTS_STMT); }
cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); }
cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); }
cmd ::= SHOW CREATE VTABLE full_table_name(A). { pCxt->pRootNode = createShowCreateVTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_VTABLE_STMT, A); }
2024-06-24 14:13:03 +00:00
cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT,
2024-03-26 11:56:15 +00:00
A); }
cmd ::= SHOW ENCRYPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); }
cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
2025-02-25 10:21:32 +00:00
cmd ::= SHOW VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithLike(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT, B); }
cmd ::= SHOW CLUSTER VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithLike(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT, B); }
cmd ::= SHOW LOCAL VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithLike(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT, B); }
cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), B); }
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
// cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BACKUP_NODES_STMT); }
cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
feat(mqtt): mqtt subscription (#30127) * feat(mqtt): Initial commit for mqtt * chore(xnode/mnd): xnode message handlers for mnode * chore(mnd/xnode): mnode part for xnode * chore(xnode/translater): fix show commands * fix(ast/creater): fix xnode create option * fix(xnode/ci): fix ci & doc's error codes * chore(xnode/sql): make create/drop/show work properly * fix(xnode/sql): commit new files * fix(xnode/sql): commit cmake files * fix: fix testing cases * fix(xnode/tsc): fix tokens * fix(ast/anode): fix anode update decl. * fix(xnode/error): fix xnode error codes * fix: xnode make/destroy * chore: xnode with option & dnode id * chore: use taosmqtt for xnode * chore: new error code for xnode launching * chore(xnode): new error code * chore: header for _xnode_mgmt_mqtt * chore: source for _xnode_mgmt_mqtt * chore: remove test directory from cmake * chore: remove taosmqtt for ci to compile * chore: remove taosudf header from xnode * chore: new window macro * chore: remove xnode mgmt mqtt for windows compilation * Revert "chore: remove xnode mgmt mqtt for windows compilation" This reverts commit 197e1640c79e40343e683f42236b3f0824392944. * chore: cleanup code * chore: xnode mgmt comment windows part out * chore: mgmt/mqtt, move uv head toppest * xnode/mnode: create xnode once per dnode * fix(xnode/systable/test): fix column count * xnode/sdb: renumber sdb type for xnode to make start/stop order correct * xnode/mqtt: new param mqttPort * fix SXnode's struct type * transfer dnode id to mqtt subscription * tmqtt: remove uv_a linking * tmqtt/tools: sources for tools * tools: fix windows compilation * tools/producer: fix windows sleep param * tools/producer: fix uninited var rc * make tools only for linux * test/mnodes: wail 1 or 2 seconds for offline to be leader * update topic producer tool for geometry data type testing * format tool sql statements * show xnodes' ep * make shell auto complete xnodes * use usleep instead of sleep * mqtt/proto: first version mqtt protocol * remove assert styles * build with linux only * fix libuv for taosmqtt building * fix log printing * mem: use ttq_ prefix instead of tmqtt * xnode/parser/proto: protocol option for xnode * xnode/translater/option: translate xnode option proto * xnode/translator: translate proto param * xnode/tmsg: encode/decode proto param * xnode/mnode: proto parma for mndXnode * xnode/proto: protocol param for xnode * xnode/mqtt: save/load proto from xnode json * rename tmqtt proto header * rename head directories * rename header name styles * restyle func names * update * update * use camel db * use camel for cxt * update count of information_schema * fix exceptional cases * fix w.r.t reviews * fixes w.r.t reviews * use ttq_free * append xnode msgs * update information schema count * support tmq meta data sub * success typo fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix error line var w.r.t. suggestions from copilot * denote mqtt node with bnode instead of xnode * smoke testing for mqtt * soak testing * new package for test framework: paho 2.1.0 * import mqtt into util * fix soak testing * test/soak: user 5 topics per client * test/soak: cover qos * update docker image references to tdengine-ci:0.1 in CI scripts and common.py * refactor: rename bnode msg to backup node * refactor: rename xnode to bnode 1 * refactor: rename xnode to bnode 2 * refactor: rename xnode to bnode 3 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 4 * refactor: rename xnode to bnode 5 * refactor: rename xnode to bnode 6 * refactor: rename some files 1 * refactor: rename some files 2 * refactor: rename some files 3 * refactor: rename some files 4 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: chenhaoran <haoran920c@163.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2025-06-25 06:58:51 +00:00
cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
cmd ::= SHOW TRANSACTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
2024-11-07 02:32:44 +00:00
cmd ::= SHOW TRANSACTION NK_INTEGER(A). { pCxt->pRootNode = createShowTransactionDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
cmd ::= SHOW TABLE DISTRIBUTED full_table_name(A). { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, A); }
cmd ::= SHOW CONSUMERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
cmd ::= SHOW SUBSCRIPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
cmd ::= SHOW TAGS FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, B, A, OP_TYPE_EQUAL); }
cmd ::= SHOW TAGS FROM db_name(B) NK_DOT table_name(A). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &B), createIdentifierValueNode(pCxt, &A), OP_TYPE_EQUAL); }
2022-11-10 09:22:13 +00:00
cmd ::= SHOW TABLE TAGS tag_list_opt(C) FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowTableTagsStmt(pCxt, A, B, C); }
cmd ::= SHOW TABLE TAGS tag_list_opt(C) FROM db_name(B) NK_DOT table_name(A). { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &A), createIdentifierValueNode(pCxt, &B), C); }
cmd ::= SHOW VNODES ON DNODE NK_INTEGER(A). { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), NULL); }
cmd ::= SHOW VNODES. { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
// show alive
cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
2024-02-19 05:10:27 +00:00
cmd ::= SHOW db_name_cond_opt(A) VIEWS like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, A, B, OP_TYPE_LIKE); }
2023-10-11 02:38:22 +00:00
cmd ::= SHOW CREATE VIEW full_table_name(A). { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, A); }
2023-11-23 07:26:21 +00:00
cmd ::= SHOW COMPACTS. { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
cmd ::= SHOW COMPACT NK_INTEGER(A). { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
cmd ::= SHOW db_name_cond_opt(A) DISK_INFO. { pCxt->pRootNode = createShowDiskUsageStmt(pCxt, A, QUERY_NODE_SHOW_USAGE_STMT); }
cmd ::= SHOW SCANS. { pCxt->pRootNode = createShowScansStmt(pCxt, QUERY_NODE_SHOW_SCANS_STMT); }
cmd ::= SHOW SCAN NK_INTEGER(A). { pCxt->pRootNode = createShowScanDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
cmd ::= SHOW SSMIGRATES. { pCxt->pRootNode = createShowSsMigratesStmt(pCxt, QUERY_NODE_SHOW_SSMIGRATES_STMT); }
%type table_kind_db_name_cond_opt { SShowTablesOption }
%destructor table_kind_db_name_cond_opt { }
2023-09-20 05:25:26 +00:00
table_kind_db_name_cond_opt(A) ::= . { A.kind = SHOW_KIND_ALL; A.dbName = nil_token; }
table_kind_db_name_cond_opt(A) ::= table_kind(B). { A.kind = B; A.dbName = nil_token; }
table_kind_db_name_cond_opt(A) ::= db_name(C) NK_DOT. { A.kind = SHOW_KIND_ALL; A.dbName = C; }
table_kind_db_name_cond_opt(A) ::= table_kind(B) db_name(C) NK_DOT. { A.kind = B; A.dbName = C; }
%type table_kind { EShowKind }
%destructor table_kind { }
table_kind(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; }
table_kind(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; }
table_kind(A) ::= VIRTUAL. { A = SHOW_KIND_TABLES_VIRTUAL; }
2022-03-17 02:33:44 +00:00
db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
2022-10-12 02:16:29 +00:00
db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); }
like_pattern_opt(A) ::= . { A = NULL; }
like_pattern_opt(A) ::= LIKE NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
2022-10-12 02:16:29 +00:00
table_name_cond(A) ::= table_name(B). { A = createIdentifierValueNode(pCxt, &B); }
2022-03-17 02:33:44 +00:00
from_db_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
2022-10-12 02:16:29 +00:00
from_db_opt(A) ::= FROM db_name(B). { A = createIdentifierValueNode(pCxt, &B); }
2022-03-11 02:02:47 +00:00
2022-11-10 09:22:13 +00:00
%type tag_list_opt { SNodeList* }
%destructor tag_list_opt { nodesDestroyList($$); }
tag_list_opt(A) ::= . { A = NULL; }
tag_list_opt(A) ::= tag_item(B). { A = createNodeList(pCxt, B); }
tag_list_opt(A) ::= tag_list_opt(B) NK_COMMA tag_item(C). { A = addNodeToList(pCxt, B, C); }
tag_item(A) ::= TBNAME(B). { A = setProjectionAlias(pCxt, createFunctionNode(pCxt, &B, NULL), &B); }
tag_item(A) ::= QTAGS(B). { A = createFunctionNode(pCxt, &B, NULL); }
tag_item(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); }
tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
2023-09-19 06:03:06 +00:00
%type db_kind_opt { EShowKind }
%destructor db_kind_opt { }
db_kind_opt(A) ::= . { A = SHOW_KIND_ALL; }
2023-09-19 06:03:06 +00:00
db_kind_opt(A) ::= USER. { A = SHOW_KIND_DATABASES_USER; }
db_kind_opt(A) ::= SYSTEM. { A = SHOW_KIND_DATABASES_SYSTEM; }
2025-09-26 09:32:32 +00:00
/************************************************ rsma ********************************************************/
cmd ::= CREATE RSMA not_exists_opt(B) rsma_name(C)
ON full_table_name(D) rsma_func_list(E)
INTERVAL NK_LP signed_duration_list(F) NK_RP. { pCxt->pRootNode = createCreateRsmaStmt(pCxt, B, &C, D, E, F); }
cmd ::= DROP RSMA exists_opt(B) full_rsma_name(C). { pCxt->pRootNode = createDropRsmaStmt(pCxt, B, C); }
cmd ::= SHOW CREATE RSMA full_table_name(A). { pCxt->pRootNode = createShowCreateRsmaStmt(pCxt, QUERY_NODE_SHOW_CREATE_RSMA_STMT, A); }
cmd ::= ALTER RSMA exists_opt(B) full_rsma_name(C) rsma_func_list(D). { pCxt->pRootNode = createAlterRsmaStmt(pCxt, B, C, TSDB_ALTER_RSMA_FUNCTION, D); }
2025-09-26 09:32:32 +00:00
cmd ::= SHOW db_name_cond_opt(B) RSMAS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_RSMAS_STMT, B, NULL, OP_TYPE_LIKE); }
cmd ::= SHOW db_name_cond_opt(B) RETENTIONS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_RETENTIONS_STMT, B, NULL, OP_TYPE_LIKE); }
cmd ::= SHOW RETENTION NK_INTEGER(A). { pCxt->pRootNode = createShowRetentionDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
cmd ::= ROLLUP DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createRollupStmt(pCxt, &A, B, C); }
cmd ::= ROLLUP db_name_cond_opt(A) VGROUPS IN NK_LP integer_list(B) NK_RP start_opt(C) end_opt(D). { pCxt->pRootNode = createRollupVgroupsStmt(pCxt, A, B, C, D); }
full_rsma_name(A) ::= rsma_name(B). { A = createRealTableNode(pCxt, NULL, &B, NULL); }
full_rsma_name(A) ::= db_name(B) NK_DOT rsma_name(C). { A = createRealTableNode(pCxt, &B, &C, NULL); }
%type rsma_func_list { SNodeList* }
%destructor rsma_func_list { }
rsma_func_list(A) ::= . { A = NULL; }
rsma_func_list(A) ::= FUNCTION NK_LP NK_RP. { A = NULL; }
rsma_func_list(A) ::= FUNCTION NK_LP func_list(B) NK_RP. { A = B; }
2023-11-20 08:36:13 +00:00
/************************************************ tsma ********************************************************/
cmd ::= CREATE TSMA not_exists_opt(B) tsma_name(C)
2024-01-31 06:20:49 +00:00
ON full_table_name(E) tsma_func_list(D)
INTERVAL NK_LP duration_literal(F) NK_RP. { pCxt->pRootNode = createCreateTSMAStmt(pCxt, B, &C, D, E, releaseRawExprNode(pCxt, F)); }
cmd ::= CREATE RECURSIVE TSMA not_exists_opt(B) tsma_name(C)
ON full_table_name(D) INTERVAL NK_LP duration_literal(E) NK_RP. { pCxt->pRootNode = createCreateTSMAStmt(pCxt, B, &C, NULL, D, releaseRawExprNode(pCxt, E)); }
2023-11-20 08:36:13 +00:00
cmd ::= DROP TSMA exists_opt(B) full_tsma_name(C). { pCxt->pRootNode = createDropTSMAStmt(pCxt, B, C); }
cmd ::= SHOW db_name_cond_opt(B) TSMAS. { pCxt->pRootNode = createShowTSMASStmt(pCxt, B); }
2024-03-20 02:51:02 +00:00
full_tsma_name(A) ::= tsma_name(B). { A = createRealTableNode(pCxt, NULL, &B, NULL); }
full_tsma_name(A) ::= db_name(B) NK_DOT tsma_name(C). { A = createRealTableNode(pCxt, &B, &C, NULL); }
2023-11-20 08:36:13 +00:00
2024-01-31 06:20:49 +00:00
%type tsma_func_list { SNode* }
%destructor tsma_func_list { nodesDestroyNode($$); }
tsma_func_list(A) ::= FUNCTION NK_LP func_list(B) NK_RP. { A = createTSMAOptions(pCxt, B); }
2023-11-20 08:36:13 +00:00
2022-03-15 08:00:09 +00:00
/************************************************ create index ********************************************************/
2022-12-28 02:31:34 +00:00
cmd ::= CREATE SMA INDEX not_exists_opt(D)
2023-08-30 02:46:28 +00:00
col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
2022-12-28 02:31:34 +00:00
cmd ::= CREATE INDEX not_exists_opt(D)
2023-08-30 02:46:28 +00:00
col_name(A) ON full_table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, D, A, B, C, NULL); }
cmd ::= DROP INDEX exists_opt(B) full_index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, A); }
full_index_name(A) ::= index_name(B). { A = createRealTableNodeForIndexName(pCxt, NULL, &B); }
full_index_name(A) ::= db_name(B) NK_DOT index_name(C). { A = createRealTableNodeForIndexName(pCxt, &B, &C); }
2022-03-15 08:00:09 +00:00
2022-12-28 02:31:34 +00:00
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL
NK_LP duration_literal(C) NK_RP sliding_opt(D) sma_stream_opt(E). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), NULL, D, E); }
2022-12-28 02:31:34 +00:00
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL
NK_LP duration_literal(C) NK_COMMA duration_literal(D) NK_RP sliding_opt(E)
sma_stream_opt(F). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), E, F); }
2022-03-15 08:00:09 +00:00
%type func_list { SNodeList* }
%destructor func_list { nodesDestroyList($$); }
func_list(A) ::= func(B). { A = createNodeList(pCxt, B); }
func_list(A) ::= func_list(B) NK_COMMA func(C). { A = addNodeToList(pCxt, B, C); }
func(A) ::= sma_func_name(B) NK_LP expression_list(C) NK_RP. { A = createFunctionNode(pCxt, &B, C); }
%type sma_func_name { SToken }
%destructor sma_func_name { }
sma_func_name(A) ::= function_name(B). { A = B; }
sma_func_name(A) ::= COUNT(B). { A = B; }
sma_func_name(A) ::= FIRST(B). { A = B; }
sma_func_name(A) ::= LAST(B). { A = B; }
sma_func_name(A) ::= LAST_ROW(B). { A = B; }
2022-03-15 08:00:09 +00:00
sma_stream_opt(A) ::= . { A = NULL; }
/************************************************ create/drop topic ***************************************************/
2023-06-30 11:36:39 +00:00
%type with_meta { int32_t }
%destructor with_meta { }
with_meta(A) ::= AS. { A = 0; }
with_meta(A) ::= WITH META AS. { A = 1; }
with_meta(A) ::= ONLY META AS. { A = 2; }
2022-09-16 07:53:27 +00:00
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_or_subquery(C). { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, A, &B, C); }
2023-06-30 11:36:39 +00:00
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) with_meta(D)
DATABASE db_name(C). { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, A, &B, &C, D); }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) with_meta(E)
STABLE full_table_name(C) where_clause_opt(D). { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, A, &B, C, E, D); }
cmd ::= DROP TOPIC exists_opt(A) force_opt(C) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B, C); }
cmd ::= DROP CONSUMER GROUP exists_opt(A) force_opt(D) cgroup_name(B) ON topic_name(C). { pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C, D); }
/************************************************ desc/describe *******************************************************/
cmd ::= DESC full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); }
cmd ::= DESCRIBE full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); }
/************************************************ reset query cache ***************************************************/
cmd ::= RESET QUERY CACHE. { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
/************************************************ explain *************************************************************/
2022-09-16 07:53:27 +00:00
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_or_subquery(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
2023-01-31 08:04:57 +00:00
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) insert_query(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
%type analyze_opt { bool }
%destructor analyze_opt { }
analyze_opt(A) ::= . { A = false; }
analyze_opt(A) ::= ANALYZE. { A = true; }
explain_options(A) ::= . { A = createDefaultExplainOptions(pCxt); }
explain_options(A) ::= explain_options(B) VERBOSE NK_BOOL(C). { A = setExplainVerbose(pCxt, B, &C); }
explain_options(A) ::= explain_options(B) RATIO NK_FLOAT(C). { A = setExplainRatio(pCxt, B, &C); }
/************************************************ create/drop function ************************************************/
cmd ::= CREATE or_replace_opt(H) agg_func_opt(A) FUNCTION not_exists_opt(F)
function_name(B) AS NK_STRING(C) OUTPUTTYPE type_name(D) bufsize_opt(E)
language_opt(G). { pCxt->pRootNode = createCreateFunctionStmt(pCxt, F, A, &B, &C, D, E, &G, H); }
cmd ::= DROP FUNCTION exists_opt(B) function_name(A). { pCxt->pRootNode = createDropFunctionStmt(pCxt, B, &A); }
%type agg_func_opt { bool }
%destructor agg_func_opt { }
agg_func_opt(A) ::= . { A = false; }
agg_func_opt(A) ::= AGGREGATE. { A = true; }
%type bufsize_opt { int32_t }
%destructor bufsize_opt { }
bufsize_opt(A) ::= . { A = 0; }
bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); }
%type language_opt { SToken }
%destructor language_opt { }
language_opt(A) ::= . { A = nil_token; }
language_opt(A) ::= LANGUAGE NK_STRING(B). { A = B; }
%type or_replace_opt { bool }
%destructor or_replace_opt { }
or_replace_opt(A) ::= . { A = false; }
or_replace_opt(A) ::= OR REPLACE. { A = true; }
2023-09-19 06:19:54 +00:00
/************************************************ create/drop view **************************************************/
2023-09-22 03:36:53 +00:00
cmd ::= CREATE or_replace_opt(A) VIEW full_view_name(B) AS(C) query_or_subquery(D).
{ pCxt->pRootNode = createCreateViewStmt(pCxt, A, B, &C, D); }
2023-09-19 06:19:54 +00:00
cmd ::= DROP VIEW exists_opt(A) full_view_name(B). { pCxt->pRootNode = createDropViewStmt(pCxt, A, B); }
2023-09-21 11:28:07 +00:00
full_view_name(A) ::= view_name(B). { A = createViewNode(pCxt, NULL, &B); }
full_view_name(A) ::= db_name(B) NK_DOT view_name(C). { A = createViewNode(pCxt, &B, &C); }
2023-09-19 06:19:54 +00:00
/************************************************ create/drop stream **************************************************/
cmd ::= CREATE STREAM not_exists_opt(A) full_stream_name(B) stream_trigger(C)
stream_outtable_opt(D) as_subquery_opt(E). { pCxt->pRootNode = createCreateStreamStmt(pCxt, A, B, C, D, E); }
cmd ::= DROP STREAM exists_opt(A) full_stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, B); }
cmd ::= STOP STREAM exists_opt(A) full_stream_name(B). { pCxt->pRootNode = createPauseStreamStmt(pCxt, A, B); }
cmd ::= START STREAM exists_opt(A) ignore_opt(C) full_stream_name(B). { pCxt->pRootNode = createResumeStreamStmt(pCxt, A, C, B); }
cmd ::= RECALCULATE STREAM full_stream_name(A) recalculate_range(B). { pCxt->pRootNode = createRecalcStreamStmt(pCxt, A, B); }
2025-06-24 05:21:01 +00:00
/* recalculate_range(A) ::= ALL. { A = createRecalcRange(pCxt, NULL, NULL); } */
recalculate_range(A) ::= FROM time_point(B). { A = createRecalcRange(pCxt, B, NULL); }
recalculate_range(A) ::= FROM time_point(B) TO time_point(C). { A = createRecalcRange(pCxt, B, C); }
full_stream_name(A) ::= stream_name(B). { A = createStreamNode(pCxt, NULL, &B); }
full_stream_name(A) ::= db_name(B) NK_DOT stream_name(C). { A = createStreamNode(pCxt, &B, &C); }
/********** stream_outtable **********/
stream_outtable_opt(A) ::= . { A = NULL; }
stream_outtable_opt(A) ::= INTO full_table_name(B) output_subtable_opt(C) column_name_opt(D) stream_tags_def_opt(E). { A = createStreamOutTableNode(pCxt, B, C, D, E); }
/********** stream_trigger **********/
stream_trigger(A) ::= trigger_type(B) trigger_table_opt(C) stream_partition_by_opt(D)
trigger_options_opt(E) notification_opt(F). { A = createStreamTriggerNode(pCxt, B, C, D, E, F); }
/***** trigger type *****/
trigger_type(A) ::= SESSION NK_LP column_reference(B) NK_COMMA interval_sliding_duration_literal(C) NK_RP. { A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
feat(stream): optimize stream logic (#33027) * fix: remove debug log * fix: remove assert * fix: delete unused code * enh: [TD-37251] Support expr in state window. * feat(stream): support expr in state window trigger * enh: [TD-37251] Fix SCL_IS_CONST_CALC condition. * fix(stream): set ver in wal * fix: print code * fix: increase runner replica num * fix: trigger mem error * fix: sliding _tnext_ts value * fix(stream): disable tagFilterCache in stream reader trigger * fix: crash * Revert "fix(stream): fix history calc finish check" This reverts commit f93d17f1d27f011639d22cb0880637dbeb7e5532. * Revert "fix(stream): fix calc request allocation in trigger" This reverts commit c5410f6da09835303d32967f4b6d02a7e47cd589. * fix(stream): fix calc request allocation in trigger * enh: [TD-37251] External window support more placeholder. * fix(stream): modify size of return from 1000000->4096 * enh: [TD-37251] Modify error msg when stream query do not have from clause. * fix(stream): add log for group not found * fix(stream): do not return gid=0 in walMetaData interface * enh: [TD-37251] Fix missing ts column in vtable query. * fix: test case build failed * fix: invalid read issue * fix(stream): add vtable logic * fix(stream): encode error in wal * fix(stream): add vtable logic * fix(stream): add log * fix: diff funcition crash * Revert "Merge branch 'enh/TD-37251-3.0-dropoutput' into enh/TD-37251-3.0" This reverts commit e93cbd6fd42261527df046c70e0ece7568af187b, reversing changes made to dc3230591d4428c817703f52574aa01d5f10e5fe. * Revert "Merge branch 'enh/TD-37251-3.0-vtable' into enh/TD-37251-3.0" This reverts commit dc3230591d4428c817703f52574aa01d5f10e5fe, reversing changes made to 085e086782896db22acd292816e53497cbecb726. * fix(stream): fix block data len is too large if data type is vchar * fix: drop output table * feat: runner delete output table * process pDropBlock in trigger task. * fix(stream): opti log level * fix(stream): build block for drop table * fix(stream): set gid for normal table * fix(stream): set gid for normal table * feat: Support delete output. * fix(stream): rows error * fix(stream): memory leak * enh: [TD-37251] Fix external window wrong ts column. * fix(stream): fix calc time check in batch mode * fix: merge aligned external window issue * Revert "fix(stream): fix calc time check in batch mode" This reverts commit d895b7f5776cf77c2ce290cdeedca86c206da6ce. * fix(stream): add test case * fix(stream): add insert drop table logic * fix: external window end issue * fix(stream): add test case * fix(stream): fix trigger pull data * fix(stream): fix history calc request * enh: drop table on snode * fix(stream): adjust hash index if data is filtered in wal * fix(stream): rollback * enh: add merge aligned extwin window row idx * fix: drop output table * fix: compile issue * enh: [TD-37251] Add flag to identify interval window is overlapped * fix: overlap * fix(stream): set gid=-1 for initialized * fix(stream): modify log level * fix: trigger slow issue * fix(stream): add basic test for obj pool * fix(stream): fix metadata clear in trigger * fix(stream): fix idle runner allocation in trigger * fix: handle agg output on externalWin * fix: test case * fix(stream): adjust log * fix: reset pCtx pOutput * fix: memory leak * fix: search first win for tsCol * fix(stream): add test case for schema change * fix: mem leak * fix: mem leak * Reapply "Merge branch 'enh/TD-37251-3.0-vtable' into enh/TD-37251-3.0" This reverts commit b508e66958eb95117b1d086a964b87b5ac59a19e. * fix(stream): fix virtual table data pull * fix(stream): fix set table request * fix(stream): process empty uidlist * fix(stream): fix set table request * fix(stream): fix data new request in trigger * fix(stream): tablelist error for vtable * fix(stream): block ver is null * fix(stream): remove version limition for wal * fix(stream): block rows error * fix(stream): fix pending calc param in batch mode * fix(stream): auto create table * fix(stream): fix stream vtable data merge * fix: _tcurrentts * fix(stream): destroy hash * fix(stream): fix trigger status * fix(stream): colId error in vtable * fix(stream): update nrows of vtable data block * fix(stream): fix trigger status * fix(stream): enable low latency calc for period trigger * fix: test case file path * fix: test case file path * fix: string to node in reader * enh: add test log * fix(stream): increase wait time of non-low-latency mode * fix(stream): fix column capacity in scalar calculation * fix(stream): fix column capacity in trigger expr calculation * fix: get origTableInfos * fix(stream): fix calc data pull in trigger * fix(stream): fix calc data cache write in trigger * enh: [TD-37251] Add flag to identify interval wind * fix: external window memory usage issue * fix(stream): fix epxr result column in trigger * fix(stream): add metaCache for calc plan * fix(stream): fix stream obj list clear * fix(stream): rollback * enh: [TD-37251] Add flag to identify interval wind * fix: mem free * fix(stream): add metaCache for calc plan * fix(stream): fix calc data cache write in trigger * fix(stream): fix calc data cache write in trigger * enh: optimize external result block memory * fix(stream): modify logic of judge table for create table * fix(stream): fix event window check in trigger * fix(stream): fix count window check in trigger * fix(stream): colSize=0 while encoding block because pDataCol->hasNull is false in secode time & reload table list if create table * enh: optimize stream memory * fix(stream): trigger tag error * fix: add log * fix(stream): fix calc data write in trigger * fix: drop output table * fix(stream): fix max delay in trigger * fix: drop output table * fix(stream): fix max delay in trigger * fix(build): handle return value of function * fix(stream): read gid error if it is child table in stream * fix(stream): fix calc param of history calculation * fix(stream): fix recalc of delete data * fix(stream): fix calc data of period trigger * fix(stream): fix cache read check * fix(stream): filter error in calc plan * fix: reset externla window expr * fix(stream): fix calc parm of max delay * fix: time range and case issues * fix(stream): fix crash in trigger * fix: case issues * fix: fix window node mem leak. * fix(stream): fix meta data clear in trigger * fix(stream): table schema is old in TsdbDataRequest for vtable * fix: fix slingding window place holder check condition. * Revert "fix: fix slingding window place holder check condition." This reverts commit ad864a1dc113961b409e32e2ac7d1feb534b74d6. * fix(stream): null pointer error * fix: case issue * fix(stream): calc data error for vtable * fix(stream): fix data sorter in trigger * fix(stream): add log for delete data * fix(stream): fix start version of realtime calculation * fix(stream): fix cache data merger of vtable * fix: case issues * fix(ci): upgrade stream cases in test_cols_function * fix(stream): gid not found if change tag value * fix: fix slingding window place holder check condition. * fix(stream): fix virt table info request in trigger * fix(stream): set gid = uid if stream table type != SUPER table * fix: clean cache data by group * fix: add block info and case issues * fix: fix heap-buffer-overflow. * fix(stream): fix state window with extend param * fix: fix access null pointer. * fix: case issues * fix: case issue * fix(stream): fix ignore_nodata_trigger option for period trigger * fix(stream): fix pseudo col fetch for calc data * fix: Extend checking time to avoid timeout. * fix: case issues * fix(stream): fix group col fetch for virtual tables * fix(stream): tag is NULL for non vtable * fix(stream): fix sliding check of virtual table * test(stream): check stream status after create all streams * fix: add log * fix(stream): fix wal meta truncate when ignore disorder * fix(stream): gid not found for child table * fix: fix place holder condition pushdown error. * fix(stream): suid not equal when delete data for child table * fix: id issue * fix(stream): disable recalc for count trigger * fix: cast result rowSize error in project * fix(stream): add log for tsdb meta * fix(stream): fix gid in tsdb meta request * fix(stream): fix wend of unclosed windows * fix(stream): fix ignore_nodata_trigger option for period trigger * fix: case issues * fix(stream): fix calc data pull for empty interval window * fix: fix ext window condition. * fix(ci): smaBasic performance check affectd by debug level log * fix(stream): add suid when set table list for vtable * fix: forbid using prefilter when using %%trows an trigger table is virtual table. * fix: forbid prefilter %%trows cases. * fix(stream): sort cid in tsdbVirtalDataReq * fix: forbid prefilter %%trows cases. * fix(stream): add log for virtual table tsdb data * fix(stream): get delete msg for vtable * fix: winRowIndex * Revert "fix: winRowIndex" This reverts commit e08b41cf960bb9ca031b9ea20b4495cbbd4e3ed0. * fix(stream): fix data merge in trigger * test(stream): fix case ans * fix(stream): fix empty calc data pull for period trigger * fix(stream): col index error for tsdbVirtalDataReq * fix(stream): pTableList is NULL for vtable * test(stream): fix case ans * fix(stream): fix notification in trigger * fix(stream): memory leak * fix(stream): fix virtual data pull in trigger * test(stream): fix case ans * fix(stream): col index error for tsdbVirtalDataReq * fix(stream): pTableList is NULL for vtable * test(stream): fix case ans * fix(stream): fix notification in trigger * fix(stream): memory leak * fix(stream): fix virtual data pull in trigger * test(stream): fix case ans * fix: case issue * fix: crash issue * fix: forbid prefilter %%trows cases. * fix(stream): session case * fix(stream): fix data pull for virtual tables * fix(stream): add log * fix(stream): fix calc req send in batch mode * fix: fix stream UT * fix(stream): tablelist is null for non vtable * fix: mem leak * fix(stream): fix compile error in trigger * fix: return code issue --------- Co-authored-by: dapan1121 <wpan@taosdata.com> Co-authored-by: facetosea <285808407@qq.com> Co-authored-by: Jing Sima <simondominic9997@outlook.com> Co-authored-by: Jinqing Kuang <kuangjinqingcn@gmail.com> Co-authored-by: Tony Zhang <tonyzhang@taosdata.com>
2025-09-25 07:48:14 +00:00
trigger_type(A) ::= STATE_WINDOW NK_LP expr_or_subquery(B) extend(C) NK_RP true_for_opt(D). { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
trigger_type(A) ::= interval_opt(B) SLIDING NK_LP sliding_expr(C) NK_RP. { A = createIntervalWindowNodeExt(pCxt, B, C); }
trigger_type(A) ::= EVENT_WINDOW NK_LP START WITH search_condition(B) END WITH search_condition(C) NK_RP true_for_opt(D). { A = createEventWindowNode(pCxt, B, C, D); }
2025-06-03 10:31:49 +00:00
trigger_type(A) ::= COUNT_WINDOW NK_LP count_window_args(B) NK_RP. { A = createCountWindowNodeFromArgs(pCxt, B); }
trigger_type(A) ::= PERIOD NK_LP interval_sliding_duration_literal(B) offset_opt(C) NK_RP. { A = createPeriodWindowNode(pCxt, releaseRawExprNode(pCxt, B), C); }
interval_opt(A) ::= . { A = NULL; }
interval_opt(A) ::= INTERVAL NK_LP interval_sliding_duration_literal(C) NK_RP. { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, C), NULL, NULL, NULL); }
interval_opt(A) ::= INTERVAL NK_LP interval_sliding_duration_literal(C)
NK_COMMA interval_sliding_duration_literal(D) NK_RP. { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), NULL, NULL); }
sliding_expr(A) ::= interval_sliding_duration_literal(B). { A = createSlidingWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
sliding_expr(A) ::= interval_sliding_duration_literal(B) NK_COMMA interval_sliding_duration_literal(C). { A = createSlidingWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
%type sliding_val_opt { SToken }
%destructor sliding_val_opt { }
offset_opt(A) ::= . { A = NULL; }
offset_opt(A) ::= NK_COMMA interval_sliding_duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
/***** trigger_table_opt *****/
trigger_table_opt(A) ::= . { A = NULL; }
trigger_table_opt(A) ::= FROM full_table_name(B). { A = B; }
/***** stream_partition_by_opt *****/
%type stream_partition_by_opt { SNodeList* }
%destructor stream_partition_by_opt { nodesDestroyList($$); }
stream_partition_by_opt(A) ::= . { A = NULL; }
stream_partition_by_opt(A) ::= PARTITION BY stream_partition_list(B). { A = B; }
%type stream_partition_list { SNodeList* }
%destructor stream_partition_list { nodesDestroyList($$); }
stream_partition_list(A) ::= stream_partition_item(B). { A = createNodeList(pCxt, B); }
stream_partition_list(A) ::= stream_partition_list(B) NK_COMMA stream_partition_item(C). { A = addNodeToList(pCxt, B, C); }
stream_partition_item(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); }
stream_partition_item(A) ::= expr_or_subquery(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
/***** trigger_options_opt *****/
trigger_options_opt(A) ::= . { A = NULL; }
trigger_options_opt(A) ::= STREAM_OPTIONS NK_LP trigger_option_list(B) NK_RP. { A = B; }
trigger_option_list(A) ::= trigger_option(B). { A = createStreamTriggerOptions(pCxt); A = setStreamTriggerOptions(pCxt, A, &B); }
trigger_option_list(A) ::= trigger_option_list(B) NK_BITOR trigger_option(C). { A = setStreamTriggerOptions(pCxt, B, &C); }
%type trigger_option { SStreamTriggerOption }
%destructor trigger_option { }
trigger_option(A) ::= CALC_NOTIFY_ONLY. { A.type = STREAM_TRIGGER_OPTION_CALC_NOTIFY_ONLY; A.pNode = NULL; }
trigger_option(A) ::= DELETE_RECALC. { A.type = STREAM_TRIGGER_OPTION_DELETE_RECALC; A.pNode = NULL; }
trigger_option(A) ::= DELETE_OUTPUT_TABLE. { A.type = STREAM_TRIGGER_OPTION_DELETE_OUTPUT_TABLE; A.pNode = NULL; }
trigger_option(A) ::= EXPIRED_TIME NK_LP duration_literal(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_EXPIRED_TIME; A.pNode = releaseRawExprNode(pCxt, B); }
trigger_option(A) ::= FILL_HISTORY NK_LP time_point(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_FILL_HISTORY; A.pNode = B; }
trigger_option(A) ::= FILL_HISTORY_FIRST NK_LP time_point(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_FILL_HISTORY_FIRST; A.pNode = B; }
trigger_option(A) ::= FILL_HISTORY. { A.type = STREAM_TRIGGER_OPTION_FILL_HISTORY; A.pNode = NULL; }
trigger_option(A) ::= FILL_HISTORY_FIRST. { A.type = STREAM_TRIGGER_OPTION_FILL_HISTORY_FIRST; A.pNode = NULL; }
trigger_option(A) ::= FORCE_OUTPUT. { A.type = STREAM_TRIGGER_OPTION_FORCE_OUTPUT; A.pNode = NULL; }
trigger_option(A) ::= IGNORE_DISORDER. { A.type = STREAM_TRIGGER_OPTION_IGNORE_DISORDER; A.pNode = NULL; }
trigger_option(A) ::= LOW_LATENCY_CALC. { A.type = STREAM_TRIGGER_OPTION_LOW_LATENCY_CALC; A.pNode = NULL; }
trigger_option(A) ::= MAX_DELAY NK_LP duration_literal(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_MAX_DELAY; A.pNode = releaseRawExprNode(pCxt, B); }
trigger_option(A) ::= PRE_FILTER NK_LP search_condition(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_PRE_FILTER; A.pNode = B; }
trigger_option(A) ::= WATERMARK NK_LP duration_literal(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_WATERMARK; A.pNode = releaseRawExprNode(pCxt, B); }
trigger_option(A) ::= EVENT_TYPE NK_LP event_type_list(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_EVENT_TYPE; A.flag = B; A.pNode = NULL; }
trigger_option(A) ::= IGNORE_NODATA_TRIGGER. { A.type = STREAM_TRIGGER_OPTION_IGNORE_NODATA_TRIGGER; A.pNode = NULL; }
/***** notification_opt *****/
notification_opt(A) ::= . { A = NULL; }
notification_opt(A) ::= NOTIFY NK_LP notify_url_list(B) NK_RP
notify_on_opt(C) where_clause_opt(D)
notify_options_opt(E). { A = createStreamNotifyOptions(pCxt, B, C, D, E); }
%type notify_url_list { SNodeList* }
%destructor notify_url_list { nodesDestroyList($$); }
notify_url_list(A) ::= NK_STRING(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); }
notify_url_list(A) ::= notify_url_list(B) NK_COMMA NK_STRING(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C)); }
%type notify_on_opt { int64_t }
%destructor notify_on_opt { }
notify_on_opt(A) ::= . { A = EVENT_NONE; }
notify_on_opt(A) ::= ON NK_LP event_type_list(B) NK_RP. { A = B; }
%type notify_options_opt { int64_t }
%destructor notify_options_opt { }
notify_options_opt(A) ::= . { A = NOTIFY_NONE; }
notify_options_opt(A) ::= NOTIFY_OPTIONS NK_LP notify_options_list(B) NK_RP. { A = B; }
%type notify_options_list { int64_t }
%destructor notify_options_list { }
notify_options_list(A) ::= notify_option(B). { A = B; }
notify_options_list(A) ::= notify_options_list(B) NK_BITOR notify_option(C). { A = B | C; }
%type notify_option { int64_t }
%destructor notify_option { }
notify_option(A) ::= NOTIFY_HISTORY. { A = NOTIFY_HISTORY; }
/***** common part *****/
time_point(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
time_point(A) ::= NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
%type column_name_list { SNodeList* }
%destructor column_name_list { nodesDestroyList($$); }
column_name_list(A) ::= trigger_col_name(B). { A = createNodeList(pCxt, B); }
column_name_list(A) ::= column_name_list(B) NK_COMMA trigger_col_name(C). { A = addNodeToList(pCxt, B, C); }
trigger_col_name(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); }
trigger_col_name(A) ::= TBNAME(B). { A = createFunctionNode(pCxt, &B, NULL); }
%type event_type_list { int64_t }
%destructor event_type_list { }
event_type_list(A) ::= event_types(B). { A = B;}
event_type_list(A) ::= event_type_list(B) NK_BITOR event_types(C). { A = B | C; }
%type event_types { int64_t }
%destructor event_types { }
event_types(A) ::= WINDOW_OPEN. { A = EVENT_WINDOW_OPEN; }
event_types(A) ::= WINDOW_CLOSE. { A = EVENT_WINDOW_CLOSE; }
/********** output_subtable_opt **********/
output_subtable_opt(A) ::= . { A = NULL; }
output_subtable_opt(A) ::= OUTPUT_SUBTABLE NK_LP expr_or_subquery(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
%type column_name_opt { SNodeList* }
%destructor column_name_opt { nodesDestroyList($$); }
column_name_opt(A) ::= . { A = NULL; }
column_name_opt(A) ::= column_name_unit(B). { A = B; }
%type stream_tags_def_opt { SNodeList* }
%destructor stream_tags_def_opt { nodesDestroyList($$); }
stream_tags_def_opt(A) ::= . { A = NULL; }
stream_tags_def_opt(A) ::= TAGS NK_LP stream_tags_def_list(B) NK_RP. { A = B; }
%type stream_tags_def_list { SNodeList* }
%destructor stream_tags_def_list { nodesDestroyList($$); }
stream_tags_def_list(A) ::= stream_tags_def(B). { A = createNodeList(pCxt, B); }
stream_tags_def_list(A) ::= stream_tags_def_list(B) NK_COMMA stream_tags_def(C). { A = addNodeToList(pCxt, B, C); }
stream_tags_def(A) ::= column_name(B) type_name(C) AS expression(D). { A = createStreamTagDefNode(pCxt, &B, C, releaseRawExprNode(pCxt, D)); }
%type column_name_unit { SNodeList* }
%destructor column_name_unit { nodesDestroyList($$); }
column_name_unit(A) ::= NK_LP column_stream_def_list(B) NK_RP. { A = B; }
2024-03-21 02:50:07 +00:00
%type column_stream_def_list { SNodeList* }
%destructor column_stream_def_list { nodesDestroyList($$); }
column_stream_def_list(A) ::= column_stream_def(B). { A = createNodeList(pCxt, B); }
column_stream_def_list(A) ::= column_stream_def_list(B)
NK_COMMA column_stream_def(C). { A = addNodeToList(pCxt, B, C); }
2024-04-15 06:08:54 +00:00
column_stream_def(A) ::= column_name(B) stream_col_options(C). { A = createColumnDefNode(pCxt, &B, createDataType(TSDB_DATA_TYPE_NULL), C); }
2024-04-15 06:08:54 +00:00
stream_col_options(A) ::= . { A = createDefaultColumnOptions(pCxt); }
stream_col_options(A) ::= stream_col_options(B) PRIMARY KEY. { A = setColumnOptionsPK(pCxt, B); }
stream_col_options(A) ::= stream_col_options(B) COMPOSITE KEY. { A = setColumnOptionsPK(pCxt, B); }
2024-03-21 02:50:07 +00:00
//column_stream_def(A) ::= column_def(B). { A = B; }
as_subquery_opt(A) ::= . { A = NULL; }
as_subquery_opt(A) ::= AS query_or_subquery(B). { A = B; }
%type ignore_opt { bool }
%destructor ignore_opt { }
ignore_opt(A) ::= . { A = false; }
ignore_opt(A) ::= IGNORE UNTREATED. { A = true; }
/************************************************ kill connection/query ***********************************************/
cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); }
2022-06-15 05:49:29 +00:00
cmd ::= KILL QUERY NK_STRING(A). { pCxt->pRootNode = createKillQueryStmt(pCxt, &A); }
cmd ::= KILL TRANSACTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &A); }
cmd ::= KILL COMPACT NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &A); }
2025-09-26 09:32:32 +00:00
cmd ::= KILL RETENTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_RETENTION_STMT, &A); }
cmd ::= KILL SCAN NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_SCAN_STMT, &A); }
cmd ::= KILL SSMIGRATE NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_SSMIGRATE_STMT, &A); }
/************************************************ merge/redistribute/ vgroup ******************************************/
2022-06-07 03:53:32 +00:00
cmd ::= BALANCE VGROUP. { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
2025-01-23 09:37:07 +00:00
2025-02-12 08:20:56 +00:00
cmd ::= ASSIGN LEADER FORCE. { pCxt->pRootNode = createAssignLeaderStmt(pCxt); }
2025-01-23 09:37:07 +00:00
cmd ::= BALANCE VGROUP LEADER on_vgroup_id(A). { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &A); }
2024-05-13 08:20:27 +00:00
cmd ::= BALANCE VGROUP LEADER DATABASE db_name(A). { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &A); }
cmd ::= MERGE VGROUP NK_INTEGER(A) NK_INTEGER(B). { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &A, &B); }
cmd ::= REDISTRIBUTE VGROUP NK_INTEGER(A) dnode_list(B). { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &A, B); }
2025-06-06 01:09:40 +00:00
cmd ::= SPLIT VGROUP NK_INTEGER(A) force_opt(B). { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &A, B); }
%type on_vgroup_id { SToken }
%destructor on_vgroup_id { }
on_vgroup_id(A) ::= . { A = nil_token; }
on_vgroup_id(A) ::= ON NK_INTEGER(B). { A = B; }
%type dnode_list { SNodeList* }
%destructor dnode_list { nodesDestroyList($$); }
dnode_list(A) ::= DNODE NK_INTEGER(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); }
dnode_list(A) ::= dnode_list(B) DNODE NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); }
/************************************************ syncdb **************************************************************/
2022-07-27 03:55:19 +00:00
//cmd ::= SYNCDB db_name(A) REPLICA. { pCxt->pRootNode = createSyncdbStmt(pCxt, &A); }
2022-06-04 11:54:55 +00:00
/************************************************ syncdb **************************************************************/
cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B). { pCxt->pRootNode = createDeleteStmt(pCxt, A, B); }
2022-03-10 07:36:06 +00:00
/************************************************ select **************************************************************/
2022-09-16 07:53:27 +00:00
cmd ::= query_or_subquery(A). { pCxt->pRootNode = A; }
2022-03-10 07:36:06 +00:00
2022-07-05 13:12:10 +00:00
/************************************************ insert **************************************************************/
2023-01-31 08:04:57 +00:00
cmd ::= insert_query(A). { pCxt->pRootNode = A; }
insert_query(A) ::= INSERT INTO full_table_name(D)
2023-01-31 08:04:57 +00:00
NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); }
insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); }
2022-07-05 13:12:10 +00:00
2024-03-10 14:14:57 +00:00
/************************************************ tags_literal *************************************************************/
tags_literal(A) ::= NK_INTEGER(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_INTEGER(B) NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_INTEGER(B) NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-10 14:14:57 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_PLUS(B) NK_INTEGER NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-10 14:14:57 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_MINUS(B) NK_INTEGER NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-10 14:14:57 +00:00
tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); }
tags_literal(A) ::= NK_PLUS(B) NK_FLOAT(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
tags_literal(A) ::= NK_MINUS(B) NK_FLOAT(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_BIN(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_BIN(B) NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_BIN(B) NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_BIN(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_PLUS(B) NK_BIN NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_BIN(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_MINUS(B) NK_BIN NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_HEX(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_HEX(B) NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_HEX(B) NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_HEX(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_PLUS(B) NK_HEX NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_HEX(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_MINUS(B) NK_HEX NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-13 07:12:21 +00:00
2024-03-10 14:14:57 +00:00
tags_literal(A) ::= NK_STRING(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B, NULL); }
2024-04-01 05:58:13 +00:00
tags_literal(A) ::= NK_STRING(B) NK_PLUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
tags_literal(A) ::= NK_STRING(B) NK_MINUS duration_literal(C). {
SToken l = B;
SToken r = getTokenFromRawExprNode(pCxt, C);
2024-06-24 14:13:03 +00:00
l.n = (r.z + r.n) - l.z;
2024-04-01 05:58:13 +00:00
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, C);
}
2024-03-10 14:14:57 +00:00
tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); }
tags_literal(A) ::= NULL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B, NULL); }
tags_literal(A) ::= literal_func(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, B); }
tags_literal(A) ::= literal_func(B) NK_PLUS duration_literal(C). {
SToken l = getTokenFromRawExprNode(pCxt, B);
SToken r = getTokenFromRawExprNode(pCxt, C);
l.n = (r.z + r.n) - l.z;
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
}
tags_literal(A) ::= literal_func(B) NK_MINUS duration_literal(C). {
SToken l = getTokenFromRawExprNode(pCxt, B);
SToken r = getTokenFromRawExprNode(pCxt, C);
l.n = (r.z + r.n) - l.z;
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
}
%type tags_literal_list { SNodeList* }
%destructor tags_literal_list { nodesDestroyList($$); }
tags_literal_list(A) ::= tags_literal(B). { A = createNodeList(pCxt, B); }
tags_literal_list(A) ::= tags_literal_list(B) NK_COMMA tags_literal(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
/************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
2022-03-10 07:36:06 +00:00
literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); }
literal(A) ::= NK_STRING(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)); }
literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); }
literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); }
literal(A) ::= duration_literal(B). { A = B; }
literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B)); }
literal(A) ::= NK_QUESTION(B). { A = createRawExprNode(pCxt, &B, createPlaceholderValueNode(pCxt, &B)); }
2022-03-10 07:36:06 +00:00
duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
2024-11-27 08:27:14 +00:00
signed_variable(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
signed_variable(A) ::= NK_PLUS NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
signed_variable(A) ::= NK_MINUS(B) NK_VARIABLE(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &t));
}
signed_integer(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B); }
signed_integer(A) ::= NK_PLUS NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B); }
signed_integer(A) ::= NK_MINUS(B) NK_INTEGER(C). {
2022-03-22 06:09:15 +00:00
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
2024-11-27 08:27:14 +00:00
2025-01-22 03:45:12 +00:00
unsigned_integer(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); }
unsigned_integer(A) ::= NK_QUESTION(B). { A = releaseRawExprNode(pCxt, createRawExprNode(pCxt, &B, createPlaceholderValueNode(pCxt, &B))); }
2024-11-27 08:27:14 +00:00
signed_float(A) ::= NK_FLOAT(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B); }
signed_float(A) ::= NK_PLUS NK_FLOAT(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B); }
signed_float(A) ::= NK_MINUS(B) NK_FLOAT(C). {
2022-03-22 06:09:15 +00:00
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
2024-11-27 08:27:14 +00:00
signed(A) ::= signed_integer(B). { A = B; }
signed(A) ::= signed_float(B). { A = B; }
2022-03-22 06:09:15 +00:00
signed_literal(A) ::= signed(B). { A = B; }
signed_literal(A) ::= NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
signed_literal(A) ::= NK_BOOL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B); }
signed_literal(A) ::= TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= NULL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B); }
signed_literal(A) ::= literal_func(B). { A = releaseRawExprNode(pCxt, B); }
2022-07-12 07:11:55 +00:00
signed_literal(A) ::= NK_QUESTION(B). { A = createPlaceholderValueNode(pCxt, &B); }
2022-03-22 06:09:15 +00:00
2025-01-22 03:45:12 +00:00
2022-03-10 07:36:06 +00:00
%type literal_list { SNodeList* }
%destructor literal_list { nodesDestroyList($$); }
2022-03-22 06:09:15 +00:00
literal_list(A) ::= signed_literal(B). { A = createNodeList(pCxt, B); }
literal_list(A) ::= literal_list(B) NK_COMMA signed_literal(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
/************************************************ names and identifiers ***********************************************/
%type db_name { SToken }
%destructor db_name { }
db_name(A) ::= NK_ID(B). { A = B; }
2025-07-12 07:39:29 +00:00
%type mount_name { SToken }
%destructor mount_name { }
mount_name(A) ::= NK_ID(B). { A = B; }
2022-03-10 07:36:06 +00:00
%type table_name { SToken }
%destructor table_name { }
table_name(A) ::= NK_ID(B). { A = B; }
%type column_name { SToken }
%destructor column_name { }
column_name(A) ::= NK_ID(B). { A = B; }
%type function_name { SToken }
%destructor function_name { }
function_name(A) ::= NK_ID(B). { A = B; }
2023-09-19 06:19:54 +00:00
%type view_name { SToken }
%destructor view_name { }
view_name(A) ::= NK_ID(B). { A = B; }
2022-03-10 07:36:06 +00:00
%type table_alias { SToken }
%destructor table_alias { }
table_alias(A) ::= NK_ID(B). { A = B; }
%type column_alias { SToken }
%destructor column_alias { }
column_alias(A) ::= NK_ID(B). { A = B; }
column_alias(A) ::= NK_ALIAS(B). { A = B; }
2022-03-10 07:36:06 +00:00
%type user_name { SToken }
%destructor user_name { }
user_name(A) ::= NK_ID(B). { A = B; }
%type topic_name { SToken }
%destructor topic_name { }
topic_name(A) ::= NK_ID(B). { A = B; }
%type stream_name { SToken }
%destructor stream_name { }
stream_name(A) ::= NK_ID(B). { A = B; }
2022-05-25 13:20:11 +00:00
%type cgroup_name { SToken }
%destructor cgroup_name { }
cgroup_name(A) ::= NK_ID(B). { A = B; }
%type index_name { SToken }
%destructor index_name { }
index_name(A) ::= NK_ID(B). { A = B; }
2023-11-20 08:36:13 +00:00
%type tsma_name { SToken }
%destructor tsma_name { }
tsma_name(A) ::= NK_ID(B). { A = B; }
2025-09-26 09:32:32 +00:00
%type rsma_name { SToken }
%destructor rsma_name { }
rsma_name(A) ::= NK_ID(B). { A = B; }
2023-11-20 08:36:13 +00:00
2022-03-10 07:36:06 +00:00
/************************************************ expression **********************************************************/
2022-09-22 11:20:21 +00:00
expr_or_subquery(A) ::= expression(B). { A = B; }
2022-11-28 03:22:11 +00:00
//expr_or_subquery(A) ::= subquery(B). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
2022-09-22 11:20:21 +00:00
2022-03-10 07:36:06 +00:00
expression(A) ::= literal(B). { A = B; }
2024-07-23 07:59:10 +00:00
expression(A) ::= pseudo_column(B). { A = B; (void)setRawExprNodeIsPseudoColumn(pCxt, A, true); }
2022-03-10 07:36:06 +00:00
expression(A) ::= column_reference(B). { A = B; }
expression(A) ::= function_expression(B). { A = B; }
expression(A) ::= if_expression(B). { A = B; }
2022-09-22 11:20:21 +00:00
expression(A) ::= case_when_expression(B). { A = B; }
2022-03-10 07:36:06 +00:00
expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
2022-09-22 11:20:21 +00:00
expression(A) ::= NK_PLUS(B) expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken t = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &t, releaseRawExprNode(pCxt, C));
}
2022-09-22 11:20:21 +00:00
expression(A) ::= NK_MINUS(B) expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken t = getTokenFromRawExprNode(pCxt, C);
2022-04-02 05:13:20 +00:00
A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, C), NULL));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_PLUS expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_MINUS expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_STAR expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_SLASH expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_REM expr_or_subquery(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
2022-03-10 07:36:06 +00:00
}
expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C)));
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_BITAND expr_or_subquery(C). {
2022-06-22 08:35:14 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
2022-09-22 11:20:21 +00:00
expression(A) ::= expr_or_subquery(B) NK_BITOR expr_or_subquery(C). {
2022-06-22 08:35:14 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
2022-03-10 07:36:06 +00:00
%type expression_list { SNodeList* }
%destructor expression_list { nodesDestroyList($$); }
2022-09-22 11:20:21 +00:00
expression_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
expression_list(A) ::= expression_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
2022-03-10 07:36:06 +00:00
column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); }
column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); }
column_reference(A) ::= NK_ALIAS(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); }
column_reference(A) ::= table_name(B) NK_DOT NK_ALIAS(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); }
2022-03-10 07:36:06 +00:00
pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= table_name(B) NK_DOT TBNAME(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &C, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B)))); }
pseudo_column(A) ::= QSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= IROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= ISFILLED(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QTAGS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
2024-10-15 02:00:38 +00:00
pseudo_column(A) ::= FLOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= FHIGH(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= FROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
2024-11-28 10:29:20 +00:00
pseudo_column(A) ::= IROWTS_ORIGIN(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TPREV_TS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TCURRENT_TS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TNEXT_TS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TWSTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TWEND(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TWDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TWROWNUM(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TPREV_LOCALTIME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TNEXT_LOCALTIME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TLOCALTIME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TGRPID(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= NK_PH NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createPlaceHolderColumnNode(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B))); }
pseudo_column(A) ::= NK_PH TBNAME(B). { A = createRawExprNode(pCxt, &B, createPHTbnameFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= IMPROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= IMPMASK(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= ANOMALYMASK(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
2022-03-10 07:36:06 +00:00
function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
2024-12-09 08:21:14 +00:00
function_expression(A) ::= cols_func(B) NK_LP cols_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
2022-09-22 11:20:21 +00:00
function_expression(A) ::=
2025-02-24 09:37:01 +00:00
CAST(B) NK_LP common_expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); }
2024-04-09 10:00:48 +00:00
function_expression(A) ::=
2025-02-24 09:37:01 +00:00
CAST(B) NK_LP common_expression(C) AS type_name_default_len(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); }
function_expression(A) ::=
POSITION(B) NK_LP expr_or_subquery(C) IN expr_or_subquery(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); }
function_expression(A) ::=
TRIM(B) NK_LP expr_or_subquery(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, C), TRIM_TYPE_BOTH)); }
function_expression(A) ::=
TRIM(B) NK_LP trim_specification_type(C) FROM expr_or_subquery(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, D), C)); }
function_expression(A) ::=
TRIM(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), TRIM_TYPE_BOTH)); }
function_expression(A) ::=
TRIM(B) NK_LP trim_specification_type(C) expr_or_subquery(D) FROM expr_or_subquery(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E), C)); }
function_expression(A) ::=
substr_func(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::=
substr_func(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); }
function_expression(A) ::=
substr_func(B) NK_LP expr_or_subquery(C) FROM expr_or_subquery(D) FOR expr_or_subquery(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
function_expression(A) ::= REPLACE(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::= literal_func(B). { A = B; }
function_expression(A) ::= rand_func(B). { A = B; }
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
literal_func(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
2024-03-10 14:14:57 +00:00
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
rand_func(A) ::= RAND(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
rand_func(A) ::= RAND(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
%type substr_func { SToken }
%destructor substr_func { }
substr_func(A) ::= SUBSTR(B). { A = B; }
substr_func(A) ::= SUBSTRING(B). { A = B; }
%type trim_specification_type ETrimType
%destructor trim_specification_type { }
trim_specification_type(A) ::= BOTH. { A = TRIM_TYPE_BOTH; }
trim_specification_type(A) ::= TRAILING. { A = TRIM_TYPE_TRAILING; }
trim_specification_type(A) ::= LEADING. { A = TRIM_TYPE_LEADING; }
%type noarg_func { SToken }
%destructor noarg_func { }
noarg_func(A) ::= NOW(B). { A = B; }
noarg_func(A) ::= TODAY(B). { A = B; }
noarg_func(A) ::= TIMEZONE(B). { A = B; }
noarg_func(A) ::= DATABASE(B). { A = B; }
noarg_func(A) ::= CLIENT_VERSION(B). { A = B; }
noarg_func(A) ::= SERVER_VERSION(B). { A = B; }
noarg_func(A) ::= SERVER_STATUS(B). { A = B; }
noarg_func(A) ::= CURRENT_USER(B). { A = B; }
noarg_func(A) ::= USER(B). { A = B; }
noarg_func(A) ::= PI(B). { A = B; }
%type star_func { SToken }
%destructor star_func { }
star_func(A) ::= COUNT(B). { A = B; }
star_func(A) ::= FIRST(B). { A = B; }
star_func(A) ::= LAST(B). { A = B; }
star_func(A) ::= LAST_ROW(B). { A = B; }
2024-12-09 08:21:14 +00:00
%type cols_func { SToken }
%destructor cols_func { }
cols_func(A) ::= COLS(B). { A = B; }
%type cols_func_para_list { SNodeList* }
%destructor cols_func_para_list { nodesDestroyList($$); }
cols_func_para_list(A) ::= function_expression(B) NK_COMMA cols_func_expression_list(C). { A = createColsFuncParamNodeList(pCxt, B, C, NULL); }
cols_func_expression(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); }
cols_func_expression(A) ::= NK_STAR(B). { A = createColumnNode(pCxt, NULL, &B); }
2024-12-09 08:21:14 +00:00
cols_func_expression(A) ::= expr_or_subquery(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C);}
cols_func_expression(A) ::= expr_or_subquery(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C);}
%type cols_func_expression_list { SNodeList* }
%destructor cols_func_expression_list { nodesDestroyList($$); }
cols_func_expression_list(A) ::= cols_func_expression(B). { A = createNodeList(pCxt, B); }
cols_func_expression_list(A) ::= cols_func_expression_list(B) NK_COMMA cols_func_expression(C). { A = addNodeToList(pCxt, B, C); }
%type star_func_para_list { SNodeList* }
%destructor star_func_para_list { nodesDestroyList($$); }
star_func_para_list(A) ::= NK_STAR(B). { A = createNodeList(pCxt, createColumnNode(pCxt, NULL, &B)); }
star_func_para_list(A) ::= other_para_list(B). { A = B; }
%type other_para_list { SNodeList* }
%destructor other_para_list { nodesDestroyList($$); }
other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); }
other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); }
2022-09-22 11:20:21 +00:00
star_func_para(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); }
star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
2022-03-10 07:36:06 +00:00
if_expression(A) ::=
IF(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_COMMA common_expression(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createIfNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
if_expression(A) ::=
IFNULL(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createNvlNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); }
if_expression(A) ::=
NVL(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createNvlNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); }
if_expression(A) ::=
NVL2(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_COMMA common_expression(E) NK_RP(F). { A = createRawExprNodeExt(pCxt, &B, &F, createNvl2Node(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D), releaseRawExprNode(pCxt, E))); }
if_expression(A) ::=
//NULLIF(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createNullIfNode(pCxt, C, D)); }
NULLIF(B) NK_LP common_expression(C) NK_COMMA common_expression(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createNullIfNode(pCxt, releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D))); }
if_expression(A) ::=
COALESCE(B) NK_LP expression_list(C) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCoalesceNode(pCxt, C)); }
2022-09-22 11:20:21 +00:00
case_when_expression(A) ::=
CASE(E) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, NULL, C, D)); }
case_when_expression(A) ::=
CASE(E) common_expression(B) when_then_list(C) case_when_else_opt(D) END(F). { A = createRawExprNodeExt(pCxt, &E, &F, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, B), C, D)); }
%type when_then_list { SNodeList* }
%destructor when_then_list { nodesDestroyList($$); }
when_then_list(A) ::= when_then_expr(B). { A = createNodeList(pCxt, B); }
when_then_list(A) ::= when_then_list(B) when_then_expr(C). { A = addNodeToList(pCxt, B, C); }
when_then_expr(A) ::= WHEN common_expression(B) THEN common_expression(C). { A = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
case_when_else_opt(A) ::= . { A = NULL; }
case_when_else_opt(A) ::= ELSE common_expression(B). { A = releaseRawExprNode(pCxt, B); }
2022-03-10 07:36:06 +00:00
/************************************************ predicate ***********************************************************/
2022-09-22 11:20:21 +00:00
predicate(A) ::= expr_or_subquery(B) compare_op(C) expr_or_subquery(D). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
//predicate(A) ::= expression(B) compare_op sub_type expression(B).
2022-09-22 11:20:21 +00:00
predicate(A) ::=
expr_or_subquery(B) BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)));
}
2022-09-22 11:20:21 +00:00
predicate(A) ::=
expr_or_subquery(B) NOT BETWEEN expr_or_subquery(C) AND expr_or_subquery(D). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
2022-04-19 05:25:19 +00:00
A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)));
2022-03-10 07:36:06 +00:00
}
2022-09-22 11:20:21 +00:00
predicate(A) ::= expr_or_subquery(B) IS NULL(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, B), NULL));
}
2022-09-22 11:20:21 +00:00
predicate(A) ::= expr_or_subquery(B) IS NOT NULL(C). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, B), NULL));
}
predicate(A) ::= ISNULL(B) NK_LP expr_or_subquery(C) NK_RP(D). {
A = createRawExprNodeExt(pCxt, &B, &D, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, C), NULL));
}
predicate(A) ::= ISNOTNULL(B) NK_LP expr_or_subquery(C) NK_RP(D). {
A = createRawExprNodeExt(pCxt, &B, &D, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, C), NULL));
}
2022-09-22 11:20:21 +00:00
predicate(A) ::= expr_or_subquery(B) in_op(C) in_predicate_value(D). {
2022-03-10 07:36:06 +00:00
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, D)));
}
%type compare_op { EOperatorType }
%destructor compare_op { }
compare_op(A) ::= NK_LT. { A = OP_TYPE_LOWER_THAN; }
compare_op(A) ::= NK_GT. { A = OP_TYPE_GREATER_THAN; }
compare_op(A) ::= NK_LE. { A = OP_TYPE_LOWER_EQUAL; }
compare_op(A) ::= NK_GE. { A = OP_TYPE_GREATER_EQUAL; }
compare_op(A) ::= NK_NE. { A = OP_TYPE_NOT_EQUAL; }
compare_op(A) ::= NK_EQ. { A = OP_TYPE_EQUAL; }
compare_op(A) ::= LIKE. { A = OP_TYPE_LIKE; }
compare_op(A) ::= NOT LIKE. { A = OP_TYPE_NOT_LIKE; }
compare_op(A) ::= MATCH. { A = OP_TYPE_MATCH; }
compare_op(A) ::= NMATCH. { A = OP_TYPE_NMATCH; }
2025-02-06 07:14:38 +00:00
compare_op(A) ::= REGEXP. { A = OP_TYPE_MATCH; }
compare_op(A) ::= NOT REGEXP. { A = OP_TYPE_NMATCH; }
compare_op(A) ::= CONTAINS. { A = OP_TYPE_JSON_CONTAINS; }
2022-03-10 07:36:06 +00:00
%type in_op { EOperatorType }
%destructor in_op { }
in_op(A) ::= IN. { A = OP_TYPE_IN; }
in_op(A) ::= NOT IN. { A = OP_TYPE_NOT_IN; }
in_predicate_value(A) ::= NK_LP(C) literal_list(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, createNodeListNode(pCxt, B)); }
2022-03-10 07:36:06 +00:00
/************************************************ boolean_value_expression ********************************************/
boolean_value_expression(A) ::= boolean_primary(B). { A = B; }
boolean_value_expression(A) ::= NOT(C) boolean_primary(B). {
SToken e = getTokenFromRawExprNode(pCxt, B);
A = createRawExprNodeExt(pCxt, &C, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, B), NULL));
}
boolean_value_expression(A) ::=
boolean_value_expression(B) OR boolean_value_expression(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
boolean_value_expression(A) ::=
boolean_value_expression(B) AND boolean_value_expression(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
boolean_primary(A) ::= predicate(B). { A = B; }
boolean_primary(A) ::= NK_LP(C) boolean_value_expression(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(pCxt, B)); }
/************************************************ common_expression ********************************************/
2022-09-22 11:20:21 +00:00
common_expression(A) ::= expr_or_subquery(B). { A = B; }
2022-03-10 07:36:06 +00:00
common_expression(A) ::= boolean_value_expression(B). { A = B; }
2022-06-22 01:54:31 +00:00
/************************************************ from_clause_opt *********************************************************/
from_clause_opt(A) ::= . { A = NULL; }
from_clause_opt(A) ::= FROM table_reference_list(B). { A = B; }
2022-03-10 07:36:06 +00:00
table_reference_list(A) ::= table_reference(B). { A = B; }
2023-11-27 12:01:00 +00:00
table_reference_list(A) ::= table_reference_list(B) NK_COMMA table_reference(C). { A = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, B, C, NULL); }
2022-03-10 07:36:06 +00:00
/************************************************ table_reference *****************************************************/
table_reference(A) ::= table_primary(B). { A = B; }
table_reference(A) ::= joined_table(B). { A = B; }
table_primary(A) ::= table_name(B) alias_opt(C). { A = createRealTableNode(pCxt, NULL, &B, &C); }
table_primary(A) ::= db_name(B) NK_DOT table_name(C) alias_opt(D). { A = createRealTableNode(pCxt, &B, &C, &D); }
table_primary(A) ::= subquery(B) alias_opt(C). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
table_primary(A) ::= parenthesized_joined_table(B). { A = B; }
table_primary(A) ::= NK_PH TBNAME alias_opt(C). { A = createPlaceHolderTableNode(pCxt, SP_PARTITION_TBNAME, &C); }
table_primary(A) ::= NK_PH TROWS alias_opt(C). { A = createPlaceHolderTableNode(pCxt, SP_PARTITION_ROWS, &C); }
2022-03-10 07:36:06 +00:00
%type alias_opt { SToken }
%destructor alias_opt { }
alias_opt(A) ::= . { A = nil_token; }
alias_opt(A) ::= table_alias(B). { A = B; }
alias_opt(A) ::= AS table_alias(B). { A = B; }
parenthesized_joined_table(A) ::= NK_LP joined_table(B) NK_RP. { A = B; }
parenthesized_joined_table(A) ::= NK_LP parenthesized_joined_table(B) NK_RP. { A = B; }
/************************************************ joined_table ********************************************************/
joined_table(A) ::= inner_joined(B). { A = B; }
joined_table(A) ::= outer_joined(B). { A = B; }
joined_table(A) ::= semi_joined(B). { A = B; }
joined_table(A) ::= anti_joined(B). { A = B; }
joined_table(A) ::= asof_joined(B). { A = B; }
joined_table(A) ::= win_joined(B). { A = B; }
/************************************************ inner join **********************************************************/
inner_joined(A) ::=
table_reference(B) JOIN table_reference(E) join_on_clause_opt(F). { JOINED_TABLE_MK(JOIN_TYPE_INNER, JOIN_STYPE_NONE, A, B, E, F, NULL, NULL); }
inner_joined(A) ::=
table_reference(B) INNER JOIN table_reference(E) join_on_clause_opt(F). { JOINED_TABLE_MK(JOIN_TYPE_INNER, JOIN_STYPE_NONE, A, B, E, F, NULL, NULL); }
2025-01-02 11:43:45 +00:00
/************************************************ outer join **********************************************************/
outer_joined(A) ::=
table_reference(B) LEFT JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
2025-01-02 11:43:45 +00:00
outer_joined(A) ::=
table_reference(B) RIGHT JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
2025-01-02 11:43:45 +00:00
outer_joined(A) ::=
table_reference(B) FULL JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
outer_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) LEFT OUTER JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
outer_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) RIGHT OUTER JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
outer_joined(A) ::=
table_reference(B) FULL OUTER JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_OUTER, A, B, E, F, NULL, NULL); }
/************************************************ semi join ***********************************************************/
semi_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) LEFT SEMI JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_SEMI, A, B, E, F, NULL, NULL); }
semi_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) RIGHT SEMI JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_SEMI, A, B, E, F, NULL, NULL); }
/************************************************ ansi join ***********************************************************/
anti_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) LEFT ANTI JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_ANTI, A, B, E, F, NULL, NULL); }
anti_joined(A) ::=
2025-01-02 11:43:45 +00:00
table_reference(B) RIGHT ANTI JOIN table_reference(E) join_on_clause(F). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_ANTI, A, B, E, F, NULL, NULL); }
/************************************************ asof join ***********************************************************/
asof_joined(A) ::=
table_reference(B) LEFT ASOF JOIN table_reference(E) join_on_clause_opt(F)
2025-01-02 11:43:45 +00:00
jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_ASOF, A, B, E, F, NULL, H); }
asof_joined(A) ::=
table_reference(B) RIGHT ASOF JOIN table_reference(E) join_on_clause_opt(F)
2025-01-02 11:43:45 +00:00
jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_ASOF, A, B, E, F, NULL, H); }
/************************************************ window join *********************************************************/
win_joined(A) ::=
table_reference(B) LEFT WINDOW JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_WIN, A, B, E, F, G, H); }
win_joined(A) ::=
table_reference(B) RIGHT WINDOW JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_WIN, A, B, E, F, G, H); }
join_on_clause_opt(A) ::= . [ON] { A = NULL; }
2025-01-02 11:43:45 +00:00
join_on_clause_opt(A) ::= join_on_clause(B). { A = B; }
join_on_clause(A) ::= ON search_condition(B). { A = B; }
2022-03-10 07:36:06 +00:00
2025-01-02 11:43:45 +00:00
window_offset_clause(A) ::= WINDOW_OFFSET NK_LP window_offset_literal(B)
2023-11-28 06:35:11 +00:00
NK_COMMA window_offset_literal(C) NK_RP. { A = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
2023-11-27 12:01:00 +00:00
2023-11-28 06:35:11 +00:00
window_offset_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createTimeOffsetValueNode(pCxt, &B)); }
window_offset_literal(A) ::= NK_MINUS(B) NK_VARIABLE(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
2024-06-24 14:13:03 +00:00
A = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
2023-11-28 06:35:11 +00:00
}
2024-06-24 14:13:03 +00:00
jlimit_clause_opt(A) ::= . [JLIMIT] { A = NULL; }
2025-01-22 03:45:12 +00:00
jlimit_clause_opt(A) ::= JLIMIT unsigned_integer(B). { A = createLimitNode(pCxt, B, NULL); }
2022-03-10 07:36:06 +00:00
/************************************************ query_specification *************************************************/
query_specification(A) ::=
SELECT hint_list(M) set_quantifier_opt(B) tag_mode_opt(N) select_list(C) from_clause_opt(D)
2023-08-15 03:29:17 +00:00
where_clause_opt(E) partition_by_clause_opt(F) range_opt(J) every_opt(K)
2024-11-28 10:29:20 +00:00
interp_fill_opt(L) twindow_clause_opt(G) group_by_clause_opt(H) having_clause_opt(I). {
2023-08-11 09:39:41 +00:00
A = createSelectStmt(pCxt, B, C, D, M);
A = setSelectStmtTagMode(pCxt, A, N);
2022-03-10 07:36:06 +00:00
A = addWhereClause(pCxt, A, E);
A = addPartitionByClause(pCxt, A, F);
A = addWindowClauseClause(pCxt, A, G);
A = addGroupByClause(pCxt, A, H);
A = addHavingClause(pCxt, A, I);
2022-06-19 11:39:12 +00:00
A = addRangeClause(pCxt, A, J);
A = addEveryClause(pCxt, A, K);
A = addFillClause(pCxt, A, L);
2022-03-10 07:36:06 +00:00
}
2023-08-15 00:51:23 +00:00
%type hint_list { SNodeList* }
%destructor hint_list { nodesDestroyList($$); }
2023-08-16 06:28:39 +00:00
hint_list(A) ::= . { A = createHintNodeList(pCxt, NULL); }
hint_list(A) ::= NK_HINT(B). { A = createHintNodeList(pCxt, &B); }
2023-08-11 09:39:41 +00:00
2023-08-15 03:29:17 +00:00
%type tag_mode_opt { bool }
%destructor tag_mode_opt { }
tag_mode_opt(A) ::= . { A = false; }
tag_mode_opt(A) ::= TAGS. { A = true; }
2022-03-10 07:36:06 +00:00
%type set_quantifier_opt { bool }
%destructor set_quantifier_opt { }
set_quantifier_opt(A) ::= . { A = false; }
set_quantifier_opt(A) ::= DISTINCT. { A = true; }
set_quantifier_opt(A) ::= ALL. { A = false; }
%type select_list { SNodeList* }
%destructor select_list { nodesDestroyList($$); }
2022-06-30 07:04:54 +00:00
select_list(A) ::= select_item(B). { A = createNodeList(pCxt, B); }
select_list(A) ::= select_list(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
2022-06-30 07:04:54 +00:00
select_item(A) ::= NK_STAR(B). { A = createColumnNode(pCxt, NULL, &B); }
select_item(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); }
2022-03-10 07:36:06 +00:00
select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
where_clause_opt(A) ::= . { A = NULL; }
where_clause_opt(A) ::= WHERE search_condition(B). { A = B; }
%type partition_by_clause_opt { SNodeList* }
%destructor partition_by_clause_opt { nodesDestroyList($$); }
partition_by_clause_opt(A) ::= . { A = NULL; }
partition_by_clause_opt(A) ::= PARTITION BY partition_list(B). { A = B; }
%type partition_list { SNodeList* }
%destructor partition_list { nodesDestroyList($$); }
partition_list(A) ::= partition_item(B). { A = createNodeList(pCxt, B); }
partition_list(A) ::= partition_list(B) NK_COMMA partition_item(C). { A = addNodeToList(pCxt, B, C); }
partition_item(A) ::= expr_or_subquery(B). { A = releaseRawExprNode(pCxt, B); }
partition_item(A) ::= expr_or_subquery(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
partition_item(A) ::= expr_or_subquery(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
2022-03-10 07:36:06 +00:00
twindow_clause_opt(A) ::= . { A = NULL; }
twindow_clause_opt(A) ::= SESSION NK_LP column_reference(B) NK_COMMA
interval_sliding_duration_literal(C) NK_RP. { A = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
twindow_clause_opt(A) ::=
STATE_WINDOW NK_LP expr_or_subquery(B) extend(C) NK_RP true_for_opt(D). { A = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
twindow_clause_opt(A) ::= INTERVAL NK_LP interval_sliding_duration_literal(B)
NK_RP sliding_opt(C) fill_opt(D). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL, C, D); }
2022-03-10 07:36:06 +00:00
twindow_clause_opt(A) ::=
INTERVAL NK_LP interval_sliding_duration_literal(B) NK_COMMA
interval_sliding_duration_literal(C) NK_RP
2022-03-15 08:00:09 +00:00
sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), D, E); }
twindow_clause_opt(A) ::=
INTERVAL NK_LP interval_sliding_duration_literal(B) NK_COMMA
AUTO(C) NK_RP sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), createDurationValueNode(pCxt, &C), D, E); }
twindow_clause_opt(A) ::= EVENT_WINDOW START WITH search_condition(B)
END WITH search_condition(C) true_for_opt(D). { A = createEventWindowNode(pCxt, B, C, D); }
2025-06-03 10:31:49 +00:00
twindow_clause_opt(A) ::= COUNT_WINDOW NK_LP count_window_args(B) NK_RP. { A = createCountWindowNodeFromArgs(pCxt, B); }
2024-10-15 02:00:38 +00:00
twindow_clause_opt(A) ::=
ANOMALY_WINDOW NK_LP expr_or_subquery(B) NK_RP. { A = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
twindow_clause_opt(A) ::=
ANOMALY_WINDOW NK_LP expr_or_subquery(B) NK_COMMA NK_STRING(C) NK_RP. { A = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
2022-03-10 07:36:06 +00:00
extend(A) ::= . { A = NULL; }
extend(A) ::= NK_COMMA NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_INT, &B); }
2022-03-10 07:36:06 +00:00
sliding_opt(A) ::= . { A = NULL; }
sliding_opt(A) ::= SLIDING NK_LP interval_sliding_duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
interval_sliding_duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
interval_sliding_duration_literal(A) ::= NK_STRING(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
interval_sliding_duration_literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
2022-03-10 07:36:06 +00:00
2024-11-28 10:29:20 +00:00
interp_fill_opt(A) ::= . { A = NULL; }
interp_fill_opt(A) ::= fill_value(B). { A = B; }
interp_fill_opt(A) ::=
FILL NK_LP fill_position_mode_extension(B) NK_COMMA expression_list(C) NK_RP. { A = createFillNode(pCxt, B, createNodeListNode(pCxt, C)); }
interp_fill_opt(A) ::= FILL NK_LP interp_fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
2022-03-10 07:36:06 +00:00
fill_opt(A) ::= . { A = NULL; }
fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
2024-11-28 10:29:20 +00:00
fill_opt(A) ::= fill_value(B). { A = B; }
fill_value(A) ::= FILL NK_LP VALUE NK_COMMA expression_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, B)); }
fill_value(A) ::= FILL NK_LP VALUE_F NK_COMMA expression_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, B)); }
2022-03-10 07:36:06 +00:00
2025-06-03 10:31:49 +00:00
count_window_args(A) ::= NK_INTEGER(B). { A = createCountWindowArgs(pCxt, &B, NULL, NULL); }
count_window_args(A) ::= NK_INTEGER(B) NK_COMMA NK_INTEGER(C). { A = createCountWindowArgs(pCxt, &B, &C, NULL); }
count_window_args(A) ::= NK_INTEGER(B) NK_COMMA column_name_list(D). { A = createCountWindowArgs(pCxt, &B, NULL, D); }
count_window_args(A) ::= NK_INTEGER(B) NK_COMMA NK_INTEGER(C) NK_COMMA column_name_list(D). { A = createCountWindowArgs(pCxt, &B, &C, D); }
2022-03-10 07:36:06 +00:00
%type fill_mode { EFillMode }
%destructor fill_mode { }
fill_mode(A) ::= NONE. { A = FILL_MODE_NONE; }
fill_mode(A) ::= NULL. { A = FILL_MODE_NULL; }
2023-02-02 10:03:30 +00:00
fill_mode(A) ::= NULL_F. { A = FILL_MODE_NULL_F; }
2022-03-10 07:36:06 +00:00
fill_mode(A) ::= LINEAR. { A = FILL_MODE_LINEAR; }
2024-11-28 10:29:20 +00:00
fill_mode(A) ::= fill_position_mode(B). { A = B; }
%type fill_position_mode { EFillMode }
%destructor fill_position_mode { }
fill_position_mode(A) ::= PREV. { A = FILL_MODE_PREV; }
fill_position_mode(A) ::= NEXT. { A = FILL_MODE_NEXT; }
%type fill_position_mode_extension { EFillMode }
%destructor fill_position_mode_extension { }
fill_position_mode_extension(A) ::= fill_position_mode(B). { A = B; }
fill_position_mode_extension(A) ::= NEAR. { A = FILL_MODE_NEAR; }
%type interp_fill_mode { EFillMode }
%destructor interp_fill_mode { }
interp_fill_mode(A) ::= fill_mode(B). { A = B; }
interp_fill_mode(A) ::= NEAR. { A = FILL_MODE_NEAR; }
2022-03-10 07:36:06 +00:00
%type group_by_clause_opt { SNodeList* }
%destructor group_by_clause_opt { nodesDestroyList($$); }
group_by_clause_opt(A) ::= . { A = NULL; }
group_by_clause_opt(A) ::= GROUP BY group_by_list(B). { A = B; }
2022-06-19 11:39:12 +00:00
%type group_by_list { SNodeList* }
%destructor group_by_list { nodesDestroyList($$); }
2022-09-22 11:20:21 +00:00
group_by_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, B))); }
group_by_list(A) ::= group_by_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, C))); }
2022-03-10 07:36:06 +00:00
having_clause_opt(A) ::= . { A = NULL; }
having_clause_opt(A) ::= HAVING search_condition(B). { A = B; }
2022-06-19 11:39:12 +00:00
range_opt(A) ::= . { A = NULL; }
2022-09-22 11:20:21 +00:00
range_opt(A) ::=
RANGE NK_LP expr_or_subquery(B) NK_COMMA expr_or_subquery(C) NK_COMMA expr_or_subquery(D) NK_RP. {
A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), releaseRawExprNode(pCxt, D)); }
range_opt(A) ::=
RANGE NK_LP expr_or_subquery(B) NK_COMMA expr_or_subquery(C) NK_RP. { A = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), NULL); }
range_opt(A) ::=
RANGE NK_LP expr_or_subquery(B) NK_RP. { A = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, B)); }
2022-06-19 11:39:12 +00:00
every_opt(A) ::= . { A = NULL; }
every_opt(A) ::= EVERY NK_LP duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
true_for_opt(A) ::= . { A = NULL; }
true_for_opt(A) ::= TRUE_FOR NK_LP interval_sliding_duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
2022-03-10 07:36:06 +00:00
/************************************************ query_expression ****************************************************/
query_expression(A) ::= query_simple(B)
2022-09-16 07:53:27 +00:00
order_by_clause_opt(C) slimit_clause_opt(D) limit_clause_opt(E). {
2022-03-10 07:36:06 +00:00
A = addOrderByClause(pCxt, B, C);
A = addSlimitClause(pCxt, A, D);
A = addLimitClause(pCxt, A, E);
}
2022-09-16 07:53:27 +00:00
query_simple(A) ::= query_specification(B). { A = B; }
query_simple(A) ::= union_query_expression(B). { A = B; }
2022-03-10 07:36:06 +00:00
2022-09-16 07:53:27 +00:00
union_query_expression(A) ::=
query_simple_or_subquery(B) UNION ALL query_simple_or_subquery(C). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, B, C); }
union_query_expression(A) ::=
query_simple_or_subquery(B) UNION query_simple_or_subquery(C). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION, B, C); }
query_simple_or_subquery(A) ::= query_simple(B). { A = B; }
2022-09-16 11:54:46 +00:00
query_simple_or_subquery(A) ::= subquery(B). { A = releaseRawExprNode(pCxt, B); }
2022-09-16 07:53:27 +00:00
query_or_subquery(A) ::= query_expression(B). { A = B; }
2022-09-16 11:54:46 +00:00
query_or_subquery(A) ::= subquery(B). { A = releaseRawExprNode(pCxt, B); }
2022-03-10 07:36:06 +00:00
%type order_by_clause_opt { SNodeList* }
%destructor order_by_clause_opt { nodesDestroyList($$); }
order_by_clause_opt(A) ::= . { A = NULL; }
order_by_clause_opt(A) ::= ORDER BY sort_specification_list(B). { A = B; }
slimit_clause_opt(A) ::= . { A = NULL; }
2025-01-22 03:45:12 +00:00
slimit_clause_opt(A) ::= SLIMIT unsigned_integer(B). { A = createLimitNode(pCxt, B, NULL); }
slimit_clause_opt(A) ::= SLIMIT unsigned_integer(B) SOFFSET unsigned_integer(C). { A = createLimitNode(pCxt, B, C); }
slimit_clause_opt(A) ::= SLIMIT unsigned_integer(C) NK_COMMA unsigned_integer(B). { A = createLimitNode(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
limit_clause_opt(A) ::= . { A = NULL; }
2025-01-22 03:45:12 +00:00
limit_clause_opt(A) ::= LIMIT unsigned_integer(B). { A = createLimitNode(pCxt, B, NULL); }
limit_clause_opt(A) ::= LIMIT unsigned_integer(B) OFFSET unsigned_integer(C). { A = createLimitNode(pCxt, B, C); }
limit_clause_opt(A) ::= LIMIT unsigned_integer(C) NK_COMMA unsigned_integer(B). { A = createLimitNode(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
/************************************************ subquery ************************************************************/
subquery(A) ::= NK_LP(B) query_expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, C); }
2022-09-22 11:20:21 +00:00
subquery(A) ::= NK_LP(B) subquery(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); }
2022-03-10 07:36:06 +00:00
/************************************************ search_condition ****************************************************/
search_condition(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); }
/************************************************ sort_specification_list *********************************************/
%type sort_specification_list { SNodeList* }
%destructor sort_specification_list { nodesDestroyList($$); }
sort_specification_list(A) ::= sort_specification(B). { A = createNodeList(pCxt, B); }
sort_specification_list(A) ::=
sort_specification_list(B) NK_COMMA sort_specification(C). { A = addNodeToList(pCxt, B, C); }
sort_specification(A) ::=
2022-09-22 11:20:21 +00:00
expr_or_subquery(B) ordering_specification_opt(C) null_ordering_opt(D). { A = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, B), C, D); }
2022-03-10 07:36:06 +00:00
%type ordering_specification_opt EOrder
%destructor ordering_specification_opt { }
ordering_specification_opt(A) ::= . { A = ORDER_ASC; }
ordering_specification_opt(A) ::= ASC. { A = ORDER_ASC; }
ordering_specification_opt(A) ::= DESC. { A = ORDER_DESC; }
%type null_ordering_opt ENullOrder
%destructor null_ordering_opt { }
null_ordering_opt(A) ::= . { A = NULL_ORDER_DEFAULT; }
null_ordering_opt(A) ::= NULLS FIRST. { A = NULL_ORDER_FIRST; }
null_ordering_opt(A) ::= NULLS LAST. { A = NULL_ORDER_LAST; }
2022-04-22 10:23:37 +00:00
%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL
FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY MODULES NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE RESTRICT ROW SEMI STAR STATEMENT
STRICT STRING TIMES VALUES VARIABLE VIEW WAL.
2024-03-07 10:06:15 +00:00
column_options(A) ::= . { A = createDefaultColumnOptions(pCxt); }
column_options(A) ::= column_options(B) PRIMARY KEY. { A = setColumnOptionsPK(pCxt, B); }
column_options(A) ::= column_options(B) COMPOSITE KEY. { A = setColumnOptionsPK(pCxt, B); }
2024-12-29 07:14:51 +00:00
column_options(A) ::= column_options(B) NK_ID(C) NK_STRING(D). { A = setColumnOptions(pCxt, B, &C, &D); }
column_options(A) ::= column_options(B) FROM column_ref(C). { A = setColumnReference(pCxt, B, C); }
column_ref(A) ::= column_name_triplet(B). { A = createColumnRefNodeByName(pCxt, B); }
%type column_name_triplet { STokenTriplet* }
%destructor column_name_triplet { }
column_name_triplet(A) ::= NK_ID(B). { A = createTokenTriplet(pCxt, B); }
column_name_triplet(A) ::= column_name_triplet(B) NK_DOT NK_ID(C). { A = setColumnName(pCxt, B, C); }