提交 a5ca4965 编写于 作者: X Xiaoyu Wang

feat: some sql syntax adjustments

上级 78caa7e0
...@@ -1174,6 +1174,13 @@ typedef struct { ...@@ -1174,6 +1174,13 @@ typedef struct {
char* data; char* data;
} STagData; } STagData;
typedef struct {
int32_t useless; // useless
} SShowVariablesReq;
int32_t tSerializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
int32_t tDeserializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
/* /*
* sql: show tables like '%a_%' * sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%' * payload is the query condition, e.g., '%a_%'
......
...@@ -158,6 +158,7 @@ enum { ...@@ -158,6 +158,7 @@ enum {
TD_DEF_MSG_TYPE(TDMT_MND_MERGE_VGROUP, "merge-vgroup", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_MERGE_VGROUP, "merge-vgroup", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_REDISTRIBUTE_VGROUP, "redistribute-vgroup", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_REDISTRIBUTE_VGROUP, "redistribute-vgroup", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_SPLIT_VGROUP, "split-vgroup", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_SPLIT_VGROUP, "split-vgroup", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_VARIABLES, "show-variables", NULL, NULL)
TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_NEW_MSG_SEG(TDMT_VND_MSG)
TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp)
......
...@@ -49,214 +49,216 @@ ...@@ -49,214 +49,216 @@
#define TK_CONNS 31 #define TK_CONNS 31
#define TK_STATE 32 #define TK_STATE 32
#define TK_USER 33 #define TK_USER 33
#define TK_PRIVILEGE 34 #define TK_ENABLE 34
#define TK_DROP 35 #define TK_NK_INTEGER 35
#define TK_GRANT 36 #define TK_SYSINFO 36
#define TK_ON 37 #define TK_DROP 37
#define TK_TO 38 #define TK_GRANT 38
#define TK_REVOKE 39 #define TK_ON 39
#define TK_FROM 40 #define TK_TO 40
#define TK_NK_COMMA 41 #define TK_REVOKE 41
#define TK_READ 42 #define TK_FROM 42
#define TK_WRITE 43 #define TK_NK_COMMA 43
#define TK_NK_DOT 44 #define TK_READ 44
#define TK_DNODE 45 #define TK_WRITE 45
#define TK_PORT 46 #define TK_NK_DOT 46
#define TK_NK_INTEGER 47 #define TK_DNODE 47
#define TK_DNODES 48 #define TK_PORT 48
#define TK_NK_IPTOKEN 49 #define TK_DNODES 49
#define TK_LOCAL 50 #define TK_NK_IPTOKEN 50
#define TK_QNODE 51 #define TK_LOCAL 51
#define TK_BNODE 52 #define TK_QNODE 52
#define TK_SNODE 53 #define TK_BNODE 53
#define TK_MNODE 54 #define TK_SNODE 54
#define TK_DATABASE 55 #define TK_MNODE 55
#define TK_USE 56 #define TK_DATABASE 56
#define TK_IF 57 #define TK_USE 57
#define TK_NOT 58 #define TK_IF 58
#define TK_EXISTS 59 #define TK_NOT 59
#define TK_BUFFER 60 #define TK_EXISTS 60
#define TK_CACHELAST 61 #define TK_BUFFER 61
#define TK_COMP 62 #define TK_CACHELAST 62
#define TK_DURATION 63 #define TK_COMP 63
#define TK_NK_VARIABLE 64 #define TK_DURATION 64
#define TK_FSYNC 65 #define TK_NK_VARIABLE 65
#define TK_MAXROWS 66 #define TK_FSYNC 66
#define TK_MINROWS 67 #define TK_MAXROWS 67
#define TK_KEEP 68 #define TK_MINROWS 68
#define TK_PAGES 69 #define TK_KEEP 69
#define TK_PAGESIZE 70 #define TK_PAGES 70
#define TK_PRECISION 71 #define TK_PAGESIZE 71
#define TK_REPLICA 72 #define TK_PRECISION 72
#define TK_STRICT 73 #define TK_REPLICA 73
#define TK_WAL 74 #define TK_STRICT 74
#define TK_VGROUPS 75 #define TK_WAL 75
#define TK_SINGLE_STABLE 76 #define TK_VGROUPS 76
#define TK_RETENTIONS 77 #define TK_SINGLE_STABLE 77
#define TK_SCHEMALESS 78 #define TK_RETENTIONS 78
#define TK_NK_COLON 79 #define TK_SCHEMALESS 79
#define TK_TABLE 80 #define TK_NK_COLON 80
#define TK_NK_LP 81 #define TK_TABLE 81
#define TK_NK_RP 82 #define TK_NK_LP 82
#define TK_STABLE 83 #define TK_NK_RP 83
#define TK_ADD 84 #define TK_STABLE 84
#define TK_COLUMN 85 #define TK_ADD 85
#define TK_MODIFY 86 #define TK_COLUMN 86
#define TK_RENAME 87 #define TK_MODIFY 87
#define TK_TAG 88 #define TK_RENAME 88
#define TK_SET 89 #define TK_TAG 89
#define TK_NK_EQ 90 #define TK_SET 90
#define TK_USING 91 #define TK_NK_EQ 91
#define TK_TAGS 92 #define TK_USING 92
#define TK_COMMENT 93 #define TK_TAGS 93
#define TK_BOOL 94 #define TK_COMMENT 94
#define TK_TINYINT 95 #define TK_BOOL 95
#define TK_SMALLINT 96 #define TK_TINYINT 96
#define TK_INT 97 #define TK_SMALLINT 97
#define TK_INTEGER 98 #define TK_INT 98
#define TK_BIGINT 99 #define TK_INTEGER 99
#define TK_FLOAT 100 #define TK_BIGINT 100
#define TK_DOUBLE 101 #define TK_FLOAT 101
#define TK_BINARY 102 #define TK_DOUBLE 102
#define TK_TIMESTAMP 103 #define TK_BINARY 103
#define TK_NCHAR 104 #define TK_TIMESTAMP 104
#define TK_UNSIGNED 105 #define TK_NCHAR 105
#define TK_JSON 106 #define TK_UNSIGNED 106
#define TK_VARCHAR 107 #define TK_JSON 107
#define TK_MEDIUMBLOB 108 #define TK_VARCHAR 108
#define TK_BLOB 109 #define TK_MEDIUMBLOB 109
#define TK_VARBINARY 110 #define TK_BLOB 110
#define TK_DECIMAL 111 #define TK_VARBINARY 111
#define TK_MAX_DELAY 112 #define TK_DECIMAL 112
#define TK_WATERMARK 113 #define TK_MAX_DELAY 113
#define TK_ROLLUP 114 #define TK_WATERMARK 114
#define TK_TTL 115 #define TK_ROLLUP 115
#define TK_SMA 116 #define TK_TTL 116
#define TK_FIRST 117 #define TK_SMA 117
#define TK_LAST 118 #define TK_FIRST 118
#define TK_SHOW 119 #define TK_LAST 119
#define TK_DATABASES 120 #define TK_SHOW 120
#define TK_TABLES 121 #define TK_DATABASES 121
#define TK_STABLES 122 #define TK_TABLES 122
#define TK_MNODES 123 #define TK_STABLES 123
#define TK_MODULES 124 #define TK_MNODES 124
#define TK_QNODES 125 #define TK_MODULES 125
#define TK_FUNCTIONS 126 #define TK_QNODES 126
#define TK_INDEXES 127 #define TK_FUNCTIONS 127
#define TK_ACCOUNTS 128 #define TK_INDEXES 128
#define TK_APPS 129 #define TK_ACCOUNTS 129
#define TK_CONNECTIONS 130 #define TK_APPS 130
#define TK_LICENCE 131 #define TK_CONNECTIONS 131
#define TK_GRANTS 132 #define TK_LICENCE 132
#define TK_QUERIES 133 #define TK_GRANTS 133
#define TK_SCORES 134 #define TK_QUERIES 134
#define TK_TOPICS 135 #define TK_SCORES 135
#define TK_VARIABLES 136 #define TK_TOPICS 136
#define TK_BNODES 137 #define TK_VARIABLES 137
#define TK_SNODES 138 #define TK_BNODES 138
#define TK_CLUSTER 139 #define TK_SNODES 139
#define TK_TRANSACTIONS 140 #define TK_CLUSTER 140
#define TK_DISTRIBUTED 141 #define TK_TRANSACTIONS 141
#define TK_LIKE 142 #define TK_DISTRIBUTED 142
#define TK_INDEX 143 #define TK_LIKE 143
#define TK_FULLTEXT 144 #define TK_INDEX 144
#define TK_FUNCTION 145 #define TK_FUNCTION 145
#define TK_INTERVAL 146 #define TK_INTERVAL 146
#define TK_TOPIC 147 #define TK_TOPIC 147
#define TK_AS 148 #define TK_AS 148
#define TK_CONSUMER 149 #define TK_WITH 149
#define TK_GROUP 150 #define TK_META 150
#define TK_DESC 151 #define TK_CONSUMER 151
#define TK_DESCRIBE 152 #define TK_GROUP 152
#define TK_RESET 153 #define TK_DESC 153
#define TK_QUERY 154 #define TK_DESCRIBE 154
#define TK_CACHE 155 #define TK_RESET 155
#define TK_EXPLAIN 156 #define TK_QUERY 156
#define TK_ANALYZE 157 #define TK_CACHE 157
#define TK_VERBOSE 158 #define TK_EXPLAIN 158
#define TK_NK_BOOL 159 #define TK_ANALYZE 159
#define TK_RATIO 160 #define TK_VERBOSE 160
#define TK_NK_FLOAT 161 #define TK_NK_BOOL 161
#define TK_COMPACT 162 #define TK_RATIO 162
#define TK_VNODES 163 #define TK_NK_FLOAT 163
#define TK_IN 164 #define TK_COMPACT 164
#define TK_OUTPUTTYPE 165 #define TK_VNODES 165
#define TK_AGGREGATE 166 #define TK_IN 166
#define TK_BUFSIZE 167 #define TK_OUTPUTTYPE 167
#define TK_STREAM 168 #define TK_AGGREGATE 168
#define TK_INTO 169 #define TK_BUFSIZE 169
#define TK_TRIGGER 170 #define TK_STREAM 170
#define TK_AT_ONCE 171 #define TK_INTO 171
#define TK_WINDOW_CLOSE 172 #define TK_TRIGGER 172
#define TK_KILL 173 #define TK_AT_ONCE 173
#define TK_CONNECTION 174 #define TK_WINDOW_CLOSE 174
#define TK_TRANSACTION 175 #define TK_KILL 175
#define TK_BALANCE 176 #define TK_CONNECTION 176
#define TK_VGROUP 177 #define TK_TRANSACTION 177
#define TK_MERGE 178 #define TK_BALANCE 178
#define TK_REDISTRIBUTE 179 #define TK_VGROUP 179
#define TK_SPLIT 180 #define TK_MERGE 180
#define TK_SYNCDB 181 #define TK_REDISTRIBUTE 181
#define TK_DELETE 182 #define TK_SPLIT 182
#define TK_NULL 183 #define TK_SYNCDB 183
#define TK_NK_QUESTION 184 #define TK_DELETE 184
#define TK_NK_ARROW 185 #define TK_NULL 185
#define TK_ROWTS 186 #define TK_NK_QUESTION 186
#define TK_TBNAME 187 #define TK_NK_ARROW 187
#define TK_QSTARTTS 188 #define TK_ROWTS 188
#define TK_QENDTS 189 #define TK_TBNAME 189
#define TK_WSTARTTS 190 #define TK_QSTARTTS 190
#define TK_WENDTS 191 #define TK_QENDTS 191
#define TK_WDURATION 192 #define TK_WSTARTTS 192
#define TK_CAST 193 #define TK_WENDTS 193
#define TK_NOW 194 #define TK_WDURATION 194
#define TK_TODAY 195 #define TK_CAST 195
#define TK_TIMEZONE 196 #define TK_NOW 196
#define TK_COUNT 197 #define TK_TODAY 197
#define TK_LAST_ROW 198 #define TK_TIMEZONE 198
#define TK_BETWEEN 199 #define TK_COUNT 199
#define TK_IS 200 #define TK_LAST_ROW 200
#define TK_NK_LT 201 #define TK_BETWEEN 201
#define TK_NK_GT 202 #define TK_IS 202
#define TK_NK_LE 203 #define TK_NK_LT 203
#define TK_NK_GE 204 #define TK_NK_GT 204
#define TK_NK_NE 205 #define TK_NK_LE 205
#define TK_MATCH 206 #define TK_NK_GE 206
#define TK_NMATCH 207 #define TK_NK_NE 207
#define TK_CONTAINS 208 #define TK_MATCH 208
#define TK_JOIN 209 #define TK_NMATCH 209
#define TK_INNER 210 #define TK_CONTAINS 210
#define TK_SELECT 211 #define TK_JOIN 211
#define TK_DISTINCT 212 #define TK_INNER 212
#define TK_WHERE 213 #define TK_SELECT 213
#define TK_PARTITION 214 #define TK_DISTINCT 214
#define TK_BY 215 #define TK_WHERE 215
#define TK_SESSION 216 #define TK_PARTITION 216
#define TK_STATE_WINDOW 217 #define TK_BY 217
#define TK_SLIDING 218 #define TK_SESSION 218
#define TK_FILL 219 #define TK_STATE_WINDOW 219
#define TK_VALUE 220 #define TK_SLIDING 220
#define TK_NONE 221 #define TK_FILL 221
#define TK_PREV 222 #define TK_VALUE 222
#define TK_LINEAR 223 #define TK_NONE 223
#define TK_NEXT 224 #define TK_PREV 224
#define TK_HAVING 225 #define TK_LINEAR 225
#define TK_RANGE 226 #define TK_NEXT 226
#define TK_EVERY 227 #define TK_HAVING 227
#define TK_ORDER 228 #define TK_RANGE 228
#define TK_SLIMIT 229 #define TK_EVERY 229
#define TK_SOFFSET 230 #define TK_ORDER 230
#define TK_LIMIT 231 #define TK_SLIMIT 231
#define TK_OFFSET 232 #define TK_SOFFSET 232
#define TK_ASC 233 #define TK_LIMIT 233
#define TK_NULLS 234 #define TK_OFFSET 234
#define TK_ID 235 #define TK_ASC 235
#define TK_NK_BITNOT 236 #define TK_NULLS 236
#define TK_INSERT 237 #define TK_ID 237
#define TK_VALUES 238 #define TK_NK_BITNOT 238
#define TK_IMPORT 239 #define TK_INSERT 239
#define TK_NK_SEMI 240 #define TK_VALUES 240
#define TK_FILE 241 #define TK_IMPORT 241
#define TK_NK_SEMI 242
#define TK_FILE 243
#define TK_NK_SPACE 300 #define TK_NK_SPACE 300
#define TK_NK_COMMENT 301 #define TK_NK_COMMENT 301
......
...@@ -170,13 +170,16 @@ typedef struct SCreateUserStmt { ...@@ -170,13 +170,16 @@ typedef struct SCreateUserStmt {
ENodeType type; ENodeType type;
char useName[TSDB_USER_LEN]; char useName[TSDB_USER_LEN];
char password[TSDB_USET_PASSWORD_LEN]; char password[TSDB_USET_PASSWORD_LEN];
int8_t sysinfo;
} SCreateUserStmt; } SCreateUserStmt;
typedef struct SAlterUserStmt { typedef struct SAlterUserStmt {
ENodeType type; ENodeType type;
char useName[TSDB_USER_LEN]; char useName[TSDB_USER_LEN];
char password[TSDB_USET_PASSWORD_LEN];
int8_t alterType; int8_t alterType;
char password[TSDB_USET_PASSWORD_LEN];
int8_t enable;
int8_t sysinfo;
} SAlterUserStmt; } SAlterUserStmt;
typedef struct SDropUserStmt { typedef struct SDropUserStmt {
...@@ -259,7 +262,6 @@ typedef struct SDropIndexStmt { ...@@ -259,7 +262,6 @@ typedef struct SDropIndexStmt {
ENodeType type; ENodeType type;
bool ignoreNotExists; bool ignoreNotExists;
char indexName[TSDB_INDEX_NAME_LEN]; char indexName[TSDB_INDEX_NAME_LEN];
char tableName[TSDB_TABLE_NAME_LEN];
} SDropIndexStmt; } SDropIndexStmt;
typedef struct SCreateComponentNodeStmt { typedef struct SCreateComponentNodeStmt {
...@@ -278,6 +280,7 @@ typedef struct SCreateTopicStmt { ...@@ -278,6 +280,7 @@ typedef struct SCreateTopicStmt {
char subDbName[TSDB_DB_NAME_LEN]; char subDbName[TSDB_DB_NAME_LEN];
char subSTbName[TSDB_TABLE_NAME_LEN]; char subSTbName[TSDB_TABLE_NAME_LEN];
bool ignoreExists; bool ignoreExists;
bool withMeta;
SNode* pQuery; SNode* pQuery;
} SCreateTopicStmt; } SCreateTopicStmt;
......
...@@ -384,6 +384,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp); ...@@ -384,6 +384,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp);
bool nodesIsComparisonOp(const SOperatorNode* pOp); bool nodesIsComparisonOp(const SOperatorNode* pOp);
bool nodesIsJsonOp(const SOperatorNode* pOp); bool nodesIsJsonOp(const SOperatorNode* pOp);
bool nodesIsRegularOp(const SOperatorNode* pOp); bool nodesIsRegularOp(const SOperatorNode* pOp);
bool nodesIsBitwiseOp(const SOperatorNode* pOp);
bool nodesExprHasColumn(SNode* pNode); bool nodesExprHasColumn(SNode* pNode);
bool nodesExprsHasColumn(SNodeList* pList); bool nodesExprsHasColumn(SNodeList* pList);
......
...@@ -134,7 +134,7 @@ typedef enum EOperatorType { ...@@ -134,7 +134,7 @@ typedef enum EOperatorType {
OP_TYPE_MINUS, OP_TYPE_MINUS,
OP_TYPE_ASSIGN, OP_TYPE_ASSIGN,
// bit operator // bitwise operator
OP_TYPE_BIT_AND, OP_TYPE_BIT_AND,
OP_TYPE_BIT_OR, OP_TYPE_BIT_OR,
......
...@@ -2552,6 +2552,31 @@ void tFreeSTableIndexInfo(void *info) { ...@@ -2552,6 +2552,31 @@ void tFreeSTableIndexInfo(void *info) {
taosMemoryFree(pInfo->expr); taosMemoryFree(pInfo->expr);
} }
int32_t tSerializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesReq *pReq) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
if (tStartEncode(&encoder) < 0) return -1;
if (tEncodeI32(&encoder, pReq->useless) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
tEncoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesReq *pReq) {
SDecoder decoder = {0};
tDecoderInit(&decoder, buf, bufLen);
if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->useless) < 0) return -1;
tEndDecode(&decoder);
tDecoderClear(&decoder);
return 0;
}
int32_t tSerializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) { int32_t tSerializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
SEncoder encoder = {0}; SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen); tEncoderInit(&encoder, buf, bufLen);
......
...@@ -1354,6 +1354,17 @@ bool nodesIsRegularOp(const SOperatorNode* pOp) { ...@@ -1354,6 +1354,17 @@ bool nodesIsRegularOp(const SOperatorNode* pOp) {
return false; return false;
} }
bool nodesIsBitwiseOp(const SOperatorNode* pOp) {
switch (pOp->opType) {
case OP_TYPE_BIT_AND:
case OP_TYPE_BIT_OR:
return true;
default:
break;
}
return false;
}
typedef struct SCollectColumnsCxt { typedef struct SCollectColumnsCxt {
int32_t errCode; int32_t errCode;
const char* pTableAlias; const char* pTableAlias;
......
...@@ -162,7 +162,7 @@ SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); ...@@ -162,7 +162,7 @@ SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId); SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId);
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword); SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo);
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName); SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort); SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort);
...@@ -171,12 +171,15 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const ...@@ -171,12 +171,15 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
SToken* pTableName, SNodeList* pCols, SNode* pOptions); SToken* pTableName, SNodeList* pCols, SNode* pOptions);
SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding); SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding);
SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName, SToken* pTableName); SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName);
SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId); SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId); SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
SNode* createTopicOptions(SAstCreateContext* pCxt); SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, SNode* pQuery);
const SToken* pSubDbName, SNode* pRealTable); SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
const SToken* pSubDbName, bool withMeta);
SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
SNode* pRealTable, bool withMeta);
SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName); SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName);
SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pCGroupId, SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pCGroupId,
const SToken* pTopicName); const SToken* pTopicName);
......
...@@ -80,11 +80,18 @@ alter_account_option ::= CONNS literal. ...@@ -80,11 +80,18 @@ alter_account_option ::= CONNS literal.
alter_account_option ::= STATE literal. { } alter_account_option ::= STATE literal. { }
/************************************************ create/alter/drop user **********************************************/ /************************************************ create/alter/drop user **********************************************/
cmd ::= CREATE USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B); } cmd ::= CREATE USER user_name(A) PASS NK_STRING(B) sysinfo_opt(C). { pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B, C); }
cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); } cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B); }
cmd ::= ALTER USER user_name(A) PRIVILEGE NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PRIVILEGES, &B); } //cmd ::= ALTER USER user_name(A) PRIVILEGE NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PRIVILEGES, &B); }
cmd ::= ALTER USER user_name(A) ENABLE NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_ENABLE, &B); }
cmd ::= ALTER USER user_name(A) SYSINFO NK_INTEGER(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_SYSINFO, &B); }
cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); } cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); }
%type sysinfo_opt { int8_t }
%destructor sysinfo_opt { }
sysinfo_opt(A) ::= . { A = 1; }
sysinfo_opt(A) ::= SYSINFO NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
/************************************************ grant/revoke ********************************************************/ /************************************************ grant/revoke ********************************************************/
cmd ::= GRANT privileges(A) ON priv_level(B) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C); } cmd ::= GRANT privileges(A) ON priv_level(B) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C); }
cmd ::= REVOKE privileges(A) ON priv_level(B) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C); } cmd ::= REVOKE privileges(A) ON priv_level(B) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C); }
...@@ -396,9 +403,9 @@ from_db_opt(A) ::= FROM db_name(B). ...@@ -396,9 +403,9 @@ from_db_opt(A) ::= FROM db_name(B).
/************************************************ create index ********************************************************/ /************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D) cmd ::= CREATE SMA INDEX not_exists_opt(D)
index_name(A) ON table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, &B, NULL, C); } index_name(A) ON table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, &B, NULL, C); }
cmd ::= CREATE FULLTEXT INDEX not_exists_opt(D) //cmd ::= CREATE FULLTEXT INDEX not_exists_opt(D)
index_name(A) ON table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, D, &A, &B, C, NULL); } // index_name(A) ON table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, D, &A, &B, C, NULL); }
cmd ::= DROP INDEX exists_opt(C) index_name(A) ON table_name(B). { pCxt->pRootNode = createDropIndexStmt(pCxt, C, &A, &B); } cmd ::= DROP INDEX exists_opt(B) index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, &A); }
index_options(A) ::= . { A = NULL; } index_options(A) ::= . { A = NULL; }
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL
...@@ -414,10 +421,14 @@ func_list(A) ::= func_list(B) NK_COMMA func(C). ...@@ -414,10 +421,14 @@ func_list(A) ::= func_list(B) NK_COMMA func(C).
func(A) ::= function_name(B) NK_LP expression_list(C) NK_RP. { A = createFunctionNode(pCxt, &B, C); } func(A) ::= function_name(B) NK_LP expression_list(C) NK_RP. { A = createFunctionNode(pCxt, &B, C); }
/************************************************ create/drop topic ***************************************************/ /************************************************ create/drop topic ***************************************************/
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, C, NULL, NULL); } cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, A, &B, C); }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS DATABASE db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C, NULL); } cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS DATABASE db_name(C). { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, A, &B, &C, false); }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B)
WITH META AS DATABASE db_name(C). { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, A, &B, &C, true); }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B)
AS STABLE full_table_name(C). { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, A, &B, C, false); }
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B)
AS STABLE full_table_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, NULL, C); } WITH META AS STABLE full_table_name(C). { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, A, &B, C, true); }
cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); } cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); }
cmd ::= DROP CONSUMER GROUP exists_opt(A) cgroup_name(B) ON topic_name(C). { pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); } cmd ::= DROP CONSUMER GROUP exists_opt(A) cgroup_name(B) ON topic_name(C). { pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); }
...@@ -627,6 +638,16 @@ expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). ...@@ -627,6 +638,16 @@ expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C).
SToken s = getTokenFromRawExprNode(pCxt, B); 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))); A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C)));
} }
expression(A) ::= expression(B) NK_BITAND expression(C). {
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)));
}
expression(A) ::= expression(B) NK_BITOR expression(C). {
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)));
}
%type expression_list { SNodeList* } %type expression_list { SNodeList* }
%destructor expression_list { nodesDestroyList($$); } %destructor expression_list { nodesDestroyList($$); }
......
...@@ -1205,7 +1205,7 @@ SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) { ...@@ -1205,7 +1205,7 @@ SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) {
return (SNode*)pStmt; return (SNode*)pStmt;
} }
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) { SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
char password[TSDB_USET_PASSWORD_LEN] = {0}; char password[TSDB_USET_PASSWORD_LEN] = {0};
if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) {
...@@ -1215,6 +1215,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST ...@@ -1215,6 +1215,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
CHECK_OUT_OF_MEM(pStmt); CHECK_OUT_OF_MEM(pStmt);
COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName); COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName);
strcpy(pStmt->password, password); strcpy(pStmt->password, password);
pStmt->sysinfo = sysinfo;
return (SNode*)pStmt; return (SNode*)pStmt;
} }
...@@ -1226,15 +1227,26 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al ...@@ -1226,15 +1227,26 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al
SAlterUserStmt* pStmt = (SAlterUserStmt*)nodesMakeNode(QUERY_NODE_ALTER_USER_STMT); SAlterUserStmt* pStmt = (SAlterUserStmt*)nodesMakeNode(QUERY_NODE_ALTER_USER_STMT);
CHECK_OUT_OF_MEM(pStmt); CHECK_OUT_OF_MEM(pStmt);
COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName); COPY_STRING_FORM_ID_TOKEN(pStmt->useName, pUserName);
if (TSDB_ALTER_USER_PASSWD == alterType) { pStmt->alterType = alterType;
switch (alterType) {
case TSDB_ALTER_USER_PASSWD: {
char password[TSDB_USET_PASSWORD_LEN] = {0}; char password[TSDB_USET_PASSWORD_LEN] = {0};
if (!checkPassword(pCxt, pVal, password)) { if (!checkPassword(pCxt, pVal, password)) {
nodesDestroyNode((SNode*)pStmt); nodesDestroyNode((SNode*)pStmt);
return NULL; return NULL;
} }
strcpy(pStmt->password, password); strcpy(pStmt->password, password);
break;
}
case TSDB_ALTER_USER_ENABLE:
pStmt->enable = taosStr2Int8(pVal->z, NULL, 10);
break;
case TSDB_ALTER_USER_SYSINFO:
pStmt->sysinfo = taosStr2Int8(pVal->z, NULL, 10);
break;
default:
break;
} }
pStmt->alterType = alterType;
return (SNode*)pStmt; return (SNode*)pStmt;
} }
...@@ -1317,16 +1329,15 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt ...@@ -1317,16 +1329,15 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt
return (SNode*)pOptions; return (SNode*)pOptions;
} }
SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName, SToken* pTableName) { SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName)) { if (!checkDbName(pCxt, NULL, true) || !checkIndexName(pCxt, pIndexName)) {
return NULL; return NULL;
} }
SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT); SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT);
CHECK_OUT_OF_MEM(pStmt); CHECK_OUT_OF_MEM(pStmt);
pStmt->ignoreNotExists = ignoreNotExists; pStmt->ignoreNotExists = ignoreNotExists;
COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName); COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName);
COPY_STRING_FORM_ID_TOKEN(pStmt->tableName, pTableName);
return (SNode*)pStmt; return (SNode*)pStmt;
} }
...@@ -1346,22 +1357,40 @@ SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, cons ...@@ -1346,22 +1357,40 @@ SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, cons
return (SNode*)pStmt; return (SNode*)pStmt;
} }
SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
const SToken* pSubDbName, SNode* pRealTable) { SNode* pQuery) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT); SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT);
CHECK_OUT_OF_MEM(pStmt); CHECK_OUT_OF_MEM(pStmt);
COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName); COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName);
pStmt->ignoreExists = ignoreExists; pStmt->ignoreExists = ignoreExists;
if (NULL != pRealTable) { pStmt->pQuery = pQuery;
return (SNode*)pStmt;
}
SNode* createCreateTopicStmtUseDb(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
const SToken* pSubDbName, bool withMeta) {
CHECK_PARSER_STATUS(pCxt);
SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT);
CHECK_OUT_OF_MEM(pStmt);
COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName);
pStmt->ignoreExists = ignoreExists;
COPY_STRING_FORM_ID_TOKEN(pStmt->subDbName, pSubDbName);
pStmt->withMeta = withMeta;
return (SNode*)pStmt;
}
SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
SNode* pRealTable, bool withMeta) {
CHECK_PARSER_STATUS(pCxt);
SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT);
CHECK_OUT_OF_MEM(pStmt);
COPY_STRING_FORM_ID_TOKEN(pStmt->topicName, pTopicName);
pStmt->ignoreExists = ignoreExists;
pStmt->withMeta = withMeta;
strcpy(pStmt->subDbName, ((SRealTableNode*)pRealTable)->table.dbName); strcpy(pStmt->subDbName, ((SRealTableNode*)pRealTable)->table.dbName);
strcpy(pStmt->subSTbName, ((SRealTableNode*)pRealTable)->table.tableName); strcpy(pStmt->subSTbName, ((SRealTableNode*)pRealTable)->table.tableName);
nodesDestroyNode(pRealTable); nodesDestroyNode(pRealTable);
} else if (NULL != pSubDbName) {
COPY_STRING_FORM_ID_TOKEN(pStmt->subDbName, pSubDbName);
} else {
pStmt->pQuery = pQuery;
}
return (SNode*)pStmt; return (SNode*)pStmt;
} }
......
...@@ -79,6 +79,7 @@ static SKeyword keywordTable[] = { ...@@ -79,6 +79,7 @@ static SKeyword keywordTable[] = {
{"DOUBLE", TK_DOUBLE}, {"DOUBLE", TK_DOUBLE},
{"DROP", TK_DROP}, {"DROP", TK_DROP},
{"DURATION", TK_DURATION}, {"DURATION", TK_DURATION},
{"ENABLE", TK_ENABLE},
{"EXISTS", TK_EXISTS}, {"EXISTS", TK_EXISTS},
{"EXPLAIN", TK_EXPLAIN}, {"EXPLAIN", TK_EXPLAIN},
{"EVERY", TK_EVERY}, {"EVERY", TK_EVERY},
...@@ -120,6 +121,7 @@ static SKeyword keywordTable[] = { ...@@ -120,6 +121,7 @@ static SKeyword keywordTable[] = {
{"MAXROWS", TK_MAXROWS}, {"MAXROWS", TK_MAXROWS},
{"MAX_DELAY", TK_MAX_DELAY}, {"MAX_DELAY", TK_MAX_DELAY},
{"MERGE", TK_MERGE}, {"MERGE", TK_MERGE},
{"META", TK_META},
{"MINROWS", TK_MINROWS}, {"MINROWS", TK_MINROWS},
{"MINUS", TK_MINUS}, {"MINUS", TK_MINUS},
{"MNODE", TK_MNODE}, {"MNODE", TK_MNODE},
...@@ -146,7 +148,7 @@ static SKeyword keywordTable[] = { ...@@ -146,7 +148,7 @@ static SKeyword keywordTable[] = {
{"PORT", TK_PORT}, {"PORT", TK_PORT},
{"PPS", TK_PPS}, {"PPS", TK_PPS},
{"PRECISION", TK_PRECISION}, {"PRECISION", TK_PRECISION},
{"PRIVILEGE", TK_PRIVILEGE}, // {"PRIVILEGE", TK_PRIVILEGE},
{"PREV", TK_PREV}, {"PREV", TK_PREV},
{"QNODE", TK_QNODE}, {"QNODE", TK_QNODE},
{"QNODES", TK_QNODES}, {"QNODES", TK_QNODES},
...@@ -187,6 +189,7 @@ static SKeyword keywordTable[] = { ...@@ -187,6 +189,7 @@ static SKeyword keywordTable[] = {
{"STREAMS", TK_STREAMS}, {"STREAMS", TK_STREAMS},
{"STRICT", TK_STRICT}, {"STRICT", TK_STRICT},
{"SYNCDB", TK_SYNCDB}, {"SYNCDB", TK_SYNCDB},
{"SYSINFO", TK_SYSINFO},
{"TABLE", TK_TABLE}, {"TABLE", TK_TABLE},
{"TABLES", TK_TABLES}, {"TABLES", TK_TABLES},
{"TAG", TK_TAG}, {"TAG", TK_TAG},
...@@ -222,6 +225,7 @@ static SKeyword keywordTable[] = { ...@@ -222,6 +225,7 @@ static SKeyword keywordTable[] = {
{"WATERMARK", TK_WATERMARK}, {"WATERMARK", TK_WATERMARK},
{"WHERE", TK_WHERE}, {"WHERE", TK_WHERE},
{"WINDOW_CLOSE", TK_WINDOW_CLOSE}, {"WINDOW_CLOSE", TK_WINDOW_CLOSE},
{"WITH", TK_WITH},
{"WRITE", TK_WRITE}, {"WRITE", TK_WRITE},
{"_C0", TK_ROWTS}, {"_C0", TK_ROWTS},
{"_QENDTS", TK_QENDTS}, {"_QENDTS", TK_QENDTS},
......
...@@ -984,6 +984,17 @@ static EDealRes translateJsonOperator(STranslateContext* pCxt, SOperatorNode* pO ...@@ -984,6 +984,17 @@ static EDealRes translateJsonOperator(STranslateContext* pCxt, SOperatorNode* pO
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
static EDealRes translateBitwiseOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType;
SDataType rdt = ((SExprNode*)(pOp->pRight))->resType;
if (TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_BLOB == rdt.type) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
}
pOp->node.resType.type = TSDB_DATA_TYPE_BIGINT;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
return DEAL_RES_CONTINUE;
}
static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode** pOpRef) { static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode** pOpRef) {
SOperatorNode* pOp = *pOpRef; SOperatorNode* pOp = *pOpRef;
...@@ -1002,6 +1013,8 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode** pOpRe ...@@ -1002,6 +1013,8 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode** pOpRe
return translateComparisonOperator(pCxt, pOp); return translateComparisonOperator(pCxt, pOp);
} else if (nodesIsJsonOp(pOp)) { } else if (nodesIsJsonOp(pOp)) {
return translateJsonOperator(pCxt, pOp); return translateJsonOperator(pCxt, pOp);
} else if (nodesIsBitwiseOp(pOp)) {
return translateBitwiseOperator(pCxt, pOp);
} }
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
...@@ -2352,6 +2365,8 @@ static SNode* createGroupingSet(SNode* pExpr) { ...@@ -2352,6 +2365,8 @@ static SNode* createGroupingSet(SNode* pExpr) {
return (SNode*)pGroupingSet; return (SNode*)pGroupingSet;
} }
// from: select unique(expr), col1 + col2 from t where_clause partition_by_clause order_by_clause ...
// to: select expr, first(col1) + first(col2) from t where_clause partition_by_clause group by expr order_by_clause ...
static int32_t rewriteUniqueStmt(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t rewriteUniqueStmt(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (!pSelect->hasUniqueFunc) { if (!pSelect->hasUniqueFunc) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -2417,6 +2432,8 @@ static SNode* createOrderByExpr(STranslateContext* pCxt) { ...@@ -2417,6 +2432,8 @@ static SNode* createOrderByExpr(STranslateContext* pCxt) {
return (SNode*)pOrder; return (SNode*)pOrder;
} }
// from: select tail(expr, k, f) from t where_clause partition_by_clause order_by_clause ...
// to: select expr from t where_clause order by _rowts desc limit k offset f
static int32_t rewriteTailStmt(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t rewriteTailStmt(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (!pSelect->hasTailFunc) { if (!pSelect->hasTailFunc) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -3685,7 +3702,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt ...@@ -3685,7 +3702,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
strcpy(createReq.user, pStmt->useName); strcpy(createReq.user, pStmt->useName);
createReq.createType = 0; createReq.createType = 0;
createReq.superUser = 0; createReq.superUser = 0;
createReq.sysInfo = 1; createReq.sysInfo = pStmt->sysinfo;
createReq.enable = 1; createReq.enable = 1;
strcpy(createReq.pass, pStmt->password); strcpy(createReq.pass, pStmt->password);
...@@ -3697,6 +3714,8 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt ...@@ -3697,6 +3714,8 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
strcpy(alterReq.user, pStmt->useName); strcpy(alterReq.user, pStmt->useName);
alterReq.alterType = pStmt->alterType; alterReq.alterType = pStmt->alterType;
alterReq.superUser = 0; alterReq.superUser = 0;
alterReq.enable = pStmt->enable;
alterReq.sysInfo = pStmt->sysinfo;
strcpy(alterReq.pass, pStmt->password); strcpy(alterReq.pass, pStmt->password);
if (NULL != pCxt->pParseCxt->db) { if (NULL != pCxt->pParseCxt->db) {
strcpy(alterReq.dbname, pCxt->pParseCxt->db); strcpy(alterReq.dbname, pCxt->pParseCxt->db);
...@@ -3851,36 +3870,11 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p ...@@ -3851,36 +3870,11 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p
} }
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) { static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {
SEncoder encoder = {0}; SMDropSmaReq dropSmaReq = {0};
int32_t contLen = 0; SName name;
SVDropTSmaReq dropSmaReq = {0}; tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), dropSmaReq.name);
strcpy(dropSmaReq.indexName, pStmt->indexName); dropSmaReq.igNotExists = pStmt->ignoreNotExists;
return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
int32_t ret = 0;
tEncodeSize(tEncodeSVDropTSmaReq, &dropSmaReq, contLen, ret);
if (ret < 0) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_VND_DROP_SMA;
pCxt->pCmdMsg->msgLen = contLen;
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
void* pBuf = pCxt->pCmdMsg->pMsg;
if (tEncodeSVDropTSmaReq(&encoder, &dropSmaReq) < 0) {
tEncoderClear(&encoder);
return TSDB_CODE_OUT_OF_MEMORY;
}
tEncoderClear(&encoder);
return TSDB_CODE_SUCCESS;
} }
static int16_t getCreateComponentNodeMsgType(ENodeType type) { static int16_t getCreateComponentNodeMsgType(ENodeType type) {
...@@ -3932,6 +3926,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS ...@@ -3932,6 +3926,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->topicName, strlen(pStmt->topicName)); tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->topicName, strlen(pStmt->topicName));
tNameGetFullDbName(&name, pReq->name); tNameGetFullDbName(&name, pReq->name);
pReq->igExists = pStmt->ignoreExists; pReq->igExists = pStmt->ignoreExists;
pReq->withMeta = pStmt->withMeta;
pReq->sql = strdup(pCxt->pParseCxt->pSql); pReq->sql = strdup(pCxt->pParseCxt->pSql);
if (NULL == pReq->sql) { if (NULL == pReq->sql) {
...@@ -4287,6 +4282,11 @@ static int32_t translateSplitVgroup(STranslateContext* pCxt, SSplitVgroupStmt* p ...@@ -4287,6 +4282,11 @@ static int32_t translateSplitVgroup(STranslateContext* pCxt, SSplitVgroupStmt* p
return buildCmdMsg(pCxt, TDMT_MND_SPLIT_VGROUP, (FSerializeFunc)tSerializeSSplitVgroupReq, &req); return buildCmdMsg(pCxt, TDMT_MND_SPLIT_VGROUP, (FSerializeFunc)tSerializeSSplitVgroupReq, &req);
} }
static int32_t translateShowVariables(STranslateContext* pCxt, SShowStmt* pStmt) {
SShowVariablesReq req = {0};
return buildCmdMsg(pCxt, TDMT_MND_SHOW_VARIABLES, (FSerializeFunc)tSerializeSShowVariablesReq, &req);
}
static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateDatabaseStmt* pStmt) { static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateDatabaseStmt* pStmt) {
pStmt->pCfg = taosMemoryCalloc(1, sizeof(SDbCfgInfo)); pStmt->pCfg = taosMemoryCalloc(1, sizeof(SDbCfgInfo));
if (NULL == pStmt->pCfg) { if (NULL == pStmt->pCfg) {
...@@ -4428,6 +4428,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { ...@@ -4428,6 +4428,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case QUERY_NODE_SPLIT_VGROUP_STMT: case QUERY_NODE_SPLIT_VGROUP_STMT:
code = translateSplitVgroup(pCxt, (SSplitVgroupStmt*)pNode); code = translateSplitVgroup(pCxt, (SSplitVgroupStmt*)pNode);
break; break;
case QUERY_NODE_SHOW_VARIABLES_STMT:
code = translateShowVariables(pCxt, (SShowStmt*)pNode);
break;
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
code = translateShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pNode); code = translateShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pNode);
break; break;
......
此差异已折叠。
...@@ -121,7 +121,7 @@ TEST_F(ParserInitialATest, alterSTable) { ...@@ -121,7 +121,7 @@ TEST_F(ParserInitialATest, alterSTable) {
int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname); int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname);
expect.name[len] = '\0'; expect.name[len] = '\0';
expect.alterType = alterType; expect.alterType = alterType;
// expect.ttl = ttl; // expect.ttl = ttl;
if (nullptr != pComment) { if (nullptr != pComment) {
expect.comment = strdup(pComment); expect.comment = strdup(pComment);
expect.commentLen = strlen(pComment); expect.commentLen = strlen(pComment);
...@@ -180,9 +180,9 @@ TEST_F(ParserInitialATest, alterSTable) { ...@@ -180,9 +180,9 @@ TEST_F(ParserInitialATest, alterSTable) {
tFreeSMAltertbReq(&req); tFreeSMAltertbReq(&req);
}); });
// setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, nullptr, 10); // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, nullptr, 10);
// run("ALTER TABLE st1 TTL 10"); // run("ALTER TABLE st1 TTL 10");
// clearAlterStbReq(); // clearAlterStbReq();
setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test"); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test");
run("ALTER TABLE st1 COMMENT 'test'"); run("ALTER TABLE st1 COMMENT 'test'");
...@@ -381,9 +381,48 @@ TEST_F(ParserInitialATest, alterTableSemanticCheck) { ...@@ -381,9 +381,48 @@ TEST_F(ParserInitialATest, alterTableSemanticCheck) {
TEST_F(ParserInitialATest, alterUser) { TEST_F(ParserInitialATest, alterUser) {
useDb("root", "test"); useDb("root", "test");
run("ALTER user wxy PASS '123456'"); SAlterUserReq expect = {0};
run("ALTER user wxy privilege 'write'"); auto clearAlterUserReq = [&]() { memset(&expect, 0, sizeof(SAlterUserReq)); };
auto setAlterUserReq = [&](const char* pUser, int8_t alterType, const char* pPass = nullptr, int8_t sysInfo = 0,
int8_t enable = 0) {
strcpy(expect.user, pUser);
expect.alterType = alterType;
expect.superUser = 0;
expect.sysInfo = sysInfo;
expect.enable = enable;
if (nullptr != pPass) {
strcpy(expect.pass, pPass);
}
strcpy(expect.dbname, "test");
};
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_USER_STMT);
SAlterUserReq req = {0};
ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSAlterUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(req.alterType, expect.alterType);
ASSERT_EQ(req.superUser, expect.superUser);
ASSERT_EQ(req.sysInfo, expect.sysInfo);
ASSERT_EQ(req.enable, expect.enable);
ASSERT_EQ(std::string(req.user), std::string(expect.user));
ASSERT_EQ(std::string(req.pass), std::string(expect.pass));
ASSERT_EQ(std::string(req.dbname), std::string(expect.dbname));
});
setAlterUserReq("wxy", TSDB_ALTER_USER_PASSWD, "123456");
run("ALTER USER wxy PASS '123456'");
clearAlterUserReq();
setAlterUserReq("wxy", TSDB_ALTER_USER_ENABLE, nullptr, 0, 1);
run("ALTER USER wxy ENABLE 1");
clearAlterUserReq();
setAlterUserReq("wxy", TSDB_ALTER_USER_SYSINFO, nullptr, 1);
run("ALTER USER wxy SYSINFO 1");
clearAlterUserReq();
} }
TEST_F(ParserInitialATest, balanceVgroup) { TEST_F(ParserInitialATest, balanceVgroup) {
......
...@@ -370,7 +370,7 @@ TEST_F(ParserInitialCTest, createStable) { ...@@ -370,7 +370,7 @@ TEST_F(ParserInitialCTest, createStable) {
expect.delay2 = delay2; expect.delay2 = delay2;
expect.watermark1 = watermark1; expect.watermark1 = watermark1;
expect.watermark2 = watermark2; expect.watermark2 = watermark2;
// expect.ttl = ttl; // expect.ttl = ttl;
if (nullptr != pComment) { if (nullptr != pComment) {
expect.comment = strdup(pComment); expect.comment = strdup(pComment);
expect.commentLen = strlen(pComment); expect.commentLen = strlen(pComment);
...@@ -414,7 +414,7 @@ TEST_F(ParserInitialCTest, createStable) { ...@@ -414,7 +414,7 @@ TEST_F(ParserInitialCTest, createStable) {
ASSERT_EQ(req.ttl, expect.ttl); ASSERT_EQ(req.ttl, expect.ttl);
ASSERT_EQ(req.numOfColumns, expect.numOfColumns); ASSERT_EQ(req.numOfColumns, expect.numOfColumns);
ASSERT_EQ(req.numOfTags, expect.numOfTags); ASSERT_EQ(req.numOfTags, expect.numOfTags);
// ASSERT_EQ(req.commentLen, expect.commentLen); // ASSERT_EQ(req.commentLen, expect.commentLen);
ASSERT_EQ(req.ast1Len, expect.ast1Len); ASSERT_EQ(req.ast1Len, expect.ast1Len);
ASSERT_EQ(req.ast2Len, expect.ast2Len); ASSERT_EQ(req.ast2Len, expect.ast2Len);
...@@ -621,10 +621,11 @@ TEST_F(ParserInitialCTest, createTopic) { ...@@ -621,10 +621,11 @@ TEST_F(ParserInitialCTest, createTopic) {
auto clearCreateTopicReq = [&]() { memset(&expect, 0, sizeof(SCMCreateTopicReq)); }; auto clearCreateTopicReq = [&]() { memset(&expect, 0, sizeof(SCMCreateTopicReq)); };
auto setCreateTopicReqFunc = [&](const char* pTopicName, int8_t igExists, const char* pSql, const char* pAst, auto setCreateTopicReqFunc = [&](const char* pTopicName, int8_t igExists, const char* pSql, const char* pAst,
const char* pDbName = nullptr, const char* pTbname = nullptr) { const char* pDbName = nullptr, const char* pTbname = nullptr, int8_t withMeta = 0) {
snprintf(expect.name, sizeof(expect.name), "0.%s", pTopicName); snprintf(expect.name, sizeof(expect.name), "0.%s", pTopicName);
expect.igExists = igExists; expect.igExists = igExists;
expect.sql = (char*)pSql; expect.sql = (char*)pSql;
expect.withMeta = withMeta;
if (nullptr != pTbname) { if (nullptr != pTbname) {
expect.subType = TOPIC_SUB_TYPE__TABLE; expect.subType = TOPIC_SUB_TYPE__TABLE;
snprintf(expect.subStbName, sizeof(expect.subStbName), "0.%s.%s", pDbName, pTbname); snprintf(expect.subStbName, sizeof(expect.subStbName), "0.%s.%s", pDbName, pTbname);
...@@ -647,6 +648,7 @@ TEST_F(ParserInitialCTest, createTopic) { ...@@ -647,6 +648,7 @@ TEST_F(ParserInitialCTest, createTopic) {
ASSERT_EQ(req.igExists, expect.igExists); ASSERT_EQ(req.igExists, expect.igExists);
ASSERT_EQ(req.subType, expect.subType); ASSERT_EQ(req.subType, expect.subType);
ASSERT_EQ(std::string(req.sql), std::string(expect.sql)); ASSERT_EQ(std::string(req.sql), std::string(expect.sql));
ASSERT_EQ(req.withMeta, expect.withMeta);
switch (expect.subType) { switch (expect.subType) {
case TOPIC_SUB_TYPE__DB: case TOPIC_SUB_TYPE__DB:
ASSERT_EQ(std::string(req.subDbName), std::string(expect.subDbName)); ASSERT_EQ(std::string(req.subDbName), std::string(expect.subDbName));
...@@ -675,15 +677,55 @@ TEST_F(ParserInitialCTest, createTopic) { ...@@ -675,15 +677,55 @@ TEST_F(ParserInitialCTest, createTopic) {
run("CREATE TOPIC tp1 AS DATABASE test"); run("CREATE TOPIC tp1 AS DATABASE test");
clearCreateTopicReq(); clearCreateTopicReq();
setCreateTopicReqFunc("tp1", 0, "create topic tp1 with meta as database test", nullptr, "test", nullptr, 1);
run("CREATE TOPIC tp1 WITH META AS DATABASE test");
clearCreateTopicReq();
setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as stable st1", nullptr, "test", "st1"); setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as stable st1", nullptr, "test", "st1");
run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1"); run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1");
clearCreateTopicReq(); clearCreateTopicReq();
setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 with meta as stable st1", nullptr, "test", "st1", 1);
run("CREATE TOPIC IF NOT EXISTS tp1 WITH META AS STABLE st1");
clearCreateTopicReq();
} }
TEST_F(ParserInitialCTest, createUser) { TEST_F(ParserInitialCTest, createUser) {
useDb("root", "test"); useDb("root", "test");
SCreateUserReq expect = {0};
auto clearCreateUserReq = [&]() { memset(&expect, 0, sizeof(SCreateUserReq)); };
auto setCreateUserReq = [&](const char* pUser, const char* pPass, int8_t sysInfo = 1) {
strcpy(expect.user, pUser);
strcpy(expect.pass, pPass);
expect.createType = 0;
expect.superUser = 0;
expect.sysInfo = sysInfo;
expect.enable = 1;
};
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_USER_STMT);
SCreateUserReq req = {0};
ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSCreateUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(req.createType, expect.createType);
ASSERT_EQ(req.superUser, expect.superUser);
ASSERT_EQ(req.sysInfo, expect.sysInfo);
ASSERT_EQ(req.enable, expect.enable);
ASSERT_EQ(std::string(req.user), std::string(expect.user));
ASSERT_EQ(std::string(req.pass), std::string(expect.pass));
});
setCreateUserReq("wxy", "123456");
run("CREATE USER wxy PASS '123456'"); run("CREATE USER wxy PASS '123456'");
clearCreateUserReq();
setCreateUserReq("wxy1", "a123456", 1);
run("CREATE USER wxy1 PASS 'a123456' SYSINFO 1");
clearCreateUserReq();
} }
} // namespace ParserTest } // namespace ParserTest
...@@ -132,7 +132,31 @@ TEST_F(ParserInitialDTest, dropDnode) { ...@@ -132,7 +132,31 @@ TEST_F(ParserInitialDTest, dropDnode) {
TEST_F(ParserInitialDTest, dropIndex) { TEST_F(ParserInitialDTest, dropIndex) {
useDb("root", "test"); useDb("root", "test");
run("DROP index index1 on t1"); SMDropSmaReq expect = {0};
auto clearDropSmaReq = [&]() { memset(&expect, 0, sizeof(SMDropSmaReq)); };
auto setDropSmaReq = [&](const char* pName, int8_t igNotExists = 0) {
sprintf(expect.name, "0.test.%s", pName);
expect.igNotExists = igNotExists;
};
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_DROP_INDEX_STMT);
SMDropSmaReq req = {0};
ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSMDropSmaReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(std::string(req.name), std::string(expect.name));
ASSERT_EQ(req.igNotExists, expect.igNotExists);
});
setDropSmaReq("index1");
run("DROP INDEX index1");
clearDropSmaReq();
setDropSmaReq("index2", 1);
run("DROP INDEX IF EXISTS index2");
clearDropSmaReq();
} }
TEST_F(ParserInitialDTest, dropMnode) { TEST_F(ParserInitialDTest, dropMnode) {
......
...@@ -58,6 +58,8 @@ TEST_F(ParserSelectTest, expression) { ...@@ -58,6 +58,8 @@ TEST_F(ParserSelectTest, expression) {
run("SELECT ts > 0, c1 < 20 and c2 = 'qaz' FROM t1"); run("SELECT ts > 0, c1 < 20 and c2 = 'qaz' FROM t1");
run("SELECT ts > 0, c1 between 10 and 20 and c2 = 'qaz' FROM t1"); run("SELECT ts > 0, c1 between 10 and 20 and c2 = 'qaz' FROM t1");
run("SELECT c1 | 10, c2 & 20, c4 | c5 FROM t1");
} }
TEST_F(ParserSelectTest, condition) { TEST_F(ParserSelectTest, condition) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册