diff --git a/include/common/systable.h b/include/common/systable.h index 34d46953f6..615b0e4656 100644 --- a/include/common/systable.h +++ b/include/common/systable.h @@ -56,6 +56,7 @@ extern "C" { #define TSDB_INS_TABLE_GRANTS_FULL "ins_grants_full" #define TSDB_INS_TABLE_GRANTS_LOGS "ins_grants_logs" #define TSDB_INS_TABLE_MACHINES "ins_machines" +#define TSDB_INS_TABLE_ENCRYPTIONS "ins_encryptions" #define TSDB_INS_TABLE_TSMAS "ins_tsmas" #define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" diff --git a/include/common/tglobal.h b/include/common/tglobal.h index c2cb27c8b6..00ed8bfb8e 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -29,6 +29,17 @@ extern "C" { #define SLOW_LOG_TYPE_OTHERS 0x4 #define SLOW_LOG_TYPE_ALL 0xFFFFFFFF +typedef enum { + DND_CA_SM4 = 1, +} EEncryptAlgor; + +typedef enum { + DND_CS_TSDB = 1, + DND_CS_VNODE_WAL = 2, + DND_CS_SDB = 4, + DND_CS_MNODE_WAL = 8, +} EEncryptScope; + // cluster extern char tsFirst[]; extern char tsSecond[]; @@ -39,6 +50,12 @@ extern uint16_t tsServerPort; extern int32_t tsVersion; extern int32_t tsStatusInterval; extern int32_t tsNumOfSupportVnodes; +extern char tsEncryptAlgorithm[]; +extern char tsEncryptScope[]; +extern EEncryptAlgor tsiEncryptAlgorithm; +extern EEncryptScope tsiEncryptScope; +//extern char tsAuthCode[]; +extern char tsEncryptKey[]; // common extern int32_t tsMaxShellConns; @@ -94,8 +111,6 @@ extern char tsSnodeAddress[]; // 127.0.0.1:873 // mnode extern int64_t tsMndSdbWriteDelta; extern int64_t tsMndLogRetention; -extern int8_t tsGrant; -extern int32_t tsMndGrantMode; extern bool tsMndSkipGrant; extern bool tsEnableWhiteList; @@ -104,6 +119,11 @@ extern int64_t tsDndStart; extern int64_t tsDndStartOsUptime; extern int64_t tsDndUpTime; +// dnode misc +extern uint32_t tsEncryptionKeyChksum; +extern int8_t tsEncryptionKeyStat; +extern int8_t tsGrant; + // monitor extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; diff --git a/include/common/tgrant.h b/include/common/tgrant.h index ac0d3155c7..c1e37787c2 100644 --- a/include/common/tgrant.h +++ b/include/common/tgrant.h @@ -58,9 +58,11 @@ typedef enum { TSDB_GRANT_BACKUP_RESTORE, } EGrantType; +int32_t checkAndGetCryptKey(const char *encryptCode, const char *machineId, char **key); +int32_t generateEncryptCode(const char *key, const char *machineId, char **encryptCode); int32_t grantCheck(EGrantType grant); int32_t grantCheckExpire(EGrantType grant); -char* tGetMachineId(); +char *tGetMachineId(); // #ifndef GRANTS_CFG #ifdef TD_ENTERPRISE diff --git a/include/common/tmsg.h b/include/common/tmsg.h index f7db44fea1..73399d99d1 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -154,6 +154,7 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_GRANTS_LOGS, TSDB_MGMT_TABLE_MACHINES, TSDB_MGMT_TABLE_ARBGROUP, + TSDB_MGMT_TABLE_ENCRYPTIONS, TSDB_MGMT_TABLE_MAX, } EShowType; @@ -374,6 +375,7 @@ typedef enum ENodeType { QUERY_NODE_SHOW_GRANTS_FULL_STMT, QUERY_NODE_SHOW_GRANTS_LOGS_STMT, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT, + QUERY_NODE_SHOW_ENCRYPTIONS_STMT, QUERY_NODE_SHOW_TSMAS_STMT, QUERY_NODE_CREATE_TSMA_STMT, QUERY_NODE_SHOW_CREATE_TSMA_STMT, @@ -1247,6 +1249,7 @@ typedef struct { int32_t sqlLen; char* sql; int8_t withArbitrator; + int8_t encryptAlgorithm; } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); @@ -1405,6 +1408,7 @@ typedef struct { int8_t replications; int8_t strict; int8_t cacheLast; + int8_t encryptAlgorithm; int32_t s3ChunkSize; int32_t s3KeepLocal; int8_t s3Compact; @@ -1605,13 +1609,15 @@ void tFreeSFuncInfo(SFuncInfo* pInfo); void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp* pRsp); typedef struct { - int32_t statusInterval; - int64_t checkTime; // 1970-01-01 00:00:00.000 - char timezone[TD_TIMEZONE_LEN]; // tsTimezone - char locale[TD_LOCALE_LEN]; // tsLocale - char charset[TD_LOCALE_LEN]; // tsCharset - int8_t ttlChangeOnWrite; - int8_t enableWhiteList; + int32_t statusInterval; + int64_t checkTime; // 1970-01-01 00:00:00.000 + char timezone[TD_TIMEZONE_LEN]; // tsTimezone + char locale[TD_LOCALE_LEN]; // tsLocale + char charset[TD_LOCALE_LEN]; // tsCharset + int8_t ttlChangeOnWrite; + int8_t enableWhiteList; + int8_t encryptionKeyStat; + uint32_t encryptionKeyChksum; } SClusterCfg; typedef struct { @@ -1823,6 +1829,7 @@ typedef struct { int8_t learnerSelfIndex; SReplica learnerReplicas[TSDB_MAX_LEARNER_REPLICA]; int32_t changeVersion; + int8_t encryptAlgorithm; } SCreateVnodeReq; int32_t tSerializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pReq); diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index d897437d1d..a5a3bd5ee0 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -106,6 +106,7 @@ TD_DEF_MSG_TYPE(TDMT_DND_ALTER_MNODE_TYPE, "dnode-alter-mnode-type", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_ALTER_VNODE_TYPE, "dnode-alter-vnode-type", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, "dnode-check-vnode-learner-catchup", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_DND_CREATE_ENCRYPT_KEY, "create-encrypt-key", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_MAX_MSG, "dnd-max", NULL, NULL) TD_CLOSE_MSG_SEG(TDMT_END_DND_MSG) @@ -220,6 +221,7 @@ TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_TIMER, "compact-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STREAM_REQ_CHKPT, "stream-req-checkpoint", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_CLUSTER, "config-cluster", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ENCRYPT_KEY, "create-encrypt-key", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_S3MIGRATE_DB, "s3migrate-db", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_S3MIGRATE_DB_TIMER, "s3migrate-db-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 23c0358a6e..e619edf972 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,378 +16,381 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_USER 35 -#define TK_ENABLE 36 -#define TK_NK_INTEGER 37 -#define TK_SYSINFO 38 -#define TK_ADD 39 -#define TK_DROP 40 -#define TK_GRANT 41 -#define TK_ON 42 -#define TK_TO 43 -#define TK_REVOKE 44 -#define TK_FROM 45 -#define TK_SUBSCRIBE 46 -#define TK_READ 47 -#define TK_WRITE 48 -#define TK_NK_DOT 49 -#define TK_WITH 50 -#define TK_DNODE 51 -#define TK_PORT 52 -#define TK_DNODES 53 -#define TK_RESTORE 54 -#define TK_NK_IPTOKEN 55 -#define TK_FORCE 56 -#define TK_UNSAFE 57 -#define TK_CLUSTER 58 -#define TK_LOCAL 59 -#define TK_QNODE 60 -#define TK_BNODE 61 -#define TK_SNODE 62 -#define TK_MNODE 63 -#define TK_VNODE 64 -#define TK_DATABASE 65 -#define TK_USE 66 -#define TK_FLUSH 67 -#define TK_TRIM 68 -#define TK_S3MIGRATE 69 -#define TK_COMPACT 70 -#define TK_IF 71 -#define TK_NOT 72 -#define TK_EXISTS 73 -#define TK_BUFFER 74 -#define TK_CACHEMODEL 75 -#define TK_CACHESIZE 76 -#define TK_COMP 77 -#define TK_DURATION 78 -#define TK_NK_VARIABLE 79 -#define TK_MAXROWS 80 -#define TK_MINROWS 81 -#define TK_KEEP 82 -#define TK_PAGES 83 -#define TK_PAGESIZE 84 -#define TK_TSDB_PAGESIZE 85 -#define TK_PRECISION 86 -#define TK_REPLICA 87 -#define TK_VGROUPS 88 -#define TK_SINGLE_STABLE 89 -#define TK_RETENTIONS 90 -#define TK_SCHEMALESS 91 -#define TK_WAL_LEVEL 92 -#define TK_WAL_FSYNC_PERIOD 93 -#define TK_WAL_RETENTION_PERIOD 94 -#define TK_WAL_RETENTION_SIZE 95 -#define TK_WAL_ROLL_PERIOD 96 -#define TK_WAL_SEGMENT_SIZE 97 -#define TK_STT_TRIGGER 98 -#define TK_TABLE_PREFIX 99 -#define TK_TABLE_SUFFIX 100 -#define TK_S3_CHUNKSIZE 101 -#define TK_S3_KEEPLOCAL 102 -#define TK_S3_COMPACT 103 -#define TK_KEEP_TIME_OFFSET 104 -#define TK_NK_COLON 105 -#define TK_BWLIMIT 106 -#define TK_START 107 -#define TK_TIMESTAMP 108 -#define TK_END 109 -#define TK_TABLE 110 -#define TK_NK_LP 111 -#define TK_NK_RP 112 -#define TK_STABLE 113 -#define TK_COLUMN 114 -#define TK_MODIFY 115 -#define TK_RENAME 116 -#define TK_TAG 117 -#define TK_SET 118 -#define TK_NK_EQ 119 -#define TK_USING 120 -#define TK_TAGS 121 -#define TK_BOOL 122 -#define TK_TINYINT 123 -#define TK_SMALLINT 124 -#define TK_INT 125 -#define TK_INTEGER 126 -#define TK_BIGINT 127 -#define TK_FLOAT 128 -#define TK_DOUBLE 129 -#define TK_BINARY 130 -#define TK_NCHAR 131 -#define TK_UNSIGNED 132 -#define TK_JSON 133 -#define TK_VARCHAR 134 -#define TK_MEDIUMBLOB 135 -#define TK_BLOB 136 -#define TK_VARBINARY 137 -#define TK_GEOMETRY 138 -#define TK_DECIMAL 139 -#define TK_COMMENT 140 -#define TK_MAX_DELAY 141 -#define TK_WATERMARK 142 -#define TK_ROLLUP 143 -#define TK_TTL 144 -#define TK_SMA 145 -#define TK_DELETE_MARK 146 -#define TK_FIRST 147 -#define TK_LAST 148 -#define TK_SHOW 149 -#define TK_PRIVILEGES 150 -#define TK_DATABASES 151 -#define TK_TABLES 152 -#define TK_STABLES 153 -#define TK_MNODES 154 -#define TK_QNODES 155 -#define TK_ARBGROUPS 156 -#define TK_FUNCTIONS 157 -#define TK_INDEXES 158 -#define TK_ACCOUNTS 159 -#define TK_APPS 160 -#define TK_CONNECTIONS 161 -#define TK_LICENCES 162 -#define TK_GRANTS 163 -#define TK_FULL 164 -#define TK_LOGS 165 -#define TK_MACHINES 166 -#define TK_QUERIES 167 -#define TK_SCORES 168 -#define TK_TOPICS 169 -#define TK_VARIABLES 170 -#define TK_BNODES 171 -#define TK_SNODES 172 -#define TK_TRANSACTIONS 173 -#define TK_DISTRIBUTED 174 -#define TK_CONSUMERS 175 -#define TK_SUBSCRIPTIONS 176 -#define TK_VNODES 177 -#define TK_ALIVE 178 -#define TK_VIEWS 179 -#define TK_VIEW 180 -#define TK_COMPACTS 181 -#define TK_NORMAL 182 -#define TK_CHILD 183 -#define TK_LIKE 184 -#define TK_TBNAME 185 -#define TK_QTAGS 186 -#define TK_AS 187 -#define TK_SYSTEM 188 -#define TK_TSMA 189 -#define TK_INTERVAL 190 -#define TK_RECURSIVE 191 -#define TK_TSMAS 192 -#define TK_FUNCTION 193 -#define TK_INDEX 194 -#define TK_COUNT 195 -#define TK_LAST_ROW 196 -#define TK_META 197 -#define TK_ONLY 198 -#define TK_TOPIC 199 -#define TK_CONSUMER 200 -#define TK_GROUP 201 -#define TK_DESC 202 -#define TK_DESCRIBE 203 -#define TK_RESET 204 -#define TK_QUERY 205 -#define TK_CACHE 206 -#define TK_EXPLAIN 207 -#define TK_ANALYZE 208 -#define TK_VERBOSE 209 -#define TK_NK_BOOL 210 -#define TK_RATIO 211 -#define TK_NK_FLOAT 212 -#define TK_OUTPUTTYPE 213 -#define TK_AGGREGATE 214 -#define TK_BUFSIZE 215 -#define TK_LANGUAGE 216 -#define TK_REPLACE 217 -#define TK_STREAM 218 -#define TK_INTO 219 -#define TK_PAUSE 220 -#define TK_RESUME 221 -#define TK_PRIMARY 222 -#define TK_KEY 223 -#define TK_TRIGGER 224 -#define TK_AT_ONCE 225 -#define TK_WINDOW_CLOSE 226 -#define TK_IGNORE 227 -#define TK_EXPIRED 228 -#define TK_FILL_HISTORY 229 -#define TK_UPDATE 230 -#define TK_SUBTABLE 231 -#define TK_UNTREATED 232 -#define TK_KILL 233 -#define TK_CONNECTION 234 -#define TK_TRANSACTION 235 -#define TK_BALANCE 236 -#define TK_VGROUP 237 -#define TK_LEADER 238 -#define TK_MERGE 239 -#define TK_REDISTRIBUTE 240 -#define TK_SPLIT 241 -#define TK_DELETE 242 -#define TK_INSERT 243 -#define TK_NK_BIN 244 -#define TK_NK_HEX 245 -#define TK_NULL 246 -#define TK_NK_QUESTION 247 -#define TK_NK_ALIAS 248 -#define TK_NK_ARROW 249 -#define TK_ROWTS 250 -#define TK_QSTART 251 -#define TK_QEND 252 -#define TK_QDURATION 253 -#define TK_WSTART 254 -#define TK_WEND 255 -#define TK_WDURATION 256 -#define TK_IROWTS 257 -#define TK_ISFILLED 258 -#define TK_CAST 259 -#define TK_NOW 260 -#define TK_TODAY 261 -#define TK_TIMEZONE 262 -#define TK_CLIENT_VERSION 263 -#define TK_SERVER_VERSION 264 -#define TK_SERVER_STATUS 265 -#define TK_CURRENT_USER 266 -#define TK_CASE 267 -#define TK_WHEN 268 -#define TK_THEN 269 -#define TK_ELSE 270 -#define TK_BETWEEN 271 -#define TK_IS 272 -#define TK_NK_LT 273 -#define TK_NK_GT 274 -#define TK_NK_LE 275 -#define TK_NK_GE 276 -#define TK_NK_NE 277 -#define TK_MATCH 278 -#define TK_NMATCH 279 -#define TK_CONTAINS 280 -#define TK_IN 281 -#define TK_JOIN 282 -#define TK_INNER 283 -#define TK_LEFT 284 -#define TK_RIGHT 285 -#define TK_OUTER 286 -#define TK_SEMI 287 -#define TK_ANTI 288 -#define TK_ASOF 289 -#define TK_WINDOW 290 -#define TK_WINDOW_OFFSET 291 -#define TK_JLIMIT 292 -#define TK_SELECT 293 -#define TK_NK_HINT 294 -#define TK_DISTINCT 295 -#define TK_WHERE 296 -#define TK_PARTITION 297 -#define TK_BY 298 -#define TK_SESSION 299 -#define TK_STATE_WINDOW 300 -#define TK_EVENT_WINDOW 301 -#define TK_COUNT_WINDOW 302 -#define TK_SLIDING 303 -#define TK_FILL 304 -#define TK_VALUE 305 -#define TK_VALUE_F 306 -#define TK_NONE 307 -#define TK_PREV 308 -#define TK_NULL_F 309 -#define TK_LINEAR 310 -#define TK_NEXT 311 -#define TK_HAVING 312 -#define TK_RANGE 313 -#define TK_EVERY 314 -#define TK_ORDER 315 -#define TK_SLIMIT 316 -#define TK_SOFFSET 317 -#define TK_LIMIT 318 -#define TK_OFFSET 319 -#define TK_ASC 320 -#define TK_NULLS 321 -#define TK_ABORT 322 -#define TK_AFTER 323 -#define TK_ATTACH 324 -#define TK_BEFORE 325 -#define TK_BEGIN 326 -#define TK_BITAND 327 -#define TK_BITNOT 328 -#define TK_BITOR 329 -#define TK_BLOCKS 330 -#define TK_CHANGE 331 -#define TK_COMMA 332 -#define TK_CONCAT 333 -#define TK_CONFLICT 334 -#define TK_COPY 335 -#define TK_DEFERRED 336 -#define TK_DELIMITERS 337 -#define TK_DETACH 338 -#define TK_DIVIDE 339 -#define TK_DOT 340 -#define TK_EACH 341 -#define TK_FAIL 342 -#define TK_FILE 343 -#define TK_FOR 344 -#define TK_GLOB 345 -#define TK_ID 346 -#define TK_IMMEDIATE 347 -#define TK_IMPORT 348 -#define TK_INITIALLY 349 -#define TK_INSTEAD 350 -#define TK_ISNULL 351 -#define TK_MODULES 352 -#define TK_NK_BITNOT 353 -#define TK_NK_SEMI 354 -#define TK_NOTNULL 355 -#define TK_OF 356 -#define TK_PLUS 357 -#define TK_PRIVILEGE 358 -#define TK_RAISE 359 -#define TK_RESTRICT 360 -#define TK_ROW 361 -#define TK_STAR 362 -#define TK_STATEMENT 363 -#define TK_STRICT 364 -#define TK_STRING 365 -#define TK_TIMES 366 -#define TK_VALUES 367 -#define TK_VARIABLE 368 -#define TK_WAL 369 -#define TK_ENCODE 370 -#define TK_COMPRESS 371 -#define TK_LEVEL 372 +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_USER 35 +#define TK_ENABLE 36 +#define TK_NK_INTEGER 37 +#define TK_SYSINFO 38 +#define TK_ADD 39 +#define TK_DROP 40 +#define TK_GRANT 41 +#define TK_ON 42 +#define TK_TO 43 +#define TK_REVOKE 44 +#define TK_FROM 45 +#define TK_SUBSCRIBE 46 +#define TK_READ 47 +#define TK_WRITE 48 +#define TK_NK_DOT 49 +#define TK_WITH 50 +#define TK_ENCRYPT_KEY 51 +#define TK_DNODE 52 +#define TK_PORT 53 +#define TK_DNODES 54 +#define TK_RESTORE 55 +#define TK_NK_IPTOKEN 56 +#define TK_FORCE 57 +#define TK_UNSAFE 58 +#define TK_CLUSTER 59 +#define TK_LOCAL 60 +#define TK_QNODE 61 +#define TK_BNODE 62 +#define TK_SNODE 63 +#define TK_MNODE 64 +#define TK_VNODE 65 +#define TK_DATABASE 66 +#define TK_USE 67 +#define TK_FLUSH 68 +#define TK_TRIM 69 +#define TK_S3MIGRATE 70 +#define TK_COMPACT 71 +#define TK_IF 72 +#define TK_NOT 73 +#define TK_EXISTS 74 +#define TK_BUFFER 75 +#define TK_CACHEMODEL 76 +#define TK_CACHESIZE 77 +#define TK_COMP 78 +#define TK_DURATION 79 +#define TK_NK_VARIABLE 80 +#define TK_MAXROWS 81 +#define TK_MINROWS 82 +#define TK_KEEP 83 +#define TK_PAGES 84 +#define TK_PAGESIZE 85 +#define TK_TSDB_PAGESIZE 86 +#define TK_PRECISION 87 +#define TK_REPLICA 88 +#define TK_VGROUPS 89 +#define TK_SINGLE_STABLE 90 +#define TK_RETENTIONS 91 +#define TK_SCHEMALESS 92 +#define TK_WAL_LEVEL 93 +#define TK_WAL_FSYNC_PERIOD 94 +#define TK_WAL_RETENTION_PERIOD 95 +#define TK_WAL_RETENTION_SIZE 96 +#define TK_WAL_ROLL_PERIOD 97 +#define TK_WAL_SEGMENT_SIZE 98 +#define TK_STT_TRIGGER 99 +#define TK_TABLE_PREFIX 100 +#define TK_TABLE_SUFFIX 101 +#define TK_S3_CHUNKSIZE 102 +#define TK_S3_KEEPLOCAL 103 +#define TK_S3_COMPACT 104 +#define TK_KEEP_TIME_OFFSET 105 +#define TK_ENCRYPT_ALGORITHM 106 +#define TK_NK_COLON 107 +#define TK_BWLIMIT 108 +#define TK_START 109 +#define TK_TIMESTAMP 110 +#define TK_END 111 +#define TK_TABLE 112 +#define TK_NK_LP 113 +#define TK_NK_RP 114 +#define TK_STABLE 115 +#define TK_COLUMN 116 +#define TK_MODIFY 117 +#define TK_RENAME 118 +#define TK_TAG 119 +#define TK_SET 120 +#define TK_NK_EQ 121 +#define TK_USING 122 +#define TK_TAGS 123 +#define TK_BOOL 124 +#define TK_TINYINT 125 +#define TK_SMALLINT 126 +#define TK_INT 127 +#define TK_INTEGER 128 +#define TK_BIGINT 129 +#define TK_FLOAT 130 +#define TK_DOUBLE 131 +#define TK_BINARY 132 +#define TK_NCHAR 133 +#define TK_UNSIGNED 134 +#define TK_JSON 135 +#define TK_VARCHAR 136 +#define TK_MEDIUMBLOB 137 +#define TK_BLOB 138 +#define TK_VARBINARY 139 +#define TK_GEOMETRY 140 +#define TK_DECIMAL 141 +#define TK_COMMENT 142 +#define TK_MAX_DELAY 143 +#define TK_WATERMARK 144 +#define TK_ROLLUP 145 +#define TK_TTL 146 +#define TK_SMA 147 +#define TK_DELETE_MARK 148 +#define TK_FIRST 149 +#define TK_LAST 150 +#define TK_SHOW 151 +#define TK_PRIVILEGES 152 +#define TK_DATABASES 153 +#define TK_TABLES 154 +#define TK_STABLES 155 +#define TK_MNODES 156 +#define TK_QNODES 157 +#define TK_ARBGROUPS 158 +#define TK_FUNCTIONS 159 +#define TK_INDEXES 160 +#define TK_ACCOUNTS 161 +#define TK_APPS 162 +#define TK_CONNECTIONS 163 +#define TK_LICENCES 164 +#define TK_GRANTS 165 +#define TK_FULL 166 +#define TK_LOGS 167 +#define TK_MACHINES 168 +#define TK_ENCRYPTIONS 169 +#define TK_QUERIES 170 +#define TK_SCORES 171 +#define TK_TOPICS 172 +#define TK_VARIABLES 173 +#define TK_BNODES 174 +#define TK_SNODES 175 +#define TK_TRANSACTIONS 176 +#define TK_DISTRIBUTED 177 +#define TK_CONSUMERS 178 +#define TK_SUBSCRIPTIONS 179 +#define TK_VNODES 180 +#define TK_ALIVE 181 +#define TK_VIEWS 182 +#define TK_VIEW 183 +#define TK_COMPACTS 184 +#define TK_NORMAL 185 +#define TK_CHILD 186 +#define TK_LIKE 187 +#define TK_TBNAME 188 +#define TK_QTAGS 189 +#define TK_AS 190 +#define TK_SYSTEM 191 +#define TK_TSMA 192 +#define TK_INTERVAL 193 +#define TK_RECURSIVE 194 +#define TK_TSMAS 195 +#define TK_FUNCTION 196 +#define TK_INDEX 197 +#define TK_COUNT 198 +#define TK_LAST_ROW 199 +#define TK_META 200 +#define TK_ONLY 201 +#define TK_TOPIC 202 +#define TK_CONSUMER 203 +#define TK_GROUP 204 +#define TK_DESC 205 +#define TK_DESCRIBE 206 +#define TK_RESET 207 +#define TK_QUERY 208 +#define TK_CACHE 209 +#define TK_EXPLAIN 210 +#define TK_ANALYZE 211 +#define TK_VERBOSE 212 +#define TK_NK_BOOL 213 +#define TK_RATIO 214 +#define TK_NK_FLOAT 215 +#define TK_OUTPUTTYPE 216 +#define TK_AGGREGATE 217 +#define TK_BUFSIZE 218 +#define TK_LANGUAGE 219 +#define TK_REPLACE 220 +#define TK_STREAM 221 +#define TK_INTO 222 +#define TK_PAUSE 223 +#define TK_RESUME 224 +#define TK_PRIMARY 225 +#define TK_KEY 226 +#define TK_TRIGGER 227 +#define TK_AT_ONCE 228 +#define TK_WINDOW_CLOSE 229 +#define TK_IGNORE 230 +#define TK_EXPIRED 231 +#define TK_FILL_HISTORY 232 +#define TK_UPDATE 233 +#define TK_SUBTABLE 234 +#define TK_UNTREATED 235 +#define TK_KILL 236 +#define TK_CONNECTION 237 +#define TK_TRANSACTION 238 +#define TK_BALANCE 239 +#define TK_VGROUP 240 +#define TK_LEADER 241 +#define TK_MERGE 242 +#define TK_REDISTRIBUTE 243 +#define TK_SPLIT 244 +#define TK_DELETE 245 +#define TK_INSERT 246 +#define TK_NK_BIN 247 +#define TK_NK_HEX 248 +#define TK_NULL 249 +#define TK_NK_QUESTION 250 +#define TK_NK_ALIAS 251 +#define TK_NK_ARROW 252 +#define TK_ROWTS 253 +#define TK_QSTART 254 +#define TK_QEND 255 +#define TK_QDURATION 256 +#define TK_WSTART 257 +#define TK_WEND 258 +#define TK_WDURATION 259 +#define TK_IROWTS 260 +#define TK_ISFILLED 261 +#define TK_CAST 262 +#define TK_NOW 263 +#define TK_TODAY 264 +#define TK_TIMEZONE 265 +#define TK_CLIENT_VERSION 266 +#define TK_SERVER_VERSION 267 +#define TK_SERVER_STATUS 268 +#define TK_CURRENT_USER 269 +#define TK_CASE 270 +#define TK_WHEN 271 +#define TK_THEN 272 +#define TK_ELSE 273 +#define TK_BETWEEN 274 +#define TK_IS 275 +#define TK_NK_LT 276 +#define TK_NK_GT 277 +#define TK_NK_LE 278 +#define TK_NK_GE 279 +#define TK_NK_NE 280 +#define TK_MATCH 281 +#define TK_NMATCH 282 +#define TK_CONTAINS 283 +#define TK_IN 284 +#define TK_JOIN 285 +#define TK_INNER 286 +#define TK_LEFT 287 +#define TK_RIGHT 288 +#define TK_OUTER 289 +#define TK_SEMI 290 +#define TK_ANTI 291 +#define TK_ASOF 292 +#define TK_WINDOW 293 +#define TK_WINDOW_OFFSET 294 +#define TK_JLIMIT 295 +#define TK_SELECT 296 +#define TK_NK_HINT 297 +#define TK_DISTINCT 298 +#define TK_WHERE 299 +#define TK_PARTITION 300 +#define TK_BY 301 +#define TK_SESSION 302 +#define TK_STATE_WINDOW 303 +#define TK_EVENT_WINDOW 304 +#define TK_COUNT_WINDOW 305 +#define TK_SLIDING 306 +#define TK_FILL 307 +#define TK_VALUE 308 +#define TK_VALUE_F 309 +#define TK_NONE 310 +#define TK_PREV 311 +#define TK_NULL_F 312 +#define TK_LINEAR 313 +#define TK_NEXT 314 +#define TK_HAVING 315 +#define TK_RANGE 316 +#define TK_EVERY 317 +#define TK_ORDER 318 +#define TK_SLIMIT 319 +#define TK_SOFFSET 320 +#define TK_LIMIT 321 +#define TK_OFFSET 322 +#define TK_ASC 323 +#define TK_NULLS 324 +#define TK_ABORT 325 +#define TK_AFTER 326 +#define TK_ATTACH 327 +#define TK_BEFORE 328 +#define TK_BEGIN 329 +#define TK_BITAND 330 +#define TK_BITNOT 331 +#define TK_BITOR 332 +#define TK_BLOCKS 333 +#define TK_CHANGE 334 +#define TK_COMMA 335 +#define TK_CONCAT 336 +#define TK_CONFLICT 337 +#define TK_COPY 338 +#define TK_DEFERRED 339 +#define TK_DELIMITERS 340 +#define TK_DETACH 341 +#define TK_DIVIDE 342 +#define TK_DOT 343 +#define TK_EACH 344 +#define TK_FAIL 345 +#define TK_FILE 346 +#define TK_FOR 347 +#define TK_GLOB 348 +#define TK_ID 349 +#define TK_IMMEDIATE 350 +#define TK_IMPORT 351 +#define TK_INITIALLY 352 +#define TK_INSTEAD 353 +#define TK_ISNULL 354 +#define TK_MODULES 355 +#define TK_NK_BITNOT 356 +#define TK_NK_SEMI 357 +#define TK_NOTNULL 358 +#define TK_OF 359 +#define TK_PLUS 360 +#define TK_PRIVILEGE 361 +#define TK_RAISE 362 +#define TK_RESTRICT 363 +#define TK_ROW 364 +#define TK_STAR 365 +#define TK_STATEMENT 366 +#define TK_STRICT 367 +#define TK_STRING 368 +#define TK_TIMES 369 +#define TK_VALUES 370 +#define TK_VARIABLE 371 +#define TK_WAL 372 +#define TK_ENCODE 373 +#define TK_COMPRESS 374 +#define TK_LEVEL 375 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/crypt/crypt.h b/include/libs/crypt/crypt.h new file mode 100644 index 0000000000..c294877a57 --- /dev/null +++ b/include/libs/crypt/crypt.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _CRYPT_H_ +#define _CRYPT_H_ +#include "tdef.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SCryptOpts{ + int32_t len; + char* source; + char* result; + int32_t unitLen; + unsigned char key[17]; +}SCryptOpts; + +int32_t CBC_Decrypt(SCryptOpts *opts); +int32_t CBC_Encrypt(SCryptOpts *opts); + +#ifdef __cplusplus +} +#endif + +#endif // _CRYPT_H_ \ No newline at end of file diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 5cb1b45b39..2b60e20902 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -70,7 +70,9 @@ typedef struct SDatabaseOptions { int8_t cacheModel; int32_t cacheLastSize; int8_t compressionLevel; + int8_t encryptAlgorithm; int32_t daysPerFile; + char encryptAlgorithmStr[TSDB_ENCRYPT_ALGO_STR_LEN]; SValueNode* pDaysPerFile; int32_t fsyncPeriod; int32_t maxRowsPerBlock; diff --git a/include/libs/sm4/sm4.h b/include/libs/sm4/sm4.h new file mode 100644 index 0000000000..659b082418 --- /dev/null +++ b/include/libs/sm4/sm4.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#ifndef _SM4_H_ +#define _SM4_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int SM4_ECB_Encrypt( unsigned char *pKey, + unsigned int KeyLen, + unsigned char *pInData, + unsigned int inDataLen, + unsigned char *pOutData, + unsigned int *pOutDataLen); + +int SM4_ECB_Decrypt( unsigned char *pKey, + unsigned int KeyLen, + unsigned char *pInData, + unsigned int inDataLen, + unsigned char *pOutData, + unsigned int *pOutDataLen); + +int SM4_CBC_Encrypt( unsigned char *pKey, + unsigned int KeyLen, + unsigned char *pIV, + unsigned int ivLen, + unsigned char *pInData, + unsigned int inDataLen, + unsigned char *pOutData, + unsigned int *pOutDataLen); + +int SM4_CBC_Decrypt(unsigned char *pKey, + unsigned int KeyLen, + unsigned char *pIV, + unsigned int ivLen, + unsigned char *pInData, + unsigned int inDataLen, + unsigned char *pOutData, + unsigned int *pOutDataLen); +#ifdef __cplusplus +} +#endif + +#endif // _SM4_H_ \ No newline at end of file diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 7c00ff5178..25566d5acb 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -57,6 +57,8 @@ typedef struct { int64_t retentionSize; int64_t segSize; EWalType level; // wal level + int32_t encryptAlgorithm; + char encryptKey[ENCRYPT_KEY_LEN + 1]; } SWalCfg; typedef struct { @@ -196,6 +198,7 @@ SWalReader *walOpenReader(SWal *, SWalFilterCond *pCond, int64_t id); void walCloseReader(SWalReader *pRead); void walReadReset(SWalReader *pReader); int32_t walReadVer(SWalReader *pRead, int64_t ver); +void decryptBody(SWalCfg* cfg, SWalCkHead* pHead, int32_t plainBodyLen, const char* func); int32_t walReaderSeekVer(SWalReader *pRead, int64_t ver); int32_t walNextValidMsg(SWalReader *pRead); int64_t walReaderGetCurrentVer(const SWalReader *pReader); diff --git a/include/os/osString.h b/include/os/osString.h index 8e8f1546e7..1aca119293 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,6 +22,8 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; +typedef void *iconv_t; +typedef enum { M2C = 0, C2M } ConvType; // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following section. @@ -59,7 +61,10 @@ int64_t taosStr2int64(const char *str); int32_t taosConvInit(void); void taosConvDestroy(); +iconv_t taosAcquireConv(int32_t *idx, ConvType type); +void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type); int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs); +int32_t taosUcs4ToMbsEx(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs, iconv_t conv); bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len); int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes); TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index c13c8586f5..acd9ac52ea 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -306,6 +306,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A) // #define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B) #define TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO TAOS_DEF_ERROR_CODE(0, 0x038C) +#define TSDB_CODE_MND_INCONSIST_ENCRYPT_KEY TAOS_DEF_ERROR_CODE(0, 0x038D) +#define TSDB_CODE_MND_INVALID_ENCRYPT_KEY TAOS_DEF_ERROR_CODE(0, 0x038E) // #define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) // 2.x // #define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) // 2.x // #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) // 2.x @@ -314,6 +316,7 @@ int32_t* taosGetErrno(); // #define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0395) // 2.x #define TSDB_CODE_MND_DB_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x0396) // #define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A) +#define TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE TAOS_DEF_ERROR_CODE(0, 0x039B) // mnode-node #define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0) @@ -421,6 +424,17 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MNODE_NO_NEED_RESTORE TAOS_DEF_ERROR_CODE(0, 0x0415) // internal #define TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0416) #define TSDB_CODE_DNODE_NO_MACHINE_CODE TAOS_DEF_ERROR_CODE(0, 0x0417) +#define TSDB_CODE_DNODE_NO_ENCRYPT_KEY TAOS_DEF_ERROR_CODE(0, 0x0418) +#define TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0419) +#define TSDB_CODE_DNODE_INVALID_ENCRYPTKEY TAOS_DEF_ERROR_CODE(0, 0x0420) +#define TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED TAOS_DEF_ERROR_CODE(0, 0x0421) +#define TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN TAOS_DEF_ERROR_CODE(0, 0x0422) +#define TSDB_CODE_DNODE_INVALID_STATUS_INTERVAL TAOS_DEF_ERROR_CODE(0, 0x0423) +#define TSDB_CODE_DNODE_INVALID_TIMEZONE TAOS_DEF_ERROR_CODE(0, 0x0424) +#define TSDB_CODE_DNODE_INVALID_CHARSET TAOS_DEF_ERROR_CODE(0, 0x0425) +#define TSDB_CODE_DNODE_INVALID_LOCALE TAOS_DEF_ERROR_CODE(0, 0x0426) +#define TSDB_CODE_DNODE_INVALID_TTL_CHG_ON_WR TAOS_DEF_ERROR_CODE(0, 0x0427) +#define TSDB_CODE_DNODE_INVALID_EN_WHITELIST TAOS_DEF_ERROR_CODE(0, 0x0428) // mnode-sma #define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480) diff --git a/include/util/tcompare.h b/include/util/tcompare.h index 65457b287a..9694bee92d 100644 --- a/include/util/tcompare.h +++ b/include/util/tcompare.h @@ -83,6 +83,7 @@ int32_t compareLenBinaryVal(const void *pLeft, const void *pRight); int32_t comparestrRegexMatch(const void *pLeft, const void *pRight); int32_t comparestrRegexNMatch(const void *pLeft, const void *pRight); +void DestoryThreadLocalRegComp(); int32_t comparewcsRegexMatch(const void *pLeft, const void *pRight); int32_t comparewcsRegexNMatch(const void *pLeft, const void *pRight); diff --git a/include/util/tdef.h b/include/util/tdef.h index 9dd0ef65be..6402ef902c 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -188,6 +188,10 @@ typedef enum ELogicConditionType { LOGIC_COND_TYPE_NOT, } ELogicConditionType; +#define ENCRYPTED_LEN(len) (len/16) * 16 + (len%16?1:0) * 16 +#define ENCRYPT_KEY_LEN 16 +#define ENCRYPT_KEY_LEN_MIN 8 + #define TSDB_INT32_ID_LEN 11 #define TSDB_NAME_DELIMITER_LEN 1 @@ -388,6 +392,14 @@ typedef enum ELogicConditionType { #define TSDB_CACHE_MODEL_LAST_ROW 1 #define TSDB_CACHE_MODEL_LAST_VALUE 2 #define TSDB_CACHE_MODEL_BOTH 3 +#define TSDB_ENCRYPT_ALGO_STR_LEN 16 +#define TSDB_ENCRYPT_ALGO_NONE_STR "none" +#define TSDB_ENCRYPT_ALGO_SM4_STR "sm4" +#define TSDB_ENCRYPT_ALGO_NONE 0 +#define TSDB_ENCRYPT_ALGO_SM4 1 +#define TSDB_DEFAULT_ENCRYPT_ALGO TSDB_ENCRYPT_ALGO_NONE +#define TSDB_MIN_ENCRYPT_ALGO TSDB_ENCRYPT_ALGO_NONE +#define TSDB_MAX_ENCRYPT_ALGO TSDB_ENCRYPT_ALGO_SM4 #define TSDB_DEFAULT_CACHE_MODEL TSDB_CACHE_MODEL_NONE #define TSDB_MIN_DB_CACHE_SIZE 1 // MB #define TSDB_MAX_DB_CACHE_SIZE 65536 @@ -523,6 +535,7 @@ typedef enum ELogicConditionType { enum { TRANS_STAT_INIT = 0, TRANS_STAT_EXECUTING, TRANS_STAT_EXECUTED, TRANS_STAT_ROLLBACKING, TRANS_STAT_ROLLBACKED }; enum { TRANS_OPER_INIT = 0, TRANS_OPER_EXECUTE, TRANS_OPER_ROLLBACK }; +enum { ENCRYPT_KEY_STAT_UNKNOWN = 0, ENCRYPT_KEY_STAT_UNSET, ENCRYPT_KEY_STAT_SET, ENCRYPT_KEY_STAT_LOADED}; typedef struct { char dir[TSDB_FILENAME_LEN]; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 1c4b49df53..1d5bc9cfb4 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1804,6 +1804,10 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) { } static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int32_t numOfCols, int32_t* colLength) { + int32_t idx = -1; + iconv_t conv = taosAcquireConv(&idx, C2M); + if (!conv) return TSDB_CODE_TSC_INTERNAL_ERROR; + for (int32_t i = 0; i < numOfCols; ++i) { int32_t type = pResultInfo->fields[i].type; int32_t bytes = pResultInfo->fields[i].bytes; @@ -1811,6 +1815,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int if (type == TSDB_DATA_TYPE_NCHAR && colLength[i] > 0) { char* p = taosMemoryRealloc(pResultInfo->convertBuf[i], colLength[i]); if (p == NULL) { + taosReleaseConv(idx, conv, C2M); return TSDB_CODE_OUT_OF_MEMORY; } @@ -1821,12 +1826,13 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int if (pCol->offset[j] != -1) { char* pStart = pCol->offset[j] + pCol->pData; - int32_t len = taosUcs4ToMbs((TdUcs4*)varDataVal(pStart), varDataLen(pStart), varDataVal(p)); - if (len > bytes || (p + len) >= (pResultInfo->convertBuf[i] + colLength[i])) { + int32_t len = taosUcs4ToMbsEx((TdUcs4*)varDataVal(pStart), varDataLen(pStart), varDataVal(p), conv); + if (len < 0 || len > bytes || (p + len) >= (pResultInfo->convertBuf[i] + colLength[i])) { tscError( "doConvertUCS4 error, invalid data. len:%d, bytes:%d, (p + len):%p, (pResultInfo->convertBuf[i] + " "colLength[i]):%p", len, bytes, (p + len), (pResultInfo->convertBuf[i] + colLength[i])); + taosReleaseConv(idx, conv, C2M); return TSDB_CODE_TSC_INTERNAL_ERROR; } @@ -1840,7 +1846,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int pResultInfo->row[i] = pResultInfo->pCol[i].pData; } } - + taosReleaseConv(idx, conv, C2M); return TSDB_CODE_SUCCESS; } @@ -2620,8 +2626,7 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { setQueryResultFromRsp(pResultInfo, (const SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4); if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; - pRequest->code = code; - tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(code), + tscError("0x%" PRIx64 " fetch results failed, code:%s, reqId:0x%" PRIx64, pRequest->self, tstrerror(pRequest->code), pRequest->requestId); } else { tscDebug("0x%" PRIx64 " fetch results, numOfRows:%" PRId64 " total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64, diff --git a/source/common/src/systable.c b/source/common/src/systable.c index ba692840a1..4dfe9d900f 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -121,6 +121,7 @@ static const SSysDbTableSchema userDBSchema[] = { {.name = "s3_keeplocal", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "s3_compact", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, {.name = "with_arbitrator", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, + {.name = "encrypt_algorithm", .bytes = TSDB_ENCRYPT_ALGO_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; static const SSysDbTableSchema userFuncSchema[] = { @@ -400,12 +401,15 @@ static const SSysDbTableSchema userGrantsLogsSchema[] = { static const SSysDbTableSchema userMachinesSchema[] = { {.name = "id", .bytes = TSDB_CLUSTER_ID_LEN + 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, -#ifndef TD_UNIQ_GRANT {.name = "dnode_num", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, -#endif {.name = "machine", .bytes = 7552 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; +static const SSysDbTableSchema encryptionsSchema[] = { + {.name = "dnode_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, + {.name = "key_status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, +}; + static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true}, {TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true}, @@ -439,6 +443,7 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_GRANTS_LOGS, userGrantsLogsSchema, tListLen(userGrantsLogsSchema), true}, {TSDB_INS_TABLE_MACHINES, userMachinesSchema, tListLen(userMachinesSchema), true}, {TSDB_INS_TABLE_ARBGROUPS, arbGroupsSchema, tListLen(arbGroupsSchema), true}, + {TSDB_INS_TABLE_ENCRYPTIONS, encryptionsSchema, tListLen(encryptionsSchema), true}, {TSDB_INS_TABLE_TSMAS, tsmaSchema, tListLen(tsmaSchema), false}, }; diff --git a/source/common/src/tcol.c b/source/common/src/tcol.c index 24f9667dcc..afd121633d 100644 --- a/source/common/src/tcol.c +++ b/source/common/src/tcol.c @@ -67,6 +67,8 @@ uint8_t getDefaultEncode(uint8_t type) { return TSDB_COLVAL_ENCODE_SIMPLE8B; case TSDB_DATA_TYPE_MEDIUMBLOB: case TSDB_DATA_TYPE_GEOMETRY: + return TSDB_COLVAL_ENCODE_DISABLED; + case TSDB_DATA_TYPE_MAX: return TSDB_COLVAL_ENCODE_SIMPLE8B; @@ -365,7 +367,7 @@ int8_t validColEncode(uint8_t type, uint8_t l1) { } else if (type >= TSDB_DATA_TYPE_FLOAT && type <= TSDB_DATA_TYPE_DOUBLE) { return TSDB_COLVAL_ENCODE_DELTAD == l1 ? 1 : 0; } else if ((type == TSDB_DATA_TYPE_VARCHAR || type == TSDB_DATA_TYPE_NCHAR) || type == TSDB_DATA_TYPE_JSON || - type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_BINARY) { + type == TSDB_DATA_TYPE_VARBINARY || type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { return l1 == TSDB_COLVAL_ENCODE_DISABLED ? 1 : 0; // if (l1 >= TSDB_COLVAL_ENCODE_NOCHANGE || l1 <= TSDB_COLVAL_ENCODE_DELTAD) { // return 1; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 0c4c60db07..04ad00e1dc 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -2450,7 +2450,7 @@ static int32_t tColDataUpdateValue72(SColData *pColData, uint8_t *pData, uint32_ pColData->numOfValue--; pColData->nVal--; if (pColData->numOfValue) { - if (IS_STR_DATA_TYPE(pColData->type)) { + if (IS_VAR_DATA_TYPE(pColData->type)) { pColData->nData = pColData->aOffset[pColData->nVal]; } else { pColData->nData -= TYPE_BYTES[pColData->type]; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1f06891d3d..24f00ab6a5 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -41,6 +41,13 @@ uint16_t tsServerPort = 6030; int32_t tsVersion = 30000000; int32_t tsStatusInterval = 1; // second int32_t tsNumOfSupportVnodes = 256; +char tsEncryptAlgorithm[16] = {0}; +char tsEncryptScope[100] = {0}; +EEncryptAlgor tsiEncryptAlgorithm = 0; +EEncryptScope tsiEncryptScope = 0; +//char tsAuthCode[500] = {0}; +//char tsEncryptKey[17] = {0}; +char tsEncryptKey[17] = {0}; // common int32_t tsMaxShellConns = 50000; @@ -77,8 +84,6 @@ int32_t tsSnapReplMaxWaitN = 128; // mnode int64_t tsMndSdbWriteDelta = 200; int64_t tsMndLogRetention = 2000; -int8_t tsGrant = 1; -int32_t tsMndGrantMode = 0; bool tsMndSkipGrant = false; bool tsEnableWhiteList = false; // ip white list cfg @@ -92,6 +97,11 @@ int64_t tsDndStart = 0; int64_t tsDndStartOsUptime = 0; int64_t tsDndUpTime = 0; +// dnode misc +uint32_t tsEncryptionKeyChksum = 0; +int8_t tsEncryptionKeyStat = ENCRYPT_KEY_STAT_UNSET; +int8_t tsGrant = 1; + // monitor bool tsEnableMonitor = true; int32_t tsMonitorInterval = 30; @@ -609,6 +619,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfSupportVnodes = TMAX(tsNumOfSupportVnodes, 2); if (cfgAddInt32(pCfg, "supportVnodes", tsNumOfSupportVnodes, 0, 4096, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "encryptAlgorithm", tsEncryptAlgorithm, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; + if (cfgAddString(pCfg, "encryptScope", tsEncryptScope, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; + //if (cfgAddString(pCfg, "authCode", tsAuthCode, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; + if (cfgAddInt32(pCfg, "statusInterval", tsStatusInterval, 1, 30, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; @@ -705,7 +719,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { return -1; if (cfgAddInt64(pCfg, "mndLogRetention", tsMndLogRetention, 500, 10000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; - if (cfgAddInt32(pCfg, "grantMode", tsMndGrantMode, 0, 10000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddBool(pCfg, "skipGrant", tsMndSkipGrant, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; @@ -1163,6 +1176,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32; tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32; tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32; + tstrncpy(tsEncryptAlgorithm, cfgGetItem(pCfg, "encryptAlgorithm")->str, 16); + tstrncpy(tsEncryptScope, cfgGetItem(pCfg, "encryptScope")->str, 100); + //tstrncpy(tsAuthCode, cfgGetItem(pCfg, "authCode")->str, 100); tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32; tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32; @@ -1238,7 +1254,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; tsMndSkipGrant = cfgGetItem(pCfg, "skipGrant")->bval; - tsMndGrantMode = cfgGetItem(pCfg, "grantMode")->i32; tsEnableWhiteList = cfgGetItem(pCfg, "enableWhiteList")->bval; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index f3a85fed35..7db408f028 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1216,6 +1216,8 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeCStr(&encoder, pReq->clusterCfg.locale) < 0) return -1; if (tEncodeCStr(&encoder, pReq->clusterCfg.charset) < 0) return -1; if (tEncodeI8(&encoder, pReq->clusterCfg.enableWhiteList) < 0) return -1; + if (tEncodeI8(&encoder, pReq->clusterCfg.encryptionKeyStat) < 0) return -1; + if (tEncodeU32(&encoder, pReq->clusterCfg.encryptionKeyChksum) < 0) return -1; // vnode loads int32_t vlen = (int32_t)taosArrayGetSize(pReq->pVloads); @@ -1308,6 +1310,8 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeCStrTo(&decoder, pReq->clusterCfg.locale) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->clusterCfg.charset) < 0) return -1; if (tDecodeI8(&decoder, &pReq->clusterCfg.enableWhiteList) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->clusterCfg.encryptionKeyStat) < 0) return -1; + if (tDecodeU32(&decoder, &pReq->clusterCfg.encryptionKeyChksum) < 0) return -1; // vnode loads int32_t vlen = 0; @@ -3080,13 +3084,14 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { } if (tEncodeI32(&encoder, pReq->tsdbPageSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3ChunkSize) < 0) return -1; - if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; - if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; ENCODESQL(); if (tEncodeI8(&encoder, pReq->withArbitrator) < 0) return -1; + if (tEncodeI8(&encoder, pReq->encryptAlgorithm) < 0) return -1; + if (tEncodeI32(&encoder, pReq->s3ChunkSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; + if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; tEndEncode(&encoder); @@ -3155,22 +3160,21 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) if (tDecodeI32(&decoder, &pReq->keepTimeOffset) < 0) return -1; } + DECODESQL(); + + pReq->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; + pReq->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; pReq->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE; pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->withArbitrator) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->encryptAlgorithm) < 0) return -1; if (tDecodeI32(&decoder, &pReq->s3ChunkSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0) return -1; if (tDecodeI8(&decoder, &pReq->s3Compact) < 0) return -1; } - DECODESQL(); - - pReq->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; - if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI8(&decoder, &pReq->withArbitrator) < 0) return -1; - } - tEndDecode(&decoder); tDecoderClear(&decoder); return 0; @@ -4137,6 +4141,7 @@ int32_t tSerializeSDbCfgRspImpl(SEncoder *encoder, const SDbCfgRsp *pRsp) { if (tEncodeI16(encoder, pRsp->sstTrigger) < 0) return -1; if (tEncodeI32(encoder, pRsp->keepTimeOffset) < 0) return -1; if (tEncodeI8(encoder, pRsp->withArbitrator) < 0) return -1; + if (tEncodeI8(encoder, pRsp->encryptAlgorithm) < 0) return -1; if (tEncodeI32(encoder, pRsp->s3ChunkSize) < 0) return -1; if (tEncodeI32(encoder, pRsp->s3KeepLocal) < 0) return -1; if (tEncodeI8(encoder, pRsp->s3Compact) < 0) return -1; @@ -4213,14 +4218,13 @@ int32_t tDeserializeSDbCfgRspImpl(SDecoder *decoder, SDbCfgRsp *pRsp) { if (tDecodeI32(decoder, &pRsp->keepTimeOffset) < 0) return -1; } pRsp->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; - if (!tDecodeIsEnd(decoder)) { - if (tDecodeI8(decoder, &pRsp->withArbitrator) < 0) return -1; - } - + pRsp->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; pRsp->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE; pRsp->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pRsp->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(decoder)) { + if (tDecodeI8(decoder, &pRsp->withArbitrator) < 0) return -1; + if (tDecodeI8(decoder, &pRsp->encryptAlgorithm) < 0) return -1; if (tDecodeI32(decoder, &pRsp->s3ChunkSize) < 0) return -1; if (tDecodeI32(decoder, &pRsp->s3KeepLocal) < 0) return -1; if (tDecodeI8(decoder, &pRsp->s3Compact) < 0) return -1; @@ -5282,6 +5286,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR } if (tEncodeI32(&encoder, pReq->changeVersion) < 0) return -1; if (tEncodeI32(&encoder, pReq->keepTimeOffset) < 0) return -1; + if (tEncodeI8(&encoder, pReq->encryptAlgorithm) < 0) return -1; if (tEncodeI32(&encoder, pReq->s3ChunkSize) < 0) return -1; if (tEncodeI32(&encoder, pReq->s3KeepLocal) < 0) return -1; if (tEncodeI8(&encoder, pReq->s3Compact) < 0) return -1; @@ -5378,11 +5383,12 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq * if (!tDecodeIsEnd(&decoder)) { if (tDecodeI32(&decoder, &pReq->keepTimeOffset) < 0) return -1; } - + pReq->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; pReq->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE; pReq->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pReq->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->encryptAlgorithm) < 0) return -1; if (tDecodeI32(&decoder, &pReq->s3ChunkSize) < 0) return -1; if (tDecodeI32(&decoder, &pReq->s3KeepLocal) < 0) return -1; if (tDecodeI8(&decoder, &pReq->s3Compact) < 0) return -1; diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index e6be56cfb7..d72301279e 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -31,8 +31,8 @@ ENDIF () IF (TD_LINUX_64 AND JEMALLOC_ENABLED) ADD_DEPENDENCIES(taosd jemalloc) - target_link_libraries(taosd dnode ${LINK_JEMALLOC}) + target_link_libraries(taosd dnode crypt ${LINK_JEMALLOC}) ELSE () - target_link_libraries(taosd dnode) + target_link_libraries(taosd dnode crypt) ENDIF () diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 4f8858f3c2..98459512f3 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -22,6 +22,7 @@ #ifdef TD_JEMALLOC_ENABLED #include "jemalloc/jemalloc.h" #endif +#include "dmUtil.h" #if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) #include "cus_name.h" @@ -49,6 +50,8 @@ #define DM_VERSION "Print program version." #define DM_EMAIL "" #define DM_MEM_DBG "Enable memory debug" +#define DM_SET_ENCRYPTKEY "Set encrypt key. such as: -y 1234567890abcdef, the length should be less or equal to 16." + // clang-format on static struct { #ifdef WINDOWS @@ -67,6 +70,8 @@ static struct { const char **envCmd; SArray *pArgs; // SConfigPair int64_t startTime; + bool generateCode; + char encryptKey[ENCRYPT_KEY_LEN + 1]; } global = {0}; static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetGlobalDebugFlag(143); } @@ -195,6 +200,23 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { } } else if (strcmp(argv[i], "-k") == 0) { global.generateGrant = true; + } else if (strcmp(argv[i], "-y") == 0) { + global.generateCode = true; + if(i < argc - 1) { + int32_t len = strlen(argv[++i]); + if (len < ENCRYPT_KEY_LEN_MIN) { + printf("encrypt key is too short, it should be great or equal to %d\n", ENCRYPT_KEY_LEN_MIN); + return -1; + } + if (len > ENCRYPT_KEY_LEN) { + printf("encrypt key overflow, it should be less or equal to %d\n", ENCRYPT_KEY_LEN); + return -1; + } + tstrncpy(global.encryptKey, argv[i], ENCRYPT_KEY_LEN); + } else { + printf("'-y' requires a parameter\n"); + return -1; + } } else if (strcmp(argv[i], "-C") == 0) { global.dumpConfig = true; } else if (strcmp(argv[i], "-V") == 0) { @@ -259,6 +281,7 @@ static void dmPrintHelp() { printf("%s%s%s%s\n", indent, "-e,", indent, DM_ENV_CMD); printf("%s%s%s%s\n", indent, "-E,", indent, DM_ENV_FILE); printf("%s%s%s%s\n", indent, "-k,", indent, DM_MACHINE_CODE); + printf("%s%s%s%s\n", indent, "-y,", indent, DM_SET_ENCRYPTKEY); printf("%s%s%s%s\n", indent, "-dm,", indent, DM_MEM_DBG); printf("%s%s%s%s\n", indent, "-V,", indent, DM_VERSION); @@ -364,6 +387,24 @@ int mainWindows(int argc, char **argv) { return -1; } + if(global.generateCode) { + if(dmCheckRunning(tsDataDir) == NULL) { + dError("failed to generate encrypt code since taosd is running, please stop it first"); + return -1; + } + int ret = dmUpdateEncryptKey(global.encryptKey); + taosCloseLog(); + taosCleanupArgs(); + return ret; + } + + if(dmGetEncryptKey() != 0){ + dError("failed to start since failed to get encrypt key"); + taosCloseLog(); + taosCleanupArgs(); + return -1; + }; + if (taosConvInit() != 0) { dError("failed to init conv"); taosCloseLog(); diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h index 975246a10f..9e1fe69714 100644 --- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h +++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h @@ -57,6 +57,7 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg); int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg); +int32_t dmProcessCreateEncryptKeyReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); // dmWorker.c int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 393db84e18..12e414b30d 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "dmInt.h" #include "systable.h" +#include "tchecksum.h" extern SConfig *tsCfg; @@ -113,6 +114,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { req.clusterCfg.checkTime = 0; req.clusterCfg.ttlChangeOnWrite = tsTtlChangeOnWrite; req.clusterCfg.enableWhiteList = tsEnableWhiteList ? 1 : 0; + req.clusterCfg.encryptionKeyStat = tsEncryptionKeyStat; + req.clusterCfg.encryptionKeyChksum = tsEncryptionKeyChksum; char timestr[32] = "1970-01-01 00:00:00.00"; (void)taosParseTime(timestr, &req.clusterCfg.checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0); memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN); @@ -221,6 +224,32 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { return 0; } +int32_t dmProcessCreateEncryptKeyReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { +#ifdef TD_ENTERPRISE + int32_t code = 0; + SDCfgDnodeReq cfgReq = {0}; + if (tDeserializeSDCfgDnodeReq(pMsg->pCont, pMsg->contLen, &cfgReq) != 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + code = dmUpdateEncryptKey(cfgReq.value); + if (code == 0) { + tsEncryptionKeyChksum = taosCalcChecksum(0, cfgReq.value, strlen(cfgReq.value)); + tsEncryptionKeyStat = ENCRYPT_KEY_STAT_LOADED; + tstrncpy(tsEncryptKey, cfgReq.value, ENCRYPT_KEY_LEN + 1); + } + +_exit: + pMsg->code = code; + pMsg->info.rsp = NULL; + pMsg->info.rspLen = 0; + return code; +#else + return 0; +#endif +} + static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) { pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_OK; pStatus->details[0] = 0; @@ -421,6 +450,7 @@ SArray *dmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_DND_SERVER_STATUS, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_SYSTABLE_RETRIEVE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_ENCRYPT_KEY, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; // Requests handled by MNODE if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index cecb3d1581..d124eb74be 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -359,6 +359,9 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { case TDMT_MND_GRANT_NOTIFY: code = dmProcessGrantNotify(NULL, pMsg); break; + case TDMT_DND_CREATE_ENCRYPT_KEY: + code = dmProcessCreateEncryptKeyReq(pMgmt, pMsg); + break; default: terrno = TSDB_CODE_MSG_NOT_PROCESSED; dGError("msg:%p, not processed in mgmt queue", pMsg); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 09267d12b4..e4afba6722 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -113,6 +113,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_VNODE_TYPE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SYNC_CONFIG_CHANGE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_ENCRYPT_KEY_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CONNECT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ACCT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -204,6 +205,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_CLUSTER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ENCRYPT_KEY, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 4ada92d20e..73a73d19f5 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -142,6 +142,14 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { if ((pRetention->freq >= 0 && pRetention->keep > 0)) pCfg->isRsma = 1; } } +#if defined(TD_ENTERPRISE) + pCfg->tsdbCfg.encryptAlgorithm = pCreate->encryptAlgorithm; + if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ + strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } +#else + pCfg->tsdbCfg.encryptAlgorithm = 0; +#endif pCfg->walCfg.vgId = pCreate->vgId; pCfg->walCfg.fsyncPeriod = pCreate->walFsyncPeriod; @@ -150,6 +158,23 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->walCfg.retentionSize = pCreate->walRetentionSize; pCfg->walCfg.segSize = pCreate->walSegmentSize; pCfg->walCfg.level = pCreate->walLevel; +#if defined(TD_ENTERPRISE) + pCfg->walCfg.encryptAlgorithm = pCreate->encryptAlgorithm; + if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ + strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } +#else + pCfg->walCfg.encryptAlgorithm = 0; +#endif + +#if defined(TD_ENTERPRISE) + pCfg->tdbEncryptAlgorithm = pCreate->encryptAlgorithm; + if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ + strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } +#else + pCfg->tdbEncryptAlgorithm = 0; +#endif pCfg->sttTrigger = pCreate->sstTrigger; pCfg->hashBegin = pCreate->hashBegin; @@ -246,14 +271,15 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { "precision:%d compression:%d minRows:%d maxRows:%d" ", wal fsync:%d level:%d retentionPeriod:%d retentionSize:%" PRId64 " rollPeriod:%d segSize:%" PRId64 ", hash method:%d begin:%u end:%u prefix:%d surfix:%d replica:%d selfIndex:%d " - "learnerReplica:%d learnerSelfIndex:%d strict:%d changeVersion:%d", + "learnerReplica:%d learnerSelfIndex:%d strict:%d changeVersion:%d encryptAlgorithm:%d", req.vgId, TMSG_INFO(pMsg->msgType), req.pages, req.pageSize, req.buffer, req.pageSize * 1024, (uint64_t)req.buffer * 1024 * 1024, req.cacheLast, req.cacheLastSize, req.sstTrigger, req.tsdbPageSize, req.tsdbPageSize * 1024, req.db, req.dbUid, req.daysPerFile, req.daysToKeep0, req.daysToKeep1, req.daysToKeep2, req.keepTimeOffset, req.s3ChunkSize, req.s3KeepLocal, req.s3Compact, req.isTsma, req.precision, req.compression, req.minRows, req.maxRows, req.walFsyncPeriod, req.walLevel, req.walRetentionPeriod, req.walRetentionSize, req.walRollPeriod, req.walSegmentSize, req.hashMethod, req.hashBegin, req.hashEnd, req.hashPrefix, req.hashSuffix, - req.replica, req.selfIndex, req.learnerReplica, req.learnerSelfIndex, req.strict, req.changeVersion); + req.replica, req.selfIndex, req.learnerReplica, req.learnerSelfIndex, req.strict, req.changeVersion, + req.encryptAlgorithm); for (int32_t i = 0; i < req.replica; ++i) { dInfo("vgId:%d, replica:%d ep:%s:%u dnode:%d", req.vgId, i, req.replicas[i].fqdn, req.replicas[i].port, @@ -278,6 +304,14 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return -1; } + if(req.encryptAlgorithm == DND_CA_SM4){ + if(strlen(tsEncryptKey) == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + dError("vgId:%d, failed to create vnode since encrypt key is empty", req.vgId); + return -1; + } + } + vmGenerateVnodeCfg(&req, &vnodeCfg); if (vmTsmaAdjustDays(&vnodeCfg, &req) < 0) { diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index 049b1bdf84..11453fcfef 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -161,6 +161,46 @@ int32_t dmInitVars(SDnode *pDnode) { return -1; } +#if defined(TD_ENTERPRISE) + tsiEncryptAlgorithm = pData->encryptAlgorigthm; + tsiEncryptScope = pData->encryptScope; + /* + if(tsiEncryptAlgorithm != 0) { + if(pData->machineId != NULL && strlen(pData->machineId) > 0){ + dInfo("get crypt key at startup, machineId:%s", pData->machineId); + int32_t code = 0; + + //code = taosGetCryptKey(tsAuthCode, pData->machineId, tsCryptKey); + code = 0; + strncpy(tsEncryptKey, tsAuthCode, 16); + + if(code != 0) { + if(code == -1){ + terrno = TSDB_CODE_DNODE_NO_ENCRYPT_KEY; + dError("machine code changed, can't get crypt key"); + } + if(code == -2){ + terrno = TSDB_CODE_DNODE_NO_ENCRYPT_KEY; + dError("failed to get crypt key"); + } + return -1; + } + + if(strlen(tsEncryptKey) == 0){ + terrno = TSDB_CODE_DNODE_NO_ENCRYPT_KEY; + dError("failed to get crypt key at startup since key is null, machineId:%s", pData->machineId); + return -1; + } + } + else{ + terrno = TSDB_CODE_DNODE_NO_MACHINE_CODE; + dError("failed to get crypt key at startup, machineId:%s", pData->machineId); + return -1; + } + } + */ +#endif + if (pData->dropped) { dError("dnode will not start since its already dropped"); return -1; diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 0dcb77d9df..0344ca685d 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -110,6 +110,8 @@ typedef struct { bool validMnodeEps; int64_t ipWhiteVer; char machineId[TSDB_MACHINE_ID_LEN + 1]; + EEncryptAlgor encryptAlgorigthm; + EEncryptScope encryptScope; } SDnodeData; typedef struct { @@ -191,7 +193,8 @@ void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port); void dmRemoveDnodePairs(SDnodeData *pData); void dmGetDnodeEp(void *pData, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort); - +int32_t dmUpdateEncryptKey(char *key); +int32_t dmGetEncryptKey(); #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index 2c341fbd4d..4b41b17cb1 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -64,7 +64,12 @@ static int32_t dmDecodeEps(SJson *pJson, SDnodeData *pData) { if (code < 0) return -1; tjsonGetInt32ValueFromDouble(pJson, "dropped", pData->dropped, code); if (code < 0) return -1; - +#ifdef TD_ENTERPRISE + tjsonGetInt32ValueFromDouble(pJson, "encryptAlgor", pData->encryptAlgorigthm, code); + if (code < 0) return -1; + tjsonGetInt32ValueFromDouble(pJson, "encryptScope", pData->encryptScope, code); + if (code < 0) return -1; +#endif SJson *dnodes = tjsonGetObjectItem(pJson, "dnodes"); if (dnodes == NULL) return 0; int32_t numOfDnodes = tjsonGetArraySize(dnodes); @@ -89,6 +94,25 @@ static int32_t dmDecodeEps(SJson *pJson, SDnodeData *pData) { return 0; } +int dmOccurrences(char *str, char *toSearch) { + int count = 0; + char *ptr = str; + while ((ptr = strstr(ptr, toSearch)) != NULL) { + count++; + ptr++; + } + return count; +} + +void dmSplitStr(char** arr, char* str, const char* del) { + char *lasts; + char* s = strsep(&str, del); + while (s != NULL) { + *arr++ = s; + s = strsep(&str, del); + } +} + int32_t dmReadEps(SDnodeData *pData) { int32_t code = -1; TdFilePtr pFile = NULL; @@ -106,6 +130,74 @@ int32_t dmReadEps(SDnodeData *pData) { if (taosStatFile(file, NULL, NULL, NULL) < 0) { dInfo("dnode file:%s not exist", file); + +#ifdef TD_ENTERPRISE + if(strlen(tsEncryptAlgorithm) > 0){ + if(strcmp(tsEncryptAlgorithm, "sm4") == 0) { + pData->encryptAlgorigthm = DND_CA_SM4; + } + else{ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG; + dError("invalid tsEncryptAlgorithm:%s", tsEncryptAlgorithm); + goto _OVER; + } + + dInfo("start to parse encryptScope:%s", tsEncryptScope); + int32_t scopeLen = strlen(tsEncryptScope); + if(scopeLen == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG; + dError("invalid tsEncryptScope:%s", tsEncryptScope); + goto _OVER; + } + + char* tmp = taosMemoryMalloc(scopeLen + 1); + memset(tmp, 0, scopeLen + 1); + memcpy(tmp, tsEncryptScope, scopeLen); + + int32_t count = dmOccurrences(tmp, ","); + + char** array = taosMemoryMalloc(sizeof(char*) * (count + 1)); + memset(array, 0, sizeof(char*) * (count + 1)); + dmSplitStr(array, tmp, ","); + + for(int32_t i = 0; i < count + 1; i++){ + char* str = *(array + i); + + bool success = false; + + if(strcasecmp(str, "tsdb") == 0 || strcasecmp(str, "all") == 0){ + pData->encryptScope |= DND_CS_TSDB; + success = true; + } + if(strcasecmp(str, "vnode_wal") == 0 || strcasecmp(str, "all") == 0){ + pData->encryptScope |= DND_CS_VNODE_WAL; + success = true; + } + if(strcasecmp(str, "sdb") == 0 || strcasecmp(str, "all") == 0){ + pData->encryptScope |= DND_CS_SDB; + success = true; + } + if(strcasecmp(str, "mnode_wal") == 0 || strcasecmp(str, "all") == 0){ + pData->encryptScope |= DND_CS_MNODE_WAL; + success = true; + } + + if(!success){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG; + taosMemoryFree(tmp); + taosMemoryFree(array); + dError("invalid tsEncryptScope:%s", tsEncryptScope); + goto _OVER; + } + } + + taosMemoryFree(tmp); + taosMemoryFree(array); + + dInfo("set tsCryptAlgorithm:%s, tsCryptScope:%s from cfg", tsEncryptAlgorithm, tsEncryptScope); + } + +#endif code = 0; goto _OVER; } @@ -191,7 +283,10 @@ static int32_t dmEncodeEps(SJson *pJson, SDnodeData *pData) { if (tjsonAddIntegerToObject(pJson, "engineVer", pData->engineVer) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "clusterId", pData->clusterId) < 0) return -1; if (tjsonAddDoubleToObject(pJson, "dropped", pData->dropped) < 0) return -1; - +#ifdef TD_ENTERPRISE + if (tjsonAddDoubleToObject(pJson, "encryptAlgor", pData->encryptAlgorigthm) < 0) return -1; + if (tjsonAddDoubleToObject(pJson, "encryptScope", pData->encryptScope) < 0) return -1; +#endif SJson *dnodes = tjsonCreateArray(); if (dnodes == NULL) return -1; if (tjsonAddItemToObject(pJson, "dnodes", dnodes) < 0) return -1; diff --git a/source/dnode/mgmt/node_util/src/dmFile.c b/source/dnode/mgmt/node_util/src/dmFile.c index 5cbeeebc14..e2c52cfb7e 100644 --- a/source/dnode/mgmt/node_util/src/dmFile.c +++ b/source/dnode/mgmt/node_util/src/dmFile.c @@ -16,8 +16,14 @@ #define _DEFAULT_SOURCE #include "dmUtil.h" #include "tjson.h" +#include "tgrant.h" +#include "crypt.h" +#include "tchecksum.h" #define MAXLEN 1024 +#define DM_KEY_INDICATOR "this indicator!" +#define DM_ENCRYPT_CODE_FILE "encryptCode.cfg" +#define DM_CHECK_CODE_FILE "checkCode.bin" static int32_t dmDecodeFile(SJson *pJson, bool *deployed) { int32_t code = 0; @@ -177,3 +183,296 @@ TdFilePtr dmCheckRunning(const char *dataDir) { dDebug("lock file:%s to prevent repeated starts", filepath); return pFile; } + +extern int32_t generateEncryptCode(const char *key, const char *machineId, char **encryptCode); + +static int32_t dmWriteCheckCodeFile(char* file, char* realfile, char* key){ + TdFilePtr pFile = NULL; + char *result = NULL; + int32_t code = -1; + + int32_t len = ENCRYPTED_LEN(sizeof(DM_KEY_INDICATOR)); + result = taosMemoryMalloc(len); + + SCryptOpts opts; + strncpy(opts.key, key, ENCRYPT_KEY_LEN); + opts.len = len; + opts.source = DM_KEY_INDICATOR; + opts.result = result; + opts.unitLen = 16; + CBC_Encrypt(&opts); + + pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); + if (pFile == NULL) goto _OVER; + + if (taosWriteFile(pFile, opts.result, len) <= 0) goto _OVER; + if (taosFsyncFile(pFile) < 0) goto _OVER; + + taosCloseFile(&pFile); + if (taosRenameFile(file, realfile) != 0) goto _OVER; + + dInfo("succeed to write checkCode file:%s", realfile); + code = 0; +_OVER: + if(pFile != NULL) taosCloseFile(&pFile); + if(result != NULL) taosMemoryFree(result); + + return code; +} + +static int32_t dmWriteEncryptCodeFile(char* file, char* realfile, char* encryptCode){ + TdFilePtr pFile = NULL; + int32_t code = -1; + + pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); + if (pFile == NULL) goto _OVER; + + int32_t len = strlen(encryptCode); + if (taosWriteFile(pFile, encryptCode, len) <= 0) goto _OVER; + if (taosFsyncFile(pFile) < 0) goto _OVER; + + taosCloseFile(&pFile); + if (taosRenameFile(file, realfile) != 0) goto _OVER; + + dInfo("succeed to write encryptCode file:%s", realfile); + + code = 0; +_OVER: + if(pFile != NULL) taosCloseFile(&pFile); + + return code; +} + +static int32_t dmCompareEncryptKey(char* file, char* key){ + char *content = NULL; + int64_t size = 0; + TdFilePtr pFile = NULL; + char *result = NULL; + int32_t code = -1; + + pFile = taosOpenFile(file, TD_FILE_READ); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to open dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + if (taosFStatFile(pFile, &size, NULL) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to fstat dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + content = taosMemoryMalloc(size); + if (content == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + if (taosReadFile(pFile, content, size) != size) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to read dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + dInfo("succeed to read checkCode file:%s", file); + + int len = ENCRYPTED_LEN(size); + result = taosMemoryMalloc(len); + + SCryptOpts opts = {0}; + strncpy(opts.key, key, ENCRYPT_KEY_LEN); + opts.len = len; + opts.source = content; + opts.result = result; + opts.unitLen = 16; + CBC_Decrypt(&opts); + + if(strcmp(opts.result, DM_KEY_INDICATOR) != 0) { + terrno = TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED; + dError("failed to compare decrypted result"); + goto _OVER; + } + + dInfo("succeed to compare checkCode file:%s", file); + code = 0; +_OVER: + if(result != NULL) taosMemoryFree(result); + if(content != NULL) taosMemoryFree(content); + if(pFile != NULL) taosCloseFile(&pFile); + + return code; +} + +int32_t dmUpdateEncryptKey(char *key) { +#ifdef TD_ENTERPRISE + int32_t code = -1; + char *machineId = NULL; + char *encryptCode = NULL; + + char folder[PATH_MAX] = {0}; + + char encryptFile[PATH_MAX] = {0}; + char realEncryptFile[PATH_MAX] = {0}; + + char checkFile[PATH_MAX] = {0}; + char realCheckFile[PATH_MAX] = {0}; + + snprintf(folder, sizeof(folder), "%s%sdnode", tsDataDir, TD_DIRSEP); + snprintf(encryptFile, sizeof(realEncryptFile), "%s%s%s.bak", folder, TD_DIRSEP, DM_ENCRYPT_CODE_FILE); + snprintf(realEncryptFile, sizeof(realEncryptFile), "%s%s%s", folder, TD_DIRSEP, DM_ENCRYPT_CODE_FILE); + snprintf(checkFile, sizeof(checkFile), "%s%s%s.bak", folder, TD_DIRSEP, DM_CHECK_CODE_FILE); + snprintf(realCheckFile, sizeof(realCheckFile), "%s%s%s", folder, TD_DIRSEP, DM_CHECK_CODE_FILE); + + terrno = 0; + + if (taosMkDir(folder) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to create dir:%s since %s", folder, terrstr()); + goto _OVER; + } + + if(taosCheckExistFile(realCheckFile)){ + if(dmCompareEncryptKey(realCheckFile, key) != 0){ + goto _OVER; + } + } + + if (!(machineId = tGetMachineId())) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + if (generateEncryptCode(key, machineId, &encryptCode) != 0) { + goto _OVER; + } + + if(dmWriteEncryptCodeFile(encryptFile, realEncryptFile, encryptCode) != 0){ + goto _OVER; + } + + if(dmWriteCheckCodeFile(checkFile, realCheckFile, key) != 0){ + goto _OVER; + } + + code = 0; +_OVER: + taosMemoryFree(encryptCode); + taosMemoryFree(machineId); + if (code != 0) { + if (terrno == 0) terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to update encrypt key since %s", terrstr()); + } + return code; +#else + return 0; +#endif +} + +extern int32_t checkAndGetCryptKey(const char *encryptCode, const char *machineId, char **key); + +static int32_t dmReadEncryptCodeFile(char* file, char** output){ + TdFilePtr pFile = NULL; + int32_t code = -1; + char *content = NULL; + + pFile = taosOpenFile(file, TD_FILE_READ); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to open dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + int64_t size = 0; + if (taosFStatFile(pFile, &size, NULL) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to fstat dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + content = taosMemoryMalloc(size + 1); + if (content == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + if (taosReadFile(pFile, content, size) != size) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to read dnode file:%s since %s", file, terrstr()); + goto _OVER; + } + + content[size] = '\0'; + + *output = content; + + dInfo("succeed to read encryptCode file:%s", file); + code = 0; +_OVER: + if(pFile != NULL) taosCloseFile(&pFile); + + return code; +} + +int32_t dmGetEncryptKey(){ +#ifdef TD_ENTERPRISE + int32_t code = -1; + char encryptFile[PATH_MAX] = {0}; + char checkFile[PATH_MAX] = {0}; + char *machineId = NULL; + char *encryptKey = NULL; + char *content = NULL; + + snprintf(encryptFile, sizeof(encryptFile), "%s%sdnode%s%s", tsDataDir, TD_DIRSEP, TD_DIRSEP, DM_ENCRYPT_CODE_FILE); + snprintf(checkFile, sizeof(checkFile), "%s%sdnode%s%s", tsDataDir, TD_DIRSEP, TD_DIRSEP, DM_CHECK_CODE_FILE); + + if(!taosCheckExistFile(encryptFile)){ + dInfo("no exist, checkCode file:%s", encryptFile); + return 0; + } + + if(dmReadEncryptCodeFile(encryptFile, &content) != 0){ + goto _OVER; + } + + if (!(machineId = tGetMachineId())) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + if(checkAndGetCryptKey(content, machineId, &encryptKey) != 0){ + goto _OVER; + } + + taosMemoryFreeClear(machineId); + taosMemoryFreeClear(content); + + if(encryptKey[0] == '\0'){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + dError("failed to read key since %s", terrstr()); + goto _OVER; + } + + if(dmCompareEncryptKey(checkFile, encryptKey) != 0){ + goto _OVER; + } + + strncpy(tsEncryptKey, encryptKey, ENCRYPT_KEY_LEN); + taosMemoryFreeClear(encryptKey); + tsEncryptionKeyChksum = taosCalcChecksum(0, tsEncryptKey, strlen(tsEncryptKey)); + tsEncryptionKeyStat = ENCRYPT_KEY_STAT_LOADED; + + code = 0; +_OVER: + if (content != NULL) taosMemoryFree(content); + if (encryptKey != NULL) taosMemoryFree(encryptKey); + if (machineId != NULL) taosMemoryFree(machineId); + if (code != 0) { + if (terrno == 0) terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to get encrypt key since %s", terrstr()); + } + return code; +#else + return 0; +#endif +} \ No newline at end of file diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index ab2a63c59c..acd0a2009c 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -141,6 +141,7 @@ typedef enum { DND_REASON_CHARSET_NOT_MATCH, DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH, DND_REASON_ENABLE_WHITELIST_NOT_MATCH, + DND_REASON_ENCRYPTION_KEY_NOT_MATCH, DND_REASON_OTHERS } EDndReason; @@ -215,6 +216,8 @@ typedef struct { int64_t memAvail; int64_t memUsed; EDndReason offlineReason; + uint32_t encryptionKeyChksum; + int8_t encryptionKeyStat; uint16_t port; char fqdn[TSDB_FQDN_LEN]; char ep[TSDB_EP_LEN]; @@ -383,6 +386,7 @@ typedef struct { int32_t s3KeepLocal; int8_t s3Compact; int8_t withArbitrator; + int8_t encryptAlgorithm; } SDbCfg; typedef struct { diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index 72f9ec1735..2da14c65d2 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -104,6 +104,13 @@ typedef struct { int64_t timeseriesAllowed; } SGrantInfo; +typedef struct { + int8_t encrypting; + int16_t nEncrypt; + int16_t nSuccess; + int16_t nFailed; +} SEncryptMgmt; + typedef struct SMnode { int32_t selfDnodeId; int64_t clusterId; @@ -127,6 +134,7 @@ typedef struct SMnode { SProfileMgmt profileMgmt; STelemMgmt telemMgmt; SSyncMgmt syncMgmt; + SEncryptMgmt encryptMgmt; SGrantInfo grant; MndMsgFp msgFp[TDMT_MAX]; SMsgCb msgCb; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 26649df530..ef0d246171 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -36,7 +36,7 @@ #include "tjson.h" #define DB_VER_NUMBER 1 -#define DB_RESERVE_SIZE 28 +#define DB_RESERVE_SIZE 27 static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw); static int32_t mndDbActionInsert(SSdb *pSdb, SDbObj *pDb); @@ -146,6 +146,7 @@ SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT32(pRaw, dataPos, pDb->cfg.s3KeepLocal, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.s3Compact, _OVER) SDB_SET_INT8(pRaw, dataPos, pDb->cfg.withArbitrator, _OVER) + SDB_SET_INT8(pRaw, dataPos, pDb->cfg.encryptAlgorithm, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->tsmaVersion, _OVER); SDB_SET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER) @@ -242,6 +243,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { SDB_GET_INT32(pRaw, dataPos, &pDb->cfg.s3KeepLocal, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.s3Compact, _OVER) SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.withArbitrator, _OVER) + SDB_GET_INT8(pRaw, dataPos, &pDb->cfg.encryptAlgorithm, _OVER) SDB_GET_INT32(pRaw, dataPos, &pDb->tsmaVersion, _OVER); SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER) @@ -425,9 +427,12 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->replications < TSDB_MIN_DB_REPLICA || pCfg->replications > TSDB_MAX_DB_REPLICA) return -1; #ifdef TD_ENTERPRISE if ((pCfg->replications == 2) ^ (pCfg->withArbitrator == TSDB_MAX_DB_WITH_ARBITRATOR)) return -1; + if (pCfg->encryptAlgorithm < TSDB_MIN_ENCRYPT_ALGO || pCfg->encryptAlgorithm > TSDB_MAX_ENCRYPT_ALGO) return -1; #else if (pCfg->replications != 1 && pCfg->replications != 3) return -1; + if (pCfg->encryptAlgorithm != TSDB_DEFAULT_ENCRYPT_ALGO) return -1; #endif + if (pCfg->strict < TSDB_DB_STRICT_OFF || pCfg->strict > TSDB_DB_STRICT_ON) return -1; if (pCfg->schemaless < TSDB_DB_SCHEMALESS_OFF || pCfg->schemaless > TSDB_DB_SCHEMALESS_ON) return -1; if (pCfg->cacheLast < TSDB_CACHE_MODEL_NONE || pCfg->cacheLast > TSDB_CACHE_MODEL_BOTH) return -1; @@ -544,6 +549,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->s3KeepLocal <= 0) pCfg->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; if (pCfg->s3Compact <= 0) pCfg->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (pCfg->withArbitrator < 0) pCfg->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; + if (pCfg->encryptAlgorithm < 0) pCfg->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; } static int32_t mndSetCreateDbPrepareAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { @@ -721,6 +727,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, .s3Compact = pCreate->s3Compact, .tsdbPageSize = pCreate->tsdbPageSize, .withArbitrator = pCreate->withArbitrator, + .encryptAlgorithm = pCreate->encryptAlgorithm, }; dbObj.cfg.numOfRetensions = pCreate->numOfRetensions; @@ -806,6 +813,46 @@ static void mndBuildAuditDetailInt64(char *detail, char *tmp, char *format, int6 } } +static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { + int32_t code = 0; + SSdb *pSdb = pMnode->pSdb; + SDnodeObj *pDnode = NULL; + void *pIter = NULL; + +#ifdef TD_ENTERPRISE + if (pReq->encryptAlgorithm == TSDB_ENCRYPT_ALGO_NONE) goto _exit; + if (tsEncryptionKeyStat != ENCRYPT_KEY_STAT_LOADED) { + code = TSDB_CODE_MND_INVALID_ENCRYPT_KEY; + mError("db:%s, failed to check encryption key:%" PRIi8 " in mnode leader since it's not loaded", pReq->db, + tsEncryptionKeyStat); + goto _exit; + } + + int64_t curMs = taosGetTimestampMs(); + while ((pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode))) { + bool online = false; + if ((pDnode->encryptionKeyStat != tsEncryptionKeyStat || pDnode->encryptionKeyChksum != tsEncryptionKeyChksum) && + (online = mndIsDnodeOnline(pDnode, curMs))) { + code = TSDB_CODE_MND_INVALID_ENCRYPT_KEY; + mError("db:%s, failed to check encryption key:%" PRIi8 + "-%u in dnode:%d since it's inconsitent with mnode leader:%" PRIi8 "-%u", + pReq->db, pDnode->encryptionKeyStat, pDnode->encryptionKeyChksum, pDnode->id, tsEncryptionKeyStat, + tsEncryptionKeyChksum); + sdbRelease(pSdb, pDnode); + break; + } + sdbRelease(pSdb, pDnode); + } +#else + if (pReq->encryptAlgorithm != TSDB_ENCRYPT_ALGO_NONE) { + code = TSDB_CODE_MND_INVALID_DB_OPTION; + goto _exit; + } +#endif +_exit: + return code; +} + static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; @@ -856,6 +903,11 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { } } + if ((code = mndCheckDbEncryptKey(pMnode, &createReq)) != 0) { + terrno = code; + goto _OVER; + } + pUser = mndAcquireUser(pMnode, pReq->info.conn.user); if (pUser == NULL) { goto _OVER; @@ -1207,6 +1259,7 @@ static void mndDumpDbCfgInfo(SDbCfgRsp *cfgRsp, SDbObj *pDb) { cfgRsp->s3KeepLocal = pDb->cfg.s3KeepLocal; cfgRsp->s3Compact = pDb->cfg.s3Compact; cfgRsp->withArbitrator = pDb->cfg.withArbitrator; + cfgRsp->encryptAlgorithm = pDb->cfg.encryptAlgorithm; } static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) { @@ -2028,6 +2081,18 @@ static const char *getCacheModelStr(int8_t cacheModel) { return "unknown"; } +static const char *getEncryptAlgorithmStr(int8_t encryptAlgorithm) { + switch (encryptAlgorithm) { + case TSDB_ENCRYPT_ALGO_NONE: + return TSDB_ENCRYPT_ALGO_NONE_STR; + case TSDB_ENCRYPT_ALGO_SM4: + return TSDB_ENCRYPT_ALGO_SM4_STR; + default: + break; + } + return "unknown"; +} + bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb) { if (pDb->cfg.replications == 1) return true; @@ -2248,6 +2313,12 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb, pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false); + + const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm); + char encryptAlgorithmVStr[24] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false); } taosMemoryFree(buf); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 57c947eb81..57ddbb9beb 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -42,11 +42,13 @@ static const char *offlineReason[] = { "version not match", "dnodeId not match", "clusterId not match", - "interval not match", + "statusInterval not match", "timezone not match", "locale not match", "charset not match", "ttlChangeOnWrite not match", + "enableWhiteList not match", + "encryptionKey not match", "unknown", }; @@ -78,6 +80,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq); static int32_t mndProcessNotifyReq(SRpcMsg *pReq); static int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq); static int32_t mndProcessStatisReq(SRpcMsg *pReq); +static int32_t mndProcessCreateEncryptKeyReq(SRpcMsg *pRsp); +static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp); static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextConfig(SMnode *pMnode, void *pIter); @@ -114,6 +118,8 @@ int32_t mndInitDnode(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_SHOW_VARIABLES, mndProcessShowVariablesReq); mndSetMsgHandle(pMnode, TDMT_MND_RESTORE_DNODE, mndProcessRestoreDnodeReq); mndSetMsgHandle(pMnode, TDMT_MND_STATIS, mndProcessStatisReq); + mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ENCRYPT_KEY, mndProcessCreateEncryptKeyReq); + mndSetMsgHandle(pMnode, TDMT_DND_CREATE_ENCRYPT_KEY_RSP, mndProcessCreateEncryptKeyRsp); mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndRetrieveConfigs); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONFIGS, mndCancelGetNextConfig); @@ -372,7 +378,7 @@ int32_t mndGetDbSize(SMnode *pMnode) { bool mndIsDnodeOnline(SDnodeObj *pDnode, int64_t curMs) { int64_t interval = TABS(pDnode->lastAccessTime - curMs); if (interval > 5000 * (int64_t)tsStatusInterval) { - if (pDnode->rebootTime > 0) { + if (pDnode->rebootTime > 0 && pDnode->offlineReason == DND_REASON_ONLINE) { pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT; } return false; @@ -436,37 +442,51 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const S if (pCfg->statusInterval != tsStatusInterval) { mError("dnode:%d, statusInterval:%d inconsistent with cluster:%d", pDnode->id, pCfg->statusInterval, tsStatusInterval); + terrno = TSDB_CODE_DNODE_INVALID_STATUS_INTERVAL; return DND_REASON_STATUS_INTERVAL_NOT_MATCH; } if ((0 != strcasecmp(pCfg->timezone, tsTimezoneStr)) && (pMnode->checkTime != pCfg->checkTime)) { mError("dnode:%d, timezone:%s checkTime:%" PRId64 " inconsistent with cluster %s %" PRId64, pDnode->id, pCfg->timezone, pCfg->checkTime, tsTimezoneStr, pMnode->checkTime); + terrno = TSDB_CODE_DNODE_INVALID_TIMEZONE; return DND_REASON_TIME_ZONE_NOT_MATCH; } if (0 != strcasecmp(pCfg->locale, tsLocale)) { mError("dnode:%d, locale:%s inconsistent with cluster:%s", pDnode->id, pCfg->locale, tsLocale); + terrno = TSDB_CODE_DNODE_INVALID_LOCALE; return DND_REASON_LOCALE_NOT_MATCH; } if (0 != strcasecmp(pCfg->charset, tsCharset)) { mError("dnode:%d, charset:%s inconsistent with cluster:%s", pDnode->id, pCfg->charset, tsCharset); + terrno = TSDB_CODE_DNODE_INVALID_CHARSET; return DND_REASON_CHARSET_NOT_MATCH; } if (pCfg->ttlChangeOnWrite != tsTtlChangeOnWrite) { mError("dnode:%d, ttlChangeOnWrite:%d inconsistent with cluster:%d", pDnode->id, pCfg->ttlChangeOnWrite, tsTtlChangeOnWrite); + terrno = TSDB_CODE_DNODE_INVALID_TTL_CHG_ON_WR; return DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH; } int8_t enable = tsEnableWhiteList ? 1 : 0; if (pCfg->enableWhiteList != enable) { - mError("dnode:%d, enable :%d inconsistent with cluster:%d", pDnode->id, pCfg->enableWhiteList, enable); + mError("dnode:%d, enableWhiteList:%d inconsistent with cluster:%d", pDnode->id, pCfg->enableWhiteList, enable); + terrno = TSDB_CODE_DNODE_INVALID_EN_WHITELIST; return DND_REASON_ENABLE_WHITELIST_NOT_MATCH; } - return 0; + if (!atomic_load_8(&pMnode->encryptMgmt.encrypting) && + (pCfg->encryptionKeyStat != tsEncryptionKeyStat || pCfg->encryptionKeyChksum != tsEncryptionKeyChksum)) { + mError("dnode:%d, encryptionKey:%" PRIi8 "-%u inconsistent with cluster:%" PRIi8 "-%u", pDnode->id, + pCfg->encryptionKeyStat, pCfg->encryptionKeyChksum, tsEncryptionKeyStat, tsEncryptionKeyChksum); + terrno = pCfg->encryptionKeyChksum ? TSDB_CODE_DNODE_INVALID_ENCRYPTKEY : TSDB_CODE_DNODE_NO_ENCRYPT_KEY; + return DND_REASON_ENCRYPTION_KEY_NOT_MATCH; + } + + return DND_REASON_ONLINE; } static bool mndUpdateVnodeState(int32_t vgId, SVnodeGid *pGid, SVnodeLoad *pVload) { @@ -795,8 +815,9 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { bool dnodeChanged = (statusReq.dnodeVer == 0) || (statusReq.dnodeVer != dnodeVer); bool reboot = (pDnode->rebootTime != statusReq.rebootTime); bool supportVnodesChanged = pDnode->numOfSupportVnodes != statusReq.numOfSupportVnodes; - bool needCheck = - !online || dnodeChanged || reboot || supportVnodesChanged || pMnode->ipWhiteVer != statusReq.ipWhiteVer; + bool encryptKeyChanged = pDnode->encryptionKeyChksum != statusReq.clusterCfg.encryptionKeyChksum; + bool needCheck = !online || dnodeChanged || reboot || supportVnodesChanged || + pMnode->ipWhiteVer != statusReq.ipWhiteVer || encryptKeyChanged; const STraceId *trace = &pReq->info.traceId; mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id, @@ -891,7 +912,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { pDnode->offlineReason = mndCheckClusterCfgPara(pMnode, pDnode, &statusReq.clusterCfg); if (pDnode->offlineReason != 0) { mError("dnode:%d, cluster cfg inconsistent since:%s", pDnode->id, offlineReason[pDnode->offlineReason]); - terrno = TSDB_CODE_MND_INVALID_CLUSTER_CFG; + if (terrno == 0) terrno = TSDB_CODE_MND_INVALID_CLUSTER_CFG; goto _OVER; } @@ -909,6 +930,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { pDnode->numOfDiskCfg = statusReq.numOfDiskCfg; pDnode->memAvail = statusReq.memAvail; pDnode->memTotal = statusReq.memTotal; + pDnode->encryptionKeyStat = statusReq.clusterCfg.encryptionKeyStat; + pDnode->encryptionKeyChksum = statusReq.clusterCfg.encryptionKeyChksum; if (memcmp(pDnode->machineId, statusReq.machineId, TSDB_MACHINE_ID_LEN) != 0) { tstrncpy(pDnode->machineId, statusReq.machineId, TSDB_MACHINE_ID_LEN + 1); mndUpdateDnodeObj(pMnode, pDnode); @@ -1494,6 +1517,136 @@ static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp) { return 0; } +static int32_t mndProcessCreateEncryptKeyReqImpl(SRpcMsg *pReq, int32_t dnodeId, SDCfgDnodeReq *pDcfgReq) { + int32_t code = 0; + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + int8_t encrypting = 0; + + const STraceId *trace = &pReq->info.traceId; + + int32_t klen = strlen(pDcfgReq->value); + if (klen > ENCRYPT_KEY_LEN || klen < ENCRYPT_KEY_LEN_MIN) { + code = TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN; + mGError("msg:%p, failed to create encrypt_key since invalid key length:%d, valid range:[%d, %d]", pReq, klen, + ENCRYPT_KEY_LEN_MIN, ENCRYPT_KEY_LEN); + goto _exit; + } + + if (0 != (encrypting = atomic_val_compare_exchange_8(&pMnode->encryptMgmt.encrypting, 0, 1))) { + code = TSDB_CODE_QRY_DUPLICATED_OPERATION; + mGWarn("msg:%p, failed to create encrypt key since %s, encrypting:%" PRIi8, pReq, tstrerror(code), encrypting); + goto _exit; + } + + if (tsEncryptionKeyStat == ENCRYPT_KEY_STAT_SET || tsEncryptionKeyStat == ENCRYPT_KEY_STAT_LOADED) { + atomic_store_8(&pMnode->encryptMgmt.encrypting, 0); + code = TSDB_CODE_QRY_DUPLICATED_OPERATION; + mGWarn("msg:%p, failed to create encrypt key since %s, stat:%" PRIi8 ", checksum:%u", pReq, tstrerror(code), + tsEncryptionKeyStat, tsEncryptionKeyChksum); + goto _exit; + } + + atomic_store_16(&pMnode->encryptMgmt.nEncrypt, 0); + atomic_store_16(&pMnode->encryptMgmt.nSuccess, 0); + atomic_store_16(&pMnode->encryptMgmt.nFailed, 0); + + while (1) { + SDnodeObj *pDnode = NULL; + pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode); + if (pIter == NULL) break; + if (pDnode->offlineReason != DND_REASON_ONLINE) { + mGWarn("msg:%p, don't send create encrypt_key req since dnode:%d in offline state:%s", pReq, pDnode->id, + offlineReason[pDnode->offlineReason]); + sdbRelease(pSdb, pDnode); + continue; + } + + if (dnodeId == -1 || pDnode->id == dnodeId || dnodeId == 0) { + SEpSet epSet = mndGetDnodeEpset(pDnode); + int32_t bufLen = tSerializeSDCfgDnodeReq(NULL, 0, pDcfgReq); + void *pBuf = rpcMallocCont(bufLen); + + if (pBuf != NULL) { + tSerializeSDCfgDnodeReq(pBuf, bufLen, pDcfgReq); + SRpcMsg rpcMsg = {.msgType = TDMT_DND_CREATE_ENCRYPT_KEY, .pCont = pBuf, .contLen = bufLen}; + if (0 == tmsgSendReq(&epSet, &rpcMsg)) { + atomic_add_fetch_16(&pMnode->encryptMgmt.nEncrypt, 1); + } + } + } + + sdbRelease(pSdb, pDnode); + } + + if (atomic_load_16(&pMnode->encryptMgmt.nEncrypt) <= 0) { + atomic_store_8(&pMnode->encryptMgmt.encrypting, 0); + } + +_exit: + if (code != 0) { + if (terrno == 0) terrno = code; + } + return code; +} + +static int32_t mndProcessCreateEncryptKeyReq(SRpcMsg *pReq) { +#ifdef TD_ENTERPRISE + SMnode *pMnode = pReq->info.node; + SMCfgDnodeReq cfgReq = {0}; + if (tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) { + terrno = TSDB_CODE_INVALID_MSG; + return -1; + } + + if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONFIG_DNODE) != 0) { + tFreeSMCfgDnodeReq(&cfgReq); + return -1; + } + const STraceId *trace = &pReq->info.traceId; + SDCfgDnodeReq dcfgReq = {0}; + if (strncasecmp(cfgReq.config, "encrypt_key", 12) == 0) { + strcpy(dcfgReq.config, cfgReq.config); + strcpy(dcfgReq.value, cfgReq.value); + tFreeSMCfgDnodeReq(&cfgReq); + return mndProcessCreateEncryptKeyReqImpl(pReq, cfgReq.dnodeId, &dcfgReq); + } else { + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; + tFreeSMCfgDnodeReq(&cfgReq); + return -1; + } + +#else + return 0; +#endif +} + +static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp) { + SMnode *pMnode = pRsp->info.node; + int16_t nSuccess = 0; + int16_t nFailed = 0; + + if (0 == pRsp->code) { + nSuccess = atomic_add_fetch_16(&pMnode->encryptMgmt.nSuccess, 1); + } else { + nFailed = atomic_add_fetch_16(&pMnode->encryptMgmt.nFailed, 1); + } + + int16_t nReq = atomic_load_16(&pMnode->encryptMgmt.nEncrypt); + bool finished = nSuccess + nFailed >= nReq; + + if (finished) { + atomic_store_8(&pMnode->encryptMgmt.encrypting, 0); + } + + const STraceId *trace = &pRsp->info.traceId; + mGInfo("msg:%p, create encrypt key rsp, nReq:%" PRIi16 ", nSucess:%" PRIi16 ", nFailed:%" PRIi16 ", %s", pRsp, nReq, + nSuccess, nFailed, finished ? "encrypt done" : "in encrypting"); + + return 0; +} + static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->info.node; int32_t totalRows = 0; @@ -1550,7 +1703,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB ESdbStatus objStatus = 0; SDnodeObj *pDnode = NULL; int64_t curMs = taosGetTimestampMs(); - char buf[TSDB_CONN_ACTIVE_KEY_LEN + VARSTR_HEADER_SIZE]; // make sure TSDB_CONN_ACTIVE_KEY_LEN >= TSDB_EP_LEN + char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE]; while (numOfRows < rows) { pShow->pIter = sdbFetchAll(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode, &objStatus, true); diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c index 00e72fb329..5561eea405 100644 --- a/source/dnode/mnode/impl/src/mndDump.c +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -104,6 +104,7 @@ void dumpDb(SSdb *pSdb, SJson *json) { tjsonAddStringToObject(item, "maxRows", i642str(pObj->cfg.maxRows)); tjsonAddStringToObject(item, "precision", i642str(pObj->cfg.precision)); tjsonAddStringToObject(item, "compression", i642str(pObj->cfg.compression)); + tjsonAddStringToObject(item, "encryptAlgorithm", i642str(pObj->cfg.encryptAlgorithm)); tjsonAddStringToObject(item, "replications", i642str(pObj->cfg.replications)); tjsonAddStringToObject(item, "strict", i642str(pObj->cfg.strict)); tjsonAddStringToObject(item, "cacheLast", i642str(pObj->cfg.cacheLast)); diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 2ec6e09d12..cce386785a 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -58,6 +58,7 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl static int32_t mndRetrieveGrantFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } static int32_t mndRetrieveGrantLogs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } static int32_t mndRetrieveMachines(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } +static int32_t mndRetrieveEncryptions(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } static int32_t mndProcessGrantHB(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; } @@ -66,6 +67,7 @@ int32_t mndInitGrant(SMnode *pMnode) { mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_FULL, mndRetrieveGrantFull); mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_LOGS, mndRetrieveGrantLogs); mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_MACHINES, mndRetrieveMachines); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ENCRYPTIONS, mndRetrieveEncryptions); mndSetMsgHandle(pMnode, TDMT_MND_GRANT_HB_TIMER, mndProcessGrantHB); return 0; } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 14328da108..a78edcb05e 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -485,8 +485,23 @@ static int32_t mndInitWal(SMnode *pMnode) { .retentionPeriod = 0, .retentionSize = 0, .level = TAOS_WAL_FSYNC, + .encryptAlgorithm = 0, + .encryptKey = {0} }; +#if defined(TD_ENTERPRISE) + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_MNODE_WAL) == DND_CS_MNODE_WAL){ + cfg.encryptAlgorithm = (tsiEncryptScope & DND_CS_MNODE_WAL)? tsiEncryptAlgorithm : 0; + if(tsEncryptKey[0] == '\0'){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(cfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } +#endif + pMnode->pWal = walOpen(path, &cfg); if (pMnode->pWal == NULL) { mError("failed to open wal since %s. wal:%s", terrstr(), path); diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 8c6ab6e518..5dcd7b3d38 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -131,6 +131,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { type = TSDB_MGMT_TABLE_GRANTS_LOGS; } else if (strncasecmp(name, TSDB_INS_TABLE_MACHINES, len) == 0) { type = TSDB_MGMT_TABLE_MACHINES; + } else if (strncasecmp(name, TSDB_INS_TABLE_ENCRYPTIONS, len) == 0) { + type = TSDB_MGMT_TABLE_ENCRYPTIONS; } else if (strncasecmp(name, TSDB_INS_TABLE_TSMAS, len) == 0) { type = TSDB_MGMT_TABLE_TSMAS; } else { diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index e9d587e199..3fc89c3d84 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -307,6 +307,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg createReq.hashSuffix = pDb->cfg.hashSuffix; createReq.tsdbPageSize = pDb->cfg.tsdbPageSize; createReq.changeVersion = ++(pVgroup->syncConfChangeVer); + createReq.encryptAlgorithm = pDb->cfg.encryptAlgorithm; for (int32_t v = 0; v < pVgroup->replica; ++v) { SReplica *pReplica = NULL; diff --git a/source/dnode/mnode/sdb/CMakeLists.txt b/source/dnode/mnode/sdb/CMakeLists.txt index 186c85004a..63f54abfcc 100644 --- a/source/dnode/mnode/sdb/CMakeLists.txt +++ b/source/dnode/mnode/sdb/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - sdb os common util wal sync + sdb os common util wal sync crypt ) diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 2e182ec10b..d94650695c 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -18,6 +18,8 @@ #include "sync.h" #include "tchecksum.h" #include "wal.h" +#include "tglobal.h" +#include "crypt.h" #define SDB_TABLE_SIZE 24 #define SDB_RESERVE_SIZE 512 @@ -276,6 +278,9 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { } readLen = pRaw->dataLen + sizeof(int32_t); + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_SDB) == DND_CS_SDB ){ + readLen = ENCRYPTED_LEN(pRaw->dataLen) + sizeof(int32_t); + } if (readLen >= bufLen) { bufLen = pRaw->dataLen * 2; SSdbRaw *pNewRaw = taosMemoryMalloc(bufLen + 100); @@ -303,6 +308,27 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { goto _OVER; } + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_SDB) == DND_CS_SDB ){ + int32_t count = 0; + + char *plantContent = taosMemoryMalloc(ENCRYPTED_LEN(pRaw->dataLen)); + + SCryptOpts opts; + opts.len = ENCRYPTED_LEN(pRaw->dataLen); + opts.source = pRaw->pData; + opts.result = plantContent; + opts.unitLen = 16; + strncpy(opts.key, tsEncryptKey, ENCRYPT_KEY_LEN); + + count = CBC_Decrypt(&opts); + + //mDebug("read sdb, CBC_Decrypt dataLen:%d, descrypted len:%d, %s", pRaw->dataLen, count, __FUNCTION__); + + memcpy(pRaw->pData, plantContent, pRaw->dataLen); + taosMemoryFree(plantContent); + memcpy(pRaw->pData + pRaw->dataLen, &pRaw->pData[ENCRYPTED_LEN(pRaw->dataLen)], sizeof(int32_t)); + } + int32_t totalLen = sizeof(SSdbRaw) + pRaw->dataLen + sizeof(int32_t); if ((!taosCheckChecksumWhole((const uint8_t *)pRaw, totalLen)) != 0) { code = TSDB_CODE_CHECKSUM_ERROR; @@ -401,14 +427,50 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) { SSdbRaw *pRaw = (*encodeFp)(pRow->pObj); if (pRaw != NULL) { pRaw->status = pRow->status; - int32_t writeLen = sizeof(SSdbRaw) + pRaw->dataLen; - if (taosWriteFile(pFile, pRaw, writeLen) != writeLen) { + + if (taosWriteFile(pFile, pRaw, sizeof(SSdbRaw)) != sizeof(SSdbRaw)) { code = TAOS_SYSTEM_ERROR(errno); taosHashCancelIterate(hash, ppRow); sdbFreeRaw(pRaw); break; } + int32_t newDataLen = pRaw->dataLen; + char* newData = pRaw->pData; + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_SDB) == DND_CS_SDB ){ + newDataLen = ENCRYPTED_LEN(pRaw->dataLen); + newData = taosMemoryMalloc(newDataLen); + if (newData == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + taosHashCancelIterate(hash, ppRow); + sdbFreeRaw(pRaw); + break; + } + + SCryptOpts opts; + opts.len = newDataLen; + opts.source = pRaw->pData; + opts.result = newData; + opts.unitLen = 16; + strncpy(opts.key, tsEncryptKey, ENCRYPT_KEY_LEN); + + int32_t count = CBC_Encrypt(&opts); + + //mDebug("write sdb, CBC_Encrypt encryptedDataLen:%d, dataLen:%d, %s", + // newDataLen, pRaw->dataLen, __FUNCTION__); + } + + if (taosWriteFile(pFile, newData, newDataLen) != newDataLen) { + code = TAOS_SYSTEM_ERROR(errno); + taosHashCancelIterate(hash, ppRow); + sdbFreeRaw(pRaw); + break; + } + + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_SDB) == DND_CS_SDB ){ + taosMemoryFree(newData); + } + int32_t cksum = taosCalcChecksum(0, (const uint8_t *)pRaw, sizeof(SSdbRaw) + pRaw->dataLen); if (taosWriteFile(pFile, &cksum, sizeof(int32_t)) != sizeof(int32_t)) { code = TAOS_SYSTEM_ERROR(errno); diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 34669ec578..43e680c382 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -121,6 +121,7 @@ if (${BUILD_CONTRIB}) PUBLIC "inc" PUBLIC "src/inc" PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar" + PUBLIC "${TD_SOURCE_DIR}/include/libs/crypt" PUBLIC "${TD_SOURCE_DIR}/include/dnode/vnode" PUBLIC "${TD_SOURCE_DIR}/contrib/rocksdb/include" ) @@ -130,6 +131,7 @@ else() PUBLIC "inc" PUBLIC "src/inc" PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar" + PUBLIC "${TD_SOURCE_DIR}/include/libs/crypt" PUBLIC "${TD_SOURCE_DIR}/include/dnode/vnode" ) if (${TD_LINUX}) @@ -162,6 +164,7 @@ target_link_libraries( PUBLIC scheduler PUBLIC tdb PUBLIC audit + PUBLIC crypt # PUBLIC bdb # PUBLIC scalar diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 29633ac008..21d967ad93 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -278,6 +278,8 @@ struct STsdbCfg { int32_t keep2; // just for save config, don't use in tsdbRead/tsdbCommit/..., and use STsdbKeepCfg in STsdb instead int32_t keepTimeOffset; // just for save config, use STsdbKeepCfg in STsdb instead SRetention retentions[TSDB_RETENTION_MAX]; + int32_t encryptAlgorithm; + char encryptKey[ENCRYPT_KEY_LEN + 1]; }; typedef struct { @@ -319,6 +321,8 @@ struct SVnodeCfg { int16_t hashPrefix; int16_t hashSuffix; int32_t tsdbPageSize; + int32_t tdbEncryptAlgorithm; + char tdbEncryptKey[ENCRYPT_KEY_LEN]; int32_t s3ChunkSize; int32_t s3KeepLocal; int8_t s3Compact; diff --git a/source/dnode/vnode/src/meta/metaEntry.c b/source/dnode/vnode/src/meta/metaEntry.c index 7477833fe9..eb41ffc0a5 100644 --- a/source/dnode/vnode/src/meta/metaEntry.c +++ b/source/dnode/vnode/src/meta/metaEntry.c @@ -149,17 +149,22 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { metaError("meta/entry: invalide table type: %" PRId8 " decode failed.", pME->type); return -1; } - if (!tDecodeIsEnd(pCoder)) { - uDebug("set type: %d, tableName:%s", pME->type, pME->name); - if (meteDecodeColCmprEntry(pCoder, pME) < 0) return -1; - TABLE_SET_COL_COMPRESSED(pME->flags); - } else { - uDebug("set default type: %d, tableName:%s", pME->type, pME->name); - if (pME->type == TSDB_SUPER_TABLE) { + if (pME->type == TSDB_SUPER_TABLE) { + if (TABLE_IS_COL_COMPRESSED(pME->flags)) { + if (meteDecodeColCmprEntry(pCoder, pME) < 0) return -1; + } else { metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->stbEntry.schemaRow); - } else if (pME->type == TSDB_NORMAL_TABLE) { + TABLE_SET_COL_COMPRESSED(pME->flags); + } + } else if (pME->type == TSDB_NORMAL_TABLE) { + if (!tDecodeIsEnd(pCoder)) { + uDebug("set type: %d, tableName:%s", pME->type, pME->name); + if (meteDecodeColCmprEntry(pCoder, pME) < 0) return -1; + } else { + uDebug("set default type: %d, tableName:%s", pME->type, pME->name); metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow); } + TABLE_SET_COL_COMPRESSED(pME->flags); } tEndDecode(pCoder); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 4a3dcd0e51..e3b3de6cd6 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -69,7 +69,8 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) { taosMkDir(pMeta->path); // open env - ret = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv, rollback); + ret = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv, rollback, + pVnode->config.tdbEncryptAlgorithm, pVnode->config.tdbEncryptKey); if (ret < 0) { metaError("vgId:%d, failed to open meta env since %s", TD_VID(pVnode), tstrerror(terrno)); goto _err; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index cd94156dbb..e9ddaf9fca 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -109,7 +109,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) { return -1; } - void * data = pCtbEntry->ctbEntry.pTags; + void *data = pCtbEntry->ctbEntry.pTags; const char *tagName = pSchema->name; tb_uid_t suid = pCtbEntry->ctbEntry.suid; @@ -128,7 +128,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i); char type = pTagVal->type; - char * key = pTagVal->pKey; + char *key = pTagVal->pKey; int32_t nKey = strlen(key); SIndexTerm *term = NULL; @@ -136,7 +136,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0); } else if (type == TSDB_DATA_TYPE_NCHAR) { if (pTagVal->nData > 0) { - char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE); + char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE); int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE); memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE); type = TSDB_DATA_TYPE_VARCHAR; @@ -170,7 +170,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) { return -1; } - void * data = pCtbEntry->ctbEntry.pTags; + void *data = pCtbEntry->ctbEntry.pTags; const char *tagName = pSchema->name; tb_uid_t suid = pCtbEntry->ctbEntry.suid; @@ -189,7 +189,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i); char type = pTagVal->type; - char * key = pTagVal->pKey; + char *key = pTagVal->pKey; int32_t nKey = strlen(key); SIndexTerm *term = NULL; @@ -197,7 +197,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0); } else if (type == TSDB_DATA_TYPE_NCHAR) { if (pTagVal->nData > 0) { - char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE); + char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE); int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE); memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE); type = TSDB_DATA_TYPE_VARCHAR; @@ -244,9 +244,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { int vLen = 0; const void *pKey = NULL; const void *pVal = NULL; - void * pBuf = NULL; + void *pBuf = NULL; int32_t szBuf = 0; - void * p = NULL; + void *p = NULL; // validate req void *pData = NULL; @@ -385,7 +385,7 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) { int c = 0; void *pKey = NULL; int nKey = 0; - TBC * pCtbIdxc = NULL; + TBC *pCtbIdxc = NULL; tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); @@ -416,8 +416,8 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) { int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { SMetaEntry oStbEntry = {0}; SMetaEntry nStbEntry = {0}; - TBC * pUidIdxc = NULL; - TBC * pTbDbc = NULL; + TBC *pUidIdxc = NULL; + TBC *pTbDbc = NULL; const void *pData; int nData; int64_t oversion; @@ -484,7 +484,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { bool updStat = deltaCol != 0 && !metaTbInFilterCache(pMeta, pReq->name, 1); if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { - STsdb * pTsdb = pMeta->pVnode->pTsdb; + STsdb *pTsdb = pMeta->pVnode->pTsdb; SArray *uids = taosArrayInit(8, sizeof(int64_t)); if (deltaCol == 1) { int16_t cid = pReq->schemaRow.pSchema[nCols - 1].colId; @@ -554,9 +554,9 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { STbDbKey tbDbKey = {0}; - TBC * pUidIdxc = NULL; - TBC * pTbDbc = NULL; - void * pData = NULL; + TBC *pUidIdxc = NULL; + TBC *pTbDbc = NULL; + void *pData = NULL; int nData = 0; int64_t oversion; SDecoder dc = {0}; @@ -710,11 +710,11 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq) SMetaEntry nStbEntry = {0}; STbDbKey tbDbKey = {0}; - TBC * pUidIdxc = NULL; - TBC * pTbDbc = NULL; + TBC *pUidIdxc = NULL; + TBC *pTbDbc = NULL; int ret = 0; int c = -2; - void * pData = NULL; + void *pData = NULL; int nData = 0; int64_t oversion; SDecoder dc = {0}; @@ -817,8 +817,8 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq) nStbEntry.uid = oStbEntry.uid; nStbEntry.name = oStbEntry.name; - SSchemaWrapper * row = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaRow); - SSchemaWrapper * tag = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaTag); + SSchemaWrapper *row = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaRow); + SSchemaWrapper *tag = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaTag); SColCmprWrapper *cmpr = tCloneSColCmprWrapper(&oStbEntry.colCmpr); nStbEntry.stbEntry.schemaRow = *row; @@ -999,7 +999,7 @@ _err: } int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUids, tb_uid_t *tbUid) { - void * pData = NULL; + void *pData = NULL; int nData = 0; int rc = 0; tb_uid_t uid = 0; @@ -1078,10 +1078,10 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) { metaULock(pMeta); // update timeseries - void * pCtbDropped = NULL; + void *pCtbDropped = NULL; int32_t iter = 0; while ((pCtbDropped = tSimpleHashIterate(suidHash, pCtbDropped, &iter))) { - tb_uid_t * pSuid = tSimpleHashGetKey(pCtbDropped, NULL); + tb_uid_t *pSuid = tSimpleHashGetKey(pCtbDropped, NULL); int32_t nCols = 0; SVnodeStats *pStats = &pMeta->pVnode->config.vndStats; if (metaGetStbStats(pMeta->pVnode, *pSuid, NULL, &nCols) == 0) { @@ -1221,7 +1221,7 @@ static int metaDeleteTtl(SMeta *pMeta, const SMetaEntry *pME) { } static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid, int8_t *pSysTbl) { - void * pData = NULL; + void *pData = NULL; int nData = 0; int rc = 0; SMetaEntry e = {0}; @@ -1260,7 +1260,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0; - SSchema * pTagColumn = NULL; + SSchema *pTagColumn = NULL; SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag; if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) { pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0]; @@ -1384,14 +1384,14 @@ int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) { } static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq, STableMetaRsp *pMetaRsp) { - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; - const void * pData = NULL; + const void *pData = NULL; int nData = 0; int ret = 0; tb_uid_t uid; int64_t oversion; - SSchema * pColumn = NULL; + SSchema *pColumn = NULL; SMetaEntry entry = {0}; SSchemaWrapper *pSchema; int c; @@ -1652,7 +1652,7 @@ _err: static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) { SMetaEntry ctbEntry = {0}; SMetaEntry stbEntry = {0}; - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; int ret; int c; @@ -1693,7 +1693,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA oversion = ((SUidIdxVal *)pData)[0].version; // search table.db - TBC * pTbDbc = NULL; + TBC *pTbDbc = NULL; SDecoder dc1 = {0}; SDecoder dc2 = {0}; @@ -1729,7 +1729,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaDecodeEntry(&dc2, &stbEntry); SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag; - SSchema * pColumn = NULL; + SSchema *pColumn = NULL; int32_t iCol = 0; for (;;) { pColumn = NULL; @@ -1756,8 +1756,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA memcpy((void *)ctbEntry.ctbEntry.pTags, pAlterTbReq->pTagVal, pAlterTbReq->nTagVal); } else { const STag *pOldTag = (const STag *)ctbEntry.ctbEntry.pTags; - STag * pNewTag = NULL; - SArray * pTagArray = taosArrayInit(pTagSchema->nCols, sizeof(STagVal)); + STag *pNewTag = NULL; + SArray *pTagArray = taosArrayInit(pTagSchema->nCols, sizeof(STagVal)); if (!pTagArray) { terrno = TSDB_CODE_OUT_OF_MEMORY; goto _err; @@ -1839,7 +1839,7 @@ _err: } static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) { - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; const void *pData = NULL; int nData = 0; @@ -1943,7 +1943,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) { SMetaEntry stbEntry = {0}; - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; int ret; int c; @@ -2076,7 +2076,7 @@ typedef struct SMetaPair { static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) { SMetaEntry stbEntry = {0}; - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; int ret; int c; @@ -2186,7 +2186,7 @@ _err: int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq) { // impl later SMetaEntry tbEntry = {0}; - void * pVal = NULL; + void *pVal = NULL; int nVal = 0; int ret; int c; @@ -2296,8 +2296,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) { STbDbKey tbDbKey; - void * pKey = NULL; - void * pVal = NULL; + void *pKey = NULL; + void *pVal = NULL; int kLen = 0; int vLen = 0; SEncoder coder = {0}; @@ -2448,14 +2448,14 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) { } static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) { - void * pData = NULL; + void *pData = NULL; int nData = 0; STbDbKey tbDbKey = {0}; SMetaEntry stbEntry = {0}; - STagIdxKey * pTagIdxKey = NULL; + STagIdxKey *pTagIdxKey = NULL; int32_t nTagIdxKey; const SSchema *pTagColumn; - const void * pTagData = NULL; + const void *pTagData = NULL; int32_t nTagData = 0; SDecoder dc = {0}; int32_t ret = 0; @@ -2524,7 +2524,7 @@ end: static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) { SEncoder coder = {0}; - void * pVal = NULL; + void *pVal = NULL; int vLen = 0; int rcode = 0; SSkmDbKey skmDbKey = {0}; @@ -2652,15 +2652,15 @@ int32_t colCompressDebug(SHashObj *pColCmprObj) { const char *l1str = columnEncodeStr(l1); const char *l2str = columnCompressStr(l2); const char *lvlstr = columnLevelStr(lvl); - metaInfo("colId: %d, encode:%s, compress:%s,level:%s", colId, l1str, l2str, lvlstr); + metaDebug("colId: %d, encode:%s, compress:%s,level:%s", colId, l1str, l2str, lvlstr); } return 0; } int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) { int rc = 0; - SHashObj * pColCmprObj = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK); - void * pData = NULL; + SHashObj *pColCmprObj = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK); + void *pData = NULL; int nData = 0; SMetaEntry e = {0}; SDecoder dc = {0}; diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index e64de9a423..82547af8d4 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -76,7 +76,7 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) { } int32_t tqMetaOpen(STQ* pTq) { - if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0) < 0) { + if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0, 0, NULL) < 0) { return -1; } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 0bb82ed50a..516a47606b 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -592,7 +592,7 @@ static int32_t buildResSDataBlock(SSDataBlock* pBlock, SSchemaWrapper* pSchema, static int32_t doSetVal(SColumnInfoData* pColumnInfoData, int32_t rowIndex, SColVal* pColVal) { int32_t code = TSDB_CODE_SUCCESS; - if (IS_STR_DATA_TYPE(pColVal->value.type)) { + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { char val[65535 + 2] = {0}; if (COL_VAL_IS_VALUE(pColVal)) { if (pColVal->value.pData != NULL) { diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 3ee06a3880..1da096224c 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -603,7 +603,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat dataIndex++; } else { void* colData = colDataGetData(pColData, j); - if (IS_STR_DATA_TYPE(pCol->type)) { + if (IS_VAR_DATA_TYPE(pCol->type)) { // address copy, no value SValue sv = (SValue){.type = pCol->type, .nData = varDataLen(colData), .pData = (uint8_t*)varDataVal(colData)}; diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c index f8cf591777..acacf98f84 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.c @@ -73,7 +73,9 @@ int32_t tsdbDataFileRAWReadBlockData(SDataFileRAWReader *reader, STsdbDataRAWBlo pBlock->file.maxVer = reader->config->file.maxVer; pBlock->file.stt->level = reader->config->file.stt->level; - code = tsdbReadFile(reader->fd, pBlock->offset, pBlock->data, pBlock->dataLength, 0); + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(reader->fd, pBlock->offset, pBlock->data, pBlock->dataLength, 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -127,8 +129,11 @@ static int32_t tsdbDataFileRAWWriterCloseCommit(SDataFileRAWWriter *writer, TFil code = TARRAY2_APPEND(opArr, op); TSDB_CHECK_CODE(code, lino, _exit); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + if (writer->fd) { - code = tsdbFsyncFile(writer->fd); + code = tsdbFsyncFile(writer->fd, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); tsdbCloseFile(&writer->fd); } @@ -206,11 +211,13 @@ _exit: return code; } -int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock) { +int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *pDataBlock, + int32_t encryptAlgorithm, char* encryptKey) { int32_t code = 0; int32_t lino = 0; - code = tsdbWriteFile(writer->fd, writer->ctx->offset, (const uint8_t *)pDataBlock->data, pDataBlock->dataLength); + code = tsdbWriteFile(writer->fd, writer->ctx->offset, (const uint8_t *)pDataBlock->data, pDataBlock->dataLength, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->ctx->offset += pDataBlock->dataLength; diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.h b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.h index d765671698..c493c66460 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.h +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRAW.h @@ -105,7 +105,8 @@ int32_t tsdbDataFileRAWWriterOpen(const SDataFileRAWWriterConfig *config, SDataF int32_t tsdbDataFileRAWWriterClose(SDataFileRAWWriter **writer, bool abort, TFileOpArray *opArr); int32_t tsdbDataFileRAWWriterDoOpen(SDataFileRAWWriter *writer); -int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *bHdr); +int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *bHdr, + int32_t encryptAlgorithm, char* encryptKey); int32_t tsdbDataFileRAWFlush(SDataFileRAWWriter *writer); #ifdef __cplusplus diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c index ff107fbd8d..eddbdd0b2f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c @@ -46,8 +46,10 @@ static int32_t tsdbDataFileReadHeadFooter(SDataFileReader *reader) { int32_t ftype = TSDB_FTYPE_HEAD; if (reader->fd[ftype]) { + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd[ftype], reader->config->files[ftype].file.size - sizeof(SHeadFooter), - (uint8_t *)reader->headFooter, sizeof(SHeadFooter), 0); + (uint8_t *)reader->headFooter, sizeof(SHeadFooter), 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } @@ -68,8 +70,10 @@ static int32_t tsdbDataFileReadTombFooter(SDataFileReader *reader) { int32_t ftype = TSDB_FTYPE_TOMB; if (reader->fd[ftype]) { + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd[ftype], reader->config->files[ftype].file.size - sizeof(STombFooter), - (uint8_t *)reader->tombFooter, sizeof(STombFooter), 0); + (uint8_t *)reader->tombFooter, sizeof(STombFooter), 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } reader->ctx->tombFooterLoaded = true; @@ -164,8 +168,10 @@ int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **b TSDB_CHECK_CODE(code, lino, _exit); } + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd[TSDB_FTYPE_HEAD], reader->headFooter->brinBlkPtr->offset, data, - reader->headFooter->brinBlkPtr->size, 0); + reader->headFooter->brinBlkPtr->size, 0, encryptAlgorithm, encryptKey); if (code) { taosMemoryFree(data); TSDB_CHECK_CODE(code, lino, _exit); @@ -195,9 +201,12 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB SBuffer *buffer = reader->buffers + 0; SBuffer *assist = reader->buffers + 1; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load data tBufferClear(buffer); - code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, brinBlk->dp->size, buffer, 0); + code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, brinBlk->dp->size, buffer, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode brin block @@ -279,9 +288,12 @@ int32_t tsdbDataFileReadBlockData(SDataFileReader *reader, const SBrinRecord *re SBuffer *buffer = reader->buffers + 0; SBuffer *assist = reader->buffers + 1; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load data tBufferClear(buffer); - code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockSize, buffer, 0); + code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockSize, buffer, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decompress @@ -307,9 +319,12 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe SBuffer *buffer1 = reader->buffers + 1; SBuffer *assist = reader->buffers + 2; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load key part tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockKeySize, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockKeySize, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // SDiskDataHdr @@ -340,11 +355,11 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe if (extraColIdx < 0) { goto _exit; } - + // load SBlockCol part tBufferClear(buffer0); code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset + record->blockKeySize, hdr.szBlkCol, - buffer0, 0); + buffer0, 0, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // calc szHint @@ -454,11 +469,14 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe code = tBlockDataDecompressColData(&hdr, &none, &br, bData, assist); TSDB_CHECK_CODE(code, lino, _exit); } else if (cid == blockCol.cid) { - // load from file + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + // load from file tBufferClear(buffer1); code = tsdbReadFileToBuffer( reader->fd[TSDB_FTYPE_DATA], record->blockOffset + record->blockKeySize + hdr.szBlkCol + blockCol.offset, - blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, firstRead ? szHint : 0); + blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, firstRead ? szHint : 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); firstRead = false; @@ -486,7 +504,10 @@ int32_t tsdbDataFileReadBlockSma(SDataFileReader *reader, const SBrinRecord *rec TARRAY2_CLEAR(columnDataAggArray, NULL); if (record->smaSize > 0) { tBufferClear(buffer); - code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_SMA], record->smaOffset, record->smaSize, buffer, 0); + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_SMA], record->smaOffset, record->smaSize, buffer, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode sma data @@ -525,8 +546,10 @@ int32_t tsdbDataFileReadTombBlk(SDataFileReader *reader, const TTombBlkArray **t TSDB_CHECK_CODE(code, lino, _exit); } + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbReadFile(reader->fd[TSDB_FTYPE_TOMB], reader->tombFooter->tombBlkPtr->offset, data, - reader->tombFooter->tombBlkPtr->size, 0); + reader->tombFooter->tombBlkPtr->size, 0, encryptAlgorithm, encryptKey); if (code) { taosMemoryFree(data); TSDB_CHECK_CODE(code, lino, _exit); @@ -557,7 +580,10 @@ int32_t tsdbDataFileReadTombBlock(SDataFileReader *reader, const STombBlk *tombB SBuffer *assist = reader->buffers + 1; tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_TOMB], tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0); + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_TOMB], tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); int32_t size = 0; @@ -785,7 +811,8 @@ int32_t tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxV } int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmprAlg, int64_t *fileSize, - TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range) { + TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range, + int32_t encryptAlgorithm, char* encryptKey) { if (brinBlock->numOfRecords == 0) return 0; int32_t code; @@ -838,7 +865,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr tBufferClear(buffer0); code = tCompressDataToBuffer(brinBlock->buffers[i].data, &info, buffer0, assist); if (code) return code; - code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size); + code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size, encryptAlgorithm, encryptKey); if (code) return code; brinBlk.size[i] = info.compressedSize; brinBlk.dp->size += info.compressedSize; @@ -854,7 +881,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr tBufferClear(buffer0); code = tCompressDataToBuffer(brinBlock->buffers[i].data, &info, buffer0, assist); if (code) return code; - code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size); + code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size, encryptAlgorithm, encryptKey); if (code) return code; brinBlk.size[i] = info.compressedSize; brinBlk.dp->size += info.compressedSize; @@ -879,10 +906,10 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr } // write to file - if ((code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size))) return code; + if ((code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size, encryptAlgorithm, encryptKey))) return code; *fileSize += buffer0->size; brinBlk.dp->size += buffer0->size; - if ((code = tsdbWriteFile(fd, *fileSize, buffer1->data, buffer1->size))) return code; + if ((code = tsdbWriteFile(fd, *fileSize, buffer1->data, buffer1->size, encryptAlgorithm, encryptKey))) return code; *fileSize += buffer1->size; brinBlk.dp->size += buffer1->size; } @@ -902,9 +929,12 @@ static int32_t tsdbDataFileWriteBrinBlock(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFileWriteBrinBlock(writer->fd[TSDB_FTYPE_HEAD], writer->brinBlock, writer->config->cmprAlg, &writer->files[TSDB_FTYPE_HEAD].size, writer->brinBlkArray, writer->buffers, - &writer->ctx->range); + &writer->ctx->range, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -995,9 +1025,11 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData record->blockKeySize = buffers[0].size + buffers[1].size; record->blockSize = record->blockKeySize + buffers[2].size + buffers[3].size; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; for (int i = 0; i < 4; i++) { code = tsdbWriteFile(writer->fd[TSDB_FTYPE_DATA], writer->files[TSDB_FTYPE_DATA].size, buffers[i].data, - buffers[i].size); + buffers[i].size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->files[TSDB_FTYPE_DATA].size += buffers[i].size; } @@ -1017,7 +1049,8 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData record->smaSize = buffers[0].size; if (record->smaSize > 0) { - code = tsdbWriteFile(writer->fd[TSDB_FTYPE_SMA], record->smaOffset, buffers[0].data, record->smaSize); + code = tsdbWriteFile(writer->fd[TSDB_FTYPE_SMA], record->smaOffset, buffers[0].data, record->smaSize, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->files[TSDB_FTYPE_SMA].size += record->smaSize; } @@ -1288,15 +1321,17 @@ _exit: return code; } -int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFooter *footer) { - int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer)); +int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFooter *footer, int32_t encryptAlgorithm, + char* encryptKey) { + int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer), encryptAlgorithm, encryptKey); if (code) return code; *fileSize += sizeof(*footer); return 0; } int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAlg, int64_t *fileSize, - TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range) { + TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range, + int32_t encryptAlgorithm, char* encryptKey) { int32_t code; if (TOMB_BLOCK_SIZE(tombBlock) == 0) return 0; @@ -1348,7 +1383,7 @@ int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAl code = tCompressDataToBuffer(tombBlock->buffers[i].data, &cinfo, buffer0, assist); if (code) return code; - code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size); + code = tsdbWriteFile(fd, *fileSize, buffer0->data, buffer0->size, encryptAlgorithm, encryptKey); if (code) return code; tombBlk.size[i] = cinfo.compressedSize; @@ -1367,7 +1402,11 @@ static int32_t tsdbDataFileWriteHeadFooter(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; - code = tsdbFileWriteHeadFooter(writer->fd[TSDB_FTYPE_HEAD], &writer->files[TSDB_FTYPE_HEAD].size, writer->headFooter); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbFileWriteHeadFooter(writer->fd[TSDB_FTYPE_HEAD], &writer->files[TSDB_FTYPE_HEAD].size, writer->headFooter, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -1383,9 +1422,12 @@ static int32_t tsdbDataFileDoWriteTombBlock(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFileWriteTombBlock(writer->fd[TSDB_FTYPE_TOMB], writer->tombBlock, writer->config->cmprAlg, &writer->files[TSDB_FTYPE_TOMB].size, writer->tombBlkArray, writer->buffers, - &writer->ctx->tombRange); + &writer->ctx->tombRange, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -1395,12 +1437,14 @@ _exit: return code; } -int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFDataPtr *ptr, int64_t *fileSize) { +int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey) { ptr->size = TARRAY2_DATA_LEN(tombBlkArray); if (ptr->size > 0) { ptr->offset = *fileSize; - int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)TARRAY2_DATA(tombBlkArray), ptr->size); + int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)TARRAY2_DATA(tombBlkArray), ptr->size, + encryptAlgorithm, encryptKey); if (code) { return code; } @@ -1416,8 +1460,11 @@ static int32_t tsdbDataFileDoWriteTombBlk(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFileWriteTombBlk(writer->fd[TSDB_FTYPE_TOMB], writer->tombBlkArray, writer->tombFooter->tombBlkPtr, - &writer->files[TSDB_FTYPE_TOMB].size); + &writer->files[TSDB_FTYPE_TOMB].size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -1427,8 +1474,9 @@ _exit: return code; } -int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t *fileSize) { - int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer)); +int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t *fileSize, int32_t encryptAlgorithm, + char* encryptKey) { + int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer), encryptAlgorithm, encryptKey); if (code) return code; *fileSize += sizeof(*footer); return 0; @@ -1438,7 +1486,11 @@ static int32_t tsdbDataFileWriteTombFooter(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; - code = tsdbFileWriteTombFooter(writer->fd[TSDB_FTYPE_TOMB], writer->tombFooter, &writer->files[TSDB_FTYPE_TOMB].size); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbFileWriteTombFooter(writer->fd[TSDB_FTYPE_TOMB], writer->tombFooter, &writer->files[TSDB_FTYPE_TOMB].size, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -1515,12 +1567,14 @@ _exit: return code; } -int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize) { +int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey) { ASSERT(TARRAY2_SIZE(brinBlkArray) > 0); ptr->offset = *fileSize; ptr->size = TARRAY2_DATA_LEN(brinBlkArray); - int32_t code = tsdbWriteFile(fd, ptr->offset, (uint8_t *)TARRAY2_DATA(brinBlkArray), ptr->size); + int32_t code = tsdbWriteFile(fd, ptr->offset, (uint8_t *)TARRAY2_DATA(brinBlkArray), ptr->size, encryptAlgorithm, + encryptKey); if (code) return code; *fileSize += ptr->size; @@ -1531,8 +1585,11 @@ static int32_t tsdbDataFileWriteBrinBlk(SDataFileWriter *writer) { int32_t code = 0; int32_t lino = 0; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFileWriteBrinBlk(writer->fd[TSDB_FTYPE_HEAD], writer->brinBlkArray, writer->headFooter->brinBlkPtr, - &writer->files[TSDB_FTYPE_HEAD].size); + &writer->files[TSDB_FTYPE_HEAD].size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -1689,10 +1746,11 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr code = TARRAY2_APPEND(opArr, op); TSDB_CHECK_CODE(code, lino, _exit); } - + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) { if (writer->fd[i]) { - code = tsdbFsyncFile(writer->fd[i]); + code = tsdbFsyncFile(writer->fd[i], encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); tsdbCloseFile(&writer->fd[i]); } @@ -1729,7 +1787,10 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) { if (writer->files[ftype].size == 0) { uint8_t hdr[TSDB_FHDR_SIZE] = {0}; - code = tsdbWriteFile(writer->fd[ftype], 0, hdr, TSDB_FHDR_SIZE); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbWriteFile(writer->fd[ftype], 0, hdr, TSDB_FHDR_SIZE, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->files[ftype].size += TSDB_FHDR_SIZE; @@ -1895,7 +1956,9 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) { TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; - code = tsdbWriteFile(writer->fd[ftype], 0, hdr, TSDB_FHDR_SIZE); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbWriteFile(writer->fd[ftype], 0, hdr, TSDB_FHDR_SIZE, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->files[ftype].size += TSDB_FHDR_SIZE; diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h index c442672902..dde33340f5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.h @@ -97,16 +97,22 @@ int32_t tsdbDataFileFlush(SDataFileWriter *writer); // head int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmprAlg, int64_t *fileSize, - TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range); -int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize); -int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFooter *footer); + TBrinBlkArray *brinBlkArray, SBuffer *buffers, SVersionRange *range, + int32_t encryptAlgorithm, char* encryptKey); +int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey); +int32_t tsdbFileWriteHeadFooter(STsdbFD *fd, int64_t *fileSize, const SHeadFooter *footer, + int32_t encryptAlgorithm, char* encryptKey); // tomb int32_t tsdbDataFileWriteTombRecord(SDataFileWriter *writer, const STombRecord *record); int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAlg, int64_t *fileSize, - TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range); -int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFDataPtr *ptr, int64_t *fileSize); -int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t *fileSize); + TTombBlkArray *tombBlkArray, SBuffer *buffers, SVersionRange *range, + int32_t encryptAlgorithm, char* encryptKey); +int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey); +int32_t tsdbFileWriteTombFooter(STsdbFD *fd, const STombFooter *footer, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey); // utils int32_t tsdbWriterUpdVerRange(SVersionRange *range, int64_t minVer, int64_t maxVer); diff --git a/source/dnode/vnode/src/tsdb/tsdbDef.h b/source/dnode/vnode/src/tsdb/tsdbDef.h index 8c1cf2c1e7..d843a0af75 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDef.h +++ b/source/dnode/vnode/src/tsdb/tsdbDef.h @@ -33,10 +33,14 @@ typedef struct SFDataPtr { extern int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppFD, int32_t lcn); extern void tsdbCloseFile(STsdbFD **ppFD); -extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size); -extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int64_t szHint); -extern int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint); -extern int32_t tsdbFsyncFile(STsdbFD *pFD); + +extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size, + int32_t encryptAlgorithm, char* encryptKey); +extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int64_t szHint, + int32_t encryptAlgorithm, char* encryptKey); +extern int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint, + int32_t encryptAlgorithm, char* encryptKey); +extern int32_t tsdbFsyncFile(STsdbFD *pFD, int32_t encryptAlgorithm, char* encryptKey); typedef struct SColCompressInfo SColCompressInfo; struct SColCompressInfo { diff --git a/source/dnode/vnode/src/tsdb/tsdbFSetRAW.c b/source/dnode/vnode/src/tsdb/tsdbFSetRAW.c index ddb8e7e27e..b180f9d099 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSetRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbFSetRAW.c @@ -152,7 +152,8 @@ _exit: return code; } -int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr) { +int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr, int32_t encryptAlgorithm, + char* encryptKey) { int32_t code = 0; int32_t lino = 0; @@ -166,7 +167,7 @@ int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeade TSDB_CHECK_CODE(code, lino, _exit); } - code = tsdbDataFileRAWWriteBlockData(writer->dataWriter, bHdr); + code = tsdbDataFileRAWWriteBlockData(writer->dataWriter, bHdr, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->ctx->offset += bHdr->dataLength; diff --git a/source/dnode/vnode/src/tsdb/tsdbFSetRAW.h b/source/dnode/vnode/src/tsdb/tsdbFSetRAW.h index 205c785e99..95e360b231 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSetRAW.h +++ b/source/dnode/vnode/src/tsdb/tsdbFSetRAW.h @@ -36,7 +36,8 @@ typedef struct SFSetRAWWriter SFSetRAWWriter; int32_t tsdbFSetRAWWriterOpen(SFSetRAWWriterConfig *config, SFSetRAWWriter **writer); int32_t tsdbFSetRAWWriterClose(SFSetRAWWriter **writer, bool abort, TFileOpArray *fopArr); -int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr); +int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr, int32_t encryptAlgorithm, + char* encryptKey); #ifdef __cplusplus } diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 49c0c483dd..6b459f90f3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -828,17 +828,22 @@ static FORCE_INLINE int32_t tLDataIterCmprFn(const SRBTreeNode *p1, const SRBTre SLDataIter *pIter1 = (SLDataIter *)(((uint8_t *)p1) - offsetof(SLDataIter, node)); SLDataIter *pIter2 = (SLDataIter *)(((uint8_t *)p2) - offsetof(SLDataIter, node)); - TSDBKEY key1 = TSDBROW_KEY(&pIter1->rInfo.row); - TSDBKEY key2 = TSDBROW_KEY(&pIter2->rInfo.row); + SRowKey rkey1, rkey2; + tRowGetKeyEx(&pIter1->rInfo.row, &rkey1); + tRowGetKeyEx(&pIter2->rInfo.row, &rkey2); - if (key1.ts < key2.ts) { + int32_t ret = tRowKeyCompare(&rkey1, &rkey2); + if (ret < 0) { return -1; - } else if (key1.ts > key2.ts) { + } else if (ret > 0) { return 1; } else { - if (key1.version < key2.version) { + int64_t ver1 = TSDBROW_VERSION(&pIter1->rInfo.row); + int64_t ver2 = TSDBROW_VERSION(&pIter2->rInfo.row); + + if (ver1 < ver2) { return -1; - } else if (key1.version > key2.version) { + } else if (ver1 > ver2) { return 1; } else { return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 5419ca3308..1ea037b4e9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -25,15 +25,6 @@ #define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC) #define getCurrentKeyInSttBlock(_r) (&((_r)->currentKey)) -#define tRowGetKeyEx(_pRow, _pKey) \ - do { \ - if ((_pRow)->type == TSDBROW_ROW_FMT) { \ - tRowGetKey((_pRow)->pTSRow, (_pKey)); \ - } else { \ - tColRowGetKey((_pRow)->pBlockData, (_pRow)->iRow, (_pKey)); \ - } \ - } while (0) - typedef struct { bool overlapWithNeighborBlock; bool hasDupTs; @@ -103,26 +94,10 @@ int32_t pkCompEx(SRowKey* p1, SRowKey* p2) { return 1; } - ASSERT(p1->numOfPKs == p2->numOfPKs); - if (p1->numOfPKs == 0) { return 0; } else { - if (IS_VAR_DATA_TYPE(p1->pks[0].type)) { - int32_t len = TMIN(p1->pks[0].nData, p2->pks[0].nData); - int32_t ret = strncmp((char*)p1->pks[0].pData, (char*)p2->pks[0].pData, len); - if (ret == 0) { - if (p1->pks[0].nData == p2->pks[0].nData) { - return 0; - } else { - return p1->pks[0].nData > p2->pks[0].nData ? 1 : -1; - } - } else { - return ret > 0 ? 1 : -1; - } - } else { - return tValueCompare(&p1->pks[0], &p2->pks[0]); - } + return tRowKeyCompare(p1, p2); } } @@ -1635,6 +1610,11 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SSttBlockReader* pSttB doUnpinSttBlock(pSttBlockReader); if (hasVal) { SRowKey* pNext = getCurrentKeyInSttBlock(pSttBlockReader); + + if (IS_VAR_DATA_TYPE(pSttKey->pks[0].type)) { + tsdbInfo("current pk:%s, next pk:%s", pSttKey->pks[0].pData, pNext->pks[0].pData); + } + if (pkCompEx(pSttKey, pNext) != 0) { code = doAppendRowFromFileBlock(pReader->resBlockInfo.pResBlock, pReader, fRow->pBlockData, fRow->iRow); *copied = (code == TSDB_CODE_SUCCESS); @@ -2327,8 +2307,11 @@ int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanIn TSDBROW* pRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree); TSDBROW fRow = {.iRow = pRow->iRow, .type = TSDBROW_COL_FMT, .pBlockData = pRow->pBlockData}; - tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " %s", pRow->pBlockData, pRow->iRow, pSttBlockReader->uid, - fRow.pBlockData->aTSKEY[fRow.iRow], pReader->idStr); + + if (IS_VAR_DATA_TYPE(pScanInfo->lastProcKey.pks[0].type)) { + tsdbTrace("fRow ptr:%p, %d, uid:%" PRIu64 ", ts:%" PRId64 " pk:%s %s", pRow->pBlockData, pRow->iRow, pSttBlockReader->uid, + fRow.pBlockData->aTSKEY[fRow.iRow], pScanInfo->lastProcKey.pks[0].pData, pReader->idStr); + } int32_t code = tryCopyDistinctRowFromSttBlock(&fRow, pSttBlockReader, pScanInfo, &pScanInfo->lastProcKey, pReader, &copied); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 27b7f3edbe..1a62c824d7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -191,6 +191,10 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno; } + + if (!asc) { + pKey->numOfPKs = 2; + } } } diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h index 96ce911b78..5f0a58c378 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h @@ -38,6 +38,15 @@ extern "C" { (_k)->ekey.ts = INT64_MIN; \ } while (0); +#define tRowGetKeyEx(_pRow, _pKey) \ + do { \ + if ((_pRow)->type == TSDBROW_ROW_FMT) { \ + tRowGetKey((_pRow)->pTSRow, (_pKey)); \ + } else { \ + tColRowGetKey((_pRow)->pBlockData, (_pRow)->iRow, (_pKey)); \ + } \ + } while (0) + typedef enum { READER_STATUS_SUSPEND = 0x1, READER_STATUS_NORMAL = 0x2, diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index ad668f77c6..136bf3bfbe 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -15,6 +15,7 @@ #include "cos.h" #include "tsdb.h" +#include "crypt.h" #include "vnd.h" static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { @@ -169,7 +170,7 @@ void tsdbCloseFile(STsdbFD **ppFD) { } } -static int32_t tsdbWriteFilePage(STsdbFD *pFD) { +static int32_t tsdbWriteFilePage(STsdbFD *pFD, int32_t encryptAlgorithm, char* encryptKey) { int32_t code = 0; if (!pFD->pFD) { @@ -197,6 +198,28 @@ static int32_t tsdbWriteFilePage(STsdbFD *pFD) { } taosCalcChecksumAppend(0, pFD->pBuf, pFD->szPage); + + if(encryptAlgorithm == DND_CA_SM4){ + //if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_TSDB) == DND_CS_TSDB){ + unsigned char PacketData[128]; + int NewLen; + int32_t count = 0; + while (count < pFD->szPage) { + SCryptOpts opts = {0}; + opts.len = 128; + opts.source = pFD->pBuf + count; + opts.result = PacketData; + opts.unitLen = 128; + //strncpy(opts.key, tsEncryptKey, 16); + strncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN); + + NewLen = CBC_Encrypt(&opts); + + memcpy(pFD->pBuf + count, PacketData, NewLen); + count += NewLen; + } + //tsdbDebug("CBC_Encrypt count:%d %s", count, __FUNCTION__); + } n = taosWriteFile(pFD->pFD, pFD->pBuf, pFD->szPage); if (n < 0) { @@ -214,7 +237,7 @@ _exit: return code; } -static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { +static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgorithm, char* encryptKey) { int32_t code = 0; // ASSERT(pgno <= pFD->szFile); @@ -274,6 +297,30 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { } //} + if(encryptAlgorithm == DND_CA_SM4){ + //if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_TSDB) == DND_CS_TSDB){ + unsigned char PacketData[128]; + int NewLen; + + int32_t count = 0; + while(count < pFD->szPage) + { + SCryptOpts opts = {0}; + opts.len = 128; + opts.source = pFD->pBuf + count; + opts.result = PacketData; + opts.unitLen = 128; + //strncpy(opts.key, tsEncryptKey, 16); + strncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN); + + NewLen = CBC_Decrypt(&opts); + + memcpy(pFD->pBuf + count, PacketData, NewLen); + count += NewLen; + } + //tsdbDebug("CBC_Decrypt count:%d %s", count, __FUNCTION__); + } + // check if (pgno > 1 && !taosCheckChecksumWhole(pFD->pBuf, pFD->szPage)) { code = TSDB_CODE_FILE_CORRUPTED; @@ -286,7 +333,8 @@ _exit: return code; } -int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size) { +int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size, int32_t encryptAlgorithm, + char* encryptKey) { int32_t code = 0; int64_t fOffset = LOGIC_TO_FILE_OFFSET(offset, pFD->szPage); int64_t pgno = OFFSET_PGNO(fOffset, pFD->szPage); @@ -295,11 +343,11 @@ int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t do { if (pFD->pgno != pgno) { - code = tsdbWriteFilePage(pFD); + code = tsdbWriteFilePage(pFD, encryptAlgorithm, encryptKey); if (code) goto _exit; if (pgno <= pFD->szFile) { - code = tsdbReadFilePage(pFD, pgno); + code = tsdbReadFilePage(pFD, pgno, encryptAlgorithm, encryptKey); if (code) goto _exit; } else { pFD->pgno = pgno; @@ -318,7 +366,8 @@ _exit: return code; } -static int32_t tsdbReadFileImp(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size) { +static int32_t tsdbReadFileImp(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int32_t encryptAlgorithm, + char* encryptKey) { int32_t code = 0; int64_t n = 0; int64_t fOffset = LOGIC_TO_FILE_OFFSET(offset, pFD->szPage); @@ -331,7 +380,7 @@ static int32_t tsdbReadFileImp(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int6 while (n < size) { if (pFD->pgno != pgno) { - code = tsdbReadFilePage(pFD, pgno); + code = tsdbReadFilePage(pFD, pgno, encryptAlgorithm, encryptKey); if (code) goto _exit; } @@ -523,7 +572,8 @@ _exit: return code; } -int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int64_t szHint) { +int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, int64_t szHint, + int32_t encryptAlgorithm, char* encryptKey) { int32_t code = 0; if (!pFD->pFD) { code = tsdbOpenFileImpl(pFD); @@ -535,26 +585,28 @@ int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size, if (pFD->lcn > 1 /*pFD->s3File && tsS3BlockSize < 0*/) { return tsdbReadFileS3(pFD, offset, pBuf, size, szHint); } else { - return tsdbReadFileImp(pFD, offset, pBuf, size); + return tsdbReadFileImp(pFD, offset, pBuf, size, encryptAlgorithm, encryptKey); } _exit: return code; } -int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint) { +int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer *buffer, int64_t szHint, + int32_t encryptAlgorithm, char* encryptKey) { int32_t code; code = tBufferEnsureCapacity(buffer, buffer->size + size); if (code) return code; - code = tsdbReadFile(pFD, offset, (uint8_t *)tBufferGetDataEnd(buffer), size, szHint); + code = tsdbReadFile(pFD, offset, (uint8_t *)tBufferGetDataEnd(buffer), size, szHint, + encryptAlgorithm, encryptKey); if (code) return code; buffer->size += size; return code; } -int32_t tsdbFsyncFile(STsdbFD *pFD) { +int32_t tsdbFsyncFile(STsdbFD *pFD, int32_t encryptAlgorithm, char* encryptKey) { int32_t code = 0; /* if (pFD->s3File) { @@ -562,7 +614,7 @@ int32_t tsdbFsyncFile(STsdbFD *pFD) { return code; } */ - code = tsdbWriteFilePage(pFD); + code = tsdbWriteFilePage(pFD, encryptAlgorithm, encryptKey); if (code) goto _exit; if (taosFsyncFile(pFD->pFD) < 0) { @@ -673,7 +725,9 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) { if (code) goto _err; // read - code = tsdbReadFile(pReader->pHeadFD, offset, pReader->aBuf[0], size, 0); + int32_t encryptAlgorithm = pReader->pTsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = pReader->pTsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(pReader->pHeadFD, offset, pReader->aBuf[0], size, 0, encryptAlgorithm, encryptKey); if (code) goto _err; // decode @@ -710,7 +764,9 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) { if (code) goto _err; // read - code = tsdbReadFile(pReader->aSttFD[iStt], offset, pReader->aBuf[0], size, 0); + int32_t encryptAlgorithm = pReader->pTsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = pReader->pTsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(pReader->aSttFD[iStt], offset, pReader->aBuf[0], size, 0, encryptAlgorithm, encryptKey); if (code) goto _err; // decode @@ -743,7 +799,9 @@ int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *m if (code) goto _err; // read - code = tsdbReadFile(pReader->pHeadFD, offset, pReader->aBuf[0], size, 0); + int32_t encryptAlgorithm = pReader->pTsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = pReader->pTsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(pReader->pHeadFD, offset, pReader->aBuf[0], size, 0, encryptAlgorithm, encryptKey); if (code) goto _err; // decode @@ -836,7 +894,9 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa if (code) goto _err; // read - code = tsdbReadFile(pReader->pReadH, offset, pReader->aBuf[0], size, 0); + int32_t encryptAlgorithm = pReader->pTsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = pReader->pTsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(pReader->pReadH, offset, pReader->aBuf[0], size, 0, encryptAlgorithm, encryptKey); if (code) goto _err; // // decode @@ -876,7 +936,9 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) { if (code) goto _err; // read - code = tsdbReadFile(pReader->pReadH, offset, pReader->aBuf[0], size, 0); + int32_t encryptAlgorithm = pReader->pTsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = pReader->pTsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(pReader->pReadH, offset, pReader->aBuf[0], size, 0, encryptAlgorithm, encryptKey); if (code) goto _err; // decode diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c index ae840eb6d2..ab0575cb53 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshotRAW.c @@ -545,7 +545,10 @@ static int32_t tsdbSnapRAWWriteTimeSeriesData(STsdbSnapRAWWriter* writer, STsdbD int32_t code = 0; int32_t lino = 0; - code = tsdbFSetRAWWriteBlockData(writer->ctx->fsetWriter, bHdr); + int32_t encryptAlgorithm = writer->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbFSetRAWWriteBlockData(writer->ctx->fsetWriter, bHdr, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index f06aeed1d4..6e56b5677a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -63,7 +63,10 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con int64_t offset = config->file->size - sizeof(SSttFooter); ASSERT(offset >= TSDB_FHDR_SIZE); - code = tsdbReadFile(reader[0]->fd, offset, (uint8_t *)(reader[0]->footer), sizeof(SSttFooter), 0); + int32_t encryptAlgoirthm = config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbReadFile(reader[0]->fd, offset, (uint8_t *)(reader[0]->footer), sizeof(SSttFooter), 0, encryptAlgoirthm, + encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -99,8 +102,11 @@ int32_t tsdbSttFileReadStatisBlk(SSttFileReader *reader, const TStatisBlkArray * void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size); if (!data) return TSDB_CODE_OUT_OF_MEMORY; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; int32_t code = - tsdbReadFile(reader->fd, reader->footer->statisBlkPtr->offset, data, reader->footer->statisBlkPtr->size, 0); + tsdbReadFile(reader->fd, reader->footer->statisBlkPtr->offset, data, reader->footer->statisBlkPtr->size, 0, + encryptAlgorithm, encryptKey); if (code) { taosMemoryFree(data); return code; @@ -127,8 +133,11 @@ int32_t tsdbSttFileReadTombBlk(SSttFileReader *reader, const TTombBlkArray **tom void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size); if (!data) return TSDB_CODE_OUT_OF_MEMORY; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; int32_t code = - tsdbReadFile(reader->fd, reader->footer->tombBlkPtr->offset, data, reader->footer->tombBlkPtr->size, 0); + tsdbReadFile(reader->fd, reader->footer->tombBlkPtr->offset, data, reader->footer->tombBlkPtr->size, 0, + encryptAlgorithm, encryptKey); if (code) { taosMemoryFree(data); return code; @@ -155,8 +164,11 @@ int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBl void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size); if (!data) return TSDB_CODE_OUT_OF_MEMORY; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; int32_t code = - tsdbReadFile(reader->fd, reader->footer->sttBlkPtr->offset, data, reader->footer->sttBlkPtr->size, 0); + tsdbReadFile(reader->fd, reader->footer->sttBlkPtr->offset, data, reader->footer->sttBlkPtr->size, 0, + encryptAlgorithm, encryptKey); if (code) { taosMemoryFree(data); return code; @@ -181,9 +193,12 @@ int32_t tsdbSttFileReadBlockData(SSttFileReader *reader, const SSttBlk *sttBlk, SBuffer *buffer0 = reader->buffers + 0; SBuffer *assist = reader->buffers + 1; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load data tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szBlock, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szBlock, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0); @@ -207,9 +222,12 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk * SBuffer *buffer1 = reader->buffers + 1; SBuffer *assist = reader->buffers + 2; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load key part tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szKey, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset, sttBlk->bInfo.szKey, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode header @@ -244,7 +262,8 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk * // load SBlockCol part tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey, hdr.szBlkCol, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey, hdr.szBlkCol, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // load each column @@ -290,7 +309,8 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk * tBufferClear(buffer1); code = tsdbReadFileToBuffer(reader->fd, sttBlk->bInfo.offset + sttBlk->bInfo.szKey + hdr.szBlkCol + blockCol.offset, - blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, 0); + blockCol.szBitmap + blockCol.szOffset + blockCol.szValue, buffer1, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode the buffer @@ -314,9 +334,12 @@ int32_t tsdbSttFileReadTombBlock(SSttFileReader *reader, const STombBlk *tombBlk SBuffer *buffer0 = reader->buffers + 0; SBuffer *assist = reader->buffers + 1; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd, tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd, tombBlk->dp->offset, tombBlk->dp->size, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode @@ -351,9 +374,12 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta SBuffer *buffer0 = reader->buffers + 0; SBuffer *assist = reader->buffers + 1; + int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = reader->config->tsdb->pVnode->config.tsdbCfg.encryptKey; // load data tBufferClear(buffer0); - code = tsdbReadFileToBuffer(reader->fd, statisBlk->dp->offset, statisBlk->dp->size, buffer0, 0); + code = tsdbReadFileToBuffer(reader->fd, statisBlk->dp->offset, statisBlk->dp->size, buffer0, 0, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); // decode data @@ -442,7 +468,7 @@ struct SSttFileWriter { static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, SColCompressInfo *info, int64_t *fileSize, TSttBlkArray *sttBlkArray, SBuffer *buffers, - SVersionRange *range) { + SVersionRange *range, int32_t encryptAlgorithm, char* encryptKey) { if (blockData->nRow == 0) return 0; int32_t code = 0; @@ -474,7 +500,7 @@ static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, S sttBlk->bInfo.szBlock = buffers[2].size + buffers[3].size + sttBlk->bInfo.szKey; for (int i = 0; i < 4; i++) { if (buffers[i].size) { - code = tsdbWriteFile(fd, *fileSize, buffers[i].data, buffers[i].size); + code = tsdbWriteFile(fd, *fileSize, buffers[i].data, buffers[i].size, encryptAlgorithm, encryptKey); if (code) return code; *fileSize += buffers[i].size; } @@ -498,8 +524,11 @@ static int32_t tsdbSttFileDoWriteBlockData(SSttFileWriter *writer) { SColCompressInfo info = {.defaultCmprAlg = writer->config->cmprAlg, .pColCmpr = NULL}; code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, uid, &(info.pColCmpr)); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; code = tsdbFileDoWriteSttBlockData(writer->fd, writer->blockData, &info, &writer->file->size, writer->sttBlkArray, - writer->buffers, &writer->ctx->range); + writer->buffers, &writer->ctx->range, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -538,6 +567,9 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) { statisBlk.maxTbid.suid = record.suid; statisBlk.maxTbid.uid = record.uid; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + // compress each column for (int32_t i = 0; i < ARRAY_SIZE(statisBlk.size); i++) { SCompressInfo info = { @@ -550,7 +582,8 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) { code = tCompressDataToBuffer(statisBlock->buffers[i].data, &info, buffer0, assist); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, info.compressedSize); + code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, info.compressedSize, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); statisBlk.size[i] = info.compressedSize; @@ -579,12 +612,12 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) { TSDB_CHECK_CODE(code, lino, _exit); } - code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, buffer0->size); + code = tsdbWriteFile(writer->fd, writer->file->size, buffer0->data, buffer0->size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->file->size += buffer0->size; statisBlk.dp->size += buffer0->size; - code = tsdbWriteFile(writer->fd, writer->file->size, buffer1->data, buffer1->size); + code = tsdbWriteFile(writer->fd, writer->file->size, buffer1->data, buffer1->size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->file->size += buffer1->size; statisBlk.dp->size += buffer1->size; @@ -608,8 +641,12 @@ static int32_t tsdbSttFileDoWriteTombBlock(SSttFileWriter *writer) { int32_t code = 0; int32_t lino = 0; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFileWriteTombBlock(writer->fd, writer->tombBlock, writer->config->cmprAlg, &writer->file->size, - writer->tombBlkArray, writer->buffers, &writer->ctx->range); + writer->tombBlkArray, writer->buffers, &writer->ctx->range, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -619,12 +656,14 @@ _exit: return code; } -int32_t tsdbFileWriteSttBlk(STsdbFD *fd, const TSttBlkArray *sttBlkArray, SFDataPtr *ptr, int64_t *fileSize) { +int32_t tsdbFileWriteSttBlk(STsdbFD *fd, const TSttBlkArray *sttBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey) { ptr->size = TARRAY2_DATA_LEN(sttBlkArray); if (ptr->size > 0) { ptr->offset = *fileSize; - int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)TARRAY2_DATA(sttBlkArray), ptr->size); + int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)TARRAY2_DATA(sttBlkArray), ptr->size, encryptAlgorithm, + encryptKey); if (code) { return code; } @@ -638,7 +677,11 @@ static int32_t tsdbSttFileDoWriteSttBlk(SSttFileWriter *writer) { int32_t code = 0; int32_t lino; - code = tsdbFileWriteSttBlk(writer->fd, writer->sttBlkArray, writer->footer->sttBlkPtr, &writer->file->size); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbFileWriteSttBlk(writer->fd, writer->sttBlkArray, writer->footer->sttBlkPtr, &writer->file->size, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -651,12 +694,14 @@ _exit: static int32_t tsdbSttFileDoWriteStatisBlk(SSttFileWriter *writer) { int32_t code = 0; int32_t lino; + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; writer->footer->statisBlkPtr->size = TARRAY2_DATA_LEN(writer->statisBlkArray); if (writer->footer->statisBlkPtr->size) { writer->footer->statisBlkPtr->offset = writer->file->size; code = tsdbWriteFile(writer->fd, writer->file->size, (const uint8_t *)TARRAY2_DATA(writer->statisBlkArray), - writer->footer->statisBlkPtr->size); + writer->footer->statisBlkPtr->size, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->file->size += writer->footer->statisBlkPtr->size; } @@ -672,7 +717,11 @@ static int32_t tsdbSttFileDoWriteTombBlk(SSttFileWriter *writer) { int32_t code = 0; int32_t lino = 0; - code = tsdbFileWriteTombBlk(writer->fd, writer->tombBlkArray, writer->footer->tombBlkPtr, &writer->file->size); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbFileWriteTombBlk(writer->fd, writer->tombBlkArray, writer->footer->tombBlkPtr, &writer->file->size, + encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); _exit: @@ -682,15 +731,19 @@ _exit: return code; } -int32_t tsdbFileWriteSttFooter(STsdbFD *fd, const SSttFooter *footer, int64_t *fileSize) { - int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer)); +int32_t tsdbFileWriteSttFooter(STsdbFD *fd, const SSttFooter *footer, int64_t *fileSize, int32_t encryptAlgorithm, + char* encryptKey) { + int32_t code = tsdbWriteFile(fd, *fileSize, (const uint8_t *)footer, sizeof(*footer), encryptAlgorithm, encryptKey); if (code) return code; *fileSize += sizeof(*footer); return 0; } static int32_t tsdbSttFileDoWriteFooter(SSttFileWriter *writer) { - return tsdbFileWriteSttFooter(writer->fd, writer->footer, &writer->file->size); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + return tsdbFileWriteSttFooter(writer->fd, writer->footer, &writer->file->size, encryptAlgorithm, encryptKey); } static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) { @@ -728,7 +781,10 @@ static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) { TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; - code = tsdbWriteFile(writer->fd, 0, hdr, sizeof(hdr)); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbWriteFile(writer->fd, 0, hdr, sizeof(hdr), encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); writer->file->size += sizeof(hdr); @@ -793,7 +849,9 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, TFileOpArray *o code = tsdbSttFileDoUpdateHeader(writer); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbFsyncFile(writer->fd); + int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = writer->config->tsdb->pVnode->config.tsdbCfg.encryptKey; + code = tsdbFsyncFile(writer->fd, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); tsdbCloseFile(&writer->fd); diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h index 066e0c3498..1b0911617e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.h @@ -71,8 +71,10 @@ int32_t tsdbSttFileWriteBlockData(SSttFileWriter *writer, SBlockData *pBlockData int32_t tsdbSttFileWriteTombRecord(SSttFileWriter *writer, const STombRecord *record); bool tsdbSttFileWriterIsOpened(SSttFileWriter *writer); -int32_t tsdbFileWriteSttBlk(STsdbFD *fd, const TSttBlkArray *sttBlkArray, SFDataPtr *ptr, int64_t *fileSize); -int32_t tsdbFileWriteSttFooter(STsdbFD *fd, const SSttFooter *footer, int64_t *fileSize); +int32_t tsdbFileWriteSttBlk(STsdbFD *fd, const TSttBlkArray *sttBlkArray, SFDataPtr *ptr, int64_t *fileSize, + int32_t encryptAlgorithm, char* encryptKey); +int32_t tsdbFileWriteSttFooter(STsdbFD *fd, const SSttFooter *footer, int64_t *fileSize, int32_t encryptAlgorithm, + char* encryptKey); struct SSttFileWriterConfig { STsdb *tsdb; diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c index 84eb1c8359..09ab2243a0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c +++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c @@ -37,6 +37,8 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * int8_t cmprAlg; int32_t szPage; SBuffer buffers[10]; + int32_t encryptAlgorithm; + char* encryptKey; // reader SArray *aBlockIdx; SMapData mDataBlk[1]; @@ -50,6 +52,8 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * .maxRow = tsdb->pVnode->config.tsdbCfg.maxRows, .cmprAlg = tsdb->pVnode->config.tsdbCfg.compression, .szPage = tsdb->pVnode->config.tsdbPageSize, + .encryptAlgorithm = tsdb->pVnode->config.tsdbCfg.encryptAlgorithm, + .encryptKey = tsdb->pVnode->config.tsdbCfg.encryptKey, }}; // read SBlockIdx array @@ -136,7 +140,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * if (ctx->brinBlock->numOfRecords >= ctx->maxRow) { SVersionRange range = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN}; code = tsdbFileWriteBrinBlock(ctx->fd, ctx->brinBlock, ctx->cmprAlg, &fset->farr[TSDB_FTYPE_HEAD]->f->size, - ctx->brinBlkArray, ctx->buffers, &range); + ctx->brinBlkArray, ctx->buffers, &range, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } } @@ -145,18 +149,19 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * if (ctx->brinBlock->numOfRecords > 0) { SVersionRange range = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN}; code = tsdbFileWriteBrinBlock(ctx->fd, ctx->brinBlock, ctx->cmprAlg, &fset->farr[TSDB_FTYPE_HEAD]->f->size, - ctx->brinBlkArray, ctx->buffers, &range); + ctx->brinBlkArray, ctx->buffers, &range, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } code = tsdbFileWriteBrinBlk(ctx->fd, ctx->brinBlkArray, ctx->footer->brinBlkPtr, - &fset->farr[TSDB_FTYPE_HEAD]->f->size); + &fset->farr[TSDB_FTYPE_HEAD]->f->size, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbFileWriteHeadFooter(ctx->fd, &fset->farr[TSDB_FTYPE_HEAD]->f->size, ctx->footer); + code = tsdbFileWriteHeadFooter(ctx->fd, &fset->farr[TSDB_FTYPE_HEAD]->f->size, ctx->footer, ctx->encryptAlgorithm, + ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbFsyncFile(ctx->fd); + code = tsdbFsyncFile(ctx->fd, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); tsdbCloseFile(&ctx->fd); @@ -252,12 +257,16 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade STFileObj *fobj; struct { int32_t szPage; + int32_t encryptAlgorithm; + char* encryptKey; // writer STsdbFD *fd; TSttBlkArray sttBlkArray[1]; SSttFooter footer[1]; } ctx[1] = {{ .szPage = tsdb->pVnode->config.tsdbPageSize, + .encryptAlgorithm = tsdb->pVnode->config.tsdbCfg.encryptAlgorithm, + .encryptKey = tsdb->pVnode->config.tsdbCfg.encryptKey, }}; STFile file = { @@ -280,13 +289,14 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade TSDB_CHECK_CODE(code, lino, _exit1); } - code = tsdbFileWriteSttBlk(ctx->fd, ctx->sttBlkArray, ctx->footer->sttBlkPtr, &fobj->f->size); + code = tsdbFileWriteSttBlk(ctx->fd, ctx->sttBlkArray, ctx->footer->sttBlkPtr, &fobj->f->size, ctx->encryptAlgorithm, + ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit1); - code = tsdbFileWriteSttFooter(ctx->fd, ctx->footer, &fobj->f->size); + code = tsdbFileWriteSttFooter(ctx->fd, ctx->footer, &fobj->f->size, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit1); - code = tsdbFsyncFile(ctx->fd); + code = tsdbFsyncFile(ctx->fd, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit1); tsdbCloseFile(&ctx->fd); @@ -431,7 +441,10 @@ static int32_t tsdbUpgradeOpenTombFile(STsdb *tsdb, STFileSet *fset, STsdbFD **f TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; - code = tsdbWriteFile(fd[0], 0, hdr, TSDB_FHDR_SIZE); + int32_t encryptAlgorithm = tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; + char* encryptKey = tsdb->pVnode->config.tsdbCfg.encryptKey; + + code = tsdbWriteFile(fd[0], 0, hdr, TSDB_FHDR_SIZE, encryptAlgorithm, encryptKey); TSDB_CHECK_CODE(code, lino, _exit); fobj[0]->f->size += TSDB_FHDR_SIZE; @@ -454,6 +467,8 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray * int64_t minKey; int64_t maxKey; SBuffer buffers[10]; + int32_t encryptAlgorithm; + char* encryptKey; // reader SArray *aDelData; // writer @@ -466,6 +481,8 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray * } ctx[1] = {{ .maxRow = tsdb->pVnode->config.tsdbCfg.maxRows, .cmprAlg = tsdb->pVnode->config.tsdbCfg.compression, + .encryptAlgorithm = tsdb->pVnode->config.tsdbCfg.encryptAlgorithm, + .encryptKey = tsdb->pVnode->config.tsdbCfg.encryptKey, }}; tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey); @@ -502,7 +519,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray * } SVersionRange tombRange = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN}; code = tsdbFileWriteTombBlock(ctx->fd, ctx->tombBlock, ctx->cmprAlg, &ctx->fobj->f->size, ctx->tombBlkArray, - ctx->buffers, &tombRange); + ctx->buffers, &tombRange, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } } @@ -515,26 +532,30 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray * } SVersionRange tombRange = {.minVer = VERSION_MAX, .maxVer = VERSION_MIN}; code = tsdbFileWriteTombBlock(ctx->fd, ctx->tombBlock, ctx->cmprAlg, &ctx->fobj->f->size, ctx->tombBlkArray, - ctx->buffers, &tombRange); + ctx->buffers, &tombRange, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } if (ctx->fd != NULL) { if (ctx->toStt) { - code = tsdbFileWriteTombBlk(ctx->fd, ctx->tombBlkArray, ctx->sttFooter->tombBlkPtr, &ctx->fobj->f->size); + code = tsdbFileWriteTombBlk(ctx->fd, ctx->tombBlkArray, ctx->sttFooter->tombBlkPtr, &ctx->fobj->f->size, + ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbFileWriteSttFooter(ctx->fd, ctx->sttFooter, &ctx->fobj->f->size); + code = tsdbFileWriteSttFooter(ctx->fd, ctx->sttFooter, &ctx->fobj->f->size, ctx->encryptAlgorithm, + ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } else { - code = tsdbFileWriteTombBlk(ctx->fd, ctx->tombBlkArray, ctx->tombFooter->tombBlkPtr, &ctx->fobj->f->size); + code = tsdbFileWriteTombBlk(ctx->fd, ctx->tombBlkArray, ctx->tombFooter->tombBlkPtr, &ctx->fobj->f->size, + ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbFileWriteTombFooter(ctx->fd, ctx->tombFooter, &ctx->fobj->f->size); + code = tsdbFileWriteTombFooter(ctx->fd, ctx->tombFooter, &ctx->fobj->f->size, ctx->encryptAlgorithm, + ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); } - code = tsdbFsyncFile(ctx->fd); + code = tsdbFsyncFile(ctx->fd, ctx->encryptAlgorithm, ctx->encryptKey); TSDB_CHECK_CODE(code, lino, _exit); tsdbCloseFile(&ctx->fd); diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 70308597b0..cd6863fd89 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,6 +15,7 @@ #include "tutil.h" #include "vnd.h" +#include "tglobal.h" const SVnodeCfg vnodeCfgDefault = {.vgId = -1, .dbname = "", @@ -133,6 +134,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { tjsonAddItemToArray(pNodeRetentions, pNodeRetention); } } + if (tjsonAddIntegerToObject(pJson, "tsdb.encryptAlgorithm", pCfg->tsdbCfg.encryptAlgorithm) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.vgId", pCfg->walCfg.vgId) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.fsyncPeriod", pCfg->walCfg.fsyncPeriod) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.retentionPeriod", pCfg->walCfg.retentionPeriod) < 0) return -1; @@ -140,6 +142,8 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "wal.retentionSize", pCfg->walCfg.retentionSize) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.segSize", pCfg->walCfg.segSize) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.level", pCfg->walCfg.level) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "sstTrigger", pCfg->sttTrigger) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "hashBegin", pCfg->hashBegin) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "hashEnd", pCfg->hashEnd) < 0) return -1; @@ -242,6 +246,19 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { tjsonGetNumberValue(pNodeRetention, "keep", (pCfg->tsdbCfg.retentions)[i].keep, code); tjsonGetNumberValue(pNodeRetention, "keepUnit", (pCfg->tsdbCfg.retentions)[i].keepUnit, code); } + tjsonGetNumberValue(pJson, "tsdb.encryptAlgorithm", pCfg->tsdbCfg.encryptAlgorithm, code); + if (code < 0) return -1; +#if defined(TD_ENTERPRISE) + if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } +#endif tjsonGetNumberValue(pJson, "wal.vgId", pCfg->walCfg.vgId, code); if (code < 0) return -1; tjsonGetNumberValue(pJson, "wal.fsyncPeriod", pCfg->walCfg.fsyncPeriod, code); @@ -256,6 +273,32 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (code < 0) return -1; tjsonGetNumberValue(pJson, "wal.level", pCfg->walCfg.level, code); if (code < 0) return -1; + tjsonGetNumberValue(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm, code); + if (code < 0) return -1; +#if defined(TD_ENTERPRISE) + if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } +#endif + tjsonGetNumberValue(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm, code); + if (code < 0) return -1; +#if defined(TD_ENTERPRISE) + if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } +#endif tjsonGetNumberValue(pJson, "sstTrigger", pCfg->sttTrigger, code); if (code < 0) pCfg->sttTrigger = TSDB_DEFAULT_SST_TRIGGER; tjsonGetNumberValue(pJson, "hashBegin", pCfg->hashBegin, code); diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index 6196d30a58..64209572f4 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -9,6 +9,8 @@ add_subdirectory(nodes) add_subdirectory(catalog) add_subdirectory(audit) add_subdirectory(monitorfw) +add_subdirectory(sm4) +add_subdirectory(crypt) add_subdirectory(scalar) add_subdirectory(function) diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 2b7100e19c..bf901188dc 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -315,6 +315,18 @@ static const char* cacheModelStr(int8_t cacheModel) { return TSDB_CACHE_MODEL_NONE_STR; } +static const char* encryptAlgorithmStr(int8_t encryptAlgorithm) { + switch (encryptAlgorithm) { + case TSDB_ENCRYPT_ALGO_NONE: + return TSDB_ENCRYPT_ALGO_NONE_STR; + case TSDB_ENCRYPT_ALGO_SM4: + return TSDB_ENCRYPT_ALGO_SM4_STR; + default: + break; + } + return TSDB_CACHE_MODEL_NONE_STR; +} + static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) { blockDataEnsureCapacity(pBlock, 1); pBlock->info.rows = 1; @@ -360,12 +372,12 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, ch "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm " "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d " "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " - "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " KEEP_TIME_OFFSET %d S3_CHUNKSIZE %d S3_KEEPLOCAL %dm S3_COMPACT %d", + "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " KEEP_TIME_OFFSET %d ENCRYPT_ALGORITHM '%s' S3_CHUNKSIZE %d S3_KEEPLOCAL %dm S3_COMPACT %d", dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, 1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, pCfg->walRetentionSize, - pCfg->keepTimeOffset, pCfg->s3ChunkSize, pCfg->s3KeepLocal, pCfg->s3Compact); + pCfg->keepTimeOffset, encryptAlgorithmStr(pCfg->encryptAlgorithm), pCfg->s3ChunkSize, pCfg->s3KeepLocal, pCfg->s3Compact); if (retentions) { len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions); diff --git a/source/libs/crypt/CMakeLists.txt b/source/libs/crypt/CMakeLists.txt new file mode 100644 index 0000000000..e6d73b1882 --- /dev/null +++ b/source/libs/crypt/CMakeLists.txt @@ -0,0 +1,14 @@ +aux_source_directory(src CRYPT_SRC) + +IF (TD_ENTERPRISE) + LIST(APPEND CRYPT_SRC ${TD_ENTERPRISE_DIR}/src/plugins/crypt/cryptImpl.c) +ENDIF () + +add_library(crypt STATIC ${CRYPT_SRC}) +target_include_directories( + crypt + PUBLIC "${TD_SOURCE_DIR}/include/libs/crypt" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries(crypt common sm4) diff --git a/source/libs/crypt/src/crypt.c b/source/libs/crypt/src/crypt.c new file mode 100644 index 0000000000..055c2f57cd --- /dev/null +++ b/source/libs/crypt/src/crypt.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#include "crypt.h" + +extern int32_t CBC_DecryptImpl(SCryptOpts *opts); +extern int32_t CBC_EncryptImpl(SCryptOpts *opts); + +int32_t CBC_Encrypt(SCryptOpts *opts) { + return CBC_EncryptImpl(opts); +} +int32_t CBC_Decrypt(SCryptOpts *opts) { + return CBC_DecryptImpl(opts); +} + +#ifndef TD_ENTERPRISE +int32_t CBC_EncryptImpl(SCryptOpts *opts) { + memcpy(opts->result, opts->source, opts->len); + return opts->len; +} +int32_t CBC_DecryptImpl(SCryptOpts *opts) { + memcpy(opts->result, opts->source, opts->len); + return opts->len; +} +#endif \ No newline at end of file diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index ec9a291f8c..0eaa2fd2b0 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -281,6 +281,8 @@ const char* nodesNodeName(ENodeType type) { return "ShowGrantsLogsStmt"; case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return "ShowClusterMachinesStmt"; + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: + return "ShowEncryptionsStmt"; case QUERY_NODE_DELETE_STMT: return "DeleteStmt"; case QUERY_NODE_INSERT_STMT: @@ -7047,10 +7049,14 @@ static int32_t showGrantsLogsStmtToJson(const void* pObj, SJson* pJson) { return static int32_t showClusterMachinesStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); } +static int32_t showEncryptionsStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); } + static int32_t jsonToShowGrantsLogsStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } static int32_t jsonToShowClusterMachinesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } +static int32_t jsonToShowEncryptionsStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } + static const char* jkShowDnodeVariablesStmtDnodeId = "DnodeId"; static const char* jkShowDnodeVariablesStmtLikePattern = "LikePattern"; @@ -7651,6 +7657,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return showGrantsLogsStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return showClusterMachinesStmtToJson(pObj, pJson); + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: + return showEncryptionsStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return showDnodeVariablesStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_TRANSACTIONS_STMT: @@ -7996,6 +8004,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToShowGrantsLogsStmt(pJson, pObj); case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return jsonToShowClusterMachinesStmt(pJson, pObj); + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: + return jsonToShowEncryptionsStmt(pJson, pObj); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return jsonToShowDnodeVariablesStmt(pJson, pObj); case QUERY_NODE_SHOW_TRANSACTIONS_STMT: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 746cdbd016..76bf7b04fd 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -521,6 +521,7 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_GRANTS_FULL_STMT: case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: case QUERY_NODE_SHOW_TSMAS_STMT: return makeNode(type, sizeof(SShowStmt)); case QUERY_NODE_SHOW_TABLE_TAGS_STMT: @@ -1210,6 +1211,7 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_GRANTS_FULL_STMT: case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: case QUERY_NODE_SHOW_TSMAS_STMT: { SShowStmt* pStmt = (SShowStmt*)pNode; nodesDestroyNode(pStmt->pDbName); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 300329c639..dac9599fa4 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -67,7 +67,8 @@ typedef enum EDatabaseOptionType { DB_OPTION_S3_CHUNKSIZE, DB_OPTION_S3_KEEPLOCAL, DB_OPTION_S3_COMPACT, - DB_OPTION_KEEP_TIME_OFFSET + DB_OPTION_KEEP_TIME_OFFSET, + DB_OPTION_ENCRYPT_ALGORITHM, } EDatabaseOptionType; typedef enum ETableOptionType { @@ -232,6 +233,7 @@ SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName); SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort); SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force, bool unsafe); SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue); +SNode* createEncryptKeyStmt(SAstCreateContext* pCxt, const SToken* pValue); SNode* createRealTableNodeForIndexName(SAstCreateContext* pCxt, SToken* pDbName, SToken* pIndexName); SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName, SNode* pRealTable, SNodeList* pCols, SNode* pOptions); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index ac14fcefdf..7ffc898529 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -144,6 +144,9 @@ priv_level(A) ::= topic_name(B). with_opt(A) ::= . { A = NULL; } with_opt(A) ::= WITH search_condition(B). { A = B; } +/************************************************ create encrypt_key *********************************************/ +cmd ::= CREATE ENCRYPT_KEY NK_STRING(A). { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &A); } + /************************************************ 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); } @@ -266,6 +269,7 @@ db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_INTEGER(C). db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); } db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_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) ENCRYPT_ALGORITHM NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_ENCRYPT_ALGORITHM, &C); } 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); } @@ -300,6 +304,7 @@ alter_db_option(A) ::= S3_KEEPLOCAL NK_INTEGER(B). alter_db_option(A) ::= S3_KEEPLOCAL NK_VARIABLE(B). { A.type = DB_OPTION_S3_KEEPLOCAL; A.val = B; } alter_db_option(A) ::= S3_COMPACT NK_INTEGER(B). { A.type = DB_OPTION_S3_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) ::= ENCRYPT_ALGORITHM NK_STRING(B). { A.type = DB_OPTION_ENCRYPT_ALGORITHM; A.val = B; } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } @@ -516,7 +521,9 @@ cmd ::= SHOW GRANTS LOGS. cmd ::= SHOW CLUSTER MACHINES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_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 STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); } +cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, +A); } +cmd ::= SHOW ENCRYPTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 75e48e5b4e..007dfbb8af 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1375,6 +1375,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { pOptions->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; pOptions->s3Compact = TSDB_DEFAULT_S3_COMPACT; pOptions->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; + pOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; return (SNode*)pOptions; } @@ -1414,6 +1415,7 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) { pOptions->s3KeepLocal = -1; pOptions->s3Compact = -1; pOptions->withArbitrator = -1; + pOptions->encryptAlgorithm = -1; return (SNode*)pOptions; } @@ -1547,6 +1549,10 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED case DB_OPTION_KEEP_TIME_OFFSET: { pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); break; + case DB_OPTION_ENCRYPT_ALGORITHM: + COPY_STRING_FORM_STR_TOKEN(pDbOptions->encryptAlgorithmStr, (SToken*)pVal); + pDbOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; + break; } default: break; @@ -2334,6 +2340,14 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const return (SNode*)pStmt; } +SNode* createEncryptKeyStmt(SAstCreateContext* pCxt, const SToken* pValue) { + SToken config; + config.type = TK_NK_STRING; + config.z = "\"encrypt_key\""; + config.n = strlen(config.z); + return createAlterDnodeStmt(pCxt, NULL, &config, pValue); +} + SNode* createRealTableNodeForIndexName(SAstCreateContext* pCxt, SToken* pDbName, SToken* pIndexName) { if (!checkIndexName(pCxt, pIndexName)) { return NULL; diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 94e17eef4f..a1f09088da 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -644,6 +644,11 @@ static int32_t collectMetaKeyFromShowClusterMachines(SCollectMetaKeyCxt* pCxt, S pCxt->pMetaCache); } +static int32_t collectMetaKeyFromShowEncryptions(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_ENCRYPTIONS, + pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) { return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); } @@ -916,6 +921,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromShowGrantsLogs(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return collectMetaKeyFromShowClusterMachines(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: + return collectMetaKeyFromShowEncryptions(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index dd04a5c36c..cf389e249f 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -356,6 +356,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: case QUERY_NODE_SHOW_ARBGROUPS_STMT: + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: return !pCxt->pParseCxt->enableSysInfo ? TSDB_CODE_PAR_PERMISSION_DENIED : TSDB_CODE_SUCCESS; case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 9829528d92..370514e1fc 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -670,11 +670,13 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, case TSDB_DATA_TYPE_NCHAR: { int32_t output = 0; - void* p = taosMemoryCalloc(1, pSchema->bytes - VARSTR_HEADER_SIZE); + int64_t realLen = pToken->n << 2; + if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE; + void* p = taosMemoryMalloc(realLen); if (p == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), pSchema->bytes - VARSTR_HEADER_SIZE, &output)) { + if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), realLen, &output)) { if (errno == E2BIG) { taosMemoryFree(p); return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 599f93602a..2d549a4180 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -94,6 +94,9 @@ static SKeyword keywordTable[] = { {"DURATION", TK_DURATION}, {"ELSE", TK_ELSE}, {"ENABLE", TK_ENABLE}, + {"ENCRYPTIONS", TK_ENCRYPTIONS}, + {"ENCRYPT_ALGORITHM", TK_ENCRYPT_ALGORITHM}, + {"ENCRYPT_KEY", TK_ENCRYPT_KEY}, {"END", TK_END}, {"EXISTS", TK_EXISTS}, {"EXPIRED", TK_EXPIRED}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 7013ea7c96..ccaf2131f4 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -305,7 +305,15 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = { { .showType = QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT, .pDbName = TSDB_INFORMATION_SCHEMA_DB, .pTableName = TSDB_INS_TABLE_MACHINES, - }, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, + { .showType = QUERY_NODE_SHOW_ENCRYPTIONS_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_ENCRYPTIONS, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, { .showType = QUERY_NODE_SHOW_TSMAS_STMT, .pDbName = TSDB_INFORMATION_SCHEMA_DB, .pTableName = TSDB_INS_TABLE_TSMAS, @@ -6501,6 +6509,7 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS pReq->s3Compact = pStmt->pOptions->s3Compact; pReq->ignoreExist = pStmt->ignoreExists; pReq->withArbitrator = pStmt->pOptions->withArbitrator; + pReq->encryptAlgorithm = pStmt->pOptions->encryptAlgorithm; return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq); } @@ -6645,6 +6654,21 @@ static int32_t checkDbCacheModelOption(STranslateContext* pCxt, SDatabaseOptions return TSDB_CODE_SUCCESS; } +static int32_t checkDbEncryptAlgorithmOption(STranslateContext* pCxt, SDatabaseOptions* pOptions) { + if ('\0' != pOptions->encryptAlgorithmStr[0]) { + if (0 == strcasecmp(pOptions->encryptAlgorithmStr, TSDB_ENCRYPT_ALGO_NONE_STR)) { + pOptions->encryptAlgorithm = TSDB_ENCRYPT_ALGO_NONE; + } else if (0 == strcasecmp(pOptions->encryptAlgorithmStr, TSDB_ENCRYPT_ALGO_SM4_STR)) { + pOptions->encryptAlgorithm = TSDB_ENCRYPT_ALGO_SM4; + } else { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid option encrypt_algorithm: %s", pOptions->encryptAlgorithmStr); + } + } + + return TSDB_CODE_SUCCESS; +} + static int32_t checkDbPrecisionOption(STranslateContext* pCxt, SDatabaseOptions* pOptions) { if ('\0' != pOptions->precisionStr[0]) { if (0 == strcasecmp(pOptions->precisionStr, TSDB_TIME_PRECISION_MILLI_STR)) { @@ -6838,6 +6862,9 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName if (TSDB_CODE_SUCCESS == code) { code = checkDbCacheModelOption(pCxt, pOptions); } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEncryptAlgorithmOption(pCxt, pOptions); + } if (TSDB_CODE_SUCCESS == code) { code = checkDbRangeOption(pCxt, "cacheSize", pOptions->cacheLastSize, TSDB_MIN_DB_CACHE_SIZE, TSDB_MAX_DB_CACHE_SIZE); @@ -6924,6 +6951,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName code = checkDbEnumOption(pCxt, "withArbitrator", pOptions->withArbitrator, TSDB_MIN_DB_WITH_ARBITRATOR, TSDB_MAX_DB_WITH_ARBITRATOR); } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEnumOption(pCxt, "encryptAlgorithm", pOptions->encryptAlgorithm, TSDB_MIN_ENCRYPT_ALGO, + TSDB_MAX_ENCRYPT_ALGO); + } if (TSDB_CODE_SUCCESS == code) { code = checkDbTbPrefixSuffixOptions(pCxt, pOptions->tablePrefix, pOptions->tableSuffix); } @@ -7070,6 +7101,11 @@ static int32_t fillCmdSql(STranslateContext* pCxt, int16_t msgType, void* pReq) FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCfgClusterReq, pReq); break; } + case TDMT_MND_CREATE_ENCRYPT_KEY: { + FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCfgDnodeReq, pReq); + break; + } + default: { break; } @@ -7157,6 +7193,11 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm return code; } + if (pStmt->pOptions->encryptAlgorithm != -1) { + code = TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE; + return code; + } + SAlterDbReq alterReq = {0}; buildAlterDbReq(pCxt, pStmt, &alterReq); @@ -8378,7 +8419,20 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt strcpy(cfgReq.config, pStmt->config); strcpy(cfgReq.value, pStmt->value); - int32_t code = buildCmdMsg(pCxt, TDMT_MND_CONFIG_DNODE, (FSerializeFunc)tSerializeSMCfgDnodeReq, &cfgReq); + int32_t code = 0; + if (0 == strncasecmp(cfgReq.config, "encrypt_key", 12)) { + int32_t klen = strlen(cfgReq.value); + if (klen > ENCRYPT_KEY_LEN || klen < ENCRYPT_KEY_LEN_MIN) { + tFreeSMCfgDnodeReq(&cfgReq); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN, + "Invalid encryption key length: %d, valid range [%d,%d]", klen, + ENCRYPT_KEY_LEN_MIN, ENCRYPT_KEY_LEN); + } + code = buildCmdMsg(pCxt, TDMT_MND_CREATE_ENCRYPT_KEY, (FSerializeFunc)tSerializeSMCfgDnodeReq, &cfgReq); + } else { + code = buildCmdMsg(pCxt, TDMT_MND_CONFIG_DNODE, (FSerializeFunc)tSerializeSMCfgDnodeReq, &cfgReq); + } + tFreeSMCfgDnodeReq(&cfgReq); return code; } @@ -13117,6 +13171,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: case QUERY_NODE_SHOW_ARBGROUPS_STMT: + case QUERY_NODE_SHOW_ENCRYPTIONS_STMT: case QUERY_NODE_SHOW_TSMAS_STMT: code = rewriteShow(pCxt, pQuery); break; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a417201fa4..2bbc9e95de 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,5 +1,3 @@ -/* This file is automatically generated by Lemon from input grammar -** source file "sql.y". */ /* ** 2000-05-29 ** @@ -24,8 +22,9 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ +#include +#include /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" #include #include @@ -42,385 +41,12 @@ #include "parAst.h" #define YYSTACKDEPTH 0 -#line 46 "sql.c" /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols. -***************** Begin token definitions *************************************/ -#ifndef TK_OR -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_USER 35 -#define TK_ENABLE 36 -#define TK_NK_INTEGER 37 -#define TK_SYSINFO 38 -#define TK_ADD 39 -#define TK_DROP 40 -#define TK_GRANT 41 -#define TK_ON 42 -#define TK_TO 43 -#define TK_REVOKE 44 -#define TK_FROM 45 -#define TK_SUBSCRIBE 46 -#define TK_READ 47 -#define TK_WRITE 48 -#define TK_NK_DOT 49 -#define TK_WITH 50 -#define TK_DNODE 51 -#define TK_PORT 52 -#define TK_DNODES 53 -#define TK_RESTORE 54 -#define TK_NK_IPTOKEN 55 -#define TK_FORCE 56 -#define TK_UNSAFE 57 -#define TK_CLUSTER 58 -#define TK_LOCAL 59 -#define TK_QNODE 60 -#define TK_BNODE 61 -#define TK_SNODE 62 -#define TK_MNODE 63 -#define TK_VNODE 64 -#define TK_DATABASE 65 -#define TK_USE 66 -#define TK_FLUSH 67 -#define TK_TRIM 68 -#define TK_S3MIGRATE 69 -#define TK_COMPACT 70 -#define TK_IF 71 -#define TK_NOT 72 -#define TK_EXISTS 73 -#define TK_BUFFER 74 -#define TK_CACHEMODEL 75 -#define TK_CACHESIZE 76 -#define TK_COMP 77 -#define TK_DURATION 78 -#define TK_NK_VARIABLE 79 -#define TK_MAXROWS 80 -#define TK_MINROWS 81 -#define TK_KEEP 82 -#define TK_PAGES 83 -#define TK_PAGESIZE 84 -#define TK_TSDB_PAGESIZE 85 -#define TK_PRECISION 86 -#define TK_REPLICA 87 -#define TK_VGROUPS 88 -#define TK_SINGLE_STABLE 89 -#define TK_RETENTIONS 90 -#define TK_SCHEMALESS 91 -#define TK_WAL_LEVEL 92 -#define TK_WAL_FSYNC_PERIOD 93 -#define TK_WAL_RETENTION_PERIOD 94 -#define TK_WAL_RETENTION_SIZE 95 -#define TK_WAL_ROLL_PERIOD 96 -#define TK_WAL_SEGMENT_SIZE 97 -#define TK_STT_TRIGGER 98 -#define TK_TABLE_PREFIX 99 -#define TK_TABLE_SUFFIX 100 -#define TK_S3_CHUNKSIZE 101 -#define TK_S3_KEEPLOCAL 102 -#define TK_S3_COMPACT 103 -#define TK_KEEP_TIME_OFFSET 104 -#define TK_NK_COLON 105 -#define TK_BWLIMIT 106 -#define TK_START 107 -#define TK_TIMESTAMP 108 -#define TK_END 109 -#define TK_TABLE 110 -#define TK_NK_LP 111 -#define TK_NK_RP 112 -#define TK_STABLE 113 -#define TK_COLUMN 114 -#define TK_MODIFY 115 -#define TK_RENAME 116 -#define TK_TAG 117 -#define TK_SET 118 -#define TK_NK_EQ 119 -#define TK_USING 120 -#define TK_TAGS 121 -#define TK_BOOL 122 -#define TK_TINYINT 123 -#define TK_SMALLINT 124 -#define TK_INT 125 -#define TK_INTEGER 126 -#define TK_BIGINT 127 -#define TK_FLOAT 128 -#define TK_DOUBLE 129 -#define TK_BINARY 130 -#define TK_NCHAR 131 -#define TK_UNSIGNED 132 -#define TK_JSON 133 -#define TK_VARCHAR 134 -#define TK_MEDIUMBLOB 135 -#define TK_BLOB 136 -#define TK_VARBINARY 137 -#define TK_GEOMETRY 138 -#define TK_DECIMAL 139 -#define TK_COMMENT 140 -#define TK_MAX_DELAY 141 -#define TK_WATERMARK 142 -#define TK_ROLLUP 143 -#define TK_TTL 144 -#define TK_SMA 145 -#define TK_DELETE_MARK 146 -#define TK_FIRST 147 -#define TK_LAST 148 -#define TK_SHOW 149 -#define TK_PRIVILEGES 150 -#define TK_DATABASES 151 -#define TK_TABLES 152 -#define TK_STABLES 153 -#define TK_MNODES 154 -#define TK_QNODES 155 -#define TK_ARBGROUPS 156 -#define TK_FUNCTIONS 157 -#define TK_INDEXES 158 -#define TK_ACCOUNTS 159 -#define TK_APPS 160 -#define TK_CONNECTIONS 161 -#define TK_LICENCES 162 -#define TK_GRANTS 163 -#define TK_FULL 164 -#define TK_LOGS 165 -#define TK_MACHINES 166 -#define TK_QUERIES 167 -#define TK_SCORES 168 -#define TK_TOPICS 169 -#define TK_VARIABLES 170 -#define TK_BNODES 171 -#define TK_SNODES 172 -#define TK_TRANSACTIONS 173 -#define TK_DISTRIBUTED 174 -#define TK_CONSUMERS 175 -#define TK_SUBSCRIPTIONS 176 -#define TK_VNODES 177 -#define TK_ALIVE 178 -#define TK_VIEWS 179 -#define TK_VIEW 180 -#define TK_COMPACTS 181 -#define TK_NORMAL 182 -#define TK_CHILD 183 -#define TK_LIKE 184 -#define TK_TBNAME 185 -#define TK_QTAGS 186 -#define TK_AS 187 -#define TK_SYSTEM 188 -#define TK_TSMA 189 -#define TK_INTERVAL 190 -#define TK_RECURSIVE 191 -#define TK_TSMAS 192 -#define TK_FUNCTION 193 -#define TK_INDEX 194 -#define TK_COUNT 195 -#define TK_LAST_ROW 196 -#define TK_META 197 -#define TK_ONLY 198 -#define TK_TOPIC 199 -#define TK_CONSUMER 200 -#define TK_GROUP 201 -#define TK_DESC 202 -#define TK_DESCRIBE 203 -#define TK_RESET 204 -#define TK_QUERY 205 -#define TK_CACHE 206 -#define TK_EXPLAIN 207 -#define TK_ANALYZE 208 -#define TK_VERBOSE 209 -#define TK_NK_BOOL 210 -#define TK_RATIO 211 -#define TK_NK_FLOAT 212 -#define TK_OUTPUTTYPE 213 -#define TK_AGGREGATE 214 -#define TK_BUFSIZE 215 -#define TK_LANGUAGE 216 -#define TK_REPLACE 217 -#define TK_STREAM 218 -#define TK_INTO 219 -#define TK_PAUSE 220 -#define TK_RESUME 221 -#define TK_PRIMARY 222 -#define TK_KEY 223 -#define TK_TRIGGER 224 -#define TK_AT_ONCE 225 -#define TK_WINDOW_CLOSE 226 -#define TK_IGNORE 227 -#define TK_EXPIRED 228 -#define TK_FILL_HISTORY 229 -#define TK_UPDATE 230 -#define TK_SUBTABLE 231 -#define TK_UNTREATED 232 -#define TK_KILL 233 -#define TK_CONNECTION 234 -#define TK_TRANSACTION 235 -#define TK_BALANCE 236 -#define TK_VGROUP 237 -#define TK_LEADER 238 -#define TK_MERGE 239 -#define TK_REDISTRIBUTE 240 -#define TK_SPLIT 241 -#define TK_DELETE 242 -#define TK_INSERT 243 -#define TK_NK_BIN 244 -#define TK_NK_HEX 245 -#define TK_NULL 246 -#define TK_NK_QUESTION 247 -#define TK_NK_ALIAS 248 -#define TK_NK_ARROW 249 -#define TK_ROWTS 250 -#define TK_QSTART 251 -#define TK_QEND 252 -#define TK_QDURATION 253 -#define TK_WSTART 254 -#define TK_WEND 255 -#define TK_WDURATION 256 -#define TK_IROWTS 257 -#define TK_ISFILLED 258 -#define TK_CAST 259 -#define TK_NOW 260 -#define TK_TODAY 261 -#define TK_TIMEZONE 262 -#define TK_CLIENT_VERSION 263 -#define TK_SERVER_VERSION 264 -#define TK_SERVER_STATUS 265 -#define TK_CURRENT_USER 266 -#define TK_CASE 267 -#define TK_WHEN 268 -#define TK_THEN 269 -#define TK_ELSE 270 -#define TK_BETWEEN 271 -#define TK_IS 272 -#define TK_NK_LT 273 -#define TK_NK_GT 274 -#define TK_NK_LE 275 -#define TK_NK_GE 276 -#define TK_NK_NE 277 -#define TK_MATCH 278 -#define TK_NMATCH 279 -#define TK_CONTAINS 280 -#define TK_IN 281 -#define TK_JOIN 282 -#define TK_INNER 283 -#define TK_LEFT 284 -#define TK_RIGHT 285 -#define TK_OUTER 286 -#define TK_SEMI 287 -#define TK_ANTI 288 -#define TK_ASOF 289 -#define TK_WINDOW 290 -#define TK_WINDOW_OFFSET 291 -#define TK_JLIMIT 292 -#define TK_SELECT 293 -#define TK_NK_HINT 294 -#define TK_DISTINCT 295 -#define TK_WHERE 296 -#define TK_PARTITION 297 -#define TK_BY 298 -#define TK_SESSION 299 -#define TK_STATE_WINDOW 300 -#define TK_EVENT_WINDOW 301 -#define TK_COUNT_WINDOW 302 -#define TK_SLIDING 303 -#define TK_FILL 304 -#define TK_VALUE 305 -#define TK_VALUE_F 306 -#define TK_NONE 307 -#define TK_PREV 308 -#define TK_NULL_F 309 -#define TK_LINEAR 310 -#define TK_NEXT 311 -#define TK_HAVING 312 -#define TK_RANGE 313 -#define TK_EVERY 314 -#define TK_ORDER 315 -#define TK_SLIMIT 316 -#define TK_SOFFSET 317 -#define TK_LIMIT 318 -#define TK_OFFSET 319 -#define TK_ASC 320 -#define TK_NULLS 321 -#define TK_ABORT 322 -#define TK_AFTER 323 -#define TK_ATTACH 324 -#define TK_BEFORE 325 -#define TK_BEGIN 326 -#define TK_BITAND 327 -#define TK_BITNOT 328 -#define TK_BITOR 329 -#define TK_BLOCKS 330 -#define TK_CHANGE 331 -#define TK_COMMA 332 -#define TK_CONCAT 333 -#define TK_CONFLICT 334 -#define TK_COPY 335 -#define TK_DEFERRED 336 -#define TK_DELIMITERS 337 -#define TK_DETACH 338 -#define TK_DIVIDE 339 -#define TK_DOT 340 -#define TK_EACH 341 -#define TK_FAIL 342 -#define TK_FILE 343 -#define TK_FOR 344 -#define TK_GLOB 345 -#define TK_ID 346 -#define TK_IMMEDIATE 347 -#define TK_IMPORT 348 -#define TK_INITIALLY 349 -#define TK_INSTEAD 350 -#define TK_ISNULL 351 -#define TK_MODULES 352 -#define TK_NK_BITNOT 353 -#define TK_NK_SEMI 354 -#define TK_NOTNULL 355 -#define TK_OF 356 -#define TK_PLUS 357 -#define TK_PRIVILEGE 358 -#define TK_RAISE 359 -#define TK_RESTRICT 360 -#define TK_ROW 361 -#define TK_STAR 362 -#define TK_STATEMENT 363 -#define TK_STRICT 364 -#define TK_STRING 365 -#define TK_TIMES 366 -#define TK_VALUES 367 -#define TK_VARIABLE 368 -#define TK_WAL 369 -#define TK_ENCODE 370 -#define TK_COMPRESS 371 -#define TK_LEVEL 372 -#endif -/**************** End token definitions ***************************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +/**************** End makeheaders token definitions ***************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -478,30 +104,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 551 +#define YYNOCODE 554 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOperatorType yy22; - EJoinSubType yy26; - ENullOrder yy71; - STokenPair yy73; - EOrder yy88; - SDataType yy146; - SAlterOption yy177; - EJoinType yy190; - SShowTablesOption yy347; - int32_t yy462; - SToken yy585; - SNodeList* yy616; - SNode* yy826; - EShowKind yy857; - int64_t yy891; - bool yy983; - int8_t yy999; - EFillMode yy1082; + EFillMode yy6; + SShowTablesOption yy125; + SAlterOption yy145; + EShowKind yy245; + ENullOrder yy273; + EOperatorType yy292; + SDataType yy400; + EJoinType yy564; + SNode* yy600; + SToken yy649; + int8_t yy663; + bool yy705; + SNodeList* yy748; + int32_t yy756; + EJoinSubType yy758; + STokenPair yy781; + int64_t yy941; + EOrder yy1010; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -517,18 +143,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 956 -#define YYNRULE 743 -#define YYNRULE_WITH_ACTION 743 -#define YYNTOKEN 373 -#define YY_MAX_SHIFT 955 -#define YY_MIN_SHIFTREDUCE 1422 -#define YY_MAX_SHIFTREDUCE 2164 -#define YY_ERROR_ACTION 2165 -#define YY_ACCEPT_ACTION 2166 -#define YY_NO_ACTION 2167 -#define YY_MIN_REDUCE 2168 -#define YY_MAX_REDUCE 2910 +#define YYNSTATE 961 +#define YYNRULE 747 +#define YYNRULE_WITH_ACTION 747 +#define YYNTOKEN 376 +#define YY_MAX_SHIFT 960 +#define YY_MIN_SHIFTREDUCE 1429 +#define YY_MAX_SHIFTREDUCE 2175 +#define YY_ERROR_ACTION 2176 +#define YY_ACCEPT_ACTION 2177 +#define YY_NO_ACTION 2178 +#define YY_MIN_REDUCE 2179 +#define YY_MAX_REDUCE 2925 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -595,891 +221,939 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2999) +#define YY_ACTTAB_COUNT (3228) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2427, 251, 37, 337, 533, 639, 122, 2219, 461, 532, - /* 10 */ 182, 2520, 47, 45, 2081, 486, 2369, 33, 2302, 2425, - /* 20 */ 468, 2169, 1902, 40, 39, 1927, 463, 46, 44, 43, - /* 30 */ 42, 41, 2517, 841, 850, 1990, 636, 1900, 2254, 637, - /* 40 */ 2211, 2686, 136, 2351, 416, 135, 134, 133, 132, 131, - /* 50 */ 130, 129, 128, 127, 799, 40, 39, 209, 750, 46, - /* 60 */ 44, 43, 42, 41, 35, 1985, 2876, 452, 2567, 733, - /* 70 */ 40, 39, 19, 2414, 46, 44, 43, 42, 41, 1908, - /* 80 */ 29, 2520, 2704, 644, 2882, 216, 637, 2211, 2644, 2877, - /* 90 */ 785, 484, 549, 2489, 796, 155, 470, 633, 2651, 850, - /* 100 */ 836, 910, 2517, 841, 2327, 1928, 631, 2604, 952, 627, - /* 110 */ 623, 15, 927, 926, 925, 924, 496, 2880, 923, 922, - /* 120 */ 160, 917, 916, 915, 914, 913, 912, 911, 159, 905, - /* 130 */ 904, 903, 495, 494, 900, 899, 898, 196, 195, 897, - /* 140 */ 491, 896, 895, 2191, 641, 231, 2685, 1992, 1993, 2724, - /* 150 */ 638, 1589, 473, 119, 2687, 840, 2689, 2690, 835, 2126, - /* 160 */ 855, 750, 517, 855, 66, 199, 1588, 2778, 2793, 2876, - /* 170 */ 136, 464, 2774, 135, 134, 133, 132, 131, 130, 129, - /* 180 */ 128, 127, 190, 197, 314, 1963, 1973, 2882, 216, 540, - /* 190 */ 50, 217, 2877, 785, 2790, 1991, 1994, 40, 39, 2825, - /* 200 */ 2651, 46, 44, 43, 42, 41, 702, 701, 700, 436, - /* 210 */ 1903, 2493, 1901, 692, 152, 696, 125, 2786, 2787, 695, - /* 220 */ 153, 2791, 2520, 652, 694, 699, 445, 444, 156, 2686, - /* 230 */ 693, 2749, 1776, 1777, 443, 689, 688, 606, 601, 599, - /* 240 */ 659, 408, 837, 2518, 841, 229, 1906, 1907, 1960, 773, - /* 250 */ 1962, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 832, - /* 260 */ 853, 852, 1984, 1986, 1987, 1988, 1989, 2, 47, 45, - /* 270 */ 2704, 62, 2358, 413, 1927, 1925, 468, 2704, 1902, 1927, - /* 280 */ 1775, 1778, 583, 851, 2367, 604, 2651, 2222, 836, 769, - /* 290 */ 603, 1990, 288, 1900, 40, 39, 287, 521, 46, 44, - /* 300 */ 43, 42, 41, 146, 235, 1488, 563, 1487, 605, 827, - /* 310 */ 682, 40, 39, 414, 565, 46, 44, 43, 42, 41, - /* 320 */ 826, 1985, 151, 1931, 655, 543, 523, 519, 19, 46, - /* 330 */ 44, 43, 42, 41, 2685, 1908, 473, 2724, 2056, 945, - /* 340 */ 1489, 119, 2687, 840, 2689, 2690, 835, 855, 855, 92, - /* 350 */ 772, 157, 91, 166, 2749, 2778, 796, 155, 428, 464, - /* 360 */ 2774, 2421, 2422, 2106, 952, 437, 1638, 15, 2056, 101, - /* 370 */ 62, 9, 321, 375, 423, 2462, 551, 450, 2107, 722, - /* 380 */ 1629, 884, 883, 882, 1633, 881, 1635, 1636, 880, 877, - /* 390 */ 850, 1644, 874, 1646, 1647, 871, 868, 865, 775, 770, - /* 400 */ 763, 759, 1462, 1992, 1993, 2019, 2500, 2479, 894, 591, - /* 410 */ 590, 589, 588, 587, 582, 581, 580, 579, 420, 90, - /* 420 */ 2105, 1469, 569, 568, 567, 566, 560, 559, 558, 787, - /* 430 */ 553, 552, 435, 861, 451, 2567, 544, 1737, 1738, 1749, - /* 440 */ 1750, 1963, 1973, 1756, 1464, 1467, 1468, 731, 2661, 181, - /* 450 */ 479, 1991, 1994, 321, 388, 482, 2798, 2053, 2054, 2055, - /* 460 */ 2798, 2798, 2798, 2798, 2798, 471, 1903, 12, 1901, 98, - /* 470 */ 2020, 386, 76, 179, 1930, 75, 2665, 798, 185, 2786, - /* 480 */ 2787, 50, 153, 2791, 2372, 415, 438, 2053, 2054, 2055, - /* 490 */ 212, 488, 885, 2056, 2420, 2422, 2362, 249, 618, 616, - /* 500 */ 613, 611, 1906, 1907, 1960, 907, 1962, 1965, 1966, 1967, - /* 510 */ 1968, 1969, 1970, 1971, 1972, 832, 853, 852, 1984, 1986, - /* 520 */ 1987, 1988, 1989, 2, 12, 47, 45, 2667, 2669, 465, - /* 530 */ 180, 2686, 183, 468, 2180, 1902, 851, 2367, 855, 486, - /* 540 */ 2369, 576, 62, 253, 837, 575, 734, 639, 1990, 2219, - /* 550 */ 1900, 1932, 321, 574, 796, 155, 220, 36, 466, 2014, - /* 560 */ 2015, 2016, 2017, 2018, 2022, 2023, 2024, 2025, 1908, 40, - /* 570 */ 39, 909, 2704, 46, 44, 43, 42, 41, 1985, 1638, - /* 580 */ 63, 860, 859, 858, 1927, 19, 1491, 1492, 2651, 371, - /* 590 */ 836, 2645, 1908, 1629, 884, 883, 882, 1633, 881, 1635, - /* 600 */ 1636, 831, 830, 2661, 1644, 829, 1646, 1647, 828, 868, - /* 610 */ 865, 2798, 2053, 2054, 2055, 2798, 2798, 2798, 2798, 2798, - /* 620 */ 1471, 952, 851, 2367, 15, 1871, 1926, 2686, 646, 2559, - /* 630 */ 1870, 2665, 2356, 86, 85, 536, 2685, 2427, 228, 2724, - /* 640 */ 799, 319, 146, 184, 2687, 840, 2689, 2690, 835, 687, - /* 650 */ 855, 528, 526, 2085, 62, 473, 803, 478, 477, 1927, - /* 660 */ 1992, 1993, 481, 480, 412, 1928, 855, 515, 2704, 98, - /* 670 */ 512, 508, 504, 501, 529, 117, 192, 2786, 795, 62, - /* 680 */ 147, 794, 2667, 2670, 2651, 774, 836, 2881, 2876, 2168, - /* 690 */ 751, 2836, 158, 855, 555, 2489, 2363, 595, 1963, 1973, - /* 700 */ 2354, 2359, 784, 1488, 1930, 1487, 783, 216, 1991, 1994, - /* 710 */ 2876, 2877, 785, 145, 144, 143, 142, 141, 140, 139, - /* 720 */ 138, 137, 2343, 1903, 321, 1901, 442, 441, 783, 216, - /* 730 */ 851, 2367, 2685, 2877, 785, 2724, 851, 2367, 1489, 119, - /* 740 */ 2687, 840, 2689, 2690, 835, 2349, 855, 233, 123, 1964, - /* 750 */ 55, 199, 531, 2778, 530, 2114, 537, 464, 2774, 1906, - /* 760 */ 1907, 1960, 240, 1962, 1965, 1966, 1967, 1968, 1969, 1970, - /* 770 */ 1971, 1972, 832, 853, 852, 1984, 1986, 1987, 1988, 1989, - /* 780 */ 2, 47, 45, 1995, 2686, 2826, 529, 594, 239, 468, - /* 790 */ 296, 1902, 1677, 1678, 2021, 381, 2149, 837, 820, 2221, - /* 800 */ 2750, 592, 440, 439, 1990, 684, 1900, 2058, 2059, 2060, - /* 810 */ 2061, 2062, 1961, 2686, 766, 765, 2112, 2113, 2115, 2116, - /* 820 */ 2117, 2427, 851, 2367, 1964, 2704, 837, 686, 2833, 472, - /* 830 */ 2371, 685, 720, 822, 1985, 2750, 321, 585, 2489, 102, - /* 840 */ 2425, 2651, 538, 836, 493, 492, 656, 718, 1908, 716, - /* 850 */ 285, 284, 40, 39, 2704, 653, 46, 44, 43, 42, - /* 860 */ 41, 321, 892, 172, 171, 889, 888, 887, 169, 1909, - /* 870 */ 2651, 319, 836, 1804, 851, 2367, 2427, 952, 328, 329, - /* 880 */ 48, 34, 2000, 327, 487, 111, 2605, 1961, 1927, 2685, - /* 890 */ 238, 2026, 2724, 210, 557, 2425, 119, 2687, 840, 2689, - /* 900 */ 2690, 835, 2257, 855, 2881, 2507, 749, 657, 2896, 2342, - /* 910 */ 2778, 2360, 2876, 1960, 464, 2774, 1992, 1993, 2685, 654, - /* 920 */ 2513, 2724, 851, 2367, 289, 119, 2687, 840, 2689, 2690, - /* 930 */ 835, 2880, 855, 851, 2367, 2877, 2879, 2896, 489, 2778, - /* 940 */ 750, 51, 570, 464, 2774, 2371, 179, 12, 2876, 10, - /* 950 */ 418, 417, 2341, 571, 1963, 1973, 2125, 2372, 3, 2166, - /* 960 */ 474, 2190, 851, 2367, 1991, 1994, 2882, 216, 851, 2367, - /* 970 */ 53, 2877, 785, 1990, 2181, 483, 702, 701, 700, 1903, - /* 980 */ 894, 1901, 572, 692, 152, 696, 727, 1931, 658, 695, - /* 990 */ 851, 2367, 851, 2367, 694, 699, 445, 444, 2686, 1902, - /* 1000 */ 693, 734, 2189, 1985, 443, 689, 688, 730, 1830, 1831, - /* 1010 */ 2364, 837, 291, 2846, 1900, 1906, 1907, 1960, 2651, 1962, - /* 1020 */ 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 832, 853, - /* 1030 */ 852, 1984, 1986, 1987, 1988, 1989, 2, 47, 45, 2704, - /* 1040 */ 750, 851, 2367, 60, 1912, 468, 499, 1902, 2876, 791, - /* 1050 */ 2686, 498, 2793, 1964, 747, 2651, 1908, 836, 197, 2651, - /* 1060 */ 1990, 299, 1900, 837, 1469, 761, 2882, 216, 2188, 40, - /* 1070 */ 39, 2877, 785, 46, 44, 43, 42, 41, 2789, 851, - /* 1080 */ 2367, 14, 13, 736, 2559, 952, 2494, 778, 1467, 1468, - /* 1090 */ 1985, 2704, 892, 172, 171, 889, 888, 887, 169, 802, - /* 1100 */ 750, 851, 2367, 2685, 1908, 2592, 2724, 2651, 2876, 836, - /* 1110 */ 119, 2687, 840, 2689, 2690, 835, 1961, 855, 2303, 851, - /* 1120 */ 2367, 332, 2896, 321, 2778, 2651, 2882, 216, 464, 2774, - /* 1130 */ 1931, 2877, 785, 952, 2686, 2446, 48, 40, 39, 816, - /* 1140 */ 2078, 46, 44, 43, 42, 41, 690, 837, 1893, 2869, - /* 1150 */ 1869, 851, 2367, 2067, 207, 2685, 2187, 375, 2724, 851, - /* 1160 */ 2367, 2186, 119, 2687, 840, 2689, 2690, 835, 825, 855, - /* 1170 */ 1571, 339, 1992, 1993, 2896, 2704, 2778, 851, 2367, 848, - /* 1180 */ 464, 2774, 476, 475, 1894, 851, 2367, 1903, 2185, 1901, - /* 1190 */ 1577, 2651, 2033, 836, 851, 2367, 2793, 849, 853, 852, - /* 1200 */ 1984, 1986, 1987, 1988, 1989, 367, 43, 42, 41, 2427, - /* 1210 */ 1963, 1973, 1593, 2651, 490, 1932, 180, 434, 2651, 2568, - /* 1220 */ 1991, 1994, 2788, 1906, 1907, 2881, 2370, 1592, 2425, 315, - /* 1230 */ 796, 155, 1579, 2876, 2573, 1903, 1931, 1901, 170, 2685, - /* 1240 */ 2427, 2097, 2724, 678, 677, 2651, 119, 2687, 840, 2689, - /* 1250 */ 2690, 835, 2880, 855, 2686, 2184, 2877, 2878, 2896, 811, - /* 1260 */ 2778, 698, 697, 2156, 464, 2774, 2183, 837, 1927, 2810, - /* 1270 */ 686, 1906, 1907, 1960, 685, 1962, 1965, 1966, 1967, 1968, - /* 1280 */ 1969, 1970, 1971, 1972, 832, 853, 852, 1984, 1986, 1987, - /* 1290 */ 1988, 1989, 2, 47, 45, 2704, 290, 211, 608, 578, - /* 1300 */ 577, 468, 886, 1902, 2182, 2418, 784, 788, 2179, 680, - /* 1310 */ 679, 2651, 2651, 836, 2876, 179, 1990, 54, 1900, 2178, - /* 1320 */ 735, 921, 919, 2651, 493, 492, 2373, 2196, 947, 2177, - /* 1330 */ 2176, 2686, 783, 216, 1916, 792, 2175, 2877, 785, 2174, - /* 1340 */ 2173, 2172, 2011, 222, 837, 2171, 1985, 1990, 890, 1909, - /* 1350 */ 2344, 2418, 186, 2786, 2787, 78, 153, 2791, 1932, 2685, - /* 1360 */ 1908, 2651, 2724, 2595, 709, 2651, 119, 2687, 840, 2689, - /* 1370 */ 2690, 835, 2704, 855, 750, 2427, 2651, 1985, 2896, 721, - /* 1380 */ 2778, 2155, 2876, 161, 464, 2774, 2651, 2651, 2651, 952, - /* 1390 */ 836, 1908, 15, 2651, 2426, 286, 2651, 2651, 2651, 2686, - /* 1400 */ 2882, 216, 2651, 148, 891, 2877, 785, 2418, 89, 800, - /* 1410 */ 382, 712, 834, 2404, 506, 88, 2241, 1573, 706, 704, - /* 1420 */ 824, 276, 162, 162, 274, 283, 2472, 278, 1992, 1993, - /* 1430 */ 277, 2077, 280, 2839, 282, 279, 2685, 281, 703, 2724, - /* 1440 */ 2704, 691, 757, 119, 2687, 840, 2689, 2690, 835, 724, - /* 1450 */ 855, 723, 300, 2158, 2159, 2753, 2651, 2778, 836, 1574, - /* 1460 */ 116, 464, 2774, 750, 1932, 1569, 1963, 1973, 547, 113, - /* 1470 */ 72, 2876, 190, 71, 49, 49, 1991, 1994, 892, 172, - /* 1480 */ 171, 889, 888, 887, 169, 200, 170, 326, 2672, 2882, - /* 1490 */ 216, 1903, 77, 1901, 2877, 785, 1961, 14, 13, 1911, - /* 1500 */ 103, 1820, 1828, 307, 2685, 64, 1910, 2724, 2239, 49, - /* 1510 */ 2686, 404, 2687, 840, 2689, 2690, 835, 833, 855, 819, - /* 1520 */ 2743, 2101, 1917, 837, 1912, 49, 77, 1906, 1907, 1960, - /* 1530 */ 705, 1962, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, - /* 1540 */ 832, 853, 852, 1984, 1986, 1987, 1988, 1989, 2, 2686, - /* 1550 */ 2674, 2704, 167, 2111, 2110, 767, 170, 797, 1920, 1922, - /* 1560 */ 2230, 2228, 837, 901, 305, 801, 330, 2651, 150, 836, - /* 1570 */ 74, 808, 853, 852, 1984, 1986, 1987, 1988, 1989, 863, - /* 1580 */ 2686, 2705, 707, 710, 2027, 346, 345, 1544, 1974, 2296, - /* 1590 */ 2704, 789, 168, 837, 2295, 348, 347, 350, 349, 352, - /* 1600 */ 351, 354, 353, 170, 1773, 1763, 2651, 149, 836, 356, - /* 1610 */ 355, 358, 357, 360, 359, 2685, 2498, 2212, 2724, 2686, - /* 1620 */ 2829, 2704, 119, 2687, 840, 2689, 2690, 835, 1552, 855, - /* 1630 */ 1525, 342, 837, 167, 2751, 1620, 2778, 2651, 764, 836, - /* 1640 */ 464, 2774, 362, 361, 364, 363, 2686, 366, 365, 380, - /* 1650 */ 457, 771, 453, 902, 2685, 805, 497, 2724, 1651, 837, - /* 1660 */ 2704, 119, 2687, 840, 2689, 2690, 835, 2218, 855, 2499, - /* 1670 */ 1553, 1659, 1526, 821, 1914, 2778, 2651, 1542, 836, 464, - /* 1680 */ 2774, 1913, 1666, 2415, 743, 2685, 1664, 2704, 2724, 779, - /* 1690 */ 2830, 2840, 120, 2687, 840, 2689, 2690, 835, 780, 855, - /* 1700 */ 317, 2328, 312, 2651, 320, 836, 2778, 732, 5, 505, - /* 1710 */ 2777, 2774, 173, 500, 432, 513, 1935, 514, 525, 223, - /* 1720 */ 224, 524, 527, 226, 2685, 955, 1797, 2724, 374, 1925, - /* 1730 */ 541, 120, 2687, 840, 2689, 2690, 835, 1926, 855, 237, - /* 1740 */ 548, 373, 550, 554, 556, 2778, 597, 561, 584, 823, - /* 1750 */ 2774, 838, 573, 2491, 2724, 593, 586, 206, 120, 2687, - /* 1760 */ 840, 2689, 2690, 835, 596, 855, 943, 939, 935, 931, - /* 1770 */ 598, 370, 2778, 609, 610, 607, 427, 2774, 242, 243, - /* 1780 */ 612, 614, 615, 246, 617, 619, 1933, 634, 4, 635, - /* 1790 */ 643, 642, 1928, 645, 1934, 254, 94, 647, 257, 1936, - /* 1800 */ 260, 648, 649, 651, 262, 1937, 2514, 1938, 271, 660, - /* 1810 */ 681, 95, 96, 2686, 2508, 97, 118, 269, 2582, 343, - /* 1820 */ 728, 409, 124, 713, 191, 683, 837, 714, 376, 726, - /* 1830 */ 100, 163, 2686, 676, 672, 668, 664, 1929, 270, 2357, - /* 1840 */ 273, 2353, 275, 2560, 175, 837, 292, 121, 2355, 2350, - /* 1850 */ 176, 812, 177, 738, 2704, 739, 295, 737, 297, 745, - /* 1860 */ 768, 744, 2845, 2844, 8, 189, 806, 2817, 777, 2579, - /* 1870 */ 2651, 2578, 836, 2704, 308, 306, 309, 753, 742, 754, - /* 1880 */ 755, 752, 310, 99, 782, 313, 268, 781, 2797, 2651, - /* 1890 */ 458, 836, 154, 2686, 793, 341, 2899, 818, 790, 302, - /* 1900 */ 324, 304, 2875, 1930, 316, 323, 837, 2075, 2073, 1, - /* 1910 */ 311, 203, 377, 804, 2528, 322, 218, 164, 2685, 2527, - /* 1920 */ 2686, 2724, 2526, 462, 293, 187, 2687, 840, 2689, 2690, - /* 1930 */ 835, 378, 855, 837, 2704, 809, 810, 2685, 165, 814, - /* 1940 */ 2724, 61, 2794, 335, 120, 2687, 840, 2689, 2690, 835, - /* 1950 */ 2651, 855, 836, 256, 817, 2759, 842, 844, 2778, 846, - /* 1960 */ 847, 2704, 267, 2775, 379, 2643, 258, 265, 2642, 2638, - /* 1970 */ 2686, 2637, 263, 650, 340, 110, 112, 2651, 2629, 836, - /* 1980 */ 2628, 1446, 2620, 837, 786, 2897, 2619, 2635, 2634, 857, - /* 1990 */ 2626, 255, 2368, 383, 949, 946, 730, 369, 2685, 174, - /* 2000 */ 2686, 2724, 455, 951, 2625, 184, 2687, 840, 2689, 2690, - /* 2010 */ 835, 2704, 855, 837, 2614, 407, 2603, 2686, 387, 2613, - /* 2020 */ 424, 2632, 52, 2631, 385, 2685, 2602, 2651, 2724, 836, - /* 2030 */ 837, 395, 405, 2687, 840, 2689, 2690, 835, 2686, 855, - /* 2040 */ 2623, 2704, 2622, 2611, 2610, 2608, 2607, 406, 2419, 396, - /* 2050 */ 425, 834, 456, 2837, 2601, 83, 2596, 2651, 2704, 836, - /* 2060 */ 502, 503, 419, 507, 1853, 1854, 221, 2594, 509, 510, - /* 2070 */ 511, 1852, 2593, 433, 2651, 2685, 836, 2591, 2724, 2704, - /* 2080 */ 2686, 516, 405, 2687, 840, 2689, 2690, 835, 2590, 855, - /* 2090 */ 518, 2589, 520, 837, 2588, 2651, 522, 836, 1841, 2564, - /* 2100 */ 225, 2563, 1800, 227, 1799, 2685, 84, 2541, 2724, 2540, - /* 2110 */ 2539, 534, 398, 2687, 840, 2689, 2690, 835, 535, 855, - /* 2120 */ 2538, 2704, 2685, 2537, 2481, 2724, 2478, 2686, 539, 187, - /* 2130 */ 2687, 840, 2689, 2690, 835, 1736, 855, 2651, 2477, 836, - /* 2140 */ 837, 542, 2471, 2685, 546, 545, 2724, 2468, 2467, 230, - /* 2150 */ 404, 2687, 840, 2689, 2690, 835, 87, 855, 2466, 2744, - /* 2160 */ 2465, 2470, 467, 776, 232, 2469, 2464, 2463, 2704, 2461, - /* 2170 */ 2460, 2459, 234, 562, 2458, 564, 2456, 2455, 2454, 2453, - /* 2180 */ 2476, 2452, 2451, 2450, 2651, 2685, 836, 2474, 2724, 2898, - /* 2190 */ 2686, 2457, 405, 2687, 840, 2689, 2690, 835, 2449, 855, - /* 2200 */ 2448, 2447, 2445, 837, 2444, 2443, 2442, 2441, 2440, 469, - /* 2210 */ 2686, 236, 2439, 93, 2438, 2437, 2436, 2435, 2506, 2475, - /* 2220 */ 2473, 2434, 2433, 837, 600, 1742, 2432, 2431, 241, 2430, - /* 2230 */ 602, 2704, 2685, 2429, 2428, 2724, 421, 2261, 422, 405, - /* 2240 */ 2687, 840, 2689, 2690, 835, 1590, 855, 2651, 2260, 836, - /* 2250 */ 1594, 2704, 2259, 2258, 244, 245, 2256, 247, 2253, 248, - /* 2260 */ 2686, 621, 1586, 2252, 625, 2245, 2232, 2651, 620, 836, - /* 2270 */ 2207, 1470, 622, 837, 626, 624, 628, 632, 630, 198, - /* 2280 */ 2206, 2562, 2558, 80, 2548, 2536, 629, 250, 261, 2535, - /* 2290 */ 2512, 2505, 252, 2671, 208, 725, 640, 2686, 2724, 264, - /* 2300 */ 266, 2704, 400, 2687, 840, 2689, 2690, 835, 2345, 855, - /* 2310 */ 837, 81, 2255, 259, 2251, 2685, 661, 2651, 2724, 836, - /* 2320 */ 663, 2686, 390, 2687, 840, 2689, 2690, 835, 1518, 855, - /* 2330 */ 2249, 665, 2247, 669, 837, 667, 2244, 662, 2704, 666, - /* 2340 */ 2686, 671, 673, 670, 675, 2227, 674, 2225, 2226, 2224, - /* 2350 */ 2203, 2347, 1671, 837, 2651, 1670, 836, 2346, 1576, 1575, - /* 2360 */ 1572, 1570, 2704, 1568, 1567, 2685, 1566, 918, 2724, 2242, - /* 2370 */ 920, 272, 389, 2687, 840, 2689, 2690, 835, 2651, 855, - /* 2380 */ 836, 2704, 2686, 73, 1559, 446, 2240, 447, 2231, 1565, - /* 2390 */ 1564, 708, 1561, 1560, 448, 837, 1558, 2651, 2229, 836, - /* 2400 */ 449, 711, 2685, 2202, 2201, 2724, 2686, 2200, 715, 391, - /* 2410 */ 2687, 840, 2689, 2690, 835, 719, 855, 2199, 2198, 837, - /* 2420 */ 717, 126, 1835, 2704, 1837, 1839, 2685, 1834, 28, 2724, - /* 2430 */ 2561, 67, 1825, 397, 2687, 840, 2689, 2690, 835, 2651, - /* 2440 */ 855, 836, 1806, 294, 2557, 2685, 56, 2704, 2724, 57, - /* 2450 */ 1808, 2686, 401, 2687, 840, 2689, 2690, 835, 2547, 855, - /* 2460 */ 740, 298, 741, 2651, 837, 836, 2534, 2533, 20, 746, - /* 2470 */ 1785, 2881, 2686, 748, 1784, 6, 756, 30, 1810, 2128, - /* 2480 */ 178, 301, 729, 17, 454, 837, 2102, 2685, 758, 2686, - /* 2490 */ 2724, 760, 2704, 7, 392, 2687, 840, 2689, 2690, 835, - /* 2500 */ 188, 855, 837, 762, 303, 21, 22, 2109, 2651, 2096, - /* 2510 */ 836, 2685, 202, 2704, 2724, 32, 2068, 201, 402, 2687, - /* 2520 */ 840, 2689, 2690, 835, 31, 855, 213, 2672, 2066, 2651, - /* 2530 */ 2704, 836, 82, 214, 215, 2070, 2148, 65, 2149, 24, - /* 2540 */ 318, 2143, 2142, 2050, 459, 2147, 2651, 2146, 836, 460, - /* 2550 */ 59, 193, 2049, 2532, 2511, 105, 2685, 104, 807, 2724, - /* 2560 */ 325, 2104, 204, 393, 2687, 840, 2689, 2690, 835, 2686, - /* 2570 */ 855, 23, 331, 69, 2510, 18, 2504, 2685, 106, 58, - /* 2580 */ 2724, 813, 837, 107, 403, 2687, 840, 2689, 2690, 835, - /* 2590 */ 815, 855, 334, 333, 2685, 25, 2002, 2724, 336, 2001, - /* 2600 */ 2686, 394, 2687, 840, 2689, 2690, 835, 13, 855, 11, - /* 2610 */ 2704, 1918, 870, 837, 194, 205, 1953, 2503, 344, 2686, - /* 2620 */ 873, 2012, 839, 1977, 845, 876, 2651, 1976, 836, 879, - /* 2630 */ 38, 16, 837, 1975, 26, 108, 1945, 27, 70, 862, - /* 2640 */ 843, 2704, 338, 109, 2729, 113, 2728, 2164, 2163, 1979, - /* 2650 */ 2686, 854, 2162, 68, 1643, 2161, 1652, 2651, 485, 836, - /* 2660 */ 2704, 864, 867, 837, 856, 866, 869, 1649, 1648, 1645, - /* 2670 */ 872, 1639, 875, 1637, 2685, 878, 2651, 2724, 836, 1642, - /* 2680 */ 2686, 410, 2687, 840, 2689, 2690, 835, 368, 855, 114, - /* 2690 */ 1641, 2704, 1640, 837, 115, 1665, 79, 1661, 1555, 1554, - /* 2700 */ 1516, 1551, 1548, 893, 1547, 2685, 1546, 2651, 2724, 836, - /* 2710 */ 1545, 1543, 411, 2687, 840, 2689, 2690, 835, 1541, 855, - /* 2720 */ 1540, 2704, 1539, 1584, 2685, 906, 1583, 2724, 908, 219, - /* 2730 */ 2686, 2698, 2687, 840, 2689, 2690, 835, 2651, 855, 836, - /* 2740 */ 1537, 1536, 1535, 837, 1534, 1533, 1532, 1531, 1578, 1580, - /* 2750 */ 1528, 1527, 1524, 1523, 1522, 2685, 1521, 2686, 2724, 2250, - /* 2760 */ 928, 2248, 2697, 2687, 840, 2689, 2690, 835, 929, 855, - /* 2770 */ 837, 2704, 930, 932, 2246, 933, 934, 936, 937, 938, - /* 2780 */ 2243, 940, 941, 942, 2223, 2685, 944, 2651, 2724, 836, - /* 2790 */ 1459, 2686, 2696, 2687, 840, 2689, 2690, 835, 2704, 855, - /* 2800 */ 2197, 1447, 948, 372, 837, 1904, 950, 954, 384, 953, - /* 2810 */ 2167, 2167, 2167, 2167, 2651, 2167, 836, 2167, 2686, 2167, - /* 2820 */ 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, - /* 2830 */ 2167, 837, 2704, 2167, 2167, 2685, 2167, 2167, 2724, 2167, - /* 2840 */ 2167, 2686, 429, 2687, 840, 2689, 2690, 835, 2651, 855, - /* 2850 */ 836, 2167, 2167, 2167, 837, 2167, 2167, 2167, 2167, 2704, - /* 2860 */ 2167, 2167, 2685, 2167, 2167, 2724, 2167, 2167, 2167, 430, - /* 2870 */ 2687, 840, 2689, 2690, 835, 2651, 855, 836, 2167, 2686, - /* 2880 */ 2167, 2167, 2704, 2167, 2167, 2167, 2167, 2167, 2167, 2167, - /* 2890 */ 2167, 2167, 837, 2167, 2167, 2167, 2685, 2167, 2651, 2724, - /* 2900 */ 836, 2167, 2167, 426, 2687, 840, 2689, 2690, 835, 2167, - /* 2910 */ 855, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, - /* 2920 */ 2704, 2167, 2167, 2685, 2167, 2167, 2724, 2167, 2167, 2167, - /* 2930 */ 431, 2687, 840, 2689, 2690, 835, 2651, 855, 836, 2167, - /* 2940 */ 2167, 2167, 2167, 2167, 2167, 2167, 838, 2167, 2167, 2724, - /* 2950 */ 2167, 2167, 2167, 400, 2687, 840, 2689, 2690, 835, 2167, - /* 2960 */ 855, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, - /* 2970 */ 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, - /* 2980 */ 2167, 2167, 2167, 2167, 2685, 2167, 2167, 2724, 2167, 2167, - /* 2990 */ 2167, 399, 2687, 840, 2689, 2690, 835, 2167, 855, + /* 0 */ 37, 337, 2535, 2701, 637, 540, 2370, 638, 2222, 190, + /* 10 */ 2676, 314, 47, 45, 2092, 2808, 801, 463, 493, 492, + /* 20 */ 468, 2180, 1913, 2532, 843, 40, 39, 2701, 66, 46, + /* 30 */ 44, 43, 42, 41, 1938, 2001, 1938, 1911, 2680, 2477, + /* 40 */ 836, 2805, 136, 1920, 2719, 135, 134, 133, 132, 131, + /* 50 */ 130, 129, 128, 127, 602, 600, 829, 408, 852, 371, + /* 60 */ 2666, 229, 838, 2365, 416, 33, 1996, 828, 2719, 798, + /* 70 */ 155, 40, 39, 19, 300, 46, 44, 43, 42, 41, + /* 80 */ 1919, 2266, 798, 155, 2666, 209, 838, 722, 136, 2682, + /* 90 */ 2685, 135, 134, 133, 132, 131, 130, 129, 128, 127, + /* 100 */ 857, 2428, 720, 251, 718, 285, 284, 640, 2700, 2230, + /* 110 */ 957, 2739, 2808, 15, 1939, 119, 2702, 842, 2704, 2705, + /* 120 */ 837, 645, 857, 103, 638, 2222, 197, 199, 852, 2793, + /* 130 */ 642, 2136, 2700, 464, 2789, 2739, 639, 62, 2804, 404, + /* 140 */ 2702, 842, 2704, 2705, 837, 835, 857, 821, 2758, 2003, + /* 150 */ 2004, 50, 436, 217, 2508, 751, 930, 929, 928, 927, + /* 160 */ 496, 2840, 926, 925, 160, 920, 919, 918, 917, 916, + /* 170 */ 915, 914, 159, 908, 907, 906, 495, 494, 903, 902, + /* 180 */ 901, 196, 195, 900, 491, 899, 898, 897, 1974, 1984, + /* 190 */ 800, 185, 2801, 2802, 776, 153, 2806, 289, 2002, 2005, + /* 200 */ 798, 155, 1760, 1761, 192, 2801, 797, 577, 147, 796, + /* 210 */ 786, 2659, 576, 1914, 484, 1912, 2891, 9, 2891, 2096, + /* 220 */ 575, 1923, 40, 39, 735, 1938, 46, 44, 43, 42, + /* 230 */ 41, 2357, 2701, 2202, 785, 216, 785, 216, 122, 2892, + /* 240 */ 787, 2892, 787, 1687, 1688, 839, 2385, 486, 2383, 1917, + /* 250 */ 1918, 1971, 775, 1973, 1976, 1977, 1978, 1979, 1980, 1981, + /* 260 */ 1982, 1983, 834, 855, 854, 1995, 1997, 1998, 1999, 2000, + /* 270 */ 2, 47, 45, 2719, 913, 473, 413, 2341, 1936, 468, + /* 280 */ 2719, 1913, 1841, 1842, 2896, 584, 857, 428, 605, 2666, + /* 290 */ 2666, 838, 2891, 604, 2001, 60, 1911, 40, 39, 452, + /* 300 */ 2582, 46, 44, 43, 42, 41, 749, 2011, 732, 1942, + /* 310 */ 563, 2895, 606, 1938, 197, 2892, 2894, 414, 565, 1496, + /* 320 */ 321, 1495, 125, 2801, 2802, 1996, 153, 2806, 180, 543, + /* 330 */ 853, 2381, 19, 660, 321, 2030, 151, 2700, 2384, 1919, + /* 340 */ 2739, 2067, 2509, 771, 119, 2702, 842, 2704, 2705, 837, + /* 350 */ 220, 857, 1469, 774, 157, 1497, 166, 2764, 2793, 2179, + /* 360 */ 40, 39, 464, 2789, 46, 44, 43, 42, 41, 957, + /* 370 */ 437, 1476, 15, 894, 172, 171, 891, 890, 889, 169, + /* 380 */ 1942, 551, 1938, 145, 144, 143, 142, 141, 140, 139, + /* 390 */ 138, 137, 653, 1975, 1471, 1474, 1475, 533, 62, 40, + /* 400 */ 39, 2031, 532, 46, 44, 43, 42, 41, 2003, 2004, + /* 410 */ 657, 2515, 2494, 656, 592, 591, 590, 589, 588, 583, + /* 420 */ 582, 581, 580, 420, 29, 1971, 2067, 570, 569, 568, + /* 430 */ 567, 566, 560, 559, 558, 253, 553, 552, 435, 640, + /* 440 */ 852, 2230, 544, 1748, 1749, 328, 329, 1974, 1984, 1767, + /* 450 */ 327, 752, 777, 772, 765, 761, 1972, 2002, 2005, 2891, + /* 460 */ 2813, 2064, 2065, 2066, 2813, 2813, 2813, 2813, 2813, 2522, + /* 470 */ 2372, 658, 1914, 517, 1912, 62, 896, 2897, 216, 212, + /* 480 */ 736, 1975, 2892, 787, 853, 2381, 853, 2381, 36, 466, + /* 490 */ 2025, 2026, 2027, 2028, 2029, 2033, 2034, 2035, 2036, 2069, + /* 500 */ 2070, 2071, 2072, 2073, 146, 2137, 55, 375, 1917, 1918, + /* 510 */ 1971, 683, 1973, 1976, 1977, 1978, 1979, 1980, 1981, 1982, + /* 520 */ 1983, 834, 855, 854, 1995, 1997, 1998, 1999, 2000, 2, + /* 530 */ 12, 47, 45, 50, 473, 1922, 2701, 2535, 181, 468, + /* 540 */ 1943, 1913, 116, 388, 1972, 857, 2064, 2065, 2066, 801, + /* 550 */ 207, 113, 470, 596, 2001, 1587, 1911, 2167, 2532, 843, + /* 560 */ 386, 76, 647, 2574, 75, 2701, 40, 39, 451, 2582, + /* 570 */ 46, 44, 43, 42, 41, 415, 733, 2719, 839, 2067, + /* 580 */ 2232, 321, 1939, 1919, 2676, 1996, 2896, 249, 619, 617, + /* 590 */ 614, 612, 19, 2666, 2891, 838, 40, 39, 1589, 1919, + /* 600 */ 46, 44, 43, 42, 41, 2487, 2719, 704, 703, 702, + /* 610 */ 521, 1943, 2680, 2895, 694, 152, 698, 2892, 2893, 240, + /* 620 */ 697, 2535, 2666, 654, 838, 696, 701, 445, 444, 957, + /* 630 */ 910, 695, 15, 62, 98, 443, 691, 690, 689, 523, + /* 640 */ 519, 2700, 2533, 843, 2739, 595, 239, 547, 119, 2702, + /* 650 */ 842, 2704, 2705, 837, 793, 857, 853, 2381, 321, 593, + /* 660 */ 199, 2377, 2793, 2682, 2684, 465, 464, 2789, 2003, 2004, + /* 670 */ 2700, 63, 2108, 2739, 857, 2166, 146, 119, 2702, 842, + /* 680 */ 2704, 2705, 837, 688, 857, 12, 2125, 655, 2528, 2911, + /* 690 */ 183, 2793, 2191, 51, 2841, 464, 2789, 912, 2813, 2064, + /* 700 */ 2065, 2066, 2813, 2813, 2813, 2813, 2813, 1974, 1984, 35, + /* 710 */ 1941, 1787, 1788, 1925, 2177, 40, 39, 2002, 2005, 46, + /* 720 */ 44, 43, 42, 41, 2355, 86, 85, 536, 2435, 2436, + /* 730 */ 228, 2089, 1914, 2441, 1912, 46, 44, 43, 42, 41, + /* 740 */ 98, 434, 2619, 528, 526, 768, 767, 2123, 2124, 2126, + /* 750 */ 2127, 2128, 2439, 12, 288, 10, 412, 438, 287, 515, + /* 760 */ 1786, 1789, 512, 508, 504, 501, 529, 2376, 1917, 1918, + /* 770 */ 1971, 1582, 1973, 1976, 1977, 1978, 1979, 1980, 1981, 1982, + /* 780 */ 1983, 834, 855, 854, 1995, 1997, 1998, 1999, 2000, 2, + /* 790 */ 47, 45, 2006, 1496, 2701, 1495, 752, 479, 468, 235, + /* 800 */ 1913, 499, 180, 863, 2891, 887, 498, 839, 2896, 2848, + /* 810 */ 2660, 486, 2383, 2001, 1583, 1911, 321, 488, 2701, 78, + /* 820 */ 2434, 2436, 2897, 216, 1599, 1941, 2808, 2892, 787, 1497, + /* 830 */ 786, 839, 101, 2861, 634, 2719, 1938, 423, 2891, 1598, + /* 840 */ 450, 2441, 724, 632, 1996, 92, 628, 624, 91, 461, + /* 850 */ 210, 2666, 2803, 838, 827, 752, 785, 216, 1919, 2719, + /* 860 */ 2439, 2892, 787, 2891, 853, 2381, 894, 172, 171, 891, + /* 870 */ 890, 889, 169, 89, 473, 2666, 321, 838, 442, 441, + /* 880 */ 319, 2897, 216, 482, 537, 857, 2892, 787, 957, 2460, + /* 890 */ 2368, 48, 894, 172, 171, 891, 890, 889, 169, 2700, + /* 900 */ 1499, 1500, 2739, 3, 2701, 736, 119, 2702, 842, 2704, + /* 910 */ 2705, 837, 607, 857, 1913, 53, 90, 839, 2911, 2160, + /* 920 */ 2793, 853, 2381, 2700, 464, 2789, 2739, 2003, 2004, 1911, + /* 930 */ 119, 2702, 842, 2704, 2705, 837, 822, 857, 2765, 549, + /* 940 */ 2504, 538, 2911, 794, 2793, 2719, 555, 2504, 464, 2789, + /* 950 */ 471, 862, 861, 860, 853, 2381, 440, 439, 179, 685, + /* 960 */ 2441, 2666, 824, 838, 2765, 2701, 1974, 1984, 472, 2386, + /* 970 */ 853, 2381, 1919, 1476, 659, 1882, 2002, 2005, 839, 2439, + /* 980 */ 763, 687, 2363, 853, 2381, 686, 2441, 738, 2574, 296, + /* 990 */ 557, 1914, 231, 1912, 487, 319, 2117, 1474, 1475, 233, + /* 1000 */ 586, 2504, 957, 571, 1975, 2439, 2719, 478, 477, 2700, + /* 1010 */ 62, 2118, 2739, 1942, 679, 678, 187, 2702, 842, 2704, + /* 1020 */ 2705, 837, 2666, 857, 838, 2088, 2201, 1917, 1918, 1971, + /* 1030 */ 2022, 1973, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, + /* 1040 */ 834, 855, 854, 1995, 1997, 1998, 1999, 2000, 2, 47, + /* 1050 */ 45, 2701, 489, 238, 2116, 579, 578, 468, 381, 1913, + /* 1060 */ 179, 1881, 681, 680, 839, 102, 2884, 1972, 853, 2381, + /* 1070 */ 2700, 2386, 2001, 2739, 1911, 788, 2912, 119, 2702, 842, + /* 1080 */ 2704, 2705, 837, 2666, 857, 700, 699, 2701, 572, 2911, + /* 1090 */ 182, 2793, 2719, 481, 480, 464, 2789, 1603, 2315, 1815, + /* 1100 */ 839, 2200, 2825, 1996, 1648, 1914, 2385, 1912, 2666, 531, + /* 1110 */ 838, 530, 1602, 111, 14, 13, 2199, 1919, 1639, 886, + /* 1120 */ 885, 884, 1643, 883, 1645, 1646, 882, 879, 2719, 1654, + /* 1130 */ 876, 1656, 1657, 873, 870, 867, 2192, 853, 2381, 2374, + /* 1140 */ 2316, 1917, 1918, 529, 2666, 117, 838, 957, 2701, 2895, + /* 1150 */ 48, 2032, 853, 2381, 853, 2381, 2700, 573, 2666, 2739, + /* 1160 */ 2356, 839, 158, 119, 2702, 842, 2704, 2705, 837, 375, + /* 1170 */ 857, 2373, 2378, 2666, 291, 2911, 2198, 2793, 853, 2381, + /* 1180 */ 190, 464, 2789, 211, 148, 609, 2003, 2004, 1478, 2719, + /* 1190 */ 853, 2381, 2700, 321, 1937, 2739, 88, 2197, 299, 119, + /* 1200 */ 2702, 842, 2704, 2705, 837, 2666, 857, 838, 853, 2381, + /* 1210 */ 804, 2911, 2196, 2793, 493, 492, 2195, 464, 2789, 2194, + /* 1220 */ 853, 2381, 853, 2381, 1927, 1974, 1984, 2044, 332, 853, + /* 1230 */ 2381, 2583, 896, 2666, 2854, 2002, 2005, 2001, 34, 1920, + /* 1240 */ 818, 1942, 339, 1938, 1943, 43, 42, 41, 2037, 850, + /* 1250 */ 1914, 2588, 1912, 2700, 2666, 2607, 2739, 853, 2381, 769, + /* 1260 */ 119, 2702, 842, 2704, 2705, 837, 2193, 857, 1996, 2666, + /* 1270 */ 924, 922, 2768, 2666, 2793, 2190, 2666, 851, 464, 2789, + /* 1280 */ 156, 687, 1919, 2764, 2189, 686, 1917, 1918, 1971, 2269, + /* 1290 */ 1973, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 834, + /* 1300 */ 855, 854, 1995, 1997, 1998, 1999, 2000, 2, 47, 45, + /* 1310 */ 2188, 2701, 826, 290, 853, 2381, 468, 2187, 1913, 853, + /* 1320 */ 2381, 2186, 2185, 2666, 839, 307, 179, 2620, 1648, 780, + /* 1330 */ 2184, 2001, 2666, 1911, 367, 888, 2358, 2387, 2432, 490, + /* 1340 */ 2183, 2666, 1639, 886, 885, 884, 1643, 883, 1645, 1646, + /* 1350 */ 833, 832, 2719, 1654, 831, 1656, 1657, 830, 870, 867, + /* 1360 */ 892, 2182, 1996, 2432, 704, 703, 702, 2666, 2666, 161, + /* 1370 */ 838, 694, 152, 698, 2666, 170, 1919, 697, 2666, 2666, + /* 1380 */ 2441, 752, 696, 701, 445, 444, 2441, 2666, 695, 2891, + /* 1390 */ 790, 2441, 443, 691, 690, 689, 2078, 2666, 2610, 805, + /* 1400 */ 893, 798, 155, 2432, 1560, 813, 957, 2897, 216, 15, + /* 1410 */ 2440, 382, 2892, 787, 2418, 1928, 2700, 1923, 2666, 2739, + /* 1420 */ 2207, 952, 2253, 119, 2702, 842, 2704, 2705, 837, 276, + /* 1430 */ 857, 278, 274, 280, 277, 2766, 279, 2793, 418, 417, + /* 1440 */ 282, 464, 2789, 281, 705, 2003, 2004, 1561, 474, 692, + /* 1450 */ 506, 1931, 1933, 726, 693, 725, 54, 2251, 2242, 2240, + /* 1460 */ 271, 2001, 2701, 483, 789, 855, 854, 1995, 1997, 1998, + /* 1470 */ 1999, 2000, 1943, 1580, 1972, 839, 1921, 191, 1578, 707, + /* 1480 */ 709, 712, 2169, 2170, 1974, 1984, 677, 673, 669, 665, + /* 1490 */ 1533, 270, 1996, 315, 2002, 2005, 222, 799, 346, 345, + /* 1500 */ 40, 39, 162, 2719, 46, 44, 43, 42, 41, 1914, + /* 1510 */ 150, 1912, 348, 347, 162, 759, 170, 326, 49, 2666, + /* 1520 */ 49, 838, 2720, 186, 2801, 2802, 2308, 153, 2806, 200, + /* 1530 */ 77, 14, 13, 1534, 64, 49, 2307, 99, 2687, 2513, + /* 1540 */ 268, 2844, 49, 77, 2223, 1917, 1918, 1971, 766, 1973, + /* 1550 */ 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 834, 855, + /* 1560 */ 854, 1995, 1997, 1998, 1999, 2000, 2, 2700, 167, 734, + /* 1570 */ 2739, 170, 350, 349, 119, 2702, 842, 2704, 2705, 837, + /* 1580 */ 74, 857, 729, 1831, 352, 351, 823, 960, 2793, 354, + /* 1590 */ 353, 865, 464, 2789, 2701, 1839, 2112, 803, 330, 2122, + /* 1600 */ 168, 2121, 2689, 373, 170, 356, 355, 839, 256, 904, + /* 1610 */ 305, 810, 358, 357, 457, 2038, 1985, 267, 773, 950, + /* 1620 */ 206, 258, 265, 1784, 1774, 360, 359, 263, 651, 946, + /* 1630 */ 942, 938, 934, 1552, 370, 2719, 752, 362, 361, 1904, + /* 1640 */ 149, 1880, 364, 363, 2891, 167, 255, 366, 365, 342, + /* 1650 */ 453, 2666, 1630, 838, 1924, 905, 807, 497, 2514, 2229, + /* 1660 */ 2429, 380, 2897, 216, 745, 2845, 2855, 2892, 787, 2234, + /* 1670 */ 317, 2701, 1661, 476, 475, 1905, 781, 791, 312, 1550, + /* 1680 */ 118, 1669, 123, 343, 839, 1676, 782, 2342, 711, 855, + /* 1690 */ 854, 1995, 1997, 1998, 1999, 2000, 320, 500, 5, 2700, + /* 1700 */ 505, 513, 2739, 723, 2701, 432, 120, 2702, 842, 2704, + /* 1710 */ 2705, 837, 2719, 857, 514, 814, 1946, 839, 525, 286, + /* 1720 */ 2793, 1674, 948, 524, 2792, 2789, 173, 223, 2666, 224, + /* 1730 */ 838, 527, 226, 1808, 2701, 374, 714, 1936, 541, 1937, + /* 1740 */ 548, 554, 237, 708, 706, 2719, 550, 839, 556, 598, + /* 1750 */ 283, 2701, 561, 574, 587, 610, 585, 611, 608, 2506, + /* 1760 */ 341, 2666, 820, 838, 839, 324, 243, 613, 594, 597, + /* 1770 */ 323, 615, 599, 242, 246, 2719, 2700, 618, 620, 2739, + /* 1780 */ 616, 635, 1944, 120, 2702, 842, 2704, 2705, 837, 293, + /* 1790 */ 857, 2666, 2719, 838, 4, 636, 72, 2793, 643, 71, + /* 1800 */ 644, 825, 2789, 646, 254, 94, 1939, 648, 2666, 840, + /* 1810 */ 838, 257, 2739, 1945, 649, 1947, 120, 2702, 842, 2704, + /* 1820 */ 2705, 837, 652, 857, 650, 1948, 737, 260, 2701, 802, + /* 1830 */ 2793, 262, 95, 2529, 427, 2789, 1949, 96, 2523, 2700, + /* 1840 */ 97, 839, 2739, 661, 269, 2701, 184, 2702, 842, 2704, + /* 1850 */ 2705, 837, 682, 857, 684, 2371, 2700, 715, 839, 2739, + /* 1860 */ 716, 409, 273, 120, 2702, 842, 2704, 2705, 837, 2719, + /* 1870 */ 857, 2367, 728, 730, 275, 175, 121, 2793, 100, 124, + /* 1880 */ 752, 2369, 2790, 752, 2364, 2666, 2719, 838, 2891, 292, + /* 1890 */ 176, 2891, 177, 753, 2851, 163, 2597, 1940, 2594, 2593, + /* 1900 */ 740, 739, 2666, 376, 838, 741, 2897, 216, 747, 2897, + /* 1910 */ 216, 2892, 787, 297, 2892, 787, 295, 2575, 744, 8, + /* 1920 */ 2832, 770, 2860, 808, 302, 2701, 756, 455, 2859, 746, + /* 1930 */ 304, 779, 757, 2700, 189, 306, 2739, 755, 839, 309, + /* 1940 */ 184, 2702, 842, 2704, 2705, 837, 754, 857, 308, 310, + /* 1950 */ 2700, 784, 783, 2739, 2701, 458, 2914, 405, 2702, 842, + /* 1960 */ 2704, 2705, 837, 311, 857, 154, 2719, 839, 795, 2812, + /* 1970 */ 313, 2890, 792, 1941, 2086, 1, 316, 2084, 203, 322, + /* 1980 */ 164, 377, 2666, 378, 838, 2809, 806, 2543, 2852, 2542, + /* 1990 */ 2541, 462, 811, 812, 819, 2719, 165, 218, 61, 816, + /* 2000 */ 335, 846, 2774, 844, 340, 379, 849, 456, 848, 110, + /* 2010 */ 2382, 2666, 2658, 838, 2657, 2701, 2653, 112, 369, 2652, + /* 2020 */ 2644, 1453, 2643, 2635, 2634, 383, 2650, 2649, 839, 951, + /* 2030 */ 2700, 2641, 954, 2739, 956, 2640, 52, 405, 2702, 842, + /* 2040 */ 2704, 2705, 837, 387, 857, 2629, 2628, 174, 859, 732, + /* 2050 */ 407, 2701, 2647, 385, 419, 2646, 2719, 395, 2638, 2700, + /* 2060 */ 2637, 424, 2739, 2626, 836, 2625, 398, 2702, 842, 2704, + /* 2070 */ 2705, 837, 2666, 857, 838, 2623, 2622, 2433, 406, 396, + /* 2080 */ 2618, 2617, 2616, 83, 425, 2611, 502, 503, 1864, 1865, + /* 2090 */ 221, 2609, 2719, 507, 509, 510, 511, 1863, 2608, 433, + /* 2100 */ 2606, 516, 2605, 518, 2604, 520, 2603, 522, 2666, 1852, + /* 2110 */ 838, 225, 2578, 227, 1811, 84, 1810, 778, 2579, 2556, + /* 2120 */ 2700, 2555, 2554, 2739, 534, 535, 2553, 187, 2702, 842, + /* 2130 */ 2704, 2705, 837, 2552, 857, 2496, 539, 1747, 2493, 2492, + /* 2140 */ 2701, 2486, 542, 2483, 545, 546, 230, 2482, 87, 2481, + /* 2150 */ 2480, 2485, 2484, 839, 562, 234, 2700, 232, 2479, 2739, + /* 2160 */ 2478, 2476, 2475, 404, 2702, 842, 2704, 2705, 837, 2701, + /* 2170 */ 857, 2474, 2759, 2473, 564, 2471, 2470, 2469, 2468, 2467, + /* 2180 */ 2491, 2719, 839, 2466, 2465, 2464, 2489, 2913, 2472, 2463, + /* 2190 */ 2701, 236, 2453, 93, 2452, 2451, 2450, 2666, 2462, 838, + /* 2200 */ 2461, 2459, 2458, 839, 2457, 2456, 2455, 2454, 2449, 2521, + /* 2210 */ 2719, 2490, 2488, 2448, 2447, 1753, 2446, 241, 2445, 2701, + /* 2220 */ 601, 2444, 467, 603, 2443, 2442, 2666, 2273, 838, 244, + /* 2230 */ 2272, 2719, 839, 245, 1596, 2271, 247, 1600, 2270, 1604, + /* 2240 */ 421, 2268, 2265, 2264, 2257, 2700, 2244, 2666, 2739, 838, + /* 2250 */ 2218, 469, 405, 2702, 842, 2704, 2705, 837, 2217, 857, + /* 2260 */ 2719, 1526, 622, 621, 623, 248, 625, 1477, 629, 422, + /* 2270 */ 627, 633, 626, 198, 2700, 630, 2666, 2739, 838, 631, + /* 2280 */ 2577, 405, 2702, 842, 2704, 2705, 837, 2573, 857, 80, + /* 2290 */ 250, 2563, 252, 2551, 261, 727, 81, 2686, 2739, 259, + /* 2300 */ 208, 2550, 400, 2702, 842, 2704, 2705, 837, 264, 857, + /* 2310 */ 641, 2527, 266, 2701, 2520, 2359, 2267, 2263, 662, 663, + /* 2320 */ 664, 2261, 666, 667, 2700, 668, 839, 2739, 2259, 670, + /* 2330 */ 2701, 390, 2702, 842, 2704, 2705, 837, 672, 857, 2256, + /* 2340 */ 671, 674, 675, 839, 676, 2239, 2237, 2701, 2238, 2236, + /* 2350 */ 2214, 2361, 272, 73, 2719, 1681, 1680, 2360, 2254, 1586, + /* 2360 */ 839, 1585, 1584, 1581, 1579, 2252, 1577, 1576, 1575, 1574, + /* 2370 */ 2666, 2719, 838, 921, 923, 1573, 1568, 446, 447, 1570, + /* 2380 */ 1569, 1567, 2243, 2241, 448, 449, 2213, 2666, 2719, 838, + /* 2390 */ 713, 2212, 2211, 2210, 2209, 721, 717, 719, 126, 2576, + /* 2400 */ 1850, 710, 28, 1846, 2666, 1848, 838, 1845, 1836, 67, + /* 2410 */ 2701, 2572, 1817, 294, 2562, 2549, 2548, 1819, 2700, 178, + /* 2420 */ 742, 2739, 2896, 839, 17, 389, 2702, 842, 2704, 2705, + /* 2430 */ 837, 6, 857, 20, 2139, 2700, 30, 7, 2739, 748, + /* 2440 */ 758, 454, 391, 2702, 842, 2704, 2705, 837, 301, 857, + /* 2450 */ 56, 2719, 2700, 21, 57, 2739, 1821, 22, 743, 397, + /* 2460 */ 2702, 842, 2704, 2705, 837, 298, 857, 2666, 202, 838, + /* 2470 */ 750, 32, 1796, 23, 1795, 213, 2687, 2079, 214, 2081, + /* 2480 */ 731, 2113, 760, 762, 188, 764, 65, 24, 303, 2154, + /* 2490 */ 2701, 2120, 201, 31, 2153, 459, 2158, 2157, 2107, 2077, + /* 2500 */ 460, 82, 215, 839, 2159, 318, 59, 2701, 2547, 2526, + /* 2510 */ 2160, 193, 105, 2525, 104, 2700, 2061, 106, 2739, 2060, + /* 2520 */ 839, 325, 401, 2702, 842, 2704, 2705, 837, 2519, 857, + /* 2530 */ 204, 2719, 2115, 2701, 331, 107, 69, 13, 25, 815, + /* 2540 */ 2013, 334, 2012, 1929, 11, 809, 839, 2666, 2719, 838, + /* 2550 */ 58, 1988, 2023, 1987, 872, 194, 205, 18, 1986, 875, + /* 2560 */ 878, 881, 38, 16, 2666, 1956, 838, 1964, 26, 2518, + /* 2570 */ 2701, 841, 108, 344, 2719, 845, 858, 27, 70, 338, + /* 2580 */ 109, 2744, 2175, 839, 2743, 2174, 1990, 856, 2173, 68, + /* 2590 */ 2666, 113, 838, 1662, 864, 2700, 485, 866, 2739, 817, + /* 2600 */ 336, 1659, 392, 2702, 842, 2704, 2705, 837, 868, 857, + /* 2610 */ 333, 2719, 2700, 869, 871, 2739, 1658, 1655, 874, 402, + /* 2620 */ 2702, 842, 2704, 2705, 837, 847, 857, 2666, 1649, 838, + /* 2630 */ 877, 2701, 1647, 880, 368, 2172, 1675, 1671, 2700, 114, + /* 2640 */ 115, 2739, 79, 895, 839, 393, 2702, 842, 2704, 2705, + /* 2650 */ 837, 1653, 857, 1652, 2701, 1564, 1651, 1650, 1563, 1524, + /* 2660 */ 1562, 1559, 1556, 1555, 1554, 1553, 1551, 839, 1549, 1548, + /* 2670 */ 1594, 1547, 2719, 219, 909, 2700, 1545, 1593, 2739, 911, + /* 2680 */ 1544, 1543, 403, 2702, 842, 2704, 2705, 837, 2666, 857, + /* 2690 */ 838, 1542, 1541, 1540, 1539, 2719, 1590, 1588, 1536, 1535, + /* 2700 */ 1532, 1531, 1530, 1529, 2262, 931, 932, 933, 2260, 935, + /* 2710 */ 936, 2666, 937, 838, 939, 2701, 2258, 941, 2255, 940, + /* 2720 */ 943, 945, 2235, 944, 947, 2233, 1466, 949, 839, 1454, + /* 2730 */ 953, 372, 955, 2178, 1915, 384, 2700, 2208, 958, 2739, + /* 2740 */ 2701, 959, 2178, 394, 2702, 842, 2704, 2705, 837, 2178, + /* 2750 */ 857, 2178, 2178, 839, 2178, 2178, 2719, 2178, 2178, 2700, + /* 2760 */ 2178, 2178, 2739, 2178, 2178, 2178, 410, 2702, 842, 2704, + /* 2770 */ 2705, 837, 2666, 857, 838, 2178, 2178, 2178, 2178, 2178, + /* 2780 */ 2178, 2719, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 2790 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2666, 2178, 838, + /* 2800 */ 2178, 2701, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 2810 */ 2178, 2178, 2178, 2178, 839, 2178, 2178, 2178, 2178, 2178, + /* 2820 */ 2700, 2178, 2701, 2739, 2178, 2178, 2178, 411, 2702, 842, + /* 2830 */ 2704, 2705, 837, 2178, 857, 839, 2178, 2178, 2178, 2178, + /* 2840 */ 2178, 2178, 2719, 2178, 2178, 2700, 2178, 2178, 2739, 2178, + /* 2850 */ 2178, 2178, 2713, 2702, 842, 2704, 2705, 837, 2666, 857, + /* 2860 */ 838, 2178, 2178, 2719, 2178, 2178, 2178, 2178, 2178, 2178, + /* 2870 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2666, + /* 2880 */ 2178, 838, 2178, 2701, 2178, 2178, 2178, 2178, 2178, 2178, + /* 2890 */ 2178, 2178, 2178, 2178, 2178, 2178, 839, 2178, 2178, 2178, + /* 2900 */ 2178, 2178, 2178, 2178, 2178, 2178, 2700, 2178, 2178, 2739, + /* 2910 */ 2178, 2178, 2178, 2712, 2702, 842, 2704, 2705, 837, 2178, + /* 2920 */ 857, 2178, 2178, 2178, 2719, 2178, 2178, 2700, 2178, 2178, + /* 2930 */ 2739, 2178, 2178, 2178, 2711, 2702, 842, 2704, 2705, 837, + /* 2940 */ 2666, 857, 838, 2178, 2701, 2178, 2178, 2178, 2178, 2178, + /* 2950 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 839, 2178, 2178, + /* 2960 */ 2178, 2178, 2178, 2701, 2178, 2178, 2178, 2178, 2178, 2178, + /* 2970 */ 2178, 2178, 2178, 2178, 2178, 2178, 839, 2178, 2178, 2178, + /* 2980 */ 2178, 2178, 2178, 2178, 2178, 2719, 2178, 2178, 2700, 2178, + /* 2990 */ 2178, 2739, 2178, 2178, 2178, 429, 2702, 842, 2704, 2705, + /* 3000 */ 837, 2666, 857, 838, 2719, 2178, 2178, 2178, 2178, 2178, + /* 3010 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3020 */ 2666, 2178, 838, 2178, 2701, 2178, 2178, 2178, 2178, 2178, + /* 3030 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 839, 2178, 2178, + /* 3040 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2700, + /* 3050 */ 2178, 2178, 2739, 2178, 2178, 2178, 430, 2702, 842, 2704, + /* 3060 */ 2705, 837, 2178, 857, 2178, 2719, 2178, 2178, 2700, 2178, + /* 3070 */ 2178, 2739, 2178, 2178, 2178, 426, 2702, 842, 2704, 2705, + /* 3080 */ 837, 2666, 857, 838, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3090 */ 2178, 2178, 2178, 2701, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3100 */ 2178, 2178, 2178, 2178, 2178, 2178, 839, 2178, 2701, 2178, + /* 3110 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3120 */ 2178, 839, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2700, + /* 3130 */ 2178, 2178, 2739, 2178, 2719, 2178, 431, 2702, 842, 2704, + /* 3140 */ 2705, 837, 2178, 857, 2178, 2178, 2178, 2178, 2178, 2719, + /* 3150 */ 2666, 2178, 838, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3160 */ 2178, 2178, 2178, 2178, 2178, 2666, 2178, 838, 2178, 2178, + /* 3170 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3180 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, + /* 3190 */ 2178, 2178, 2178, 2178, 2178, 2178, 2178, 2178, 840, 2178, + /* 3200 */ 2178, 2739, 2178, 2178, 2178, 400, 2702, 842, 2704, 2705, + /* 3210 */ 837, 2178, 857, 2700, 2178, 2178, 2739, 2178, 2178, 2178, + /* 3220 */ 399, 2702, 842, 2704, 2705, 837, 2178, 857, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 417, 384, 503, 504, 460, 388, 417, 390, 425, 465, - /* 10 */ 398, 435, 12, 13, 14, 426, 427, 2, 406, 436, - /* 20 */ 20, 0, 22, 8, 9, 20, 450, 12, 13, 14, - /* 30 */ 15, 16, 456, 457, 20, 35, 383, 37, 0, 386, - /* 40 */ 387, 376, 21, 418, 419, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 389, 8, 9, 416, 514, 12, - /* 60 */ 13, 14, 15, 16, 2, 65, 522, 478, 479, 20, - /* 70 */ 8, 9, 72, 432, 12, 13, 14, 15, 16, 79, - /* 80 */ 33, 435, 417, 383, 540, 541, 386, 387, 420, 545, - /* 90 */ 546, 423, 388, 389, 388, 389, 450, 51, 433, 20, - /* 100 */ 435, 404, 456, 457, 407, 20, 60, 460, 108, 63, - /* 110 */ 64, 111, 74, 75, 76, 77, 78, 3, 80, 81, - /* 120 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - /* 130 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - /* 140 */ 102, 103, 104, 376, 14, 441, 481, 147, 148, 484, - /* 150 */ 20, 22, 484, 488, 489, 490, 491, 492, 493, 112, - /* 160 */ 495, 514, 70, 495, 4, 500, 37, 502, 487, 522, - /* 170 */ 21, 506, 507, 24, 25, 26, 27, 28, 29, 30, - /* 180 */ 31, 32, 516, 417, 518, 185, 186, 540, 541, 388, - /* 190 */ 111, 526, 545, 546, 513, 195, 196, 8, 9, 534, - /* 200 */ 433, 12, 13, 14, 15, 16, 74, 75, 76, 443, - /* 210 */ 210, 445, 212, 81, 82, 83, 510, 511, 512, 87, - /* 220 */ 514, 515, 435, 20, 92, 93, 94, 95, 498, 376, - /* 230 */ 98, 501, 147, 148, 102, 103, 104, 108, 437, 438, - /* 240 */ 71, 440, 389, 456, 457, 444, 246, 247, 248, 389, - /* 250 */ 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 12, 13, - /* 270 */ 417, 111, 420, 18, 20, 20, 20, 417, 22, 20, - /* 280 */ 195, 196, 27, 388, 389, 30, 433, 0, 435, 190, - /* 290 */ 35, 35, 142, 37, 8, 9, 146, 205, 12, 13, - /* 300 */ 14, 15, 16, 408, 65, 20, 51, 22, 53, 418, - /* 310 */ 415, 8, 9, 58, 59, 12, 13, 14, 15, 16, - /* 320 */ 429, 65, 37, 20, 20, 70, 234, 235, 72, 12, - /* 330 */ 13, 14, 15, 16, 481, 79, 484, 484, 164, 52, - /* 340 */ 55, 488, 489, 490, 491, 492, 493, 495, 495, 110, - /* 350 */ 490, 498, 113, 500, 501, 502, 388, 389, 72, 506, - /* 360 */ 507, 434, 435, 22, 108, 110, 108, 111, 164, 219, - /* 370 */ 111, 42, 293, 417, 224, 0, 121, 227, 37, 229, - /* 380 */ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - /* 390 */ 20, 133, 134, 135, 136, 137, 138, 139, 299, 300, - /* 400 */ 301, 302, 4, 147, 148, 119, 151, 152, 71, 154, - /* 410 */ 155, 156, 157, 158, 159, 160, 161, 162, 163, 180, - /* 420 */ 79, 23, 167, 168, 169, 170, 171, 172, 173, 315, - /* 430 */ 175, 176, 177, 222, 478, 479, 181, 182, 183, 185, - /* 440 */ 186, 185, 186, 188, 46, 47, 48, 121, 405, 18, - /* 450 */ 37, 195, 196, 293, 23, 37, 282, 283, 284, 285, - /* 460 */ 286, 287, 288, 289, 290, 409, 210, 268, 212, 397, - /* 470 */ 184, 40, 41, 417, 20, 44, 433, 509, 510, 511, - /* 480 */ 512, 111, 514, 515, 428, 54, 414, 283, 284, 285, - /* 490 */ 187, 431, 121, 164, 434, 435, 424, 66, 67, 68, - /* 500 */ 69, 70, 246, 247, 248, 13, 250, 251, 252, 253, - /* 510 */ 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - /* 520 */ 264, 265, 266, 267, 268, 12, 13, 484, 485, 486, - /* 530 */ 417, 376, 375, 20, 377, 22, 388, 389, 495, 426, - /* 540 */ 427, 166, 111, 384, 389, 170, 388, 388, 35, 390, - /* 550 */ 37, 248, 293, 178, 388, 389, 408, 271, 272, 273, - /* 560 */ 274, 275, 276, 277, 278, 279, 280, 281, 79, 8, - /* 570 */ 9, 79, 417, 12, 13, 14, 15, 16, 65, 108, - /* 580 */ 149, 370, 371, 372, 20, 72, 56, 57, 433, 34, - /* 590 */ 435, 420, 79, 122, 123, 124, 125, 126, 127, 128, - /* 600 */ 129, 130, 131, 405, 133, 134, 135, 136, 137, 138, - /* 610 */ 139, 282, 283, 284, 285, 286, 287, 288, 289, 290, - /* 620 */ 14, 108, 388, 389, 111, 212, 20, 376, 470, 471, - /* 630 */ 212, 433, 418, 202, 203, 204, 481, 417, 207, 484, - /* 640 */ 389, 187, 408, 488, 489, 490, 491, 492, 493, 415, - /* 650 */ 495, 220, 221, 14, 111, 484, 436, 244, 245, 20, - /* 660 */ 147, 148, 244, 245, 233, 20, 495, 236, 417, 397, - /* 670 */ 239, 240, 241, 242, 243, 395, 510, 511, 512, 111, - /* 680 */ 514, 515, 484, 485, 433, 20, 435, 3, 522, 0, - /* 690 */ 535, 536, 412, 495, 388, 389, 424, 88, 185, 186, - /* 700 */ 418, 421, 514, 20, 20, 22, 540, 541, 195, 196, - /* 710 */ 522, 545, 546, 24, 25, 26, 27, 28, 29, 30, - /* 720 */ 31, 32, 0, 210, 293, 212, 39, 40, 540, 541, - /* 730 */ 388, 389, 481, 545, 546, 484, 388, 389, 55, 488, - /* 740 */ 489, 490, 491, 492, 493, 418, 495, 441, 187, 185, - /* 750 */ 408, 500, 209, 502, 211, 246, 408, 506, 507, 246, - /* 760 */ 247, 248, 153, 250, 251, 252, 253, 254, 255, 256, - /* 770 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 780 */ 267, 12, 13, 14, 376, 534, 243, 178, 179, 20, - /* 790 */ 418, 22, 147, 148, 184, 418, 112, 389, 499, 391, - /* 800 */ 501, 192, 115, 116, 35, 118, 37, 286, 287, 288, - /* 810 */ 289, 290, 248, 376, 305, 306, 307, 308, 309, 310, - /* 820 */ 311, 417, 388, 389, 185, 417, 389, 140, 391, 425, - /* 830 */ 418, 144, 21, 499, 65, 501, 293, 388, 389, 180, - /* 840 */ 436, 433, 408, 435, 12, 13, 388, 36, 79, 38, - /* 850 */ 39, 40, 8, 9, 417, 388, 12, 13, 14, 15, - /* 860 */ 16, 293, 140, 141, 142, 143, 144, 145, 146, 37, - /* 870 */ 433, 187, 435, 214, 388, 389, 417, 108, 141, 142, - /* 880 */ 111, 271, 14, 146, 425, 395, 460, 248, 20, 481, - /* 890 */ 441, 281, 484, 466, 408, 436, 488, 489, 490, 491, - /* 900 */ 492, 493, 0, 495, 514, 447, 50, 449, 500, 0, - /* 910 */ 502, 421, 522, 248, 506, 507, 147, 148, 481, 452, - /* 920 */ 453, 484, 388, 389, 141, 488, 489, 490, 491, 492, - /* 930 */ 493, 541, 495, 388, 389, 545, 546, 500, 409, 502, - /* 940 */ 514, 111, 408, 506, 507, 418, 417, 268, 522, 270, - /* 950 */ 12, 13, 0, 408, 185, 186, 112, 428, 33, 373, - /* 960 */ 22, 376, 388, 389, 195, 196, 540, 541, 388, 389, - /* 970 */ 45, 545, 546, 35, 377, 37, 74, 75, 76, 210, - /* 980 */ 71, 212, 408, 81, 82, 83, 460, 20, 408, 87, - /* 990 */ 388, 389, 388, 389, 92, 93, 94, 95, 376, 22, - /* 1000 */ 98, 388, 376, 65, 102, 103, 104, 480, 225, 226, - /* 1010 */ 408, 389, 408, 391, 37, 246, 247, 248, 433, 250, - /* 1020 */ 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - /* 1030 */ 261, 262, 263, 264, 265, 266, 267, 12, 13, 417, - /* 1040 */ 514, 388, 389, 187, 212, 20, 460, 22, 522, 33, - /* 1050 */ 376, 465, 487, 185, 198, 433, 79, 435, 417, 433, - /* 1060 */ 35, 408, 37, 389, 23, 391, 540, 541, 376, 8, - /* 1070 */ 9, 545, 546, 12, 13, 14, 15, 16, 513, 388, - /* 1080 */ 389, 1, 2, 470, 471, 108, 445, 13, 47, 48, - /* 1090 */ 65, 417, 140, 141, 142, 143, 144, 145, 146, 408, - /* 1100 */ 514, 388, 389, 481, 79, 0, 484, 433, 522, 435, - /* 1110 */ 488, 489, 490, 491, 492, 493, 248, 495, 406, 388, - /* 1120 */ 389, 408, 500, 293, 502, 433, 540, 541, 506, 507, - /* 1130 */ 20, 545, 546, 108, 376, 0, 111, 8, 9, 408, - /* 1140 */ 4, 12, 13, 14, 15, 16, 13, 389, 210, 391, - /* 1150 */ 212, 388, 389, 79, 187, 481, 376, 417, 484, 388, - /* 1160 */ 389, 376, 488, 489, 490, 491, 492, 493, 72, 495, - /* 1170 */ 37, 408, 147, 148, 500, 417, 502, 388, 389, 408, - /* 1180 */ 506, 507, 244, 245, 246, 388, 389, 210, 376, 212, - /* 1190 */ 37, 433, 112, 435, 388, 389, 487, 408, 260, 261, - /* 1200 */ 262, 263, 264, 265, 266, 408, 14, 15, 16, 417, - /* 1210 */ 185, 186, 22, 433, 408, 248, 417, 425, 433, 479, - /* 1220 */ 195, 196, 513, 246, 247, 514, 427, 37, 436, 549, - /* 1230 */ 388, 389, 79, 522, 413, 210, 20, 212, 33, 481, - /* 1240 */ 417, 112, 484, 393, 394, 433, 488, 489, 490, 491, - /* 1250 */ 492, 493, 541, 495, 376, 376, 545, 546, 500, 436, - /* 1260 */ 502, 402, 403, 202, 506, 507, 376, 389, 20, 391, - /* 1270 */ 140, 246, 247, 248, 144, 250, 251, 252, 253, 254, - /* 1280 */ 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - /* 1290 */ 265, 266, 267, 12, 13, 417, 475, 187, 108, 164, - /* 1300 */ 165, 20, 430, 22, 376, 433, 514, 33, 376, 393, - /* 1310 */ 394, 433, 433, 435, 522, 417, 35, 112, 37, 376, - /* 1320 */ 460, 402, 403, 433, 12, 13, 428, 379, 380, 376, - /* 1330 */ 376, 376, 540, 541, 22, 319, 376, 545, 546, 376, - /* 1340 */ 376, 376, 246, 238, 389, 376, 65, 35, 430, 37, - /* 1350 */ 0, 433, 510, 511, 512, 121, 514, 515, 248, 481, - /* 1360 */ 79, 433, 484, 0, 4, 433, 488, 489, 490, 491, - /* 1370 */ 492, 493, 417, 495, 514, 417, 433, 65, 500, 19, - /* 1380 */ 502, 320, 522, 33, 506, 507, 433, 433, 433, 108, - /* 1390 */ 435, 79, 111, 433, 436, 35, 433, 433, 433, 376, - /* 1400 */ 540, 541, 433, 33, 430, 545, 546, 433, 174, 460, - /* 1410 */ 410, 51, 389, 413, 51, 45, 0, 37, 58, 59, - /* 1420 */ 108, 114, 33, 33, 117, 65, 0, 114, 147, 148, - /* 1430 */ 117, 295, 114, 446, 114, 117, 481, 117, 22, 484, - /* 1440 */ 417, 13, 33, 488, 489, 490, 491, 492, 493, 228, - /* 1450 */ 495, 230, 65, 147, 148, 500, 433, 502, 435, 79, - /* 1460 */ 111, 506, 507, 514, 248, 37, 185, 186, 42, 120, - /* 1470 */ 110, 522, 516, 113, 33, 33, 195, 196, 140, 141, - /* 1480 */ 142, 143, 144, 145, 146, 33, 33, 33, 49, 540, - /* 1490 */ 541, 210, 33, 212, 545, 546, 248, 1, 2, 37, - /* 1500 */ 113, 112, 112, 531, 481, 33, 37, 484, 0, 33, - /* 1510 */ 376, 488, 489, 490, 491, 492, 493, 494, 495, 496, - /* 1520 */ 497, 112, 210, 389, 212, 33, 33, 246, 247, 248, - /* 1530 */ 22, 250, 251, 252, 253, 254, 255, 256, 257, 258, - /* 1540 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 376, - /* 1550 */ 111, 417, 33, 112, 112, 538, 33, 517, 246, 247, - /* 1560 */ 0, 0, 389, 13, 112, 112, 112, 433, 392, 435, - /* 1570 */ 33, 112, 260, 261, 262, 263, 264, 265, 266, 33, - /* 1580 */ 376, 417, 22, 22, 112, 12, 13, 37, 112, 405, - /* 1590 */ 417, 317, 33, 389, 405, 12, 13, 12, 13, 12, - /* 1600 */ 13, 12, 13, 33, 112, 112, 433, 33, 435, 12, - /* 1610 */ 13, 12, 13, 12, 13, 481, 446, 387, 484, 376, - /* 1620 */ 446, 417, 488, 489, 490, 491, 492, 493, 37, 495, - /* 1630 */ 37, 112, 389, 33, 500, 112, 502, 433, 537, 435, - /* 1640 */ 506, 507, 12, 13, 12, 13, 376, 12, 13, 112, - /* 1650 */ 537, 537, 459, 13, 481, 537, 392, 484, 112, 389, - /* 1660 */ 417, 488, 489, 490, 491, 492, 493, 389, 495, 446, - /* 1670 */ 79, 112, 79, 500, 212, 502, 433, 37, 435, 506, - /* 1680 */ 507, 212, 112, 432, 467, 481, 112, 417, 484, 521, - /* 1690 */ 446, 446, 488, 489, 490, 491, 492, 493, 521, 495, - /* 1700 */ 542, 407, 508, 433, 524, 435, 502, 1, 296, 51, - /* 1710 */ 506, 507, 112, 461, 483, 42, 20, 482, 472, 477, - /* 1720 */ 397, 227, 472, 397, 481, 19, 208, 484, 463, 20, - /* 1730 */ 388, 488, 489, 490, 491, 492, 493, 20, 495, 45, - /* 1740 */ 389, 35, 442, 389, 442, 502, 184, 439, 389, 506, - /* 1750 */ 507, 481, 388, 388, 484, 439, 442, 51, 488, 489, - /* 1760 */ 490, 491, 492, 493, 439, 495, 60, 61, 62, 63, - /* 1770 */ 439, 65, 502, 109, 401, 107, 506, 507, 400, 388, - /* 1780 */ 388, 106, 399, 388, 388, 388, 20, 381, 50, 385, - /* 1790 */ 385, 381, 20, 472, 20, 397, 397, 435, 397, 20, - /* 1800 */ 397, 390, 462, 390, 397, 20, 453, 20, 35, 388, - /* 1810 */ 381, 397, 397, 376, 447, 397, 110, 397, 433, 113, - /* 1820 */ 476, 381, 388, 379, 51, 417, 389, 379, 472, 231, - /* 1830 */ 111, 474, 376, 60, 61, 62, 63, 20, 65, 417, - /* 1840 */ 417, 417, 417, 471, 417, 389, 395, 417, 417, 417, - /* 1850 */ 417, 145, 417, 216, 417, 469, 468, 215, 395, 388, - /* 1860 */ 304, 461, 530, 530, 312, 530, 303, 533, 201, 433, - /* 1870 */ 433, 433, 435, 417, 529, 532, 528, 313, 435, 433, - /* 1880 */ 314, 297, 527, 110, 292, 519, 113, 291, 520, 433, - /* 1890 */ 321, 435, 389, 376, 318, 189, 550, 191, 316, 454, - /* 1900 */ 194, 454, 544, 20, 543, 199, 389, 121, 294, 525, - /* 1910 */ 461, 390, 454, 433, 433, 395, 523, 395, 481, 433, - /* 1920 */ 376, 484, 433, 433, 218, 488, 489, 490, 491, 492, - /* 1930 */ 493, 454, 495, 389, 417, 193, 451, 481, 395, 433, - /* 1940 */ 484, 111, 487, 395, 488, 489, 490, 491, 492, 493, - /* 1950 */ 433, 495, 435, 180, 447, 505, 193, 433, 502, 448, - /* 1960 */ 447, 417, 189, 507, 413, 433, 193, 194, 433, 433, - /* 1970 */ 376, 433, 199, 200, 395, 395, 111, 433, 433, 435, - /* 1980 */ 433, 22, 433, 389, 547, 548, 433, 433, 433, 422, - /* 1990 */ 433, 218, 389, 388, 378, 38, 480, 395, 481, 382, - /* 2000 */ 376, 484, 458, 381, 433, 488, 489, 490, 491, 492, - /* 2010 */ 493, 417, 495, 389, 433, 473, 0, 376, 374, 433, - /* 2020 */ 455, 433, 464, 433, 396, 481, 0, 433, 484, 435, - /* 2030 */ 389, 411, 488, 489, 490, 491, 492, 493, 376, 495, - /* 2040 */ 433, 417, 433, 433, 433, 433, 433, 411, 433, 411, - /* 2050 */ 455, 389, 458, 536, 0, 45, 0, 433, 417, 435, - /* 2060 */ 37, 237, 419, 237, 37, 37, 37, 0, 37, 37, - /* 2070 */ 237, 37, 0, 237, 433, 481, 435, 0, 484, 417, - /* 2080 */ 376, 37, 488, 489, 490, 491, 492, 493, 0, 495, - /* 2090 */ 37, 0, 22, 389, 0, 433, 37, 435, 232, 0, - /* 2100 */ 218, 0, 212, 218, 210, 481, 219, 0, 484, 0, - /* 2110 */ 0, 206, 488, 489, 490, 491, 492, 493, 205, 495, - /* 2120 */ 0, 417, 481, 0, 152, 484, 0, 376, 49, 488, - /* 2130 */ 489, 490, 491, 492, 493, 49, 495, 433, 0, 435, - /* 2140 */ 389, 37, 0, 481, 51, 37, 484, 0, 0, 49, - /* 2150 */ 488, 489, 490, 491, 492, 493, 45, 495, 0, 497, - /* 2160 */ 0, 0, 458, 539, 49, 0, 0, 0, 417, 0, - /* 2170 */ 0, 0, 170, 37, 0, 170, 0, 0, 0, 0, - /* 2180 */ 0, 0, 0, 0, 433, 481, 435, 0, 484, 548, - /* 2190 */ 376, 0, 488, 489, 490, 491, 492, 493, 0, 495, - /* 2200 */ 0, 0, 0, 389, 0, 0, 0, 0, 0, 458, - /* 2210 */ 376, 49, 0, 45, 0, 0, 0, 0, 0, 0, - /* 2220 */ 0, 0, 0, 389, 151, 22, 0, 0, 152, 0, - /* 2230 */ 150, 417, 481, 0, 0, 484, 50, 0, 50, 488, - /* 2240 */ 489, 490, 491, 492, 493, 22, 495, 433, 0, 435, - /* 2250 */ 22, 417, 0, 0, 65, 65, 0, 65, 0, 65, - /* 2260 */ 376, 51, 37, 0, 51, 0, 0, 433, 37, 435, - /* 2270 */ 0, 14, 42, 389, 42, 37, 37, 37, 42, 33, - /* 2280 */ 0, 0, 0, 42, 0, 0, 51, 45, 201, 0, - /* 2290 */ 0, 0, 43, 49, 49, 481, 49, 376, 484, 49, - /* 2300 */ 49, 417, 488, 489, 490, 491, 492, 493, 0, 495, - /* 2310 */ 389, 42, 0, 42, 0, 481, 37, 433, 484, 435, - /* 2320 */ 42, 376, 488, 489, 490, 491, 492, 493, 73, 495, - /* 2330 */ 0, 37, 0, 37, 389, 42, 0, 51, 417, 51, - /* 2340 */ 376, 42, 37, 51, 42, 0, 51, 0, 0, 0, - /* 2350 */ 0, 0, 37, 389, 433, 22, 435, 0, 37, 37, - /* 2360 */ 37, 37, 417, 37, 37, 481, 37, 33, 484, 0, - /* 2370 */ 33, 117, 488, 489, 490, 491, 492, 493, 433, 495, - /* 2380 */ 435, 417, 376, 119, 22, 22, 0, 22, 0, 37, - /* 2390 */ 37, 53, 37, 37, 22, 389, 37, 433, 0, 435, - /* 2400 */ 22, 37, 481, 0, 0, 484, 376, 0, 37, 488, - /* 2410 */ 489, 490, 491, 492, 493, 22, 495, 0, 0, 389, - /* 2420 */ 37, 20, 37, 417, 37, 112, 481, 37, 111, 484, - /* 2430 */ 0, 111, 223, 488, 489, 490, 491, 492, 493, 433, - /* 2440 */ 495, 435, 37, 49, 0, 481, 187, 417, 484, 187, - /* 2450 */ 22, 376, 488, 489, 490, 491, 492, 493, 0, 495, - /* 2460 */ 22, 193, 187, 433, 389, 435, 0, 0, 33, 197, - /* 2470 */ 187, 3, 376, 197, 187, 50, 37, 111, 217, 112, - /* 2480 */ 213, 111, 222, 298, 37, 389, 112, 481, 111, 376, - /* 2490 */ 484, 109, 417, 50, 488, 489, 490, 491, 492, 493, - /* 2500 */ 111, 495, 389, 107, 112, 33, 33, 112, 433, 112, - /* 2510 */ 435, 481, 33, 417, 484, 33, 79, 111, 488, 489, - /* 2520 */ 490, 491, 492, 493, 111, 495, 49, 49, 112, 433, - /* 2530 */ 417, 435, 111, 33, 111, 37, 112, 3, 112, 33, - /* 2540 */ 49, 37, 37, 112, 37, 37, 433, 37, 435, 37, - /* 2550 */ 33, 49, 112, 0, 0, 42, 481, 111, 190, 484, - /* 2560 */ 112, 112, 111, 488, 489, 490, 491, 492, 493, 376, - /* 2570 */ 495, 298, 111, 111, 0, 298, 0, 481, 42, 282, - /* 2580 */ 484, 112, 389, 42, 488, 489, 490, 491, 492, 493, - /* 2590 */ 190, 495, 111, 194, 481, 33, 109, 484, 189, 109, - /* 2600 */ 376, 488, 489, 490, 491, 492, 493, 2, 495, 269, - /* 2610 */ 417, 22, 111, 389, 49, 49, 22, 0, 49, 376, - /* 2620 */ 111, 246, 249, 112, 190, 111, 433, 112, 435, 111, - /* 2630 */ 111, 111, 389, 112, 111, 42, 112, 111, 111, 37, - /* 2640 */ 112, 417, 111, 111, 111, 120, 111, 22, 22, 112, - /* 2650 */ 376, 111, 22, 111, 132, 223, 112, 433, 37, 435, - /* 2660 */ 417, 111, 111, 389, 121, 37, 37, 112, 112, 112, - /* 2670 */ 37, 112, 37, 112, 481, 37, 433, 484, 435, 132, - /* 2680 */ 376, 488, 489, 490, 491, 492, 493, 33, 495, 111, - /* 2690 */ 132, 417, 132, 389, 111, 37, 111, 22, 37, 37, - /* 2700 */ 73, 37, 37, 72, 37, 481, 37, 433, 484, 435, - /* 2710 */ 37, 37, 488, 489, 490, 491, 492, 493, 37, 495, - /* 2720 */ 37, 417, 37, 79, 481, 105, 79, 484, 105, 33, - /* 2730 */ 376, 488, 489, 490, 491, 492, 493, 433, 495, 435, - /* 2740 */ 37, 37, 37, 389, 22, 37, 37, 37, 37, 79, - /* 2750 */ 37, 37, 37, 37, 22, 481, 37, 376, 484, 0, - /* 2760 */ 37, 0, 488, 489, 490, 491, 492, 493, 51, 495, - /* 2770 */ 389, 417, 42, 37, 0, 51, 42, 37, 51, 42, - /* 2780 */ 0, 37, 51, 42, 0, 481, 37, 433, 484, 435, - /* 2790 */ 37, 376, 488, 489, 490, 491, 492, 493, 417, 495, - /* 2800 */ 0, 22, 33, 22, 389, 22, 21, 20, 22, 21, - /* 2810 */ 551, 551, 551, 551, 433, 551, 435, 551, 376, 551, - /* 2820 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 2830 */ 551, 389, 417, 551, 551, 481, 551, 551, 484, 551, - /* 2840 */ 551, 376, 488, 489, 490, 491, 492, 493, 433, 495, - /* 2850 */ 435, 551, 551, 551, 389, 551, 551, 551, 551, 417, - /* 2860 */ 551, 551, 481, 551, 551, 484, 551, 551, 551, 488, - /* 2870 */ 489, 490, 491, 492, 493, 433, 495, 435, 551, 376, - /* 2880 */ 551, 551, 417, 551, 551, 551, 551, 551, 551, 551, - /* 2890 */ 551, 551, 389, 551, 551, 551, 481, 551, 433, 484, - /* 2900 */ 435, 551, 551, 488, 489, 490, 491, 492, 493, 551, - /* 2910 */ 495, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 2920 */ 417, 551, 551, 481, 551, 551, 484, 551, 551, 551, - /* 2930 */ 488, 489, 490, 491, 492, 493, 433, 495, 435, 551, - /* 2940 */ 551, 551, 551, 551, 551, 551, 481, 551, 551, 484, - /* 2950 */ 551, 551, 551, 488, 489, 490, 491, 492, 493, 551, - /* 2960 */ 495, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 2970 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 2980 */ 551, 551, 551, 551, 481, 551, 551, 484, 551, 551, - /* 2990 */ 551, 488, 489, 490, 491, 492, 493, 551, 495, 551, - /* 3000 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3010 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3020 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3030 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3040 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3050 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3060 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3070 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3080 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3090 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3100 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3110 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3120 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3130 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3140 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3150 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3160 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3170 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 3180 */ 551, 551, 551, 373, 373, 373, 373, 373, 373, 373, - /* 3190 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3200 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3210 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3220 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3230 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3240 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3250 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3260 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3270 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3280 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3290 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3300 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3310 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3320 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3330 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3340 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3350 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3360 */ 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, - /* 3370 */ 373, 373, + /* 0 */ 506, 507, 438, 379, 386, 391, 421, 389, 390, 519, + /* 10 */ 408, 521, 12, 13, 14, 490, 392, 453, 12, 13, + /* 20 */ 20, 0, 22, 459, 460, 8, 9, 379, 4, 12, + /* 30 */ 13, 14, 15, 16, 20, 35, 20, 37, 436, 0, + /* 40 */ 392, 516, 21, 37, 420, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 440, 441, 421, 443, 20, 34, + /* 60 */ 436, 447, 438, 421, 422, 2, 66, 432, 420, 391, + /* 70 */ 392, 8, 9, 73, 66, 12, 13, 14, 15, 16, + /* 80 */ 80, 0, 391, 392, 436, 419, 438, 21, 21, 487, + /* 90 */ 488, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 100 */ 498, 435, 36, 387, 38, 39, 40, 391, 484, 393, + /* 110 */ 110, 487, 490, 113, 20, 491, 492, 493, 494, 495, + /* 120 */ 496, 386, 498, 115, 389, 390, 420, 503, 20, 505, + /* 130 */ 14, 114, 484, 509, 510, 487, 20, 113, 516, 491, + /* 140 */ 492, 493, 494, 495, 496, 497, 498, 499, 500, 149, + /* 150 */ 150, 113, 446, 529, 448, 50, 75, 76, 77, 78, + /* 160 */ 79, 537, 81, 82, 83, 84, 85, 86, 87, 88, + /* 170 */ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + /* 180 */ 99, 100, 101, 102, 103, 104, 105, 106, 188, 189, + /* 190 */ 512, 513, 514, 515, 20, 517, 518, 143, 198, 199, + /* 200 */ 391, 392, 188, 189, 513, 514, 515, 168, 517, 518, + /* 210 */ 517, 423, 173, 213, 426, 215, 525, 42, 525, 14, + /* 220 */ 181, 215, 8, 9, 20, 20, 12, 13, 14, 15, + /* 230 */ 16, 0, 379, 379, 543, 544, 543, 544, 420, 548, + /* 240 */ 549, 548, 549, 149, 150, 392, 421, 429, 430, 249, + /* 250 */ 250, 251, 392, 253, 254, 255, 256, 257, 258, 259, + /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + /* 270 */ 270, 12, 13, 420, 407, 487, 18, 410, 20, 20, + /* 280 */ 420, 22, 228, 229, 517, 27, 498, 73, 30, 436, + /* 290 */ 436, 438, 525, 35, 35, 190, 37, 8, 9, 481, + /* 300 */ 482, 12, 13, 14, 15, 16, 201, 14, 483, 20, + /* 310 */ 52, 544, 54, 20, 420, 548, 549, 59, 60, 20, + /* 320 */ 296, 22, 513, 514, 515, 66, 517, 518, 420, 71, + /* 330 */ 391, 392, 73, 72, 296, 121, 37, 484, 430, 80, + /* 340 */ 487, 166, 448, 193, 491, 492, 493, 494, 495, 496, + /* 350 */ 411, 498, 4, 493, 501, 56, 503, 504, 505, 0, + /* 360 */ 8, 9, 509, 510, 12, 13, 14, 15, 16, 110, + /* 370 */ 112, 23, 113, 142, 143, 144, 145, 146, 147, 148, + /* 380 */ 20, 123, 20, 24, 25, 26, 27, 28, 29, 30, + /* 390 */ 31, 32, 20, 188, 46, 47, 48, 463, 113, 8, + /* 400 */ 9, 187, 468, 12, 13, 14, 15, 16, 149, 150, + /* 410 */ 391, 153, 154, 20, 156, 157, 158, 159, 160, 161, + /* 420 */ 162, 163, 164, 165, 33, 251, 166, 169, 170, 171, + /* 430 */ 172, 173, 174, 175, 176, 387, 178, 179, 180, 391, + /* 440 */ 20, 393, 184, 185, 186, 143, 144, 188, 189, 191, + /* 450 */ 148, 517, 302, 303, 304, 305, 251, 198, 199, 525, + /* 460 */ 285, 286, 287, 288, 289, 290, 291, 292, 293, 450, + /* 470 */ 423, 452, 213, 71, 215, 113, 72, 543, 544, 190, + /* 480 */ 391, 188, 548, 549, 391, 392, 391, 392, 274, 275, + /* 490 */ 276, 277, 278, 279, 280, 281, 282, 283, 284, 289, + /* 500 */ 290, 291, 292, 293, 411, 114, 411, 420, 249, 250, + /* 510 */ 251, 418, 253, 254, 255, 256, 257, 258, 259, 260, + /* 520 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + /* 530 */ 271, 12, 13, 113, 487, 37, 379, 438, 18, 20, + /* 540 */ 251, 22, 113, 23, 251, 498, 286, 287, 288, 392, + /* 550 */ 190, 122, 453, 89, 35, 37, 37, 205, 459, 460, + /* 560 */ 40, 41, 473, 474, 44, 379, 8, 9, 481, 482, + /* 570 */ 12, 13, 14, 15, 16, 55, 123, 420, 392, 166, + /* 580 */ 394, 296, 20, 80, 408, 66, 517, 67, 68, 69, + /* 590 */ 70, 71, 73, 436, 525, 438, 8, 9, 80, 80, + /* 600 */ 12, 13, 14, 15, 16, 0, 420, 75, 76, 77, + /* 610 */ 208, 251, 436, 544, 82, 83, 84, 548, 549, 155, + /* 620 */ 88, 438, 436, 391, 438, 93, 94, 95, 96, 110, + /* 630 */ 13, 99, 113, 113, 400, 103, 104, 105, 106, 237, + /* 640 */ 238, 484, 459, 460, 487, 181, 182, 42, 491, 492, + /* 650 */ 493, 494, 495, 496, 33, 498, 391, 392, 296, 195, + /* 660 */ 503, 427, 505, 487, 488, 489, 509, 510, 149, 150, + /* 670 */ 484, 151, 114, 487, 498, 323, 411, 491, 492, 493, + /* 680 */ 494, 495, 496, 418, 498, 271, 249, 455, 456, 503, + /* 690 */ 378, 505, 380, 113, 537, 509, 510, 80, 285, 286, + /* 700 */ 287, 288, 289, 290, 291, 292, 293, 188, 189, 2, + /* 710 */ 20, 149, 150, 215, 376, 8, 9, 198, 199, 12, + /* 720 */ 13, 14, 15, 16, 0, 205, 206, 207, 437, 438, + /* 730 */ 210, 4, 213, 420, 215, 12, 13, 14, 15, 16, + /* 740 */ 400, 428, 463, 223, 224, 308, 309, 310, 311, 312, + /* 750 */ 313, 314, 439, 271, 144, 273, 236, 417, 148, 239, + /* 760 */ 198, 199, 242, 243, 244, 245, 246, 427, 249, 250, + /* 770 */ 251, 37, 253, 254, 255, 256, 257, 258, 259, 260, + /* 780 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + /* 790 */ 12, 13, 14, 20, 379, 22, 517, 37, 20, 66, + /* 800 */ 22, 463, 420, 225, 525, 123, 468, 392, 3, 394, + /* 810 */ 423, 429, 430, 35, 80, 37, 296, 434, 379, 123, + /* 820 */ 437, 438, 543, 544, 22, 20, 490, 548, 549, 56, + /* 830 */ 517, 392, 222, 394, 52, 420, 20, 227, 525, 37, + /* 840 */ 230, 420, 232, 61, 66, 112, 64, 65, 115, 428, + /* 850 */ 469, 436, 516, 438, 73, 517, 543, 544, 80, 420, + /* 860 */ 439, 548, 549, 525, 391, 392, 142, 143, 144, 145, + /* 870 */ 146, 147, 148, 177, 487, 436, 296, 438, 39, 40, + /* 880 */ 190, 543, 544, 37, 411, 498, 548, 549, 110, 0, + /* 890 */ 421, 113, 142, 143, 144, 145, 146, 147, 148, 484, + /* 900 */ 57, 58, 487, 33, 379, 391, 491, 492, 493, 494, + /* 910 */ 495, 496, 110, 498, 22, 45, 183, 392, 503, 114, + /* 920 */ 505, 391, 392, 484, 509, 510, 487, 149, 150, 37, + /* 930 */ 491, 492, 493, 494, 495, 496, 502, 498, 504, 391, + /* 940 */ 392, 411, 503, 322, 505, 420, 391, 392, 509, 510, + /* 950 */ 412, 373, 374, 375, 391, 392, 117, 118, 420, 120, + /* 960 */ 420, 436, 502, 438, 504, 379, 188, 189, 428, 431, + /* 970 */ 391, 392, 80, 23, 411, 215, 198, 199, 392, 439, + /* 980 */ 394, 142, 421, 391, 392, 146, 420, 473, 474, 421, + /* 990 */ 411, 213, 444, 215, 428, 190, 22, 47, 48, 444, + /* 1000 */ 391, 392, 110, 411, 188, 439, 420, 247, 248, 484, + /* 1010 */ 113, 37, 487, 20, 396, 397, 491, 492, 493, 494, + /* 1020 */ 495, 496, 436, 498, 438, 298, 379, 249, 250, 251, + /* 1030 */ 249, 253, 254, 255, 256, 257, 258, 259, 260, 261, + /* 1040 */ 262, 263, 264, 265, 266, 267, 268, 269, 270, 12, + /* 1050 */ 13, 379, 412, 444, 80, 166, 167, 20, 421, 22, + /* 1060 */ 420, 215, 396, 397, 392, 183, 394, 251, 391, 392, + /* 1070 */ 484, 431, 35, 487, 37, 550, 551, 491, 492, 493, + /* 1080 */ 494, 495, 496, 436, 498, 405, 406, 379, 411, 503, + /* 1090 */ 401, 505, 420, 247, 248, 509, 510, 22, 409, 217, + /* 1100 */ 392, 379, 394, 66, 110, 213, 421, 215, 436, 212, + /* 1110 */ 438, 214, 37, 398, 1, 2, 379, 80, 124, 125, + /* 1120 */ 126, 127, 128, 129, 130, 131, 132, 133, 420, 135, + /* 1130 */ 136, 137, 138, 139, 140, 141, 380, 391, 392, 424, + /* 1140 */ 409, 249, 250, 246, 436, 398, 438, 110, 379, 3, + /* 1150 */ 113, 187, 391, 392, 391, 392, 484, 411, 436, 487, + /* 1160 */ 0, 392, 415, 491, 492, 493, 494, 495, 496, 420, + /* 1170 */ 498, 424, 411, 436, 411, 503, 379, 505, 391, 392, + /* 1180 */ 519, 509, 510, 190, 33, 110, 149, 150, 14, 420, + /* 1190 */ 391, 392, 484, 296, 20, 487, 45, 379, 411, 491, + /* 1200 */ 492, 493, 494, 495, 496, 436, 498, 438, 391, 392, + /* 1210 */ 411, 503, 379, 505, 12, 13, 379, 509, 510, 379, + /* 1220 */ 391, 392, 391, 392, 22, 188, 189, 114, 411, 391, + /* 1230 */ 392, 482, 72, 436, 449, 198, 199, 35, 274, 37, + /* 1240 */ 411, 20, 411, 20, 251, 14, 15, 16, 284, 411, + /* 1250 */ 213, 416, 215, 484, 436, 0, 487, 391, 392, 541, + /* 1260 */ 491, 492, 493, 494, 495, 496, 379, 498, 66, 436, + /* 1270 */ 405, 406, 503, 436, 505, 379, 436, 411, 509, 510, + /* 1280 */ 501, 142, 80, 504, 379, 146, 249, 250, 251, 0, + /* 1290 */ 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + /* 1300 */ 263, 264, 265, 266, 267, 268, 269, 270, 12, 13, + /* 1310 */ 379, 379, 110, 478, 391, 392, 20, 379, 22, 391, + /* 1320 */ 392, 379, 379, 436, 392, 534, 420, 463, 110, 13, + /* 1330 */ 379, 35, 436, 37, 411, 433, 0, 431, 436, 411, + /* 1340 */ 379, 436, 124, 125, 126, 127, 128, 129, 130, 131, + /* 1350 */ 132, 133, 420, 135, 136, 137, 138, 139, 140, 141, + /* 1360 */ 433, 379, 66, 436, 75, 76, 77, 436, 436, 33, + /* 1370 */ 438, 82, 83, 84, 436, 33, 80, 88, 436, 436, + /* 1380 */ 420, 517, 93, 94, 95, 96, 420, 436, 99, 525, + /* 1390 */ 33, 420, 103, 104, 105, 106, 80, 436, 0, 439, + /* 1400 */ 433, 391, 392, 436, 37, 439, 110, 543, 544, 113, + /* 1410 */ 439, 413, 548, 549, 416, 213, 484, 215, 436, 487, + /* 1420 */ 382, 383, 0, 491, 492, 493, 494, 495, 496, 116, + /* 1430 */ 498, 116, 119, 116, 119, 503, 119, 505, 12, 13, + /* 1440 */ 116, 509, 510, 119, 22, 149, 150, 80, 22, 13, + /* 1450 */ 52, 249, 250, 231, 13, 233, 114, 0, 0, 0, + /* 1460 */ 35, 35, 379, 37, 318, 263, 264, 265, 266, 267, + /* 1470 */ 268, 269, 251, 37, 251, 392, 37, 52, 37, 22, + /* 1480 */ 22, 22, 149, 150, 188, 189, 61, 62, 63, 64, + /* 1490 */ 37, 66, 66, 552, 198, 199, 241, 520, 12, 13, + /* 1500 */ 8, 9, 33, 420, 12, 13, 14, 15, 16, 213, + /* 1510 */ 395, 215, 12, 13, 33, 33, 33, 33, 33, 436, + /* 1520 */ 33, 438, 420, 513, 514, 515, 408, 517, 518, 33, + /* 1530 */ 33, 1, 2, 80, 33, 33, 408, 112, 49, 449, + /* 1540 */ 115, 449, 33, 33, 390, 249, 250, 251, 540, 253, + /* 1550 */ 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + /* 1560 */ 264, 265, 266, 267, 268, 269, 270, 484, 33, 1, + /* 1570 */ 487, 33, 12, 13, 491, 492, 493, 494, 495, 496, + /* 1580 */ 33, 498, 463, 114, 12, 13, 503, 19, 505, 12, + /* 1590 */ 13, 33, 509, 510, 379, 114, 114, 114, 114, 114, + /* 1600 */ 33, 114, 113, 35, 33, 12, 13, 392, 183, 13, + /* 1610 */ 114, 114, 12, 13, 540, 114, 114, 192, 540, 51, + /* 1620 */ 52, 196, 197, 114, 114, 12, 13, 202, 203, 61, + /* 1630 */ 62, 63, 64, 37, 66, 420, 517, 12, 13, 213, + /* 1640 */ 33, 215, 12, 13, 525, 33, 221, 12, 13, 114, + /* 1650 */ 462, 436, 114, 438, 215, 13, 540, 395, 449, 392, + /* 1660 */ 435, 114, 543, 544, 470, 449, 449, 548, 549, 0, + /* 1670 */ 545, 379, 114, 247, 248, 249, 524, 320, 511, 37, + /* 1680 */ 112, 114, 190, 115, 392, 114, 524, 410, 4, 263, + /* 1690 */ 264, 265, 266, 267, 268, 269, 527, 464, 299, 484, + /* 1700 */ 52, 42, 487, 19, 379, 486, 491, 492, 493, 494, + /* 1710 */ 495, 496, 420, 498, 485, 147, 20, 392, 475, 35, + /* 1720 */ 505, 114, 53, 230, 509, 510, 114, 480, 436, 400, + /* 1730 */ 438, 475, 400, 211, 379, 466, 52, 20, 391, 20, + /* 1740 */ 392, 392, 45, 59, 60, 420, 445, 392, 445, 187, + /* 1750 */ 66, 379, 442, 391, 445, 111, 392, 404, 109, 391, + /* 1760 */ 192, 436, 194, 438, 392, 197, 391, 391, 442, 442, + /* 1770 */ 202, 108, 442, 403, 391, 420, 484, 391, 391, 487, + /* 1780 */ 402, 384, 20, 491, 492, 493, 494, 495, 496, 221, + /* 1790 */ 498, 436, 420, 438, 50, 388, 112, 505, 384, 115, + /* 1800 */ 388, 509, 510, 475, 400, 400, 20, 438, 436, 484, + /* 1810 */ 438, 400, 487, 20, 393, 20, 491, 492, 493, 494, + /* 1820 */ 495, 496, 393, 498, 465, 20, 463, 400, 379, 463, + /* 1830 */ 505, 400, 400, 456, 509, 510, 20, 400, 450, 484, + /* 1840 */ 400, 392, 487, 391, 400, 379, 491, 492, 493, 494, + /* 1850 */ 495, 496, 384, 498, 420, 420, 484, 382, 392, 487, + /* 1860 */ 382, 384, 420, 491, 492, 493, 494, 495, 496, 420, + /* 1870 */ 498, 420, 234, 479, 420, 420, 420, 505, 113, 391, + /* 1880 */ 517, 420, 510, 517, 420, 436, 420, 438, 525, 398, + /* 1890 */ 420, 525, 420, 538, 539, 477, 436, 20, 436, 436, + /* 1900 */ 219, 218, 436, 475, 438, 472, 543, 544, 391, 543, + /* 1910 */ 544, 548, 549, 398, 548, 549, 471, 474, 438, 315, + /* 1920 */ 536, 307, 533, 306, 457, 379, 436, 461, 533, 464, + /* 1930 */ 457, 204, 317, 484, 533, 535, 487, 316, 392, 531, + /* 1940 */ 491, 492, 493, 494, 495, 496, 300, 498, 532, 530, + /* 1950 */ 484, 295, 294, 487, 379, 324, 553, 491, 492, 493, + /* 1960 */ 494, 495, 496, 464, 498, 392, 420, 392, 321, 523, + /* 1970 */ 522, 547, 319, 20, 123, 528, 546, 297, 393, 398, + /* 1980 */ 398, 457, 436, 457, 438, 490, 436, 436, 539, 436, + /* 1990 */ 436, 436, 196, 454, 450, 420, 398, 526, 113, 436, + /* 2000 */ 398, 436, 508, 196, 398, 416, 450, 461, 451, 398, + /* 2010 */ 392, 436, 436, 438, 436, 379, 436, 113, 398, 436, + /* 2020 */ 436, 22, 436, 436, 436, 391, 436, 436, 392, 38, + /* 2030 */ 484, 436, 381, 487, 384, 436, 467, 491, 492, 493, + /* 2040 */ 494, 495, 496, 377, 498, 436, 436, 385, 425, 483, + /* 2050 */ 476, 379, 436, 399, 422, 436, 420, 414, 436, 484, + /* 2060 */ 436, 458, 487, 436, 392, 436, 491, 492, 493, 494, + /* 2070 */ 495, 496, 436, 498, 438, 436, 436, 436, 414, 414, + /* 2080 */ 0, 0, 0, 45, 458, 0, 37, 240, 37, 37, + /* 2090 */ 37, 0, 420, 240, 37, 37, 240, 37, 0, 240, + /* 2100 */ 0, 37, 0, 37, 0, 22, 0, 37, 436, 235, + /* 2110 */ 438, 221, 0, 221, 215, 222, 213, 542, 0, 0, + /* 2120 */ 484, 0, 0, 487, 209, 208, 0, 491, 492, 493, + /* 2130 */ 494, 495, 496, 0, 498, 154, 49, 49, 0, 0, + /* 2140 */ 379, 0, 37, 0, 37, 52, 49, 0, 45, 0, + /* 2150 */ 0, 0, 0, 392, 37, 173, 484, 49, 0, 487, + /* 2160 */ 0, 0, 0, 491, 492, 493, 494, 495, 496, 379, + /* 2170 */ 498, 0, 500, 0, 173, 0, 0, 0, 0, 0, + /* 2180 */ 0, 420, 392, 0, 0, 0, 0, 551, 0, 0, + /* 2190 */ 379, 49, 0, 45, 0, 0, 0, 436, 0, 438, + /* 2200 */ 0, 0, 0, 392, 0, 0, 0, 0, 0, 0, + /* 2210 */ 420, 0, 0, 0, 0, 22, 0, 154, 0, 379, + /* 2220 */ 153, 0, 461, 152, 0, 0, 436, 0, 438, 66, + /* 2230 */ 0, 420, 392, 66, 37, 0, 66, 22, 0, 22, + /* 2240 */ 50, 0, 0, 0, 0, 484, 0, 436, 487, 438, + /* 2250 */ 0, 461, 491, 492, 493, 494, 495, 496, 0, 498, + /* 2260 */ 420, 74, 52, 37, 42, 66, 37, 14, 37, 50, + /* 2270 */ 42, 37, 52, 33, 484, 52, 436, 487, 438, 42, + /* 2280 */ 0, 491, 492, 493, 494, 495, 496, 0, 498, 42, + /* 2290 */ 45, 0, 43, 0, 204, 484, 42, 49, 487, 42, + /* 2300 */ 49, 0, 491, 492, 493, 494, 495, 496, 49, 498, + /* 2310 */ 49, 0, 49, 379, 0, 0, 0, 0, 37, 52, + /* 2320 */ 42, 0, 37, 52, 484, 42, 392, 487, 0, 37, + /* 2330 */ 379, 491, 492, 493, 494, 495, 496, 42, 498, 0, + /* 2340 */ 52, 37, 52, 392, 42, 0, 0, 379, 0, 0, + /* 2350 */ 0, 0, 119, 121, 420, 37, 22, 0, 0, 22, + /* 2360 */ 392, 37, 37, 37, 37, 0, 37, 37, 37, 37, + /* 2370 */ 436, 420, 438, 33, 33, 37, 22, 22, 22, 37, + /* 2380 */ 37, 37, 0, 0, 22, 22, 0, 436, 420, 438, + /* 2390 */ 37, 0, 0, 0, 0, 22, 37, 37, 20, 0, + /* 2400 */ 114, 54, 113, 37, 436, 37, 438, 37, 226, 113, + /* 2410 */ 379, 0, 37, 49, 0, 0, 0, 22, 484, 216, + /* 2420 */ 22, 487, 3, 392, 301, 491, 492, 493, 494, 495, + /* 2430 */ 496, 50, 498, 33, 114, 484, 113, 50, 487, 200, + /* 2440 */ 37, 37, 491, 492, 493, 494, 495, 496, 113, 498, + /* 2450 */ 190, 420, 484, 33, 190, 487, 220, 33, 190, 491, + /* 2460 */ 492, 493, 494, 495, 496, 196, 498, 436, 33, 438, + /* 2470 */ 200, 33, 190, 301, 190, 49, 49, 80, 33, 37, + /* 2480 */ 225, 114, 113, 111, 113, 109, 3, 33, 114, 37, + /* 2490 */ 379, 114, 113, 113, 37, 37, 37, 37, 114, 114, + /* 2500 */ 37, 113, 113, 392, 114, 49, 33, 379, 0, 0, + /* 2510 */ 114, 49, 42, 0, 113, 484, 114, 42, 487, 114, + /* 2520 */ 392, 114, 491, 492, 493, 494, 495, 496, 0, 498, + /* 2530 */ 113, 420, 114, 379, 113, 42, 113, 2, 33, 114, + /* 2540 */ 111, 113, 111, 22, 272, 193, 392, 436, 420, 438, + /* 2550 */ 285, 114, 249, 114, 113, 49, 49, 301, 114, 113, + /* 2560 */ 113, 113, 113, 113, 436, 114, 438, 22, 113, 0, + /* 2570 */ 379, 252, 42, 49, 420, 114, 123, 113, 113, 113, + /* 2580 */ 113, 113, 22, 392, 113, 22, 114, 113, 22, 113, + /* 2590 */ 436, 122, 438, 114, 37, 484, 37, 113, 487, 193, + /* 2600 */ 192, 114, 491, 492, 493, 494, 495, 496, 37, 498, + /* 2610 */ 197, 420, 484, 113, 37, 487, 114, 114, 37, 491, + /* 2620 */ 492, 493, 494, 495, 496, 193, 498, 436, 114, 438, + /* 2630 */ 37, 379, 114, 37, 33, 226, 37, 22, 484, 113, + /* 2640 */ 113, 487, 113, 73, 392, 491, 492, 493, 494, 495, + /* 2650 */ 496, 134, 498, 134, 379, 22, 134, 134, 37, 74, + /* 2660 */ 37, 37, 37, 37, 37, 37, 37, 392, 37, 37, + /* 2670 */ 80, 37, 420, 33, 107, 484, 37, 80, 487, 107, + /* 2680 */ 37, 37, 491, 492, 493, 494, 495, 496, 436, 498, + /* 2690 */ 438, 22, 37, 37, 37, 420, 80, 37, 37, 37, + /* 2700 */ 37, 37, 22, 37, 0, 37, 52, 42, 0, 37, + /* 2710 */ 52, 436, 42, 438, 37, 379, 0, 42, 0, 52, + /* 2720 */ 37, 42, 0, 52, 37, 0, 37, 22, 392, 22, + /* 2730 */ 33, 22, 21, 554, 22, 22, 484, 0, 21, 487, + /* 2740 */ 379, 20, 554, 491, 492, 493, 494, 495, 496, 554, + /* 2750 */ 498, 554, 554, 392, 554, 554, 420, 554, 554, 484, + /* 2760 */ 554, 554, 487, 554, 554, 554, 491, 492, 493, 494, + /* 2770 */ 495, 496, 436, 498, 438, 554, 554, 554, 554, 554, + /* 2780 */ 554, 420, 554, 554, 554, 554, 554, 554, 554, 554, + /* 2790 */ 554, 554, 554, 554, 554, 554, 554, 436, 554, 438, + /* 2800 */ 554, 379, 554, 554, 554, 554, 554, 554, 554, 554, + /* 2810 */ 554, 554, 554, 554, 392, 554, 554, 554, 554, 554, + /* 2820 */ 484, 554, 379, 487, 554, 554, 554, 491, 492, 493, + /* 2830 */ 494, 495, 496, 554, 498, 392, 554, 554, 554, 554, + /* 2840 */ 554, 554, 420, 554, 554, 484, 554, 554, 487, 554, + /* 2850 */ 554, 554, 491, 492, 493, 494, 495, 496, 436, 498, + /* 2860 */ 438, 554, 554, 420, 554, 554, 554, 554, 554, 554, + /* 2870 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 436, + /* 2880 */ 554, 438, 554, 379, 554, 554, 554, 554, 554, 554, + /* 2890 */ 554, 554, 554, 554, 554, 554, 392, 554, 554, 554, + /* 2900 */ 554, 554, 554, 554, 554, 554, 484, 554, 554, 487, + /* 2910 */ 554, 554, 554, 491, 492, 493, 494, 495, 496, 554, + /* 2920 */ 498, 554, 554, 554, 420, 554, 554, 484, 554, 554, + /* 2930 */ 487, 554, 554, 554, 491, 492, 493, 494, 495, 496, + /* 2940 */ 436, 498, 438, 554, 379, 554, 554, 554, 554, 554, + /* 2950 */ 554, 554, 554, 554, 554, 554, 554, 392, 554, 554, + /* 2960 */ 554, 554, 554, 379, 554, 554, 554, 554, 554, 554, + /* 2970 */ 554, 554, 554, 554, 554, 554, 392, 554, 554, 554, + /* 2980 */ 554, 554, 554, 554, 554, 420, 554, 554, 484, 554, + /* 2990 */ 554, 487, 554, 554, 554, 491, 492, 493, 494, 495, + /* 3000 */ 496, 436, 498, 438, 420, 554, 554, 554, 554, 554, + /* 3010 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, + /* 3020 */ 436, 554, 438, 554, 379, 554, 554, 554, 554, 554, + /* 3030 */ 554, 554, 554, 554, 554, 554, 554, 392, 554, 554, + /* 3040 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 484, + /* 3050 */ 554, 554, 487, 554, 554, 554, 491, 492, 493, 494, + /* 3060 */ 495, 496, 554, 498, 554, 420, 554, 554, 484, 554, + /* 3070 */ 554, 487, 554, 554, 554, 491, 492, 493, 494, 495, + /* 3080 */ 496, 436, 498, 438, 554, 554, 554, 554, 554, 554, + /* 3090 */ 554, 554, 554, 379, 554, 554, 554, 554, 554, 554, + /* 3100 */ 554, 554, 554, 554, 554, 554, 392, 554, 379, 554, + /* 3110 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, + /* 3120 */ 554, 392, 554, 554, 554, 554, 554, 554, 554, 484, + /* 3130 */ 554, 554, 487, 554, 420, 554, 491, 492, 493, 494, + /* 3140 */ 495, 496, 554, 498, 554, 554, 554, 554, 554, 420, + /* 3150 */ 436, 554, 438, 554, 554, 554, 554, 554, 554, 554, + /* 3160 */ 554, 554, 554, 554, 554, 436, 554, 438, 554, 554, + /* 3170 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, + /* 3180 */ 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, + /* 3190 */ 554, 554, 554, 554, 554, 554, 554, 554, 484, 554, + /* 3200 */ 554, 487, 554, 554, 554, 491, 492, 493, 494, 495, + /* 3210 */ 496, 554, 498, 484, 554, 554, 487, 554, 554, 554, + /* 3220 */ 491, 492, 493, 494, 495, 496, 554, 498, 376, 376, + /* 3230 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3240 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3250 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3260 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3270 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3280 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3290 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3300 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3310 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3320 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3330 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3340 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3350 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3360 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3370 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3380 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3390 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3400 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3410 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3420 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3430 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3440 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3450 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3460 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3470 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3480 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3490 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3500 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3510 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3520 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3530 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3540 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3550 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3560 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3570 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3580 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3590 */ 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, + /* 3600 */ 376, 376, 376, 376, }; -#define YY_SHIFT_COUNT (955) +#define YY_SHIFT_COUNT (960) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2800) +#define YY_SHIFT_MAX (2737) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 431, 0, 256, 0, 513, 513, 513, 513, 513, 513, - /* 10 */ 513, 513, 513, 513, 513, 513, 769, 1025, 1025, 1281, - /* 20 */ 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - /* 30 */ 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - /* 40 */ 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - /* 50 */ 79, 259, 543, 370, 568, 830, 568, 568, 370, 370, - /* 60 */ 568, 1312, 568, 255, 1312, 160, 568, 5, 938, 85, - /* 70 */ 85, 14, 14, 938, 938, 398, 398, 85, 254, 645, - /* 80 */ 130, 130, 665, 14, 14, 14, 14, 14, 14, 14, - /* 90 */ 14, 14, 14, 14, 49, 203, 304, 14, 14, 169, - /* 100 */ 5, 14, 49, 14, 5, 14, 14, 14, 14, 5, - /* 110 */ 14, 14, 5, 14, 5, 5, 5, 14, 337, 286, - /* 120 */ 286, 258, 258, 471, 132, 329, 149, 977, 977, 977, - /* 130 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977, - /* 140 */ 977, 977, 977, 977, 977, 977, 687, 684, 254, 645, - /* 150 */ 530, 530, 1153, 454, 454, 454, 679, 679, 909, 492, - /* 160 */ 1153, 169, 5, 326, 5, 5, 199, 5, 5, 489, - /* 170 */ 5, 489, 489, 371, 555, 258, 258, 258, 258, 258, - /* 180 */ 258, 1706, 902, 21, 303, 174, 174, 1061, 509, 99, - /* 190 */ 521, 285, 204, 639, 868, 832, 832, 967, 1041, 1110, - /* 200 */ 341, 341, 341, 856, 341, 564, 683, 1216, 606, 1130, - /* 210 */ 659, 1216, 1216, 1248, 1074, 1074, 114, 925, 1136, 492, - /* 220 */ 1412, 1658, 1673, 1696, 1494, 169, 1696, 169, 1518, 1709, - /* 230 */ 1717, 1694, 1717, 1694, 1562, 1709, 1717, 1709, 1694, 1562, - /* 240 */ 1562, 1562, 1664, 1668, 1709, 1709, 1675, 1709, 1709, 1709, - /* 250 */ 1766, 1738, 1766, 1738, 1696, 169, 169, 1772, 169, 1774, - /* 260 */ 1779, 169, 1774, 169, 1785, 169, 1787, 169, 169, 1709, - /* 270 */ 169, 1766, 5, 5, 5, 5, 5, 5, 5, 5, - /* 280 */ 5, 5, 5, 1709, 555, 555, 1766, 489, 489, 489, - /* 290 */ 1598, 1719, 1696, 337, 1817, 1637, 1642, 1772, 337, 1412, - /* 300 */ 1709, 489, 1556, 1563, 1556, 1563, 1552, 1667, 1556, 1566, - /* 310 */ 1564, 1584, 1412, 1592, 1596, 1569, 1576, 1582, 1717, 1883, - /* 320 */ 1786, 1614, 1774, 337, 337, 1563, 489, 489, 489, 489, - /* 330 */ 1563, 489, 1742, 337, 489, 1787, 337, 1830, 489, 1763, - /* 340 */ 1787, 337, 371, 337, 1717, 489, 489, 489, 489, 489, - /* 350 */ 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, - /* 360 */ 489, 489, 489, 489, 489, 489, 489, 1865, 489, 1709, - /* 370 */ 337, 1959, 1957, 1766, 2999, 2999, 2999, 2999, 2999, 2999, - /* 380 */ 2999, 2999, 2999, 2999, 2999, 38, 1773, 689, 1360, 47, - /* 390 */ 844, 1129, 15, 62, 561, 722, 952, 189, 189, 189, - /* 400 */ 189, 189, 189, 189, 189, 189, 1338, 150, 609, 811, - /* 410 */ 317, 317, 92, 239, 375, 46, 211, 413, 418, 211, - /* 420 */ 1135, 129, 1190, 783, 737, 737, 1192, 1080, 610, 1192, - /* 430 */ 1192, 1192, 1363, 1105, 1205, 1426, 1370, 1234, 1350, 1307, - /* 440 */ 1313, 1318, 1320, 1380, 1133, 1428, 1416, 1508, 1560, 1561, - /* 450 */ 1221, 1389, 1390, 1387, 1409, 1441, 1442, 1452, 1306, 1274, - /* 460 */ 1016, 1453, 1454, 1459, 1496, 1472, 1096, 1476, 1439, 1492, - /* 470 */ 1493, 1519, 1523, 1573, 1583, 1585, 1587, 1589, 1597, 1599, - /* 480 */ 1601, 1630, 1632, 1635, 1537, 1546, 1559, 1570, 1574, 1600, - /* 490 */ 1349, 1591, 1462, 1469, 1550, 1640, 1593, 287, 2016, 2026, - /* 500 */ 2054, 2010, 2056, 2023, 1824, 2027, 2028, 2029, 1826, 2067, - /* 510 */ 2031, 2032, 1833, 2034, 2072, 1836, 2077, 2044, 2088, 2053, - /* 520 */ 2091, 2070, 2094, 2059, 1866, 2099, 1882, 2101, 1885, 1887, - /* 530 */ 1890, 1894, 2107, 2109, 2110, 1905, 1913, 2120, 2123, 1972, - /* 540 */ 2079, 2086, 2126, 2104, 2138, 2142, 2108, 2093, 2147, 2100, - /* 550 */ 2148, 2111, 2158, 2160, 2161, 2115, 2165, 2166, 2167, 2169, - /* 560 */ 2170, 2171, 2002, 2136, 2174, 2005, 2176, 2177, 2178, 2179, - /* 570 */ 2180, 2181, 2182, 2183, 2187, 2191, 2198, 2200, 2201, 2202, - /* 580 */ 2204, 2205, 2206, 2207, 2208, 2162, 2212, 2168, 2214, 2215, - /* 590 */ 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2203, 2226, 2076, - /* 600 */ 2227, 2073, 2229, 2080, 2233, 2234, 2223, 2186, 2228, 2188, - /* 610 */ 2237, 2189, 2248, 2190, 2225, 2252, 2192, 2253, 2194, 2256, - /* 620 */ 2258, 2231, 2210, 2230, 2263, 2238, 2213, 2232, 2265, 2239, - /* 630 */ 2235, 2236, 2266, 2240, 2270, 2242, 2241, 2246, 2244, 2245, - /* 640 */ 2257, 2247, 2280, 2249, 2269, 2281, 2282, 2284, 2285, 2271, - /* 650 */ 2087, 2289, 2244, 2250, 2290, 2244, 2251, 2291, 2308, 2255, - /* 660 */ 2312, 2314, 2279, 2286, 2278, 2330, 2294, 2288, 2293, 2332, - /* 670 */ 2296, 2292, 2299, 2336, 2305, 2295, 2302, 2345, 2347, 2348, - /* 680 */ 2349, 2350, 2351, 2264, 2254, 2315, 2333, 2357, 2321, 2322, - /* 690 */ 2323, 2324, 2326, 2327, 2329, 2352, 2353, 2334, 2337, 2355, - /* 700 */ 2356, 2362, 2359, 2369, 2363, 2386, 2365, 2388, 2372, 2338, - /* 710 */ 2398, 2378, 2364, 2403, 2404, 2407, 2371, 2417, 2383, 2418, - /* 720 */ 2393, 2401, 2385, 2387, 2390, 2313, 2317, 2430, 2259, 2209, - /* 730 */ 2260, 2320, 2261, 2244, 2394, 2444, 2262, 2405, 2428, 2458, - /* 740 */ 2267, 2438, 2275, 2268, 2466, 2467, 2283, 2272, 2287, 2276, - /* 750 */ 2468, 2435, 2185, 2366, 2367, 2370, 2374, 2439, 2447, 2377, - /* 760 */ 2425, 2382, 2443, 2396, 2392, 2472, 2473, 2395, 2389, 2406, - /* 770 */ 2413, 2397, 2479, 2477, 2478, 2421, 2482, 2273, 2437, 2416, - /* 780 */ 2500, 2423, 2498, 2424, 2426, 2534, 2506, 2277, 2504, 2505, - /* 790 */ 2507, 2508, 2510, 2512, 2431, 2440, 2491, 2297, 2517, 2502, - /* 800 */ 2553, 2554, 2446, 2513, 2448, 2449, 2451, 2461, 2368, 2462, - /* 810 */ 2574, 2536, 2399, 2576, 2469, 2481, 2400, 2541, 2409, 2562, - /* 820 */ 2487, 2340, 2490, 2605, 2589, 2375, 2511, 2515, 2501, 2509, - /* 830 */ 2514, 2518, 2519, 2521, 2565, 2520, 2523, 2566, 2524, 2594, - /* 840 */ 2373, 2526, 2527, 2617, 2528, 2531, 2434, 2593, 2532, 2525, - /* 850 */ 2244, 2569, 2533, 2535, 2537, 2540, 2542, 2543, 2625, 2626, - /* 860 */ 2630, 2432, 2544, 2602, 2621, 2550, 2555, 2628, 2551, 2556, - /* 870 */ 2629, 2501, 2557, 2633, 2509, 2559, 2635, 2514, 2561, 2638, - /* 880 */ 2518, 2522, 2547, 2558, 2560, 2578, 2654, 2583, 2658, 2585, - /* 890 */ 2654, 2654, 2675, 2627, 2631, 2661, 2662, 2664, 2665, 2667, - /* 900 */ 2669, 2673, 2674, 2681, 2683, 2685, 2644, 2620, 2647, 2623, - /* 910 */ 2696, 2703, 2704, 2705, 2722, 2708, 2709, 2710, 2670, 2334, - /* 920 */ 2711, 2337, 2713, 2714, 2715, 2716, 2732, 2719, 2759, 2723, - /* 930 */ 2717, 2730, 2761, 2736, 2724, 2734, 2774, 2740, 2727, 2737, - /* 940 */ 2780, 2744, 2731, 2741, 2784, 2749, 2753, 2800, 2779, 2769, - /* 950 */ 2781, 2785, 2783, 2786, 2788, 2787, + /* 0 */ 520, 0, 259, 0, 519, 519, 519, 519, 519, 519, + /* 10 */ 519, 519, 519, 519, 519, 519, 778, 1037, 1037, 1296, + /* 20 */ 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, + /* 30 */ 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, + /* 40 */ 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, + /* 50 */ 38, 362, 897, 420, 285, 580, 285, 285, 420, 420, + /* 60 */ 285, 1202, 285, 258, 1202, 24, 285, 16, 1426, 562, + /* 70 */ 562, 108, 108, 1426, 1426, 348, 348, 562, 14, 94, + /* 80 */ 116, 116, 174, 108, 108, 108, 108, 108, 108, 108, + /* 90 */ 108, 108, 108, 108, 204, 372, 393, 108, 108, 261, + /* 100 */ 16, 108, 204, 108, 16, 108, 108, 108, 108, 16, + /* 110 */ 108, 108, 16, 108, 16, 16, 16, 108, 404, 214, + /* 120 */ 214, 994, 994, 1218, 532, 175, 67, 892, 892, 892, + /* 130 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, + /* 140 */ 892, 892, 892, 892, 892, 892, 839, 805, 14, 94, + /* 150 */ 843, 843, 518, 690, 690, 690, 482, 482, 1160, 617, + /* 160 */ 518, 261, 16, 453, 16, 16, 414, 16, 16, 503, + /* 170 */ 16, 503, 503, 682, 25, 994, 994, 994, 994, 994, + /* 180 */ 994, 1568, 1289, 21, 289, 413, 413, 352, 437, 150, + /* 190 */ 210, 299, 260, 205, 293, 6, 6, 360, 950, 993, + /* 200 */ 974, 974, 974, 105, 974, 816, 773, 1221, 1174, 1139, + /* 210 */ 882, 1221, 1221, 1223, 1316, 1316, 1146, 870, 727, 617, + /* 220 */ 1399, 1648, 1659, 1696, 1493, 261, 1696, 261, 1522, 1717, + /* 230 */ 1719, 1697, 1719, 1697, 1562, 1717, 1719, 1717, 1697, 1562, + /* 240 */ 1562, 1562, 1644, 1649, 1717, 1717, 1663, 1717, 1717, 1717, + /* 250 */ 1762, 1744, 1762, 1744, 1696, 261, 261, 1786, 261, 1793, + /* 260 */ 1795, 261, 1793, 261, 1805, 261, 1816, 261, 261, 1717, + /* 270 */ 261, 1762, 16, 16, 16, 16, 16, 16, 16, 16, + /* 280 */ 16, 16, 16, 1717, 25, 25, 1762, 503, 503, 503, + /* 290 */ 1638, 1765, 1696, 404, 1877, 1681, 1683, 1786, 404, 1399, + /* 300 */ 1717, 503, 1614, 1617, 1614, 1617, 1604, 1727, 1614, 1615, + /* 310 */ 1621, 1646, 1399, 1656, 1658, 1631, 1647, 1653, 1719, 1953, + /* 320 */ 1851, 1680, 1793, 404, 404, 1617, 503, 503, 503, 503, + /* 330 */ 1617, 503, 1796, 404, 503, 1816, 404, 1885, 503, 1807, + /* 340 */ 1816, 404, 682, 404, 1719, 503, 503, 503, 503, 503, + /* 350 */ 503, 503, 503, 503, 503, 503, 503, 503, 503, 503, + /* 360 */ 503, 503, 503, 503, 503, 503, 503, 1904, 503, 1717, + /* 370 */ 404, 1999, 1991, 1762, 3228, 3228, 3228, 3228, 3228, 3228, + /* 380 */ 3228, 3228, 3228, 3228, 3228, 81, 1425, 359, 1684, 391, + /* 390 */ 17, 558, 63, 707, 1492, 231, 724, 588, 588, 588, + /* 400 */ 588, 588, 588, 588, 588, 588, 750, 610, 464, 66, + /* 410 */ 723, 723, 402, 733, 39, 782, 578, 760, 846, 578, + /* 420 */ 889, 802, 1075, 54, 302, 302, 1231, 1113, 964, 1231, + /* 430 */ 1231, 1231, 1398, 1255, 1342, 605, 1151, 696, 1336, 1313, + /* 440 */ 1315, 1317, 1324, 734, 1436, 1441, 1422, 1457, 1458, 1459, + /* 450 */ 1222, 1469, 1481, 8, 1482, 1485, 1487, 1496, 1333, 1357, + /* 460 */ 621, 1483, 1484, 1497, 1530, 1501, 781, 1502, 1489, 1509, + /* 470 */ 1510, 1535, 1538, 1486, 1500, 1560, 1572, 1577, 1593, 1600, + /* 480 */ 1613, 1625, 1630, 1635, 1547, 1558, 1567, 1571, 1607, 1612, + /* 490 */ 429, 1367, 498, 1439, 1596, 1642, 1453, 1669, 2080, 2081, + /* 500 */ 2082, 2038, 2085, 2049, 1847, 2051, 2052, 2053, 1853, 2091, + /* 510 */ 2057, 2058, 1856, 2060, 2098, 1859, 2100, 2064, 2102, 2066, + /* 520 */ 2104, 2083, 2106, 2070, 1874, 2118, 1890, 2112, 1892, 1893, + /* 530 */ 1899, 1903, 2119, 2121, 2122, 1915, 1917, 2126, 2133, 1981, + /* 540 */ 2087, 2088, 2138, 2105, 2139, 2141, 2107, 2093, 2143, 2097, + /* 550 */ 2147, 2103, 2149, 2150, 2151, 2108, 2152, 2158, 2160, 2161, + /* 560 */ 2162, 2171, 1982, 2117, 2173, 2001, 2175, 2176, 2177, 2178, + /* 570 */ 2179, 2180, 2183, 2184, 2185, 2186, 2188, 2189, 2198, 2200, + /* 580 */ 2201, 2202, 2204, 2205, 2206, 2207, 2142, 2192, 2148, 2194, + /* 590 */ 2195, 2196, 2208, 2209, 2211, 2212, 2213, 2214, 2193, 2216, + /* 600 */ 2063, 2218, 2067, 2221, 2071, 2224, 2225, 2215, 2190, 2217, + /* 610 */ 2219, 2227, 2163, 2230, 2167, 2197, 2235, 2170, 2238, 2199, + /* 620 */ 2241, 2242, 2226, 2210, 2222, 2243, 2229, 2220, 2228, 2244, + /* 630 */ 2231, 2223, 2237, 2246, 2234, 2250, 2245, 2247, 2240, 2248, + /* 640 */ 2251, 2253, 2261, 2258, 2249, 2254, 2280, 2287, 2291, 2293, + /* 650 */ 2257, 2090, 2301, 2248, 2259, 2311, 2248, 2263, 2314, 2315, + /* 660 */ 2187, 2316, 2317, 2281, 2267, 2278, 2321, 2285, 2271, 2283, + /* 670 */ 2328, 2292, 2288, 2295, 2339, 2304, 2290, 2302, 2345, 2346, + /* 680 */ 2348, 2349, 2350, 2351, 2232, 2233, 2318, 2334, 2357, 2337, + /* 690 */ 2324, 2325, 2326, 2327, 2329, 2330, 2331, 2332, 2338, 2340, + /* 700 */ 2341, 2342, 2343, 2354, 2344, 2358, 2355, 2365, 2356, 2382, + /* 710 */ 2362, 2347, 2383, 2363, 2353, 2386, 2391, 2392, 2359, 2393, + /* 720 */ 2360, 2394, 2373, 2378, 2366, 2368, 2370, 2286, 2289, 2399, + /* 730 */ 2260, 2182, 2255, 2296, 2236, 2248, 2364, 2411, 2264, 2375, + /* 740 */ 2395, 2414, 2203, 2398, 2268, 2269, 2415, 2416, 2282, 2239, + /* 750 */ 2284, 2270, 2419, 2400, 2123, 2323, 2320, 2335, 2367, 2403, + /* 760 */ 2404, 2369, 2381, 2372, 2387, 2376, 2374, 2420, 2424, 2377, + /* 770 */ 2371, 2379, 2380, 2384, 2435, 2426, 2427, 2388, 2438, 2172, + /* 780 */ 2397, 2385, 2445, 2389, 2442, 2390, 2396, 2483, 2454, 2256, + /* 790 */ 2452, 2457, 2458, 2459, 2460, 2463, 2402, 2405, 2456, 2265, + /* 800 */ 2473, 2462, 2508, 2509, 2401, 2470, 2407, 2418, 2417, 2421, + /* 810 */ 2352, 2423, 2513, 2475, 2413, 2528, 2425, 2428, 2406, 2493, + /* 820 */ 2408, 2505, 2429, 2272, 2431, 2535, 2521, 2303, 2437, 2439, + /* 830 */ 2441, 2446, 2447, 2448, 2449, 2444, 2506, 2450, 2455, 2507, + /* 840 */ 2451, 2545, 2319, 2464, 2465, 2569, 2461, 2466, 2432, 2530, + /* 850 */ 2467, 2469, 2248, 2524, 2468, 2471, 2472, 2474, 2476, 2453, + /* 860 */ 2560, 2563, 2566, 2409, 2479, 2557, 2559, 2484, 2487, 2571, + /* 870 */ 2500, 2502, 2577, 2441, 2503, 2581, 2446, 2514, 2593, 2447, + /* 880 */ 2518, 2596, 2448, 2517, 2519, 2522, 2523, 2526, 2601, 2527, + /* 890 */ 2599, 2529, 2601, 2601, 2615, 2585, 2570, 2633, 2621, 2623, + /* 900 */ 2624, 2625, 2626, 2627, 2628, 2629, 2631, 2632, 2634, 2590, + /* 910 */ 2567, 2597, 2572, 2640, 2639, 2643, 2644, 2669, 2655, 2656, + /* 920 */ 2657, 2616, 2340, 2660, 2341, 2661, 2662, 2663, 2664, 2680, + /* 930 */ 2666, 2704, 2668, 2654, 2665, 2708, 2672, 2658, 2670, 2716, + /* 940 */ 2677, 2667, 2675, 2718, 2683, 2671, 2679, 2722, 2687, 2725, + /* 950 */ 2705, 2689, 2737, 2707, 2697, 2709, 2711, 2712, 2713, 2717, + /* 960 */ 2721, }; #define YY_REDUCE_COUNT (384) -#define YY_REDUCE_MIN (-501) -#define YY_REDUCE_MAX (2503) +#define YY_REDUCE_MIN (-510) +#define YY_REDUCE_MAX (2729) static const short yy_reduce_ofst[] = { - /* 0 */ 586, -335, -147, 251, 408, 437, 622, 674, 758, 878, - /* 10 */ 955, 1134, 1173, 1204, 1243, 1270, 1023, 155, 1437, 1456, - /* 20 */ 1517, 1544, 1594, 1624, 1641, 1662, 1704, 1751, 1814, 1834, - /* 30 */ 1884, 1921, 1945, 1964, 2006, 2030, 2075, 2096, 2113, 2193, - /* 40 */ 2224, 2243, 2274, 2304, 2354, 2381, 2415, 2442, 2465, 2503, - /* 50 */ 166, 792, -456, -32, -353, 426, 526, 860, -294, 842, - /* 60 */ 949, 43, 188, -199, 198, 390, 711, -411, -332, -424, - /* 70 */ -354, -105, 234, -148, 171, -347, -300, -213, -234, 60, - /* 80 */ -383, 159, -140, 148, 342, 348, 434, -296, 306, 486, - /* 90 */ 534, 545, 574, 449, 158, 467, 458, 580, 602, 72, - /* 100 */ -44, 604, 613, 653, -417, 691, 713, 731, 763, 56, - /* 110 */ 771, 789, 404, 797, 113, 459, 529, 806, 280, -501, - /* 120 */ -501, -375, 527, -109, -388, -334, 157, -233, 585, 626, - /* 130 */ 692, 780, 785, 812, 879, 890, 928, 932, 943, 953, - /* 140 */ 954, 960, 963, 964, 965, 969, -359, -319, 641, -73, - /* 150 */ 850, 916, 859, -319, 565, 709, 299, 334, 490, -303, - /* 160 */ 919, 272, 740, 821, 220, 823, -270, 898, 799, 872, - /* 170 */ 958, 918, 974, 1000, 948, 214, 282, 327, 372, 377, - /* 180 */ 412, 427, 712, 597, 987, 956, 956, 680, 1017, 972, - /* 190 */ 1040, 1176, 956, 1164, 1164, 1184, 1189, 1170, 1230, 1174, - /* 200 */ 1101, 1113, 1114, 1193, 1118, 1164, 1264, 1223, 1278, 1251, - /* 210 */ 1217, 1244, 1245, 1164, 1168, 1177, 1158, 1194, 1180, 1294, - /* 220 */ 1252, 1231, 1235, 1246, 1242, 1323, 1250, 1326, 1265, 1342, - /* 230 */ 1351, 1300, 1354, 1302, 1308, 1364, 1359, 1365, 1314, 1316, - /* 240 */ 1325, 1331, 1373, 1378, 1391, 1392, 1383, 1395, 1396, 1397, - /* 250 */ 1406, 1404, 1410, 1405, 1321, 1398, 1399, 1362, 1401, 1411, - /* 260 */ 1340, 1403, 1413, 1407, 1353, 1414, 1367, 1415, 1418, 1421, - /* 270 */ 1420, 1429, 1408, 1422, 1423, 1424, 1425, 1427, 1430, 1431, - /* 280 */ 1432, 1433, 1435, 1434, 1444, 1448, 1440, 1385, 1436, 1438, - /* 290 */ 1344, 1357, 1356, 1451, 1372, 1386, 1388, 1443, 1463, 1400, - /* 300 */ 1471, 1446, 1332, 1445, 1333, 1447, 1334, 1343, 1335, 1345, - /* 310 */ 1348, 1355, 1449, 1368, 1366, 1346, 1358, 1361, 1503, 1455, - /* 320 */ 1384, 1393, 1521, 1520, 1522, 1458, 1480, 1481, 1486, 1489, - /* 330 */ 1477, 1490, 1485, 1543, 1506, 1507, 1548, 1450, 1524, 1511, - /* 340 */ 1513, 1579, 1551, 1580, 1603, 1532, 1535, 1536, 1538, 1545, - /* 350 */ 1547, 1549, 1553, 1554, 1555, 1557, 1571, 1581, 1586, 1588, - /* 360 */ 1590, 1607, 1609, 1610, 1611, 1612, 1613, 1567, 1615, 1605, - /* 370 */ 1602, 1616, 1617, 1622, 1558, 1516, 1542, 1565, 1595, 1620, - /* 380 */ 1636, 1643, 1638, 1628, 1644, + /* 0 */ 338, -376, -147, 157, 186, 415, 439, 586, 672, 708, + /* 10 */ 769, 932, 1083, 1215, 1292, 1325, -352, 1355, 525, 1372, + /* 20 */ 1449, 1466, 1546, 1575, 1636, 1672, 1761, 1790, 1811, 1840, + /* 30 */ 1934, 1951, 1968, 2031, 2111, 2128, 2154, 2191, 2252, 2275, + /* 40 */ 2336, 2361, 2422, 2443, 2504, 2565, 2584, 2645, 2714, 2729, + /* 50 */ -309, 313, -66, -322, 279, 864, 1119, 1363, -191, 1010, + /* 60 */ 1366, 176, -307, -386, -398, -233, 69, -182, -212, -436, + /* 70 */ 99, 93, 265, 47, 387, -382, -265, 183, -294, 383, + /* 80 */ -284, 48, -140, -61, 95, 473, 530, 548, 555, 579, + /* 90 */ 592, 677, 746, 609, 89, 232, 19, 563, 761, 340, + /* 100 */ 87, 763, 514, 787, 421, 799, 817, 829, 831, 538, + /* 110 */ 838, 866, 540, 923, 382, 566, 640, 928, 747, -506, + /* 120 */ -506, -358, -175, -365, 689, -510, 312, -146, 647, 722, + /* 130 */ 737, 797, 818, 833, 837, 840, 887, 896, 905, 931, + /* 140 */ 938, 942, 943, 951, 961, 982, -334, -475, -106, 291, + /* 150 */ 618, 666, 680, -475, -378, 336, 434, 460, 715, -133, + /* 160 */ 865, 234, 749, 835, 960, 966, 779, 906, -92, 902, + /* 170 */ 971, 927, 967, 998, 1038, -415, 469, 561, 568, 637, + /* 180 */ 685, 381, 731, 756, 785, 661, 661, 941, 718, 791, + /* 190 */ 977, 1115, 661, 1102, 1102, 1118, 1128, 1090, 1154, 1092, + /* 200 */ 1008, 1074, 1078, 1188, 1116, 1102, 1262, 1209, 1267, 1225, + /* 210 */ 1194, 1216, 1217, 1102, 1152, 1162, 1125, 1167, 1169, 1277, + /* 220 */ 1233, 1219, 1229, 1243, 1247, 1329, 1256, 1332, 1269, 1347, + /* 230 */ 1348, 1301, 1349, 1303, 1310, 1362, 1364, 1368, 1309, 1326, + /* 240 */ 1327, 1330, 1353, 1370, 1375, 1376, 1378, 1383, 1386, 1387, + /* 250 */ 1397, 1407, 1414, 1412, 1328, 1404, 1405, 1369, 1411, 1421, + /* 260 */ 1359, 1427, 1429, 1431, 1377, 1432, 1388, 1437, 1440, 1452, + /* 270 */ 1444, 1468, 1434, 1435, 1442, 1451, 1454, 1455, 1456, 1461, + /* 280 */ 1464, 1470, 1472, 1488, 1475, 1478, 1477, 1460, 1462, 1463, + /* 290 */ 1394, 1418, 1428, 1491, 1443, 1433, 1445, 1480, 1515, 1465, + /* 300 */ 1517, 1490, 1389, 1467, 1395, 1473, 1384, 1400, 1401, 1416, + /* 310 */ 1408, 1419, 1499, 1446, 1448, 1403, 1424, 1430, 1573, 1495, + /* 320 */ 1447, 1471, 1585, 1581, 1582, 1524, 1550, 1551, 1553, 1554, + /* 330 */ 1526, 1555, 1539, 1598, 1563, 1544, 1602, 1494, 1565, 1557, + /* 340 */ 1556, 1606, 1589, 1611, 1618, 1576, 1578, 1580, 1583, 1584, + /* 350 */ 1586, 1587, 1588, 1590, 1591, 1595, 1599, 1609, 1610, 1616, + /* 360 */ 1619, 1622, 1624, 1627, 1629, 1639, 1640, 1623, 1641, 1634, + /* 370 */ 1620, 1651, 1662, 1650, 1569, 1566, 1574, 1603, 1626, 1643, + /* 380 */ 1664, 1632, 1665, 1654, 1666, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 10 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 20 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 30 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 40 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 50 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 60 */ 2529, 2165, 2165, 2485, 2165, 2165, 2165, 2165, 2165, 2165, - /* 70 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2492, 2165, - /* 80 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 90 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2265, - /* 100 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 110 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2263, 2780, - /* 120 */ 2165, 2906, 2570, 2165, 2165, 2809, 2165, 2165, 2165, 2165, - /* 130 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 140 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2792, 2165, 2165, - /* 150 */ 2236, 2236, 2165, 2792, 2792, 2792, 2752, 2752, 2263, 2165, - /* 160 */ 2165, 2265, 2165, 2572, 2165, 2165, 2165, 2165, 2165, 2165, - /* 170 */ 2165, 2165, 2165, 2403, 2195, 2165, 2165, 2165, 2165, 2165, - /* 180 */ 2165, 2555, 2165, 2165, 2838, 2784, 2785, 2900, 2165, 2841, - /* 190 */ 2803, 2165, 2798, 2165, 2165, 2165, 2165, 2497, 2165, 2828, - /* 200 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2348, - /* 210 */ 2549, 2165, 2165, 2165, 2165, 2165, 2884, 2782, 2822, 2165, - /* 220 */ 2832, 2165, 2597, 2165, 2586, 2265, 2165, 2265, 2542, 2480, - /* 230 */ 2165, 2490, 2165, 2490, 2487, 2165, 2165, 2165, 2490, 2487, - /* 240 */ 2487, 2487, 2337, 2333, 2165, 2165, 2331, 2165, 2165, 2165, - /* 250 */ 2165, 2220, 2165, 2220, 2165, 2265, 2265, 2165, 2265, 2165, - /* 260 */ 2165, 2265, 2165, 2265, 2165, 2265, 2165, 2265, 2265, 2165, - /* 270 */ 2265, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 280 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 290 */ 2584, 2565, 2165, 2263, 2165, 2553, 2551, 2165, 2263, 2832, - /* 300 */ 2165, 2165, 2854, 2849, 2854, 2849, 2868, 2864, 2854, 2873, - /* 310 */ 2870, 2834, 2832, 2815, 2811, 2903, 2890, 2886, 2165, 2165, - /* 320 */ 2820, 2818, 2165, 2263, 2263, 2849, 2165, 2165, 2165, 2165, - /* 330 */ 2849, 2165, 2165, 2263, 2165, 2165, 2263, 2165, 2165, 2165, - /* 340 */ 2165, 2263, 2165, 2263, 2165, 2165, 2165, 2165, 2165, 2165, - /* 350 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 360 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2365, 2165, 2165, - /* 370 */ 2263, 2165, 2204, 2165, 2544, 2570, 2575, 2525, 2525, 2406, - /* 380 */ 2406, 2906, 2406, 2266, 2170, 2165, 2165, 2165, 2165, 2165, - /* 390 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2867, 2866, 2703, - /* 400 */ 2165, 2756, 2755, 2754, 2745, 2702, 2361, 2165, 2165, 2165, - /* 410 */ 2701, 2700, 2165, 2165, 2165, 2165, 2352, 2165, 2165, 2374, - /* 420 */ 2165, 2165, 2165, 2165, 2516, 2515, 2694, 2165, 2165, 2695, - /* 430 */ 2693, 2692, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 440 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 450 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2887, - /* 460 */ 2891, 2165, 2165, 2165, 2781, 2165, 2165, 2165, 2673, 2165, - /* 470 */ 2165, 2165, 2165, 2641, 2636, 2627, 2618, 2633, 2624, 2612, - /* 480 */ 2630, 2621, 2609, 2606, 2165, 2165, 2165, 2165, 2165, 2165, - /* 490 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 500 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 510 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 520 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 530 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2486, - /* 540 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 550 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 560 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 570 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 580 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 590 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 600 */ 2165, 2165, 2165, 2501, 2165, 2165, 2165, 2165, 2165, 2165, - /* 610 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 620 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 630 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2209, 2680, 2165, - /* 640 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 650 */ 2165, 2165, 2683, 2165, 2165, 2684, 2165, 2165, 2165, 2165, - /* 660 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 670 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 680 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 690 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2309, 2308, 2165, - /* 700 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 710 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 720 */ 2165, 2165, 2165, 2165, 2165, 2685, 2165, 2165, 2165, 2165, - /* 730 */ 2569, 2165, 2165, 2675, 2165, 2165, 2165, 2165, 2165, 2165, - /* 740 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 750 */ 2883, 2835, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 760 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 770 */ 2165, 2165, 2165, 2165, 2673, 2165, 2865, 2165, 2165, 2165, - /* 780 */ 2165, 2165, 2165, 2165, 2881, 2165, 2885, 2165, 2165, 2165, - /* 790 */ 2165, 2165, 2165, 2165, 2791, 2787, 2165, 2165, 2783, 2165, - /* 800 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 810 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2742, - /* 820 */ 2165, 2165, 2165, 2776, 2165, 2165, 2165, 2165, 2402, 2401, - /* 830 */ 2400, 2399, 2165, 2165, 2165, 2165, 2165, 2165, 2685, 2165, - /* 840 */ 2688, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 850 */ 2672, 2165, 2727, 2726, 2165, 2165, 2165, 2165, 2165, 2165, - /* 860 */ 2165, 2165, 2165, 2165, 2165, 2396, 2165, 2165, 2165, 2165, - /* 870 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 880 */ 2165, 2380, 2378, 2377, 2376, 2165, 2413, 2165, 2165, 2165, - /* 890 */ 2409, 2408, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 900 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 910 */ 2284, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2276, - /* 920 */ 2165, 2275, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 930 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, - /* 940 */ 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2194, - /* 950 */ 2165, 2165, 2165, 2165, 2165, 2165, + /* 0 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 10 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 20 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 30 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 40 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 50 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 60 */ 2544, 2176, 2176, 2500, 2176, 2176, 2176, 2176, 2176, 2176, + /* 70 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2507, 2176, + /* 80 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 90 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2277, + /* 100 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 110 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2275, 2795, + /* 120 */ 2176, 2921, 2585, 2176, 2176, 2824, 2176, 2176, 2176, 2176, + /* 130 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 140 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2807, 2176, 2176, + /* 150 */ 2248, 2248, 2176, 2807, 2807, 2807, 2767, 2767, 2275, 2176, + /* 160 */ 2176, 2277, 2176, 2587, 2176, 2176, 2176, 2176, 2176, 2176, + /* 170 */ 2176, 2176, 2176, 2417, 2206, 2176, 2176, 2176, 2176, 2176, + /* 180 */ 2176, 2570, 2176, 2176, 2853, 2799, 2800, 2915, 2176, 2856, + /* 190 */ 2818, 2176, 2813, 2176, 2176, 2176, 2176, 2512, 2176, 2843, + /* 200 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2362, + /* 210 */ 2564, 2176, 2176, 2176, 2176, 2176, 2899, 2797, 2837, 2176, + /* 220 */ 2847, 2176, 2612, 2176, 2601, 2277, 2176, 2277, 2557, 2495, + /* 230 */ 2176, 2505, 2176, 2505, 2502, 2176, 2176, 2176, 2505, 2502, + /* 240 */ 2502, 2502, 2351, 2347, 2176, 2176, 2345, 2176, 2176, 2176, + /* 250 */ 2176, 2231, 2176, 2231, 2176, 2277, 2277, 2176, 2277, 2176, + /* 260 */ 2176, 2277, 2176, 2277, 2176, 2277, 2176, 2277, 2277, 2176, + /* 270 */ 2277, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 280 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 290 */ 2599, 2580, 2176, 2275, 2176, 2568, 2566, 2176, 2275, 2847, + /* 300 */ 2176, 2176, 2869, 2864, 2869, 2864, 2883, 2879, 2869, 2888, + /* 310 */ 2885, 2849, 2847, 2830, 2826, 2918, 2905, 2901, 2176, 2176, + /* 320 */ 2835, 2833, 2176, 2275, 2275, 2864, 2176, 2176, 2176, 2176, + /* 330 */ 2864, 2176, 2176, 2275, 2176, 2176, 2275, 2176, 2176, 2176, + /* 340 */ 2176, 2275, 2176, 2275, 2176, 2176, 2176, 2176, 2176, 2176, + /* 350 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 360 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2379, 2176, 2176, + /* 370 */ 2275, 2176, 2215, 2176, 2559, 2585, 2590, 2540, 2540, 2420, + /* 380 */ 2420, 2921, 2420, 2278, 2181, 2176, 2176, 2176, 2176, 2176, + /* 390 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2882, 2881, 2718, + /* 400 */ 2176, 2771, 2770, 2769, 2760, 2717, 2375, 2176, 2176, 2176, + /* 410 */ 2716, 2715, 2176, 2176, 2176, 2176, 2366, 2176, 2176, 2388, + /* 420 */ 2176, 2176, 2176, 2176, 2531, 2530, 2709, 2176, 2176, 2710, + /* 430 */ 2708, 2707, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 440 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 450 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2902, + /* 460 */ 2906, 2176, 2176, 2176, 2796, 2176, 2176, 2176, 2688, 2176, + /* 470 */ 2176, 2176, 2176, 2656, 2651, 2642, 2633, 2648, 2639, 2627, + /* 480 */ 2645, 2636, 2624, 2621, 2176, 2176, 2176, 2176, 2176, 2176, + /* 490 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 500 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 510 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 520 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 530 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2501, + /* 540 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 550 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 560 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 570 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 580 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 590 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 600 */ 2176, 2176, 2176, 2176, 2516, 2176, 2176, 2176, 2176, 2176, + /* 610 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 620 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 630 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2220, 2695, + /* 640 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 650 */ 2176, 2176, 2176, 2698, 2176, 2176, 2699, 2176, 2176, 2176, + /* 660 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 670 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 680 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 690 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2322, + /* 700 */ 2321, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 710 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 720 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2700, 2176, 2176, + /* 730 */ 2176, 2176, 2584, 2176, 2176, 2690, 2176, 2176, 2176, 2176, + /* 740 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 750 */ 2176, 2176, 2898, 2850, 2176, 2176, 2176, 2176, 2176, 2176, + /* 760 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 770 */ 2176, 2176, 2176, 2176, 2176, 2176, 2688, 2176, 2880, 2176, + /* 780 */ 2176, 2176, 2176, 2176, 2176, 2176, 2896, 2176, 2900, 2176, + /* 790 */ 2176, 2176, 2176, 2176, 2176, 2176, 2806, 2802, 2176, 2176, + /* 800 */ 2798, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 810 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 820 */ 2176, 2757, 2176, 2176, 2176, 2791, 2176, 2176, 2176, 2176, + /* 830 */ 2416, 2415, 2414, 2413, 2176, 2176, 2176, 2176, 2176, 2176, + /* 840 */ 2700, 2176, 2703, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 850 */ 2176, 2176, 2687, 2176, 2742, 2741, 2176, 2176, 2176, 2176, + /* 860 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2410, 2176, 2176, + /* 870 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 880 */ 2176, 2176, 2176, 2394, 2392, 2391, 2390, 2176, 2427, 2176, + /* 890 */ 2176, 2176, 2423, 2422, 2176, 2176, 2176, 2176, 2176, 2176, + /* 900 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 910 */ 2176, 2176, 2176, 2296, 2176, 2176, 2176, 2176, 2176, 2176, + /* 920 */ 2176, 2176, 2288, 2176, 2287, 2176, 2176, 2176, 2176, 2176, + /* 930 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 940 */ 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, + /* 950 */ 2176, 2176, 2176, 2176, 2205, 2176, 2176, 2176, 2176, 2176, + /* 960 */ 2176, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1550,6 +1224,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* WRITE => nothing */ 0, /* NK_DOT => nothing */ 0, /* WITH => nothing */ + 0, /* ENCRYPT_KEY => nothing */ 0, /* DNODE => nothing */ 0, /* PORT => nothing */ 0, /* DNODES => nothing */ @@ -1604,11 +1279,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* S3_KEEPLOCAL => nothing */ 0, /* S3_COMPACT => nothing */ 0, /* KEEP_TIME_OFFSET => nothing */ + 0, /* ENCRYPT_ALGORITHM => nothing */ 0, /* NK_COLON => nothing */ 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 322, /* END => ABORT */ + 325, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1666,6 +1342,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* FULL => nothing */ 0, /* LOGS => nothing */ 0, /* MACHINES => nothing */ + 0, /* ENCRYPTIONS => nothing */ 0, /* QUERIES => nothing */ 0, /* SCORES => nothing */ 0, /* TOPICS => nothing */ @@ -1679,7 +1356,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 322, /* VIEW => ABORT */ + 325, /* VIEW => ABORT */ 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ @@ -1722,7 +1399,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* PAUSE => nothing */ 0, /* RESUME => nothing */ 0, /* PRIMARY => nothing */ - 322, /* KEY => ABORT */ + 325, /* KEY => ABORT */ 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ @@ -1786,7 +1463,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* LEFT => nothing */ 0, /* RIGHT => nothing */ 0, /* OUTER => nothing */ - 322, /* SEMI => ABORT */ + 325, /* SEMI => ABORT */ 0, /* ANTI => nothing */ 0, /* ASOF => nothing */ 0, /* WINDOW => nothing */ @@ -1822,53 +1499,53 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 322, /* AFTER => ABORT */ - 322, /* ATTACH => ABORT */ - 322, /* BEFORE => ABORT */ - 322, /* BEGIN => ABORT */ - 322, /* BITAND => ABORT */ - 322, /* BITNOT => ABORT */ - 322, /* BITOR => ABORT */ - 322, /* BLOCKS => ABORT */ - 322, /* CHANGE => ABORT */ - 322, /* COMMA => ABORT */ - 322, /* CONCAT => ABORT */ - 322, /* CONFLICT => ABORT */ - 322, /* COPY => ABORT */ - 322, /* DEFERRED => ABORT */ - 322, /* DELIMITERS => ABORT */ - 322, /* DETACH => ABORT */ - 322, /* DIVIDE => ABORT */ - 322, /* DOT => ABORT */ - 322, /* EACH => ABORT */ - 322, /* FAIL => ABORT */ - 322, /* FILE => ABORT */ - 322, /* FOR => ABORT */ - 322, /* GLOB => ABORT */ - 322, /* ID => ABORT */ - 322, /* IMMEDIATE => ABORT */ - 322, /* IMPORT => ABORT */ - 322, /* INITIALLY => ABORT */ - 322, /* INSTEAD => ABORT */ - 322, /* ISNULL => ABORT */ - 322, /* MODULES => ABORT */ - 322, /* NK_BITNOT => ABORT */ - 322, /* NK_SEMI => ABORT */ - 322, /* NOTNULL => ABORT */ - 322, /* OF => ABORT */ - 322, /* PLUS => ABORT */ - 322, /* PRIVILEGE => ABORT */ - 322, /* RAISE => ABORT */ - 322, /* RESTRICT => ABORT */ - 322, /* ROW => ABORT */ - 322, /* STAR => ABORT */ - 322, /* STATEMENT => ABORT */ - 322, /* STRICT => ABORT */ - 322, /* STRING => ABORT */ - 322, /* TIMES => ABORT */ - 322, /* VALUES => ABORT */ - 322, /* VARIABLE => ABORT */ - 322, /* WAL => ABORT */ + 325, /* AFTER => ABORT */ + 325, /* ATTACH => ABORT */ + 325, /* BEFORE => ABORT */ + 325, /* BEGIN => ABORT */ + 325, /* BITAND => ABORT */ + 325, /* BITNOT => ABORT */ + 325, /* BITOR => ABORT */ + 325, /* BLOCKS => ABORT */ + 325, /* CHANGE => ABORT */ + 325, /* COMMA => ABORT */ + 325, /* CONCAT => ABORT */ + 325, /* CONFLICT => ABORT */ + 325, /* COPY => ABORT */ + 325, /* DEFERRED => ABORT */ + 325, /* DELIMITERS => ABORT */ + 325, /* DETACH => ABORT */ + 325, /* DIVIDE => ABORT */ + 325, /* DOT => ABORT */ + 325, /* EACH => ABORT */ + 325, /* FAIL => ABORT */ + 325, /* FILE => ABORT */ + 325, /* FOR => ABORT */ + 325, /* GLOB => ABORT */ + 325, /* ID => ABORT */ + 325, /* IMMEDIATE => ABORT */ + 325, /* IMPORT => ABORT */ + 325, /* INITIALLY => ABORT */ + 325, /* INSTEAD => ABORT */ + 325, /* ISNULL => ABORT */ + 325, /* MODULES => ABORT */ + 325, /* NK_BITNOT => ABORT */ + 325, /* NK_SEMI => ABORT */ + 325, /* NOTNULL => ABORT */ + 325, /* OF => ABORT */ + 325, /* PLUS => ABORT */ + 325, /* PRIVILEGE => ABORT */ + 325, /* RAISE => ABORT */ + 325, /* RESTRICT => ABORT */ + 325, /* ROW => ABORT */ + 325, /* STAR => ABORT */ + 325, /* STATEMENT => ABORT */ + 325, /* STRICT => ABORT */ + 325, /* STRING => ABORT */ + 325, /* TIMES => ABORT */ + 325, /* VALUES => ABORT */ + 325, /* VARIABLE => ABORT */ + 325, /* WAL => ABORT */ 0, /* ENCODE => nothing */ 0, /* COMPRESS => nothing */ 0, /* LEVEL => nothing */ @@ -1923,7 +1600,6 @@ struct yyParser { }; typedef struct yyParser yyParser; -#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -2011,506 +1687,509 @@ static const char *const yyTokenName[] = { /* 48 */ "WRITE", /* 49 */ "NK_DOT", /* 50 */ "WITH", - /* 51 */ "DNODE", - /* 52 */ "PORT", - /* 53 */ "DNODES", - /* 54 */ "RESTORE", - /* 55 */ "NK_IPTOKEN", - /* 56 */ "FORCE", - /* 57 */ "UNSAFE", - /* 58 */ "CLUSTER", - /* 59 */ "LOCAL", - /* 60 */ "QNODE", - /* 61 */ "BNODE", - /* 62 */ "SNODE", - /* 63 */ "MNODE", - /* 64 */ "VNODE", - /* 65 */ "DATABASE", - /* 66 */ "USE", - /* 67 */ "FLUSH", - /* 68 */ "TRIM", - /* 69 */ "S3MIGRATE", - /* 70 */ "COMPACT", - /* 71 */ "IF", - /* 72 */ "NOT", - /* 73 */ "EXISTS", - /* 74 */ "BUFFER", - /* 75 */ "CACHEMODEL", - /* 76 */ "CACHESIZE", - /* 77 */ "COMP", - /* 78 */ "DURATION", - /* 79 */ "NK_VARIABLE", - /* 80 */ "MAXROWS", - /* 81 */ "MINROWS", - /* 82 */ "KEEP", - /* 83 */ "PAGES", - /* 84 */ "PAGESIZE", - /* 85 */ "TSDB_PAGESIZE", - /* 86 */ "PRECISION", - /* 87 */ "REPLICA", - /* 88 */ "VGROUPS", - /* 89 */ "SINGLE_STABLE", - /* 90 */ "RETENTIONS", - /* 91 */ "SCHEMALESS", - /* 92 */ "WAL_LEVEL", - /* 93 */ "WAL_FSYNC_PERIOD", - /* 94 */ "WAL_RETENTION_PERIOD", - /* 95 */ "WAL_RETENTION_SIZE", - /* 96 */ "WAL_ROLL_PERIOD", - /* 97 */ "WAL_SEGMENT_SIZE", - /* 98 */ "STT_TRIGGER", - /* 99 */ "TABLE_PREFIX", - /* 100 */ "TABLE_SUFFIX", - /* 101 */ "S3_CHUNKSIZE", - /* 102 */ "S3_KEEPLOCAL", - /* 103 */ "S3_COMPACT", - /* 104 */ "KEEP_TIME_OFFSET", - /* 105 */ "NK_COLON", - /* 106 */ "BWLIMIT", - /* 107 */ "START", - /* 108 */ "TIMESTAMP", - /* 109 */ "END", - /* 110 */ "TABLE", - /* 111 */ "NK_LP", - /* 112 */ "NK_RP", - /* 113 */ "STABLE", - /* 114 */ "COLUMN", - /* 115 */ "MODIFY", - /* 116 */ "RENAME", - /* 117 */ "TAG", - /* 118 */ "SET", - /* 119 */ "NK_EQ", - /* 120 */ "USING", - /* 121 */ "TAGS", - /* 122 */ "BOOL", - /* 123 */ "TINYINT", - /* 124 */ "SMALLINT", - /* 125 */ "INT", - /* 126 */ "INTEGER", - /* 127 */ "BIGINT", - /* 128 */ "FLOAT", - /* 129 */ "DOUBLE", - /* 130 */ "BINARY", - /* 131 */ "NCHAR", - /* 132 */ "UNSIGNED", - /* 133 */ "JSON", - /* 134 */ "VARCHAR", - /* 135 */ "MEDIUMBLOB", - /* 136 */ "BLOB", - /* 137 */ "VARBINARY", - /* 138 */ "GEOMETRY", - /* 139 */ "DECIMAL", - /* 140 */ "COMMENT", - /* 141 */ "MAX_DELAY", - /* 142 */ "WATERMARK", - /* 143 */ "ROLLUP", - /* 144 */ "TTL", - /* 145 */ "SMA", - /* 146 */ "DELETE_MARK", - /* 147 */ "FIRST", - /* 148 */ "LAST", - /* 149 */ "SHOW", - /* 150 */ "PRIVILEGES", - /* 151 */ "DATABASES", - /* 152 */ "TABLES", - /* 153 */ "STABLES", - /* 154 */ "MNODES", - /* 155 */ "QNODES", - /* 156 */ "ARBGROUPS", - /* 157 */ "FUNCTIONS", - /* 158 */ "INDEXES", - /* 159 */ "ACCOUNTS", - /* 160 */ "APPS", - /* 161 */ "CONNECTIONS", - /* 162 */ "LICENCES", - /* 163 */ "GRANTS", - /* 164 */ "FULL", - /* 165 */ "LOGS", - /* 166 */ "MACHINES", - /* 167 */ "QUERIES", - /* 168 */ "SCORES", - /* 169 */ "TOPICS", - /* 170 */ "VARIABLES", - /* 171 */ "BNODES", - /* 172 */ "SNODES", - /* 173 */ "TRANSACTIONS", - /* 174 */ "DISTRIBUTED", - /* 175 */ "CONSUMERS", - /* 176 */ "SUBSCRIPTIONS", - /* 177 */ "VNODES", - /* 178 */ "ALIVE", - /* 179 */ "VIEWS", - /* 180 */ "VIEW", - /* 181 */ "COMPACTS", - /* 182 */ "NORMAL", - /* 183 */ "CHILD", - /* 184 */ "LIKE", - /* 185 */ "TBNAME", - /* 186 */ "QTAGS", - /* 187 */ "AS", - /* 188 */ "SYSTEM", - /* 189 */ "TSMA", - /* 190 */ "INTERVAL", - /* 191 */ "RECURSIVE", - /* 192 */ "TSMAS", - /* 193 */ "FUNCTION", - /* 194 */ "INDEX", - /* 195 */ "COUNT", - /* 196 */ "LAST_ROW", - /* 197 */ "META", - /* 198 */ "ONLY", - /* 199 */ "TOPIC", - /* 200 */ "CONSUMER", - /* 201 */ "GROUP", - /* 202 */ "DESC", - /* 203 */ "DESCRIBE", - /* 204 */ "RESET", - /* 205 */ "QUERY", - /* 206 */ "CACHE", - /* 207 */ "EXPLAIN", - /* 208 */ "ANALYZE", - /* 209 */ "VERBOSE", - /* 210 */ "NK_BOOL", - /* 211 */ "RATIO", - /* 212 */ "NK_FLOAT", - /* 213 */ "OUTPUTTYPE", - /* 214 */ "AGGREGATE", - /* 215 */ "BUFSIZE", - /* 216 */ "LANGUAGE", - /* 217 */ "REPLACE", - /* 218 */ "STREAM", - /* 219 */ "INTO", - /* 220 */ "PAUSE", - /* 221 */ "RESUME", - /* 222 */ "PRIMARY", - /* 223 */ "KEY", - /* 224 */ "TRIGGER", - /* 225 */ "AT_ONCE", - /* 226 */ "WINDOW_CLOSE", - /* 227 */ "IGNORE", - /* 228 */ "EXPIRED", - /* 229 */ "FILL_HISTORY", - /* 230 */ "UPDATE", - /* 231 */ "SUBTABLE", - /* 232 */ "UNTREATED", - /* 233 */ "KILL", - /* 234 */ "CONNECTION", - /* 235 */ "TRANSACTION", - /* 236 */ "BALANCE", - /* 237 */ "VGROUP", - /* 238 */ "LEADER", - /* 239 */ "MERGE", - /* 240 */ "REDISTRIBUTE", - /* 241 */ "SPLIT", - /* 242 */ "DELETE", - /* 243 */ "INSERT", - /* 244 */ "NK_BIN", - /* 245 */ "NK_HEX", - /* 246 */ "NULL", - /* 247 */ "NK_QUESTION", - /* 248 */ "NK_ALIAS", - /* 249 */ "NK_ARROW", - /* 250 */ "ROWTS", - /* 251 */ "QSTART", - /* 252 */ "QEND", - /* 253 */ "QDURATION", - /* 254 */ "WSTART", - /* 255 */ "WEND", - /* 256 */ "WDURATION", - /* 257 */ "IROWTS", - /* 258 */ "ISFILLED", - /* 259 */ "CAST", - /* 260 */ "NOW", - /* 261 */ "TODAY", - /* 262 */ "TIMEZONE", - /* 263 */ "CLIENT_VERSION", - /* 264 */ "SERVER_VERSION", - /* 265 */ "SERVER_STATUS", - /* 266 */ "CURRENT_USER", - /* 267 */ "CASE", - /* 268 */ "WHEN", - /* 269 */ "THEN", - /* 270 */ "ELSE", - /* 271 */ "BETWEEN", - /* 272 */ "IS", - /* 273 */ "NK_LT", - /* 274 */ "NK_GT", - /* 275 */ "NK_LE", - /* 276 */ "NK_GE", - /* 277 */ "NK_NE", - /* 278 */ "MATCH", - /* 279 */ "NMATCH", - /* 280 */ "CONTAINS", - /* 281 */ "IN", - /* 282 */ "JOIN", - /* 283 */ "INNER", - /* 284 */ "LEFT", - /* 285 */ "RIGHT", - /* 286 */ "OUTER", - /* 287 */ "SEMI", - /* 288 */ "ANTI", - /* 289 */ "ASOF", - /* 290 */ "WINDOW", - /* 291 */ "WINDOW_OFFSET", - /* 292 */ "JLIMIT", - /* 293 */ "SELECT", - /* 294 */ "NK_HINT", - /* 295 */ "DISTINCT", - /* 296 */ "WHERE", - /* 297 */ "PARTITION", - /* 298 */ "BY", - /* 299 */ "SESSION", - /* 300 */ "STATE_WINDOW", - /* 301 */ "EVENT_WINDOW", - /* 302 */ "COUNT_WINDOW", - /* 303 */ "SLIDING", - /* 304 */ "FILL", - /* 305 */ "VALUE", - /* 306 */ "VALUE_F", - /* 307 */ "NONE", - /* 308 */ "PREV", - /* 309 */ "NULL_F", - /* 310 */ "LINEAR", - /* 311 */ "NEXT", - /* 312 */ "HAVING", - /* 313 */ "RANGE", - /* 314 */ "EVERY", - /* 315 */ "ORDER", - /* 316 */ "SLIMIT", - /* 317 */ "SOFFSET", - /* 318 */ "LIMIT", - /* 319 */ "OFFSET", - /* 320 */ "ASC", - /* 321 */ "NULLS", - /* 322 */ "ABORT", - /* 323 */ "AFTER", - /* 324 */ "ATTACH", - /* 325 */ "BEFORE", - /* 326 */ "BEGIN", - /* 327 */ "BITAND", - /* 328 */ "BITNOT", - /* 329 */ "BITOR", - /* 330 */ "BLOCKS", - /* 331 */ "CHANGE", - /* 332 */ "COMMA", - /* 333 */ "CONCAT", - /* 334 */ "CONFLICT", - /* 335 */ "COPY", - /* 336 */ "DEFERRED", - /* 337 */ "DELIMITERS", - /* 338 */ "DETACH", - /* 339 */ "DIVIDE", - /* 340 */ "DOT", - /* 341 */ "EACH", - /* 342 */ "FAIL", - /* 343 */ "FILE", - /* 344 */ "FOR", - /* 345 */ "GLOB", - /* 346 */ "ID", - /* 347 */ "IMMEDIATE", - /* 348 */ "IMPORT", - /* 349 */ "INITIALLY", - /* 350 */ "INSTEAD", - /* 351 */ "ISNULL", - /* 352 */ "MODULES", - /* 353 */ "NK_BITNOT", - /* 354 */ "NK_SEMI", - /* 355 */ "NOTNULL", - /* 356 */ "OF", - /* 357 */ "PLUS", - /* 358 */ "PRIVILEGE", - /* 359 */ "RAISE", - /* 360 */ "RESTRICT", - /* 361 */ "ROW", - /* 362 */ "STAR", - /* 363 */ "STATEMENT", - /* 364 */ "STRICT", - /* 365 */ "STRING", - /* 366 */ "TIMES", - /* 367 */ "VALUES", - /* 368 */ "VARIABLE", - /* 369 */ "WAL", - /* 370 */ "ENCODE", - /* 371 */ "COMPRESS", - /* 372 */ "LEVEL", - /* 373 */ "cmd", - /* 374 */ "account_options", - /* 375 */ "alter_account_options", - /* 376 */ "literal", - /* 377 */ "alter_account_option", - /* 378 */ "ip_range_list", - /* 379 */ "white_list", - /* 380 */ "white_list_opt", - /* 381 */ "user_name", - /* 382 */ "sysinfo_opt", - /* 383 */ "privileges", - /* 384 */ "priv_level", - /* 385 */ "with_opt", - /* 386 */ "priv_type_list", - /* 387 */ "priv_type", - /* 388 */ "db_name", - /* 389 */ "table_name", - /* 390 */ "topic_name", - /* 391 */ "search_condition", - /* 392 */ "dnode_endpoint", - /* 393 */ "force_opt", - /* 394 */ "unsafe_opt", - /* 395 */ "not_exists_opt", - /* 396 */ "db_options", - /* 397 */ "exists_opt", - /* 398 */ "alter_db_options", - /* 399 */ "speed_opt", - /* 400 */ "start_opt", - /* 401 */ "end_opt", - /* 402 */ "integer_list", - /* 403 */ "variable_list", - /* 404 */ "retention_list", - /* 405 */ "signed", - /* 406 */ "alter_db_option", - /* 407 */ "retention", - /* 408 */ "full_table_name", - /* 409 */ "column_def_list", - /* 410 */ "tags_def_opt", - /* 411 */ "table_options", - /* 412 */ "multi_create_clause", - /* 413 */ "tags_def", - /* 414 */ "multi_drop_clause", - /* 415 */ "alter_table_clause", - /* 416 */ "alter_table_options", - /* 417 */ "column_name", - /* 418 */ "type_name", - /* 419 */ "column_options", - /* 420 */ "tags_literal", - /* 421 */ "create_subtable_clause", - /* 422 */ "specific_cols_opt", - /* 423 */ "tags_literal_list", - /* 424 */ "drop_table_clause", - /* 425 */ "col_name_list", - /* 426 */ "tag_def_list", - /* 427 */ "tag_def", - /* 428 */ "column_def", - /* 429 */ "type_name_default_len", - /* 430 */ "duration_list", - /* 431 */ "rollup_func_list", - /* 432 */ "alter_table_option", - /* 433 */ "duration_literal", - /* 434 */ "rollup_func_name", - /* 435 */ "function_name", - /* 436 */ "col_name", - /* 437 */ "db_kind_opt", - /* 438 */ "table_kind_db_name_cond_opt", - /* 439 */ "like_pattern_opt", - /* 440 */ "db_name_cond_opt", - /* 441 */ "table_name_cond", - /* 442 */ "from_db_opt", - /* 443 */ "tag_list_opt", - /* 444 */ "table_kind", - /* 445 */ "tag_item", - /* 446 */ "column_alias", - /* 447 */ "tsma_name", - /* 448 */ "tsma_func_list", - /* 449 */ "full_tsma_name", - /* 450 */ "func_list", - /* 451 */ "index_options", - /* 452 */ "full_index_name", - /* 453 */ "index_name", - /* 454 */ "sliding_opt", - /* 455 */ "sma_stream_opt", - /* 456 */ "func", - /* 457 */ "sma_func_name", - /* 458 */ "expression_list", - /* 459 */ "with_meta", - /* 460 */ "query_or_subquery", - /* 461 */ "where_clause_opt", - /* 462 */ "cgroup_name", - /* 463 */ "analyze_opt", - /* 464 */ "explain_options", - /* 465 */ "insert_query", - /* 466 */ "or_replace_opt", - /* 467 */ "agg_func_opt", - /* 468 */ "bufsize_opt", - /* 469 */ "language_opt", - /* 470 */ "full_view_name", - /* 471 */ "view_name", - /* 472 */ "stream_name", - /* 473 */ "stream_options", - /* 474 */ "col_list_opt", - /* 475 */ "tag_def_or_ref_opt", - /* 476 */ "subtable_opt", - /* 477 */ "ignore_opt", - /* 478 */ "column_stream_def_list", - /* 479 */ "column_stream_def", - /* 480 */ "stream_col_options", - /* 481 */ "expression", - /* 482 */ "on_vgroup_id", - /* 483 */ "dnode_list", - /* 484 */ "literal_func", - /* 485 */ "signed_literal", - /* 486 */ "literal_list", - /* 487 */ "table_alias", - /* 488 */ "expr_or_subquery", - /* 489 */ "pseudo_column", - /* 490 */ "column_reference", - /* 491 */ "function_expression", - /* 492 */ "case_when_expression", - /* 493 */ "star_func", - /* 494 */ "star_func_para_list", - /* 495 */ "noarg_func", - /* 496 */ "other_para_list", - /* 497 */ "star_func_para", - /* 498 */ "when_then_list", - /* 499 */ "case_when_else_opt", - /* 500 */ "common_expression", - /* 501 */ "when_then_expr", - /* 502 */ "predicate", - /* 503 */ "compare_op", - /* 504 */ "in_op", - /* 505 */ "in_predicate_value", - /* 506 */ "boolean_value_expression", - /* 507 */ "boolean_primary", - /* 508 */ "from_clause_opt", - /* 509 */ "table_reference_list", - /* 510 */ "table_reference", - /* 511 */ "table_primary", - /* 512 */ "joined_table", - /* 513 */ "alias_opt", - /* 514 */ "subquery", - /* 515 */ "parenthesized_joined_table", - /* 516 */ "join_type", - /* 517 */ "join_subtype", - /* 518 */ "join_on_clause_opt", - /* 519 */ "window_offset_clause_opt", - /* 520 */ "jlimit_clause_opt", - /* 521 */ "window_offset_literal", - /* 522 */ "query_specification", - /* 523 */ "hint_list", - /* 524 */ "set_quantifier_opt", - /* 525 */ "tag_mode_opt", - /* 526 */ "select_list", - /* 527 */ "partition_by_clause_opt", - /* 528 */ "range_opt", - /* 529 */ "every_opt", - /* 530 */ "fill_opt", - /* 531 */ "twindow_clause_opt", - /* 532 */ "group_by_clause_opt", - /* 533 */ "having_clause_opt", - /* 534 */ "select_item", - /* 535 */ "partition_list", - /* 536 */ "partition_item", - /* 537 */ "interval_sliding_duration_literal", - /* 538 */ "fill_mode", - /* 539 */ "group_by_list", - /* 540 */ "query_expression", - /* 541 */ "query_simple", - /* 542 */ "order_by_clause_opt", - /* 543 */ "slimit_clause_opt", - /* 544 */ "limit_clause_opt", - /* 545 */ "union_query_expression", - /* 546 */ "query_simple_or_subquery", - /* 547 */ "sort_specification_list", - /* 548 */ "sort_specification", - /* 549 */ "ordering_specification_opt", - /* 550 */ "null_ordering_opt", + /* 51 */ "ENCRYPT_KEY", + /* 52 */ "DNODE", + /* 53 */ "PORT", + /* 54 */ "DNODES", + /* 55 */ "RESTORE", + /* 56 */ "NK_IPTOKEN", + /* 57 */ "FORCE", + /* 58 */ "UNSAFE", + /* 59 */ "CLUSTER", + /* 60 */ "LOCAL", + /* 61 */ "QNODE", + /* 62 */ "BNODE", + /* 63 */ "SNODE", + /* 64 */ "MNODE", + /* 65 */ "VNODE", + /* 66 */ "DATABASE", + /* 67 */ "USE", + /* 68 */ "FLUSH", + /* 69 */ "TRIM", + /* 70 */ "S3MIGRATE", + /* 71 */ "COMPACT", + /* 72 */ "IF", + /* 73 */ "NOT", + /* 74 */ "EXISTS", + /* 75 */ "BUFFER", + /* 76 */ "CACHEMODEL", + /* 77 */ "CACHESIZE", + /* 78 */ "COMP", + /* 79 */ "DURATION", + /* 80 */ "NK_VARIABLE", + /* 81 */ "MAXROWS", + /* 82 */ "MINROWS", + /* 83 */ "KEEP", + /* 84 */ "PAGES", + /* 85 */ "PAGESIZE", + /* 86 */ "TSDB_PAGESIZE", + /* 87 */ "PRECISION", + /* 88 */ "REPLICA", + /* 89 */ "VGROUPS", + /* 90 */ "SINGLE_STABLE", + /* 91 */ "RETENTIONS", + /* 92 */ "SCHEMALESS", + /* 93 */ "WAL_LEVEL", + /* 94 */ "WAL_FSYNC_PERIOD", + /* 95 */ "WAL_RETENTION_PERIOD", + /* 96 */ "WAL_RETENTION_SIZE", + /* 97 */ "WAL_ROLL_PERIOD", + /* 98 */ "WAL_SEGMENT_SIZE", + /* 99 */ "STT_TRIGGER", + /* 100 */ "TABLE_PREFIX", + /* 101 */ "TABLE_SUFFIX", + /* 102 */ "S3_CHUNKSIZE", + /* 103 */ "S3_KEEPLOCAL", + /* 104 */ "S3_COMPACT", + /* 105 */ "KEEP_TIME_OFFSET", + /* 106 */ "ENCRYPT_ALGORITHM", + /* 107 */ "NK_COLON", + /* 108 */ "BWLIMIT", + /* 109 */ "START", + /* 110 */ "TIMESTAMP", + /* 111 */ "END", + /* 112 */ "TABLE", + /* 113 */ "NK_LP", + /* 114 */ "NK_RP", + /* 115 */ "STABLE", + /* 116 */ "COLUMN", + /* 117 */ "MODIFY", + /* 118 */ "RENAME", + /* 119 */ "TAG", + /* 120 */ "SET", + /* 121 */ "NK_EQ", + /* 122 */ "USING", + /* 123 */ "TAGS", + /* 124 */ "BOOL", + /* 125 */ "TINYINT", + /* 126 */ "SMALLINT", + /* 127 */ "INT", + /* 128 */ "INTEGER", + /* 129 */ "BIGINT", + /* 130 */ "FLOAT", + /* 131 */ "DOUBLE", + /* 132 */ "BINARY", + /* 133 */ "NCHAR", + /* 134 */ "UNSIGNED", + /* 135 */ "JSON", + /* 136 */ "VARCHAR", + /* 137 */ "MEDIUMBLOB", + /* 138 */ "BLOB", + /* 139 */ "VARBINARY", + /* 140 */ "GEOMETRY", + /* 141 */ "DECIMAL", + /* 142 */ "COMMENT", + /* 143 */ "MAX_DELAY", + /* 144 */ "WATERMARK", + /* 145 */ "ROLLUP", + /* 146 */ "TTL", + /* 147 */ "SMA", + /* 148 */ "DELETE_MARK", + /* 149 */ "FIRST", + /* 150 */ "LAST", + /* 151 */ "SHOW", + /* 152 */ "PRIVILEGES", + /* 153 */ "DATABASES", + /* 154 */ "TABLES", + /* 155 */ "STABLES", + /* 156 */ "MNODES", + /* 157 */ "QNODES", + /* 158 */ "ARBGROUPS", + /* 159 */ "FUNCTIONS", + /* 160 */ "INDEXES", + /* 161 */ "ACCOUNTS", + /* 162 */ "APPS", + /* 163 */ "CONNECTIONS", + /* 164 */ "LICENCES", + /* 165 */ "GRANTS", + /* 166 */ "FULL", + /* 167 */ "LOGS", + /* 168 */ "MACHINES", + /* 169 */ "ENCRYPTIONS", + /* 170 */ "QUERIES", + /* 171 */ "SCORES", + /* 172 */ "TOPICS", + /* 173 */ "VARIABLES", + /* 174 */ "BNODES", + /* 175 */ "SNODES", + /* 176 */ "TRANSACTIONS", + /* 177 */ "DISTRIBUTED", + /* 178 */ "CONSUMERS", + /* 179 */ "SUBSCRIPTIONS", + /* 180 */ "VNODES", + /* 181 */ "ALIVE", + /* 182 */ "VIEWS", + /* 183 */ "VIEW", + /* 184 */ "COMPACTS", + /* 185 */ "NORMAL", + /* 186 */ "CHILD", + /* 187 */ "LIKE", + /* 188 */ "TBNAME", + /* 189 */ "QTAGS", + /* 190 */ "AS", + /* 191 */ "SYSTEM", + /* 192 */ "TSMA", + /* 193 */ "INTERVAL", + /* 194 */ "RECURSIVE", + /* 195 */ "TSMAS", + /* 196 */ "FUNCTION", + /* 197 */ "INDEX", + /* 198 */ "COUNT", + /* 199 */ "LAST_ROW", + /* 200 */ "META", + /* 201 */ "ONLY", + /* 202 */ "TOPIC", + /* 203 */ "CONSUMER", + /* 204 */ "GROUP", + /* 205 */ "DESC", + /* 206 */ "DESCRIBE", + /* 207 */ "RESET", + /* 208 */ "QUERY", + /* 209 */ "CACHE", + /* 210 */ "EXPLAIN", + /* 211 */ "ANALYZE", + /* 212 */ "VERBOSE", + /* 213 */ "NK_BOOL", + /* 214 */ "RATIO", + /* 215 */ "NK_FLOAT", + /* 216 */ "OUTPUTTYPE", + /* 217 */ "AGGREGATE", + /* 218 */ "BUFSIZE", + /* 219 */ "LANGUAGE", + /* 220 */ "REPLACE", + /* 221 */ "STREAM", + /* 222 */ "INTO", + /* 223 */ "PAUSE", + /* 224 */ "RESUME", + /* 225 */ "PRIMARY", + /* 226 */ "KEY", + /* 227 */ "TRIGGER", + /* 228 */ "AT_ONCE", + /* 229 */ "WINDOW_CLOSE", + /* 230 */ "IGNORE", + /* 231 */ "EXPIRED", + /* 232 */ "FILL_HISTORY", + /* 233 */ "UPDATE", + /* 234 */ "SUBTABLE", + /* 235 */ "UNTREATED", + /* 236 */ "KILL", + /* 237 */ "CONNECTION", + /* 238 */ "TRANSACTION", + /* 239 */ "BALANCE", + /* 240 */ "VGROUP", + /* 241 */ "LEADER", + /* 242 */ "MERGE", + /* 243 */ "REDISTRIBUTE", + /* 244 */ "SPLIT", + /* 245 */ "DELETE", + /* 246 */ "INSERT", + /* 247 */ "NK_BIN", + /* 248 */ "NK_HEX", + /* 249 */ "NULL", + /* 250 */ "NK_QUESTION", + /* 251 */ "NK_ALIAS", + /* 252 */ "NK_ARROW", + /* 253 */ "ROWTS", + /* 254 */ "QSTART", + /* 255 */ "QEND", + /* 256 */ "QDURATION", + /* 257 */ "WSTART", + /* 258 */ "WEND", + /* 259 */ "WDURATION", + /* 260 */ "IROWTS", + /* 261 */ "ISFILLED", + /* 262 */ "CAST", + /* 263 */ "NOW", + /* 264 */ "TODAY", + /* 265 */ "TIMEZONE", + /* 266 */ "CLIENT_VERSION", + /* 267 */ "SERVER_VERSION", + /* 268 */ "SERVER_STATUS", + /* 269 */ "CURRENT_USER", + /* 270 */ "CASE", + /* 271 */ "WHEN", + /* 272 */ "THEN", + /* 273 */ "ELSE", + /* 274 */ "BETWEEN", + /* 275 */ "IS", + /* 276 */ "NK_LT", + /* 277 */ "NK_GT", + /* 278 */ "NK_LE", + /* 279 */ "NK_GE", + /* 280 */ "NK_NE", + /* 281 */ "MATCH", + /* 282 */ "NMATCH", + /* 283 */ "CONTAINS", + /* 284 */ "IN", + /* 285 */ "JOIN", + /* 286 */ "INNER", + /* 287 */ "LEFT", + /* 288 */ "RIGHT", + /* 289 */ "OUTER", + /* 290 */ "SEMI", + /* 291 */ "ANTI", + /* 292 */ "ASOF", + /* 293 */ "WINDOW", + /* 294 */ "WINDOW_OFFSET", + /* 295 */ "JLIMIT", + /* 296 */ "SELECT", + /* 297 */ "NK_HINT", + /* 298 */ "DISTINCT", + /* 299 */ "WHERE", + /* 300 */ "PARTITION", + /* 301 */ "BY", + /* 302 */ "SESSION", + /* 303 */ "STATE_WINDOW", + /* 304 */ "EVENT_WINDOW", + /* 305 */ "COUNT_WINDOW", + /* 306 */ "SLIDING", + /* 307 */ "FILL", + /* 308 */ "VALUE", + /* 309 */ "VALUE_F", + /* 310 */ "NONE", + /* 311 */ "PREV", + /* 312 */ "NULL_F", + /* 313 */ "LINEAR", + /* 314 */ "NEXT", + /* 315 */ "HAVING", + /* 316 */ "RANGE", + /* 317 */ "EVERY", + /* 318 */ "ORDER", + /* 319 */ "SLIMIT", + /* 320 */ "SOFFSET", + /* 321 */ "LIMIT", + /* 322 */ "OFFSET", + /* 323 */ "ASC", + /* 324 */ "NULLS", + /* 325 */ "ABORT", + /* 326 */ "AFTER", + /* 327 */ "ATTACH", + /* 328 */ "BEFORE", + /* 329 */ "BEGIN", + /* 330 */ "BITAND", + /* 331 */ "BITNOT", + /* 332 */ "BITOR", + /* 333 */ "BLOCKS", + /* 334 */ "CHANGE", + /* 335 */ "COMMA", + /* 336 */ "CONCAT", + /* 337 */ "CONFLICT", + /* 338 */ "COPY", + /* 339 */ "DEFERRED", + /* 340 */ "DELIMITERS", + /* 341 */ "DETACH", + /* 342 */ "DIVIDE", + /* 343 */ "DOT", + /* 344 */ "EACH", + /* 345 */ "FAIL", + /* 346 */ "FILE", + /* 347 */ "FOR", + /* 348 */ "GLOB", + /* 349 */ "ID", + /* 350 */ "IMMEDIATE", + /* 351 */ "IMPORT", + /* 352 */ "INITIALLY", + /* 353 */ "INSTEAD", + /* 354 */ "ISNULL", + /* 355 */ "MODULES", + /* 356 */ "NK_BITNOT", + /* 357 */ "NK_SEMI", + /* 358 */ "NOTNULL", + /* 359 */ "OF", + /* 360 */ "PLUS", + /* 361 */ "PRIVILEGE", + /* 362 */ "RAISE", + /* 363 */ "RESTRICT", + /* 364 */ "ROW", + /* 365 */ "STAR", + /* 366 */ "STATEMENT", + /* 367 */ "STRICT", + /* 368 */ "STRING", + /* 369 */ "TIMES", + /* 370 */ "VALUES", + /* 371 */ "VARIABLE", + /* 372 */ "WAL", + /* 373 */ "ENCODE", + /* 374 */ "COMPRESS", + /* 375 */ "LEVEL", + /* 376 */ "cmd", + /* 377 */ "account_options", + /* 378 */ "alter_account_options", + /* 379 */ "literal", + /* 380 */ "alter_account_option", + /* 381 */ "ip_range_list", + /* 382 */ "white_list", + /* 383 */ "white_list_opt", + /* 384 */ "user_name", + /* 385 */ "sysinfo_opt", + /* 386 */ "privileges", + /* 387 */ "priv_level", + /* 388 */ "with_opt", + /* 389 */ "priv_type_list", + /* 390 */ "priv_type", + /* 391 */ "db_name", + /* 392 */ "table_name", + /* 393 */ "topic_name", + /* 394 */ "search_condition", + /* 395 */ "dnode_endpoint", + /* 396 */ "force_opt", + /* 397 */ "unsafe_opt", + /* 398 */ "not_exists_opt", + /* 399 */ "db_options", + /* 400 */ "exists_opt", + /* 401 */ "alter_db_options", + /* 402 */ "speed_opt", + /* 403 */ "start_opt", + /* 404 */ "end_opt", + /* 405 */ "integer_list", + /* 406 */ "variable_list", + /* 407 */ "retention_list", + /* 408 */ "signed", + /* 409 */ "alter_db_option", + /* 410 */ "retention", + /* 411 */ "full_table_name", + /* 412 */ "column_def_list", + /* 413 */ "tags_def_opt", + /* 414 */ "table_options", + /* 415 */ "multi_create_clause", + /* 416 */ "tags_def", + /* 417 */ "multi_drop_clause", + /* 418 */ "alter_table_clause", + /* 419 */ "alter_table_options", + /* 420 */ "column_name", + /* 421 */ "type_name", + /* 422 */ "column_options", + /* 423 */ "tags_literal", + /* 424 */ "create_subtable_clause", + /* 425 */ "specific_cols_opt", + /* 426 */ "tags_literal_list", + /* 427 */ "drop_table_clause", + /* 428 */ "col_name_list", + /* 429 */ "tag_def_list", + /* 430 */ "tag_def", + /* 431 */ "column_def", + /* 432 */ "type_name_default_len", + /* 433 */ "duration_list", + /* 434 */ "rollup_func_list", + /* 435 */ "alter_table_option", + /* 436 */ "duration_literal", + /* 437 */ "rollup_func_name", + /* 438 */ "function_name", + /* 439 */ "col_name", + /* 440 */ "db_kind_opt", + /* 441 */ "table_kind_db_name_cond_opt", + /* 442 */ "like_pattern_opt", + /* 443 */ "db_name_cond_opt", + /* 444 */ "table_name_cond", + /* 445 */ "from_db_opt", + /* 446 */ "tag_list_opt", + /* 447 */ "table_kind", + /* 448 */ "tag_item", + /* 449 */ "column_alias", + /* 450 */ "tsma_name", + /* 451 */ "tsma_func_list", + /* 452 */ "full_tsma_name", + /* 453 */ "func_list", + /* 454 */ "index_options", + /* 455 */ "full_index_name", + /* 456 */ "index_name", + /* 457 */ "sliding_opt", + /* 458 */ "sma_stream_opt", + /* 459 */ "func", + /* 460 */ "sma_func_name", + /* 461 */ "expression_list", + /* 462 */ "with_meta", + /* 463 */ "query_or_subquery", + /* 464 */ "where_clause_opt", + /* 465 */ "cgroup_name", + /* 466 */ "analyze_opt", + /* 467 */ "explain_options", + /* 468 */ "insert_query", + /* 469 */ "or_replace_opt", + /* 470 */ "agg_func_opt", + /* 471 */ "bufsize_opt", + /* 472 */ "language_opt", + /* 473 */ "full_view_name", + /* 474 */ "view_name", + /* 475 */ "stream_name", + /* 476 */ "stream_options", + /* 477 */ "col_list_opt", + /* 478 */ "tag_def_or_ref_opt", + /* 479 */ "subtable_opt", + /* 480 */ "ignore_opt", + /* 481 */ "column_stream_def_list", + /* 482 */ "column_stream_def", + /* 483 */ "stream_col_options", + /* 484 */ "expression", + /* 485 */ "on_vgroup_id", + /* 486 */ "dnode_list", + /* 487 */ "literal_func", + /* 488 */ "signed_literal", + /* 489 */ "literal_list", + /* 490 */ "table_alias", + /* 491 */ "expr_or_subquery", + /* 492 */ "pseudo_column", + /* 493 */ "column_reference", + /* 494 */ "function_expression", + /* 495 */ "case_when_expression", + /* 496 */ "star_func", + /* 497 */ "star_func_para_list", + /* 498 */ "noarg_func", + /* 499 */ "other_para_list", + /* 500 */ "star_func_para", + /* 501 */ "when_then_list", + /* 502 */ "case_when_else_opt", + /* 503 */ "common_expression", + /* 504 */ "when_then_expr", + /* 505 */ "predicate", + /* 506 */ "compare_op", + /* 507 */ "in_op", + /* 508 */ "in_predicate_value", + /* 509 */ "boolean_value_expression", + /* 510 */ "boolean_primary", + /* 511 */ "from_clause_opt", + /* 512 */ "table_reference_list", + /* 513 */ "table_reference", + /* 514 */ "table_primary", + /* 515 */ "joined_table", + /* 516 */ "alias_opt", + /* 517 */ "subquery", + /* 518 */ "parenthesized_joined_table", + /* 519 */ "join_type", + /* 520 */ "join_subtype", + /* 521 */ "join_on_clause_opt", + /* 522 */ "window_offset_clause_opt", + /* 523 */ "jlimit_clause_opt", + /* 524 */ "window_offset_literal", + /* 525 */ "query_specification", + /* 526 */ "hint_list", + /* 527 */ "set_quantifier_opt", + /* 528 */ "tag_mode_opt", + /* 529 */ "select_list", + /* 530 */ "partition_by_clause_opt", + /* 531 */ "range_opt", + /* 532 */ "every_opt", + /* 533 */ "fill_opt", + /* 534 */ "twindow_clause_opt", + /* 535 */ "group_by_clause_opt", + /* 536 */ "having_clause_opt", + /* 537 */ "select_item", + /* 538 */ "partition_list", + /* 539 */ "partition_item", + /* 540 */ "interval_sliding_duration_literal", + /* 541 */ "fill_mode", + /* 542 */ "group_by_list", + /* 543 */ "query_expression", + /* 544 */ "query_simple", + /* 545 */ "order_by_clause_opt", + /* 546 */ "slimit_clause_opt", + /* 547 */ "limit_clause_opt", + /* 548 */ "union_query_expression", + /* 549 */ "query_simple_or_subquery", + /* 550 */ "sort_specification_list", + /* 551 */ "sort_specification", + /* 552 */ "ordering_specification_opt", + /* 553 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2572,695 +2251,699 @@ static const char *const yyRuleName[] = { /* 51 */ "priv_level ::= topic_name", /* 52 */ "with_opt ::=", /* 53 */ "with_opt ::= WITH search_condition", - /* 54 */ "cmd ::= CREATE DNODE dnode_endpoint", - /* 55 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", - /* 56 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", - /* 57 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", - /* 58 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt", - /* 59 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt", - /* 60 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", - /* 61 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", - /* 62 */ "cmd ::= ALTER ALL DNODES NK_STRING", - /* 63 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", - /* 64 */ "cmd ::= RESTORE DNODE NK_INTEGER", - /* 65 */ "dnode_endpoint ::= NK_STRING", - /* 66 */ "dnode_endpoint ::= NK_ID", - /* 67 */ "dnode_endpoint ::= NK_IPTOKEN", - /* 68 */ "force_opt ::=", - /* 69 */ "force_opt ::= FORCE", - /* 70 */ "unsafe_opt ::= UNSAFE", - /* 71 */ "cmd ::= ALTER CLUSTER NK_STRING", - /* 72 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING", - /* 73 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 74 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 75 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 76 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 77 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", - /* 78 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 79 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 80 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 81 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 82 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 83 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 84 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", - /* 85 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", - /* 86 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 87 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 88 */ "cmd ::= USE db_name", - /* 89 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 90 */ "cmd ::= FLUSH DATABASE db_name", - /* 91 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 92 */ "cmd ::= S3MIGRATE DATABASE db_name", - /* 93 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 94 */ "not_exists_opt ::= IF NOT EXISTS", - /* 95 */ "not_exists_opt ::=", - /* 96 */ "exists_opt ::= IF EXISTS", - /* 97 */ "exists_opt ::=", - /* 98 */ "db_options ::=", - /* 99 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 100 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 101 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 102 */ "db_options ::= db_options COMP NK_INTEGER", - /* 103 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 104 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 105 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 106 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 107 */ "db_options ::= db_options KEEP integer_list", - /* 108 */ "db_options ::= db_options KEEP variable_list", - /* 109 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 110 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 111 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 112 */ "db_options ::= db_options PRECISION NK_STRING", - /* 113 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 114 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 115 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 116 */ "db_options ::= db_options RETENTIONS retention_list", - /* 117 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 118 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 119 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 120 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 121 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 122 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 123 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 124 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 125 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 126 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 127 */ "db_options ::= db_options TABLE_PREFIX signed", - /* 128 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 129 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER", - /* 130 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER", - /* 131 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE", - /* 132 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", - /* 133 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", - /* 134 */ "alter_db_options ::= alter_db_option", - /* 135 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 136 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 137 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 138 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 139 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 140 */ "alter_db_option ::= KEEP integer_list", - /* 141 */ "alter_db_option ::= KEEP variable_list", - /* 142 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 143 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 144 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 145 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 146 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 147 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 148 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 149 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 150 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 151 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", - /* 152 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", - /* 153 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", - /* 154 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", - /* 155 */ "integer_list ::= NK_INTEGER", - /* 156 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 157 */ "variable_list ::= NK_VARIABLE", - /* 158 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 159 */ "retention_list ::= retention", - /* 160 */ "retention_list ::= retention_list NK_COMMA retention", - /* 161 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 162 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", - /* 163 */ "speed_opt ::=", - /* 164 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 165 */ "start_opt ::=", - /* 166 */ "start_opt ::= START WITH NK_INTEGER", - /* 167 */ "start_opt ::= START WITH NK_STRING", - /* 168 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 169 */ "end_opt ::=", - /* 170 */ "end_opt ::= END WITH NK_INTEGER", - /* 171 */ "end_opt ::= END WITH NK_STRING", - /* 172 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 173 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 174 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 175 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 176 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 177 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 178 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 179 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 180 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 181 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 182 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 183 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 184 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", - /* 185 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 186 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 187 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 188 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 189 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 190 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", - /* 191 */ "multi_create_clause ::= create_subtable_clause", - /* 192 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 193 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 194 */ "multi_drop_clause ::= drop_table_clause", - /* 195 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 196 */ "drop_table_clause ::= exists_opt full_table_name", - /* 197 */ "specific_cols_opt ::=", - /* 198 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 199 */ "full_table_name ::= table_name", - /* 200 */ "full_table_name ::= db_name NK_DOT table_name", - /* 201 */ "tag_def_list ::= tag_def", - /* 202 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 203 */ "tag_def ::= column_name type_name", - /* 204 */ "column_def_list ::= column_def", - /* 205 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 206 */ "column_def ::= column_name type_name column_options", - /* 207 */ "type_name ::= BOOL", - /* 208 */ "type_name ::= TINYINT", - /* 209 */ "type_name ::= SMALLINT", - /* 210 */ "type_name ::= INT", - /* 211 */ "type_name ::= INTEGER", - /* 212 */ "type_name ::= BIGINT", - /* 213 */ "type_name ::= FLOAT", - /* 214 */ "type_name ::= DOUBLE", - /* 215 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 216 */ "type_name ::= TIMESTAMP", - /* 217 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 218 */ "type_name ::= TINYINT UNSIGNED", - /* 219 */ "type_name ::= SMALLINT UNSIGNED", - /* 220 */ "type_name ::= INT UNSIGNED", - /* 221 */ "type_name ::= BIGINT UNSIGNED", - /* 222 */ "type_name ::= JSON", - /* 223 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 224 */ "type_name ::= MEDIUMBLOB", - /* 225 */ "type_name ::= BLOB", - /* 226 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 227 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 228 */ "type_name ::= DECIMAL", - /* 229 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 230 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 231 */ "type_name_default_len ::= BINARY", - /* 232 */ "type_name_default_len ::= NCHAR", - /* 233 */ "type_name_default_len ::= VARCHAR", - /* 234 */ "type_name_default_len ::= VARBINARY", - /* 235 */ "tags_def_opt ::=", - /* 236 */ "tags_def_opt ::= tags_def", - /* 237 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 238 */ "table_options ::=", - /* 239 */ "table_options ::= table_options COMMENT NK_STRING", - /* 240 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 241 */ "table_options ::= table_options WATERMARK duration_list", - /* 242 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 243 */ "table_options ::= table_options TTL NK_INTEGER", - /* 244 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 245 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 246 */ "alter_table_options ::= alter_table_option", - /* 247 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 248 */ "alter_table_option ::= COMMENT NK_STRING", - /* 249 */ "alter_table_option ::= TTL NK_INTEGER", - /* 250 */ "duration_list ::= duration_literal", - /* 251 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 252 */ "rollup_func_list ::= rollup_func_name", - /* 253 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 254 */ "rollup_func_name ::= function_name", - /* 255 */ "rollup_func_name ::= FIRST", - /* 256 */ "rollup_func_name ::= LAST", - /* 257 */ "col_name_list ::= col_name", - /* 258 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 259 */ "col_name ::= column_name", - /* 260 */ "cmd ::= SHOW DNODES", - /* 261 */ "cmd ::= SHOW USERS", - /* 262 */ "cmd ::= SHOW USER PRIVILEGES", - /* 263 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 264 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 265 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 266 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 267 */ "cmd ::= SHOW MNODES", - /* 268 */ "cmd ::= SHOW QNODES", - /* 269 */ "cmd ::= SHOW ARBGROUPS", - /* 270 */ "cmd ::= SHOW FUNCTIONS", - /* 271 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 272 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 273 */ "cmd ::= SHOW STREAMS", - /* 274 */ "cmd ::= SHOW ACCOUNTS", - /* 275 */ "cmd ::= SHOW APPS", - /* 276 */ "cmd ::= SHOW CONNECTIONS", - /* 277 */ "cmd ::= SHOW LICENCES", - /* 278 */ "cmd ::= SHOW GRANTS", - /* 279 */ "cmd ::= SHOW GRANTS FULL", - /* 280 */ "cmd ::= SHOW GRANTS LOGS", - /* 281 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 282 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 283 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 284 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 285 */ "cmd ::= SHOW QUERIES", - /* 286 */ "cmd ::= SHOW SCORES", - /* 287 */ "cmd ::= SHOW TOPICS", - /* 288 */ "cmd ::= SHOW VARIABLES", - /* 289 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 290 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 291 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 292 */ "cmd ::= SHOW BNODES", - /* 293 */ "cmd ::= SHOW SNODES", - /* 294 */ "cmd ::= SHOW CLUSTER", - /* 295 */ "cmd ::= SHOW TRANSACTIONS", - /* 296 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 297 */ "cmd ::= SHOW CONSUMERS", - /* 298 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 299 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 300 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 301 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 302 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 303 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 304 */ "cmd ::= SHOW VNODES", - /* 305 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 306 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 307 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 308 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 309 */ "cmd ::= SHOW COMPACTS", - /* 310 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 311 */ "table_kind_db_name_cond_opt ::=", - /* 312 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 313 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 314 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 315 */ "table_kind ::= NORMAL", - /* 316 */ "table_kind ::= CHILD", - /* 317 */ "db_name_cond_opt ::=", - /* 318 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 319 */ "like_pattern_opt ::=", - /* 320 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 321 */ "table_name_cond ::= table_name", - /* 322 */ "from_db_opt ::=", - /* 323 */ "from_db_opt ::= FROM db_name", - /* 324 */ "tag_list_opt ::=", - /* 325 */ "tag_list_opt ::= tag_item", - /* 326 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 327 */ "tag_item ::= TBNAME", - /* 328 */ "tag_item ::= QTAGS", - /* 329 */ "tag_item ::= column_name", - /* 330 */ "tag_item ::= column_name column_alias", - /* 331 */ "tag_item ::= column_name AS column_alias", - /* 332 */ "db_kind_opt ::=", - /* 333 */ "db_kind_opt ::= USER", - /* 334 */ "db_kind_opt ::= SYSTEM", - /* 335 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 336 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 337 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 338 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 339 */ "full_tsma_name ::= tsma_name", - /* 340 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 341 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 342 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 343 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 344 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 345 */ "full_index_name ::= index_name", - /* 346 */ "full_index_name ::= db_name NK_DOT index_name", - /* 347 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 348 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 349 */ "func_list ::= func", - /* 350 */ "func_list ::= func_list NK_COMMA func", - /* 351 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 352 */ "sma_func_name ::= function_name", - /* 353 */ "sma_func_name ::= COUNT", - /* 354 */ "sma_func_name ::= FIRST", - /* 355 */ "sma_func_name ::= LAST", - /* 356 */ "sma_func_name ::= LAST_ROW", - /* 357 */ "sma_stream_opt ::=", - /* 358 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 359 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 360 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 361 */ "with_meta ::= AS", - /* 362 */ "with_meta ::= WITH META AS", - /* 363 */ "with_meta ::= ONLY META AS", - /* 364 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 365 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 366 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 367 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 368 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 369 */ "cmd ::= DESC full_table_name", - /* 370 */ "cmd ::= DESCRIBE full_table_name", - /* 371 */ "cmd ::= RESET QUERY CACHE", - /* 372 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 373 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 374 */ "analyze_opt ::=", - /* 375 */ "analyze_opt ::= ANALYZE", - /* 376 */ "explain_options ::=", - /* 377 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 378 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 379 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 380 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 381 */ "agg_func_opt ::=", - /* 382 */ "agg_func_opt ::= AGGREGATE", - /* 383 */ "bufsize_opt ::=", - /* 384 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 385 */ "language_opt ::=", - /* 386 */ "language_opt ::= LANGUAGE NK_STRING", - /* 387 */ "or_replace_opt ::=", - /* 388 */ "or_replace_opt ::= OR REPLACE", - /* 389 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 390 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 391 */ "full_view_name ::= view_name", - /* 392 */ "full_view_name ::= db_name NK_DOT view_name", - /* 393 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 394 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 395 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 396 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 397 */ "col_list_opt ::=", - /* 398 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 399 */ "column_stream_def_list ::= column_stream_def", - /* 400 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 401 */ "column_stream_def ::= column_name stream_col_options", - /* 402 */ "stream_col_options ::=", - /* 403 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 404 */ "tag_def_or_ref_opt ::=", - /* 405 */ "tag_def_or_ref_opt ::= tags_def", - /* 406 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 407 */ "stream_options ::=", - /* 408 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 409 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 410 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 411 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 412 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 413 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 414 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 415 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 416 */ "subtable_opt ::=", - /* 417 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 418 */ "ignore_opt ::=", - /* 419 */ "ignore_opt ::= IGNORE UNTREATED", - /* 420 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 421 */ "cmd ::= KILL QUERY NK_STRING", - /* 422 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 423 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 424 */ "cmd ::= BALANCE VGROUP", - /* 425 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 426 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 427 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 428 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 429 */ "on_vgroup_id ::=", - /* 430 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 431 */ "dnode_list ::= DNODE NK_INTEGER", - /* 432 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 433 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 434 */ "cmd ::= query_or_subquery", - /* 435 */ "cmd ::= insert_query", - /* 436 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 437 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 438 */ "tags_literal ::= NK_INTEGER", - /* 439 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 440 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 441 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 442 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 443 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 444 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 445 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 446 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 447 */ "tags_literal ::= NK_FLOAT", - /* 448 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 449 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 450 */ "tags_literal ::= NK_BIN", - /* 451 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 452 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 453 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 454 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 455 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 456 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 457 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 458 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 459 */ "tags_literal ::= NK_HEX", - /* 460 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 461 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 462 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 463 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 464 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 465 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 466 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 467 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 468 */ "tags_literal ::= NK_STRING", - /* 469 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 470 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 471 */ "tags_literal ::= NK_BOOL", - /* 472 */ "tags_literal ::= NULL", - /* 473 */ "tags_literal ::= literal_func", - /* 474 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 475 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 476 */ "tags_literal_list ::= tags_literal", - /* 477 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 478 */ "literal ::= NK_INTEGER", - /* 479 */ "literal ::= NK_FLOAT", - /* 480 */ "literal ::= NK_STRING", - /* 481 */ "literal ::= NK_BOOL", - /* 482 */ "literal ::= TIMESTAMP NK_STRING", - /* 483 */ "literal ::= duration_literal", - /* 484 */ "literal ::= NULL", - /* 485 */ "literal ::= NK_QUESTION", - /* 486 */ "duration_literal ::= NK_VARIABLE", - /* 487 */ "signed ::= NK_INTEGER", - /* 488 */ "signed ::= NK_PLUS NK_INTEGER", - /* 489 */ "signed ::= NK_MINUS NK_INTEGER", - /* 490 */ "signed ::= NK_FLOAT", - /* 491 */ "signed ::= NK_PLUS NK_FLOAT", - /* 492 */ "signed ::= NK_MINUS NK_FLOAT", - /* 493 */ "signed_literal ::= signed", - /* 494 */ "signed_literal ::= NK_STRING", - /* 495 */ "signed_literal ::= NK_BOOL", - /* 496 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 497 */ "signed_literal ::= duration_literal", - /* 498 */ "signed_literal ::= NULL", - /* 499 */ "signed_literal ::= literal_func", - /* 500 */ "signed_literal ::= NK_QUESTION", - /* 501 */ "literal_list ::= signed_literal", - /* 502 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 503 */ "db_name ::= NK_ID", - /* 504 */ "table_name ::= NK_ID", - /* 505 */ "column_name ::= NK_ID", - /* 506 */ "function_name ::= NK_ID", - /* 507 */ "view_name ::= NK_ID", - /* 508 */ "table_alias ::= NK_ID", - /* 509 */ "column_alias ::= NK_ID", - /* 510 */ "column_alias ::= NK_ALIAS", - /* 511 */ "user_name ::= NK_ID", - /* 512 */ "topic_name ::= NK_ID", - /* 513 */ "stream_name ::= NK_ID", - /* 514 */ "cgroup_name ::= NK_ID", - /* 515 */ "index_name ::= NK_ID", - /* 516 */ "tsma_name ::= NK_ID", - /* 517 */ "expr_or_subquery ::= expression", - /* 518 */ "expression ::= literal", - /* 519 */ "expression ::= pseudo_column", - /* 520 */ "expression ::= column_reference", - /* 521 */ "expression ::= function_expression", - /* 522 */ "expression ::= case_when_expression", - /* 523 */ "expression ::= NK_LP expression NK_RP", - /* 524 */ "expression ::= NK_PLUS expr_or_subquery", - /* 525 */ "expression ::= NK_MINUS expr_or_subquery", - /* 526 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 527 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 528 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 529 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 530 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 531 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 532 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 533 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 534 */ "expression_list ::= expr_or_subquery", - /* 535 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 536 */ "column_reference ::= column_name", - /* 537 */ "column_reference ::= table_name NK_DOT column_name", - /* 538 */ "column_reference ::= NK_ALIAS", - /* 539 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 540 */ "pseudo_column ::= ROWTS", - /* 541 */ "pseudo_column ::= TBNAME", - /* 542 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 543 */ "pseudo_column ::= QSTART", - /* 544 */ "pseudo_column ::= QEND", - /* 545 */ "pseudo_column ::= QDURATION", - /* 546 */ "pseudo_column ::= WSTART", - /* 547 */ "pseudo_column ::= WEND", - /* 548 */ "pseudo_column ::= WDURATION", - /* 549 */ "pseudo_column ::= IROWTS", - /* 550 */ "pseudo_column ::= ISFILLED", - /* 551 */ "pseudo_column ::= QTAGS", - /* 552 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 553 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 554 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 555 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 556 */ "function_expression ::= literal_func", - /* 557 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 558 */ "literal_func ::= NOW", - /* 559 */ "literal_func ::= TODAY", - /* 560 */ "noarg_func ::= NOW", - /* 561 */ "noarg_func ::= TODAY", - /* 562 */ "noarg_func ::= TIMEZONE", - /* 563 */ "noarg_func ::= DATABASE", - /* 564 */ "noarg_func ::= CLIENT_VERSION", - /* 565 */ "noarg_func ::= SERVER_VERSION", - /* 566 */ "noarg_func ::= SERVER_STATUS", - /* 567 */ "noarg_func ::= CURRENT_USER", - /* 568 */ "noarg_func ::= USER", - /* 569 */ "star_func ::= COUNT", - /* 570 */ "star_func ::= FIRST", - /* 571 */ "star_func ::= LAST", - /* 572 */ "star_func ::= LAST_ROW", - /* 573 */ "star_func_para_list ::= NK_STAR", - /* 574 */ "star_func_para_list ::= other_para_list", - /* 575 */ "other_para_list ::= star_func_para", - /* 576 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 577 */ "star_func_para ::= expr_or_subquery", - /* 578 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 579 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 580 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 581 */ "when_then_list ::= when_then_expr", - /* 582 */ "when_then_list ::= when_then_list when_then_expr", - /* 583 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 584 */ "case_when_else_opt ::=", - /* 585 */ "case_when_else_opt ::= ELSE common_expression", - /* 586 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 587 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 588 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 589 */ "predicate ::= expr_or_subquery IS NULL", - /* 590 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 591 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 592 */ "compare_op ::= NK_LT", - /* 593 */ "compare_op ::= NK_GT", - /* 594 */ "compare_op ::= NK_LE", - /* 595 */ "compare_op ::= NK_GE", - /* 596 */ "compare_op ::= NK_NE", - /* 597 */ "compare_op ::= NK_EQ", - /* 598 */ "compare_op ::= LIKE", - /* 599 */ "compare_op ::= NOT LIKE", - /* 600 */ "compare_op ::= MATCH", - /* 601 */ "compare_op ::= NMATCH", - /* 602 */ "compare_op ::= CONTAINS", - /* 603 */ "in_op ::= IN", - /* 604 */ "in_op ::= NOT IN", - /* 605 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 606 */ "boolean_value_expression ::= boolean_primary", - /* 607 */ "boolean_value_expression ::= NOT boolean_primary", - /* 608 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 609 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 610 */ "boolean_primary ::= predicate", - /* 611 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 612 */ "common_expression ::= expr_or_subquery", - /* 613 */ "common_expression ::= boolean_value_expression", - /* 614 */ "from_clause_opt ::=", - /* 615 */ "from_clause_opt ::= FROM table_reference_list", - /* 616 */ "table_reference_list ::= table_reference", - /* 617 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 618 */ "table_reference ::= table_primary", - /* 619 */ "table_reference ::= joined_table", - /* 620 */ "table_primary ::= table_name alias_opt", - /* 621 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 622 */ "table_primary ::= subquery alias_opt", - /* 623 */ "table_primary ::= parenthesized_joined_table", - /* 624 */ "alias_opt ::=", - /* 625 */ "alias_opt ::= table_alias", - /* 626 */ "alias_opt ::= AS table_alias", - /* 627 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 628 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 629 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 630 */ "join_type ::=", - /* 631 */ "join_type ::= INNER", - /* 632 */ "join_type ::= LEFT", - /* 633 */ "join_type ::= RIGHT", - /* 634 */ "join_type ::= FULL", - /* 635 */ "join_subtype ::=", - /* 636 */ "join_subtype ::= OUTER", - /* 637 */ "join_subtype ::= SEMI", - /* 638 */ "join_subtype ::= ANTI", - /* 639 */ "join_subtype ::= ASOF", - /* 640 */ "join_subtype ::= WINDOW", - /* 641 */ "join_on_clause_opt ::=", - /* 642 */ "join_on_clause_opt ::= ON search_condition", - /* 643 */ "window_offset_clause_opt ::=", - /* 644 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 645 */ "window_offset_literal ::= NK_VARIABLE", - /* 646 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 647 */ "jlimit_clause_opt ::=", - /* 648 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 649 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 650 */ "hint_list ::=", - /* 651 */ "hint_list ::= NK_HINT", - /* 652 */ "tag_mode_opt ::=", - /* 653 */ "tag_mode_opt ::= TAGS", - /* 654 */ "set_quantifier_opt ::=", - /* 655 */ "set_quantifier_opt ::= DISTINCT", - /* 656 */ "set_quantifier_opt ::= ALL", - /* 657 */ "select_list ::= select_item", - /* 658 */ "select_list ::= select_list NK_COMMA select_item", - /* 659 */ "select_item ::= NK_STAR", - /* 660 */ "select_item ::= common_expression", - /* 661 */ "select_item ::= common_expression column_alias", - /* 662 */ "select_item ::= common_expression AS column_alias", - /* 663 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 664 */ "where_clause_opt ::=", - /* 665 */ "where_clause_opt ::= WHERE search_condition", - /* 666 */ "partition_by_clause_opt ::=", - /* 667 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 668 */ "partition_list ::= partition_item", - /* 669 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 670 */ "partition_item ::= expr_or_subquery", - /* 671 */ "partition_item ::= expr_or_subquery column_alias", - /* 672 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 673 */ "twindow_clause_opt ::=", - /* 674 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 675 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 676 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 677 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 678 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 679 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 680 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 681 */ "sliding_opt ::=", - /* 682 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 683 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 684 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 685 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 686 */ "fill_opt ::=", - /* 687 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 688 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 689 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 690 */ "fill_mode ::= NONE", - /* 691 */ "fill_mode ::= PREV", - /* 692 */ "fill_mode ::= NULL", - /* 693 */ "fill_mode ::= NULL_F", - /* 694 */ "fill_mode ::= LINEAR", - /* 695 */ "fill_mode ::= NEXT", - /* 696 */ "group_by_clause_opt ::=", - /* 697 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 698 */ "group_by_list ::= expr_or_subquery", - /* 699 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 700 */ "having_clause_opt ::=", - /* 701 */ "having_clause_opt ::= HAVING search_condition", - /* 702 */ "range_opt ::=", - /* 703 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 704 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 705 */ "every_opt ::=", - /* 706 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 707 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 708 */ "query_simple ::= query_specification", - /* 709 */ "query_simple ::= union_query_expression", - /* 710 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 711 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 712 */ "query_simple_or_subquery ::= query_simple", - /* 713 */ "query_simple_or_subquery ::= subquery", - /* 714 */ "query_or_subquery ::= query_expression", - /* 715 */ "query_or_subquery ::= subquery", - /* 716 */ "order_by_clause_opt ::=", - /* 717 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 718 */ "slimit_clause_opt ::=", - /* 719 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 720 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 721 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 722 */ "limit_clause_opt ::=", - /* 723 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 724 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 725 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 726 */ "subquery ::= NK_LP query_expression NK_RP", - /* 727 */ "subquery ::= NK_LP subquery NK_RP", - /* 728 */ "search_condition ::= common_expression", - /* 729 */ "sort_specification_list ::= sort_specification", - /* 730 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 731 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 732 */ "ordering_specification_opt ::=", - /* 733 */ "ordering_specification_opt ::= ASC", - /* 734 */ "ordering_specification_opt ::= DESC", - /* 735 */ "null_ordering_opt ::=", - /* 736 */ "null_ordering_opt ::= NULLS FIRST", - /* 737 */ "null_ordering_opt ::= NULLS LAST", - /* 738 */ "column_options ::=", - /* 739 */ "column_options ::= column_options PRIMARY KEY", - /* 740 */ "column_options ::= column_options ENCODE NK_STRING", - /* 741 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 742 */ "column_options ::= column_options LEVEL NK_STRING", + /* 54 */ "cmd ::= CREATE ENCRYPT_KEY NK_STRING", + /* 55 */ "cmd ::= CREATE DNODE dnode_endpoint", + /* 56 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", + /* 57 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", + /* 58 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", + /* 59 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt", + /* 60 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt", + /* 61 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", + /* 62 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", + /* 63 */ "cmd ::= ALTER ALL DNODES NK_STRING", + /* 64 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", + /* 65 */ "cmd ::= RESTORE DNODE NK_INTEGER", + /* 66 */ "dnode_endpoint ::= NK_STRING", + /* 67 */ "dnode_endpoint ::= NK_ID", + /* 68 */ "dnode_endpoint ::= NK_IPTOKEN", + /* 69 */ "force_opt ::=", + /* 70 */ "force_opt ::= FORCE", + /* 71 */ "unsafe_opt ::= UNSAFE", + /* 72 */ "cmd ::= ALTER CLUSTER NK_STRING", + /* 73 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING", + /* 74 */ "cmd ::= ALTER LOCAL NK_STRING", + /* 75 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", + /* 76 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", + /* 77 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", + /* 78 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", + /* 79 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", + /* 80 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", + /* 81 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", + /* 82 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", + /* 83 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", + /* 84 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", + /* 85 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", + /* 86 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", + /* 87 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", + /* 88 */ "cmd ::= DROP DATABASE exists_opt db_name", + /* 89 */ "cmd ::= USE db_name", + /* 90 */ "cmd ::= ALTER DATABASE db_name alter_db_options", + /* 91 */ "cmd ::= FLUSH DATABASE db_name", + /* 92 */ "cmd ::= TRIM DATABASE db_name speed_opt", + /* 93 */ "cmd ::= S3MIGRATE DATABASE db_name", + /* 94 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", + /* 95 */ "not_exists_opt ::= IF NOT EXISTS", + /* 96 */ "not_exists_opt ::=", + /* 97 */ "exists_opt ::= IF EXISTS", + /* 98 */ "exists_opt ::=", + /* 99 */ "db_options ::=", + /* 100 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 101 */ "db_options ::= db_options CACHEMODEL NK_STRING", + /* 102 */ "db_options ::= db_options CACHESIZE NK_INTEGER", + /* 103 */ "db_options ::= db_options COMP NK_INTEGER", + /* 104 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 105 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 106 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 107 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 108 */ "db_options ::= db_options KEEP integer_list", + /* 109 */ "db_options ::= db_options KEEP variable_list", + /* 110 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 111 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 112 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", + /* 113 */ "db_options ::= db_options PRECISION NK_STRING", + /* 114 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 115 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 116 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 117 */ "db_options ::= db_options RETENTIONS retention_list", + /* 118 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 119 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 120 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 121 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 122 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 123 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 124 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 125 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 126 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 127 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 128 */ "db_options ::= db_options TABLE_PREFIX signed", + /* 129 */ "db_options ::= db_options TABLE_SUFFIX signed", + /* 130 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER", + /* 131 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER", + /* 132 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE", + /* 133 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", + /* 134 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", + /* 135 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING", + /* 136 */ "alter_db_options ::= alter_db_option", + /* 137 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 138 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 139 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 140 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 141 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 142 */ "alter_db_option ::= KEEP integer_list", + /* 143 */ "alter_db_option ::= KEEP variable_list", + /* 144 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 145 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 146 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 147 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 148 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 149 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", + /* 150 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 151 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", + /* 152 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 153 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", + /* 154 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", + /* 155 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", + /* 156 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", + /* 157 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING", + /* 158 */ "integer_list ::= NK_INTEGER", + /* 159 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 160 */ "variable_list ::= NK_VARIABLE", + /* 161 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 162 */ "retention_list ::= retention", + /* 163 */ "retention_list ::= retention_list NK_COMMA retention", + /* 164 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 165 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", + /* 166 */ "speed_opt ::=", + /* 167 */ "speed_opt ::= BWLIMIT NK_INTEGER", + /* 168 */ "start_opt ::=", + /* 169 */ "start_opt ::= START WITH NK_INTEGER", + /* 170 */ "start_opt ::= START WITH NK_STRING", + /* 171 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 172 */ "end_opt ::=", + /* 173 */ "end_opt ::= END WITH NK_INTEGER", + /* 174 */ "end_opt ::= END WITH NK_STRING", + /* 175 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 176 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 177 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 178 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 179 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 180 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 181 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 182 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 183 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 184 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 185 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 186 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 187 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", + /* 188 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 189 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 190 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 191 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 192 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 193 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", + /* 194 */ "multi_create_clause ::= create_subtable_clause", + /* 195 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 196 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", + /* 197 */ "multi_drop_clause ::= drop_table_clause", + /* 198 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 199 */ "drop_table_clause ::= exists_opt full_table_name", + /* 200 */ "specific_cols_opt ::=", + /* 201 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 202 */ "full_table_name ::= table_name", + /* 203 */ "full_table_name ::= db_name NK_DOT table_name", + /* 204 */ "tag_def_list ::= tag_def", + /* 205 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", + /* 206 */ "tag_def ::= column_name type_name", + /* 207 */ "column_def_list ::= column_def", + /* 208 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 209 */ "column_def ::= column_name type_name column_options", + /* 210 */ "type_name ::= BOOL", + /* 211 */ "type_name ::= TINYINT", + /* 212 */ "type_name ::= SMALLINT", + /* 213 */ "type_name ::= INT", + /* 214 */ "type_name ::= INTEGER", + /* 215 */ "type_name ::= BIGINT", + /* 216 */ "type_name ::= FLOAT", + /* 217 */ "type_name ::= DOUBLE", + /* 218 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 219 */ "type_name ::= TIMESTAMP", + /* 220 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 221 */ "type_name ::= TINYINT UNSIGNED", + /* 222 */ "type_name ::= SMALLINT UNSIGNED", + /* 223 */ "type_name ::= INT UNSIGNED", + /* 224 */ "type_name ::= BIGINT UNSIGNED", + /* 225 */ "type_name ::= JSON", + /* 226 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 227 */ "type_name ::= MEDIUMBLOB", + /* 228 */ "type_name ::= BLOB", + /* 229 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 230 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 231 */ "type_name ::= DECIMAL", + /* 232 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 233 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 234 */ "type_name_default_len ::= BINARY", + /* 235 */ "type_name_default_len ::= NCHAR", + /* 236 */ "type_name_default_len ::= VARCHAR", + /* 237 */ "type_name_default_len ::= VARBINARY", + /* 238 */ "tags_def_opt ::=", + /* 239 */ "tags_def_opt ::= tags_def", + /* 240 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", + /* 241 */ "table_options ::=", + /* 242 */ "table_options ::= table_options COMMENT NK_STRING", + /* 243 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 244 */ "table_options ::= table_options WATERMARK duration_list", + /* 245 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 246 */ "table_options ::= table_options TTL NK_INTEGER", + /* 247 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 248 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 249 */ "alter_table_options ::= alter_table_option", + /* 250 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 251 */ "alter_table_option ::= COMMENT NK_STRING", + /* 252 */ "alter_table_option ::= TTL NK_INTEGER", + /* 253 */ "duration_list ::= duration_literal", + /* 254 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 255 */ "rollup_func_list ::= rollup_func_name", + /* 256 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 257 */ "rollup_func_name ::= function_name", + /* 258 */ "rollup_func_name ::= FIRST", + /* 259 */ "rollup_func_name ::= LAST", + /* 260 */ "col_name_list ::= col_name", + /* 261 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 262 */ "col_name ::= column_name", + /* 263 */ "cmd ::= SHOW DNODES", + /* 264 */ "cmd ::= SHOW USERS", + /* 265 */ "cmd ::= SHOW USER PRIVILEGES", + /* 266 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 267 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 268 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 269 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 270 */ "cmd ::= SHOW MNODES", + /* 271 */ "cmd ::= SHOW QNODES", + /* 272 */ "cmd ::= SHOW ARBGROUPS", + /* 273 */ "cmd ::= SHOW FUNCTIONS", + /* 274 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 275 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 276 */ "cmd ::= SHOW STREAMS", + /* 277 */ "cmd ::= SHOW ACCOUNTS", + /* 278 */ "cmd ::= SHOW APPS", + /* 279 */ "cmd ::= SHOW CONNECTIONS", + /* 280 */ "cmd ::= SHOW LICENCES", + /* 281 */ "cmd ::= SHOW GRANTS", + /* 282 */ "cmd ::= SHOW GRANTS FULL", + /* 283 */ "cmd ::= SHOW GRANTS LOGS", + /* 284 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 285 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 286 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 287 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 288 */ "cmd ::= SHOW ENCRYPTIONS", + /* 289 */ "cmd ::= SHOW QUERIES", + /* 290 */ "cmd ::= SHOW SCORES", + /* 291 */ "cmd ::= SHOW TOPICS", + /* 292 */ "cmd ::= SHOW VARIABLES", + /* 293 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 294 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 295 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 296 */ "cmd ::= SHOW BNODES", + /* 297 */ "cmd ::= SHOW SNODES", + /* 298 */ "cmd ::= SHOW CLUSTER", + /* 299 */ "cmd ::= SHOW TRANSACTIONS", + /* 300 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 301 */ "cmd ::= SHOW CONSUMERS", + /* 302 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 303 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 304 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 305 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 306 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 307 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 308 */ "cmd ::= SHOW VNODES", + /* 309 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 310 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 311 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", + /* 312 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 313 */ "cmd ::= SHOW COMPACTS", + /* 314 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 315 */ "table_kind_db_name_cond_opt ::=", + /* 316 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 317 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 318 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 319 */ "table_kind ::= NORMAL", + /* 320 */ "table_kind ::= CHILD", + /* 321 */ "db_name_cond_opt ::=", + /* 322 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 323 */ "like_pattern_opt ::=", + /* 324 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 325 */ "table_name_cond ::= table_name", + /* 326 */ "from_db_opt ::=", + /* 327 */ "from_db_opt ::= FROM db_name", + /* 328 */ "tag_list_opt ::=", + /* 329 */ "tag_list_opt ::= tag_item", + /* 330 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 331 */ "tag_item ::= TBNAME", + /* 332 */ "tag_item ::= QTAGS", + /* 333 */ "tag_item ::= column_name", + /* 334 */ "tag_item ::= column_name column_alias", + /* 335 */ "tag_item ::= column_name AS column_alias", + /* 336 */ "db_kind_opt ::=", + /* 337 */ "db_kind_opt ::= USER", + /* 338 */ "db_kind_opt ::= SYSTEM", + /* 339 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", + /* 340 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", + /* 341 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", + /* 342 */ "cmd ::= SHOW db_name_cond_opt TSMAS", + /* 343 */ "full_tsma_name ::= tsma_name", + /* 344 */ "full_tsma_name ::= db_name NK_DOT tsma_name", + /* 345 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", + /* 346 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 347 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 348 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 349 */ "full_index_name ::= index_name", + /* 350 */ "full_index_name ::= db_name NK_DOT index_name", + /* 351 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 352 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", + /* 353 */ "func_list ::= func", + /* 354 */ "func_list ::= func_list NK_COMMA func", + /* 355 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 356 */ "sma_func_name ::= function_name", + /* 357 */ "sma_func_name ::= COUNT", + /* 358 */ "sma_func_name ::= FIRST", + /* 359 */ "sma_func_name ::= LAST", + /* 360 */ "sma_func_name ::= LAST_ROW", + /* 361 */ "sma_stream_opt ::=", + /* 362 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 363 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 364 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 365 */ "with_meta ::= AS", + /* 366 */ "with_meta ::= WITH META AS", + /* 367 */ "with_meta ::= ONLY META AS", + /* 368 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 369 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 370 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 371 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 372 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 373 */ "cmd ::= DESC full_table_name", + /* 374 */ "cmd ::= DESCRIBE full_table_name", + /* 375 */ "cmd ::= RESET QUERY CACHE", + /* 376 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 377 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 378 */ "analyze_opt ::=", + /* 379 */ "analyze_opt ::= ANALYZE", + /* 380 */ "explain_options ::=", + /* 381 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 382 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 383 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 384 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 385 */ "agg_func_opt ::=", + /* 386 */ "agg_func_opt ::= AGGREGATE", + /* 387 */ "bufsize_opt ::=", + /* 388 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 389 */ "language_opt ::=", + /* 390 */ "language_opt ::= LANGUAGE NK_STRING", + /* 391 */ "or_replace_opt ::=", + /* 392 */ "or_replace_opt ::= OR REPLACE", + /* 393 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 394 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 395 */ "full_view_name ::= view_name", + /* 396 */ "full_view_name ::= db_name NK_DOT view_name", + /* 397 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 398 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 399 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 400 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 401 */ "col_list_opt ::=", + /* 402 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 403 */ "column_stream_def_list ::= column_stream_def", + /* 404 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 405 */ "column_stream_def ::= column_name stream_col_options", + /* 406 */ "stream_col_options ::=", + /* 407 */ "stream_col_options ::= stream_col_options PRIMARY KEY", + /* 408 */ "tag_def_or_ref_opt ::=", + /* 409 */ "tag_def_or_ref_opt ::= tags_def", + /* 410 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 411 */ "stream_options ::=", + /* 412 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 413 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 414 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 415 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 416 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 417 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 418 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 419 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 420 */ "subtable_opt ::=", + /* 421 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 422 */ "ignore_opt ::=", + /* 423 */ "ignore_opt ::= IGNORE UNTREATED", + /* 424 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 425 */ "cmd ::= KILL QUERY NK_STRING", + /* 426 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 427 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 428 */ "cmd ::= BALANCE VGROUP", + /* 429 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 430 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 431 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 432 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 433 */ "on_vgroup_id ::=", + /* 434 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 435 */ "dnode_list ::= DNODE NK_INTEGER", + /* 436 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 437 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 438 */ "cmd ::= query_or_subquery", + /* 439 */ "cmd ::= insert_query", + /* 440 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 441 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 442 */ "tags_literal ::= NK_INTEGER", + /* 443 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 444 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 445 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 446 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 447 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 448 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 449 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 450 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 451 */ "tags_literal ::= NK_FLOAT", + /* 452 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 453 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 454 */ "tags_literal ::= NK_BIN", + /* 455 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 456 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 457 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 458 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 459 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 460 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 461 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 462 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 463 */ "tags_literal ::= NK_HEX", + /* 464 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 465 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 466 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 467 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 468 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 469 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 470 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 471 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 472 */ "tags_literal ::= NK_STRING", + /* 473 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 474 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 475 */ "tags_literal ::= NK_BOOL", + /* 476 */ "tags_literal ::= NULL", + /* 477 */ "tags_literal ::= literal_func", + /* 478 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 479 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 480 */ "tags_literal_list ::= tags_literal", + /* 481 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 482 */ "literal ::= NK_INTEGER", + /* 483 */ "literal ::= NK_FLOAT", + /* 484 */ "literal ::= NK_STRING", + /* 485 */ "literal ::= NK_BOOL", + /* 486 */ "literal ::= TIMESTAMP NK_STRING", + /* 487 */ "literal ::= duration_literal", + /* 488 */ "literal ::= NULL", + /* 489 */ "literal ::= NK_QUESTION", + /* 490 */ "duration_literal ::= NK_VARIABLE", + /* 491 */ "signed ::= NK_INTEGER", + /* 492 */ "signed ::= NK_PLUS NK_INTEGER", + /* 493 */ "signed ::= NK_MINUS NK_INTEGER", + /* 494 */ "signed ::= NK_FLOAT", + /* 495 */ "signed ::= NK_PLUS NK_FLOAT", + /* 496 */ "signed ::= NK_MINUS NK_FLOAT", + /* 497 */ "signed_literal ::= signed", + /* 498 */ "signed_literal ::= NK_STRING", + /* 499 */ "signed_literal ::= NK_BOOL", + /* 500 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 501 */ "signed_literal ::= duration_literal", + /* 502 */ "signed_literal ::= NULL", + /* 503 */ "signed_literal ::= literal_func", + /* 504 */ "signed_literal ::= NK_QUESTION", + /* 505 */ "literal_list ::= signed_literal", + /* 506 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 507 */ "db_name ::= NK_ID", + /* 508 */ "table_name ::= NK_ID", + /* 509 */ "column_name ::= NK_ID", + /* 510 */ "function_name ::= NK_ID", + /* 511 */ "view_name ::= NK_ID", + /* 512 */ "table_alias ::= NK_ID", + /* 513 */ "column_alias ::= NK_ID", + /* 514 */ "column_alias ::= NK_ALIAS", + /* 515 */ "user_name ::= NK_ID", + /* 516 */ "topic_name ::= NK_ID", + /* 517 */ "stream_name ::= NK_ID", + /* 518 */ "cgroup_name ::= NK_ID", + /* 519 */ "index_name ::= NK_ID", + /* 520 */ "tsma_name ::= NK_ID", + /* 521 */ "expr_or_subquery ::= expression", + /* 522 */ "expression ::= literal", + /* 523 */ "expression ::= pseudo_column", + /* 524 */ "expression ::= column_reference", + /* 525 */ "expression ::= function_expression", + /* 526 */ "expression ::= case_when_expression", + /* 527 */ "expression ::= NK_LP expression NK_RP", + /* 528 */ "expression ::= NK_PLUS expr_or_subquery", + /* 529 */ "expression ::= NK_MINUS expr_or_subquery", + /* 530 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 531 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 532 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 533 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 534 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 535 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 536 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 537 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 538 */ "expression_list ::= expr_or_subquery", + /* 539 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 540 */ "column_reference ::= column_name", + /* 541 */ "column_reference ::= table_name NK_DOT column_name", + /* 542 */ "column_reference ::= NK_ALIAS", + /* 543 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 544 */ "pseudo_column ::= ROWTS", + /* 545 */ "pseudo_column ::= TBNAME", + /* 546 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 547 */ "pseudo_column ::= QSTART", + /* 548 */ "pseudo_column ::= QEND", + /* 549 */ "pseudo_column ::= QDURATION", + /* 550 */ "pseudo_column ::= WSTART", + /* 551 */ "pseudo_column ::= WEND", + /* 552 */ "pseudo_column ::= WDURATION", + /* 553 */ "pseudo_column ::= IROWTS", + /* 554 */ "pseudo_column ::= ISFILLED", + /* 555 */ "pseudo_column ::= QTAGS", + /* 556 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 557 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 558 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 559 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 560 */ "function_expression ::= literal_func", + /* 561 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 562 */ "literal_func ::= NOW", + /* 563 */ "literal_func ::= TODAY", + /* 564 */ "noarg_func ::= NOW", + /* 565 */ "noarg_func ::= TODAY", + /* 566 */ "noarg_func ::= TIMEZONE", + /* 567 */ "noarg_func ::= DATABASE", + /* 568 */ "noarg_func ::= CLIENT_VERSION", + /* 569 */ "noarg_func ::= SERVER_VERSION", + /* 570 */ "noarg_func ::= SERVER_STATUS", + /* 571 */ "noarg_func ::= CURRENT_USER", + /* 572 */ "noarg_func ::= USER", + /* 573 */ "star_func ::= COUNT", + /* 574 */ "star_func ::= FIRST", + /* 575 */ "star_func ::= LAST", + /* 576 */ "star_func ::= LAST_ROW", + /* 577 */ "star_func_para_list ::= NK_STAR", + /* 578 */ "star_func_para_list ::= other_para_list", + /* 579 */ "other_para_list ::= star_func_para", + /* 580 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 581 */ "star_func_para ::= expr_or_subquery", + /* 582 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 583 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 584 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 585 */ "when_then_list ::= when_then_expr", + /* 586 */ "when_then_list ::= when_then_list when_then_expr", + /* 587 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 588 */ "case_when_else_opt ::=", + /* 589 */ "case_when_else_opt ::= ELSE common_expression", + /* 590 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 591 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 592 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 593 */ "predicate ::= expr_or_subquery IS NULL", + /* 594 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 595 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 596 */ "compare_op ::= NK_LT", + /* 597 */ "compare_op ::= NK_GT", + /* 598 */ "compare_op ::= NK_LE", + /* 599 */ "compare_op ::= NK_GE", + /* 600 */ "compare_op ::= NK_NE", + /* 601 */ "compare_op ::= NK_EQ", + /* 602 */ "compare_op ::= LIKE", + /* 603 */ "compare_op ::= NOT LIKE", + /* 604 */ "compare_op ::= MATCH", + /* 605 */ "compare_op ::= NMATCH", + /* 606 */ "compare_op ::= CONTAINS", + /* 607 */ "in_op ::= IN", + /* 608 */ "in_op ::= NOT IN", + /* 609 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 610 */ "boolean_value_expression ::= boolean_primary", + /* 611 */ "boolean_value_expression ::= NOT boolean_primary", + /* 612 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 613 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 614 */ "boolean_primary ::= predicate", + /* 615 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 616 */ "common_expression ::= expr_or_subquery", + /* 617 */ "common_expression ::= boolean_value_expression", + /* 618 */ "from_clause_opt ::=", + /* 619 */ "from_clause_opt ::= FROM table_reference_list", + /* 620 */ "table_reference_list ::= table_reference", + /* 621 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 622 */ "table_reference ::= table_primary", + /* 623 */ "table_reference ::= joined_table", + /* 624 */ "table_primary ::= table_name alias_opt", + /* 625 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 626 */ "table_primary ::= subquery alias_opt", + /* 627 */ "table_primary ::= parenthesized_joined_table", + /* 628 */ "alias_opt ::=", + /* 629 */ "alias_opt ::= table_alias", + /* 630 */ "alias_opt ::= AS table_alias", + /* 631 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 632 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 633 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 634 */ "join_type ::=", + /* 635 */ "join_type ::= INNER", + /* 636 */ "join_type ::= LEFT", + /* 637 */ "join_type ::= RIGHT", + /* 638 */ "join_type ::= FULL", + /* 639 */ "join_subtype ::=", + /* 640 */ "join_subtype ::= OUTER", + /* 641 */ "join_subtype ::= SEMI", + /* 642 */ "join_subtype ::= ANTI", + /* 643 */ "join_subtype ::= ASOF", + /* 644 */ "join_subtype ::= WINDOW", + /* 645 */ "join_on_clause_opt ::=", + /* 646 */ "join_on_clause_opt ::= ON search_condition", + /* 647 */ "window_offset_clause_opt ::=", + /* 648 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 649 */ "window_offset_literal ::= NK_VARIABLE", + /* 650 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 651 */ "jlimit_clause_opt ::=", + /* 652 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 653 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 654 */ "hint_list ::=", + /* 655 */ "hint_list ::= NK_HINT", + /* 656 */ "tag_mode_opt ::=", + /* 657 */ "tag_mode_opt ::= TAGS", + /* 658 */ "set_quantifier_opt ::=", + /* 659 */ "set_quantifier_opt ::= DISTINCT", + /* 660 */ "set_quantifier_opt ::= ALL", + /* 661 */ "select_list ::= select_item", + /* 662 */ "select_list ::= select_list NK_COMMA select_item", + /* 663 */ "select_item ::= NK_STAR", + /* 664 */ "select_item ::= common_expression", + /* 665 */ "select_item ::= common_expression column_alias", + /* 666 */ "select_item ::= common_expression AS column_alias", + /* 667 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 668 */ "where_clause_opt ::=", + /* 669 */ "where_clause_opt ::= WHERE search_condition", + /* 670 */ "partition_by_clause_opt ::=", + /* 671 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 672 */ "partition_list ::= partition_item", + /* 673 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 674 */ "partition_item ::= expr_or_subquery", + /* 675 */ "partition_item ::= expr_or_subquery column_alias", + /* 676 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 677 */ "twindow_clause_opt ::=", + /* 678 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 679 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 680 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 681 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 682 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 683 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 684 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 685 */ "sliding_opt ::=", + /* 686 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 687 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 688 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 689 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 690 */ "fill_opt ::=", + /* 691 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 692 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 693 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 694 */ "fill_mode ::= NONE", + /* 695 */ "fill_mode ::= PREV", + /* 696 */ "fill_mode ::= NULL", + /* 697 */ "fill_mode ::= NULL_F", + /* 698 */ "fill_mode ::= LINEAR", + /* 699 */ "fill_mode ::= NEXT", + /* 700 */ "group_by_clause_opt ::=", + /* 701 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 702 */ "group_by_list ::= expr_or_subquery", + /* 703 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 704 */ "having_clause_opt ::=", + /* 705 */ "having_clause_opt ::= HAVING search_condition", + /* 706 */ "range_opt ::=", + /* 707 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 708 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 709 */ "every_opt ::=", + /* 710 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 711 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 712 */ "query_simple ::= query_specification", + /* 713 */ "query_simple ::= union_query_expression", + /* 714 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 715 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 716 */ "query_simple_or_subquery ::= query_simple", + /* 717 */ "query_simple_or_subquery ::= subquery", + /* 718 */ "query_or_subquery ::= query_expression", + /* 719 */ "query_or_subquery ::= subquery", + /* 720 */ "order_by_clause_opt ::=", + /* 721 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 722 */ "slimit_clause_opt ::=", + /* 723 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 724 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 725 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 726 */ "limit_clause_opt ::=", + /* 727 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 728 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 729 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 730 */ "subquery ::= NK_LP query_expression NK_RP", + /* 731 */ "subquery ::= NK_LP subquery NK_RP", + /* 732 */ "search_condition ::= common_expression", + /* 733 */ "sort_specification_list ::= sort_specification", + /* 734 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 735 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 736 */ "ordering_specification_opt ::=", + /* 737 */ "ordering_specification_opt ::= ASC", + /* 738 */ "ordering_specification_opt ::= DESC", + /* 739 */ "null_ordering_opt ::=", + /* 740 */ "null_ordering_opt ::= NULLS FIRST", + /* 741 */ "null_ordering_opt ::= NULLS LAST", + /* 742 */ "column_options ::=", + /* 743 */ "column_options ::= column_options PRIMARY KEY", + /* 744 */ "column_options ::= column_options ENCODE NK_STRING", + /* 745 */ "column_options ::= column_options COMPRESS NK_STRING", + /* 746 */ "column_options ::= column_options LEVEL NK_STRING", }; #endif /* NDEBUG */ @@ -3387,296 +3070,258 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 373: /* cmd */ - case 376: /* literal */ - case 385: /* with_opt */ - case 391: /* search_condition */ - case 396: /* db_options */ - case 398: /* alter_db_options */ - case 400: /* start_opt */ - case 401: /* end_opt */ - case 405: /* signed */ - case 407: /* retention */ - case 408: /* full_table_name */ - case 411: /* table_options */ - case 415: /* alter_table_clause */ - case 416: /* alter_table_options */ - case 419: /* column_options */ - case 420: /* tags_literal */ - case 421: /* create_subtable_clause */ - case 424: /* drop_table_clause */ - case 427: /* tag_def */ - case 428: /* column_def */ - case 433: /* duration_literal */ - case 434: /* rollup_func_name */ - case 436: /* col_name */ - case 439: /* like_pattern_opt */ - case 440: /* db_name_cond_opt */ - case 441: /* table_name_cond */ - case 442: /* from_db_opt */ - case 445: /* tag_item */ - case 449: /* full_tsma_name */ - case 451: /* index_options */ - case 452: /* full_index_name */ - case 454: /* sliding_opt */ - case 455: /* sma_stream_opt */ - case 456: /* func */ - case 460: /* query_or_subquery */ - case 461: /* where_clause_opt */ - case 464: /* explain_options */ - case 465: /* insert_query */ - case 470: /* full_view_name */ - case 473: /* stream_options */ - case 476: /* subtable_opt */ - case 479: /* column_stream_def */ - case 480: /* stream_col_options */ - case 481: /* expression */ - case 484: /* literal_func */ - case 485: /* signed_literal */ - case 488: /* expr_or_subquery */ - case 489: /* pseudo_column */ - case 490: /* column_reference */ - case 491: /* function_expression */ - case 492: /* case_when_expression */ - case 497: /* star_func_para */ - case 499: /* case_when_else_opt */ - case 500: /* common_expression */ - case 501: /* when_then_expr */ - case 502: /* predicate */ - case 505: /* in_predicate_value */ - case 506: /* boolean_value_expression */ - case 507: /* boolean_primary */ - case 508: /* from_clause_opt */ - case 509: /* table_reference_list */ - case 510: /* table_reference */ - case 511: /* table_primary */ - case 512: /* joined_table */ - case 514: /* subquery */ - case 515: /* parenthesized_joined_table */ - case 518: /* join_on_clause_opt */ - case 519: /* window_offset_clause_opt */ - case 520: /* jlimit_clause_opt */ - case 521: /* window_offset_literal */ - case 522: /* query_specification */ - case 528: /* range_opt */ - case 529: /* every_opt */ - case 530: /* fill_opt */ - case 531: /* twindow_clause_opt */ - case 533: /* having_clause_opt */ - case 534: /* select_item */ - case 536: /* partition_item */ - case 537: /* interval_sliding_duration_literal */ - case 540: /* query_expression */ - case 541: /* query_simple */ - case 543: /* slimit_clause_opt */ - case 544: /* limit_clause_opt */ - case 545: /* union_query_expression */ - case 546: /* query_simple_or_subquery */ - case 548: /* sort_specification */ + case 376: /* cmd */ + case 379: /* literal */ + case 388: /* with_opt */ + case 394: /* search_condition */ + case 399: /* db_options */ + case 401: /* alter_db_options */ + case 403: /* start_opt */ + case 404: /* end_opt */ + case 408: /* signed */ + case 410: /* retention */ + case 411: /* full_table_name */ + case 414: /* table_options */ + case 418: /* alter_table_clause */ + case 419: /* alter_table_options */ + case 422: /* column_options */ + case 423: /* tags_literal */ + case 424: /* create_subtable_clause */ + case 427: /* drop_table_clause */ + case 430: /* tag_def */ + case 431: /* column_def */ + case 436: /* duration_literal */ + case 437: /* rollup_func_name */ + case 439: /* col_name */ + case 442: /* like_pattern_opt */ + case 443: /* db_name_cond_opt */ + case 444: /* table_name_cond */ + case 445: /* from_db_opt */ + case 448: /* tag_item */ + case 452: /* full_tsma_name */ + case 454: /* index_options */ + case 455: /* full_index_name */ + case 457: /* sliding_opt */ + case 458: /* sma_stream_opt */ + case 459: /* func */ + case 463: /* query_or_subquery */ + case 464: /* where_clause_opt */ + case 467: /* explain_options */ + case 468: /* insert_query */ + case 473: /* full_view_name */ + case 476: /* stream_options */ + case 479: /* subtable_opt */ + case 482: /* column_stream_def */ + case 483: /* stream_col_options */ + case 484: /* expression */ + case 487: /* literal_func */ + case 488: /* signed_literal */ + case 491: /* expr_or_subquery */ + case 492: /* pseudo_column */ + case 493: /* column_reference */ + case 494: /* function_expression */ + case 495: /* case_when_expression */ + case 500: /* star_func_para */ + case 502: /* case_when_else_opt */ + case 503: /* common_expression */ + case 504: /* when_then_expr */ + case 505: /* predicate */ + case 508: /* in_predicate_value */ + case 509: /* boolean_value_expression */ + case 510: /* boolean_primary */ + case 511: /* from_clause_opt */ + case 512: /* table_reference_list */ + case 513: /* table_reference */ + case 514: /* table_primary */ + case 515: /* joined_table */ + case 517: /* subquery */ + case 518: /* parenthesized_joined_table */ + case 521: /* join_on_clause_opt */ + case 522: /* window_offset_clause_opt */ + case 523: /* jlimit_clause_opt */ + case 524: /* window_offset_literal */ + case 525: /* query_specification */ + case 531: /* range_opt */ + case 532: /* every_opt */ + case 533: /* fill_opt */ + case 534: /* twindow_clause_opt */ + case 536: /* having_clause_opt */ + case 537: /* select_item */ + case 539: /* partition_item */ + case 540: /* interval_sliding_duration_literal */ + case 543: /* query_expression */ + case 544: /* query_simple */ + case 546: /* slimit_clause_opt */ + case 547: /* limit_clause_opt */ + case 548: /* union_query_expression */ + case 549: /* query_simple_or_subquery */ + case 551: /* sort_specification */ { -#line 7 "sql.y" - nodesDestroyNode((yypminor->yy826)); -#line 3479 "sql.c" + nodesDestroyNode((yypminor->yy600)); } break; - case 374: /* account_options */ - case 375: /* alter_account_options */ - case 377: /* alter_account_option */ - case 399: /* speed_opt */ - case 459: /* with_meta */ - case 468: /* bufsize_opt */ + case 377: /* account_options */ + case 378: /* alter_account_options */ + case 380: /* alter_account_option */ + case 402: /* speed_opt */ + case 462: /* with_meta */ + case 471: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3491 "sql.c" } break; - case 378: /* ip_range_list */ - case 379: /* white_list */ - case 380: /* white_list_opt */ - case 402: /* integer_list */ - case 403: /* variable_list */ - case 404: /* retention_list */ - case 409: /* column_def_list */ - case 410: /* tags_def_opt */ - case 412: /* multi_create_clause */ - case 413: /* tags_def */ - case 414: /* multi_drop_clause */ - case 422: /* specific_cols_opt */ - case 423: /* tags_literal_list */ - case 425: /* col_name_list */ - case 426: /* tag_def_list */ - case 430: /* duration_list */ - case 431: /* rollup_func_list */ - case 443: /* tag_list_opt */ - case 450: /* func_list */ - case 458: /* expression_list */ - case 474: /* col_list_opt */ - case 475: /* tag_def_or_ref_opt */ - case 478: /* column_stream_def_list */ - case 483: /* dnode_list */ - case 486: /* literal_list */ - case 494: /* star_func_para_list */ - case 496: /* other_para_list */ - case 498: /* when_then_list */ - case 523: /* hint_list */ - case 526: /* select_list */ - case 527: /* partition_by_clause_opt */ - case 532: /* group_by_clause_opt */ - case 535: /* partition_list */ - case 539: /* group_by_list */ - case 542: /* order_by_clause_opt */ - case 547: /* sort_specification_list */ + case 381: /* ip_range_list */ + case 382: /* white_list */ + case 383: /* white_list_opt */ + case 405: /* integer_list */ + case 406: /* variable_list */ + case 407: /* retention_list */ + case 412: /* column_def_list */ + case 413: /* tags_def_opt */ + case 415: /* multi_create_clause */ + case 416: /* tags_def */ + case 417: /* multi_drop_clause */ + case 425: /* specific_cols_opt */ + case 426: /* tags_literal_list */ + case 428: /* col_name_list */ + case 429: /* tag_def_list */ + case 433: /* duration_list */ + case 434: /* rollup_func_list */ + case 446: /* tag_list_opt */ + case 453: /* func_list */ + case 461: /* expression_list */ + case 477: /* col_list_opt */ + case 478: /* tag_def_or_ref_opt */ + case 481: /* column_stream_def_list */ + case 486: /* dnode_list */ + case 489: /* literal_list */ + case 497: /* star_func_para_list */ + case 499: /* other_para_list */ + case 501: /* when_then_list */ + case 526: /* hint_list */ + case 529: /* select_list */ + case 530: /* partition_by_clause_opt */ + case 535: /* group_by_clause_opt */ + case 538: /* partition_list */ + case 542: /* group_by_list */ + case 545: /* order_by_clause_opt */ + case 550: /* sort_specification_list */ { -#line 85 "sql.y" - nodesDestroyList((yypminor->yy616)); -#line 3533 "sql.c" + nodesDestroyList((yypminor->yy748)); } break; - case 381: /* user_name */ - case 388: /* db_name */ - case 389: /* table_name */ - case 390: /* topic_name */ - case 392: /* dnode_endpoint */ - case 417: /* column_name */ - case 435: /* function_name */ - case 446: /* column_alias */ - case 447: /* tsma_name */ - case 453: /* index_name */ - case 457: /* sma_func_name */ - case 462: /* cgroup_name */ - case 469: /* language_opt */ - case 471: /* view_name */ - case 472: /* stream_name */ - case 482: /* on_vgroup_id */ - case 487: /* table_alias */ - case 493: /* star_func */ - case 495: /* noarg_func */ - case 513: /* alias_opt */ + case 384: /* user_name */ + case 391: /* db_name */ + case 392: /* table_name */ + case 393: /* topic_name */ + case 395: /* dnode_endpoint */ + case 420: /* column_name */ + case 438: /* function_name */ + case 449: /* column_alias */ + case 450: /* tsma_name */ + case 456: /* index_name */ + case 460: /* sma_func_name */ + case 465: /* cgroup_name */ + case 472: /* language_opt */ + case 474: /* view_name */ + case 475: /* stream_name */ + case 485: /* on_vgroup_id */ + case 490: /* table_alias */ + case 496: /* star_func */ + case 498: /* noarg_func */ + case 516: /* alias_opt */ { -#line 1061 "sql.y" -#line 3559 "sql.c" } break; - case 382: /* sysinfo_opt */ + case 385: /* sysinfo_opt */ { -#line 112 "sql.y" -#line 3566 "sql.c" } break; - case 383: /* privileges */ - case 386: /* priv_type_list */ - case 387: /* priv_type */ + case 386: /* privileges */ + case 389: /* priv_type_list */ + case 390: /* priv_type */ { -#line 121 "sql.y" -#line 3575 "sql.c" } break; - case 384: /* priv_level */ + case 387: /* priv_level */ { -#line 138 "sql.y" -#line 3582 "sql.c" } break; - case 393: /* force_opt */ - case 394: /* unsafe_opt */ - case 395: /* not_exists_opt */ - case 397: /* exists_opt */ - case 463: /* analyze_opt */ - case 466: /* or_replace_opt */ - case 467: /* agg_func_opt */ - case 477: /* ignore_opt */ - case 524: /* set_quantifier_opt */ - case 525: /* tag_mode_opt */ + case 396: /* force_opt */ + case 397: /* unsafe_opt */ + case 398: /* not_exists_opt */ + case 400: /* exists_opt */ + case 466: /* analyze_opt */ + case 469: /* or_replace_opt */ + case 470: /* agg_func_opt */ + case 480: /* ignore_opt */ + case 527: /* set_quantifier_opt */ + case 528: /* tag_mode_opt */ { -#line 167 "sql.y" -#line 3598 "sql.c" } break; - case 406: /* alter_db_option */ - case 432: /* alter_table_option */ + case 409: /* alter_db_option */ + case 435: /* alter_table_option */ { -#line 274 "sql.y" -#line 3606 "sql.c" } break; - case 418: /* type_name */ - case 429: /* type_name_default_len */ + case 421: /* type_name */ + case 432: /* type_name_default_len */ { -#line 408 "sql.y" -#line 3614 "sql.c" } break; - case 437: /* db_kind_opt */ - case 444: /* table_kind */ + case 440: /* db_kind_opt */ + case 447: /* table_kind */ { -#line 584 "sql.y" -#line 3622 "sql.c" } break; - case 438: /* table_kind_db_name_cond_opt */ + case 441: /* table_kind_db_name_cond_opt */ { -#line 549 "sql.y" -#line 3629 "sql.c" } break; - case 448: /* tsma_func_list */ + case 451: /* tsma_func_list */ { -#line 603 "sql.y" - nodesDestroyNode((yypminor->yy826)); -#line 3636 "sql.c" + nodesDestroyNode((yypminor->yy600)); } break; - case 503: /* compare_op */ - case 504: /* in_op */ + case 506: /* compare_op */ + case 507: /* in_op */ { -#line 1259 "sql.y" -#line 3644 "sql.c" } break; - case 516: /* join_type */ + case 519: /* join_type */ { -#line 1340 "sql.y" -#line 3651 "sql.c" } break; - case 517: /* join_subtype */ + case 520: /* join_subtype */ { -#line 1348 "sql.y" -#line 3658 "sql.c" } break; - case 538: /* fill_mode */ + case 541: /* fill_mode */ { -#line 1464 "sql.y" -#line 3665 "sql.c" } break; - case 549: /* ordering_specification_opt */ + case 552: /* ordering_specification_opt */ { -#line 1549 "sql.y" -#line 3672 "sql.c" } break; - case 550: /* null_ordering_opt */ + case 553: /* null_ordering_opt */ { -#line 1555 "sql.y" -#line 3679 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3843,7 +3488,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); + assert( i>=0 && iyytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; + } + yymsp = yypParser->yytos; + } +#endif + } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -5498,21 +5199,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5503 "sql.c" - yy_destructor(yypParser,374,&yymsp[0].minor); + yy_destructor(yypParser,377,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5509 "sql.c" - yy_destructor(yypParser,375,&yymsp[0].minor); + yy_destructor(yypParser,378,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 5515 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5523,26 +5218,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,374,&yymsp[-2].minor); -#line 56 "sql.y" +{ yy_destructor(yypParser,377,&yymsp[-2].minor); { } -#line 5529 "sql.c" - yy_destructor(yypParser,376,&yymsp[0].minor); + yy_destructor(yypParser,379,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,377,&yymsp[0].minor); -#line 68 "sql.y" +{ yy_destructor(yypParser,380,&yymsp[0].minor); { } -#line 5537 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,375,&yymsp[-1].minor); -#line 69 "sql.y" +{ yy_destructor(yypParser,378,&yymsp[-1].minor); { } -#line 5544 "sql.c" - yy_destructor(yypParser,377,&yymsp[0].minor); + yy_destructor(yypParser,380,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -5555,3004 +5244,2048 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 5560 "sql.c" - yy_destructor(yypParser,376,&yymsp[0].minor); + yy_destructor(yypParser,379,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5566 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5572 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" -{ yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; } -#line 5578 "sql.c" +{ yymsp[-1].minor.yy748 = yymsp[0].minor.yy748; } break; case 27: /* white_list_opt ::= */ - case 197: /* specific_cols_opt ::= */ yytestcase(yyruleno==197); - case 235: /* tags_def_opt ::= */ yytestcase(yyruleno==235); - case 324: /* tag_list_opt ::= */ yytestcase(yyruleno==324); - case 397: /* col_list_opt ::= */ yytestcase(yyruleno==397); - case 404: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==404); - case 666: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==666); - case 696: /* group_by_clause_opt ::= */ yytestcase(yyruleno==696); - case 716: /* order_by_clause_opt ::= */ yytestcase(yyruleno==716); -#line 95 "sql.y" -{ yymsp[1].minor.yy616 = NULL; } -#line 5591 "sql.c" + case 200: /* specific_cols_opt ::= */ yytestcase(yyruleno==200); + case 238: /* tags_def_opt ::= */ yytestcase(yyruleno==238); + case 328: /* tag_list_opt ::= */ yytestcase(yyruleno==328); + case 401: /* col_list_opt ::= */ yytestcase(yyruleno==401); + case 408: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==408); + case 670: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==670); + case 700: /* group_by_clause_opt ::= */ yytestcase(yyruleno==700); + case 720: /* order_by_clause_opt ::= */ yytestcase(yyruleno==720); +{ yymsp[1].minor.yy748 = NULL; } break; case 28: /* white_list_opt ::= white_list */ - case 236: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==236); - case 405: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==405); - case 574: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==574); -#line 96 "sql.y" -{ yylhsminor.yy616 = yymsp[0].minor.yy616; } -#line 5599 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 239: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==239); + case 409: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==409); + case 578: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==578); +{ yylhsminor.yy748 = yymsp[0].minor.yy748; } + yymsp[0].minor.yy748 = yylhsminor.yy748; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ -#line 100 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy585, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy999); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy616); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy649, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy663); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy748); } -#line 5608 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 104 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy585, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 5613 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 105 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy585, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 5618 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 106 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy585, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 5623 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ -#line 107 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy585, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy616); } -#line 5628 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy748); } break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ -#line 108 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy585, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy616); } -#line 5633 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy649, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy748); } break; case 35: /* cmd ::= DROP USER user_name */ -#line 109 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy585); } -#line 5638 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy649); } break; case 36: /* sysinfo_opt ::= */ -#line 113 "sql.y" -{ yymsp[1].minor.yy999 = 1; } -#line 5643 "sql.c" +{ yymsp[1].minor.yy663 = 1; } break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -#line 114 "sql.y" -{ yymsp[-1].minor.yy999 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5648 "sql.c" +{ yymsp[-1].minor.yy663 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -#line 117 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy891, &yymsp[-3].minor.yy73, &yymsp[0].minor.yy585, yymsp[-2].minor.yy826); } -#line 5653 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy941, &yymsp[-3].minor.yy781, &yymsp[0].minor.yy649, yymsp[-2].minor.yy600); } break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -#line 118 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy891, &yymsp[-3].minor.yy73, &yymsp[0].minor.yy585, yymsp[-2].minor.yy826); } -#line 5658 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy941, &yymsp[-3].minor.yy781, &yymsp[0].minor.yy649, yymsp[-2].minor.yy600); } break; case 40: /* privileges ::= ALL */ -#line 122 "sql.y" -{ yymsp[0].minor.yy891 = PRIVILEGE_TYPE_ALL; } -#line 5663 "sql.c" +{ yymsp[0].minor.yy941 = PRIVILEGE_TYPE_ALL; } break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -#line 123 "sql.y" -{ yylhsminor.yy891 = yymsp[0].minor.yy891; } -#line 5669 "sql.c" - yymsp[0].minor.yy891 = yylhsminor.yy891; +{ yylhsminor.yy941 = yymsp[0].minor.yy941; } + yymsp[0].minor.yy941 = yylhsminor.yy941; break; case 42: /* privileges ::= SUBSCRIBE */ -#line 124 "sql.y" -{ yymsp[0].minor.yy891 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5675 "sql.c" +{ yymsp[0].minor.yy941 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 129 "sql.y" -{ yylhsminor.yy891 = yymsp[-2].minor.yy891 | yymsp[0].minor.yy891; } -#line 5680 "sql.c" - yymsp[-2].minor.yy891 = yylhsminor.yy891; +{ yylhsminor.yy941 = yymsp[-2].minor.yy941 | yymsp[0].minor.yy941; } + yymsp[-2].minor.yy941 = yylhsminor.yy941; break; case 45: /* priv_type ::= READ */ -#line 133 "sql.y" -{ yymsp[0].minor.yy891 = PRIVILEGE_TYPE_READ; } -#line 5686 "sql.c" +{ yymsp[0].minor.yy941 = PRIVILEGE_TYPE_READ; } break; case 46: /* priv_type ::= WRITE */ -#line 134 "sql.y" -{ yymsp[0].minor.yy891 = PRIVILEGE_TYPE_WRITE; } -#line 5691 "sql.c" +{ yymsp[0].minor.yy941 = PRIVILEGE_TYPE_WRITE; } break; case 47: /* priv_type ::= ALTER */ -#line 135 "sql.y" -{ yymsp[0].minor.yy891 = PRIVILEGE_TYPE_ALTER; } -#line 5696 "sql.c" +{ yymsp[0].minor.yy941 = PRIVILEGE_TYPE_ALTER; } break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 139 "sql.y" -{ yylhsminor.yy73.first = yymsp[-2].minor.yy0; yylhsminor.yy73.second = yymsp[0].minor.yy0; } -#line 5701 "sql.c" - yymsp[-2].minor.yy73 = yylhsminor.yy73; +{ yylhsminor.yy781.first = yymsp[-2].minor.yy0; yylhsminor.yy781.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 140 "sql.y" -{ yylhsminor.yy73.first = yymsp[-2].minor.yy585; yylhsminor.yy73.second = yymsp[0].minor.yy0; } -#line 5707 "sql.c" - yymsp[-2].minor.yy73 = yylhsminor.yy73; +{ yylhsminor.yy781.first = yymsp[-2].minor.yy649; yylhsminor.yy781.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -#line 141 "sql.y" -{ yylhsminor.yy73.first = yymsp[-2].minor.yy585; yylhsminor.yy73.second = yymsp[0].minor.yy585; } -#line 5713 "sql.c" - yymsp[-2].minor.yy73 = yylhsminor.yy73; +{ yylhsminor.yy781.first = yymsp[-2].minor.yy649; yylhsminor.yy781.second = yymsp[0].minor.yy649; } + yymsp[-2].minor.yy781 = yylhsminor.yy781; break; case 51: /* priv_level ::= topic_name */ -#line 142 "sql.y" -{ yylhsminor.yy73.first = yymsp[0].minor.yy585; yylhsminor.yy73.second = nil_token; } -#line 5719 "sql.c" - yymsp[0].minor.yy73 = yylhsminor.yy73; +{ yylhsminor.yy781.first = yymsp[0].minor.yy649; yylhsminor.yy781.second = nil_token; } + yymsp[0].minor.yy781 = yylhsminor.yy781; break; case 52: /* with_opt ::= */ - case 165: /* start_opt ::= */ yytestcase(yyruleno==165); - case 169: /* end_opt ::= */ yytestcase(yyruleno==169); - case 319: /* like_pattern_opt ::= */ yytestcase(yyruleno==319); - case 416: /* subtable_opt ::= */ yytestcase(yyruleno==416); - case 584: /* case_when_else_opt ::= */ yytestcase(yyruleno==584); - case 614: /* from_clause_opt ::= */ yytestcase(yyruleno==614); - case 641: /* join_on_clause_opt ::= */ yytestcase(yyruleno==641); - case 643: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==643); - case 647: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==647); - case 664: /* where_clause_opt ::= */ yytestcase(yyruleno==664); - case 673: /* twindow_clause_opt ::= */ yytestcase(yyruleno==673); - case 681: /* sliding_opt ::= */ yytestcase(yyruleno==681); - case 686: /* fill_opt ::= */ yytestcase(yyruleno==686); - case 700: /* having_clause_opt ::= */ yytestcase(yyruleno==700); - case 702: /* range_opt ::= */ yytestcase(yyruleno==702); - case 705: /* every_opt ::= */ yytestcase(yyruleno==705); - case 718: /* slimit_clause_opt ::= */ yytestcase(yyruleno==718); - case 722: /* limit_clause_opt ::= */ yytestcase(yyruleno==722); -#line 144 "sql.y" -{ yymsp[1].minor.yy826 = NULL; } -#line 5743 "sql.c" + case 168: /* start_opt ::= */ yytestcase(yyruleno==168); + case 172: /* end_opt ::= */ yytestcase(yyruleno==172); + case 323: /* like_pattern_opt ::= */ yytestcase(yyruleno==323); + case 420: /* subtable_opt ::= */ yytestcase(yyruleno==420); + case 588: /* case_when_else_opt ::= */ yytestcase(yyruleno==588); + case 618: /* from_clause_opt ::= */ yytestcase(yyruleno==618); + case 645: /* join_on_clause_opt ::= */ yytestcase(yyruleno==645); + case 647: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==647); + case 651: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==651); + case 668: /* where_clause_opt ::= */ yytestcase(yyruleno==668); + case 677: /* twindow_clause_opt ::= */ yytestcase(yyruleno==677); + case 685: /* sliding_opt ::= */ yytestcase(yyruleno==685); + case 690: /* fill_opt ::= */ yytestcase(yyruleno==690); + case 704: /* having_clause_opt ::= */ yytestcase(yyruleno==704); + case 706: /* range_opt ::= */ yytestcase(yyruleno==706); + case 709: /* every_opt ::= */ yytestcase(yyruleno==709); + case 722: /* slimit_clause_opt ::= */ yytestcase(yyruleno==722); + case 726: /* limit_clause_opt ::= */ yytestcase(yyruleno==726); +{ yymsp[1].minor.yy600 = NULL; } break; case 53: /* with_opt ::= WITH search_condition */ - case 615: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==615); - case 642: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==642); - case 665: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==665); - case 701: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==701); -#line 145 "sql.y" -{ yymsp[-1].minor.yy826 = yymsp[0].minor.yy826; } -#line 5752 "sql.c" + case 619: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==619); + case 646: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==646); + case 669: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==669); + case 705: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==705); +{ yymsp[-1].minor.yy600 = yymsp[0].minor.yy600; } break; - case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 148 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy585, NULL); } -#line 5757 "sql.c" + case 54: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ +{ pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 149 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0); } -#line 5762 "sql.c" + case 55: /* cmd ::= CREATE DNODE dnode_endpoint */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy649, NULL); } break; - case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 150 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy983, false); } -#line 5767 "sql.c" + case 56: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0); } break; - case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 151 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy585, yymsp[0].minor.yy983, false); } -#line 5772 "sql.c" + case 57: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy705, false); } break; - case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -#line 152 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy983); } -#line 5777 "sql.c" + case 58: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy705, false); } break; - case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -#line 153 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy585, false, yymsp[0].minor.yy983); } -#line 5782 "sql.c" + case 59: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy705); } break; - case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 154 "sql.y" + case 60: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy649, false, yymsp[0].minor.yy705); } + break; + case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5787 "sql.c" break; - case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 155 "sql.y" + case 62: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5792 "sql.c" break; - case 62: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 156 "sql.y" + case 63: /* cmd ::= ALTER ALL DNODES NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5797 "sql.c" break; - case 63: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 157 "sql.y" + case 64: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5802 "sql.c" break; - case 64: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 158 "sql.y" + case 65: /* cmd ::= RESTORE DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5807 "sql.c" break; - case 65: /* dnode_endpoint ::= NK_STRING */ - case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); - case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67); - case 353: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==353); - case 354: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==354); - case 355: /* sma_func_name ::= LAST */ yytestcase(yyruleno==355); - case 356: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==356); - case 503: /* db_name ::= NK_ID */ yytestcase(yyruleno==503); - case 504: /* table_name ::= NK_ID */ yytestcase(yyruleno==504); - case 505: /* column_name ::= NK_ID */ yytestcase(yyruleno==505); - case 506: /* function_name ::= NK_ID */ yytestcase(yyruleno==506); - case 507: /* view_name ::= NK_ID */ yytestcase(yyruleno==507); - case 508: /* table_alias ::= NK_ID */ yytestcase(yyruleno==508); - case 509: /* column_alias ::= NK_ID */ yytestcase(yyruleno==509); - case 510: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==510); - case 511: /* user_name ::= NK_ID */ yytestcase(yyruleno==511); - case 512: /* topic_name ::= NK_ID */ yytestcase(yyruleno==512); - case 513: /* stream_name ::= NK_ID */ yytestcase(yyruleno==513); - case 514: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==514); - case 515: /* index_name ::= NK_ID */ yytestcase(yyruleno==515); - case 516: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==516); - case 560: /* noarg_func ::= NOW */ yytestcase(yyruleno==560); - case 561: /* noarg_func ::= TODAY */ yytestcase(yyruleno==561); - case 562: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==562); - case 563: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==563); - case 564: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==564); - case 565: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==565); - case 566: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==566); - case 567: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==567); - case 568: /* noarg_func ::= USER */ yytestcase(yyruleno==568); - case 569: /* star_func ::= COUNT */ yytestcase(yyruleno==569); - case 570: /* star_func ::= FIRST */ yytestcase(yyruleno==570); - case 571: /* star_func ::= LAST */ yytestcase(yyruleno==571); - case 572: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==572); -#line 162 "sql.y" -{ yylhsminor.yy585 = yymsp[0].minor.yy0; } -#line 5845 "sql.c" - yymsp[0].minor.yy585 = yylhsminor.yy585; + case 66: /* dnode_endpoint ::= NK_STRING */ + case 67: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==67); + case 68: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==68); + case 357: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==357); + case 358: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==358); + case 359: /* sma_func_name ::= LAST */ yytestcase(yyruleno==359); + case 360: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==360); + case 507: /* db_name ::= NK_ID */ yytestcase(yyruleno==507); + case 508: /* table_name ::= NK_ID */ yytestcase(yyruleno==508); + case 509: /* column_name ::= NK_ID */ yytestcase(yyruleno==509); + case 510: /* function_name ::= NK_ID */ yytestcase(yyruleno==510); + case 511: /* view_name ::= NK_ID */ yytestcase(yyruleno==511); + case 512: /* table_alias ::= NK_ID */ yytestcase(yyruleno==512); + case 513: /* column_alias ::= NK_ID */ yytestcase(yyruleno==513); + case 514: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==514); + case 515: /* user_name ::= NK_ID */ yytestcase(yyruleno==515); + case 516: /* topic_name ::= NK_ID */ yytestcase(yyruleno==516); + case 517: /* stream_name ::= NK_ID */ yytestcase(yyruleno==517); + case 518: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* index_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==520); + case 564: /* noarg_func ::= NOW */ yytestcase(yyruleno==564); + case 565: /* noarg_func ::= TODAY */ yytestcase(yyruleno==565); + case 566: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==566); + case 567: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==567); + case 568: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==568); + case 569: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==569); + case 570: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==570); + case 571: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==571); + case 572: /* noarg_func ::= USER */ yytestcase(yyruleno==572); + case 573: /* star_func ::= COUNT */ yytestcase(yyruleno==573); + case 574: /* star_func ::= FIRST */ yytestcase(yyruleno==574); + case 575: /* star_func ::= LAST */ yytestcase(yyruleno==575); + case 576: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==576); +{ yylhsminor.yy649 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy649 = yylhsminor.yy649; break; - case 68: /* force_opt ::= */ - case 95: /* not_exists_opt ::= */ yytestcase(yyruleno==95); - case 97: /* exists_opt ::= */ yytestcase(yyruleno==97); - case 374: /* analyze_opt ::= */ yytestcase(yyruleno==374); - case 381: /* agg_func_opt ::= */ yytestcase(yyruleno==381); - case 387: /* or_replace_opt ::= */ yytestcase(yyruleno==387); - case 418: /* ignore_opt ::= */ yytestcase(yyruleno==418); - case 652: /* tag_mode_opt ::= */ yytestcase(yyruleno==652); - case 654: /* set_quantifier_opt ::= */ yytestcase(yyruleno==654); -#line 168 "sql.y" -{ yymsp[1].minor.yy983 = false; } -#line 5859 "sql.c" + case 69: /* force_opt ::= */ + case 96: /* not_exists_opt ::= */ yytestcase(yyruleno==96); + case 98: /* exists_opt ::= */ yytestcase(yyruleno==98); + case 378: /* analyze_opt ::= */ yytestcase(yyruleno==378); + case 385: /* agg_func_opt ::= */ yytestcase(yyruleno==385); + case 391: /* or_replace_opt ::= */ yytestcase(yyruleno==391); + case 422: /* ignore_opt ::= */ yytestcase(yyruleno==422); + case 656: /* tag_mode_opt ::= */ yytestcase(yyruleno==656); + case 658: /* set_quantifier_opt ::= */ yytestcase(yyruleno==658); +{ yymsp[1].minor.yy705 = false; } break; - case 69: /* force_opt ::= FORCE */ - case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); - case 375: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==375); - case 382: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==382); - case 653: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==653); - case 655: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==655); -#line 169 "sql.y" -{ yymsp[0].minor.yy983 = true; } -#line 5869 "sql.c" + case 70: /* force_opt ::= FORCE */ + case 71: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==71); + case 379: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==379); + case 386: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==386); + case 657: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==657); + case 659: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==659); +{ yymsp[0].minor.yy705 = true; } break; - case 71: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 176 "sql.y" + case 72: /* cmd ::= ALTER CLUSTER NK_STRING */ { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5874 "sql.c" break; - case 72: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -#line 177 "sql.y" + case 73: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5879 "sql.c" break; - case 73: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 180 "sql.y" + case 74: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5884 "sql.c" break; - case 74: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 181 "sql.y" + case 75: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5889 "sql.c" break; - case 75: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 184 "sql.y" + case 76: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5894 "sql.c" break; - case 76: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 185 "sql.y" + case 77: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5899 "sql.c" break; - case 77: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 186 "sql.y" + case 78: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5904 "sql.c" break; - case 78: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 189 "sql.y" + case 79: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5909 "sql.c" break; - case 79: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 190 "sql.y" + case 80: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5914 "sql.c" break; - case 80: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 193 "sql.y" + case 81: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5919 "sql.c" break; - case 81: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 194 "sql.y" + case 82: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5924 "sql.c" break; - case 82: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 197 "sql.y" + case 83: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5929 "sql.c" break; - case 83: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 198 "sql.y" + case 84: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5934 "sql.c" break; - case 84: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 199 "sql.y" + case 85: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5939 "sql.c" break; - case 85: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 202 "sql.y" + case 86: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 5944 "sql.c" break; - case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 205 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy983, &yymsp[-1].minor.yy585, yymsp[0].minor.yy826); } -#line 5949 "sql.c" + case 87: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy705, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } break; - case 87: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 206 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 5954 "sql.c" + case 88: /* cmd ::= DROP DATABASE exists_opt db_name */ +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 88: /* cmd ::= USE db_name */ -#line 207 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy585); } -#line 5959 "sql.c" + case 89: /* cmd ::= USE db_name */ +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } break; - case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 208 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy585, yymsp[0].minor.yy826); } -#line 5964 "sql.c" + case 90: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } break; - case 90: /* cmd ::= FLUSH DATABASE db_name */ -#line 209 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy585); } -#line 5969 "sql.c" + case 91: /* cmd ::= FLUSH DATABASE db_name */ +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } break; - case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 210 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy585, yymsp[0].minor.yy462); } -#line 5974 "sql.c" + case 92: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy756); } break; - case 92: /* cmd ::= S3MIGRATE DATABASE db_name */ -#line 211 "sql.y" -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy585); } -#line 5979 "sql.c" + case 93: /* cmd ::= S3MIGRATE DATABASE db_name */ +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } break; - case 93: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 212 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy585, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 5984 "sql.c" + case 94: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy649, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 94: /* not_exists_opt ::= IF NOT EXISTS */ -#line 216 "sql.y" -{ yymsp[-2].minor.yy983 = true; } -#line 5989 "sql.c" + case 95: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy705 = true; } break; - case 96: /* exists_opt ::= IF EXISTS */ - case 388: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==388); - case 419: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==419); -#line 221 "sql.y" -{ yymsp[-1].minor.yy983 = true; } -#line 5996 "sql.c" + case 97: /* exists_opt ::= IF EXISTS */ + case 392: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==392); + case 423: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==423); +{ yymsp[-1].minor.yy705 = true; } break; - case 98: /* db_options ::= */ -#line 224 "sql.y" -{ yymsp[1].minor.yy826 = createDefaultDatabaseOptions(pCxt); } -#line 6001 "sql.c" + case 99: /* db_options ::= */ +{ yymsp[1].minor.yy600 = createDefaultDatabaseOptions(pCxt); } break; - case 99: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 225 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 6006 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 100: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 100: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 226 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 6012 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 101: /* db_options ::= db_options CACHEMODEL NK_STRING */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 101: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 227 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 6018 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 102: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 102: /* db_options ::= db_options COMP NK_INTEGER */ -#line 228 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 6024 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 103: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 103: /* db_options ::= db_options DURATION NK_INTEGER */ - case 104: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==104); -#line 229 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 6031 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 104: /* db_options ::= db_options DURATION NK_INTEGER */ + case 105: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==105); +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 105: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 231 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 6037 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 106: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 106: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 232 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 6043 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 107: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 107: /* db_options ::= db_options KEEP integer_list */ - case 108: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==108); -#line 233 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_KEEP, yymsp[0].minor.yy616); } -#line 6050 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 108: /* db_options ::= db_options KEEP integer_list */ + case 109: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==109); +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP, yymsp[0].minor.yy748); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 109: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 235 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 6056 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 110: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 110: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 236 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6062 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 111: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 111: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 237 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6068 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 112: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 112: /* db_options ::= db_options PRECISION NK_STRING */ -#line 238 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 6074 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 113: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 113: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 239 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 6080 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 114: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 114: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 241 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 6086 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 115: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 115: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 242 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 6092 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 116: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 116: /* db_options ::= db_options RETENTIONS retention_list */ -#line 243 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_RETENTIONS, yymsp[0].minor.yy616); } -#line 6098 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 117: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_RETENTIONS, yymsp[0].minor.yy748); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 117: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 244 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 6104 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 118: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 118: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 245 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 6110 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 119: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 119: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 246 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 6116 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 120: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 247 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 6122 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 121: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 121: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 248 "sql.y" + case 122: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-3].minor.yy826, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 6132 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 253 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 6138 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 123: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 123: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 254 "sql.y" + case 124: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-3].minor.yy826, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 6148 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 124: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 259 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 6154 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 125: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 125: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 260 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 6160 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 126: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 126: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 261 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 6166 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 127: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 127: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 262 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy826); } -#line 6172 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 128: /* db_options ::= db_options TABLE_PREFIX signed */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy600); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 128: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 263 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy826); } -#line 6178 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 129: /* db_options ::= db_options TABLE_SUFFIX signed */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy600); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 129: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -#line 264 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } -#line 6184 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 130: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 130: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - case 131: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==131); -#line 265 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } -#line 6191 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 131: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ + case 132: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==132); +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 132: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -#line 267 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } -#line 6197 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 133: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 133: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 268 "sql.y" -{ yylhsminor.yy826 = setDatabaseOption(pCxt, yymsp[-2].minor.yy826, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 6203 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 134: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 134: /* alter_db_options ::= alter_db_option */ -#line 270 "sql.y" -{ yylhsminor.yy826 = createAlterDatabaseOptions(pCxt); yylhsminor.yy826 = setAlterDatabaseOption(pCxt, yylhsminor.yy826, &yymsp[0].minor.yy177); } -#line 6209 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 135: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ +{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 135: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 271 "sql.y" -{ yylhsminor.yy826 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy826, &yymsp[0].minor.yy177); } -#line 6215 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 136: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy600 = createAlterDatabaseOptions(pCxt); yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yylhsminor.yy600, &yymsp[0].minor.yy145); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 136: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 275 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6221 "sql.c" + case 137: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy600, &yymsp[0].minor.yy145); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 137: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 276 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6226 "sql.c" + case 138: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 138: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 277 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6231 "sql.c" + case 139: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 139: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 278 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6236 "sql.c" + case 140: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 140: /* alter_db_option ::= KEEP integer_list */ - case 141: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==141); -#line 279 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_KEEP; yymsp[-1].minor.yy177.pList = yymsp[0].minor.yy616; } -#line 6242 "sql.c" + case 141: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 142: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 281 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_PAGES; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6247 "sql.c" + case 142: /* alter_db_option ::= KEEP integer_list */ + case 143: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==143); +{ yymsp[-1].minor.yy145.type = DB_OPTION_KEEP; yymsp[-1].minor.yy145.pList = yymsp[0].minor.yy748; } break; - case 143: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 282 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6252 "sql.c" + case 144: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_PAGES; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 144: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 284 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_WAL; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6257 "sql.c" + case 145: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 145: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 285 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6262 "sql.c" + case 146: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_WAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 146: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 286 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6267 "sql.c" + case 147: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 147: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 287 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6272 "sql.c" + case 148: /* alter_db_option ::= MINROWS NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 148: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 288 "sql.y" + case 149: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 150: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy177.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy177.val = t; + yymsp[-2].minor.yy145.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy145.val = t; } -#line 6281 "sql.c" break; - case 149: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 293 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6286 "sql.c" + case 151: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 150: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 294 "sql.y" + case 152: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy177.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy177.val = t; + yymsp[-2].minor.yy145.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy145.val = t; } -#line 6295 "sql.c" - break; - case 151: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - case 152: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==152); -#line 299 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6301 "sql.c" - break; - case 153: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -#line 301 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6306 "sql.c" - break; - case 154: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 302 "sql.y" -{ yymsp[-1].minor.yy177.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6311 "sql.c" - break; - case 155: /* integer_list ::= NK_INTEGER */ -#line 306 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6316 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; - break; - case 156: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 432: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==432); -#line 307 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6323 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 157: /* variable_list ::= NK_VARIABLE */ -#line 311 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6329 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; - break; - case 158: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 312 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6335 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 159: /* retention_list ::= retention */ - case 191: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==191); - case 194: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==194); - case 201: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==201); - case 204: /* column_def_list ::= column_def */ yytestcase(yyruleno==204); - case 252: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==252); - case 257: /* col_name_list ::= col_name */ yytestcase(yyruleno==257); - case 325: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==325); - case 349: /* func_list ::= func */ yytestcase(yyruleno==349); - case 399: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==399); - case 476: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==476); - case 501: /* literal_list ::= signed_literal */ yytestcase(yyruleno==501); - case 575: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==575); - case 581: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==581); - case 657: /* select_list ::= select_item */ yytestcase(yyruleno==657); - case 668: /* partition_list ::= partition_item */ yytestcase(yyruleno==668); - case 729: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==729); -#line 316 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, yymsp[0].minor.yy826); } -#line 6357 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; - break; - case 160: /* retention_list ::= retention_list NK_COMMA retention */ - case 195: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==195); - case 202: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==202); - case 205: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==205); - case 253: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==253); - case 258: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==258); - case 326: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==326); - case 350: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==350); - case 400: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==400); - case 477: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==477); - case 502: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==502); - case 576: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==576); - case 658: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==658); - case 669: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==669); - case 730: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==730); -#line 317 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, yymsp[0].minor.yy826); } -#line 6377 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 161: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - case 162: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==162); -#line 319 "sql.y" -{ yylhsminor.yy826 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6384 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 163: /* speed_opt ::= */ - case 383: /* bufsize_opt ::= */ yytestcase(yyruleno==383); -#line 324 "sql.y" -{ yymsp[1].minor.yy462 = 0; } -#line 6391 "sql.c" - break; - case 164: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 384: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==384); -#line 325 "sql.y" -{ yymsp[-1].minor.yy462 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6397 "sql.c" - break; - case 166: /* start_opt ::= START WITH NK_INTEGER */ - case 170: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==170); -#line 328 "sql.y" -{ yymsp[-2].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 6403 "sql.c" - break; - case 167: /* start_opt ::= START WITH NK_STRING */ - case 171: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==171); -#line 329 "sql.y" -{ yymsp[-2].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6409 "sql.c" - break; - case 168: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 172: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==172); -#line 330 "sql.y" -{ yymsp[-3].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6415 "sql.c" - break; - case 173: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 175: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==175); -#line 339 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy983, yymsp[-5].minor.yy826, yymsp[-3].minor.yy616, yymsp[-1].minor.yy616, yymsp[0].minor.yy826); } -#line 6421 "sql.c" - break; - case 174: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 340 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy616); } -#line 6426 "sql.c" - break; - case 176: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 343 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy616); } -#line 6431 "sql.c" - break; - case 177: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 344 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy826); } -#line 6436 "sql.c" - break; - case 178: /* cmd ::= ALTER TABLE alter_table_clause */ - case 434: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==434); - case 435: /* cmd ::= insert_query */ yytestcase(yyruleno==435); -#line 346 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy826; } -#line 6443 "sql.c" - break; - case 179: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 347 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy826); } -#line 6448 "sql.c" - break; - case 180: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 349 "sql.y" -{ yylhsminor.yy826 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 6453 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; - break; - case 181: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -#line 351 "sql.y" -{ yylhsminor.yy826 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy585, yymsp[0].minor.yy146); } -#line 6459 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 182: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 352 "sql.y" -{ yylhsminor.yy826 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy826, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy585); } -#line 6465 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; - break; - case 183: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 354 "sql.y" -{ yylhsminor.yy826 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy585, yymsp[0].minor.yy146); } -#line 6471 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 184: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -#line 356 "sql.y" -{ yylhsminor.yy826 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy585, yymsp[0].minor.yy826); } -#line 6477 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 185: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 358 "sql.y" -{ yylhsminor.yy826 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy585, &yymsp[0].minor.yy585); } -#line 6483 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 186: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 360 "sql.y" -{ yylhsminor.yy826 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy585, yymsp[0].minor.yy146); } -#line 6489 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 187: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 361 "sql.y" -{ yylhsminor.yy826 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy826, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy585); } -#line 6495 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; - break; - case 188: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 363 "sql.y" -{ yylhsminor.yy826 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy585, yymsp[0].minor.yy146); } -#line 6501 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 189: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 365 "sql.y" -{ yylhsminor.yy826 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy826, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy585, &yymsp[0].minor.yy585); } -#line 6507 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 190: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -#line 367 "sql.y" -{ yylhsminor.yy826 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy826, &yymsp[-2].minor.yy585, yymsp[0].minor.yy826); } -#line 6513 "sql.c" - yymsp[-5].minor.yy826 = yylhsminor.yy826; - break; - case 192: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 582: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==582); -#line 372 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy826); } -#line 6520 "sql.c" - yymsp[-1].minor.yy616 = yylhsminor.yy616; - break; - case 193: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 376 "sql.y" -{ yylhsminor.yy826 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy983, yymsp[-8].minor.yy826, yymsp[-6].minor.yy826, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy826); } -#line 6526 "sql.c" - yymsp[-9].minor.yy826 = yylhsminor.yy826; - break; - case 196: /* drop_table_clause ::= exists_opt full_table_name */ -#line 383 "sql.y" -{ yylhsminor.yy826 = createDropTableClause(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy826); } -#line 6532 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; - break; - case 198: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 398: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==398); -#line 388 "sql.y" -{ yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; } -#line 6539 "sql.c" - break; - case 199: /* full_table_name ::= table_name */ - case 339: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==339); -#line 390 "sql.y" -{ yylhsminor.yy826 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy585, NULL); } -#line 6545 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; - break; - case 200: /* full_table_name ::= db_name NK_DOT table_name */ - case 340: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==340); -#line 391 "sql.y" -{ yylhsminor.yy826 = createRealTableNode(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585, NULL); } -#line 6552 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 203: /* tag_def ::= column_name type_name */ -#line 397 "sql.y" -{ yylhsminor.yy826 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy585, yymsp[0].minor.yy146, NULL); } -#line 6558 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; - break; - case 206: /* column_def ::= column_name type_name column_options */ -#line 405 "sql.y" -{ yylhsminor.yy826 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy585, yymsp[-1].minor.yy146, yymsp[0].minor.yy826); } -#line 6564 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 207: /* type_name ::= BOOL */ -#line 409 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6570 "sql.c" - break; - case 208: /* type_name ::= TINYINT */ -#line 410 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6575 "sql.c" - break; - case 209: /* type_name ::= SMALLINT */ -#line 411 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6580 "sql.c" - break; - case 210: /* type_name ::= INT */ - case 211: /* type_name ::= INTEGER */ yytestcase(yyruleno==211); -#line 412 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_INT); } -#line 6586 "sql.c" - break; - case 212: /* type_name ::= BIGINT */ -#line 414 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 6591 "sql.c" - break; - case 213: /* type_name ::= FLOAT */ -#line 415 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 6596 "sql.c" - break; - case 214: /* type_name ::= DOUBLE */ -#line 416 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 6601 "sql.c" - break; - case 215: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 417 "sql.y" -{ yymsp[-3].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 6606 "sql.c" - break; - case 216: /* type_name ::= TIMESTAMP */ -#line 418 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 6611 "sql.c" - break; - case 217: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 419 "sql.y" -{ yymsp[-3].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 6616 "sql.c" - break; - case 218: /* type_name ::= TINYINT UNSIGNED */ -#line 420 "sql.y" -{ yymsp[-1].minor.yy146 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 6621 "sql.c" - break; - case 219: /* type_name ::= SMALLINT UNSIGNED */ -#line 421 "sql.y" -{ yymsp[-1].minor.yy146 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 6626 "sql.c" - break; - case 220: /* type_name ::= INT UNSIGNED */ -#line 422 "sql.y" -{ yymsp[-1].minor.yy146 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 6631 "sql.c" - break; - case 221: /* type_name ::= BIGINT UNSIGNED */ -#line 423 "sql.y" -{ yymsp[-1].minor.yy146 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 6636 "sql.c" - break; - case 222: /* type_name ::= JSON */ -#line 424 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 6641 "sql.c" - break; - case 223: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 425 "sql.y" -{ yymsp[-3].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 6646 "sql.c" - break; - case 224: /* type_name ::= MEDIUMBLOB */ -#line 426 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 6651 "sql.c" - break; - case 225: /* type_name ::= BLOB */ -#line 427 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 6656 "sql.c" - break; - case 226: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 428 "sql.y" -{ yymsp[-3].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 6661 "sql.c" - break; - case 227: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 429 "sql.y" -{ yymsp[-3].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 6666 "sql.c" - break; - case 228: /* type_name ::= DECIMAL */ -#line 430 "sql.y" -{ yymsp[0].minor.yy146 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6671 "sql.c" - break; - case 229: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 431 "sql.y" -{ yymsp[-3].minor.yy146 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6676 "sql.c" - break; - case 230: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 432 "sql.y" -{ yymsp[-5].minor.yy146 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6681 "sql.c" - break; - case 231: /* type_name_default_len ::= BINARY */ -#line 436 "sql.y" -{ yymsp[0].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } -#line 6686 "sql.c" - break; - case 232: /* type_name_default_len ::= NCHAR */ -#line 437 "sql.y" -{ yymsp[0].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } -#line 6691 "sql.c" - break; - case 233: /* type_name_default_len ::= VARCHAR */ -#line 438 "sql.y" -{ yymsp[0].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } -#line 6696 "sql.c" - break; - case 234: /* type_name_default_len ::= VARBINARY */ -#line 439 "sql.y" -{ yymsp[0].minor.yy146 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } -#line 6701 "sql.c" - break; - case 237: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 406: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==406); -#line 448 "sql.y" -{ yymsp[-3].minor.yy616 = yymsp[-1].minor.yy616; } -#line 6707 "sql.c" - break; - case 238: /* table_options ::= */ -#line 450 "sql.y" -{ yymsp[1].minor.yy826 = createDefaultTableOptions(pCxt); } -#line 6712 "sql.c" - break; - case 239: /* table_options ::= table_options COMMENT NK_STRING */ -#line 451 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-2].minor.yy826, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6717 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 240: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 452 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-2].minor.yy826, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy616); } -#line 6723 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 241: /* table_options ::= table_options WATERMARK duration_list */ -#line 453 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-2].minor.yy826, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy616); } -#line 6729 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 242: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 454 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-4].minor.yy826, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy616); } -#line 6735 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 243: /* table_options ::= table_options TTL NK_INTEGER */ -#line 455 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-2].minor.yy826, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6741 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 244: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 456 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-4].minor.yy826, TABLE_OPTION_SMA, yymsp[-1].minor.yy616); } -#line 6747 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; - break; - case 245: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 457 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-2].minor.yy826, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy616); } -#line 6753 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; - break; - case 246: /* alter_table_options ::= alter_table_option */ -#line 459 "sql.y" -{ yylhsminor.yy826 = createAlterTableOptions(pCxt); yylhsminor.yy826 = setTableOption(pCxt, yylhsminor.yy826, yymsp[0].minor.yy177.type, &yymsp[0].minor.yy177.val); } -#line 6759 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; - break; - case 247: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 460 "sql.y" -{ yylhsminor.yy826 = setTableOption(pCxt, yymsp[-1].minor.yy826, yymsp[0].minor.yy177.type, &yymsp[0].minor.yy177.val); } -#line 6765 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; - break; - case 248: /* alter_table_option ::= COMMENT NK_STRING */ -#line 464 "sql.y" -{ yymsp[-1].minor.yy177.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6771 "sql.c" - break; - case 249: /* alter_table_option ::= TTL NK_INTEGER */ -#line 465 "sql.y" -{ yymsp[-1].minor.yy177.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy177.val = yymsp[0].minor.yy0; } -#line 6776 "sql.c" - break; - case 250: /* duration_list ::= duration_literal */ - case 534: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==534); -#line 469 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 6782 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; - break; - case 251: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 535: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==535); -#line 470 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 6789 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 254: /* rollup_func_name ::= function_name */ -#line 477 "sql.y" -{ yylhsminor.yy826 = createFunctionNode(pCxt, &yymsp[0].minor.yy585, NULL); } -#line 6795 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; - break; - case 255: /* rollup_func_name ::= FIRST */ - case 256: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==256); - case 328: /* tag_item ::= QTAGS */ yytestcase(yyruleno==328); -#line 478 "sql.y" -{ yylhsminor.yy826 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6803 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; - break; - case 259: /* col_name ::= column_name */ - case 329: /* tag_item ::= column_name */ yytestcase(yyruleno==329); -#line 486 "sql.y" -{ yylhsminor.yy826 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy585); } -#line 6810 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; - break; - case 260: /* cmd ::= SHOW DNODES */ -#line 489 "sql.y" + break; + case 153: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + case 154: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==154); +{ yymsp[-1].minor.yy145.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 155: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 156: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 157: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 158: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy748 = yylhsminor.yy748; + break; + case 159: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 436: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==436); +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; + break; + case 160: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy748 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy748 = yylhsminor.yy748; + break; + case 161: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; + break; + case 162: /* retention_list ::= retention */ + case 194: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==194); + case 197: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==197); + case 204: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==204); + case 207: /* column_def_list ::= column_def */ yytestcase(yyruleno==207); + case 255: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==255); + case 260: /* col_name_list ::= col_name */ yytestcase(yyruleno==260); + case 329: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==329); + case 353: /* func_list ::= func */ yytestcase(yyruleno==353); + case 403: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==403); + case 480: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==480); + case 505: /* literal_list ::= signed_literal */ yytestcase(yyruleno==505); + case 579: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==579); + case 585: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==585); + case 661: /* select_list ::= select_item */ yytestcase(yyruleno==661); + case 672: /* partition_list ::= partition_item */ yytestcase(yyruleno==672); + case 733: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==733); +{ yylhsminor.yy748 = createNodeList(pCxt, yymsp[0].minor.yy600); } + yymsp[0].minor.yy748 = yylhsminor.yy748; + break; + case 163: /* retention_list ::= retention_list NK_COMMA retention */ + case 198: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==198); + case 205: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==205); + case 208: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==208); + case 256: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==256); + case 261: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==261); + case 330: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==330); + case 354: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==354); + case 404: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==404); + case 481: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==481); + case 506: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==506); + case 580: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==580); + case 662: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==662); + case 673: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==673); + case 734: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==734); +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; + break; + case 164: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 165: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==165); +{ yylhsminor.yy600 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 166: /* speed_opt ::= */ + case 387: /* bufsize_opt ::= */ yytestcase(yyruleno==387); +{ yymsp[1].minor.yy756 = 0; } + break; + case 167: /* speed_opt ::= BWLIMIT NK_INTEGER */ + case 388: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==388); +{ yymsp[-1].minor.yy756 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 169: /* start_opt ::= START WITH NK_INTEGER */ + case 173: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==173); +{ yymsp[-2].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 170: /* start_opt ::= START WITH NK_STRING */ + case 174: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==174); +{ yymsp[-2].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 171: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 175: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==175); +{ yymsp[-3].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 176: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 178: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==178); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy705, yymsp[-5].minor.yy600, yymsp[-3].minor.yy748, yymsp[-1].minor.yy748, yymsp[0].minor.yy600); } + break; + case 177: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy748); } + break; + case 179: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy748); } + break; + case 180: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } + break; + case 181: /* cmd ::= ALTER TABLE alter_table_clause */ + case 438: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==438); + case 439: /* cmd ::= insert_query */ yytestcase(yyruleno==439); +{ pCxt->pRootNode = yymsp[0].minor.yy600; } + break; + case 182: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy600); } + break; + case 183: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy600 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; + break; + case 184: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 185: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy649); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; + break; + case 186: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 187: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ +{ yylhsminor.yy600 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy649, yymsp[0].minor.yy600); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 188: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 189: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 190: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy649); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; + break; + case 191: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 192: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 193: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ +{ yylhsminor.yy600 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy600, &yymsp[-2].minor.yy649, yymsp[0].minor.yy600); } + yymsp[-5].minor.yy600 = yylhsminor.yy600; + break; + case 195: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 586: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==586); +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-1].minor.yy748, yymsp[0].minor.yy600); } + yymsp[-1].minor.yy748 = yylhsminor.yy748; + break; + case 196: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ +{ yylhsminor.yy600 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy705, yymsp[-8].minor.yy600, yymsp[-6].minor.yy600, yymsp[-5].minor.yy748, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } + yymsp[-9].minor.yy600 = yylhsminor.yy600; + break; + case 199: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy600 = createDropTableClause(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; + break; + case 201: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 402: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==402); +{ yymsp[-2].minor.yy748 = yymsp[-1].minor.yy748; } + break; + case 202: /* full_table_name ::= table_name */ + case 343: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==343); +{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy649, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; + break; + case 203: /* full_table_name ::= db_name NK_DOT table_name */ + case 344: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==344); +{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649, NULL); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 206: /* tag_def ::= column_name type_name */ +{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy649, yymsp[0].minor.yy400, NULL); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; + break; + case 209: /* column_def ::= column_name type_name column_options */ +{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy649, yymsp[-1].minor.yy400, yymsp[0].minor.yy600); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 210: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } + break; + case 211: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } + break; + case 212: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + break; + case 213: /* type_name ::= INT */ + case 214: /* type_name ::= INTEGER */ yytestcase(yyruleno==214); +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } + break; + case 215: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } + break; + case 216: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } + break; + case 217: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + break; + case 218: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + break; + case 219: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + break; + case 220: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + break; + case 221: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + break; + case 222: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + break; + case 223: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } + break; + case 224: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + break; + case 225: /* type_name ::= JSON */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } + break; + case 226: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + break; + case 227: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + break; + case 228: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } + break; + case 229: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + break; + case 230: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + break; + case 231: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 232: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 233: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 234: /* type_name_default_len ::= BINARY */ +{ yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } + break; + case 235: /* type_name_default_len ::= NCHAR */ +{ yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } + break; + case 236: /* type_name_default_len ::= VARCHAR */ +{ yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } + break; + case 237: /* type_name_default_len ::= VARBINARY */ +{ yymsp[0].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } + break; + case 240: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + case 410: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==410); +{ yymsp[-3].minor.yy748 = yymsp[-1].minor.yy748; } + break; + case 241: /* table_options ::= */ +{ yymsp[1].minor.yy600 = createDefaultTableOptions(pCxt); } + break; + case 242: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 243: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy748); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 244: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy748); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 245: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy748); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 246: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 247: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_SMA, yymsp[-1].minor.yy748); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; + break; + case 248: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy748); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; + break; + case 249: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy600 = createAlterTableOptions(pCxt); yylhsminor.yy600 = setTableOption(pCxt, yylhsminor.yy600, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[0].minor.yy600 = yylhsminor.yy600; + break; + case 250: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; + break; + case 251: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy145.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 252: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 253: /* duration_list ::= duration_literal */ + case 538: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==538); +{ yylhsminor.yy748 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + yymsp[0].minor.yy748 = yylhsminor.yy748; + break; + case 254: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 539: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==539); +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; + break; + case 257: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy649, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; + break; + case 258: /* rollup_func_name ::= FIRST */ + case 259: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==259); + case 332: /* tag_item ::= QTAGS */ yytestcase(yyruleno==332); +{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; + break; + case 262: /* col_name ::= column_name */ + case 333: /* tag_item ::= column_name */ yytestcase(yyruleno==333); +{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy649); } + yymsp[0].minor.yy600 = yylhsminor.yy600; + break; + case 263: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6816 "sql.c" break; - case 261: /* cmd ::= SHOW USERS */ -#line 490 "sql.y" + case 264: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6821 "sql.c" break; - case 262: /* cmd ::= SHOW USER PRIVILEGES */ -#line 491 "sql.y" + case 265: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6826 "sql.c" break; - case 263: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 492 "sql.y" + case 266: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy857); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy245); } -#line 6834 "sql.c" break; - case 264: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 496 "sql.y" + case 267: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy347, yymsp[0].minor.yy826, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy125, yymsp[0].minor.yy600, OP_TYPE_LIKE); } -#line 6841 "sql.c" break; - case 265: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 499 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy826, yymsp[0].minor.yy826, OP_TYPE_LIKE); } -#line 6846 "sql.c" + case 268: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } break; - case 266: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 500 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy826, NULL, OP_TYPE_LIKE); } -#line 6851 "sql.c" + case 269: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy600, NULL, OP_TYPE_LIKE); } break; - case 267: /* cmd ::= SHOW MNODES */ -#line 501 "sql.y" + case 270: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6856 "sql.c" break; - case 268: /* cmd ::= SHOW QNODES */ -#line 503 "sql.y" + case 271: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6861 "sql.c" break; - case 269: /* cmd ::= SHOW ARBGROUPS */ -#line 504 "sql.y" + case 272: /* cmd ::= SHOW ARBGROUPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } -#line 6866 "sql.c" break; - case 270: /* cmd ::= SHOW FUNCTIONS */ -#line 505 "sql.y" + case 273: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6871 "sql.c" break; - case 271: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 506 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy826, yymsp[-1].minor.yy826, OP_TYPE_EQUAL); } -#line 6876 "sql.c" + case 274: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } break; - case 272: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 507 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy585), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy585), OP_TYPE_EQUAL); } -#line 6881 "sql.c" + case 275: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), OP_TYPE_EQUAL); } break; - case 273: /* cmd ::= SHOW STREAMS */ -#line 508 "sql.y" + case 276: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6886 "sql.c" break; - case 274: /* cmd ::= SHOW ACCOUNTS */ -#line 509 "sql.y" + case 277: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6891 "sql.c" break; - case 275: /* cmd ::= SHOW APPS */ -#line 510 "sql.y" + case 278: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6896 "sql.c" break; - case 276: /* cmd ::= SHOW CONNECTIONS */ -#line 511 "sql.y" + case 279: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 6901 "sql.c" break; - case 277: /* cmd ::= SHOW LICENCES */ - case 278: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==278); -#line 512 "sql.y" + case 280: /* cmd ::= SHOW LICENCES */ + case 281: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==281); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 6907 "sql.c" break; - case 279: /* cmd ::= SHOW GRANTS FULL */ -#line 514 "sql.y" + case 282: /* cmd ::= SHOW GRANTS FULL */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 6912 "sql.c" break; - case 280: /* cmd ::= SHOW GRANTS LOGS */ -#line 515 "sql.y" + case 283: /* cmd ::= SHOW GRANTS LOGS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 6917 "sql.c" break; - case 281: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 516 "sql.y" + case 284: /* cmd ::= SHOW CLUSTER MACHINES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 6922 "sql.c" break; - case 282: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 517 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy585); } -#line 6927 "sql.c" + case 285: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy649); } break; - case 283: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 518 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy826); } -#line 6932 "sql.c" + case 286: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy600); } break; - case 284: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 519 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy826); } -#line 6937 "sql.c" + case 287: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, +yymsp[0].minor.yy600); } break; - case 285: /* cmd ::= SHOW QUERIES */ -#line 520 "sql.y" + case 288: /* cmd ::= SHOW ENCRYPTIONS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } + break; + case 289: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 6942 "sql.c" break; - case 286: /* cmd ::= SHOW SCORES */ -#line 521 "sql.y" + case 290: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 6947 "sql.c" break; - case 287: /* cmd ::= SHOW TOPICS */ -#line 522 "sql.y" + case 291: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 6952 "sql.c" break; - case 288: /* cmd ::= SHOW VARIABLES */ - case 289: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==289); -#line 523 "sql.y" + case 292: /* cmd ::= SHOW VARIABLES */ + case 293: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==293); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 6958 "sql.c" break; - case 290: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 525 "sql.y" + case 294: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 6963 "sql.c" break; - case 291: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 526 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy826); } -#line 6968 "sql.c" + case 295: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy600); } break; - case 292: /* cmd ::= SHOW BNODES */ -#line 527 "sql.y" + case 296: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 6973 "sql.c" break; - case 293: /* cmd ::= SHOW SNODES */ -#line 528 "sql.y" + case 297: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 6978 "sql.c" break; - case 294: /* cmd ::= SHOW CLUSTER */ -#line 529 "sql.y" + case 298: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 6983 "sql.c" break; - case 295: /* cmd ::= SHOW TRANSACTIONS */ -#line 530 "sql.y" + case 299: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 6988 "sql.c" break; - case 296: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 531 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy826); } -#line 6993 "sql.c" + case 300: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy600); } break; - case 297: /* cmd ::= SHOW CONSUMERS */ -#line 532 "sql.y" + case 301: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 6998 "sql.c" break; - case 298: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 533 "sql.y" + case 302: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 7003 "sql.c" break; - case 299: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 534 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy826, yymsp[-1].minor.yy826, OP_TYPE_EQUAL); } -#line 7008 "sql.c" + case 303: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); } break; - case 300: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 535 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy585), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy585), OP_TYPE_EQUAL); } -#line 7013 "sql.c" + case 304: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), OP_TYPE_EQUAL); } break; - case 301: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 536 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy826, yymsp[0].minor.yy826, yymsp[-3].minor.yy616); } -#line 7018 "sql.c" + case 305: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600, yymsp[-3].minor.yy748); } break; - case 302: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 537 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy585), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy585), yymsp[-4].minor.yy616); } -#line 7023 "sql.c" + case 306: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy649), yymsp[-4].minor.yy748); } break; - case 303: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 538 "sql.y" + case 307: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 7028 "sql.c" break; - case 304: /* cmd ::= SHOW VNODES */ -#line 539 "sql.y" + case 308: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 7033 "sql.c" break; - case 305: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 541 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy826, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 7038 "sql.c" + case 309: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy600, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 306: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 542 "sql.y" + case 310: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 7043 "sql.c" break; - case 307: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 543 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy826, yymsp[0].minor.yy826, OP_TYPE_LIKE); } -#line 7048 "sql.c" + case 311: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); } break; - case 308: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 544 "sql.y" -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy826); } -#line 7053 "sql.c" + case 312: /* cmd ::= SHOW CREATE VIEW full_table_name */ +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy600); } break; - case 309: /* cmd ::= SHOW COMPACTS */ -#line 545 "sql.y" + case 313: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 7058 "sql.c" break; - case 310: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 546 "sql.y" + case 314: /* cmd ::= SHOW COMPACT NK_INTEGER */ { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7063 "sql.c" break; - case 311: /* table_kind_db_name_cond_opt ::= */ -#line 550 "sql.y" -{ yymsp[1].minor.yy347.kind = SHOW_KIND_ALL; yymsp[1].minor.yy347.dbName = nil_token; } -#line 7068 "sql.c" + case 315: /* table_kind_db_name_cond_opt ::= */ +{ yymsp[1].minor.yy125.kind = SHOW_KIND_ALL; yymsp[1].minor.yy125.dbName = nil_token; } break; - case 312: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 551 "sql.y" -{ yylhsminor.yy347.kind = yymsp[0].minor.yy857; yylhsminor.yy347.dbName = nil_token; } -#line 7073 "sql.c" - yymsp[0].minor.yy347 = yylhsminor.yy347; + case 316: /* table_kind_db_name_cond_opt ::= table_kind */ +{ yylhsminor.yy125.kind = yymsp[0].minor.yy245; yylhsminor.yy125.dbName = nil_token; } + yymsp[0].minor.yy125 = yylhsminor.yy125; break; - case 313: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 552 "sql.y" -{ yylhsminor.yy347.kind = SHOW_KIND_ALL; yylhsminor.yy347.dbName = yymsp[-1].minor.yy585; } -#line 7079 "sql.c" - yymsp[-1].minor.yy347 = yylhsminor.yy347; + case 317: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy125.kind = SHOW_KIND_ALL; yylhsminor.yy125.dbName = yymsp[-1].minor.yy649; } + yymsp[-1].minor.yy125 = yylhsminor.yy125; break; - case 314: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 553 "sql.y" -{ yylhsminor.yy347.kind = yymsp[-2].minor.yy857; yylhsminor.yy347.dbName = yymsp[-1].minor.yy585; } -#line 7085 "sql.c" - yymsp[-2].minor.yy347 = yylhsminor.yy347; + case 318: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +{ yylhsminor.yy125.kind = yymsp[-2].minor.yy245; yylhsminor.yy125.dbName = yymsp[-1].minor.yy649; } + yymsp[-2].minor.yy125 = yylhsminor.yy125; break; - case 315: /* table_kind ::= NORMAL */ -#line 557 "sql.y" -{ yymsp[0].minor.yy857 = SHOW_KIND_TABLES_NORMAL; } -#line 7091 "sql.c" + case 319: /* table_kind ::= NORMAL */ +{ yymsp[0].minor.yy245 = SHOW_KIND_TABLES_NORMAL; } break; - case 316: /* table_kind ::= CHILD */ -#line 558 "sql.y" -{ yymsp[0].minor.yy857 = SHOW_KIND_TABLES_CHILD; } -#line 7096 "sql.c" + case 320: /* table_kind ::= CHILD */ +{ yymsp[0].minor.yy245 = SHOW_KIND_TABLES_CHILD; } break; - case 317: /* db_name_cond_opt ::= */ - case 322: /* from_db_opt ::= */ yytestcase(yyruleno==322); -#line 560 "sql.y" -{ yymsp[1].minor.yy826 = createDefaultDatabaseCondValue(pCxt); } -#line 7102 "sql.c" + case 321: /* db_name_cond_opt ::= */ + case 326: /* from_db_opt ::= */ yytestcase(yyruleno==326); +{ yymsp[1].minor.yy600 = createDefaultDatabaseCondValue(pCxt); } break; - case 318: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 561 "sql.y" -{ yylhsminor.yy826 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy585); } -#line 7107 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 322: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy649); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 320: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 564 "sql.y" -{ yymsp[-1].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7113 "sql.c" + case 324: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 321: /* table_name_cond ::= table_name */ -#line 566 "sql.y" -{ yylhsminor.yy826 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy585); } -#line 7118 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 325: /* table_name_cond ::= table_name */ +{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 323: /* from_db_opt ::= FROM db_name */ -#line 569 "sql.y" -{ yymsp[-1].minor.yy826 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy585); } -#line 7124 "sql.c" + case 327: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy649); } break; - case 327: /* tag_item ::= TBNAME */ -#line 577 "sql.y" -{ yylhsminor.yy826 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 7129 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 331: /* tag_item ::= TBNAME */ +{ yylhsminor.yy600 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 330: /* tag_item ::= column_name column_alias */ -#line 580 "sql.y" -{ yylhsminor.yy826 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy585), &yymsp[0].minor.yy585); } -#line 7135 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 334: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy649), &yymsp[0].minor.yy649); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 331: /* tag_item ::= column_name AS column_alias */ -#line 581 "sql.y" -{ yylhsminor.yy826 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy585), &yymsp[0].minor.yy585); } -#line 7141 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 335: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy649), &yymsp[0].minor.yy649); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 332: /* db_kind_opt ::= */ -#line 585 "sql.y" -{ yymsp[1].minor.yy857 = SHOW_KIND_ALL; } -#line 7147 "sql.c" + case 336: /* db_kind_opt ::= */ +{ yymsp[1].minor.yy245 = SHOW_KIND_ALL; } break; - case 333: /* db_kind_opt ::= USER */ -#line 586 "sql.y" -{ yymsp[0].minor.yy857 = SHOW_KIND_DATABASES_USER; } -#line 7152 "sql.c" + case 337: /* db_kind_opt ::= USER */ +{ yymsp[0].minor.yy245 = SHOW_KIND_DATABASES_USER; } break; - case 334: /* db_kind_opt ::= SYSTEM */ -#line 587 "sql.y" -{ yymsp[0].minor.yy857 = SHOW_KIND_DATABASES_SYSTEM; } -#line 7157 "sql.c" + case 338: /* db_kind_opt ::= SYSTEM */ +{ yymsp[0].minor.yy245 = SHOW_KIND_DATABASES_SYSTEM; } break; - case 335: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -#line 593 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy983, &yymsp[-7].minor.yy585, yymsp[-4].minor.yy826, yymsp[-5].minor.yy826, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 7162 "sql.c" + case 339: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy705, &yymsp[-7].minor.yy649, yymsp[-4].minor.yy600, yymsp[-5].minor.yy600, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 336: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -#line 595 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy983, &yymsp[-6].minor.yy585, NULL, yymsp[-4].minor.yy826, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 7167 "sql.c" + case 340: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy705, &yymsp[-6].minor.yy649, NULL, yymsp[-4].minor.yy600, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 337: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -#line 596 "sql.y" -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy826); } -#line 7172 "sql.c" + case 341: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } break; - case 338: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -#line 597 "sql.y" -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy826); } -#line 7177 "sql.c" + case 342: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy600); } break; - case 341: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -#line 604 "sql.y" -{ yymsp[-3].minor.yy826 = createTSMAOptions(pCxt, yymsp[-1].minor.yy616); } -#line 7182 "sql.c" + case 345: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +{ yymsp[-3].minor.yy600 = createTSMAOptions(pCxt, yymsp[-1].minor.yy748); } break; - case 342: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 608 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy983, yymsp[-3].minor.yy826, yymsp[-1].minor.yy826, NULL, yymsp[0].minor.yy826); } -#line 7187 "sql.c" + case 346: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy705, yymsp[-3].minor.yy600, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } break; - case 343: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 610 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy983, yymsp[-5].minor.yy826, yymsp[-3].minor.yy826, yymsp[-1].minor.yy616, NULL); } -#line 7192 "sql.c" + case 347: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy705, yymsp[-5].minor.yy600, yymsp[-3].minor.yy600, yymsp[-1].minor.yy748, NULL); } break; - case 344: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 611 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy826); } -#line 7197 "sql.c" + case 348: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } break; - case 345: /* full_index_name ::= index_name */ -#line 613 "sql.y" -{ yylhsminor.yy826 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy585); } -#line 7202 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 349: /* full_index_name ::= index_name */ +{ yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy649); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 346: /* full_index_name ::= db_name NK_DOT index_name */ -#line 614 "sql.y" -{ yylhsminor.yy826 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585); } -#line 7208 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 350: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 347: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 617 "sql.y" -{ yymsp[-9].minor.yy826 = createIndexOption(pCxt, yymsp[-7].minor.yy616, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), NULL, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 7214 "sql.c" + case 351: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy600 = createIndexOption(pCxt, yymsp[-7].minor.yy748, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 348: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 620 "sql.y" -{ yymsp[-11].minor.yy826 = createIndexOption(pCxt, yymsp[-9].minor.yy616, releaseRawExprNode(pCxt, yymsp[-5].minor.yy826), releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 7219 "sql.c" + case 352: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-11].minor.yy600 = createIndexOption(pCxt, yymsp[-9].minor.yy748, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 351: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 627 "sql.y" -{ yylhsminor.yy826 = createFunctionNode(pCxt, &yymsp[-3].minor.yy585, yymsp[-1].minor.yy616); } -#line 7224 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 355: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[-3].minor.yy649, yymsp[-1].minor.yy748); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 352: /* sma_func_name ::= function_name */ - case 625: /* alias_opt ::= table_alias */ yytestcase(yyruleno==625); -#line 631 "sql.y" -{ yylhsminor.yy585 = yymsp[0].minor.yy585; } -#line 7231 "sql.c" - yymsp[0].minor.yy585 = yylhsminor.yy585; + case 356: /* sma_func_name ::= function_name */ + case 629: /* alias_opt ::= table_alias */ yytestcase(yyruleno==629); +{ yylhsminor.yy649 = yymsp[0].minor.yy649; } + yymsp[0].minor.yy649 = yylhsminor.yy649; break; - case 357: /* sma_stream_opt ::= */ - case 407: /* stream_options ::= */ yytestcase(yyruleno==407); -#line 637 "sql.y" -{ yymsp[1].minor.yy826 = createStreamOptions(pCxt); } -#line 7238 "sql.c" + case 361: /* sma_stream_opt ::= */ + case 411: /* stream_options ::= */ yytestcase(yyruleno==411); +{ yymsp[1].minor.yy600 = createStreamOptions(pCxt); } break; - case 358: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 638 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy826)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy826); yylhsminor.yy826 = yymsp[-2].minor.yy826; } -#line 7243 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 362: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 359: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 639 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy826)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy826); yylhsminor.yy826 = yymsp[-2].minor.yy826; } -#line 7249 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 363: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 360: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 640 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy826)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy826); yylhsminor.yy826 = yymsp[-2].minor.yy826; } -#line 7255 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 364: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 361: /* with_meta ::= AS */ -#line 645 "sql.y" -{ yymsp[0].minor.yy462 = 0; } -#line 7261 "sql.c" + case 365: /* with_meta ::= AS */ +{ yymsp[0].minor.yy756 = 0; } break; - case 362: /* with_meta ::= WITH META AS */ -#line 646 "sql.y" -{ yymsp[-2].minor.yy462 = 1; } -#line 7266 "sql.c" + case 366: /* with_meta ::= WITH META AS */ +{ yymsp[-2].minor.yy756 = 1; } break; - case 363: /* with_meta ::= ONLY META AS */ -#line 647 "sql.y" -{ yymsp[-2].minor.yy462 = 2; } -#line 7271 "sql.c" + case 367: /* with_meta ::= ONLY META AS */ +{ yymsp[-2].minor.yy756 = 2; } break; - case 364: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 649 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy983, &yymsp[-2].minor.yy585, yymsp[0].minor.yy826); } -#line 7276 "sql.c" + case 368: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy705, &yymsp[-2].minor.yy649, yymsp[0].minor.yy600); } break; - case 365: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 651 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy983, &yymsp[-3].minor.yy585, &yymsp[0].minor.yy585, yymsp[-2].minor.yy462); } -#line 7281 "sql.c" + case 369: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy705, &yymsp[-3].minor.yy649, &yymsp[0].minor.yy649, yymsp[-2].minor.yy756); } break; - case 366: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 653 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy983, &yymsp[-4].minor.yy585, yymsp[-1].minor.yy826, yymsp[-3].minor.yy462, yymsp[0].minor.yy826); } -#line 7286 "sql.c" + case 370: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy705, &yymsp[-4].minor.yy649, yymsp[-1].minor.yy600, yymsp[-3].minor.yy756, yymsp[0].minor.yy600); } break; - case 367: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 655 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 7291 "sql.c" + case 371: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 368: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 656 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy983, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585); } -#line 7296 "sql.c" + case 372: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy705, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } break; - case 369: /* cmd ::= DESC full_table_name */ - case 370: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==370); -#line 659 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy826); } -#line 7302 "sql.c" + case 373: /* cmd ::= DESC full_table_name */ + case 374: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==374); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy600); } break; - case 371: /* cmd ::= RESET QUERY CACHE */ -#line 663 "sql.y" + case 375: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 7307 "sql.c" break; - case 372: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 373: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==373); -#line 666 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy983, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 7313 "sql.c" + case 376: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 377: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==377); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy705, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 376: /* explain_options ::= */ -#line 674 "sql.y" -{ yymsp[1].minor.yy826 = createDefaultExplainOptions(pCxt); } -#line 7318 "sql.c" + case 380: /* explain_options ::= */ +{ yymsp[1].minor.yy600 = createDefaultExplainOptions(pCxt); } break; - case 377: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 675 "sql.y" -{ yylhsminor.yy826 = setExplainVerbose(pCxt, yymsp[-2].minor.yy826, &yymsp[0].minor.yy0); } -#line 7323 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 381: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy600 = setExplainVerbose(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 378: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 676 "sql.y" -{ yylhsminor.yy826 = setExplainRatio(pCxt, yymsp[-2].minor.yy826, &yymsp[0].minor.yy0); } -#line 7329 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 382: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy600 = setExplainRatio(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 379: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 681 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy983, yymsp[-9].minor.yy983, &yymsp[-6].minor.yy585, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy146, yymsp[-1].minor.yy462, &yymsp[0].minor.yy585, yymsp[-10].minor.yy983); } -#line 7335 "sql.c" + case 383: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy705, yymsp[-9].minor.yy705, &yymsp[-6].minor.yy649, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy400, yymsp[-1].minor.yy756, &yymsp[0].minor.yy649, yymsp[-10].minor.yy705); } break; - case 380: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 682 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 7340 "sql.c" + case 384: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 385: /* language_opt ::= */ - case 429: /* on_vgroup_id ::= */ yytestcase(yyruleno==429); -#line 696 "sql.y" -{ yymsp[1].minor.yy585 = nil_token; } -#line 7346 "sql.c" + case 389: /* language_opt ::= */ + case 433: /* on_vgroup_id ::= */ yytestcase(yyruleno==433); +{ yymsp[1].minor.yy649 = nil_token; } break; - case 386: /* language_opt ::= LANGUAGE NK_STRING */ - case 430: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==430); -#line 697 "sql.y" -{ yymsp[-1].minor.yy585 = yymsp[0].minor.yy0; } -#line 7352 "sql.c" + case 390: /* language_opt ::= LANGUAGE NK_STRING */ + case 434: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==434); +{ yymsp[-1].minor.yy649 = yymsp[0].minor.yy0; } break; - case 389: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 706 "sql.y" -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy983, yymsp[-2].minor.yy826, &yymsp[-1].minor.yy0, yymsp[0].minor.yy826); } -#line 7357 "sql.c" + case 393: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy705, yymsp[-2].minor.yy600, &yymsp[-1].minor.yy0, yymsp[0].minor.yy600); } break; - case 390: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 707 "sql.y" -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy983, yymsp[0].minor.yy826); } -#line 7362 "sql.c" + case 394: /* cmd ::= DROP VIEW exists_opt full_view_name */ +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy705, yymsp[0].minor.yy600); } break; - case 391: /* full_view_name ::= view_name */ -#line 709 "sql.y" -{ yylhsminor.yy826 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy585); } -#line 7367 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 395: /* full_view_name ::= view_name */ +{ yylhsminor.yy600 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy649); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 392: /* full_view_name ::= db_name NK_DOT view_name */ -#line 710 "sql.y" -{ yylhsminor.yy826 = createViewNode(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585); } -#line 7373 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 396: /* full_view_name ::= db_name NK_DOT view_name */ +{ yylhsminor.yy600 = createViewNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 393: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 715 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy983, &yymsp[-8].minor.yy585, yymsp[-5].minor.yy826, yymsp[-7].minor.yy826, yymsp[-3].minor.yy616, yymsp[-2].minor.yy826, yymsp[0].minor.yy826, yymsp[-4].minor.yy616); } -#line 7379 "sql.c" + case 397: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy705, &yymsp[-8].minor.yy649, yymsp[-5].minor.yy600, yymsp[-7].minor.yy600, yymsp[-3].minor.yy748, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, yymsp[-4].minor.yy748); } break; - case 394: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 716 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 7384 "sql.c" + case 398: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 395: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 717 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 7389 "sql.c" + case 399: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 396: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 718 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy983, yymsp[-1].minor.yy983, &yymsp[0].minor.yy585); } -#line 7394 "sql.c" + case 400: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy705, yymsp[-1].minor.yy705, &yymsp[0].minor.yy649); } break; - case 401: /* column_stream_def ::= column_name stream_col_options */ -#line 731 "sql.y" -{ yylhsminor.yy826 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy585, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy826); } -#line 7399 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 405: /* column_stream_def ::= column_name stream_col_options */ +{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy649, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy600); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 402: /* stream_col_options ::= */ - case 738: /* column_options ::= */ yytestcase(yyruleno==738); -#line 732 "sql.y" -{ yymsp[1].minor.yy826 = createDefaultColumnOptions(pCxt); } -#line 7406 "sql.c" + case 406: /* stream_col_options ::= */ + case 742: /* column_options ::= */ yytestcase(yyruleno==742); +{ yymsp[1].minor.yy600 = createDefaultColumnOptions(pCxt); } break; - case 403: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 739: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==739); -#line 733 "sql.y" -{ yylhsminor.yy826 = setColumnOptions(pCxt, yymsp[-2].minor.yy826, COLUMN_OPTION_PRIMARYKEY, NULL); } -#line 7412 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 407: /* stream_col_options ::= stream_col_options PRIMARY KEY */ + case 743: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==743); +{ yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_PRIMARYKEY, NULL); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 408: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 409: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==409); -#line 743 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-2].minor.yy826, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7419 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 412: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 413: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==413); +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 410: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 745 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-3].minor.yy826, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 7425 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 414: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 411: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 746 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-2].minor.yy826, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 7431 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 415: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 412: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 747 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-3].minor.yy826, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 7437 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 416: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 413: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 748 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-2].minor.yy826, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 7443 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 417: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 414: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 749 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-2].minor.yy826, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 7449 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 418: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-2].minor.yy600, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 415: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 750 "sql.y" -{ yylhsminor.yy826 = setStreamOptions(pCxt, yymsp[-3].minor.yy826, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7455 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 419: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy600 = setStreamOptions(pCxt, yymsp[-3].minor.yy600, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 417: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 682: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==682); - case 706: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==706); -#line 753 "sql.y" -{ yymsp[-3].minor.yy826 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy826); } -#line 7463 "sql.c" + case 421: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 686: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==686); + case 710: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==710); +{ yymsp[-3].minor.yy600 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy600); } break; - case 420: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 761 "sql.y" + case 424: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 7468 "sql.c" break; - case 421: /* cmd ::= KILL QUERY NK_STRING */ -#line 762 "sql.y" + case 425: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7473 "sql.c" break; - case 422: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 763 "sql.y" + case 426: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 7478 "sql.c" break; - case 423: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 764 "sql.y" + case 427: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 7483 "sql.c" break; - case 424: /* cmd ::= BALANCE VGROUP */ -#line 767 "sql.y" + case 428: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 7488 "sql.c" break; - case 425: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 768 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy585); } -#line 7493 "sql.c" + case 429: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy649); } break; - case 426: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 769 "sql.y" + case 430: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 7498 "sql.c" break; - case 427: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 770 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy616); } -#line 7503 "sql.c" + case 431: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy748); } break; - case 428: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 771 "sql.y" + case 432: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7508 "sql.c" break; - case 431: /* dnode_list ::= DNODE NK_INTEGER */ -#line 780 "sql.y" -{ yymsp[-1].minor.yy616 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7513 "sql.c" + case 435: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy748 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 433: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 787 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 7518 "sql.c" + case 437: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 436: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 796 "sql.y" -{ yymsp[-6].minor.yy826 = createInsertStmt(pCxt, yymsp[-4].minor.yy826, yymsp[-2].minor.yy616, yymsp[0].minor.yy826); } -#line 7523 "sql.c" + case 440: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy600 = createInsertStmt(pCxt, yymsp[-4].minor.yy600, yymsp[-2].minor.yy748, yymsp[0].minor.yy600); } break; - case 437: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 797 "sql.y" -{ yymsp[-3].minor.yy826 = createInsertStmt(pCxt, yymsp[-1].minor.yy826, NULL, yymsp[0].minor.yy826); } -#line 7528 "sql.c" + case 441: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy600 = createInsertStmt(pCxt, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); } break; - case 438: /* tags_literal ::= NK_INTEGER */ - case 450: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==450); - case 459: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==459); -#line 800 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 7535 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 442: /* tags_literal ::= NK_INTEGER */ + case 454: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==454); + case 463: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==463); +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 439: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 440: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==440); - case 451: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==451); - case 452: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==452); - case 460: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==460); - case 461: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==461); - case 469: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==469); - case 470: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==470); -#line 801 "sql.y" + case 443: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 444: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==444); + case 455: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==455); + case 456: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==456); + case 464: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==464); + case 465: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==465); + case 473: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==473); + case 474: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==474); { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; - yylhsminor.yy826 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy826); + yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy600); } -#line 7553 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 441: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 444: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==444); - case 453: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==453); - case 456: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==456); - case 462: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==462); - case 465: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==465); -#line 813 "sql.y" + case 445: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 448: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==448); + case 457: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==457); + case 460: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==460); + case 466: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==466); + case 469: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==469); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 7568 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 442: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 443: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==443); - case 445: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==445); - case 446: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==446); - case 454: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==454); - case 455: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==455); - case 457: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==457); - case 458: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==458); - case 463: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==463); - case 464: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==464); - case 466: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==466); - case 467: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==467); -#line 818 "sql.y" + case 446: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 447: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==447); + case 449: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==449); + case 450: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==450); + case 458: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==458); + case 459: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==459); + case 461: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==461); + case 462: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==462); + case 467: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==467); + case 468: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==468); + case 470: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==470); + case 471: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==471); { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; - yylhsminor.yy826 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy826); + yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy600); } -#line 7590 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 447: /* tags_literal ::= NK_FLOAT */ -#line 847 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 7596 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 451: /* tags_literal ::= NK_FLOAT */ +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 448: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 449: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==449); -#line 848 "sql.y" + case 452: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 453: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==453); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 7607 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 468: /* tags_literal ::= NK_STRING */ -#line 954 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 7613 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 472: /* tags_literal ::= NK_STRING */ +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 471: /* tags_literal ::= NK_BOOL */ -#line 967 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 7619 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 475: /* tags_literal ::= NK_BOOL */ +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 472: /* tags_literal ::= NULL */ -#line 968 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 7625 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 476: /* tags_literal ::= NULL */ +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 473: /* tags_literal ::= literal_func */ -#line 970 "sql.y" -{ yylhsminor.yy826 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy826); } -#line 7631 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 477: /* tags_literal ::= literal_func */ +{ yylhsminor.yy600 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy600); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 474: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 475: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==475); -#line 971 "sql.y" + case 478: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 479: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==479); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); l.n = (r.z + r.n) - l.z; - yylhsminor.yy826 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy826, yymsp[0].minor.yy826); + yylhsminor.yy600 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } -#line 7643 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 478: /* literal ::= NK_INTEGER */ -#line 990 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7649 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 482: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 479: /* literal ::= NK_FLOAT */ -#line 991 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7655 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 483: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 480: /* literal ::= NK_STRING */ -#line 992 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7661 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 484: /* literal ::= NK_STRING */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 481: /* literal ::= NK_BOOL */ -#line 993 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7667 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 485: /* literal ::= NK_BOOL */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 482: /* literal ::= TIMESTAMP NK_STRING */ -#line 994 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 7673 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 486: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 483: /* literal ::= duration_literal */ - case 493: /* signed_literal ::= signed */ yytestcase(yyruleno==493); - case 517: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==517); - case 518: /* expression ::= literal */ yytestcase(yyruleno==518); - case 520: /* expression ::= column_reference */ yytestcase(yyruleno==520); - case 521: /* expression ::= function_expression */ yytestcase(yyruleno==521); - case 522: /* expression ::= case_when_expression */ yytestcase(yyruleno==522); - case 556: /* function_expression ::= literal_func */ yytestcase(yyruleno==556); - case 606: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==606); - case 610: /* boolean_primary ::= predicate */ yytestcase(yyruleno==610); - case 612: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==612); - case 613: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==613); - case 616: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==616); - case 618: /* table_reference ::= table_primary */ yytestcase(yyruleno==618); - case 619: /* table_reference ::= joined_table */ yytestcase(yyruleno==619); - case 623: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==623); - case 708: /* query_simple ::= query_specification */ yytestcase(yyruleno==708); - case 709: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==709); - case 712: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==712); - case 714: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==714); -#line 995 "sql.y" -{ yylhsminor.yy826 = yymsp[0].minor.yy826; } -#line 7698 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 487: /* literal ::= duration_literal */ + case 497: /* signed_literal ::= signed */ yytestcase(yyruleno==497); + case 521: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==521); + case 522: /* expression ::= literal */ yytestcase(yyruleno==522); + case 524: /* expression ::= column_reference */ yytestcase(yyruleno==524); + case 525: /* expression ::= function_expression */ yytestcase(yyruleno==525); + case 526: /* expression ::= case_when_expression */ yytestcase(yyruleno==526); + case 560: /* function_expression ::= literal_func */ yytestcase(yyruleno==560); + case 610: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==610); + case 614: /* boolean_primary ::= predicate */ yytestcase(yyruleno==614); + case 616: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==616); + case 617: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==617); + case 620: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==620); + case 622: /* table_reference ::= table_primary */ yytestcase(yyruleno==622); + case 623: /* table_reference ::= joined_table */ yytestcase(yyruleno==623); + case 627: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==627); + case 712: /* query_simple ::= query_specification */ yytestcase(yyruleno==712); + case 713: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==713); + case 716: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==716); + case 718: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==718); +{ yylhsminor.yy600 = yymsp[0].minor.yy600; } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 484: /* literal ::= NULL */ -#line 996 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7704 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 488: /* literal ::= NULL */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 485: /* literal ::= NK_QUESTION */ -#line 997 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7710 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 489: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 486: /* duration_literal ::= NK_VARIABLE */ - case 683: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==683); - case 684: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==684); - case 685: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==685); -#line 999 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7719 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 490: /* duration_literal ::= NK_VARIABLE */ + case 687: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==687); + case 688: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==688); + case 689: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==689); +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 487: /* signed ::= NK_INTEGER */ -#line 1001 "sql.y" -{ yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7725 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 491: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 488: /* signed ::= NK_PLUS NK_INTEGER */ -#line 1002 "sql.y" -{ yymsp[-1].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7731 "sql.c" + case 492: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 489: /* signed ::= NK_MINUS NK_INTEGER */ -#line 1003 "sql.y" + case 493: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7740 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 490: /* signed ::= NK_FLOAT */ -#line 1008 "sql.y" -{ yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7746 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 494: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 491: /* signed ::= NK_PLUS NK_FLOAT */ -#line 1009 "sql.y" -{ yymsp[-1].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7752 "sql.c" + case 495: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 492: /* signed ::= NK_MINUS NK_FLOAT */ -#line 1010 "sql.y" + case 496: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7761 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 494: /* signed_literal ::= NK_STRING */ -#line 1017 "sql.y" -{ yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7767 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 498: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 495: /* signed_literal ::= NK_BOOL */ -#line 1018 "sql.y" -{ yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7773 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 499: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 496: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 1019 "sql.y" -{ yymsp[-1].minor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7779 "sql.c" + case 500: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 497: /* signed_literal ::= duration_literal */ - case 499: /* signed_literal ::= literal_func */ yytestcase(yyruleno==499); - case 577: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==577); - case 660: /* select_item ::= common_expression */ yytestcase(yyruleno==660); - case 670: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==670); - case 713: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==713); - case 715: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==715); - case 728: /* search_condition ::= common_expression */ yytestcase(yyruleno==728); -#line 1020 "sql.y" -{ yylhsminor.yy826 = releaseRawExprNode(pCxt, yymsp[0].minor.yy826); } -#line 7791 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 501: /* signed_literal ::= duration_literal */ + case 503: /* signed_literal ::= literal_func */ yytestcase(yyruleno==503); + case 581: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==581); + case 664: /* select_item ::= common_expression */ yytestcase(yyruleno==664); + case 674: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==674); + case 717: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==717); + case 719: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==719); + case 732: /* search_condition ::= common_expression */ yytestcase(yyruleno==732); +{ yylhsminor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 498: /* signed_literal ::= NULL */ -#line 1021 "sql.y" -{ yylhsminor.yy826 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7797 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 502: /* signed_literal ::= NULL */ +{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 500: /* signed_literal ::= NK_QUESTION */ -#line 1023 "sql.y" -{ yylhsminor.yy826 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7803 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 504: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy600 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 519: /* expression ::= pseudo_column */ -#line 1089 "sql.y" -{ yylhsminor.yy826 = yymsp[0].minor.yy826; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy826, true); } -#line 7809 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 523: /* expression ::= pseudo_column */ +{ yylhsminor.yy600 = yymsp[0].minor.yy600; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy600, true); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 523: /* expression ::= NK_LP expression NK_RP */ - case 611: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==611); - case 727: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==727); -#line 1093 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 7817 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 527: /* expression ::= NK_LP expression NK_RP */ + case 615: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==615); + case 731: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==731); +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 524: /* expression ::= NK_PLUS expr_or_subquery */ -#line 1094 "sql.y" + case 528: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } -#line 7826 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 525: /* expression ::= NK_MINUS expr_or_subquery */ -#line 1098 "sql.y" + case 529: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy826), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } -#line 7835 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 526: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 1102 "sql.y" + case 530: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7845 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 527: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 1107 "sql.y" + case 531: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7855 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 528: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 1112 "sql.y" + case 532: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7865 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 529: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 1117 "sql.y" + case 533: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7875 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 530: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 1122 "sql.y" + case 534: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7885 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 531: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 1127 "sql.y" + case 535: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 7894 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 532: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 1131 "sql.y" + case 536: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7904 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 533: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 1136 "sql.y" + case 537: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 7914 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 536: /* column_reference ::= column_name */ -#line 1147 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy585, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy585)); } -#line 7920 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 540: /* column_reference ::= column_name */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy649, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy649)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 537: /* column_reference ::= table_name NK_DOT column_name */ -#line 1148 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585, createColumnNode(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy585)); } -#line 7926 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 541: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649, createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy649)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 538: /* column_reference ::= NK_ALIAS */ -#line 1149 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7932 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 542: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 539: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 1150 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0)); } -#line 7938 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 543: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 540: /* pseudo_column ::= ROWTS */ - case 541: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==541); - case 543: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==543); - case 544: /* pseudo_column ::= QEND */ yytestcase(yyruleno==544); - case 545: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==545); - case 546: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==546); - case 547: /* pseudo_column ::= WEND */ yytestcase(yyruleno==547); - case 548: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==548); - case 549: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==549); - case 550: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==550); - case 551: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==551); - case 558: /* literal_func ::= NOW */ yytestcase(yyruleno==558); - case 559: /* literal_func ::= TODAY */ yytestcase(yyruleno==559); -#line 1152 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 7956 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 544: /* pseudo_column ::= ROWTS */ + case 545: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==545); + case 547: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==547); + case 548: /* pseudo_column ::= QEND */ yytestcase(yyruleno==548); + case 549: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==549); + case 550: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==550); + case 551: /* pseudo_column ::= WEND */ yytestcase(yyruleno==551); + case 552: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==552); + case 553: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==553); + case 554: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==554); + case 555: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==555); + case 562: /* literal_func ::= NOW */ yytestcase(yyruleno==562); + case 563: /* literal_func ::= TODAY */ yytestcase(yyruleno==563); +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 542: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 1154 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy585)))); } -#line 7962 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 546: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy649)))); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 552: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 553: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==553); -#line 1165 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy585, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy585, yymsp[-1].minor.yy616)); } -#line 7969 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 556: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 557: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==557); +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy649, yymsp[-1].minor.yy748)); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 554: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 555: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==555); -#line 1168 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), yymsp[-1].minor.yy146)); } -#line 7976 "sql.c" - yymsp[-5].minor.yy826 = yylhsminor.yy826; + case 558: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 559: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==559); +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy400)); } + yymsp[-5].minor.yy600 = yylhsminor.yy600; break; - case 557: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 1174 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy585, NULL)); } -#line 7982 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 561: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy649, NULL)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 573: /* star_func_para_list ::= NK_STAR */ -#line 1199 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 7988 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 577: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy748 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy748 = yylhsminor.yy748; break; - case 578: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 663: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==663); -#line 1208 "sql.y" -{ yylhsminor.yy826 = createColumnNode(pCxt, &yymsp[-2].minor.yy585, &yymsp[0].minor.yy0); } -#line 7995 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 582: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 667: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==667); +{ yylhsminor.yy600 = createColumnNode(pCxt, &yymsp[-2].minor.yy649, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 579: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 1211 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy616, yymsp[-1].minor.yy826)); } -#line 8001 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 583: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy748, yymsp[-1].minor.yy600)); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 580: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1213 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), yymsp[-2].minor.yy616, yymsp[-1].minor.yy826)); } -#line 8007 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; + case 584: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-2].minor.yy748, yymsp[-1].minor.yy600)); } + yymsp[-4].minor.yy600 = yylhsminor.yy600; break; - case 583: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1220 "sql.y" -{ yymsp[-3].minor.yy826 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826)); } -#line 8013 "sql.c" + case 587: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy600 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); } break; - case 585: /* case_when_else_opt ::= ELSE common_expression */ -#line 1223 "sql.y" -{ yymsp[-1].minor.yy826 = releaseRawExprNode(pCxt, yymsp[0].minor.yy826); } -#line 8018 "sql.c" + case 589: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); } break; - case 586: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 591: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==591); -#line 1226 "sql.y" + case 590: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 595: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==595); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy22, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy292, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 8028 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 587: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1233 "sql.y" + case 591: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy826), releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 8038 "sql.c" - yymsp[-4].minor.yy826 = yylhsminor.yy826; + yymsp[-4].minor.yy600 = yylhsminor.yy600; break; - case 588: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1239 "sql.y" + case 592: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy826), releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 8048 "sql.c" - yymsp[-5].minor.yy826 = yylhsminor.yy826; + yymsp[-5].minor.yy600 = yylhsminor.yy600; break; - case 589: /* predicate ::= expr_or_subquery IS NULL */ -#line 1244 "sql.y" + case 593: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), NULL)); } -#line 8057 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 590: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1248 "sql.y" + case 594: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL)); } -#line 8066 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 592: /* compare_op ::= NK_LT */ -#line 1260 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_LOWER_THAN; } -#line 8072 "sql.c" + case 596: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_THAN; } break; - case 593: /* compare_op ::= NK_GT */ -#line 1261 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_GREATER_THAN; } -#line 8077 "sql.c" + case 597: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_THAN; } break; - case 594: /* compare_op ::= NK_LE */ -#line 1262 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_LOWER_EQUAL; } -#line 8082 "sql.c" + case 598: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_EQUAL; } break; - case 595: /* compare_op ::= NK_GE */ -#line 1263 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_GREATER_EQUAL; } -#line 8087 "sql.c" + case 599: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_EQUAL; } break; - case 596: /* compare_op ::= NK_NE */ -#line 1264 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_NOT_EQUAL; } -#line 8092 "sql.c" + case 600: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy292 = OP_TYPE_NOT_EQUAL; } break; - case 597: /* compare_op ::= NK_EQ */ -#line 1265 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_EQUAL; } -#line 8097 "sql.c" + case 601: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy292 = OP_TYPE_EQUAL; } break; - case 598: /* compare_op ::= LIKE */ -#line 1266 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_LIKE; } -#line 8102 "sql.c" + case 602: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy292 = OP_TYPE_LIKE; } break; - case 599: /* compare_op ::= NOT LIKE */ -#line 1267 "sql.y" -{ yymsp[-1].minor.yy22 = OP_TYPE_NOT_LIKE; } -#line 8107 "sql.c" + case 603: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_LIKE; } break; - case 600: /* compare_op ::= MATCH */ -#line 1268 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_MATCH; } -#line 8112 "sql.c" + case 604: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy292 = OP_TYPE_MATCH; } break; - case 601: /* compare_op ::= NMATCH */ -#line 1269 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_NMATCH; } -#line 8117 "sql.c" + case 605: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy292 = OP_TYPE_NMATCH; } break; - case 602: /* compare_op ::= CONTAINS */ -#line 1270 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_JSON_CONTAINS; } -#line 8122 "sql.c" + case 606: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy292 = OP_TYPE_JSON_CONTAINS; } break; - case 603: /* in_op ::= IN */ -#line 1274 "sql.y" -{ yymsp[0].minor.yy22 = OP_TYPE_IN; } -#line 8127 "sql.c" + case 607: /* in_op ::= IN */ +{ yymsp[0].minor.yy292 = OP_TYPE_IN; } break; - case 604: /* in_op ::= NOT IN */ -#line 1275 "sql.y" -{ yymsp[-1].minor.yy22 = OP_TYPE_NOT_IN; } -#line 8132 "sql.c" + case 608: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_IN; } break; - case 605: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1277 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy616)); } -#line 8137 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 609: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 607: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1281 "sql.y" + case 611: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy826), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL)); } -#line 8146 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 608: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1286 "sql.y" + case 612: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 8156 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 609: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1292 "sql.y" + case 613: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy826); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy826); - yylhsminor.yy826 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600); + yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } -#line 8166 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 617: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1310 "sql.y" -{ yylhsminor.yy826 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy826, yymsp[0].minor.yy826, NULL); } -#line 8172 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 621: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy600 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, NULL); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 620: /* table_primary ::= table_name alias_opt */ -#line 1316 "sql.y" -{ yylhsminor.yy826 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy585, &yymsp[0].minor.yy585); } -#line 8178 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 624: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 621: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1317 "sql.y" -{ yylhsminor.yy826 = createRealTableNode(pCxt, &yymsp[-3].minor.yy585, &yymsp[-1].minor.yy585, &yymsp[0].minor.yy585); } -#line 8184 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 625: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-3].minor.yy649, &yymsp[-1].minor.yy649, &yymsp[0].minor.yy649); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 622: /* table_primary ::= subquery alias_opt */ -#line 1318 "sql.y" -{ yylhsminor.yy826 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826), &yymsp[0].minor.yy585); } -#line 8190 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 626: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy600 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy649); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 624: /* alias_opt ::= */ -#line 1323 "sql.y" -{ yymsp[1].minor.yy585 = nil_token; } -#line 8196 "sql.c" + case 628: /* alias_opt ::= */ +{ yymsp[1].minor.yy649 = nil_token; } break; - case 626: /* alias_opt ::= AS table_alias */ -#line 1325 "sql.y" -{ yymsp[-1].minor.yy585 = yymsp[0].minor.yy585; } -#line 8201 "sql.c" + case 630: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy649 = yymsp[0].minor.yy649; } break; - case 627: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 628: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==628); -#line 1327 "sql.y" -{ yymsp[-2].minor.yy826 = yymsp[-1].minor.yy826; } -#line 8207 "sql.c" + case 631: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 632: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==632); +{ yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600; } break; - case 629: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -#line 1333 "sql.y" + case 633: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy826 = createJoinTableNode(pCxt, yymsp[-6].minor.yy190, yymsp[-5].minor.yy26, yymsp[-7].minor.yy826, yymsp[-3].minor.yy826, yymsp[-2].minor.yy826); - yylhsminor.yy826 = addWindowOffsetClause(pCxt, yylhsminor.yy826, yymsp[-1].minor.yy826); - yylhsminor.yy826 = addJLimitClause(pCxt, yylhsminor.yy826, yymsp[0].minor.yy826); + yylhsminor.yy600 = createJoinTableNode(pCxt, yymsp[-6].minor.yy564, yymsp[-5].minor.yy758, yymsp[-7].minor.yy600, yymsp[-3].minor.yy600, yymsp[-2].minor.yy600); + yylhsminor.yy600 = addWindowOffsetClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); + yylhsminor.yy600 = addJLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600); } -#line 8216 "sql.c" - yymsp[-7].minor.yy826 = yylhsminor.yy826; + yymsp[-7].minor.yy600 = yylhsminor.yy600; break; - case 630: /* join_type ::= */ -#line 1341 "sql.y" -{ yymsp[1].minor.yy190 = JOIN_TYPE_INNER; } -#line 8222 "sql.c" + case 634: /* join_type ::= */ +{ yymsp[1].minor.yy564 = JOIN_TYPE_INNER; } break; - case 631: /* join_type ::= INNER */ -#line 1342 "sql.y" -{ yymsp[0].minor.yy190 = JOIN_TYPE_INNER; } -#line 8227 "sql.c" + case 635: /* join_type ::= INNER */ +{ yymsp[0].minor.yy564 = JOIN_TYPE_INNER; } break; - case 632: /* join_type ::= LEFT */ -#line 1343 "sql.y" -{ yymsp[0].minor.yy190 = JOIN_TYPE_LEFT; } -#line 8232 "sql.c" + case 636: /* join_type ::= LEFT */ +{ yymsp[0].minor.yy564 = JOIN_TYPE_LEFT; } break; - case 633: /* join_type ::= RIGHT */ -#line 1344 "sql.y" -{ yymsp[0].minor.yy190 = JOIN_TYPE_RIGHT; } -#line 8237 "sql.c" + case 637: /* join_type ::= RIGHT */ +{ yymsp[0].minor.yy564 = JOIN_TYPE_RIGHT; } break; - case 634: /* join_type ::= FULL */ -#line 1345 "sql.y" -{ yymsp[0].minor.yy190 = JOIN_TYPE_FULL; } -#line 8242 "sql.c" + case 638: /* join_type ::= FULL */ +{ yymsp[0].minor.yy564 = JOIN_TYPE_FULL; } break; - case 635: /* join_subtype ::= */ -#line 1349 "sql.y" -{ yymsp[1].minor.yy26 = JOIN_STYPE_NONE; } -#line 8247 "sql.c" + case 639: /* join_subtype ::= */ +{ yymsp[1].minor.yy758 = JOIN_STYPE_NONE; } break; - case 636: /* join_subtype ::= OUTER */ -#line 1350 "sql.y" -{ yymsp[0].minor.yy26 = JOIN_STYPE_OUTER; } -#line 8252 "sql.c" + case 640: /* join_subtype ::= OUTER */ +{ yymsp[0].minor.yy758 = JOIN_STYPE_OUTER; } break; - case 637: /* join_subtype ::= SEMI */ -#line 1351 "sql.y" -{ yymsp[0].minor.yy26 = JOIN_STYPE_SEMI; } -#line 8257 "sql.c" + case 641: /* join_subtype ::= SEMI */ +{ yymsp[0].minor.yy758 = JOIN_STYPE_SEMI; } break; - case 638: /* join_subtype ::= ANTI */ -#line 1352 "sql.y" -{ yymsp[0].minor.yy26 = JOIN_STYPE_ANTI; } -#line 8262 "sql.c" + case 642: /* join_subtype ::= ANTI */ +{ yymsp[0].minor.yy758 = JOIN_STYPE_ANTI; } break; - case 639: /* join_subtype ::= ASOF */ -#line 1353 "sql.y" -{ yymsp[0].minor.yy26 = JOIN_STYPE_ASOF; } -#line 8267 "sql.c" + case 643: /* join_subtype ::= ASOF */ +{ yymsp[0].minor.yy758 = JOIN_STYPE_ASOF; } break; - case 640: /* join_subtype ::= WINDOW */ -#line 1354 "sql.y" -{ yymsp[0].minor.yy26 = JOIN_STYPE_WIN; } -#line 8272 "sql.c" + case 644: /* join_subtype ::= WINDOW */ +{ yymsp[0].minor.yy758 = JOIN_STYPE_WIN; } break; - case 644: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -#line 1361 "sql.y" -{ yymsp[-5].minor.yy826 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 8277 "sql.c" + case 648: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +{ yymsp[-5].minor.yy600 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 645: /* window_offset_literal ::= NK_VARIABLE */ -#line 1363 "sql.y" -{ yylhsminor.yy826 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8282 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 649: /* window_offset_literal ::= NK_VARIABLE */ +{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 646: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -#line 1364 "sql.y" + case 650: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy826 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy600 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } -#line 8292 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 648: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 719: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==719); - case 723: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==723); -#line 1371 "sql.y" -{ yymsp[-1].minor.yy826 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 8300 "sql.c" + case 652: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 723: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==723); + case 727: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==727); +{ yymsp[-1].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 649: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ -#line 1377 "sql.y" + case 653: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-13].minor.yy826 = createSelectStmt(pCxt, yymsp[-11].minor.yy983, yymsp[-9].minor.yy616, yymsp[-8].minor.yy826, yymsp[-12].minor.yy616); - yymsp[-13].minor.yy826 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy826, yymsp[-10].minor.yy983); - yymsp[-13].minor.yy826 = addWhereClause(pCxt, yymsp[-13].minor.yy826, yymsp[-7].minor.yy826); - yymsp[-13].minor.yy826 = addPartitionByClause(pCxt, yymsp[-13].minor.yy826, yymsp[-6].minor.yy616); - yymsp[-13].minor.yy826 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy826, yymsp[-2].minor.yy826); - yymsp[-13].minor.yy826 = addGroupByClause(pCxt, yymsp[-13].minor.yy826, yymsp[-1].minor.yy616); - yymsp[-13].minor.yy826 = addHavingClause(pCxt, yymsp[-13].minor.yy826, yymsp[0].minor.yy826); - yymsp[-13].minor.yy826 = addRangeClause(pCxt, yymsp[-13].minor.yy826, yymsp[-5].minor.yy826); - yymsp[-13].minor.yy826 = addEveryClause(pCxt, yymsp[-13].minor.yy826, yymsp[-4].minor.yy826); - yymsp[-13].minor.yy826 = addFillClause(pCxt, yymsp[-13].minor.yy826, yymsp[-3].minor.yy826); + yymsp[-13].minor.yy600 = createSelectStmt(pCxt, yymsp[-11].minor.yy705, yymsp[-9].minor.yy748, yymsp[-8].minor.yy600, yymsp[-12].minor.yy748); + yymsp[-13].minor.yy600 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy600, yymsp[-10].minor.yy705); + yymsp[-13].minor.yy600 = addWhereClause(pCxt, yymsp[-13].minor.yy600, yymsp[-7].minor.yy600); + yymsp[-13].minor.yy600 = addPartitionByClause(pCxt, yymsp[-13].minor.yy600, yymsp[-6].minor.yy748); + yymsp[-13].minor.yy600 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy600, yymsp[-2].minor.yy600); + yymsp[-13].minor.yy600 = addGroupByClause(pCxt, yymsp[-13].minor.yy600, yymsp[-1].minor.yy748); + yymsp[-13].minor.yy600 = addHavingClause(pCxt, yymsp[-13].minor.yy600, yymsp[0].minor.yy600); + yymsp[-13].minor.yy600 = addRangeClause(pCxt, yymsp[-13].minor.yy600, yymsp[-5].minor.yy600); + yymsp[-13].minor.yy600 = addEveryClause(pCxt, yymsp[-13].minor.yy600, yymsp[-4].minor.yy600); + yymsp[-13].minor.yy600 = addFillClause(pCxt, yymsp[-13].minor.yy600, yymsp[-3].minor.yy600); } -#line 8316 "sql.c" break; - case 650: /* hint_list ::= */ -#line 1392 "sql.y" -{ yymsp[1].minor.yy616 = createHintNodeList(pCxt, NULL); } -#line 8321 "sql.c" + case 654: /* hint_list ::= */ +{ yymsp[1].minor.yy748 = createHintNodeList(pCxt, NULL); } break; - case 651: /* hint_list ::= NK_HINT */ -#line 1393 "sql.y" -{ yylhsminor.yy616 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 8326 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 655: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy748 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy748 = yylhsminor.yy748; break; - case 656: /* set_quantifier_opt ::= ALL */ -#line 1404 "sql.y" -{ yymsp[0].minor.yy983 = false; } -#line 8332 "sql.c" + case 660: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy705 = false; } break; - case 659: /* select_item ::= NK_STAR */ -#line 1411 "sql.y" -{ yylhsminor.yy826 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 8337 "sql.c" - yymsp[0].minor.yy826 = yylhsminor.yy826; + case 663: /* select_item ::= NK_STAR */ +{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy600 = yylhsminor.yy600; break; - case 661: /* select_item ::= common_expression column_alias */ - case 671: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==671); -#line 1413 "sql.y" -{ yylhsminor.yy826 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826), &yymsp[0].minor.yy585); } -#line 8344 "sql.c" - yymsp[-1].minor.yy826 = yylhsminor.yy826; + case 665: /* select_item ::= common_expression column_alias */ + case 675: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==675); +{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy649); } + yymsp[-1].minor.yy600 = yylhsminor.yy600; break; - case 662: /* select_item ::= common_expression AS column_alias */ - case 672: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==672); -#line 1414 "sql.y" -{ yylhsminor.yy826 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), &yymsp[0].minor.yy585); } -#line 8351 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 666: /* select_item ::= common_expression AS column_alias */ + case 676: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==676); +{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), &yymsp[0].minor.yy649); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 667: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 697: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==697); - case 717: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==717); -#line 1423 "sql.y" -{ yymsp[-2].minor.yy616 = yymsp[0].minor.yy616; } -#line 8359 "sql.c" + case 671: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 701: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==701); + case 721: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==721); +{ yymsp[-2].minor.yy748 = yymsp[0].minor.yy748; } break; - case 674: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1436 "sql.y" -{ yymsp[-5].minor.yy826 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 8364 "sql.c" + case 678: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy600 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 675: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1437 "sql.y" -{ yymsp[-3].minor.yy826 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 8369 "sql.c" + case 679: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy600 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 676: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1439 "sql.y" -{ yymsp[-5].minor.yy826 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), NULL, yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 8374 "sql.c" + case 680: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 677: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1443 "sql.y" -{ yymsp[-7].minor.yy826 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy826), releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), yymsp[-1].minor.yy826, yymsp[0].minor.yy826); } -#line 8379 "sql.c" + case 681: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); } break; - case 678: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1445 "sql.y" -{ yymsp[-6].minor.yy826 = createEventWindowNode(pCxt, yymsp[-3].minor.yy826, yymsp[0].minor.yy826); } -#line 8384 "sql.c" + case 682: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy600 = createEventWindowNode(pCxt, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } break; - case 679: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1447 "sql.y" -{ yymsp[-3].minor.yy826 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8389 "sql.c" + case 683: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy600 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 680: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1449 "sql.y" -{ yymsp[-5].minor.yy826 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8394 "sql.c" + case 684: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy600 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 687: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1459 "sql.y" -{ yymsp[-3].minor.yy826 = createFillNode(pCxt, yymsp[-1].minor.yy1082, NULL); } -#line 8399 "sql.c" + case 691: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy600 = createFillNode(pCxt, yymsp[-1].minor.yy6, NULL); } break; - case 688: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1460 "sql.y" -{ yymsp[-5].minor.yy826 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy616)); } -#line 8404 "sql.c" + case 692: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } break; - case 689: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1461 "sql.y" -{ yymsp[-5].minor.yy826 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy616)); } -#line 8409 "sql.c" + case 693: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy748)); } break; - case 690: /* fill_mode ::= NONE */ -#line 1465 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_NONE; } -#line 8414 "sql.c" + case 694: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy6 = FILL_MODE_NONE; } break; - case 691: /* fill_mode ::= PREV */ -#line 1466 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_PREV; } -#line 8419 "sql.c" + case 695: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy6 = FILL_MODE_PREV; } break; - case 692: /* fill_mode ::= NULL */ -#line 1467 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_NULL; } -#line 8424 "sql.c" + case 696: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy6 = FILL_MODE_NULL; } break; - case 693: /* fill_mode ::= NULL_F */ -#line 1468 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_NULL_F; } -#line 8429 "sql.c" + case 697: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy6 = FILL_MODE_NULL_F; } break; - case 694: /* fill_mode ::= LINEAR */ -#line 1469 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_LINEAR; } -#line 8434 "sql.c" + case 698: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy6 = FILL_MODE_LINEAR; } break; - case 695: /* fill_mode ::= NEXT */ -#line 1470 "sql.y" -{ yymsp[0].minor.yy1082 = FILL_MODE_NEXT; } -#line 8439 "sql.c" + case 699: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy6 = FILL_MODE_NEXT; } break; - case 698: /* group_by_list ::= expr_or_subquery */ -#line 1479 "sql.y" -{ yylhsminor.yy616 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); } -#line 8444 "sql.c" - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 702: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy748 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } + yymsp[0].minor.yy748 = yylhsminor.yy748; break; - case 699: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1480 "sql.y" -{ yylhsminor.yy616 = addNodeToList(pCxt, yymsp[-2].minor.yy616, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy826))); } -#line 8450 "sql.c" - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 703: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy748 = addNodeToList(pCxt, yymsp[-2].minor.yy748, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); } + yymsp[-2].minor.yy748 = yylhsminor.yy748; break; - case 703: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1487 "sql.y" -{ yymsp[-5].minor.yy826 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy826), releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 8456 "sql.c" + case 707: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy600 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 704: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1489 "sql.y" -{ yymsp[-3].minor.yy826 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy826)); } -#line 8461 "sql.c" + case 708: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy600 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); } break; - case 707: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1496 "sql.y" + case 711: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy826 = addOrderByClause(pCxt, yymsp[-3].minor.yy826, yymsp[-2].minor.yy616); - yylhsminor.yy826 = addSlimitClause(pCxt, yylhsminor.yy826, yymsp[-1].minor.yy826); - yylhsminor.yy826 = addLimitClause(pCxt, yylhsminor.yy826, yymsp[0].minor.yy826); + yylhsminor.yy600 = addOrderByClause(pCxt, yymsp[-3].minor.yy600, yymsp[-2].minor.yy748); + yylhsminor.yy600 = addSlimitClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600); + yylhsminor.yy600 = addLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600); } -#line 8470 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 710: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1506 "sql.y" -{ yylhsminor.yy826 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy826, yymsp[0].minor.yy826); } -#line 8476 "sql.c" - yymsp[-3].minor.yy826 = yylhsminor.yy826; + case 714: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); } + yymsp[-3].minor.yy600 = yylhsminor.yy600; break; - case 711: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1508 "sql.y" -{ yylhsminor.yy826 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy826, yymsp[0].minor.yy826); } -#line 8482 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 715: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 720: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 724: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==724); -#line 1523 "sql.y" -{ yymsp[-3].minor.yy826 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 8489 "sql.c" + case 724: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 728: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==728); +{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 721: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 725: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==725); -#line 1524 "sql.y" -{ yymsp[-3].minor.yy826 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 8495 "sql.c" + case 725: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 729: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==729); +{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 726: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1532 "sql.y" -{ yylhsminor.yy826 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy826); } -#line 8500 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 730: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy600); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 731: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1546 "sql.y" -{ yylhsminor.yy826 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy826), yymsp[-1].minor.yy88, yymsp[0].minor.yy71); } -#line 8506 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 735: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy600 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), yymsp[-1].minor.yy1010, yymsp[0].minor.yy273); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 732: /* ordering_specification_opt ::= */ -#line 1550 "sql.y" -{ yymsp[1].minor.yy88 = ORDER_ASC; } -#line 8512 "sql.c" + case 736: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy1010 = ORDER_ASC; } break; - case 733: /* ordering_specification_opt ::= ASC */ -#line 1551 "sql.y" -{ yymsp[0].minor.yy88 = ORDER_ASC; } -#line 8517 "sql.c" + case 737: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy1010 = ORDER_ASC; } break; - case 734: /* ordering_specification_opt ::= DESC */ -#line 1552 "sql.y" -{ yymsp[0].minor.yy88 = ORDER_DESC; } -#line 8522 "sql.c" + case 738: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy1010 = ORDER_DESC; } break; - case 735: /* null_ordering_opt ::= */ -#line 1556 "sql.y" -{ yymsp[1].minor.yy71 = NULL_ORDER_DEFAULT; } -#line 8527 "sql.c" + case 739: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy273 = NULL_ORDER_DEFAULT; } break; - case 736: /* null_ordering_opt ::= NULLS FIRST */ -#line 1557 "sql.y" -{ yymsp[-1].minor.yy71 = NULL_ORDER_FIRST; } -#line 8532 "sql.c" + case 740: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy273 = NULL_ORDER_FIRST; } break; - case 737: /* null_ordering_opt ::= NULLS LAST */ -#line 1558 "sql.y" -{ yymsp[-1].minor.yy71 = NULL_ORDER_LAST; } -#line 8537 "sql.c" + case 741: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy273 = NULL_ORDER_LAST; } break; - case 740: /* column_options ::= column_options ENCODE NK_STRING */ -#line 1566 "sql.y" -{ yylhsminor.yy826 = setColumnOptions(pCxt, yymsp[-2].minor.yy826, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } -#line 8542 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 744: /* column_options ::= column_options ENCODE NK_STRING */ +{ yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 741: /* column_options ::= column_options COMPRESS NK_STRING */ -#line 1567 "sql.y" -{ yylhsminor.yy826 = setColumnOptions(pCxt, yymsp[-2].minor.yy826, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } -#line 8548 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 745: /* column_options ::= column_options COMPRESS NK_STRING */ +{ yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; - case 742: /* column_options ::= column_options LEVEL NK_STRING */ -#line 1568 "sql.y" -{ yylhsminor.yy826 = setColumnOptions(pCxt, yymsp[-2].minor.yy826, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } -#line 8554 "sql.c" - yymsp[-2].minor.yy826 = yylhsminor.yy826; + case 746: /* column_options ::= column_options LEVEL NK_STRING */ +{ yylhsminor.yy600 = setColumnOptions(pCxt, yymsp[-2].minor.yy600, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy600 = yylhsminor.yy600; break; default: break; @@ -8614,7 +7347,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -8625,7 +7357,6 @@ static void yy_syntax_error( } 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); } -#line 8628 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -8711,56 +7442,12 @@ void Parse( } #endif - while(1){ /* Exit by "break" */ - assert( yypParser->yytos>=yypParser->yystack ); + do{ assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ -#ifndef NDEBUG - assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); - if( yyTraceFILE ){ - int yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos[yysize].stateno); - }else{ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", - yyTracePrompt, yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == - (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - break; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - break; - } - } -#endif - } - yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -8816,13 +7503,14 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos > yypParser->yystack ){ - yyact = yy_find_reduce_action(yypParser->yytos->stateno, - YYERRORSYMBOL); - if( yyact<=YY_MAX_SHIFTREDUCE ) break; + while( yypParser->yytos >= yypParser->yystack + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE + ){ yy_pop_parser_stack(yypParser); } - if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -8872,7 +7560,7 @@ void Parse( break; #endif } - } + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; diff --git a/source/libs/sm4/CMakeLists.txt b/source/libs/sm4/CMakeLists.txt new file mode 100644 index 0000000000..bd77bcd40b --- /dev/null +++ b/source/libs/sm4/CMakeLists.txt @@ -0,0 +1,9 @@ +aux_source_directory(src SM4_SRC) +add_library(sm4 STATIC ${SM4_SRC}) +target_include_directories( + sm4 + PUBLIC "${TD_SOURCE_DIR}/include/libs/sm4" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries(sm4 common) diff --git a/source/libs/sm4/src/sm4.c b/source/libs/sm4/src/sm4.c new file mode 100644 index 0000000000..0a50c9f18d --- /dev/null +++ b/source/libs/sm4/src/sm4.c @@ -0,0 +1,544 @@ +#include "sm4.h" + +#define SM4_ROUND 32 + +static unsigned int FK[4]={ + 0xA3B1BAC6,0x56AA3350,0x677D9197,0xB27022DC +}; + +static unsigned int CK[SM4_ROUND]={ + 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269, + 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9, + 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249, + 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9, + 0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229, + 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299, + 0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209, + 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279 +}; + +static unsigned char Sbox[256]={ + 0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x05, + 0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x04,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x06,0x99, + 0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0x0b,0x43,0xed,0xcf,0xac,0x62, + 0xe4,0xb3,0x1c,0xa9,0xc9,0x08,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6, + 0x47,0x07,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8, + 0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0x0f,0x4b,0x70,0x56,0x9d,0x35, + 0x1e,0x24,0x0e,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x01,0x21,0x78,0x87, + 0xd4,0x00,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x02,0xe7,0xa0,0xc4,0xc8,0x9e, + 0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1, + 0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3, + 0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0x0d,0x53,0x4e,0x6f, + 0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x03,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51, + 0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8, + 0x0a,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0, + 0x89,0x69,0x97,0x4a,0x0c,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x09,0xc5,0x6e,0xc6,0x84, + 0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48 +}; + +#define ROL(x,y) ((x)<<(y) | (x)>>(32-(y))) + +unsigned int SMS4_T1(unsigned int dwA) +{ + unsigned char a0[4]={0}; + unsigned char b0[4]={0}; + unsigned int dwB=0; + unsigned int dwC=0; + int i=0; +/* + for (i=0;i<4;i++) + { + a0[i] = (unsigned char)((dwA>>(i*8)) & 0xff); + b0[i] = Sbox[a0[i]]; + dwB |= (b0[i]<<(i*8)); + } +*/ + a0[0] = (unsigned char)((dwA) & 0xff); + b0[0] = Sbox[a0[0]]; + dwB |= (b0[0]); + + a0[1] = (unsigned char)((dwA>>(8)) & 0xff); + b0[1] = Sbox[a0[1]]; + dwB |= (b0[1]<<(8)); + + a0[2] = (unsigned char)((dwA>>(16)) & 0xff); + b0[2] = Sbox[a0[2]]; + dwB |= (b0[2]<<(16)); + + a0[3] = (unsigned char)((dwA>>(24)) & 0xff); + b0[3] = Sbox[a0[3]]; + dwB |= (b0[3]<<(24)); // 2013-08-13 + + dwC=dwB^ROL(dwB,2)^ROL(dwB,10)^ROL(dwB,18)^ROL(dwB,24); + + return dwC; +} + +unsigned int SMS4_T2(unsigned int dwA) +{ + unsigned char a0[4]={0}; + unsigned char b0[4]={0}; + unsigned int dwB=0; + unsigned int dwC=0; + int i=0; +/* + for (i=0;i<4;i++) + { + a0[i] = (unsigned char)((dwA>>(i*8)) & 0xff); + b0[i] = Sbox[a0[i]]; + dwB |= (b0[i]<<(i*8)); + } +*/ + a0[0] = (unsigned char)((dwA) & 0xff); + b0[0] = Sbox[a0[0]]; + dwB |= (b0[0]); + + a0[1] = (unsigned char)((dwA>>(8)) & 0xff); + b0[1] = Sbox[a0[1]]; + dwB |= (b0[1]<<(8)); + + a0[2] = (unsigned char)((dwA>>(16)) & 0xff); + b0[2] = Sbox[a0[2]]; + dwB |= (b0[2]<<(16)); + + a0[3] = (unsigned char)((dwA>>(24)) & 0xff); + b0[3] = Sbox[a0[3]]; + dwB |= (b0[3]<<(24)); // 2013-08-13 + + dwC=dwB^ROL(dwB,13)^ROL(dwB,23); + + return dwC; +} + +/* MK[4] is the Encrypt Key, rk[32] is Round Key */ +void SMS4_Key_Expansion(unsigned int MK[], unsigned int rk[]) +{ + unsigned int K[4]={0}; + int i=0; + + for (i=0;i<4;i++) + { + K[i] = MK[i] ^ FK[i]; + } + + for (i=0;ipath, 16 * 1024, 1, &pMeta->db, 0) < 0) { + if (tdbOpen(pMeta->path, 16 * 1024, 1, &pMeta->db, 0, 0, NULL) < 0) { return -1; // goto _err; } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index fbfcee25a7..4c16e47163 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -158,7 +158,7 @@ SStreamState* streamStateOpen(char* path, void* pTask, bool specPath, int32_t sz } taosCloseFile(&pCfgFile); - if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 1) < 0) { + if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 1, 0, NULL) < 0) { goto _err; } diff --git a/source/libs/tdb/CMakeLists.txt b/source/libs/tdb/CMakeLists.txt index 405fb1c5a0..cc50919413 100644 --- a/source/libs/tdb/CMakeLists.txt +++ b/source/libs/tdb/CMakeLists.txt @@ -22,6 +22,7 @@ target_link_libraries( tdb PUBLIC os PUBLIC util + PUBLIC crypt ) # for test diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index 4dd47e97ac..d3a5711352 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -32,7 +32,8 @@ typedef struct STBC TBC; typedef struct STxn TXN; // TDB -int32_t tdbOpen(const char *dbname, int szPage, int pages, TDB **ppDb, int8_t rollback); +int32_t tdbOpen(const char *dbname, int szPage, int pages, TDB **ppDb, int8_t rollback, int32_t encryptAlgorithm, + char *encryptKey); int32_t tdbClose(TDB *pDb); int32_t tdbBegin(TDB *pDb, TXN **pTxn, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *), void *xArg, int flags); diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index 81b306e65d..9a1d89eeac 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -15,7 +15,8 @@ #include "tdbInt.h" -int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb, int8_t rollback) { +int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb, int8_t rollback, int32_t encryptAlgorithm, + char *encryptKey) { TDB *pDb; int dsize; int zsize; @@ -49,6 +50,11 @@ int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb, i pDb->jfd = -1; + pDb->encryptAlgorithm = encryptAlgorithm; + if(encryptKey != NULL){ + strncpy(pDb->encryptKey, encryptKey, ENCRYPT_KEY_LEN); + } + ret = tdbPCacheOpen(szPage, pages, &(pDb->pCache)); if (ret < 0) { return -1; diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 474e5d2270..9dbac11b02 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -14,6 +14,8 @@ */ #include "tdbInt.h" +#include "crypt.h" +#include "tglobal.h" /* #pragma pack(push, 1) typedef struct { @@ -457,6 +459,49 @@ int tdbPagerPrepareAsyncCommit(SPager *pPager, TXN *pTxn) { return 0; } +static char* tdbEncryptPage(SPager *pPager, char* pPageData, int32_t pageSize, const char* function, + int64_t offset){ + int32_t encryptAlgorithm = pPager->pEnv->encryptAlgorithm; + char* encryptKey = pPager->pEnv->encryptKey; + + char* buf = pPageData; + + if(encryptAlgorithm == DND_CA_SM4){ + //tdbInfo("CBC_Encrypt key:%d %s %s", encryptAlgorithm, encryptKey, __FUNCTION__); + //ASSERT(strlen(encryptKey) > 0); + + //tdbInfo("CBC tdb offset:%" PRId64 ", flag:%d before Encrypt", offset, pPage->pData[0]); + + buf = taosMemoryMalloc(pageSize); + + unsigned char packetData[128]; + + int32_t count = 0; + while (count < pageSize) { + SCryptOpts opts = {0}; + opts.len = 128; + opts.source = pPageData + count; + opts.result = packetData; + opts.unitLen = 128; + strncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN); + + int32_t newLen = CBC_Encrypt(&opts); + + memcpy(buf + count, packetData, newLen); + count += newLen; + } + //tdbInfo("CBC tdb offset:%" PRId64 ", Encrypt count:%d %s", offset, count, function); + + //tdbInfo("CBC tdb offset:%" PRId64 ", flag:%d after Encrypt", offset, (uint8_t)buf[0]); + } + + return buf; +} + +void tdbFreeEncryptBuf(SPager *pPager, char* buf){ + int32_t encryptAlgorithm = pPager->pEnv->encryptAlgorithm; + if(encryptAlgorithm == DND_CA_SM4) taosMemoryFreeClear(buf); +} // recovery dirty pages int tdbPagerAbort(SPager *pPager, TXN *pTxn) { SPage *pPage; @@ -525,14 +570,19 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { return -1; } - ret = tdbOsWrite(pPager->fd, pageBuf, pPager->pageSize); + char* buf = tdbEncryptPage(pPager, pageBuf, pPager->pageSize, __FUNCTION__, offset); + + ret = tdbOsWrite(pPager->fd, buf, pPager->pageSize); if (ret < 0) { tdbError("failed to write buf due to %s. file: %s, bufsize:%d", strerror(errno), pPager->dbFileName, pPager->pageSize); + tdbFreeEncryptBuf(pPager, buf); terrno = TAOS_SYSTEM_ERROR(errno); tdbOsFree(pageBuf); return -1; } + + tdbFreeEncryptBuf(pPager, buf); } if (tdbOsFSync(pPager->fd) < 0) { @@ -872,10 +922,44 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage TDB_UNLOCK_PAGE(pPage); return -1; } + + int32_t encryptAlgorithm = pPager->pEnv->encryptAlgorithm; + char* encryptKey = pPager->pEnv->encryptKey; + + if(encryptAlgorithm == DND_CA_SM4){ + //tdbInfo("CBC_Decrypt key:%d %s %s", encryptAlgorithm, encryptKey, __FUNCTION__); + //ASSERT(strlen(encryptKey) > 0); + + //uint8_t flags = pPage->pData[0]; + //tdbInfo("CBC tdb offset:%" PRId64 ", flag:%d before Decrypt", ((i64)pPage->pageSize) * (pgno - 1), flags); + + unsigned char packetData[128]; + + int32_t count = 0; + while(count < pPage->pageSize) + { + SCryptOpts opts = {0}; + opts.len = 128; + opts.source = pPage->pData + count; + opts.result = packetData; + opts.unitLen = 128; + strncpy(opts.key, encryptKey, ENCRYPT_KEY_LEN); + + int newLen = CBC_Decrypt(&opts); + + memcpy(pPage->pData + count, packetData, newLen); + count += newLen; + } + //tdbInfo("CBC tdb offset:%" PRId64 ", Decrypt count:%d %s", ((i64)pPage->pageSize) * (pgno - 1), count, __FUNCTION__); + + //tdbInfo("CBC tdb offset:%" PRId64 ", flag:%d after Decrypt %s", ((i64)pPage->pageSize) * (pgno - 1), pPage->pData[0], __FUNCTION__); + } } else { init = 0; } + //tdbInfo("CBC tdb offset:%" PRId64 ", flag:%d initPage %s", ((i64)pPage->pageSize) * (pgno - 1), pPage->pData[0], __FUNCTION__); + ret = (*initPage)(pPage, arg, init); if (ret < 0) { tdbError("tdb/pager:%p, pgno:%d, nRead:%" PRId64 "pgSize:%" PRId32 " init page failed.", pPager, pgno, nRead, @@ -960,14 +1044,19 @@ static int tdbPagerPWritePageToDB(SPager *pPager, SPage *pPage) { offset = (i64)pPage->pageSize * (TDB_PAGE_PGNO(pPage) - 1); - ret = tdbOsPWrite(pPager->fd, pPage->pData, pPage->pageSize, offset); + char* buf = tdbEncryptPage(pPager, pPage->pData, pPage->pageSize, __FUNCTION__, offset); + + ret = tdbOsPWrite(pPager->fd, buf, pPage->pageSize, offset); if (ret < 0) { + tdbFreeEncryptBuf(pPager, buf); tdbError("failed to pwrite page data due to %s. file:%s, pageSize:%d", strerror(errno), pPager->dbFileName, pPage->pageSize); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } + tdbFreeEncryptBuf(pPager, buf); + return 0; } @@ -1025,14 +1114,19 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) { return -1; } - ret = tdbOsWrite(pPager->fd, pageBuf, pPager->pageSize); + char* buf = tdbEncryptPage(pPager, pageBuf, pPager->pageSize, __FUNCTION__, offset); + + ret = tdbOsWrite(pPager->fd, buf, pPager->pageSize); if (ret < 0) { tdbError("failed to write buf due to %s. file: %s, bufsize:%d", strerror(errno), pPager->dbFileName, pPager->pageSize); + tdbFreeEncryptBuf(pPager, buf); terrno = TAOS_SYSTEM_ERROR(errno); tdbOsFree(pageBuf); return -1; } + + tdbFreeEncryptBuf(pPager, buf); } if (tdbOsFSync(pPager->fd) < 0) { diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 8ce294a3c6..b3351cf787 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -18,6 +18,7 @@ #include "tdb.h" +#include "tdef.h" #include "tlog.h" #include "trbtree.h" @@ -392,6 +393,8 @@ struct STDB { TTB *pFreeDb; #endif int64_t txnId; + int32_t encryptAlgorithm; + char encryptKey[ENCRYPT_KEY_LEN + 1]; }; struct SPager { diff --git a/source/libs/tdb/test/tdbExOVFLTest.cpp b/source/libs/tdb/test/tdbExOVFLTest.cpp index 325703c946..a2deba4696 100644 --- a/source/libs/tdb/test/tdbExOVFLTest.cpp +++ b/source/libs/tdb/test/tdbExOVFLTest.cpp @@ -141,7 +141,7 @@ static void generateBigVal(char *val, int valLen) { static TDB *openEnv(char const *envName, int const pageSize, int const pageNum) { TDB *pEnv = NULL; - int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0); + int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0, 0, NULL); if (ret) { pEnv = NULL; } @@ -374,7 +374,7 @@ TEST(tdb_test, simple_insert1) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database diff --git a/source/libs/tdb/test/tdbPageDefragmentTest.cpp b/source/libs/tdb/test/tdbPageDefragmentTest.cpp index 7aeef94d14..b64517c787 100644 --- a/source/libs/tdb/test/tdbPageDefragmentTest.cpp +++ b/source/libs/tdb/test/tdbPageDefragmentTest.cpp @@ -141,7 +141,7 @@ static void generateBigVal(char *val, int valLen) { static TDB *openEnv(char const *envName, int const pageSize, int const pageNum) { TDB *pEnv = NULL; - int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0); + int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0, 0, NULL); if (ret) { pEnv = NULL; } @@ -352,7 +352,7 @@ TEST(TdbPageDefragmentTest, DISABLED_simple_insert1) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -485,7 +485,7 @@ TEST(TdbPageDefragmentTest, seq_insert) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -566,7 +566,7 @@ TEST(TdbPageDefragmentTest, seq_delete) { int const pageSize = 1 * 1024 * 1024; // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -650,7 +650,7 @@ TEST(TdbPageDefragmentTest, defragment_insert) { int const pageSize = 1 * 1024 * 1024; // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database diff --git a/source/libs/tdb/test/tdbPageRecycleTest.cpp b/source/libs/tdb/test/tdbPageRecycleTest.cpp index d740bd0f94..bbbd90e73d 100644 --- a/source/libs/tdb/test/tdbPageRecycleTest.cpp +++ b/source/libs/tdb/test/tdbPageRecycleTest.cpp @@ -123,7 +123,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in static TDB *openEnv(char const *envName, int const pageSize, int const pageNum) { TDB *pEnv = NULL; - int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0); + int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0 , 0, NULL); if (ret) { pEnv = NULL; } @@ -355,7 +355,7 @@ TEST(TdbPageRecycleTest, DISABLED_simple_insert1) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -484,7 +484,7 @@ static void insertDb(int nData) { int const pageSize = 4 * 1024; // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -552,7 +552,7 @@ static void deleteDb(int nData) { int const pageSize = 4 * 1024; // Open Env - ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0); + ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index cd02eb8d5e..c1aa15b4d2 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -131,7 +131,7 @@ TEST(tdb_test, DISABLED_simple_insert1) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", 4096, 64, &pEnv, 0); + ret = tdbOpen("tdb", 4096, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -246,7 +246,7 @@ TEST(tdb_test, DISABLED_simple_insert2) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", 1024, 10, &pEnv, 0); + ret = tdbOpen("tdb", 1024, 10, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -339,7 +339,7 @@ TEST(tdb_test, DISABLED_simple_delete1) { pPool = openPool(); // open env - ret = tdbOpen("tdb", 1024, 256, &pEnv, 0); + ret = tdbOpen("tdb", 1024, 256, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // open database @@ -428,7 +428,7 @@ TEST(tdb_test, DISABLED_simple_upsert1) { taosRemoveDir("tdb"); // open env - ret = tdbOpen("tdb", 4096, 64, &pEnv, 0); + ret = tdbOpen("tdb", 4096, 64, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // open database @@ -490,7 +490,7 @@ TEST(tdb_test, multi_thread_query) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", 4096, 10, &pEnv, 0); + ret = tdbOpen("tdb", 4096, 10, &pEnv, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -599,7 +599,7 @@ TEST(tdb_test, DISABLED_multi_thread1) { taosRemoveDir("tdb"); // Open Env - ret = tdbOpen("tdb", 512, 1, &pDb, 0); + ret = tdbOpen("tdb", 512, 1, &pDb, 0, 0, NULL); GTEST_ASSERT_EQ(ret, 0); ret = tdbTbOpen("db.db", -1, -1, NULL, pDb, &pTb, 0); diff --git a/source/libs/wal/CMakeLists.txt b/source/libs/wal/CMakeLists.txt index d2ed4f1d16..7b81aff8a8 100644 --- a/source/libs/wal/CMakeLists.txt +++ b/source/libs/wal/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries( PUBLIC os PUBLIC util PUBLIC common + PUBLIC crypt ) if(${BUILD_TEST}) diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index b897eb4922..08162ef158 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -153,7 +153,11 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { } // validate body - recordLen = walCkHeadSz + logContent->head.bodyLen; + int32_t cryptedBodyLen = logContent->head.bodyLen; + if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ + cryptedBodyLen = ENCRYPTED_LEN(cryptedBodyLen); + } + recordLen = walCkHeadSz + cryptedBodyLen; if (len < recordLen) { int64_t extraSize = recordLen - len; if (capacity < readSize + extraSize + sizeof(magic)) { @@ -181,6 +185,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { } logContent = (SWalCkHead*)(buf + pos); + decryptBody(&pWal->cfg, logContent, logContent->head.bodyLen, __FUNCTION__); if (walValidBodyCksum(logContent) != 0) { terrno = TSDB_CODE_WAL_CHKSUM_MISMATCH; wWarn("vgId:%d, failed to validate checksum of wal entry body. offset:%" PRId64 ", file:%s", pWal->cfg.vgId, @@ -618,7 +623,13 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { /*A(idxEntry.ver == ckHead.head.version);*/ idxEntry.ver += 1; - idxEntry.offset += sizeof(SWalCkHead) + ckHead.head.bodyLen; + + int32_t plainBodyLen = ckHead.head.bodyLen; + int32_t cryptedBodyLen = plainBodyLen; + if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ + cryptedBodyLen = ENCRYPTED_LEN(cryptedBodyLen); + } + idxEntry.offset += sizeof(SWalCkHead) + cryptedBodyLen; if (walReadLogHead(pLogFile, idxEntry.offset, &ckHead) < 0) { wError("vgId:%d, failed to read wal log head since %s. index:%" PRId64 ", offset:%" PRId64 ", file:%s", diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index d491b00e73..c164940f9b 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -13,7 +13,9 @@ * along with this program. If not, see . */ +#include "crypt.h" #include "taoserror.h" +#include "wal.h" #include "walInt.h" SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond, int64_t id) { @@ -307,7 +309,13 @@ int32_t walSkipFetchBody(SWalReader *pRead) { pRead->pWal->cfg.vgId, pRead->pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer, pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer, pRead->readerId); - int64_t code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); + int32_t plainBodyLen = pRead->pHead->head.bodyLen; + int32_t cryptedBodyLen = plainBodyLen; + //TODO: dmchen emun + if(pRead->pWal->cfg.encryptAlgorithm == 1){ + cryptedBodyLen = ENCRYPTED_LEN(cryptedBodyLen); + } + int64_t code = taosLSeekFile(pRead->pLogFile, cryptedBodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -328,19 +336,27 @@ int32_t walFetchBody(SWalReader *pRead) { ", 0x%" PRIx64, vgId, ver, pVer->firstVer, pVer->commitVer, pVer->lastVer, pVer->appliedVer, id); - if (pRead->capacity < pReadHead->bodyLen) { - SWalCkHead *ptr = (SWalCkHead *)taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + pReadHead->bodyLen); + int32_t plainBodyLen = pReadHead->bodyLen; + int32_t cryptedBodyLen = plainBodyLen; + + //TODO: dmchen emun + if(pRead->pWal->cfg.encryptAlgorithm == 1){ + cryptedBodyLen = ENCRYPTED_LEN(cryptedBodyLen); + } + + if (pRead->capacity < cryptedBodyLen) { + SWalCkHead *ptr = (SWalCkHead *)taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + cryptedBodyLen); if (ptr == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } pRead->pHead = ptr; pReadHead = &pRead->pHead->head; - pRead->capacity = pReadHead->bodyLen; + pRead->capacity = cryptedBodyLen; } - if (pReadHead->bodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, pReadHead->bodyLen)) { - if (pReadHead->bodyLen < 0) { + if (cryptedBodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, cryptedBodyLen)) { + if (plainBodyLen < 0) { terrno = TAOS_SYSTEM_ERROR(errno); wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s, 0x%"PRIx64, vgId, pReadHead->version, ver, tstrerror(terrno), id); @@ -359,6 +375,8 @@ int32_t walFetchBody(SWalReader *pRead) { return -1; } + decryptBody(&pRead->pWal->cfg, pRead->pHead, plainBodyLen, __FUNCTION__); + if (walValidBodyCksum(pRead->pHead) != 0) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed, 0x%" PRIx64, vgId, ver, id); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; @@ -431,20 +449,28 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { return -1; } - if (pReader->capacity < pReader->pHead->head.bodyLen) { + int32_t plainBodyLen = pReader->pHead->head.bodyLen; + int32_t cryptedBodyLen = plainBodyLen; + + //TODO: dmchen emun + if(pReader->pWal->cfg.encryptAlgorithm == 1){ + cryptedBodyLen = ENCRYPTED_LEN(cryptedBodyLen); + } + + if (pReader->capacity < cryptedBodyLen) { SWalCkHead *ptr = - (SWalCkHead *)taosMemoryRealloc(pReader->pHead, sizeof(SWalCkHead) + pReader->pHead->head.bodyLen); + (SWalCkHead *)taosMemoryRealloc(pReader->pHead, sizeof(SWalCkHead) + cryptedBodyLen); if (ptr == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; taosThreadMutexUnlock(&pReader->mutex); return -1; } pReader->pHead = ptr; - pReader->capacity = pReader->pHead->head.bodyLen; + pReader->capacity = cryptedBodyLen; } - if ((contLen = taosReadFile(pReader->pLogFile, pReader->pHead->head.body, pReader->pHead->head.bodyLen)) != - pReader->pHead->head.bodyLen) { + if ((contLen = taosReadFile(pReader->pLogFile, pReader->pHead->head.body, cryptedBodyLen)) != + cryptedBodyLen) { if (contLen < 0) terrno = TAOS_SYSTEM_ERROR(errno); else { @@ -465,11 +491,13 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { return -1; } + decryptBody(&pReader->pWal->cfg, pReader->pHead, plainBodyLen, __FUNCTION__); + code = walValidBodyCksum(pReader->pHead); if (code != 0) { wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since body checksum not passed", pReader->pWal->cfg.vgId, ver); - uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, pReader->pHead->head.bodyLen); + uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, plainBodyLen); uint32_t logCkSum = pReader->pHead->cksumBody; wError("checksum written into log:%u, checksum calculated:%u", logCkSum, readCkSum); // pReader->curInvalid = 1; @@ -484,6 +512,29 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { return 0; } +void decryptBody(SWalCfg* cfg, SWalCkHead* pHead, int32_t plainBodyLen, const char* func) { + //TODO: dmchen emun + if (cfg->encryptAlgorithm == 1) { + int32_t cryptedBodyLen = ENCRYPTED_LEN(plainBodyLen); + char *newBody = taosMemoryMalloc(cryptedBodyLen); + + SCryptOpts opts; + opts.len = cryptedBodyLen; + opts.source = pHead->head.body; + opts.result = newBody; + opts.unitLen = 16; + strncpy(opts.key, cfg->encryptKey, 16); + + int32_t count = CBC_Decrypt(&opts); + + //wDebug("CBC_Decrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", count, plainBodyLen, func); + + memcpy(pHead->head.body, newBody, plainBodyLen); + + taosMemoryFree(newBody); + } +} + void walReadReset(SWalReader *pReader) { taosThreadMutexLock(&pReader->mutex); taosCloseFile(&pReader->pIdxFile); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 9783705bad..25fec4a998 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -18,6 +18,7 @@ #include "tchecksum.h" #include "tglobal.h" #include "walInt.h" +#include "crypt.h" int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) { taosThreadMutexLock(&pWal->mutex); @@ -491,12 +492,13 @@ static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgType, SWalSyncInfo syncMeta, const void *body, int32_t bodyLen) { int64_t code = 0; + int32_t plainBodyLen = bodyLen; int64_t offset = walGetCurFileOffset(pWal); SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal); pWal->writeHead.head.version = index; - pWal->writeHead.head.bodyLen = bodyLen; + pWal->writeHead.head.bodyLen = plainBodyLen; pWal->writeHead.head.msgType = msgType; pWal->writeHead.head.ingestTs = taosGetTimestampUs(); @@ -504,7 +506,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy pWal->writeHead.head.syncMeta = syncMeta; pWal->writeHead.cksumHead = walCalcHeadCksum(&pWal->writeHead); - pWal->writeHead.cksumBody = walCalcBodyCksum(body, bodyLen); + pWal->writeHead.cksumBody = walCalcBodyCksum(body, plainBodyLen); wDebug("vgId:%d, wal write log %" PRId64 ", msgType: %s, cksum head %u cksum body %u", pWal->cfg.vgId, index, TMSG_INFO(msgType), pWal->writeHead.cksumHead, pWal->writeHead.cksumBody); @@ -521,22 +523,75 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy goto END; } - if (taosWriteFile(pWal->pLogFile, (char *)body, bodyLen) != bodyLen) { + int32_t cyptedBodyLen = plainBodyLen; + char* buf = (char*)body; + char* newBody = NULL; + char* newBodyEncrypted = NULL; + + if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ + cyptedBodyLen = ENCRYPTED_LEN(cyptedBodyLen); + + newBody = taosMemoryMalloc(cyptedBodyLen); + if(newBody == NULL){ + wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), + strerror(errno)); + code = -1; + goto END; + } + memset(newBody, 0, cyptedBodyLen); + memcpy(newBody, body, plainBodyLen); + + newBodyEncrypted = taosMemoryMalloc(cyptedBodyLen); + if(newBodyEncrypted == NULL){ + wError("vgId:%d, file:%" PRId64 ".log, failed to malloc since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), + strerror(errno)); + code = -1; + if(newBody != NULL) taosMemoryFreeClear(newBody); + goto END; + } + + SCryptOpts opts; + opts.len = cyptedBodyLen; + opts.source = newBody; + opts.result = newBodyEncrypted; + opts.unitLen = 16; + strncpy(opts.key, pWal->cfg.encryptKey, ENCRYPT_KEY_LEN); + + int32_t count = CBC_Encrypt(&opts); + + //wDebug("vgId:%d, file:%" PRId64 ".log, index:%" PRId64 ", CBC_Encrypt cryptedBodyLen:%d, plainBodyLen:%d, %s", + // pWal->cfg.vgId, walGetLastFileFirstVer(pWal), index, count, plainBodyLen, __FUNCTION__); + + buf = newBodyEncrypted; + } + + if (taosWriteFile(pWal->pLogFile, (char *)buf, cyptedBodyLen) != cyptedBodyLen) { terrno = TAOS_SYSTEM_ERROR(errno); wError("vgId:%d, file:%" PRId64 ".log, failed to write since %s", pWal->cfg.vgId, walGetLastFileFirstVer(pWal), strerror(errno)); code = -1; + if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ + taosMemoryFreeClear(newBody); + taosMemoryFreeClear(newBodyEncrypted); + } goto END; } + if(pWal->cfg.encryptAlgorithm == DND_CA_SM4){ + taosMemoryFreeClear(newBody); + taosMemoryFreeClear(newBodyEncrypted); + //wInfo("vgId:%d, free newBody newBodyEncrypted %s", + // pWal->cfg.vgId, __FUNCTION__); + } + // set status if (pWal->vers.firstVer == -1) { pWal->vers.firstVer = 0; } pWal->vers.lastVer = index; - pWal->totSize += sizeof(SWalCkHead) + bodyLen; + pWal->totSize += sizeof(SWalCkHead) + cyptedBodyLen; pFileInfo->lastVer = index; - pFileInfo->fileSize += sizeof(SWalCkHead) + bodyLen; + pFileInfo->fileSize += sizeof(SWalCkHead) + cyptedBodyLen; return 0; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 8c6c0e0d7c..768bbe5cd1 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -129,8 +129,6 @@ typedef struct { int8_t inUse; } SConv; -typedef enum { M2C = 0, C2M } ConvType; - // 0: Mbs --> Ucs4 // 1: Ucs4--> Mbs SConv *gConv[2] = {NULL, NULL}; @@ -269,6 +267,22 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) { return (int32_t)(ucs4_max_len - outLen); #endif } + +int32_t taosUcs4ToMbsEx(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs, iconv_t conv) { +#ifdef DISALLOW_NCHAR_WITHOUT_ICONV + printf("Nchar cannot be read and written without iconv, please install iconv library and recompile.\n"); + return -1; +#else + + size_t ucs4_input_len = ucs4_max_len; + size_t outLen = ucs4_max_len; + if (iconv(conv, (char **)&ucs4, &ucs4_input_len, &mbs, &outLen) == -1) { + return -1; + } + return (int32_t)(ucs4_max_len - outLen); +#endif +} + bool taosValidateEncodec(const char *encodec) { #ifdef DISALLOW_NCHAR_WITHOUT_ICONV printf("Nchar cannot be read and written without iconv, please install iconv library and recompile.\n"); diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 53fdc96c37..26122a4a29 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -1203,28 +1203,57 @@ int32_t comparestrRegexNMatch(const void *pLeft, const void *pRight) { return comparestrRegexMatch(pLeft, pRight) ? 0 : 1; } +static threadlocal regex_t pRegex; +static threadlocal char *pOldPattern = NULL; +static regex_t *threadGetRegComp(const char *pPattern) { + if (NULL != pOldPattern) { + if( strcmp(pOldPattern, pPattern) == 0) { + return &pRegex; + } else { + DestoryThreadLocalRegComp(); + } + } + pOldPattern = taosMemoryMalloc(strlen(pPattern) + 1); + if (NULL == pOldPattern) { + uError("Failed to Malloc when compile regex pattern %s.", pPattern); + return NULL; + } + strcpy(pOldPattern, pPattern); + int32_t cflags = REG_EXTENDED; + int32_t ret = regcomp(&pRegex, pPattern, cflags); + if (ret != 0) { + char msgbuf[256] = {0}; + regerror(ret, &pRegex, msgbuf, tListLen(msgbuf)); + uError("Failed to compile regex pattern %s. reason %s", pPattern, msgbuf); + DestoryThreadLocalRegComp(); + return NULL; + } + return &pRegex; +} + +void DestoryThreadLocalRegComp() { + if (NULL != pOldPattern) { + regfree(&pRegex); + taosMemoryFree(pOldPattern); + pOldPattern = NULL; + } +} + static int32_t doExecRegexMatch(const char *pString, const char *pPattern) { int32_t ret = 0; - regex_t regex; char msgbuf[256] = {0}; - - int32_t cflags = REG_EXTENDED; - if ((ret = regcomp(®ex, pPattern, cflags)) != 0) { - regerror(ret, ®ex, msgbuf, tListLen(msgbuf)); - - uError("Failed to compile regex pattern %s. reason %s", pPattern, msgbuf); - regfree(®ex); + regex_t *regex = threadGetRegComp(pPattern); + if (regex == NULL) { return 1; } regmatch_t pmatch[1]; - ret = regexec(®ex, pString, 1, pmatch, 0); + ret = regexec(regex, pString, 1, pmatch, 0); if (ret != 0 && ret != REG_NOMATCH) { - regerror(ret, ®ex, msgbuf, sizeof(msgbuf)); + regerror(ret, regex, msgbuf, sizeof(msgbuf)); uDebug("Failed to match %s with pattern %s, reason %s", pString, pPattern, msgbuf) } - regfree(®ex); return (ret == 0) ? 0 : 1; } @@ -1245,7 +1274,6 @@ int32_t comparestrRegexMatch(const void *pLeft, const void *pRight) { taosMemoryFree(pattern); return (ret == 0) ? 0 : 1; - ; } int32_t comparewcsRegexMatch(const void *pString, const void *pPattern) { diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index cab83e513f..aec1eba684 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -1046,16 +1046,38 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { paGetToken(name + olen + 1, &value, &vlen); if (vlen == 0) continue; value[vlen] = 0; + + if (strcasecmp(name, "encryptScope") == 0) { + char* tmp = NULL; + int32_t len = 0; + char newValue[1024] = {0}; - paGetToken(value + vlen + 1, &value2, &vlen2); - if (vlen2 != 0) { - value2[vlen2] = 0; - paGetToken(value2 + vlen2 + 1, &value3, &vlen3); - if (vlen3 != 0) value3[vlen3] = 0; + strcpy(newValue, value); + + int32_t count = 1; + while(vlen < 1024){ + paGetToken(value + vlen + 1 * count, &tmp, &len); + if(len == 0) break; + tmp[len] = 0; + strcpy(newValue + vlen, tmp); + vlen += len; + count++; + } + + code = cfgSetItem(pConfig, name, newValue, CFG_STYPE_CFG_FILE); + if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; } + else{ + paGetToken(value + vlen + 1, &value2, &vlen2); + if (vlen2 != 0) { + value2[vlen2] = 0; + paGetToken(value2 + vlen2 + 1, &value3, &vlen3); + if (vlen3 != 0) value3[vlen3] = 0; + } - code = cfgSetItem(pConfig, name, value, CFG_STYPE_CFG_FILE); - if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; + code = cfgSetItem(pConfig, name, value, CFG_STYPE_CFG_FILE); + if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break; + } if (strcasecmp(name, "dataDir") == 0) { code = cfgSetTfsItem(pConfig, name, value, value2, value3, CFG_STYPE_CFG_FILE); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 5947652096..ec81f57319 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -247,6 +247,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_OPTION_UNCHANGED, "Database options not TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_INDEX_NOT_EXIST, "Index not exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table name") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_CREATING, "Database in creating status") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE, "Encryption is not allowed to be changed after database is created") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INCONSIST_ENCRYPT_KEY, "Inconsistent encryption key") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ENCRYPT_KEY, "The cluster has not been set properly for database encryption") // mnode-node TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists") @@ -358,6 +361,17 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_ONLY_TWO_MNODE, "Only two mnodes exist TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_NO_NEED_RESTORE, "No need to restore on this dnode") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE, "Please use this command when the dnode is offline") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_NO_MACHINE_CODE, "Dnode can not get machine code") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_NO_ENCRYPT_KEY, "no encryption key exists") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_ENCRYPT_CONFIG, "invalid encryption configuration") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_ENCRYPTKEY, "invalid encryption key") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_ENCRYPTKEY_CHANGED, "encryption key was changed") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_ENCRYPT_KLEN, "Invalid encryption key length") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_STATUS_INTERVAL,"statusInterval not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_TIMEZONE, "timezone not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_CHARSET, "charset not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_LOCALE, "locale not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_TTL_CHG_ON_WR, "ttlChangeOnWrite not match") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_INVALID_EN_WHITELIST, "enableWhiteList not match") // vnode TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode is closed or removed") diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 0712010458..d2651c1d2c 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -18,6 +18,7 @@ #include "taoserror.h" #include "tgeosctx.h" #include "tlog.h" +#include "tcompare.h" #define QUEUE_THRESHOLD (1000 * 1000) @@ -103,6 +104,7 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) { } destroyThreadLocalGeosCtx(); + DestoryThreadLocalRegComp(); return NULL; } diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index 4cd4582749..3fe68a6803 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") self.restartTaosd(1, dbname='scd') @@ -60,17 +60,16 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") - + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") tdSql.execute('drop database scd') diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py index 655499249a..38e35a175e 100644 --- a/tests/develop-test/2-query/table_count_scan.py +++ b/tests/develop-test/2-query/table_count_scan.py @@ -65,7 +65,7 @@ class TDTestCase: tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 31) + tdSql.checkData(0, 0, 32) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 3) @@ -77,7 +77,7 @@ class TDTestCase: tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 31) + tdSql.checkData(0, 0, 32) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 5) @@ -93,7 +93,7 @@ class TDTestCase: tdSql.checkData(1, 1, 'performance_schema') tdSql.checkData(0, 0, 3) tdSql.checkData(0, 1, 'tbl_count') - tdSql.checkData(2, 0, 31) + tdSql.checkData(2, 0, 32) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -106,7 +106,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 39) + tdSql.checkData(0, 0, 40) tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);') @@ -189,7 +189,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 31) + tdSql.checkData(3, 0, 32) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -204,7 +204,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 31) + tdSql.checkData(3, 0, 32) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -215,7 +215,7 @@ class TDTestCase: tdSql.checkData(0, 1, 'tbl_count') tdSql.checkData(1, 0, 5) tdSql.checkData(1, 1, 'performance_schema') - tdSql.checkData(2, 0, 31) + tdSql.checkData(2, 0, 32) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -228,7 +228,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 40) + tdSql.checkData(0, 0, 41) tdSql.execute('drop database tbl_count') diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index f4db7edb8b..c8def3cfca 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -99,7 +99,7 @@ docker run \ -v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \ -v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \ -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=false -DJEMALLOC_ENABLED=0;make -j 10|| exit 1 " + --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=false -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DCMAKE_BUILD_TYPE=Release -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=false -DJEMALLOC_ENABLED=0;make -j 10|| exit 1 " mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim index 11b4482f10..716937f073 100644 --- a/tests/script/tsim/query/sys_tbname.sim +++ b/tests/script/tsim/query/sys_tbname.sim @@ -58,7 +58,7 @@ endi sql select tbname from information_schema.ins_tables; print $rows $data00 -if $rows != 40 then +if $rows != 41 then return -1 endi if $data00 != @ins_tables@ then diff --git a/tests/script/tsim/query/tableCount.sim b/tests/script/tsim/query/tableCount.sim index 4c9c8ce240..5a3dd0714f 100644 --- a/tests/script/tsim/query/tableCount.sim +++ b/tests/script/tsim/query/tableCount.sim @@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou if $rows != 3 then return -1 endi -if $data01 != 37 then +if $data01 != 38 then return -1 endi if $data11 != 10 then @@ -72,7 +72,7 @@ endi if $data11 != 5 then return -1 endi -if $data21 != 31 then +if $data21 != 32 then return -1 endi if $data31 != 5 then @@ -97,7 +97,7 @@ endi if $data42 != 3 then return -1 endi -if $data52 != 31 then +if $data52 != 32 then return -1 endi if $data62 != 5 then diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index c9802fa80d..56ef8c6b47 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -11,7 +11,7 @@ # -*- coding: utf-8 -*- - +import time from util.log import * from util.cases import * from util.sql import * @@ -61,7 +61,7 @@ class TDTestCase: self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\ 'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\ 'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views', - 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines', 'ins_arbgroups', 'ins_tsmas'] + 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines', 'ins_arbgroups', 'ins_tsmas', "ins_encryptions"] self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps'] def insert_data(self,column_dict,tbname,row_num): insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str) @@ -221,7 +221,8 @@ class TDTestCase: tdSql.checkEqual(20470,len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") - tdSql.checkEqual(True, len(tdSql.queryResult) in range(226, 250)) + tdLog.info(len(tdSql.queryResult)) + tdSql.checkEqual(True, len(tdSql.queryResult) in range(251, 252)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(54, len(tdSql.queryResult)) @@ -314,11 +315,56 @@ class TDTestCase: tdSql.error('alter cluster "activeCode" ""') tdSql.execute('alter cluster "activeCode" "revoked"') + def ins_encryptions_check(self): + key_status_list = ['unknown', 'unset', 'set', 'loaded'] + + # unset/none + tdSql.execute('drop database if exists db2') + tdSql.execute('create database if not exists db2 vgroups 1 replica 1') + time.sleep(2) + tdSql.query(f'select * from information_schema.ins_encryptions') + result = tdSql.queryResult + index = 0 + for i in range(0, len(result)): + tdSql.checkEqual(True, result[i][1] in key_status_list[1]) + index += 1 + tdSql.checkEqual(True, index > 0) + + tdSql.query(f'show encryptions') + result = tdSql.queryResult + index = 0 + for i in range(0, len(result)): + tdSql.checkEqual(True, result[i][1] in key_status_list[1]) + index += 1 + tdSql.checkEqual(True, index > 0) + + # loaded/sm4 + tdSql.execute('drop database if exists db2') + tdSql.execute('create encrypt_key \'12345678\'') + time.sleep(3) + tdSql.execute('create database if not exists db2 vgroups 1 replica 1 encrypt_algorithm \'sm4\'') + tdSql.query(f'select * from information_schema.ins_encryptions') + result = tdSql.queryResult + index = 0 + for i in range(0, len(result)): + tdSql.checkEqual(True, result[i][1] in key_status_list[3]) + index += 1 + tdSql.checkEqual(True, index > 0) + + tdSql.query(f'show encryptions') + result = tdSql.queryResult + index = 0 + for i in range(0, len(result)): + tdSql.checkEqual(True, result[i][1] in key_status_list[3]) + index += 1 + tdSql.checkEqual(True, index > 0) + def test_query_ins_tags(self): sql = f'select tag_name, tag_value from information_schema.ins_tags where table_name = "{self.stbname}_0"' tdSql.query(sql) tdSql.checkRows(2) + def run(self): self.prepare_data() self.count_check() @@ -328,6 +374,7 @@ class TDTestCase: self.ins_stable_check2() self.ins_dnodes_check() self.ins_grants_check() + self.ins_encryptions_check() self.test_query_ins_tags() diff --git a/tests/system-test/1-insert/alter_database.py b/tests/system-test/1-insert/alter_database.py index d83813bf3a..e3ff797baa 100644 --- a/tests/system-test/1-insert/alter_database.py +++ b/tests/system-test/1-insert/alter_database.py @@ -64,6 +64,14 @@ class TDTestCase: tdSql.error(f'alter database db pages {pages}') tdSql.execute('drop database db') + def alter_encrypt_alrogithm(self): + tdSql.execute('create database db') + tdSql.checkEqual("Encryption is not allowed to be changed after database is created", tdSql.error('alter database db encrypt_algorithm \'sM4\'')) + tdSql.checkEqual("Encryption is not allowed to be changed after database is created", tdSql.error('alter database db encrypt_algorithm \'noNe\'')) + tdSql.checkEqual("Encryption is not allowed to be changed after database is created", tdSql.error('alter database db encrypt_algorithm \'\'')) + tdSql.checkEqual("Invalid option encrypt_algorithm: none ", tdSql.error('alter database db encrypt_algorithm \'none \'')) + tdSql.execute('drop database db') + def alter_same_options(self): tdSql.execute('drop database if exists db') tdSql.execute('create database db') @@ -92,6 +100,7 @@ class TDTestCase: self.alter_buffer() self.alter_pages() + self.alter_encrypt_alrogithm() self.alter_same_options() def stop(self):