fix: continue coding
This commit is contained in:
parent
94a616fcc1
commit
2773f1e9ac
|
@ -273,7 +273,7 @@ typedef struct SShowStmt {
|
||||||
SNode* pDbName; // SValueNode
|
SNode* pDbName; // SValueNode
|
||||||
SNode* pTbName; // SValueNode
|
SNode* pTbName; // SValueNode
|
||||||
EOperatorType tableCondType;
|
EOperatorType tableCondType;
|
||||||
SValueNode* pKind; // show databases: user/system, show tables: normal/child, others NULL
|
EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL
|
||||||
} SShowStmt;
|
} SShowStmt;
|
||||||
|
|
||||||
typedef struct SShowCreateDatabaseStmt {
|
typedef struct SShowCreateDatabaseStmt {
|
||||||
|
|
|
@ -277,6 +277,14 @@ typedef enum ETimeLineMode {
|
||||||
TIME_LINE_GLOBAL,
|
TIME_LINE_GLOBAL,
|
||||||
} ETimeLineMode;
|
} ETimeLineMode;
|
||||||
|
|
||||||
|
typedef enum EShowKind {
|
||||||
|
SHOW_KIND_NONE = 1,
|
||||||
|
SHOW_KIND_TABLES_NORMAL,
|
||||||
|
SHOW_KIND_TABLES_CHILD,
|
||||||
|
SHOW_KIND_DATABASES_USER,
|
||||||
|
SHOW_KIND_DATABASES_SYSTEM
|
||||||
|
} EShowKind;
|
||||||
|
|
||||||
typedef struct SFillNode {
|
typedef struct SFillNode {
|
||||||
ENodeType type; // QUERY_NODE_FILL
|
ENodeType type; // QUERY_NODE_FILL
|
||||||
EFillMode mode;
|
EFillMode mode;
|
||||||
|
|
|
@ -181,7 +181,7 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int
|
||||||
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal);
|
SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal);
|
||||||
SNode* setAlterSuperTableType(SNode* pStmt);
|
SNode* setAlterSuperTableType(SNode* pStmt);
|
||||||
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, SNode* pKind);
|
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind);
|
||||||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type);
|
||||||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||||
EOperatorType tableCondType);
|
EOperatorType tableCondType);
|
||||||
|
|
|
@ -530,11 +530,15 @@ tag_item(A) ::= column_name(B).
|
||||||
tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
|
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); }
|
tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); }
|
||||||
|
|
||||||
db_kind_opt(A) ::= . { A = NULL; }
|
%type db_kind_opt { EShowKind }
|
||||||
db_kind_opt(A) ::= NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
|
%destructor db_kind_opt { }
|
||||||
|
db_kind_opt(A) ::= . { A = SHOW_KIND_NONE; }
|
||||||
|
db_kind_opt(A) ::= USER. { A = SHOW_KIND_DATABASES_USER; }
|
||||||
|
db_kind_opt(A) ::= SYSTEM. { A = SHOW_KIND_DATABASES_SYSTEM; }
|
||||||
|
|
||||||
table_kind_opt(A) ::= . { A = NULL; }
|
table_kind_opt(A) ::= . { A = SHOW_KIND_NONE; }
|
||||||
table_kind_opt(A) ::= NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
|
table_kind_opt(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; }
|
||||||
|
table_kind_opt(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; }
|
||||||
/************************************************ create index ********************************************************/
|
/************************************************ create index ********************************************************/
|
||||||
cmd ::= CREATE SMA INDEX not_exists_opt(D)
|
cmd ::= CREATE SMA INDEX not_exists_opt(D)
|
||||||
col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
|
col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
|
||||||
|
|
|
@ -1552,15 +1552,9 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, SNode* pKind) {
|
SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind) {
|
||||||
//TODO: check show
|
SShowStmt* pShow = (SShowStmt*)pStmt;
|
||||||
if ((nodeType(pStmt) == QUERY_NODE_SHOW_TABLES_STMT ||
|
pShow->showKind = showKind;
|
||||||
nodeType(pStmt) == QUERY_NODE_SHOW_DATABASES_STMT) && nodeType(pKind) == QUERY_NODE_VALUE) {
|
|
||||||
SShowStmt* pShowStmt = (SShowStmt*)pStmt;
|
|
||||||
pShowStmt->pKind = (SValueNode*)pKind;
|
|
||||||
} else {
|
|
||||||
//pCxt->errCode = generateSyntaxErrMsgExt(pCxt->msgBuf, code, "shall be normal|child, user/system");
|
|
||||||
}
|
|
||||||
return pStmt;
|
return pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"CACHESIZE", TK_CACHESIZE},
|
{"CACHESIZE", TK_CACHESIZE},
|
||||||
{"CASE", TK_CASE},
|
{"CASE", TK_CASE},
|
||||||
{"CAST", TK_CAST},
|
{"CAST", TK_CAST},
|
||||||
|
{"CHILD", TK_CHILD},
|
||||||
{"CLIENT_VERSION", TK_CLIENT_VERSION},
|
{"CLIENT_VERSION", TK_CLIENT_VERSION},
|
||||||
{"CLUSTER", TK_CLUSTER},
|
{"CLUSTER", TK_CLUSTER},
|
||||||
{"COLUMN", TK_COLUMN},
|
{"COLUMN", TK_COLUMN},
|
||||||
|
@ -149,6 +150,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"MNODES", TK_MNODES},
|
{"MNODES", TK_MNODES},
|
||||||
{"MODIFY", TK_MODIFY},
|
{"MODIFY", TK_MODIFY},
|
||||||
{"MODULES", TK_MODULES},
|
{"MODULES", TK_MODULES},
|
||||||
|
{"NORMAL", TK_NORMAL},
|
||||||
{"NCHAR", TK_NCHAR},
|
{"NCHAR", TK_NCHAR},
|
||||||
{"NEXT", TK_NEXT},
|
{"NEXT", TK_NEXT},
|
||||||
{"NMATCH", TK_NMATCH},
|
{"NMATCH", TK_NMATCH},
|
||||||
|
@ -224,6 +226,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"SUBSCRIPTIONS", TK_SUBSCRIPTIONS},
|
{"SUBSCRIPTIONS", TK_SUBSCRIPTIONS},
|
||||||
{"SUBTABLE", TK_SUBTABLE},
|
{"SUBTABLE", TK_SUBTABLE},
|
||||||
{"SYSINFO", TK_SYSINFO},
|
{"SYSINFO", TK_SYSINFO},
|
||||||
|
{"SYSTEM", TK_SYSTEM},
|
||||||
{"TABLE", TK_TABLE},
|
{"TABLE", TK_TABLE},
|
||||||
{"TABLES", TK_TABLES},
|
{"TABLES", TK_TABLES},
|
||||||
{"TABLE_PREFIX", TK_TABLE_PREFIX},
|
{"TABLE_PREFIX", TK_TABLE_PREFIX},
|
||||||
|
|
|
@ -8079,19 +8079,19 @@ static int32_t addShowChildTablesCond(SSelectStmt* pSelect) {
|
||||||
|
|
||||||
static int32_t addShowKindCond(const SShowStmt* pShow, SSelectStmt* pSelect) {
|
static int32_t addShowKindCond(const SShowStmt* pShow, SSelectStmt* pSelect) {
|
||||||
if (pShow->type != QUERY_NODE_SHOW_DATABASES_STMT && pShow->type != QUERY_NODE_SHOW_TABLES_STMT ||
|
if (pShow->type != QUERY_NODE_SHOW_DATABASES_STMT && pShow->type != QUERY_NODE_SHOW_TABLES_STMT ||
|
||||||
pShow->pKind == NULL) {
|
pShow->showKind == SHOW_KIND_NONE) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (pShow->type == QUERY_NODE_SHOW_DATABASES_STMT) {
|
if (pShow->type == QUERY_NODE_SHOW_DATABASES_STMT) {
|
||||||
if (strcasecmp(pShow->pKind->literal, "USER") == 0) {
|
if (pShow->showKind == SHOW_KIND_DATABASES_USER) {
|
||||||
addShowUserDatabasesCond(pSelect);
|
addShowUserDatabasesCond(pSelect);
|
||||||
} else if (strcasecmp(pShow->pKind->literal, "SYSTEM") == 0) {
|
} else if (pShow->showKind == SHOW_KIND_DATABASES_SYSTEM) {
|
||||||
addShowSystemDatabasesCond(pSelect);
|
addShowSystemDatabasesCond(pSelect);
|
||||||
}
|
}
|
||||||
} else if (pShow->type == QUERY_NODE_SHOW_TABLES_STMT) {
|
} else if (pShow->type == QUERY_NODE_SHOW_TABLES_STMT) {
|
||||||
if (strcasecmp(pShow->pKind->literal, "NORMAL") == 0) {
|
if (pShow->showKind == SHOW_KIND_TABLES_NORMAL) {
|
||||||
addShowNormalTablesCond(pSelect);
|
addShowNormalTablesCond(pSelect);
|
||||||
} else if (strcasecmp(pShow->pKind->literal, "CHILD") == 0) {
|
} else if (pShow->showKind == SHOW_KIND_TABLES_CHILD) {
|
||||||
addShowChildTablesCond(pSelect);
|
addShowChildTablesCond(pSelect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue