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

2886 lines
264 KiB
Text
Raw Permalink 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); \
}
int32_t taosParseShortWeekday(const char* str);
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 ANY SOME EXISTS.
/************************************************ 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. { }
/************************************************ create/alter/drop user **********************************************/
%type option_value { SToken }
%destructor option_value { }
option_value(A) ::= DEFAULT(B). { A = B; }
option_value(A) ::= UNLIMITED(B). { A = B; }
option_value(A) ::= NK_INTEGER(B). { A = B; }
%type user_enabled { int8_t }
%destructor user_enabled { }
user_enabled(A) ::= ACCOUNT LOCK. { A = 0; }
user_enabled(A) ::= ACCOUNT UNLOCK. { A = 1; }
user_enabled(A) ::= ENABLE NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
%type user_option { SUserOptions* }
2026-01-06 05:36:36 +00:00
// NOTE: TOTPSEED is deprecated, please use CREATE/DROP TOTP_SECRET.
user_option(A) ::= TOTPSEED NK_STRING(B). { A = mergeUserOptions(pCxt, NULL, NULL); setUserOptionsTotpseed(pCxt, A, &B); }
user_option(A) ::= TOTPSEED NULL. { A = mergeUserOptions(pCxt, NULL, NULL); setUserOptionsTotpseed(pCxt, A, NULL); }
user_option(A) ::= user_enabled(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->enable = B; A->hasEnable = true; }
user_option(A) ::= SYSINFO NK_INTEGER(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->sysinfo = taosStr2Int8(B.z, NULL, 10); A->hasSysinfo = true; }
user_option(A) ::= IS_IMPORT NK_INTEGER(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->isImport = taosStr2Int8(B.z, NULL, 10); A->hasIsImport = true; }
user_option(A) ::= CREATEDB NK_INTEGER(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->createdb = taosStr2Int8(B.z, NULL, 10); A->hasCreatedb = true; }
user_option(A) ::= CHANGEPASS NK_INTEGER(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->changepass = taosStr2Int8(B.z, NULL, 10); A->hasChangepass = true; }
user_option(A) ::= SESSION_PER_USER option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->sessionPerUser = TSDB_USER_SESSION_PER_USER_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->sessionPerUser = -1;
} else {
A->sessionPerUser = taosStr2Int32(B.z, NULL, 10);
}
A->hasSessionPerUser = true;
}
user_option(A) ::= CONNECT_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->connectTime = TSDB_USER_CONNECT_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->connectTime = -1;
} else {
A->connectTime = taosStr2Int32(B.z, NULL, 10) * 60; // default unit is minute
}
A->hasConnectTime = true;
}
user_option(A) ::= CONNECT_IDLE_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->connectIdleTime = TSDB_USER_CONNECT_IDLE_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->connectIdleTime = -1;
} else {
A->connectIdleTime = taosStr2Int32(B.z, NULL, 10) * 60; // default unit is minute
}
A->hasConnectIdleTime = true;
}
user_option(A) ::= CALL_PER_SESSION option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->callPerSession = TSDB_USER_CALL_PER_SESSION_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->callPerSession = -1;
} else {
A->callPerSession = taosStr2Int32(B.z, NULL, 10);
}
A->hasCallPerSession = true;
}
user_option(A) ::= VNODE_PER_CALL option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->vnodePerCall = TSDB_USER_VNODE_PER_CALL_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->vnodePerCall = -1;
} else {
A->vnodePerCall = taosStr2Int32(B.z, NULL, 10);
}
A->hasVnodePerCall = true;
}
2025-12-30 06:06:30 +00:00
user_option(A) ::= FAILED_LOGIN_ATTEMPTS option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->failedLoginAttempts = TSDB_USER_FAILED_LOGIN_ATTEMPTS_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->failedLoginAttempts = -1;
} else {
A->failedLoginAttempts = taosStr2Int32(B.z, NULL, 10);
}
A->hasFailedLoginAttempts = true;
}
user_option(A) ::= PASSWORD_LIFE_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->passwordLifeTime = TSDB_USER_PASSWORD_LIFE_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->passwordLifeTime = -1;
} else {
A->passwordLifeTime = taosStr2Int32(B.z, NULL, 10) * 1440 * 60; // default unit is day
}
A->hasPasswordLifeTime = true;
}
user_option(A) ::= PASSWORD_REUSE_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->passwordReuseTime = TSDB_USER_PASSWORD_REUSE_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_OPTION_VALUE, "PASSWORD_REUSE_TIME");
} else {
A->passwordReuseTime = taosStr2Int32(B.z, NULL, 10) * 1440 * 60; // default unit is day
}
A->hasPasswordReuseTime = true;
}
user_option(A) ::= PASSWORD_REUSE_MAX option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->passwordReuseMax = TSDB_USER_PASSWORD_REUSE_MAX_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_OPTION_VALUE, "PASSWORD_REUSE_MAX");
} else {
A->passwordReuseMax = taosStr2Int32(B.z, NULL, 10);
}
A->hasPasswordReuseMax = true;
}
user_option(A) ::= PASSWORD_LOCK_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->passwordLockTime = TSDB_USER_PASSWORD_LOCK_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->passwordLockTime = -1;
} else {
A->passwordLockTime = taosStr2Int32(B.z, NULL, 10) * 60; // default unit is minute
}
A->hasPasswordLockTime = true;
}
user_option(A) ::= PASSWORD_GRACE_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->passwordGraceTime = TSDB_USER_PASSWORD_GRACE_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->passwordGraceTime = -1;
} else {
A->passwordGraceTime = taosStr2Int32(B.z, NULL, 10) * 1440 * 60; // default unit is day
}
A->hasPasswordGraceTime = true;
}
user_option(A) ::= INACTIVE_ACCOUNT_TIME option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->inactiveAccountTime = TSDB_USER_INACTIVE_ACCOUNT_TIME_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->inactiveAccountTime = -1;
} else {
A->inactiveAccountTime = taosStr2Int32(B.z, NULL, 10) * 1440 * 60; // default unit is day
}
A->hasInactiveAccountTime = true;
}
user_option(A) ::= ALLOW_TOKEN_NUM option_value(B). {
A = mergeUserOptions(pCxt, NULL, NULL);
if (B.type == TK_DEFAULT) {
A->allowTokenNum = TSDB_USER_ALLOW_TOKEN_NUM_DEFAULT;
} else if (B.type == TK_UNLIMITED) {
A->allowTokenNum = -1;
} else {
A->allowTokenNum = taosStr2Int32(B.z, NULL, 10);
}
A->hasAllowTokenNum = true;
}
%type ip_range_list { SNodeList* }
%destructor ip_range_list { nodesDestroyList($$); }
ip_range_list(A) ::= NK_STRING(B). { A = createNodeList(pCxt, (SNode*)parseIpRange(pCxt, &B)); }
ip_range_list(A) ::= ip_range_list(B) NK_COMMA NK_STRING(C). { A = addNodeToList(pCxt, B, (SNode*)parseIpRange(pCxt, &C)); }
%type datetime_range_list { SNodeList* }
%destructor datetime_range_list { nodesDestroyList($$); }
datetime_range_list(A) ::= NK_STRING(B). { A = createNodeList(pCxt, (SNode*)parseDateTimeRange(pCxt, &B)); }
datetime_range_list(A) ::= datetime_range_list(B) NK_COMMA NK_STRING(C). { A = addNodeToList(pCxt, B, (SNode*)parseDateTimeRange(pCxt, &C)); }
%type create_user_option { SUserOptions* }
create_user_option(A) ::= HOST ip_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pIpRanges = B; }
create_user_option(A) ::= NOT_ALLOW_HOST ip_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SIpRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pIpRanges = B;
}
create_user_option(A) ::= ALLOW_DATETIME datetime_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pTimeRanges = B; }
create_user_option(A) ::= NOT_ALLOW_DATETIME datetime_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SDateTimeRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pTimeRanges = B;
}
create_user_option(A) ::= SECURITY_LEVEL integer_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pSecurityLevels = B; }
%type create_user_options { SUserOptions* }
create_user_options(A) ::= user_option(B). { A = B; }
create_user_options(A) ::= create_user_option(B). { A = B; }
create_user_options(A) ::= create_user_options(B) user_option(C). { A = mergeUserOptions(pCxt, B, C); }
create_user_options(A) ::= create_user_options(B) create_user_option(C). { A = mergeUserOptions(pCxt, B, C); }
%type create_user_options_opt { SUserOptions* }
create_user_options_opt(A) ::= . { A = NULL; }
create_user_options_opt(A) ::= create_user_options(B). { A = B; }
%type alter_user_option { SUserOptions* }
alter_user_option(A) ::= PASS NK_STRING(B). { A = mergeUserOptions(pCxt, NULL, NULL); setUserOptionsPassword(pCxt, A, &B); }
alter_user_option(A) ::= ADD HOST ip_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pIpRanges = B; }
alter_user_option(A) ::= ADD NOT_ALLOW_HOST ip_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SIpRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pIpRanges = B;
}
alter_user_option(A) ::= DROP HOST ip_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pDropIpRanges = B; }
alter_user_option(A) ::= DROP NOT_ALLOW_HOST ip_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SIpRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pDropIpRanges = B;
}
alter_user_option(A) ::= ADD ALLOW_DATETIME datetime_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pTimeRanges = B; }
alter_user_option(A) ::= ADD NOT_ALLOW_DATETIME datetime_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SDateTimeRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pTimeRanges = B;
}
alter_user_option(A) ::= DROP ALLOW_DATETIME datetime_range_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pDropTimeRanges = B; }
alter_user_option(A) ::= DROP NOT_ALLOW_DATETIME datetime_range_list(B). {
SNode* pNode = NULL;
FOREACH(pNode, B) {
((SDateTimeRangeNode*)pNode)->range.neg = true;
}
A = mergeUserOptions(pCxt, NULL, NULL);
A->pDropTimeRanges = B;
}
alter_user_option(A) ::= SECURITY_LEVEL integer_list(B). { A = mergeUserOptions(pCxt, NULL, NULL); A->pSecurityLevels = B; }
%type alter_user_options { SUserOptions* }
alter_user_options(A) ::= user_option(B). { A = B; }
alter_user_options(A) ::= alter_user_option(B). { A = B; }
alter_user_options(A) ::= alter_user_options(B) user_option(C). { A = mergeUserOptions(pCxt, B, C); }
alter_user_options(A) ::= alter_user_options(B) alter_user_option(C). { A = mergeUserOptions(pCxt, B, C); }
cmd ::= CREATE USER not_exists_opt(A) user_name(B) PASS NK_STRING(C) create_user_options_opt(D). {
D = mergeUserOptions(pCxt, D, NULL);
setUserOptionsPassword(pCxt, D, &C);
pCxt->pRootNode = createCreateUserStmt(pCxt, &B, D, A);
}
cmd ::= ALTER USER user_name(A) alter_user_options(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, B); }
2025-12-30 06:18:44 +00:00
cmd ::= DROP USER exists_opt(A) user_name(B). { pCxt->pRootNode = createDropUserStmt(pCxt, &B, A); }
/************************************************ create/alter/drop token **********************************************/
%type token_option { STokenOptions* }
token_option(A) ::= PROVIDER NK_STRING(B). { A = mergeTokenOptions(pCxt, NULL, NULL); setTokenOptionsProvider(pCxt, A, &B); }
token_option(A) ::= ENABLE NK_INTEGER(B). { A = mergeTokenOptions(pCxt, NULL, NULL); A->enable = taosStr2Int8(B.z, NULL, 10); A->hasEnable = true; }
token_option(A) ::= TTL NK_INTEGER(B). { A = mergeTokenOptions(pCxt, NULL, NULL); A->ttl = taosStr2Int32(B.z, NULL, 10) * 86400; A->hasTtl = true; }
token_option(A) ::= EXTRA_INFO NK_STRING(B). { A = mergeTokenOptions(pCxt, NULL, NULL); setTokenOptionsExtraInfo(pCxt, A, &B); }
%type token_options { STokenOptions* }
token_options(A) ::= token_option(B). { A = B; }
token_options(A) ::= token_options(B) token_option(C). { A = mergeTokenOptions(pCxt, B, C); }
%type token_options_opt { STokenOptions* }
token_options_opt(A) ::= . { A = NULL; }
token_options_opt(A) ::= token_options(B). { A = B; }
cmd ::= CREATE TOKEN not_exists_opt(A) NK_ID(B) FROM USER user_name(C) token_options_opt(D). {
pCxt->pRootNode = createCreateTokenStmt(pCxt, &B, &C, D, A);
}
cmd ::= ALTER TOKEN NK_ID(A) token_options(B). {
pCxt->pRootNode = createAlterTokenStmt(pCxt, &A, B);
}
2025-12-30 06:18:44 +00:00
cmd ::= DROP TOKEN exists_opt(A) NK_ID(B). {
pCxt->pRootNode = createDropTokenStmt(pCxt, &B, A);
}
/************************************************ create/drop totpsecret **********************************************/
cmd ::= CREATE TOTP_SECRET FOR USER user_name(A). {
pCxt->pRootNode = createCreateTotpSecretStmt(pCxt, &A);
}
cmd ::= DROP TOTP_SECRET FROM USER user_name(A). {
pCxt->pRootNode = createDropTotpSecretStmt(pCxt, &A);
}
2022-06-22 08:35:14 +00:00
2025-12-29 11:27:11 +00:00
/************************************************ create/drop role **********************************************/
cmd ::= CREATE ROLE not_exists_opt(A) role_name(B). { pCxt->pRootNode = createCreateRoleStmt(pCxt, A, &B); }
cmd ::= DROP ROLE exists_opt(A) role_name(B). { pCxt->pRootNode = createDropRoleStmt(pCxt, A, &B); }
cmd ::= LOCK ROLE role_name(A). {
2025-12-29 11:27:11 +00:00
SToken t = {.n = 1, .z = "1", .type = TK_STRING };
pCxt->pRootNode = createAlterRoleStmt(pCxt, &A, TSDB_ALTER_ROLE_LOCK, &t);
2025-12-29 11:27:11 +00:00
}
cmd ::= UNLOCK ROLE role_name(A). {
2025-12-29 11:27:11 +00:00
SToken t = {.n = 1, .z = "0", .type = TK_STRING };
pCxt->pRootNode = createAlterRoleStmt(pCxt, &A,TSDB_ALTER_ROLE_LOCK, &t);
2025-12-29 11:27:11 +00:00
}
cmd ::= GRANT ROLE role_name(A) TO role_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, &A, NULL, &C, NULL, TSDB_ALTER_ROLE_ROLE); }
cmd ::= REVOKE ROLE role_name(A) FROM role_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, &A, NULL, &C, NULL, TSDB_ALTER_ROLE_ROLE); }
/************************************************ grant/revoke ********************************************************/
2025-12-29 11:27:11 +00:00
cmd ::= GRANT privileges(A) priv_level_opt(B) with_clause_opt(D) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, &A, &B, &C, D, TSDB_ALTER_ROLE_PRIVILEGES); }
cmd ::= REVOKE privileges(A) priv_level_opt(B) with_clause_opt(D) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, &A, &B, &C, D, TSDB_ALTER_ROLE_PRIVILEGES); }
%type privileges { SPrivSetArgs }
%destructor privileges {
if ($$.selectCols != NULL) {
nodesDestroyList($$.selectCols);
}
if ($$.insertCols != NULL) {
nodesDestroyList($$.insertCols);
}
if ($$.updateCols != NULL) {
nodesDestroyList($$.updateCols);
}
2025-12-29 11:27:11 +00:00
}
privileges(A) ::= priv_type_list(B). { A = B; }
2025-12-29 11:27:11 +00:00
%type priv_type_list { SPrivSetArgs }
%destructor priv_type_list {
if ($$.selectCols != NULL) {
nodesDestroyList($$.selectCols);
}
if ($$.insertCols != NULL) {
nodesDestroyList($$.insertCols);
}
if ($$.updateCols != NULL) {
nodesDestroyList($$.updateCols);
}
}
priv_type_list(A) ::= priv_type(B). { A = B; }
2025-12-29 11:27:11 +00:00
priv_type_list(A) ::= priv_type_list(B) NK_COMMA priv_type(C). { A = privArgsAdd(pCxt, B, C); }
%type priv_type { SPrivSetArgs }
%destructor priv_type {
if ($$.selectCols != NULL) {
nodesDestroyList($$.selectCols);
}
if ($$.insertCols != NULL) {
nodesDestroyList($$.insertCols);
}
if ($$.updateCols != NULL) {
nodesDestroyList($$.updateCols);
}
}
priv_type(A) ::= ALL. { A = PRIV_SET_TYPE(PRIV_CM_ALL); }
priv_type(A) ::= ALL PRIVILEGES. { A = PRIV_SET_TYPE(PRIV_CM_ALL); }
priv_type(A) ::= ALTER. { A = PRIV_SET_TYPE(PRIV_CM_ALTER); }
priv_type(A) ::= DROP. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
priv_type(A) ::= SHOW CREATE. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= START. { A = PRIV_SET_TYPE(PRIV_CM_START); }
priv_type(A) ::= STOP. { A = PRIV_SET_TYPE(PRIV_CM_STOP); }
priv_type(A) ::= KILL. { A = PRIV_SET_TYPE(PRIV_CM_KILL); }
priv_type(A) ::= RECALCULATE. { A = PRIV_SET_TYPE(PRIV_CM_RECALC); }
priv_type(A) ::= SUBSCRIBE. { A = PRIV_SET_TYPE(PRIV_CM_SUBSCRIBE); }
priv_type(A) ::= READ. { A = PRIV_SET_TYPE(PRIV_CM_READ); }
priv_type(A) ::= WRITE. { A = PRIV_SET_TYPE(PRIV_CM_WRITE); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= CREATE DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_CREATE); }
priv_type(A) ::= USE DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_USE); }
priv_type(A) ::= FLUSH DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_FLUSH); }
priv_type(A) ::= COMPACT DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_COMPACT); }
priv_type(A) ::= TRIM DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_TRIM); }
priv_type(A) ::= ROLLUP DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_ROLLUP); }
priv_type(A) ::= SCAN DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_SCAN); }
priv_type(A) ::= SSMIGRATE DATABASE. { A = PRIV_SET_TYPE(PRIV_DB_SSMIGRATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= SHOW DATABASES. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= USE. { A = PRIV_SET_TYPE(PRIV_DB_USE); }
priv_type(A) ::= FLUSH. { A = PRIV_SET_TYPE(PRIV_DB_FLUSH); }
priv_type(A) ::= COMPACT. { A = PRIV_SET_TYPE(PRIV_DB_COMPACT); }
priv_type(A) ::= TRIM. { A = PRIV_SET_TYPE(PRIV_DB_TRIM); }
priv_type(A) ::= ROLLUP. { A = PRIV_SET_TYPE(PRIV_DB_ROLLUP); }
priv_type(A) ::= SCAN. { A = PRIV_SET_TYPE(PRIV_DB_SCAN); }
priv_type(A) ::= SSMIGRATE. { A = PRIV_SET_TYPE(PRIV_DB_SSMIGRATE); }
priv_type(A) ::= SHOW VNODES. { A = PRIV_SET_TYPE(PRIV_SHOW_VNODES); }
priv_type(A) ::= SHOW VGROUPS. { A = PRIV_SET_TYPE(PRIV_SHOW_VGROUPS); }
priv_type(A) ::= SHOW COMPACTS. { A = PRIV_SET_TYPE(PRIV_SHOW_COMPACTS); }
priv_type(A) ::= SHOW RETENTIONS. { A = PRIV_SET_TYPE(PRIV_SHOW_RETENTIONS); }
priv_type(A) ::= SHOW SCANS. { A = PRIV_SET_TYPE(PRIV_SHOW_SCANS); }
priv_type(A) ::= SHOW SSMIGRATES. { A = PRIV_SET_TYPE(PRIV_SHOW_SSMIGRATES); }
priv_type(A) ::= CREATE TABLE. { A = PRIV_SET_TYPE(PRIV_TBL_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= ALTER TABLE. { A = PRIV_SET_TYPE(PRIV_CM_ALTER); }
priv_type(A) ::= DROP TABLE. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW CREATE TABLE. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW TABLES. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= priv_type_tbl_dml(B). { A = B; }
priv_type(A) ::= CREATE FUNCTION. { A = PRIV_SET_TYPE(PRIV_FUNC_CREATE); }
priv_type(A) ::= DROP FUNCTION. { A = PRIV_SET_TYPE(PRIV_FUNC_DROP); }
priv_type(A) ::= SHOW FUNCTIONS. { A = PRIV_SET_TYPE(PRIV_FUNC_SHOW); }
priv_type(A) ::= CREATE INDEX. { A = PRIV_SET_TYPE(PRIV_IDX_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= DROP INDEX. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW CREATE INDEX. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW INDEXES. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= CREATE VIEW. { A = PRIV_SET_TYPE(PRIV_VIEW_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= ALTER VIEW. { A = PRIV_SET_TYPE(PRIV_CM_ALTER); }
priv_type(A) ::= DROP VIEW. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW CREATE VIEW. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW VIEWS. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= SELECT VIEW. { A = PRIV_SET_TYPE(PRIV_VIEW_SELECT); }
priv_type(A) ::= CREATE RSMA. { A = PRIV_SET_TYPE(PRIV_RSMA_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= DROP RSMA. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW CREATE RSMA. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW RSMAS. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= CREATE TSMA. { A = PRIV_SET_TYPE(PRIV_TSMA_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= DROP TSMA. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW CREATE TSMA. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW TSMAS. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= CREATE MOUNT. { A = PRIV_SET_TYPE(PRIV_MOUNT_CREATE); }
priv_type(A) ::= DROP MOUNT. { A = PRIV_SET_TYPE(PRIV_MOUNT_DROP); }
priv_type(A) ::= SHOW MOUNTS. { A = PRIV_SET_TYPE(PRIV_MOUNT_SHOW); }
priv_type(A) ::= ALTER PASS. { A = PRIV_SET_TYPE(PRIV_PASS_ALTER); }
priv_type(A) ::= CREATE ROLE. { A = PRIV_SET_TYPE(PRIV_ROLE_CREATE); }
priv_type(A) ::= DROP ROLE. { A = PRIV_SET_TYPE(PRIV_ROLE_DROP); }
priv_type(A) ::= UNLOCK ROLE. { A = PRIV_SET_TYPE(PRIV_ROLE_UNLOCK); }
priv_type(A) ::= LOCK ROLE. { A = PRIV_SET_TYPE(PRIV_ROLE_LOCK); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= SHOW ROLES. { A = PRIV_SET_TYPE(PRIV_ROLE_SHOW); }
priv_type(A) ::= CREATE USER. { A = PRIV_SET_TYPE(PRIV_USER_CREATE); }
priv_type(A) ::= DROP USER. { A = PRIV_SET_TYPE(PRIV_USER_DROP); }
priv_type(A) ::= UNLOCK USER. { A = PRIV_SET_TYPE(PRIV_USER_UNLOCK); }
priv_type(A) ::= LOCK USER. { A = PRIV_SET_TYPE(PRIV_USER_LOCK); }
priv_type(A) ::= SHOW USERS. { A = PRIV_SET_TYPE(PRIV_USER_SHOW); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= ALTER USER. { A = PRIV_SET_TYPE(PRIV_USER_ALTER); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= CREATE TOKEN. { A = PRIV_SET_TYPE(PRIV_TOKEN_CREATE); }
priv_type(A) ::= DROP TOKEN. { A = PRIV_SET_TYPE(PRIV_TOKEN_DROP); }
priv_type(A) ::= ALTER TOKEN. { A = PRIV_SET_TYPE(PRIV_TOKEN_ALTER); }
priv_type(A) ::= SHOW TOKENS. { A = PRIV_SET_TYPE(PRIV_TOKEN_SHOW); }
priv_type(A) ::= UPDATE KEY. { A = PRIV_SET_TYPE(PRIV_KEY_UPDATE); }
priv_type(A) ::= CREATE TOTP_SECRET. { A = PRIV_SET_TYPE(PRIV_TOTP_CREATE); }
priv_type(A) ::= DROP TOTP_SECRET. { A = PRIV_SET_TYPE(PRIV_TOTP_DROP); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= GRANT PRIVILEGE. { A = PRIV_SET_TYPE(PRIV_GRANT_PRIVILEGE); }
priv_type(A) ::= REVOKE PRIVILEGE. { A = PRIV_SET_TYPE(PRIV_REVOKE_PRIVILEGE); }
priv_type(A) ::= SHOW PRIVILEGES. { A = PRIV_SET_TYPE(PRIV_SHOW_PRIVILEGES); }
priv_type(A) ::= CREATE NODE. { A = PRIV_SET_TYPE(PRIV_NODE_CREATE); }
priv_type(A) ::= ALTER NODE. { A = PRIV_SET_TYPE(PRIV_NODE_ALTER); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= DROP NODE. { A = PRIV_SET_TYPE(PRIV_NODE_DROP); }
priv_type(A) ::= SHOW NODES. { A = PRIV_SET_TYPE(PRIV_NODES_SHOW); }
priv_type(A) ::= CREATE TOPIC. { A = PRIV_SET_TYPE(PRIV_TOPIC_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= DROP TOPIC. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SUBSCRIBE TOPIC. { A = PRIV_SET_TYPE(PRIV_CM_SUBSCRIBE); }
priv_type(A) ::= SHOW CREATE TOPIC. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= SHOW TOPICS. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= SHOW CONSUMERS. { A = PRIV_SET_TYPE(PRIV_CONSUMER_SHOW); }
priv_type(A) ::= SHOW SUBSCRIPTIONS. { A = PRIV_SET_TYPE(PRIV_SUBSCRIPTION_SHOW); }
priv_type(A) ::= CREATE STREAM. { A = PRIV_SET_TYPE(PRIV_STREAM_CREATE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= DROP STREAM. { A = PRIV_SET_TYPE(PRIV_CM_DROP); }
priv_type(A) ::= SHOW STREAMS. { A = PRIV_SET_TYPE(PRIV_CM_SHOW); }
priv_type(A) ::= SHOW CREATE STREAM. { A = PRIV_SET_TYPE(PRIV_CM_SHOW_CREATE); }
priv_type(A) ::= START STREAM. { A = PRIV_SET_TYPE(PRIV_CM_START); }
priv_type(A) ::= STOP STREAMS. { A = PRIV_SET_TYPE(PRIV_CM_STOP); }
priv_type(A) ::= RECALCULATE STREAMS. { A = PRIV_SET_TYPE(PRIV_CM_RECALC); }
priv_type(A) ::= SHOW TRANSACTIONS. { A = PRIV_SET_TYPE(PRIV_TRANS_SHOW); }
priv_type(A) ::= KILL TRANSACTION. { A = PRIV_SET_TYPE(PRIV_TRANS_KILL); }
priv_type(A) ::= SHOW CONNECTIONS. { A = PRIV_SET_TYPE(PRIV_CONN_SHOW); }
priv_type(A) ::= KILL CONNECTION. { A = PRIV_SET_TYPE(PRIV_CONN_KILL); }
2025-12-29 11:27:11 +00:00
priv_type(A) ::= SHOW QUERIES. { A = PRIV_SET_TYPE(PRIV_QUERY_SHOW); }
priv_type(A) ::= KILL QUERY. { A = PRIV_SET_TYPE(PRIV_QUERY_KILL); }
priv_type(A) ::= SHOW GRANTS. { A = PRIV_SET_TYPE(PRIV_GRANTS_SHOW); }
priv_type(A) ::= SHOW CLUSTER. { A = PRIV_SET_TYPE(PRIV_CLUSTER_SHOW); }
priv_type(A) ::= SHOW APPS. { A = PRIV_SET_TYPE(PRIV_APPS_SHOW); }
%type create_xnode_obj {EPrivType}
priv_type(A) ::= CREATE XNODE create_xnode_obj(B). {
memset(&A, 0, sizeof(A));
A.nPrivArgs = 1;
A.privSet.set[PRIV_GROUP(B)] = 1ULL << PRIV_OFFSET(B);
}
create_xnode_obj(A) ::= NK_ID(B). { A = xnodeResourceToPrivType(pCxt, &B, PRIV_XNODE_TASK_CREATE); }
2025-12-29 11:27:11 +00:00
%type priv_type_tbl_dml { SPrivSetArgs }
%destructor priv_type_tbl_dml {
if ($$.selectCols != NULL) {
nodesDestroyList($$.selectCols);
}
if ($$.insertCols != NULL) {
nodesDestroyList($$.insertCols);
}
if ($$.updateCols != NULL) {
nodesDestroyList($$.updateCols);
}
}
priv_type_tbl_dml(A) ::= SELECT TABLE. { A = PRIV_SET_TYPE(PRIV_TBL_SELECT); }
priv_type_tbl_dml(A) ::= SELECT specific_cols_with_mask_opt(B). { A = PRIV_SET_COLS(PRIV_TBL_SELECT, B, NULL, NULL); }
priv_type_tbl_dml(A) ::= INSERT TABLE. { A = PRIV_SET_TYPE(PRIV_TBL_INSERT); }
priv_type_tbl_dml(A) ::= INSERT specific_cols_opt(B). { A = PRIV_SET_COLS(PRIV_TBL_INSERT, NULL, B, NULL); }
2026-01-28 11:06:16 +00:00
/*priv_type_tbl_dml(A) ::= UPDATE TABLE. { A = PRIV_SET_TYPE(PRIV_TBL_UPDATE); }
2025-12-29 11:27:11 +00:00
priv_type_tbl_dml(A) ::= UPDATE specific_cols_opt(B). { A = PRIV_SET_COLS(PRIV_TBL_UPDATE, NULL, NULL, B); }*/
priv_type_tbl_dml(A) ::= DELETE TABLE. { A = PRIV_SET_TYPE(PRIV_TBL_DELETE); }
priv_type_tbl_dml(A) ::= DELETE. { A = PRIV_SET_TYPE(PRIV_TBL_DELETE); }
2026-01-28 11:06:16 +00:00
priv_type(A) ::= ALTER priv_id(B) priv_id(C). { A = privArgsSet(pCxt, 0, &B, &C); }
priv_type(A) ::= READ priv_id(B) priv_id(C). { A = privArgsSet(pCxt, 1, &B, &C); }
priv_type(A) ::= SHOW priv_id(B) priv_id(C). { A = privArgsSet(pCxt, 2, &B, &C); }
priv_type(A) ::= SET USER priv_id(B) priv_id(C). { A = privArgsSet(pCxt, 3, &B, &C); }
priv_type(A) ::= SHOW USERS priv_id(B) priv_id(C). { A = privArgsSet(pCxt, 4, &B, &C); }
2026-01-28 11:06:16 +00:00
%type priv_id { SToken }
%destructor priv_id { }
priv_id(A) ::= NK_ID(B). { A = B; }
priv_id(A) ::= SYSTEM(B). { A = B; }
priv_id(A) ::= VARIABLES(B). { A = B; }
priv_id(A) ::= PASS(B). { A = B; }
2025-12-29 11:27:11 +00:00
%type priv_level_opt { SPrivLevelArgs }
%destructor priv_level_opt {
2025-12-29 11:27:11 +00:00
if ($$.cols != NULL) {
nodesDestroyList($$.cols);
}
}
priv_level_opt(A) ::= . {
A.first = nil_token; A.second = nil_token;
A.objType = PRIV_OBJ_CLUSTER; A.cols = NULL;
}
priv_level_opt(A) ::= ON priv_level(B). { A = B; A.objType = PRIV_OBJ_NONE; }
2025-12-29 11:27:11 +00:00
priv_level_opt(A) ::= ON DATABASE priv_level(B). { A = B; A.objType = PRIV_OBJ_DB; }
priv_level_opt(A) ::= ON TABLE priv_level(B). { A = B; A.objType = PRIV_OBJ_TBL; }
priv_level_opt(A) ::= ON VIEW priv_level(B). { A = B; A.objType = PRIV_OBJ_VIEW; }
priv_level_opt(A) ::= ON INDEX priv_level(B). { A = B; A.objType = PRIV_OBJ_IDX; }
priv_level_opt(A) ::= ON TOPIC priv_level(B). { A = B; A.objType = PRIV_OBJ_TOPIC; }
priv_level_opt(A) ::= ON STREAM priv_level(B). { A = B; A.objType = PRIV_OBJ_STREAM; }
priv_level_opt(A) ::= ON RSMA priv_level(B). { A = B; A.objType = PRIV_OBJ_RSMA; }
priv_level_opt(A) ::= ON TSMA priv_level(B). { A = B; A.objType = PRIV_OBJ_TSMA; }
priv_level_opt(A) ::= ON XNODE xnode_task_level(B). { A = B; A.objType = PRIV_OBJ_XTASK; }
2025-12-29 11:27:11 +00:00
%type priv_level { SPrivLevelArgs }
%destructor priv_level { }
2025-12-29 11:27:11 +00:00
priv_level(A) ::= NK_STAR(B). { A.first = B; A.second = nil_token; A.cols = NULL; }
priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; A.cols = NULL; }
priv_level(A) ::= db_name(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; A.cols = NULL; }
priv_level(A) ::= db_name(B) NK_DOT table_name(C). { A.first = B; A.second = C; A.cols = NULL; }
priv_level(A) ::= db_name(B). { A.first = B; A.second = nil_token; A.cols = NULL; }
2023-03-28 10:43:58 +00:00
%type xnode_task_level { SPrivLevelArgs }
%destructor xnode_task_level { }
xnode_task_level(A) ::= NK_ID(B) priv_level(C). { A = xnodeTaskObjPrivLevelSet(pCxt, &B, C); }
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); }
2025-12-05 05:26:28 +00:00
cmd ::= CREATE ENCRYPT_ALGR NK_STRING(A) ALGR_NAME NK_STRING(B) DESC NK_STRING(C) ALGR_TYPE NK_STRING(D) OSSL_ALGR_NAME NK_STRING(E). { pCxt->pRootNode = createCreateAlgrStmt(pCxt, &A, &B, &C, &D, &E); }
cmd ::= DROP ENCRYPT_ALGR NK_STRING(A). { pCxt->pRootNode = createDropEncryptAlgrStmt(pCxt, &A); }
/************************************************ alter encrypt key *********************************************/
cmd ::= ALTER SYSTEM SET SVR_KEY NK_STRING(A). { pCxt->pRootNode = createAlterEncryptKeyStmt(pCxt, 0, &A); }
cmd ::= ALTER SYSTEM SET DB_KEY NK_STRING(A). { pCxt->pRootNode = createAlterEncryptKeyStmt(pCxt, 1, &A); }
cmd ::= ALTER SYSTEM SET KEY_EXPIRATION NK_INTEGER(A) DAYS STRATEGY NK_STRING(B). { pCxt->pRootNode = createAlterKeyExpirationStmt(pCxt, &A, &B); }
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); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
/************************************************ create drop update xnode ***************************************/
%type xnode_endpoint { SToken }
%destructor xnode_endpoint { }
xnode_endpoint(A) ::= NK_STRING(B). { A = B; }
xnode_endpoint(A) ::= NK_INTEGER(B). { A = B; }
%destructor xnode_task_source { }
xnode_task_source(A) ::= NK_STRING(B). { A = createXnodeSourceAsDsn(pCxt, &B); }
xnode_task_source(A) ::= DATABASE db_name(B). { A = createXnodeSourceAsDatabase(pCxt, &B); }
xnode_task_source(A) ::= TOPIC topic_name(B). { A = createXnodeSourceAsTopic(pCxt, &B); }
xnode_task_sink(A) ::= NK_STRING(B). { A = createXnodeSinkAsDsn(pCxt, &B); }
xnode_task_sink(A) ::= DATABASE db_name(B). { A = createXnodeSinkAsDatabase(pCxt, &B); }
%type xnode_task_opt_v { SToken }
%destructor xnode_task_opt_v { }
xnode_task_opt_v(A) ::= NK_STRING(B). { A = B; }
xnode_task_opt_v(A) ::= NK_INTEGER(B). { A = B; }
xnode_task_options(A) ::= NK_ID(C) xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, NULL, &C, &D); }
xnode_task_options(A) ::= NK_ID(C) NK_EQ xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, NULL, &C, &D); }
xnode_task_options(A) ::= xnode_task_options(B) NK_ID(C) xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
xnode_task_options(A) ::= xnode_task_options(B) NK_ID(C) NK_EQ xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
xnode_task_options(A) ::= xnode_task_options(B) NK_COMMA NK_ID(C) xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_options(A) ::= xnode_task_options(B) NK_COMMA NK_ID(C) NK_EQ xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
xnode_task_options(A) ::= xnode_task_options(B) AND NK_ID(C) xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_options(A) ::= xnode_task_options(B) AND NK_ID(C) NK_EQ xnode_task_opt_v(D). { A = setXnodeTaskOption(pCxt, B, &C, &D); }
//xnode_task_options(A) ::= xnode_task_options(B) NK_COMMA NK_ID(C). { A = setXnodeTaskOption(pCxt, B, &C, NULL); }
//xnode_task_options(A) ::= xnode_task_options(B) AND NK_ID(C). { A = setXnodeTaskOption(pCxt, B, &C, NULL); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_options(A) ::= xnode_task_options(B) TRIGGER NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
xnode_task_options(A) ::= xnode_task_options(B) TRIGGER NK_EQ NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
xnode_task_options(A) ::= xnode_task_options(B) NK_COMMA TRIGGER NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_options(A) ::= xnode_task_options(B) NK_COMMA TRIGGER NK_EQ NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
xnode_task_options(A) ::= xnode_task_options(B) AND TRIGGER NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_options(A) ::= xnode_task_options(B) AND TRIGGER NK_EQ NK_STRING(D). { A = setXnodeTaskOption(pCxt, B, createTriggerToken(), &D); }
with_task_options_opt(A) ::= . { A = NULL; }
with_task_options_opt(A) ::= WITH xnode_task_options(B). { A = B; }
with_task_options_opt(A) ::= SET xnode_task_options(B). { A = B; }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
xnode_task_from_opt(A) ::= . { A = NULL; }
xnode_task_from_opt(A) ::= FROM xnode_task_source(B). { A = B; }
xnode_task_to_opt(A) ::= . { A = NULL; }
xnode_task_to_opt(A) ::= TO xnode_task_sink(B). { A = B; }
cmd ::= CREATE XNODE NK_STRING(A). { pCxt->pRootNode = createCreateXnodeStmt(pCxt, &A); }
cmd ::= CREATE XNODE NK_STRING(A) USER user_name(B) PASS NK_STRING(C). { pCxt->pRootNode = createCreateXnodeWithUserPassStmt(pCxt, &A, &B, &C); }
cmd ::= CREATE XNODE NK_STRING(A) TOKEN NK_STRING(B). { pCxt->pRootNode = createCreateXnodeWithTokenStmt(pCxt, &A, &B); }
// alter
cmd ::= ALTER XNODE SET TOKEN NK_STRING(B). { pCxt->pRootNode = createAlterXnodeStmt(pCxt, &B, NULL, NULL); }
cmd ::= ALTER XNODE SET USER user_name(B) PASS NK_STRING(C). { pCxt->pRootNode = createAlterXnodeStmt(pCxt, NULL, &B, &C); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
cmd ::= DROP XNODE xnode_endpoint(A) force_opt(B). { pCxt->pRootNode = createDropXnodeStmt(pCxt, &A, B); }
cmd ::= DROP XNODE FORCE xnode_endpoint(A). { pCxt->pRootNode = createDropXnodeStmt(pCxt, &A, true); }
cmd ::= DRAIN XNODE NK_INTEGER(A). { pCxt->pRootNode = createDrainXnodeStmt(pCxt, &A); }
%type xnode_resource_type { EXnodeResourceType }
%destructor xnode_resource_type { }
xnode_resource_type(A) ::= NK_ID(B). { A = setXnodeResourceType(pCxt, &B); }
/* create xnode agent 'a1' */
cmd ::= CREATE XNODE xnode_resource_type(A) NK_STRING(B) with_task_options_opt(E).
{ pCxt->pRootNode = createXnodeTaskWithOptions(pCxt, A, &B, NULL, NULL, E); }
/* create xnode task 't1' from 'mqtt://xxx' to database s1 with parser '{...}' */
cmd ::= CREATE XNODE xnode_resource_type(A) NK_STRING(B) FROM xnode_task_source(C) TO xnode_task_sink(D) with_task_options_opt(E).
{ pCxt->pRootNode = createXnodeTaskWithOptions(pCxt, A, &B, C, D, E); }
/* create xnode job on 1 with config '{"json":true}' */
cmd ::= CREATE XNODE xnode_resource_type(A) ON NK_INTEGER(B) with_task_options_opt(C).
{ pCxt->pRootNode = createXnodeTaskJobWithOptions(pCxt, A, &B, C); }
/*start xnode task 1; stop xnode task 1;*/
cmd ::= START XNODE xnode_resource_type(A) NK_INTEGER(B). { pCxt->pRootNode = createStartXnodeTaskStmt(pCxt, A, &B); }
cmd ::= START XNODE xnode_resource_type(A) NK_STRING(B). { pCxt->pRootNode = createStartXnodeTaskStmt(pCxt, A, &B); }
cmd ::= STOP XNODE xnode_resource_type(A) NK_INTEGER(B). { pCxt->pRootNode = createStopXnodeTaskStmt(pCxt, A, &B); }
cmd ::= STOP XNODE xnode_resource_type(A) NK_STRING(B). { pCxt->pRootNode = createStopXnodeTaskStmt(pCxt, A, &B); }
/* rebalance xnode job 1 with xnode_id 3;*/
cmd ::= REBALANCE XNODE xnode_resource_type(A) NK_INTEGER(B) with_task_options_opt(C).
{ pCxt->pRootNode = createRebalanceXnodeJobStmt(pCxt, A, &B, C); }
cmd ::= REBALANCE XNODE xnode_resource_type(A) where_clause_opt(B).
{ pCxt->pRootNode = createRebalanceXnodeJobWhereStmt(pCxt, A, B); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
/* alter xnode task 't1' from 'mqtt://xxx' to database s1 with parser '{...}' */
cmd ::= ALTER XNODE xnode_resource_type(A) NK_INTEGER(B) xnode_task_from_opt(C) xnode_task_to_opt(D) with_task_options_opt(E).
{ pCxt->pRootNode = alterXnodeTaskWithOptions(pCxt, A, &B, C, D, E); }
cmd ::= ALTER XNODE xnode_resource_type(A) NK_STRING(B) xnode_task_from_opt(C) xnode_task_to_opt(D) with_task_options_opt(E).
{ pCxt->pRootNode = alterXnodeTaskWithOptions(pCxt, A, &B, C, D, E); }
/* drop xnode agent 'a1'; drop xnode task 't1'; drop xnode job 1; drop xnode task 1; */
cmd ::= DROP XNODE xnode_resource_type(A) NK_STRING(B). { pCxt->pRootNode = dropXnodeResource(pCxt, A, &B); }
cmd ::= DROP XNODE xnode_resource_type(A) NK_INTEGER(B). { pCxt->pRootNode = dropXnodeResource(pCxt, A, &B); }
cmd ::= DROP XNODE xnode_resource_type(A) WHERE search_condition(B). { pCxt->pRootNode = dropXnodeResourceWhere(pCxt, A, B); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
/* show xnodes; or show xnodes where ...*/
cmd ::= SHOW XNODES where_clause_opt(B). { pCxt->pRootNode = createShowXnodeStmtWithCond(pCxt, QUERY_NODE_SHOW_XNODES_STMT, B); }
/* show xnode tasks; or show xnode tasks where ...*/
/* show xnode agents; show xnode agents where ... */
/* show xnode jobs; show xnode jobs where ... */
cmd ::= SHOW XNODE xnode_resource_type(A) where_clause_opt(B). { pCxt->pRootNode = createShowXNodeResourcesWhereStmt(pCxt, A, B); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
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 DNODES RELOAD general_name(A). { pCxt->pRootNode = createAlterAllDnodeTLSStmt(pCxt, &A);}
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); }
2026-03-30 10:31:43 +00:00
cmd ::= RESTORE VNODE ON DNODE NK_INTEGER(A) ON VGROUP NK_INTEGER(B). { pCxt->pRootNode = createRestoreComponentNodeStmtWithVgId(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &A, &B); }
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); }
cmd ::= TRIM DATABASE db_name(A) WAL. { pCxt->pRootNode = createTrimDbWalStmt(pCxt, &A); }
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); }
cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C) meta_only(D) force_opt(E). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C, D, E); }
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) force_opt(F). { pCxt->pRootNode = createCompactVgroupsStmt(pCxt, A, B, C, D, E, F); }
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); }
2026-03-20 05:56:20 +00:00
db_options(A) ::= db_options(B) CACHESHARDBITS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHESHARDBITS, &C); }
db_options(A) ::= db_options(B) CACHESHARDBITS NK_MINUS(D) NK_INTEGER(C). {
SToken t = D;
t.n = (C.z + C.n) - D.z;
A = setDatabaseOption(pCxt, B, DB_OPTION_CACHESHARDBITS, &t);
}
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); }
2026-01-28 11:06:16 +00:00
db_options(A) ::= db_options(B) IS_AUDIT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_IS_AUDIT, &C); }
db_options(A) ::= db_options(B) ALLOW_DROP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_ALLOW_DROP, &C); }
db_options(A) ::= db_options(B) SECURE_DELETE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SECURE_DELETE, &C); }
db_options(A) ::= db_options(B) SECURITY_LEVEL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SECURITY_LEVEL, &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; }
2026-03-20 05:56:20 +00:00
alter_db_option(A) ::= CACHESHARDBITS NK_INTEGER(B). { A.type = DB_OPTION_CACHESHARDBITS; A.val = B; }
alter_db_option(A) ::= CACHESHARDBITS NK_MINUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A.type = DB_OPTION_CACHESHARDBITS; A.val = t;
}
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; }
2026-01-28 11:06:16 +00:00
alter_db_option(A) ::= ALLOW_DROP NK_INTEGER(B). { A.type = DB_OPTION_ALLOW_DROP; A.val = B; }
alter_db_option(A) ::= SECURE_DELETE NK_INTEGER(B). { A.type = DB_OPTION_SECURE_DELETE; A.val = B; }
alter_db_option(A) ::= SECURITY_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_SECURITY_LEVEL; 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, NULL, NULL); }
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, NULL, NULL); }
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, NULL, NULL); }
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
2026-03-18 06:19:15 +00:00
/* update multi table tag values */
%type column_tag_value_list { SNodeList* }
%destructor column_tag_value_list { nodesDestroyList($$); }
2026-03-18 06:19:15 +00:00
column_tag_value(A) ::= column_name(B) NK_EQ tags_literal(C). { A = createAlterTagValueNode(pCxt, &B, C); }
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
2026-03-18 06:19:15 +00:00
%type alter_single_table_clause { SNode* }
%destructor alter_single_table_clause { nodesDestroyNode($$); }
alter_single_table_clause(A) ::= full_table_name(B) SET TAG column_tag_value_list(C). { A = createAlterTableUpdateTagValClause(pCxt, B, C); }
%type alter_multi_table_clause { SNodeList* }
%destructor alter_multi_table_clause { nodesDestroyList($$); }
alter_multi_table_clause(A) ::= alter_single_table_clause(B). { A = createNodeList(pCxt, B); }
alter_multi_table_clause(A) ::= alter_multi_table_clause(B) alter_single_table_clause(C). { A = addNodeToList(pCxt, B, C); }
alter_table_clause(A) ::= alter_multi_table_clause(B). { A = createAlterMultiTableUpdateTagValStmt(pCxt, B); }
/* update child table tag values */
column_tag_expr_value(A) ::= column_tag_value(B). { A = B; }
/* NOTE: the use of REGEXP_REPLACE is a temporary solution, will be replaced by a more general solution like below in the future:
column_tag_expr_value(A) ::= column_name(B) NK_EQ expression(C).
*/
column_tag_expr_value(A) ::= column_name(B) NK_EQ REGEXP_REPLACE NK_LP NK_ID NK_COMMA NK_STRING(C) NK_COMMA NK_STRING(D) NK_RP. {
A = createAlterTagValueNodeWithExpression(pCxt, &B, &C, &D);
}
%type column_tag_expr_value_list { SNodeList* }
%destructor column_tag_expr_value_list { nodesDestroyList($$); }
column_tag_expr_value_list(A) ::= column_tag_expr_value(B). { A = createNodeList(pCxt, B); }
column_tag_expr_value_list(A) ::= column_tag_expr_value_list(B) NK_COMMA column_tag_expr_value(C). { A = addNodeToList(pCxt, B, C); }
alter_table_clause(A) ::= USING full_table_name(B) SET TAG column_tag_expr_value_list(C) where_clause_opt(D). {
A = createAlterChildTableUpdateTagValStmt(pCxt, B, C, D);
}
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
2025-12-29 11:27:11 +00:00
%type specific_cols_with_mask_opt { SNodeList* }
%destructor specific_cols_with_mask_opt { nodesDestroyList($$); }
specific_cols_with_mask_opt(A) ::= . { A = NULL; }
specific_cols_with_mask_opt(A) ::= NK_LP col_name_ex_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); }
table_options(A) ::= table_options(B) SECURE_DELETE NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_SECURE_DELETE, &C); }
table_options(A) ::= table_options(B) SECURITY_LEVEL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_SECURITY_LEVEL, &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; }
alter_table_option(A) ::= SECURE_DELETE NK_INTEGER(B). { A.type = TABLE_OPTION_SECURE_DELETE; A.val = B; }
alter_table_option(A) ::= SECURITY_LEVEL NK_INTEGER(B). { A.type = TABLE_OPTION_SECURITY_LEVEL; 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); }
2025-12-29 11:27:11 +00:00
%type col_name_ex_list { SNodeList* }
%destructor col_name_ex_list { nodesDestroyList($$); }
col_name_ex_list(A) ::= col_name(B). { A = createNodeList(pCxt, B); }
col_name_ex_list(A) ::= col_name_with_mask(B). { A = createNodeList(pCxt, B); }
col_name_ex_list(A) ::= col_name_ex_list(B) NK_COMMA col_name(C). { A = addNodeToList(pCxt, B, C); }
col_name_ex_list(A) ::= col_name_ex_list(B) NK_COMMA col_name_with_mask(C). { A = addNodeToList(pCxt, B, C); }
2022-03-10 07:36:06 +00:00
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); }
2025-12-29 11:27:11 +00:00
col_name_with_mask(A) ::= MASK NK_LP column_name(B) NK_RP. { A = createColumnNodeExt(pCxt, NULL, &B, 1); }
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); }
2025-12-29 11:27:11 +00:00
cmd ::= SHOW ROLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ROLES_STMT); }
cmd ::= SHOW ROLE PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ROLE_PRIVILEGES_STMT); }
cmd ::= SHOW ROLE COLUMN PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ROLE_COL_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); }
2025-11-28 02:10:37 +00:00
cmd ::= SHOW INSTANCES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithLike(pCxt, QUERY_NODE_SHOW_INSTANCES_STMT, B); }
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); }
2025-12-05 05:26:28 +00:00
cmd ::= SHOW ENCRYPT_ALGORITHMS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPT_ALGORITHMS_STMT); }
cmd ::= SHOW ENCRYPT_STATUS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPT_STATUS_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 SECURITY_POLICIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SECURITY_POLICIES_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); }
cmd ::= SHOW TOKENS. { pCxt->pRootNode = createShowTokensStmt(pCxt, QUERY_NODE_SHOW_TOKENS_STMT); }
cmd ::= SHOW VTABLE VALIDATE FOR full_table_name(A). { pCxt->pRootNode = createShowValidateVirtualTableStmt(pCxt, QUERY_NODE_SHOW_VALIDATE_VTABLE_STMT, A);
}
%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 ::= SHOW CREATE STREAM full_stream_name(A). { pCxt->pRootNode = createShowCreateStreamStmt(pCxt, 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; }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_or_subquery(C). { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, A, &B, C, false); }
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 ::= RELOAD TOPIC exists_opt(A) topic_name(B) AS query_or_subquery(C). { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, A, &B, C, true); }
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); }
2025-12-30 10:52:02 +00:00
cmd ::= DROP STREAM exists_opt(A) stream_name_list(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); }
2025-12-30 10:52:02 +00:00
%type stream_name_list { SNodeList* }
%destructor stream_name_list { nodesDestroyList($$); }
stream_name_list(A) ::= full_stream_name(B). { A = createNodeList(pCxt, B); }
stream_name_list(A) ::= stream_name_list(B) NK_COMMA full_stream_name(C). { A = addNodeToList(pCxt, B, C); }
/********** stream_outtable **********/
%type nodelay_create_subtable_opt { int32_t }
%destructor nodelay_create_subtable_opt { }
nodelay_create_subtable_opt(A) ::= . { A = 0; }
nodelay_create_subtable_opt(A) ::= NODELAY_CREATE_SUBTABLE. { A = 1; }
stream_outtable_opt(A) ::= . { A = NULL; }
stream_outtable_opt(A) ::= INTO full_table_name(B) nodelay_create_subtable_opt(F) output_subtable_opt(C) column_name_opt(D) stream_tags_def_opt(E). { A = createStreamOutTableNode(pCxt, B, C, D, E, F); }
/********** 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)); }
trigger_type(A) ::= STATE_WINDOW NK_LP expr_or_subquery(B) state_window_opt(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); }
trigger_type(A) ::= EVENT_WINDOW NK_LP START WITH NK_LP search_condition_list(B) NK_RP
END WITH search_condition(C) NK_RP true_for_opt(D). { A = createEventWindowNode(pCxt, createNodeListNode(pCxt, B), C, D); }
trigger_type(A) ::= EVENT_WINDOW NK_LP START WITH NK_LP search_condition_list(B) NK_RP NK_RP true_for_opt(D). { A = createEventWindowNode(pCxt, createNodeListNode(pCxt, B), NULL, D); }
%type search_condition_list { SNodeList* }
%destructor search_condition_list { nodesDestroyList($$); }
search_condition_list(A) ::= search_condition(B) NK_COMMA search_condition(C). { A = addNodeToList(pCxt, createNodeList(pCxt, B), C); }
search_condition_list(A) ::= search_condition_list(B) NK_COMMA search_condition(C). { A = addNodeToList(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; }
trigger_option(A) ::= IDLE_TIMEOUT NK_LP duration_literal(B) NK_RP. { A.type = STREAM_TRIGGER_OPTION_IDLE_TIMEOUT; A.pNode = releaseRawExprNode(pCxt, B); }
/***** 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; }
event_types(A) ::= IDLE. { A = EVENT_IDLE; }
event_types(A) ::= RESUME. { A = EVENT_RESUME; }
/********** 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 ::= ALTER VGROUP NK_INTEGER(A) SET KEEP NK_INTEGER(B). { pCxt->pRootNode = createSetVgroupKeepVersionStmt(pCxt, &A, &B); }
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); }
cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B) SECURE_DELETE. { pCxt->pRootNode = createSecureDeleteStmt(pCxt, A, B); }
2022-06-04 11:54:55 +00:00
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); }
//%type vtags_literal_list { SNodeList* }
//%destructor vtags_literal_list { nodesDestroyList($$); }
//vtags_literal_list(A) ::= vtags_literal(B). { A = createNodeList(pCxt, B); }
//vtags_literal_list(A) ::= vtags_literal_list(B) NK_COMMA vtags_literal(C). { A = addNodeToList(pCxt, B, C); }
//vtags_literal(A) ::= tags_literal(B). { A = B; }
//vtags_literal(A) ::= FROM column_ref(B). { A = B; }
//vtags_literal(A) ::= NK_ID(B) FROM column_ref(C). { A = createColumnRefNodeByNode(pCxt, &B, C); }
//vtags_literal(A) ::= NK_ID(B) NK_DOT NK_ID(C) NK_DOT NK_ID(D). { A = createColumnRefNodeFromTriplet(pCxt, &B, &C, &D); }
//vtags_literal(A) ::= NK_ID(B) NK_DOT NK_ID(C). { A = createColumnRefNodeFromPair(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)); }
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
signed_variable(A) ::= NK_MINUS(B) NK_VARIABLE(C). {
2024-11-27 08:27:14 +00:00
SToken t = B;
t.n = (C.z + C.n) - B.z;
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &t));
2024-11-27 08:27:14 +00:00
}
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; }
2025-12-29 11:27:11 +00:00
%type role_name { SToken }
%destructor role_name { }
role_name(A) ::= NK_ID(B). { A = B; }
2025-12-15 08:48:20 +00:00
%type general_name { SToken }
%destructor general_name { }
general_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; }
expr_or_subquery(A) ::= subquery(B). { A = B; }
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) ::= IMPMARK(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= ANOMALYMARK(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TIDLESTART(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= TIDLEEND(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 ***********************************************************/
%type quantified_expr { EQuantifyType }
%destructor quantified_expr { }
quantified_expr(A) ::= ANY. { A = QU_TYPE_ANY; }
quantified_expr(A) ::= SOME. { A = QU_TYPE_ANY; }
quantified_expr(A) ::= ALL. { A = QU_TYPE_ALL; }
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) ::= expr_or_subquery(B) quantified_compare_op(C) quantified_expr(D) subquery(E). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, E);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, C, releaseRawExprNode(pCxt, B), setNodeQuantifyType(pCxt, releaseRawExprNode(pCxt, E), D)));
}
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)));
}
predicate(A) ::= EXISTS(B) subquery(C). {
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &e, createOperatorNode(pCxt, OP_TYPE_EXISTS, releaseRawExprNode(pCxt, C), NULL));
}
predicate(A) ::= NOT(B) EXISTS subquery(C). {
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &B, &e, createOperatorNode(pCxt, OP_TYPE_NOT_EXISTS, releaseRawExprNode(pCxt, C), NULL));
}
%type quantified_compare_op { EOperatorType }
%destructor quantified_compare_op { }
quantified_compare_op(A) ::= NK_LT. { A = OP_TYPE_LOWER_THAN; }
quantified_compare_op(A) ::= NK_GT. { A = OP_TYPE_GREATER_THAN; }
quantified_compare_op(A) ::= NK_LE. { A = OP_TYPE_LOWER_EQUAL; }
quantified_compare_op(A) ::= NK_GE. { A = OP_TYPE_GREATER_EQUAL; }
quantified_compare_op(A) ::= NK_NE. { A = OP_TYPE_NOT_EQUAL; }
quantified_compare_op(A) ::= NK_EQ. { A = OP_TYPE_EQUAL; }
2022-03-10 07:36:06 +00:00
%type compare_op { EOperatorType }
%destructor compare_op { }
compare_op(A) ::= quantified_compare_op(B). { A = B; }
2022-03-10 07:36:06 +00:00
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)); }
in_predicate_value(A) ::= NK_LP(C) query_expression(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, B); }
in_predicate_value(A) ::= NK_LP(C) subquery(B) NK_RP(D). { A = createRawExprNodeExt(pCxt, &C, &D, releaseRawExprNode(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)
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) state_window_opt(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 anomaly_col_list(B) NK_RP. { A = createAnomalyWindowNode(pCxt, B); }
%type anomaly_col_list { SNodeList* }
%destructor anomaly_col_list { nodesDestroyList($$); }
anomaly_col_list(A) ::= expr_or_subquery(B). { A = createNodeList(pCxt, releaseRawExprNode(pCxt, B)); }
anomaly_col_list(A) ::= anomaly_col_list(B) NK_COMMA expr_or_subquery(C). { A = addNodeToList(pCxt, B, releaseRawExprNode(pCxt, C)); }
/* External window treated as a special time window clause */
twindow_clause_opt(A) ::=
EXTERNAL_WINDOW NK_LP subquery(B) table_alias(C) external_window_fill_opt(D) NK_RP. {
A = createExternalWindowClause(pCxt, releaseRawExprNode(pCxt, B), &C, D);
}
2022-03-10 07:36:06 +00:00
extend_literal(A) ::= NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_INT, &B); }
zeroth_literal(A) ::= signed_integer(B). { A = B; }
zeroth_literal(A) ::= NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
zeroth_literal(A) ::= NK_BOOL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B); }
%type state_window_opt { SNodeList* }
%destructor state_window_opt { nodesDestroyList($$); }
state_window_opt(A) ::= . { A = NULL; }
state_window_opt(A) ::= NK_COMMA extend_literal(B). { A = createNodeList(pCxt, B); }
state_window_opt(A) ::= NK_COMMA extend_literal(B) NK_COMMA zeroth_literal(C). { A = addNodeToList(pCxt, createNodeList(pCxt, B), C); }
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)); }
2026-01-21 06:06:49 +00:00
interval_sliding_duration_literal(A) ::= NK_QUESTION(B). { A = createRawExprNode(pCxt, &B, createDurationPlaceholderValueNode(pCxt, &B)); }
2022-03-10 07:36:06 +00:00
2024-11-28 10:29:20 +00:00
2022-03-10 07:36:06 +00:00
fill_opt(A) ::= . { A = NULL; }
2024-11-28 10:29:20 +00:00
fill_opt(A) ::= fill_value(B). { A = B; }
fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
fill_opt(A) ::=
FILL NK_LP fill_position_mode(B) NK_RP surround_opt(C). { A = createFillNodeWithSurroundNode(pCxt, B, C); }
fill_opt(A) ::=
FILL NK_LP fill_position_mode(B) NK_COMMA expression_list(C) NK_RP. { A = createFillNode(pCxt, B, createNodeListNode(pCxt, C)); }
2024-11-28 10:29:20 +00:00
fill_value(A) ::= FILL NK_LP VALUE NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE, NULL); }
2024-11-28 10:29:20 +00:00
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_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE_F, NULL); }
2024-11-28 10:29:20 +00:00
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
%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
%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; }
fill_position_mode(A) ::= NEAR. { A = FILL_MODE_NEAR; }
2024-11-28 10:29:20 +00:00
%type surround_opt { SNode* }
%destructor surround_opt { nodesDestroyNode($$); }
surround_opt(A) ::= . { A = NULL; }
surround_opt(A) ::= SURROUND NK_LP duration_literal(B) NK_RP. { A = createSurroundNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
surround_opt(A) ::=
SURROUND NK_LP duration_literal(B) NK_COMMA expression_list(C) NK_RP. { A = createSurroundNode(pCxt, releaseRawExprNode(pCxt, B), createNodeListNode(pCxt, C)); }
2024-11-28 10:29:20 +00:00
/* External window clause syntax was folded into twindow_clause_opt */
%type external_window_fill_opt { SNode* }
%destructor external_window_fill_opt { nodesDestroyNode($$); }
external_window_fill_opt(A) ::= . { A = NULL; }
external_window_fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
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 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) ::=
feat(taosx): support distributed taosx (#34126) * feat: add xnode syntax * refactor(xnode): reduce function complexity * chore: add lost xnode.h file * feat(xnode): create xnode task * chore: fix double free error * add xnoded * start xnoded as subprocess * complete xnode task feature * complete show xnode jobs feature * complete with option feature * complete alter xnode job feature * complete alter xnode task feature * complete user pass feature * clean code * modify status type as char * fix leader ep null * fix start task req null * fix pass id for status * support timeout msg * drop xnode task relative jobs * clean code * wip * chore: add test cases for xnode * chore: fix 3.0 merge changes * fix drain core dump and create task core dump * add password check * retrieve xnode status from xnoded * pass integer as double to cjson * add some debug log * add some job log * fix start task lock * do not handle http response * fix coredump drop xnode task by name * support start/stop/drop task by name * remove mock xnoded * support unix socket * kill pre-xnoded before start * support dnode close xnoded * test(xnode): add unit test cases for xnode * rebalance support where clause * fix some test issue * unformat http post content json string * add xnode zh doc * modify drain description * remove job create/stop/drop operation * support rebalance all without where condition * support alter task by name * add NULL param for mndCheckOperPrivilege * add xnode txnode module for libmnode.a * code clean * change parser len to 4096 * clean code * chore: try to fix gtest/gtest.h not found * chore: fix markdown files * chore: fix markdown in zh * chore: fix enum issue and add ci * chore: fix test case problem * chore: fix pKeyVal overflow * chore: rename to 排空节点 * chore: external cmake remove parallel * chore: add DEP_ext_gtest for xnode test * chore: fix gtest errors * chore: remove gtest pthread lib * chore: fix data type not match * chore: fix some lint errors * chore: fix void unlink * chore: fix return with null pointer check * chore: fix pointer double free and xnodeMemoryTest strncpy null * chore: fix xnode encode action invalid datelen * chore: remove TD_LINUX condition * chore: use PRIu64 denote long long * chore: fix task parser NULL and allow no with clause * fix(xnode): fix windows build error * chore: fix windows curl error * chore: fix test case ins_tables relative error * chore: fix memory leak * docs: update taosx docs * chore: update taosx docs * chore: add role priviledge table * chore: fix error code doc * chore: fix test_xnode.py * chore: fix doc typo * fix: ci error while run test_user_privilege_sysinfo.py --------- Co-authored-by: Linhe Huo <linhehuo@gmail.com> Co-authored-by: huohong <sallyhuo@taosdata.com> Co-authored-by: Simon Guan <guanshengliang@qq.com>
2026-01-01 06:51:03 +00:00
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); }
true_for_opt(A) ::= TRUE_FOR NK_LP COUNT NK_INTEGER(B) NK_RP. { A = createTrueForCountNode(pCxt, &B); }
true_for_opt(A) ::= TRUE_FOR NK_LP interval_sliding_duration_literal(B) AND COUNT NK_INTEGER(C) NK_RP. { A = createTrueForAndNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
true_for_opt(A) ::= TRUE_FOR NK_LP interval_sliding_duration_literal(B) OR COUNT NK_INTEGER(C) NK_RP. { A = createTrueForOrNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
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 NK_ID FROM_BASE64 TO_BASE64 MD5 SHA SHA1 SHA2 AES_ENCRYPT AES_DECRYPT SM4_ENCRYPT SM4_DECRYPT.
%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); }