From ef58f09931fe7cffbf16894596b3e5097f7bd7c1 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Fri, 28 May 2021 19:09:55 +0800 Subject: [PATCH 01/46] support alter column length --- src/client/src/tscSQLParser.c | 32 +- src/inc/ttokendef.h | 100 +- src/mnode/src/mnodeTable.c | 12 +- src/query/inc/sql.y | 14 +- src/query/src/qSqlParser.c | 2 +- src/query/src/sql.c | 1664 ++++++++++++++++++++------------- src/util/src/ttokenizer.c | 3 +- 7 files changed, 1110 insertions(+), 717 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 61b659f96c..d5141fad10 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5074,6 +5074,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg18 = "primary timestamp column cannot be dropped"; const char* msg19 = "invalid new tag name"; const char* msg20 = "table is not super table"; + const char* msg21 = "only binary/nchar column length could be altered"; + const char* msg22 = "invalid column length"; int32_t code = TSDB_CODE_SUCCESS; @@ -5110,7 +5112,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) && (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4); - } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN) && + } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) && UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6); } @@ -5326,6 +5328,34 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { tstrncpy(name1, pItem->pVar.pz, sizeof(name1)); TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { + if (taosArrayGetSize(pAlterSQL->pAddColumns) != 2) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), NULL); + } + + tVariantListItem* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + + SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; + SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen}; + if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg17); + } + + SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); + + if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + pItem = taosArrayGet(pAlterSQL->pAddColumns, 1); + int64_t nlen = 0; + + if (tVariantDump(&pItem->pVar, (char *)&nlen, TSDB_DATA_TYPE_BIGINT, false) < 0 || nlen <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg22); + } + + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, nlen); + tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } return TSDB_CODE_SUCCESS; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index ef3f8ed1fb..51272e15f5 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -155,54 +155,58 @@ #define TK_SYNCDB 136 #define TK_ADD 137 #define TK_COLUMN 138 -#define TK_TAG 139 -#define TK_CHANGE 140 -#define TK_SET 141 -#define TK_KILL 142 -#define TK_CONNECTION 143 -#define TK_STREAM 144 -#define TK_COLON 145 -#define TK_ABORT 146 -#define TK_AFTER 147 -#define TK_ATTACH 148 -#define TK_BEFORE 149 -#define TK_BEGIN 150 -#define TK_CASCADE 151 -#define TK_CLUSTER 152 -#define TK_CONFLICT 153 -#define TK_COPY 154 -#define TK_DEFERRED 155 -#define TK_DELIMITERS 156 -#define TK_DETACH 157 -#define TK_EACH 158 -#define TK_END 159 -#define TK_EXPLAIN 160 -#define TK_FAIL 161 -#define TK_FOR 162 -#define TK_IGNORE 163 -#define TK_IMMEDIATE 164 -#define TK_INITIALLY 165 -#define TK_INSTEAD 166 -#define TK_MATCH 167 -#define TK_KEY 168 -#define TK_OF 169 -#define TK_RAISE 170 -#define TK_REPLACE 171 -#define TK_RESTRICT 172 -#define TK_ROW 173 -#define TK_STATEMENT 174 -#define TK_TRIGGER 175 -#define TK_VIEW 176 -#define TK_SEMI 177 -#define TK_NONE 178 -#define TK_PREV 179 -#define TK_LINEAR 180 -#define TK_IMPORT 181 -#define TK_TBNAME 182 -#define TK_JOIN 183 -#define TK_INSERT 184 -#define TK_INTO 185 -#define TK_VALUES 186 +#define TK_LENGTH 139 +#define TK_TAG 140 +#define TK_CHANGE 141 +#define TK_SET 142 +#define TK_KILL 143 +#define TK_CONNECTION 144 +#define TK_STREAM 145 +#define TK_COLON 146 +#define TK_ABORT 147 +#define TK_AFTER 148 +#define TK_ATTACH 149 +#define TK_BEFORE 150 +#define TK_BEGIN 151 +#define TK_CASCADE 152 +#define TK_CLUSTER 153 +#define TK_CONFLICT 154 +#define TK_COPY 155 +#define TK_DEFERRED 156 +#define TK_DELIMITERS 157 +#define TK_DETACH 158 +#define TK_EACH 159 +#define TK_END 160 +#define TK_EXPLAIN 161 +#define TK_FAIL 162 +#define TK_FOR 163 +#define TK_IGNORE 164 +#define TK_IMMEDIATE 165 +#define TK_INITIALLY 166 +#define TK_INSTEAD 167 +#define TK_MATCH 168 +#define TK_KEY 169 +#define TK_OF 170 +#define TK_RAISE 171 +#define TK_REPLACE 172 +#define TK_RESTRICT 173 +#define TK_ROW 174 +#define TK_STATEMENT 175 +#define TK_TRIGGER 176 +#define TK_VIEW 177 +#define TK_SEMI 178 +#define TK_NONE 179 +#define TK_PREV 180 +#define TK_LINEAR 181 +#define TK_IMPORT 182 +#define TK_TBNAME 183 +#define TK_JOIN 184 +#define TK_INSERT 185 +#define TK_INTO 186 +#define TK_VALUES 187 + + + #define TK_SPACE 300 diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 4e879537e4..89d13a4c12 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -3100,7 +3100,10 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropSuperTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + //code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + (void)mnodeChangeSuperTableColumn; + mError("change table[%s] column[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); + code = TSDB_CODE_SUCCESS; } else { } } else { @@ -3112,7 +3115,10 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropNormalTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - code = mnodeChangeNormalTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + //code = mnodeChangeNormalTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + (void)mnodeChangeNormalTableColumn; + mError("change table[%s] column[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); + code = TSDB_CODE_SUCCESS; } else { } } @@ -3303,4 +3309,4 @@ int32_t mnodeCompactTables() { mnodeCompactChildTables(); return 0; -} \ No newline at end of file +} diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 8ef8ef0e2b..62f7da9f9c 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -28,7 +28,7 @@ #include #include "qSqlparser.h" #include "tcmdtype.h" -#include "tstoken.h" +#include "ttoken.h" #include "ttokendef.h" #include "tutil.h" #include "tvariant.h" @@ -748,6 +748,18 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER TABLE ids(X) cpxName(F) ALTER COLUMN LENGTH ids(A) INTEGER(Z). { + X.n += F.n; + + toTSDBType(A.type); + SArray* K = tVariantListAppendToken(NULL, &A, -1); + toTSDBType(Z.type); + K = tVariantListAppendToken(K, &Z, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER TABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index 2459439b7b..959de7530d 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -885,7 +885,7 @@ SAlterTableInfo *tSetAlterTableInfo(SStrToken *pTableName, SArray *pCols, SArray pAlterTable->type = type; pAlterTable->tableType = tableType; - if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) { + if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { pAlterTable->pAddColumns = pCols; assert(pVals == NULL); } else { diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 5a5038be79..ca840ea4dc 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,13 +23,14 @@ ** input grammar file: */ #include +#include /************ Begin %include sections from the grammar ************************/ -#include -#include #include #include #include +#include +#include #include "qSqlparser.h" #include "tcmdtype.h" #include "ttoken.h" @@ -76,8 +77,10 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -97,7 +100,7 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 264 +#define YYNOCODE 263 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { @@ -124,21 +127,29 @@ typedef union { #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo -#define ParseARG_STORE yypParser->pInfo = pInfo +#define ParseARG_PARAM ,pInfo +#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; +#define ParseARG_STORE yypParser->pInfo=pInfo; +#define ParseCTX_SDECL +#define ParseCTX_PDECL +#define ParseCTX_PARAM +#define ParseCTX_FETCH +#define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 317 -#define YYNRULE 270 -#define YYNTOKEN 187 -#define YY_MAX_SHIFT 316 -#define YY_MIN_SHIFTREDUCE 511 -#define YY_MAX_SHIFTREDUCE 780 -#define YY_ERROR_ACTION 781 -#define YY_ACCEPT_ACTION 782 -#define YY_NO_ACTION 783 -#define YY_MIN_REDUCE 784 -#define YY_MAX_REDUCE 1053 +#define YYNSTATE 321 +#define YYNRULE 271 +#define YYNRULE_WITH_ACTION 271 +#define YYNTOKEN 188 +#define YY_MAX_SHIFT 320 +#define YY_MIN_SHIFTREDUCE 516 +#define YY_MAX_SHIFTREDUCE 786 +#define YY_ERROR_ACTION 787 +#define YY_ACCEPT_ACTION 788 +#define YY_NO_ACTION 789 +#define YY_MIN_REDUCE 790 +#define YY_MAX_REDUCE 1060 /************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -205,145 +216,145 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (685) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 925, 559, 206, 314, 211, 141, 952, 3, 168, 560, - /* 10 */ 782, 316, 134, 47, 48, 141, 51, 52, 30, 183, - /* 20 */ 217, 41, 183, 50, 264, 55, 53, 57, 54, 1034, - /* 30 */ 931, 214, 1035, 46, 45, 17, 183, 44, 43, 42, - /* 40 */ 47, 48, 223, 51, 52, 213, 1035, 217, 41, 559, - /* 50 */ 50, 264, 55, 53, 57, 54, 943, 560, 181, 208, - /* 60 */ 46, 45, 928, 222, 44, 43, 42, 48, 949, 51, - /* 70 */ 52, 244, 983, 217, 41, 249, 50, 264, 55, 53, - /* 80 */ 57, 54, 984, 638, 259, 85, 46, 45, 280, 931, - /* 90 */ 44, 43, 42, 512, 513, 514, 515, 516, 517, 518, - /* 100 */ 519, 520, 521, 522, 523, 524, 315, 943, 187, 207, - /* 110 */ 70, 290, 289, 47, 48, 30, 51, 52, 300, 919, - /* 120 */ 217, 41, 209, 50, 264, 55, 53, 57, 54, 44, - /* 130 */ 43, 42, 724, 46, 45, 674, 224, 44, 43, 42, - /* 140 */ 47, 49, 24, 51, 52, 228, 141, 217, 41, 559, - /* 150 */ 50, 264, 55, 53, 57, 54, 220, 560, 105, 928, - /* 160 */ 46, 45, 931, 300, 44, 43, 42, 23, 278, 309, - /* 170 */ 308, 277, 276, 275, 307, 274, 306, 305, 304, 273, - /* 180 */ 303, 302, 891, 30, 879, 880, 881, 882, 883, 884, - /* 190 */ 885, 886, 887, 888, 889, 890, 892, 893, 51, 52, - /* 200 */ 830, 1031, 217, 41, 167, 50, 264, 55, 53, 57, - /* 210 */ 54, 261, 18, 78, 230, 46, 45, 287, 286, 44, - /* 220 */ 43, 42, 216, 739, 221, 30, 728, 928, 731, 192, - /* 230 */ 734, 216, 739, 310, 1030, 728, 193, 731, 236, 734, - /* 240 */ 30, 118, 117, 191, 677, 559, 240, 239, 55, 53, - /* 250 */ 57, 54, 25, 560, 202, 203, 46, 45, 263, 931, - /* 260 */ 44, 43, 42, 202, 203, 74, 283, 61, 23, 928, - /* 270 */ 309, 308, 74, 36, 730, 307, 733, 306, 305, 304, - /* 280 */ 36, 303, 302, 899, 927, 662, 897, 898, 659, 62, - /* 290 */ 660, 900, 661, 902, 903, 901, 82, 904, 905, 103, - /* 300 */ 97, 108, 243, 917, 68, 30, 107, 113, 116, 106, - /* 310 */ 199, 5, 33, 157, 141, 110, 231, 232, 156, 92, - /* 320 */ 87, 91, 681, 226, 30, 56, 30, 914, 915, 29, - /* 330 */ 918, 729, 740, 732, 56, 175, 173, 171, 736, 1, - /* 340 */ 155, 740, 170, 121, 120, 119, 284, 736, 229, 928, - /* 350 */ 265, 46, 45, 69, 735, 44, 43, 42, 839, 666, - /* 360 */ 12, 667, 167, 735, 84, 288, 81, 292, 928, 215, - /* 370 */ 928, 313, 312, 126, 132, 130, 129, 80, 705, 706, - /* 380 */ 831, 79, 280, 929, 167, 916, 737, 245, 726, 684, - /* 390 */ 71, 31, 227, 994, 663, 282, 690, 247, 696, 697, - /* 400 */ 136, 760, 60, 20, 741, 19, 64, 648, 19, 241, - /* 410 */ 267, 31, 650, 6, 31, 269, 60, 1029, 649, 83, - /* 420 */ 28, 200, 60, 270, 727, 201, 65, 96, 95, 185, - /* 430 */ 14, 13, 993, 102, 101, 67, 218, 637, 16, 15, - /* 440 */ 664, 186, 665, 738, 115, 114, 743, 188, 182, 189, - /* 450 */ 190, 196, 197, 195, 180, 194, 184, 133, 1045, 990, - /* 460 */ 930, 989, 219, 291, 39, 951, 959, 944, 961, 135, - /* 470 */ 139, 976, 248, 975, 926, 131, 152, 151, 924, 153, - /* 480 */ 250, 154, 689, 210, 252, 150, 257, 145, 142, 842, - /* 490 */ 941, 143, 272, 144, 262, 37, 146, 66, 58, 178, - /* 500 */ 63, 260, 34, 258, 256, 281, 838, 147, 1050, 254, - /* 510 */ 93, 1049, 1047, 158, 285, 1044, 99, 148, 1043, 1041, - /* 520 */ 159, 860, 251, 35, 32, 38, 149, 179, 827, 109, - /* 530 */ 825, 111, 112, 823, 822, 233, 169, 820, 819, 818, - /* 540 */ 817, 816, 815, 172, 174, 40, 812, 810, 808, 806, - /* 550 */ 176, 803, 177, 301, 246, 72, 75, 104, 253, 977, - /* 560 */ 293, 294, 295, 296, 297, 204, 225, 298, 271, 299, - /* 570 */ 311, 780, 205, 198, 234, 88, 89, 235, 779, 237, - /* 580 */ 238, 778, 766, 765, 242, 247, 821, 814, 162, 266, - /* 590 */ 122, 861, 160, 165, 161, 164, 163, 166, 123, 124, - /* 600 */ 813, 805, 895, 125, 804, 2, 8, 73, 4, 669, - /* 610 */ 76, 691, 137, 212, 694, 86, 138, 77, 907, 255, - /* 620 */ 9, 698, 140, 26, 742, 7, 27, 11, 10, 21, - /* 630 */ 84, 744, 22, 268, 601, 597, 595, 594, 593, 590, - /* 640 */ 563, 279, 94, 90, 31, 59, 640, 639, 636, 585, - /* 650 */ 583, 98, 575, 581, 577, 579, 573, 571, 604, 603, - /* 660 */ 602, 600, 599, 100, 598, 596, 592, 591, 60, 561, - /* 670 */ 528, 784, 526, 783, 783, 783, 783, 783, 783, 127, - /* 680 */ 783, 783, 783, 783, 128, + /* 0 */ 135, 564, 207, 318, 212, 142, 958, 230, 142, 565, + /* 10 */ 788, 320, 17, 47, 48, 142, 51, 52, 30, 184, + /* 20 */ 218, 41, 184, 50, 265, 55, 53, 57, 54, 1040, + /* 30 */ 937, 215, 1041, 46, 45, 182, 184, 44, 43, 42, + /* 40 */ 47, 48, 935, 51, 52, 214, 1041, 218, 41, 564, + /* 50 */ 50, 265, 55, 53, 57, 54, 949, 565, 188, 209, + /* 60 */ 46, 45, 934, 250, 44, 43, 42, 48, 955, 51, + /* 70 */ 52, 245, 989, 218, 41, 79, 50, 265, 55, 53, + /* 80 */ 57, 54, 990, 106, 260, 281, 46, 45, 304, 227, + /* 90 */ 44, 43, 42, 517, 518, 519, 520, 521, 522, 523, + /* 100 */ 524, 525, 526, 527, 528, 529, 319, 643, 85, 208, + /* 110 */ 70, 564, 304, 47, 48, 30, 51, 52, 1037, 565, + /* 120 */ 218, 41, 923, 50, 265, 55, 53, 57, 54, 44, + /* 130 */ 43, 42, 729, 46, 45, 294, 293, 44, 43, 42, + /* 140 */ 47, 49, 925, 51, 52, 1036, 142, 218, 41, 564, + /* 150 */ 50, 265, 55, 53, 57, 54, 221, 565, 228, 934, + /* 160 */ 46, 45, 283, 1052, 44, 43, 42, 23, 279, 313, + /* 170 */ 312, 278, 277, 276, 311, 275, 310, 309, 308, 274, + /* 180 */ 307, 306, 897, 30, 885, 886, 887, 888, 889, 890, + /* 190 */ 891, 892, 893, 894, 895, 896, 898, 899, 51, 52, + /* 200 */ 836, 281, 218, 41, 168, 50, 265, 55, 53, 57, + /* 210 */ 54, 262, 18, 78, 25, 46, 45, 1, 156, 44, + /* 220 */ 43, 42, 217, 744, 222, 30, 733, 934, 736, 193, + /* 230 */ 739, 217, 744, 223, 12, 733, 194, 736, 84, 739, + /* 240 */ 81, 119, 118, 192, 317, 316, 127, 225, 55, 53, + /* 250 */ 57, 54, 949, 731, 203, 204, 46, 45, 264, 937, + /* 260 */ 44, 43, 42, 203, 204, 1035, 284, 210, 23, 934, + /* 270 */ 313, 312, 74, 937, 735, 311, 738, 310, 309, 308, + /* 280 */ 36, 307, 306, 905, 201, 667, 903, 904, 664, 732, + /* 290 */ 665, 906, 666, 908, 909, 907, 82, 910, 911, 104, + /* 300 */ 97, 109, 244, 202, 68, 30, 108, 114, 117, 107, + /* 310 */ 74, 200, 5, 33, 158, 111, 232, 233, 36, 157, + /* 320 */ 92, 87, 91, 682, 229, 56, 30, 920, 921, 29, + /* 330 */ 924, 291, 745, 30, 56, 176, 174, 172, 741, 314, + /* 340 */ 931, 745, 171, 122, 121, 120, 285, 741, 30, 934, + /* 350 */ 237, 46, 45, 69, 740, 44, 43, 42, 689, 241, + /* 360 */ 240, 266, 734, 740, 737, 937, 248, 292, 80, 61, + /* 370 */ 934, 133, 131, 130, 296, 3, 169, 934, 186, 845, + /* 380 */ 837, 71, 224, 168, 168, 922, 742, 710, 711, 679, + /* 390 */ 216, 62, 933, 231, 668, 187, 24, 288, 287, 246, + /* 400 */ 695, 686, 701, 31, 137, 702, 60, 765, 746, 20, + /* 410 */ 64, 19, 19, 653, 189, 268, 655, 31, 270, 31, + /* 420 */ 60, 654, 83, 28, 183, 60, 271, 96, 190, 95, + /* 430 */ 65, 14, 1000, 13, 6, 67, 103, 642, 102, 671, + /* 440 */ 669, 672, 670, 16, 191, 15, 116, 115, 197, 198, + /* 450 */ 196, 181, 195, 185, 936, 999, 219, 748, 996, 995, + /* 460 */ 220, 295, 242, 134, 39, 957, 965, 967, 136, 950, + /* 470 */ 249, 982, 140, 981, 743, 932, 152, 132, 153, 930, + /* 480 */ 251, 154, 155, 848, 694, 305, 147, 273, 947, 143, + /* 490 */ 37, 263, 144, 145, 211, 179, 66, 34, 282, 253, + /* 500 */ 258, 63, 58, 844, 261, 1057, 93, 259, 1056, 146, + /* 510 */ 257, 1054, 159, 286, 1051, 99, 289, 1050, 1047, 160, + /* 520 */ 866, 148, 255, 35, 32, 38, 180, 833, 110, 831, + /* 530 */ 112, 113, 829, 828, 234, 170, 826, 252, 825, 824, + /* 540 */ 823, 822, 821, 173, 175, 818, 816, 814, 40, 812, + /* 550 */ 177, 809, 178, 105, 247, 72, 75, 254, 983, 297, + /* 560 */ 298, 299, 300, 301, 302, 303, 315, 786, 205, 226, + /* 570 */ 235, 272, 236, 785, 238, 239, 206, 199, 88, 784, + /* 580 */ 89, 771, 770, 243, 248, 76, 827, 674, 267, 8, + /* 590 */ 123, 696, 124, 163, 162, 867, 161, 164, 165, 167, + /* 600 */ 166, 820, 2, 125, 819, 901, 126, 811, 4, 73, + /* 610 */ 810, 138, 151, 149, 150, 139, 699, 77, 913, 213, + /* 620 */ 256, 26, 703, 141, 9, 10, 747, 27, 7, 11, + /* 630 */ 21, 749, 22, 86, 269, 606, 602, 84, 600, 599, + /* 640 */ 598, 595, 280, 568, 94, 90, 31, 774, 59, 645, + /* 650 */ 644, 641, 590, 588, 98, 100, 580, 586, 582, 584, + /* 660 */ 578, 101, 576, 609, 608, 607, 605, 604, 290, 603, + /* 670 */ 601, 597, 596, 60, 566, 533, 531, 128, 790, 789, + /* 680 */ 789, 789, 789, 789, 129, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 191, 1, 190, 191, 210, 191, 191, 194, 195, 9, - /* 10 */ 188, 189, 191, 13, 14, 191, 16, 17, 191, 252, + /* 0 */ 191, 1, 190, 191, 210, 191, 191, 191, 191, 9, + /* 10 */ 188, 189, 252, 13, 14, 191, 16, 17, 191, 252, /* 20 */ 20, 21, 252, 23, 24, 25, 26, 27, 28, 262, /* 30 */ 236, 261, 262, 33, 34, 252, 252, 37, 38, 39, - /* 40 */ 13, 14, 233, 16, 17, 261, 262, 20, 21, 1, + /* 40 */ 13, 14, 226, 16, 17, 261, 262, 20, 21, 1, /* 50 */ 23, 24, 25, 26, 27, 28, 234, 9, 252, 232, - /* 60 */ 33, 34, 235, 210, 37, 38, 39, 14, 253, 16, - /* 70 */ 17, 249, 258, 20, 21, 254, 23, 24, 25, 26, - /* 80 */ 27, 28, 258, 5, 260, 197, 33, 34, 79, 236, + /* 60 */ 33, 34, 235, 254, 37, 38, 39, 14, 253, 16, + /* 70 */ 17, 249, 258, 20, 21, 258, 23, 24, 25, 26, + /* 80 */ 27, 28, 258, 76, 260, 79, 33, 34, 81, 68, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 234, 252, 61, - /* 110 */ 110, 33, 34, 13, 14, 191, 16, 17, 81, 231, - /* 120 */ 20, 21, 249, 23, 24, 25, 26, 27, 28, 37, - /* 130 */ 38, 39, 105, 33, 34, 109, 210, 37, 38, 39, - /* 140 */ 13, 14, 116, 16, 17, 68, 191, 20, 21, 1, - /* 150 */ 23, 24, 25, 26, 27, 28, 232, 9, 76, 235, - /* 160 */ 33, 34, 236, 81, 37, 38, 39, 88, 89, 90, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 5, 197, 61, + /* 110 */ 110, 1, 81, 13, 14, 191, 16, 17, 252, 9, + /* 120 */ 20, 21, 0, 23, 24, 25, 26, 27, 28, 37, + /* 130 */ 38, 39, 105, 33, 34, 33, 34, 37, 38, 39, + /* 140 */ 13, 14, 231, 16, 17, 252, 191, 20, 21, 1, + /* 150 */ 23, 24, 25, 26, 27, 28, 232, 9, 137, 235, + /* 160 */ 33, 34, 141, 236, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216, /* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17, - /* 200 */ 196, 252, 20, 21, 200, 23, 24, 25, 26, 27, - /* 210 */ 28, 256, 44, 258, 137, 33, 34, 140, 141, 37, + /* 200 */ 196, 79, 20, 21, 200, 23, 24, 25, 26, 27, + /* 210 */ 28, 256, 44, 258, 104, 33, 34, 198, 199, 37, /* 220 */ 38, 39, 1, 2, 232, 191, 5, 235, 7, 61, - /* 230 */ 9, 1, 2, 210, 252, 5, 68, 7, 135, 9, - /* 240 */ 191, 73, 74, 75, 37, 1, 143, 144, 25, 26, - /* 250 */ 27, 28, 104, 9, 33, 34, 33, 34, 37, 236, - /* 260 */ 37, 38, 39, 33, 34, 104, 232, 109, 88, 235, - /* 270 */ 90, 91, 104, 112, 5, 95, 7, 97, 98, 99, - /* 280 */ 112, 101, 102, 209, 235, 2, 212, 213, 5, 131, + /* 230 */ 9, 1, 2, 210, 104, 5, 68, 7, 108, 9, + /* 240 */ 110, 73, 74, 75, 65, 66, 67, 210, 25, 26, + /* 250 */ 27, 28, 234, 1, 33, 34, 33, 34, 37, 236, + /* 260 */ 37, 38, 39, 33, 34, 252, 232, 249, 88, 235, + /* 270 */ 90, 91, 104, 236, 5, 95, 7, 97, 98, 99, + /* 280 */ 112, 101, 102, 209, 252, 2, 212, 213, 5, 37, /* 290 */ 7, 217, 9, 219, 220, 221, 197, 223, 224, 62, - /* 300 */ 63, 64, 134, 0, 136, 191, 69, 70, 71, 72, - /* 310 */ 142, 62, 63, 64, 191, 78, 33, 34, 69, 70, - /* 320 */ 71, 72, 115, 68, 191, 104, 191, 228, 229, 230, - /* 330 */ 231, 5, 111, 7, 104, 62, 63, 64, 117, 198, - /* 340 */ 199, 111, 69, 70, 71, 72, 232, 117, 191, 235, - /* 350 */ 15, 33, 34, 197, 133, 37, 38, 39, 196, 5, - /* 360 */ 104, 7, 200, 133, 108, 232, 110, 232, 235, 60, - /* 370 */ 235, 65, 66, 67, 62, 63, 64, 237, 124, 125, - /* 380 */ 196, 258, 79, 226, 200, 229, 117, 105, 1, 105, - /* 390 */ 250, 109, 137, 227, 111, 140, 105, 113, 105, 105, - /* 400 */ 109, 105, 109, 109, 105, 109, 109, 105, 109, 191, - /* 410 */ 105, 109, 105, 104, 109, 105, 109, 252, 105, 109, - /* 420 */ 104, 252, 109, 107, 37, 252, 129, 138, 139, 252, - /* 430 */ 138, 139, 227, 138, 139, 104, 227, 106, 138, 139, - /* 440 */ 5, 252, 7, 117, 76, 77, 111, 252, 252, 252, - /* 450 */ 252, 252, 252, 252, 252, 252, 252, 191, 236, 227, - /* 460 */ 236, 227, 227, 227, 251, 191, 191, 234, 191, 191, - /* 470 */ 191, 259, 234, 259, 234, 60, 191, 238, 191, 191, - /* 480 */ 255, 191, 117, 255, 255, 239, 255, 244, 247, 191, - /* 490 */ 248, 246, 191, 245, 122, 191, 243, 128, 127, 191, - /* 500 */ 130, 126, 191, 121, 120, 191, 191, 242, 191, 119, - /* 510 */ 191, 191, 191, 191, 191, 191, 191, 241, 191, 191, - /* 520 */ 191, 191, 118, 191, 191, 191, 240, 191, 191, 191, - /* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 540 */ 191, 191, 191, 191, 191, 132, 191, 191, 191, 191, - /* 550 */ 191, 191, 191, 103, 192, 192, 192, 87, 192, 192, - /* 560 */ 86, 50, 83, 85, 54, 192, 192, 84, 192, 82, - /* 570 */ 79, 5, 192, 192, 145, 197, 197, 5, 5, 145, - /* 580 */ 5, 5, 90, 89, 135, 113, 192, 192, 202, 107, - /* 590 */ 193, 208, 207, 204, 206, 203, 205, 201, 193, 193, - /* 600 */ 192, 192, 225, 193, 192, 198, 104, 114, 194, 105, - /* 610 */ 109, 105, 104, 1, 105, 76, 109, 104, 225, 104, - /* 620 */ 123, 105, 104, 109, 105, 104, 109, 104, 123, 104, - /* 630 */ 108, 111, 104, 107, 9, 5, 5, 5, 5, 5, - /* 640 */ 80, 15, 139, 76, 109, 16, 5, 5, 105, 5, - /* 650 */ 5, 139, 5, 5, 5, 5, 5, 5, 5, 5, - /* 660 */ 5, 5, 5, 139, 5, 5, 5, 5, 109, 80, - /* 670 */ 60, 0, 59, 263, 263, 263, 263, 263, 263, 21, + /* 300 */ 63, 64, 134, 252, 136, 191, 69, 70, 71, 72, + /* 310 */ 104, 143, 62, 63, 64, 78, 33, 34, 112, 69, + /* 320 */ 70, 71, 72, 37, 68, 104, 191, 228, 229, 230, + /* 330 */ 231, 75, 111, 191, 104, 62, 63, 64, 117, 210, + /* 340 */ 191, 111, 69, 70, 71, 72, 232, 117, 191, 235, + /* 350 */ 135, 33, 34, 197, 133, 37, 38, 39, 105, 144, + /* 360 */ 145, 15, 5, 133, 7, 236, 113, 232, 237, 109, + /* 370 */ 235, 62, 63, 64, 232, 194, 195, 235, 252, 196, + /* 380 */ 196, 250, 233, 200, 200, 229, 117, 124, 125, 109, + /* 390 */ 60, 131, 235, 137, 111, 252, 116, 141, 142, 105, + /* 400 */ 105, 115, 105, 109, 109, 105, 109, 105, 105, 109, + /* 410 */ 109, 109, 109, 105, 252, 105, 105, 109, 105, 109, + /* 420 */ 109, 105, 109, 104, 252, 109, 107, 138, 252, 140, + /* 430 */ 129, 138, 227, 140, 104, 104, 138, 106, 140, 5, + /* 440 */ 5, 7, 7, 138, 252, 140, 76, 77, 252, 252, + /* 450 */ 252, 252, 252, 252, 236, 227, 227, 111, 227, 227, + /* 460 */ 227, 227, 191, 191, 251, 191, 191, 191, 191, 234, + /* 470 */ 234, 259, 191, 259, 117, 234, 238, 60, 191, 191, + /* 480 */ 255, 191, 191, 191, 117, 103, 243, 191, 248, 247, + /* 490 */ 191, 122, 246, 245, 255, 191, 128, 191, 191, 255, + /* 500 */ 255, 130, 127, 191, 126, 191, 191, 121, 191, 244, + /* 510 */ 120, 191, 191, 191, 191, 191, 191, 191, 191, 191, + /* 520 */ 191, 242, 119, 191, 191, 191, 191, 191, 191, 191, + /* 530 */ 191, 191, 191, 191, 191, 191, 191, 118, 191, 191, + /* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 132, 191, + /* 550 */ 191, 191, 191, 87, 192, 192, 192, 192, 192, 86, + /* 560 */ 50, 83, 85, 54, 84, 82, 79, 5, 192, 192, + /* 570 */ 146, 192, 5, 5, 146, 5, 192, 192, 197, 5, + /* 580 */ 197, 90, 89, 135, 113, 109, 192, 105, 107, 104, + /* 590 */ 193, 105, 193, 202, 206, 208, 207, 205, 203, 201, + /* 600 */ 204, 192, 198, 193, 192, 225, 193, 192, 194, 114, + /* 610 */ 192, 104, 239, 241, 240, 109, 105, 104, 225, 1, + /* 620 */ 104, 109, 105, 104, 123, 123, 105, 109, 104, 104, + /* 630 */ 104, 111, 104, 76, 107, 9, 5, 108, 5, 5, + /* 640 */ 5, 5, 15, 80, 140, 76, 109, 5, 16, 5, + /* 650 */ 5, 105, 5, 5, 140, 140, 5, 5, 5, 5, + /* 660 */ 5, 139, 5, 5, 5, 5, 5, 5, 138, 5, + /* 670 */ 5, 5, 5, 109, 80, 60, 59, 21, 0, 263, /* 680 */ 263, 263, 263, 263, 21, 263, 263, 263, 263, 263, /* 690 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 700 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, @@ -363,101 +374,104 @@ static const YYCODETYPE yy_lookahead[] = { /* 840 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 850 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, /* 860 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - /* 870 */ 263, 263, + /* 870 */ 263, 263, 263, }; -#define YY_SHIFT_COUNT (316) +#define YY_SHIFT_COUNT (320) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (671) +#define YY_SHIFT_MAX (678) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 168, 79, 79, 180, 180, 9, 221, 230, 244, 244, - /* 10 */ 244, 244, 244, 244, 244, 244, 244, 0, 48, 230, - /* 20 */ 283, 283, 283, 283, 148, 161, 244, 244, 244, 303, - /* 30 */ 244, 244, 82, 9, 37, 37, 685, 685, 685, 230, + /* 0 */ 168, 79, 79, 180, 180, 6, 221, 230, 148, 148, + /* 10 */ 148, 148, 148, 148, 148, 148, 148, 0, 48, 230, + /* 20 */ 283, 283, 283, 283, 110, 206, 148, 148, 148, 122, + /* 30 */ 148, 148, 7, 6, 31, 31, 685, 685, 685, 230, /* 40 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, /* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 283, - /* 60 */ 283, 78, 78, 78, 78, 78, 78, 78, 244, 244, - /* 70 */ 244, 207, 244, 161, 161, 244, 244, 244, 254, 254, - /* 80 */ 26, 161, 244, 244, 244, 244, 244, 244, 244, 244, - /* 90 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - /* 100 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - /* 110 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - /* 120 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - /* 130 */ 244, 244, 244, 415, 415, 415, 365, 365, 365, 415, - /* 140 */ 365, 415, 369, 370, 371, 372, 375, 382, 384, 390, - /* 150 */ 404, 413, 415, 415, 415, 450, 9, 9, 415, 415, - /* 160 */ 470, 474, 511, 479, 478, 510, 483, 487, 450, 415, - /* 170 */ 491, 491, 415, 491, 415, 491, 415, 415, 685, 685, - /* 180 */ 27, 100, 127, 100, 100, 53, 182, 223, 223, 223, - /* 190 */ 223, 237, 249, 273, 318, 318, 318, 318, 77, 103, - /* 200 */ 92, 92, 269, 326, 256, 255, 306, 312, 282, 284, - /* 210 */ 291, 293, 294, 296, 299, 387, 309, 335, 158, 297, - /* 220 */ 302, 305, 307, 310, 313, 316, 289, 292, 295, 331, - /* 230 */ 300, 354, 435, 368, 566, 429, 572, 573, 434, 575, - /* 240 */ 576, 492, 494, 449, 472, 482, 502, 493, 504, 501, - /* 250 */ 506, 508, 509, 507, 513, 612, 515, 516, 518, 514, - /* 260 */ 497, 517, 505, 519, 521, 520, 523, 482, 525, 526, - /* 270 */ 528, 522, 539, 625, 630, 631, 632, 633, 634, 560, - /* 280 */ 626, 567, 503, 535, 535, 629, 512, 524, 535, 641, - /* 290 */ 642, 543, 535, 644, 645, 647, 648, 649, 650, 651, - /* 300 */ 652, 653, 654, 655, 656, 657, 659, 660, 661, 662, - /* 310 */ 559, 589, 658, 663, 610, 613, 671, + /* 60 */ 283, 102, 102, 102, 102, 102, 102, 102, 148, 148, + /* 70 */ 148, 286, 148, 206, 206, 148, 148, 148, 263, 263, + /* 80 */ 280, 206, 148, 148, 148, 148, 148, 148, 148, 148, + /* 90 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 100 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 110 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 120 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + /* 130 */ 148, 148, 148, 148, 417, 417, 417, 367, 367, 367, + /* 140 */ 417, 367, 417, 368, 371, 375, 369, 378, 386, 390, + /* 150 */ 403, 419, 416, 417, 417, 417, 382, 6, 6, 417, + /* 160 */ 417, 466, 473, 510, 478, 477, 509, 480, 483, 382, + /* 170 */ 417, 487, 487, 417, 487, 417, 487, 417, 417, 685, + /* 180 */ 685, 27, 100, 127, 100, 100, 53, 182, 223, 223, + /* 190 */ 223, 223, 237, 250, 273, 318, 318, 318, 318, 256, + /* 200 */ 215, 92, 92, 269, 357, 130, 21, 179, 309, 294, + /* 210 */ 253, 295, 297, 300, 302, 303, 252, 330, 346, 260, + /* 220 */ 301, 308, 310, 311, 313, 316, 319, 289, 293, 298, + /* 230 */ 331, 305, 434, 435, 370, 562, 424, 567, 568, 428, + /* 240 */ 570, 574, 491, 493, 448, 471, 481, 485, 495, 482, + /* 250 */ 476, 486, 507, 511, 506, 513, 618, 516, 517, 519, + /* 260 */ 512, 501, 518, 502, 521, 524, 520, 525, 481, 526, + /* 270 */ 527, 528, 529, 557, 626, 631, 633, 634, 635, 636, + /* 280 */ 563, 627, 569, 504, 537, 537, 632, 514, 515, 642, + /* 290 */ 522, 530, 537, 644, 645, 546, 537, 647, 648, 651, + /* 300 */ 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, + /* 310 */ 664, 665, 666, 667, 564, 594, 656, 663, 615, 617, + /* 320 */ 678, }; -#define YY_REDUCE_COUNT (179) -#define YY_REDUCE_MIN (-233) -#define YY_REDUCE_MAX (414) +#define YY_REDUCE_COUNT (180) +#define YY_REDUCE_MIN (-240) +#define YY_REDUCE_MAX (418) static const short yy_reduce_ofst[] = { /* 0 */ -178, -27, -27, 74, 74, 99, -230, -216, -173, -176, - /* 10 */ -45, -76, -8, 34, 114, 133, 135, -185, -188, -233, - /* 20 */ -206, -147, -74, 23, -179, -127, -186, 123, -191, -112, - /* 30 */ 157, 49, 4, 156, 162, 184, 140, 141, -187, -217, - /* 40 */ -194, -144, -51, -18, 165, 169, 173, 177, 189, 195, - /* 50 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 222, - /* 60 */ 224, 166, 205, 209, 232, 234, 235, 236, 218, 266, - /* 70 */ 274, 213, 275, 233, 238, 277, 278, 279, 212, 214, - /* 80 */ 239, 240, 285, 287, 288, 290, 298, 301, 304, 308, - /* 90 */ 311, 314, 315, 317, 319, 320, 321, 322, 323, 324, - /* 100 */ 325, 327, 328, 329, 330, 332, 333, 334, 336, 337, - /* 110 */ 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, - /* 120 */ 348, 349, 350, 351, 352, 353, 355, 356, 357, 358, - /* 130 */ 359, 360, 361, 362, 363, 364, 225, 228, 229, 366, - /* 140 */ 231, 367, 242, 241, 245, 248, 243, 253, 265, 276, - /* 150 */ 286, 246, 373, 374, 376, 377, 378, 379, 380, 381, - /* 160 */ 383, 385, 388, 386, 391, 392, 389, 396, 393, 394, - /* 170 */ 397, 405, 395, 406, 408, 410, 409, 412, 407, 414, + /* 10 */ -45, -76, -8, 34, 114, 135, 142, -185, -188, -233, + /* 20 */ -206, 23, 37, 129, -191, 18, -186, -183, 149, -89, + /* 30 */ -184, 157, 4, 156, 183, 184, 131, 19, 181, -240, + /* 40 */ -217, -194, -134, -107, 13, 32, 51, 126, 143, 162, + /* 50 */ 172, 176, 192, 196, 197, 198, 199, 200, 201, -73, + /* 60 */ 218, 205, 228, 229, 231, 232, 233, 234, 271, 272, + /* 70 */ 274, 213, 275, 235, 236, 276, 277, 281, 212, 214, + /* 80 */ 238, 241, 287, 288, 290, 291, 292, 296, 299, 304, + /* 90 */ 306, 307, 312, 314, 315, 317, 320, 321, 322, 323, + /* 100 */ 324, 325, 326, 327, 328, 329, 332, 333, 334, 335, + /* 110 */ 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + /* 120 */ 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + /* 130 */ 358, 359, 360, 361, 362, 363, 364, 225, 239, 244, + /* 140 */ 365, 245, 366, 240, 242, 246, 248, 265, 243, 279, + /* 150 */ 372, 374, 373, 376, 377, 379, 380, 381, 383, 384, + /* 160 */ 385, 387, 389, 388, 391, 392, 395, 396, 398, 393, + /* 170 */ 394, 397, 399, 409, 410, 412, 413, 415, 418, 404, + /* 180 */ 414, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 781, 894, 840, 906, 828, 837, 1037, 1037, 781, 781, - /* 10 */ 781, 781, 781, 781, 781, 781, 781, 953, 800, 1037, - /* 20 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 837, - /* 30 */ 781, 781, 843, 837, 843, 843, 948, 878, 896, 781, - /* 40 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 50 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 60 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 70 */ 781, 955, 958, 781, 781, 960, 781, 781, 980, 980, - /* 80 */ 946, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 90 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 100 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 826, - /* 110 */ 781, 824, 781, 781, 781, 781, 781, 781, 781, 781, - /* 120 */ 781, 781, 781, 781, 781, 781, 811, 781, 781, 781, - /* 130 */ 781, 781, 781, 802, 802, 802, 781, 781, 781, 802, - /* 140 */ 781, 802, 987, 991, 985, 973, 981, 972, 968, 966, - /* 150 */ 965, 995, 802, 802, 802, 841, 837, 837, 802, 802, - /* 160 */ 859, 857, 855, 847, 853, 849, 851, 845, 829, 802, - /* 170 */ 835, 835, 802, 835, 802, 835, 802, 802, 878, 896, - /* 180 */ 781, 996, 781, 1036, 986, 1026, 1025, 1032, 1024, 1023, - /* 190 */ 1022, 781, 781, 781, 1018, 1019, 1021, 1020, 781, 781, - /* 200 */ 1028, 1027, 781, 781, 781, 781, 781, 781, 781, 781, - /* 210 */ 781, 781, 781, 781, 781, 781, 998, 781, 992, 988, - /* 220 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 908, - /* 230 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 240 */ 781, 781, 781, 781, 945, 781, 781, 781, 781, 956, - /* 250 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 982, - /* 260 */ 781, 974, 781, 781, 781, 781, 781, 920, 781, 781, - /* 270 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 280 */ 781, 781, 781, 1048, 1046, 781, 781, 781, 1042, 781, - /* 290 */ 781, 781, 1040, 781, 781, 781, 781, 781, 781, 781, - /* 300 */ 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, - /* 310 */ 862, 781, 809, 807, 781, 798, 781, + /* 0 */ 787, 900, 846, 912, 834, 843, 1043, 1043, 787, 787, + /* 10 */ 787, 787, 787, 787, 787, 787, 787, 959, 806, 1043, + /* 20 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 843, + /* 30 */ 787, 787, 849, 843, 849, 849, 954, 884, 902, 787, + /* 40 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 50 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 60 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 70 */ 787, 961, 964, 787, 787, 966, 787, 787, 986, 986, + /* 80 */ 952, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 90 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 100 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 110 */ 832, 787, 830, 787, 787, 787, 787, 787, 787, 787, + /* 120 */ 787, 787, 787, 787, 787, 787, 787, 817, 787, 787, + /* 130 */ 787, 787, 787, 787, 808, 808, 808, 787, 787, 787, + /* 140 */ 808, 787, 808, 993, 997, 991, 979, 987, 978, 974, + /* 150 */ 972, 971, 1001, 808, 808, 808, 847, 843, 843, 808, + /* 160 */ 808, 865, 863, 861, 853, 859, 855, 857, 851, 835, + /* 170 */ 808, 841, 841, 808, 841, 808, 841, 808, 808, 884, + /* 180 */ 902, 787, 1002, 787, 1042, 992, 1032, 1031, 1038, 1030, + /* 190 */ 1029, 1028, 787, 787, 787, 1024, 1025, 1027, 1026, 787, + /* 200 */ 787, 1034, 1033, 787, 787, 787, 787, 787, 787, 787, + /* 210 */ 787, 787, 787, 787, 787, 787, 787, 1004, 787, 998, + /* 220 */ 994, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 230 */ 914, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 240 */ 787, 787, 787, 787, 787, 951, 787, 787, 787, 787, + /* 250 */ 962, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 260 */ 988, 787, 980, 787, 787, 787, 787, 787, 926, 787, + /* 270 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 280 */ 787, 787, 787, 787, 1055, 1053, 787, 787, 787, 787, + /* 290 */ 787, 787, 1049, 787, 787, 787, 1046, 787, 787, 787, + /* 300 */ 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, + /* 310 */ 787, 787, 787, 787, 868, 787, 815, 813, 787, 804, + /* 320 */ 787, }; /********** End of lemon-generated parsing tables *****************************/ @@ -616,6 +630,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SYNCDB => nothing */ 0, /* ADD => nothing */ 0, /* COLUMN => nothing */ + 0, /* LENGTH => nothing */ 0, /* TAG => nothing */ 0, /* CHANGE => nothing */ 0, /* SET => nothing */ @@ -703,6 +718,7 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -889,55 +905,55 @@ static const char *const yyTokenName[] = { /* 136 */ "SYNCDB", /* 137 */ "ADD", /* 138 */ "COLUMN", - /* 139 */ "TAG", - /* 140 */ "CHANGE", - /* 141 */ "SET", - /* 142 */ "KILL", - /* 143 */ "CONNECTION", - /* 144 */ "STREAM", - /* 145 */ "COLON", - /* 146 */ "ABORT", - /* 147 */ "AFTER", - /* 148 */ "ATTACH", - /* 149 */ "BEFORE", - /* 150 */ "BEGIN", - /* 151 */ "CASCADE", - /* 152 */ "CLUSTER", - /* 153 */ "CONFLICT", - /* 154 */ "COPY", - /* 155 */ "DEFERRED", - /* 156 */ "DELIMITERS", - /* 157 */ "DETACH", - /* 158 */ "EACH", - /* 159 */ "END", - /* 160 */ "EXPLAIN", - /* 161 */ "FAIL", - /* 162 */ "FOR", - /* 163 */ "IGNORE", - /* 164 */ "IMMEDIATE", - /* 165 */ "INITIALLY", - /* 166 */ "INSTEAD", - /* 167 */ "MATCH", - /* 168 */ "KEY", - /* 169 */ "OF", - /* 170 */ "RAISE", - /* 171 */ "REPLACE", - /* 172 */ "RESTRICT", - /* 173 */ "ROW", - /* 174 */ "STATEMENT", - /* 175 */ "TRIGGER", - /* 176 */ "VIEW", - /* 177 */ "SEMI", - /* 178 */ "NONE", - /* 179 */ "PREV", - /* 180 */ "LINEAR", - /* 181 */ "IMPORT", - /* 182 */ "TBNAME", - /* 183 */ "JOIN", - /* 184 */ "INSERT", - /* 185 */ "INTO", - /* 186 */ "VALUES", - /* 187 */ "error", + /* 139 */ "LENGTH", + /* 140 */ "TAG", + /* 141 */ "CHANGE", + /* 142 */ "SET", + /* 143 */ "KILL", + /* 144 */ "CONNECTION", + /* 145 */ "STREAM", + /* 146 */ "COLON", + /* 147 */ "ABORT", + /* 148 */ "AFTER", + /* 149 */ "ATTACH", + /* 150 */ "BEFORE", + /* 151 */ "BEGIN", + /* 152 */ "CASCADE", + /* 153 */ "CLUSTER", + /* 154 */ "CONFLICT", + /* 155 */ "COPY", + /* 156 */ "DEFERRED", + /* 157 */ "DELIMITERS", + /* 158 */ "DETACH", + /* 159 */ "EACH", + /* 160 */ "END", + /* 161 */ "EXPLAIN", + /* 162 */ "FAIL", + /* 163 */ "FOR", + /* 164 */ "IGNORE", + /* 165 */ "IMMEDIATE", + /* 166 */ "INITIALLY", + /* 167 */ "INSTEAD", + /* 168 */ "MATCH", + /* 169 */ "KEY", + /* 170 */ "OF", + /* 171 */ "RAISE", + /* 172 */ "REPLACE", + /* 173 */ "RESTRICT", + /* 174 */ "ROW", + /* 175 */ "STATEMENT", + /* 176 */ "TRIGGER", + /* 177 */ "VIEW", + /* 178 */ "SEMI", + /* 179 */ "NONE", + /* 180 */ "PREV", + /* 181 */ "LINEAR", + /* 182 */ "IMPORT", + /* 183 */ "TBNAME", + /* 184 */ "JOIN", + /* 185 */ "INSERT", + /* 186 */ "INTO", + /* 187 */ "VALUES", /* 188 */ "program", /* 189 */ "cmd", /* 190 */ "dbPrefix", @@ -1278,18 +1294,19 @@ static const char *const yyRuleName[] = { /* 255 */ "cmd ::= SYNCDB ids REPLICA", /* 256 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", /* 257 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 258 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 259 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 260 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 261 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 262 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 263 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 264 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 265 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 266 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 267 */ "cmd ::= KILL CONNECTION INTEGER", - /* 268 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 269 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 258 */ "cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER", + /* 259 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 260 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 261 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 262 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 263 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 264 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 265 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 266 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 267 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 268 */ "cmd ::= KILL CONNECTION INTEGER", + /* 269 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 270 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1338,28 +1355,29 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + yypParser->yyerrcnt = -1; #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1376,11 +1394,14 @@ void ParseInit(void *yypParser){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1397,7 +1418,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1573,13 +1595,12 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ +static YYACTIONTYPE yy_find_shift_action( + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; - int stateno = pParser->yytos->stateno; - + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1587,15 +1608,19 @@ static unsigned int yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", @@ -1610,15 +1635,8 @@ static unsigned int yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1632,6 +1650,7 @@ static unsigned int yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ + assert( i>=0 && iyytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; + yytos->stateno = yyNewState; + yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ -} yyRuleInfo[] = { - { 188, -1 }, /* (0) program ::= cmd */ - { 189, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 189, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 189, -2 }, /* (3) cmd ::= SHOW MNODES */ - { 189, -2 }, /* (4) cmd ::= SHOW DNODES */ - { 189, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */ - { 189, -2 }, /* (6) cmd ::= SHOW USERS */ - { 189, -2 }, /* (7) cmd ::= SHOW MODULES */ - { 189, -2 }, /* (8) cmd ::= SHOW QUERIES */ - { 189, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */ - { 189, -2 }, /* (10) cmd ::= SHOW STREAMS */ - { 189, -2 }, /* (11) cmd ::= SHOW VARIABLES */ - { 189, -2 }, /* (12) cmd ::= SHOW SCORES */ - { 189, -2 }, /* (13) cmd ::= SHOW GRANTS */ - { 189, -2 }, /* (14) cmd ::= SHOW VNODES */ - { 189, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */ - { 190, 0 }, /* (16) dbPrefix ::= */ - { 190, -2 }, /* (17) dbPrefix ::= ids DOT */ - { 192, 0 }, /* (18) cpxName ::= */ - { 192, -2 }, /* (19) cpxName ::= DOT ids */ - { 189, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 189, -5 }, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ - { 189, -4 }, /* (22) cmd ::= SHOW CREATE DATABASE ids */ - { 189, -3 }, /* (23) cmd ::= SHOW dbPrefix TABLES */ - { 189, -5 }, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 189, -3 }, /* (25) cmd ::= SHOW dbPrefix STABLES */ - { 189, -5 }, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 189, -3 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ - { 189, -4 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 189, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ - { 189, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ - { 189, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */ - { 189, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */ - { 189, -3 }, /* (33) cmd ::= DROP DNODE ids */ - { 189, -3 }, /* (34) cmd ::= DROP USER ids */ - { 189, -3 }, /* (35) cmd ::= DROP ACCOUNT ids */ - { 189, -2 }, /* (36) cmd ::= USE ids */ - { 189, -3 }, /* (37) cmd ::= DESCRIBE ids cpxName */ - { 189, -5 }, /* (38) cmd ::= ALTER USER ids PASS ids */ - { 189, -5 }, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 189, -4 }, /* (40) cmd ::= ALTER DNODE ids ids */ - { 189, -5 }, /* (41) cmd ::= ALTER DNODE ids ids ids */ - { 189, -3 }, /* (42) cmd ::= ALTER LOCAL ids */ - { 189, -4 }, /* (43) cmd ::= ALTER LOCAL ids ids */ - { 189, -4 }, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 189, -4 }, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 189, -4 }, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 189, -6 }, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 191, -1 }, /* (48) ids ::= ID */ - { 191, -1 }, /* (49) ids ::= STRING */ - { 193, -2 }, /* (50) ifexists ::= IF EXISTS */ - { 193, 0 }, /* (51) ifexists ::= */ - { 197, -3 }, /* (52) ifnotexists ::= IF NOT EXISTS */ - { 197, 0 }, /* (53) ifnotexists ::= */ - { 189, -3 }, /* (54) cmd ::= CREATE DNODE ids */ - { 189, -6 }, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 189, -5 }, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 189, -5 }, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 189, -5 }, /* (58) cmd ::= CREATE USER ids PASS ids */ - { 200, 0 }, /* (59) pps ::= */ - { 200, -2 }, /* (60) pps ::= PPS INTEGER */ - { 201, 0 }, /* (61) tseries ::= */ - { 201, -2 }, /* (62) tseries ::= TSERIES INTEGER */ - { 202, 0 }, /* (63) dbs ::= */ - { 202, -2 }, /* (64) dbs ::= DBS INTEGER */ - { 203, 0 }, /* (65) streams ::= */ - { 203, -2 }, /* (66) streams ::= STREAMS INTEGER */ - { 204, 0 }, /* (67) storage ::= */ - { 204, -2 }, /* (68) storage ::= STORAGE INTEGER */ - { 205, 0 }, /* (69) qtime ::= */ - { 205, -2 }, /* (70) qtime ::= QTIME INTEGER */ - { 206, 0 }, /* (71) users ::= */ - { 206, -2 }, /* (72) users ::= USERS INTEGER */ - { 207, 0 }, /* (73) conns ::= */ - { 207, -2 }, /* (74) conns ::= CONNS INTEGER */ - { 208, 0 }, /* (75) state ::= */ - { 208, -2 }, /* (76) state ::= STATE ids */ - { 196, -9 }, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 209, -2 }, /* (78) keep ::= KEEP tagitemlist */ - { 211, -2 }, /* (79) cache ::= CACHE INTEGER */ - { 212, -2 }, /* (80) replica ::= REPLICA INTEGER */ - { 213, -2 }, /* (81) quorum ::= QUORUM INTEGER */ - { 214, -2 }, /* (82) days ::= DAYS INTEGER */ - { 215, -2 }, /* (83) minrows ::= MINROWS INTEGER */ - { 216, -2 }, /* (84) maxrows ::= MAXROWS INTEGER */ - { 217, -2 }, /* (85) blocks ::= BLOCKS INTEGER */ - { 218, -2 }, /* (86) ctime ::= CTIME INTEGER */ - { 219, -2 }, /* (87) wal ::= WAL INTEGER */ - { 220, -2 }, /* (88) fsync ::= FSYNC INTEGER */ - { 221, -2 }, /* (89) comp ::= COMP INTEGER */ - { 222, -2 }, /* (90) prec ::= PRECISION STRING */ - { 223, -2 }, /* (91) update ::= UPDATE INTEGER */ - { 224, -2 }, /* (92) cachelast ::= CACHELAST INTEGER */ - { 225, -2 }, /* (93) partitions ::= PARTITIONS INTEGER */ - { 198, 0 }, /* (94) db_optr ::= */ - { 198, -2 }, /* (95) db_optr ::= db_optr cache */ - { 198, -2 }, /* (96) db_optr ::= db_optr replica */ - { 198, -2 }, /* (97) db_optr ::= db_optr quorum */ - { 198, -2 }, /* (98) db_optr ::= db_optr days */ - { 198, -2 }, /* (99) db_optr ::= db_optr minrows */ - { 198, -2 }, /* (100) db_optr ::= db_optr maxrows */ - { 198, -2 }, /* (101) db_optr ::= db_optr blocks */ - { 198, -2 }, /* (102) db_optr ::= db_optr ctime */ - { 198, -2 }, /* (103) db_optr ::= db_optr wal */ - { 198, -2 }, /* (104) db_optr ::= db_optr fsync */ - { 198, -2 }, /* (105) db_optr ::= db_optr comp */ - { 198, -2 }, /* (106) db_optr ::= db_optr prec */ - { 198, -2 }, /* (107) db_optr ::= db_optr keep */ - { 198, -2 }, /* (108) db_optr ::= db_optr update */ - { 198, -2 }, /* (109) db_optr ::= db_optr cachelast */ - { 199, -1 }, /* (110) topic_optr ::= db_optr */ - { 199, -2 }, /* (111) topic_optr ::= topic_optr partitions */ - { 194, 0 }, /* (112) alter_db_optr ::= */ - { 194, -2 }, /* (113) alter_db_optr ::= alter_db_optr replica */ - { 194, -2 }, /* (114) alter_db_optr ::= alter_db_optr quorum */ - { 194, -2 }, /* (115) alter_db_optr ::= alter_db_optr keep */ - { 194, -2 }, /* (116) alter_db_optr ::= alter_db_optr blocks */ - { 194, -2 }, /* (117) alter_db_optr ::= alter_db_optr comp */ - { 194, -2 }, /* (118) alter_db_optr ::= alter_db_optr wal */ - { 194, -2 }, /* (119) alter_db_optr ::= alter_db_optr fsync */ - { 194, -2 }, /* (120) alter_db_optr ::= alter_db_optr update */ - { 194, -2 }, /* (121) alter_db_optr ::= alter_db_optr cachelast */ - { 195, -1 }, /* (122) alter_topic_optr ::= alter_db_optr */ - { 195, -2 }, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ - { 226, -1 }, /* (124) typename ::= ids */ - { 226, -4 }, /* (125) typename ::= ids LP signed RP */ - { 226, -2 }, /* (126) typename ::= ids UNSIGNED */ - { 227, -1 }, /* (127) signed ::= INTEGER */ - { 227, -2 }, /* (128) signed ::= PLUS INTEGER */ - { 227, -2 }, /* (129) signed ::= MINUS INTEGER */ - { 189, -3 }, /* (130) cmd ::= CREATE TABLE create_table_args */ - { 189, -3 }, /* (131) cmd ::= CREATE TABLE create_stable_args */ - { 189, -3 }, /* (132) cmd ::= CREATE STABLE create_stable_args */ - { 189, -3 }, /* (133) cmd ::= CREATE TABLE create_table_list */ - { 230, -1 }, /* (134) create_table_list ::= create_from_stable */ - { 230, -2 }, /* (135) create_table_list ::= create_table_list create_from_stable */ - { 228, -6 }, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 229, -10 }, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 231, -10 }, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 231, -13 }, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 233, -3 }, /* (140) tagNamelist ::= tagNamelist COMMA ids */ - { 233, -1 }, /* (141) tagNamelist ::= ids */ - { 228, -5 }, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ - { 232, -3 }, /* (143) columnlist ::= columnlist COMMA column */ - { 232, -1 }, /* (144) columnlist ::= column */ - { 235, -2 }, /* (145) column ::= ids typename */ - { 210, -3 }, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ - { 210, -1 }, /* (147) tagitemlist ::= tagitem */ - { 236, -1 }, /* (148) tagitem ::= INTEGER */ - { 236, -1 }, /* (149) tagitem ::= FLOAT */ - { 236, -1 }, /* (150) tagitem ::= STRING */ - { 236, -1 }, /* (151) tagitem ::= BOOL */ - { 236, -1 }, /* (152) tagitem ::= NULL */ - { 236, -2 }, /* (153) tagitem ::= MINUS INTEGER */ - { 236, -2 }, /* (154) tagitem ::= MINUS FLOAT */ - { 236, -2 }, /* (155) tagitem ::= PLUS INTEGER */ - { 236, -2 }, /* (156) tagitem ::= PLUS FLOAT */ - { 234, -13 }, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 234, -3 }, /* (158) select ::= LP select RP */ - { 249, -1 }, /* (159) union ::= select */ - { 249, -4 }, /* (160) union ::= union UNION ALL select */ - { 189, -1 }, /* (161) cmd ::= union */ - { 234, -2 }, /* (162) select ::= SELECT selcollist */ - { 250, -2 }, /* (163) sclp ::= selcollist COMMA */ - { 250, 0 }, /* (164) sclp ::= */ - { 237, -4 }, /* (165) selcollist ::= sclp distinct expr as */ - { 237, -2 }, /* (166) selcollist ::= sclp STAR */ - { 253, -2 }, /* (167) as ::= AS ids */ - { 253, -1 }, /* (168) as ::= ids */ - { 253, 0 }, /* (169) as ::= */ - { 251, -1 }, /* (170) distinct ::= DISTINCT */ - { 251, 0 }, /* (171) distinct ::= */ - { 238, -2 }, /* (172) from ::= FROM tablelist */ - { 238, -4 }, /* (173) from ::= FROM LP union RP */ - { 254, -2 }, /* (174) tablelist ::= ids cpxName */ - { 254, -3 }, /* (175) tablelist ::= ids cpxName ids */ - { 254, -4 }, /* (176) tablelist ::= tablelist COMMA ids cpxName */ - { 254, -5 }, /* (177) tablelist ::= tablelist COMMA ids cpxName ids */ - { 255, -1 }, /* (178) tmvar ::= VARIABLE */ - { 240, -4 }, /* (179) interval_opt ::= INTERVAL LP tmvar RP */ - { 240, -6 }, /* (180) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 240, 0 }, /* (181) interval_opt ::= */ - { 241, 0 }, /* (182) session_option ::= */ - { 241, -7 }, /* (183) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 242, 0 }, /* (184) fill_opt ::= */ - { 242, -6 }, /* (185) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 242, -4 }, /* (186) fill_opt ::= FILL LP ID RP */ - { 243, -4 }, /* (187) sliding_opt ::= SLIDING LP tmvar RP */ - { 243, 0 }, /* (188) sliding_opt ::= */ - { 245, 0 }, /* (189) orderby_opt ::= */ - { 245, -3 }, /* (190) orderby_opt ::= ORDER BY sortlist */ - { 256, -4 }, /* (191) sortlist ::= sortlist COMMA item sortorder */ - { 256, -2 }, /* (192) sortlist ::= item sortorder */ - { 258, -2 }, /* (193) item ::= ids cpxName */ - { 259, -1 }, /* (194) sortorder ::= ASC */ - { 259, -1 }, /* (195) sortorder ::= DESC */ - { 259, 0 }, /* (196) sortorder ::= */ - { 244, 0 }, /* (197) groupby_opt ::= */ - { 244, -3 }, /* (198) groupby_opt ::= GROUP BY grouplist */ - { 260, -3 }, /* (199) grouplist ::= grouplist COMMA item */ - { 260, -1 }, /* (200) grouplist ::= item */ - { 246, 0 }, /* (201) having_opt ::= */ - { 246, -2 }, /* (202) having_opt ::= HAVING expr */ - { 248, 0 }, /* (203) limit_opt ::= */ - { 248, -2 }, /* (204) limit_opt ::= LIMIT signed */ - { 248, -4 }, /* (205) limit_opt ::= LIMIT signed OFFSET signed */ - { 248, -4 }, /* (206) limit_opt ::= LIMIT signed COMMA signed */ - { 247, 0 }, /* (207) slimit_opt ::= */ - { 247, -2 }, /* (208) slimit_opt ::= SLIMIT signed */ - { 247, -4 }, /* (209) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 247, -4 }, /* (210) slimit_opt ::= SLIMIT signed COMMA signed */ - { 239, 0 }, /* (211) where_opt ::= */ - { 239, -2 }, /* (212) where_opt ::= WHERE expr */ - { 252, -3 }, /* (213) expr ::= LP expr RP */ - { 252, -1 }, /* (214) expr ::= ID */ - { 252, -3 }, /* (215) expr ::= ID DOT ID */ - { 252, -3 }, /* (216) expr ::= ID DOT STAR */ - { 252, -1 }, /* (217) expr ::= INTEGER */ - { 252, -2 }, /* (218) expr ::= MINUS INTEGER */ - { 252, -2 }, /* (219) expr ::= PLUS INTEGER */ - { 252, -1 }, /* (220) expr ::= FLOAT */ - { 252, -2 }, /* (221) expr ::= MINUS FLOAT */ - { 252, -2 }, /* (222) expr ::= PLUS FLOAT */ - { 252, -1 }, /* (223) expr ::= STRING */ - { 252, -1 }, /* (224) expr ::= NOW */ - { 252, -1 }, /* (225) expr ::= VARIABLE */ - { 252, -2 }, /* (226) expr ::= PLUS VARIABLE */ - { 252, -2 }, /* (227) expr ::= MINUS VARIABLE */ - { 252, -1 }, /* (228) expr ::= BOOL */ - { 252, -1 }, /* (229) expr ::= NULL */ - { 252, -4 }, /* (230) expr ::= ID LP exprlist RP */ - { 252, -4 }, /* (231) expr ::= ID LP STAR RP */ - { 252, -3 }, /* (232) expr ::= expr IS NULL */ - { 252, -4 }, /* (233) expr ::= expr IS NOT NULL */ - { 252, -3 }, /* (234) expr ::= expr LT expr */ - { 252, -3 }, /* (235) expr ::= expr GT expr */ - { 252, -3 }, /* (236) expr ::= expr LE expr */ - { 252, -3 }, /* (237) expr ::= expr GE expr */ - { 252, -3 }, /* (238) expr ::= expr NE expr */ - { 252, -3 }, /* (239) expr ::= expr EQ expr */ - { 252, -5 }, /* (240) expr ::= expr BETWEEN expr AND expr */ - { 252, -3 }, /* (241) expr ::= expr AND expr */ - { 252, -3 }, /* (242) expr ::= expr OR expr */ - { 252, -3 }, /* (243) expr ::= expr PLUS expr */ - { 252, -3 }, /* (244) expr ::= expr MINUS expr */ - { 252, -3 }, /* (245) expr ::= expr STAR expr */ - { 252, -3 }, /* (246) expr ::= expr SLASH expr */ - { 252, -3 }, /* (247) expr ::= expr REM expr */ - { 252, -3 }, /* (248) expr ::= expr LIKE expr */ - { 252, -5 }, /* (249) expr ::= expr IN LP exprlist RP */ - { 261, -3 }, /* (250) exprlist ::= exprlist COMMA expritem */ - { 261, -1 }, /* (251) exprlist ::= expritem */ - { 262, -1 }, /* (252) expritem ::= expr */ - { 262, 0 }, /* (253) expritem ::= */ - { 189, -3 }, /* (254) cmd ::= RESET QUERY CACHE */ - { 189, -3 }, /* (255) cmd ::= SYNCDB ids REPLICA */ - { 189, -7 }, /* (256) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (257) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (258) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (259) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (260) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 189, -9 }, /* (261) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 189, -7 }, /* (262) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 189, -7 }, /* (263) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 189, -7 }, /* (264) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 189, -7 }, /* (265) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 189, -8 }, /* (266) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 189, -3 }, /* (267) cmd ::= KILL CONNECTION INTEGER */ - { 189, -5 }, /* (268) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 189, -5 }, /* (269) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { + 188, /* (0) program ::= cmd */ + 189, /* (1) cmd ::= SHOW DATABASES */ + 189, /* (2) cmd ::= SHOW TOPICS */ + 189, /* (3) cmd ::= SHOW MNODES */ + 189, /* (4) cmd ::= SHOW DNODES */ + 189, /* (5) cmd ::= SHOW ACCOUNTS */ + 189, /* (6) cmd ::= SHOW USERS */ + 189, /* (7) cmd ::= SHOW MODULES */ + 189, /* (8) cmd ::= SHOW QUERIES */ + 189, /* (9) cmd ::= SHOW CONNECTIONS */ + 189, /* (10) cmd ::= SHOW STREAMS */ + 189, /* (11) cmd ::= SHOW VARIABLES */ + 189, /* (12) cmd ::= SHOW SCORES */ + 189, /* (13) cmd ::= SHOW GRANTS */ + 189, /* (14) cmd ::= SHOW VNODES */ + 189, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 190, /* (16) dbPrefix ::= */ + 190, /* (17) dbPrefix ::= ids DOT */ + 192, /* (18) cpxName ::= */ + 192, /* (19) cpxName ::= DOT ids */ + 189, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + 189, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ + 189, /* (22) cmd ::= SHOW CREATE DATABASE ids */ + 189, /* (23) cmd ::= SHOW dbPrefix TABLES */ + 189, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 189, /* (25) cmd ::= SHOW dbPrefix STABLES */ + 189, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 189, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ + 189, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ + 189, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + 189, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + 189, /* (31) cmd ::= DROP DATABASE ifexists ids */ + 189, /* (32) cmd ::= DROP TOPIC ifexists ids */ + 189, /* (33) cmd ::= DROP DNODE ids */ + 189, /* (34) cmd ::= DROP USER ids */ + 189, /* (35) cmd ::= DROP ACCOUNT ids */ + 189, /* (36) cmd ::= USE ids */ + 189, /* (37) cmd ::= DESCRIBE ids cpxName */ + 189, /* (38) cmd ::= ALTER USER ids PASS ids */ + 189, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ + 189, /* (40) cmd ::= ALTER DNODE ids ids */ + 189, /* (41) cmd ::= ALTER DNODE ids ids ids */ + 189, /* (42) cmd ::= ALTER LOCAL ids */ + 189, /* (43) cmd ::= ALTER LOCAL ids ids */ + 189, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ + 189, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 189, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ + 189, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 191, /* (48) ids ::= ID */ + 191, /* (49) ids ::= STRING */ + 193, /* (50) ifexists ::= IF EXISTS */ + 193, /* (51) ifexists ::= */ + 197, /* (52) ifnotexists ::= IF NOT EXISTS */ + 197, /* (53) ifnotexists ::= */ + 189, /* (54) cmd ::= CREATE DNODE ids */ + 189, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 189, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 189, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 189, /* (58) cmd ::= CREATE USER ids PASS ids */ + 200, /* (59) pps ::= */ + 200, /* (60) pps ::= PPS INTEGER */ + 201, /* (61) tseries ::= */ + 201, /* (62) tseries ::= TSERIES INTEGER */ + 202, /* (63) dbs ::= */ + 202, /* (64) dbs ::= DBS INTEGER */ + 203, /* (65) streams ::= */ + 203, /* (66) streams ::= STREAMS INTEGER */ + 204, /* (67) storage ::= */ + 204, /* (68) storage ::= STORAGE INTEGER */ + 205, /* (69) qtime ::= */ + 205, /* (70) qtime ::= QTIME INTEGER */ + 206, /* (71) users ::= */ + 206, /* (72) users ::= USERS INTEGER */ + 207, /* (73) conns ::= */ + 207, /* (74) conns ::= CONNS INTEGER */ + 208, /* (75) state ::= */ + 208, /* (76) state ::= STATE ids */ + 196, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 209, /* (78) keep ::= KEEP tagitemlist */ + 211, /* (79) cache ::= CACHE INTEGER */ + 212, /* (80) replica ::= REPLICA INTEGER */ + 213, /* (81) quorum ::= QUORUM INTEGER */ + 214, /* (82) days ::= DAYS INTEGER */ + 215, /* (83) minrows ::= MINROWS INTEGER */ + 216, /* (84) maxrows ::= MAXROWS INTEGER */ + 217, /* (85) blocks ::= BLOCKS INTEGER */ + 218, /* (86) ctime ::= CTIME INTEGER */ + 219, /* (87) wal ::= WAL INTEGER */ + 220, /* (88) fsync ::= FSYNC INTEGER */ + 221, /* (89) comp ::= COMP INTEGER */ + 222, /* (90) prec ::= PRECISION STRING */ + 223, /* (91) update ::= UPDATE INTEGER */ + 224, /* (92) cachelast ::= CACHELAST INTEGER */ + 225, /* (93) partitions ::= PARTITIONS INTEGER */ + 198, /* (94) db_optr ::= */ + 198, /* (95) db_optr ::= db_optr cache */ + 198, /* (96) db_optr ::= db_optr replica */ + 198, /* (97) db_optr ::= db_optr quorum */ + 198, /* (98) db_optr ::= db_optr days */ + 198, /* (99) db_optr ::= db_optr minrows */ + 198, /* (100) db_optr ::= db_optr maxrows */ + 198, /* (101) db_optr ::= db_optr blocks */ + 198, /* (102) db_optr ::= db_optr ctime */ + 198, /* (103) db_optr ::= db_optr wal */ + 198, /* (104) db_optr ::= db_optr fsync */ + 198, /* (105) db_optr ::= db_optr comp */ + 198, /* (106) db_optr ::= db_optr prec */ + 198, /* (107) db_optr ::= db_optr keep */ + 198, /* (108) db_optr ::= db_optr update */ + 198, /* (109) db_optr ::= db_optr cachelast */ + 199, /* (110) topic_optr ::= db_optr */ + 199, /* (111) topic_optr ::= topic_optr partitions */ + 194, /* (112) alter_db_optr ::= */ + 194, /* (113) alter_db_optr ::= alter_db_optr replica */ + 194, /* (114) alter_db_optr ::= alter_db_optr quorum */ + 194, /* (115) alter_db_optr ::= alter_db_optr keep */ + 194, /* (116) alter_db_optr ::= alter_db_optr blocks */ + 194, /* (117) alter_db_optr ::= alter_db_optr comp */ + 194, /* (118) alter_db_optr ::= alter_db_optr wal */ + 194, /* (119) alter_db_optr ::= alter_db_optr fsync */ + 194, /* (120) alter_db_optr ::= alter_db_optr update */ + 194, /* (121) alter_db_optr ::= alter_db_optr cachelast */ + 195, /* (122) alter_topic_optr ::= alter_db_optr */ + 195, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ + 226, /* (124) typename ::= ids */ + 226, /* (125) typename ::= ids LP signed RP */ + 226, /* (126) typename ::= ids UNSIGNED */ + 227, /* (127) signed ::= INTEGER */ + 227, /* (128) signed ::= PLUS INTEGER */ + 227, /* (129) signed ::= MINUS INTEGER */ + 189, /* (130) cmd ::= CREATE TABLE create_table_args */ + 189, /* (131) cmd ::= CREATE TABLE create_stable_args */ + 189, /* (132) cmd ::= CREATE STABLE create_stable_args */ + 189, /* (133) cmd ::= CREATE TABLE create_table_list */ + 230, /* (134) create_table_list ::= create_from_stable */ + 230, /* (135) create_table_list ::= create_table_list create_from_stable */ + 228, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 229, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 231, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 231, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 233, /* (140) tagNamelist ::= tagNamelist COMMA ids */ + 233, /* (141) tagNamelist ::= ids */ + 228, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ + 232, /* (143) columnlist ::= columnlist COMMA column */ + 232, /* (144) columnlist ::= column */ + 235, /* (145) column ::= ids typename */ + 210, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ + 210, /* (147) tagitemlist ::= tagitem */ + 236, /* (148) tagitem ::= INTEGER */ + 236, /* (149) tagitem ::= FLOAT */ + 236, /* (150) tagitem ::= STRING */ + 236, /* (151) tagitem ::= BOOL */ + 236, /* (152) tagitem ::= NULL */ + 236, /* (153) tagitem ::= MINUS INTEGER */ + 236, /* (154) tagitem ::= MINUS FLOAT */ + 236, /* (155) tagitem ::= PLUS INTEGER */ + 236, /* (156) tagitem ::= PLUS FLOAT */ + 234, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + 234, /* (158) select ::= LP select RP */ + 249, /* (159) union ::= select */ + 249, /* (160) union ::= union UNION ALL select */ + 189, /* (161) cmd ::= union */ + 234, /* (162) select ::= SELECT selcollist */ + 250, /* (163) sclp ::= selcollist COMMA */ + 250, /* (164) sclp ::= */ + 237, /* (165) selcollist ::= sclp distinct expr as */ + 237, /* (166) selcollist ::= sclp STAR */ + 253, /* (167) as ::= AS ids */ + 253, /* (168) as ::= ids */ + 253, /* (169) as ::= */ + 251, /* (170) distinct ::= DISTINCT */ + 251, /* (171) distinct ::= */ + 238, /* (172) from ::= FROM tablelist */ + 238, /* (173) from ::= FROM LP union RP */ + 254, /* (174) tablelist ::= ids cpxName */ + 254, /* (175) tablelist ::= ids cpxName ids */ + 254, /* (176) tablelist ::= tablelist COMMA ids cpxName */ + 254, /* (177) tablelist ::= tablelist COMMA ids cpxName ids */ + 255, /* (178) tmvar ::= VARIABLE */ + 240, /* (179) interval_opt ::= INTERVAL LP tmvar RP */ + 240, /* (180) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 240, /* (181) interval_opt ::= */ + 241, /* (182) session_option ::= */ + 241, /* (183) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 242, /* (184) fill_opt ::= */ + 242, /* (185) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 242, /* (186) fill_opt ::= FILL LP ID RP */ + 243, /* (187) sliding_opt ::= SLIDING LP tmvar RP */ + 243, /* (188) sliding_opt ::= */ + 245, /* (189) orderby_opt ::= */ + 245, /* (190) orderby_opt ::= ORDER BY sortlist */ + 256, /* (191) sortlist ::= sortlist COMMA item sortorder */ + 256, /* (192) sortlist ::= item sortorder */ + 258, /* (193) item ::= ids cpxName */ + 259, /* (194) sortorder ::= ASC */ + 259, /* (195) sortorder ::= DESC */ + 259, /* (196) sortorder ::= */ + 244, /* (197) groupby_opt ::= */ + 244, /* (198) groupby_opt ::= GROUP BY grouplist */ + 260, /* (199) grouplist ::= grouplist COMMA item */ + 260, /* (200) grouplist ::= item */ + 246, /* (201) having_opt ::= */ + 246, /* (202) having_opt ::= HAVING expr */ + 248, /* (203) limit_opt ::= */ + 248, /* (204) limit_opt ::= LIMIT signed */ + 248, /* (205) limit_opt ::= LIMIT signed OFFSET signed */ + 248, /* (206) limit_opt ::= LIMIT signed COMMA signed */ + 247, /* (207) slimit_opt ::= */ + 247, /* (208) slimit_opt ::= SLIMIT signed */ + 247, /* (209) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 247, /* (210) slimit_opt ::= SLIMIT signed COMMA signed */ + 239, /* (211) where_opt ::= */ + 239, /* (212) where_opt ::= WHERE expr */ + 252, /* (213) expr ::= LP expr RP */ + 252, /* (214) expr ::= ID */ + 252, /* (215) expr ::= ID DOT ID */ + 252, /* (216) expr ::= ID DOT STAR */ + 252, /* (217) expr ::= INTEGER */ + 252, /* (218) expr ::= MINUS INTEGER */ + 252, /* (219) expr ::= PLUS INTEGER */ + 252, /* (220) expr ::= FLOAT */ + 252, /* (221) expr ::= MINUS FLOAT */ + 252, /* (222) expr ::= PLUS FLOAT */ + 252, /* (223) expr ::= STRING */ + 252, /* (224) expr ::= NOW */ + 252, /* (225) expr ::= VARIABLE */ + 252, /* (226) expr ::= PLUS VARIABLE */ + 252, /* (227) expr ::= MINUS VARIABLE */ + 252, /* (228) expr ::= BOOL */ + 252, /* (229) expr ::= NULL */ + 252, /* (230) expr ::= ID LP exprlist RP */ + 252, /* (231) expr ::= ID LP STAR RP */ + 252, /* (232) expr ::= expr IS NULL */ + 252, /* (233) expr ::= expr IS NOT NULL */ + 252, /* (234) expr ::= expr LT expr */ + 252, /* (235) expr ::= expr GT expr */ + 252, /* (236) expr ::= expr LE expr */ + 252, /* (237) expr ::= expr GE expr */ + 252, /* (238) expr ::= expr NE expr */ + 252, /* (239) expr ::= expr EQ expr */ + 252, /* (240) expr ::= expr BETWEEN expr AND expr */ + 252, /* (241) expr ::= expr AND expr */ + 252, /* (242) expr ::= expr OR expr */ + 252, /* (243) expr ::= expr PLUS expr */ + 252, /* (244) expr ::= expr MINUS expr */ + 252, /* (245) expr ::= expr STAR expr */ + 252, /* (246) expr ::= expr SLASH expr */ + 252, /* (247) expr ::= expr REM expr */ + 252, /* (248) expr ::= expr LIKE expr */ + 252, /* (249) expr ::= expr IN LP exprlist RP */ + 261, /* (250) exprlist ::= exprlist COMMA expritem */ + 261, /* (251) exprlist ::= expritem */ + 262, /* (252) expritem ::= expr */ + 262, /* (253) expritem ::= */ + 189, /* (254) cmd ::= RESET QUERY CACHE */ + 189, /* (255) cmd ::= SYNCDB ids REPLICA */ + 189, /* (256) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 189, /* (257) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 189, /* (258) cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + 189, /* (259) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 189, /* (260) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 189, /* (261) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 189, /* (262) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 189, /* (263) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 189, /* (264) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 189, /* (265) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 189, /* (266) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 189, /* (267) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 189, /* (268) cmd ::= KILL CONNECTION INTEGER */ + 189, /* (269) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 189, /* (270) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { + -1, /* (0) program ::= cmd */ + -2, /* (1) cmd ::= SHOW DATABASES */ + -2, /* (2) cmd ::= SHOW TOPICS */ + -2, /* (3) cmd ::= SHOW MNODES */ + -2, /* (4) cmd ::= SHOW DNODES */ + -2, /* (5) cmd ::= SHOW ACCOUNTS */ + -2, /* (6) cmd ::= SHOW USERS */ + -2, /* (7) cmd ::= SHOW MODULES */ + -2, /* (8) cmd ::= SHOW QUERIES */ + -2, /* (9) cmd ::= SHOW CONNECTIONS */ + -2, /* (10) cmd ::= SHOW STREAMS */ + -2, /* (11) cmd ::= SHOW VARIABLES */ + -2, /* (12) cmd ::= SHOW SCORES */ + -2, /* (13) cmd ::= SHOW GRANTS */ + -2, /* (14) cmd ::= SHOW VNODES */ + -3, /* (15) cmd ::= SHOW VNODES IPTOKEN */ + 0, /* (16) dbPrefix ::= */ + -2, /* (17) dbPrefix ::= ids DOT */ + 0, /* (18) cpxName ::= */ + -2, /* (19) cpxName ::= DOT ids */ + -5, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */ + -5, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */ + -4, /* (22) cmd ::= SHOW CREATE DATABASE ids */ + -3, /* (23) cmd ::= SHOW dbPrefix TABLES */ + -5, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + -3, /* (25) cmd ::= SHOW dbPrefix STABLES */ + -5, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + -3, /* (27) cmd ::= SHOW dbPrefix VGROUPS */ + -4, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */ + -5, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */ + -5, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */ + -4, /* (31) cmd ::= DROP DATABASE ifexists ids */ + -4, /* (32) cmd ::= DROP TOPIC ifexists ids */ + -3, /* (33) cmd ::= DROP DNODE ids */ + -3, /* (34) cmd ::= DROP USER ids */ + -3, /* (35) cmd ::= DROP ACCOUNT ids */ + -2, /* (36) cmd ::= USE ids */ + -3, /* (37) cmd ::= DESCRIBE ids cpxName */ + -5, /* (38) cmd ::= ALTER USER ids PASS ids */ + -5, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */ + -4, /* (40) cmd ::= ALTER DNODE ids ids */ + -5, /* (41) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (42) cmd ::= ALTER LOCAL ids */ + -4, /* (43) cmd ::= ALTER LOCAL ids ids */ + -4, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -1, /* (48) ids ::= ID */ + -1, /* (49) ids ::= STRING */ + -2, /* (50) ifexists ::= IF EXISTS */ + 0, /* (51) ifexists ::= */ + -3, /* (52) ifnotexists ::= IF NOT EXISTS */ + 0, /* (53) ifnotexists ::= */ + -3, /* (54) cmd ::= CREATE DNODE ids */ + -6, /* (55) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (56) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (57) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -5, /* (58) cmd ::= CREATE USER ids PASS ids */ + 0, /* (59) pps ::= */ + -2, /* (60) pps ::= PPS INTEGER */ + 0, /* (61) tseries ::= */ + -2, /* (62) tseries ::= TSERIES INTEGER */ + 0, /* (63) dbs ::= */ + -2, /* (64) dbs ::= DBS INTEGER */ + 0, /* (65) streams ::= */ + -2, /* (66) streams ::= STREAMS INTEGER */ + 0, /* (67) storage ::= */ + -2, /* (68) storage ::= STORAGE INTEGER */ + 0, /* (69) qtime ::= */ + -2, /* (70) qtime ::= QTIME INTEGER */ + 0, /* (71) users ::= */ + -2, /* (72) users ::= USERS INTEGER */ + 0, /* (73) conns ::= */ + -2, /* (74) conns ::= CONNS INTEGER */ + 0, /* (75) state ::= */ + -2, /* (76) state ::= STATE ids */ + -9, /* (77) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -2, /* (78) keep ::= KEEP tagitemlist */ + -2, /* (79) cache ::= CACHE INTEGER */ + -2, /* (80) replica ::= REPLICA INTEGER */ + -2, /* (81) quorum ::= QUORUM INTEGER */ + -2, /* (82) days ::= DAYS INTEGER */ + -2, /* (83) minrows ::= MINROWS INTEGER */ + -2, /* (84) maxrows ::= MAXROWS INTEGER */ + -2, /* (85) blocks ::= BLOCKS INTEGER */ + -2, /* (86) ctime ::= CTIME INTEGER */ + -2, /* (87) wal ::= WAL INTEGER */ + -2, /* (88) fsync ::= FSYNC INTEGER */ + -2, /* (89) comp ::= COMP INTEGER */ + -2, /* (90) prec ::= PRECISION STRING */ + -2, /* (91) update ::= UPDATE INTEGER */ + -2, /* (92) cachelast ::= CACHELAST INTEGER */ + -2, /* (93) partitions ::= PARTITIONS INTEGER */ + 0, /* (94) db_optr ::= */ + -2, /* (95) db_optr ::= db_optr cache */ + -2, /* (96) db_optr ::= db_optr replica */ + -2, /* (97) db_optr ::= db_optr quorum */ + -2, /* (98) db_optr ::= db_optr days */ + -2, /* (99) db_optr ::= db_optr minrows */ + -2, /* (100) db_optr ::= db_optr maxrows */ + -2, /* (101) db_optr ::= db_optr blocks */ + -2, /* (102) db_optr ::= db_optr ctime */ + -2, /* (103) db_optr ::= db_optr wal */ + -2, /* (104) db_optr ::= db_optr fsync */ + -2, /* (105) db_optr ::= db_optr comp */ + -2, /* (106) db_optr ::= db_optr prec */ + -2, /* (107) db_optr ::= db_optr keep */ + -2, /* (108) db_optr ::= db_optr update */ + -2, /* (109) db_optr ::= db_optr cachelast */ + -1, /* (110) topic_optr ::= db_optr */ + -2, /* (111) topic_optr ::= topic_optr partitions */ + 0, /* (112) alter_db_optr ::= */ + -2, /* (113) alter_db_optr ::= alter_db_optr replica */ + -2, /* (114) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (115) alter_db_optr ::= alter_db_optr keep */ + -2, /* (116) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (117) alter_db_optr ::= alter_db_optr comp */ + -2, /* (118) alter_db_optr ::= alter_db_optr wal */ + -2, /* (119) alter_db_optr ::= alter_db_optr fsync */ + -2, /* (120) alter_db_optr ::= alter_db_optr update */ + -2, /* (121) alter_db_optr ::= alter_db_optr cachelast */ + -1, /* (122) alter_topic_optr ::= alter_db_optr */ + -2, /* (123) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (124) typename ::= ids */ + -4, /* (125) typename ::= ids LP signed RP */ + -2, /* (126) typename ::= ids UNSIGNED */ + -1, /* (127) signed ::= INTEGER */ + -2, /* (128) signed ::= PLUS INTEGER */ + -2, /* (129) signed ::= MINUS INTEGER */ + -3, /* (130) cmd ::= CREATE TABLE create_table_args */ + -3, /* (131) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (132) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (133) cmd ::= CREATE TABLE create_table_list */ + -1, /* (134) create_table_list ::= create_from_stable */ + -2, /* (135) create_table_list ::= create_table_list create_from_stable */ + -6, /* (136) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (137) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (138) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (139) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (140) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (141) tagNamelist ::= ids */ + -5, /* (142) create_table_args ::= ifnotexists ids cpxName AS select */ + -3, /* (143) columnlist ::= columnlist COMMA column */ + -1, /* (144) columnlist ::= column */ + -2, /* (145) column ::= ids typename */ + -3, /* (146) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (147) tagitemlist ::= tagitem */ + -1, /* (148) tagitem ::= INTEGER */ + -1, /* (149) tagitem ::= FLOAT */ + -1, /* (150) tagitem ::= STRING */ + -1, /* (151) tagitem ::= BOOL */ + -1, /* (152) tagitem ::= NULL */ + -2, /* (153) tagitem ::= MINUS INTEGER */ + -2, /* (154) tagitem ::= MINUS FLOAT */ + -2, /* (155) tagitem ::= PLUS INTEGER */ + -2, /* (156) tagitem ::= PLUS FLOAT */ + -13, /* (157) select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + -3, /* (158) select ::= LP select RP */ + -1, /* (159) union ::= select */ + -4, /* (160) union ::= union UNION ALL select */ + -1, /* (161) cmd ::= union */ + -2, /* (162) select ::= SELECT selcollist */ + -2, /* (163) sclp ::= selcollist COMMA */ + 0, /* (164) sclp ::= */ + -4, /* (165) selcollist ::= sclp distinct expr as */ + -2, /* (166) selcollist ::= sclp STAR */ + -2, /* (167) as ::= AS ids */ + -1, /* (168) as ::= ids */ + 0, /* (169) as ::= */ + -1, /* (170) distinct ::= DISTINCT */ + 0, /* (171) distinct ::= */ + -2, /* (172) from ::= FROM tablelist */ + -4, /* (173) from ::= FROM LP union RP */ + -2, /* (174) tablelist ::= ids cpxName */ + -3, /* (175) tablelist ::= ids cpxName ids */ + -4, /* (176) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (177) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (178) tmvar ::= VARIABLE */ + -4, /* (179) interval_opt ::= INTERVAL LP tmvar RP */ + -6, /* (180) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + 0, /* (181) interval_opt ::= */ + 0, /* (182) session_option ::= */ + -7, /* (183) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (184) fill_opt ::= */ + -6, /* (185) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (186) fill_opt ::= FILL LP ID RP */ + -4, /* (187) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (188) sliding_opt ::= */ + 0, /* (189) orderby_opt ::= */ + -3, /* (190) orderby_opt ::= ORDER BY sortlist */ + -4, /* (191) sortlist ::= sortlist COMMA item sortorder */ + -2, /* (192) sortlist ::= item sortorder */ + -2, /* (193) item ::= ids cpxName */ + -1, /* (194) sortorder ::= ASC */ + -1, /* (195) sortorder ::= DESC */ + 0, /* (196) sortorder ::= */ + 0, /* (197) groupby_opt ::= */ + -3, /* (198) groupby_opt ::= GROUP BY grouplist */ + -3, /* (199) grouplist ::= grouplist COMMA item */ + -1, /* (200) grouplist ::= item */ + 0, /* (201) having_opt ::= */ + -2, /* (202) having_opt ::= HAVING expr */ + 0, /* (203) limit_opt ::= */ + -2, /* (204) limit_opt ::= LIMIT signed */ + -4, /* (205) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (206) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (207) slimit_opt ::= */ + -2, /* (208) slimit_opt ::= SLIMIT signed */ + -4, /* (209) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (210) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (211) where_opt ::= */ + -2, /* (212) where_opt ::= WHERE expr */ + -3, /* (213) expr ::= LP expr RP */ + -1, /* (214) expr ::= ID */ + -3, /* (215) expr ::= ID DOT ID */ + -3, /* (216) expr ::= ID DOT STAR */ + -1, /* (217) expr ::= INTEGER */ + -2, /* (218) expr ::= MINUS INTEGER */ + -2, /* (219) expr ::= PLUS INTEGER */ + -1, /* (220) expr ::= FLOAT */ + -2, /* (221) expr ::= MINUS FLOAT */ + -2, /* (222) expr ::= PLUS FLOAT */ + -1, /* (223) expr ::= STRING */ + -1, /* (224) expr ::= NOW */ + -1, /* (225) expr ::= VARIABLE */ + -2, /* (226) expr ::= PLUS VARIABLE */ + -2, /* (227) expr ::= MINUS VARIABLE */ + -1, /* (228) expr ::= BOOL */ + -1, /* (229) expr ::= NULL */ + -4, /* (230) expr ::= ID LP exprlist RP */ + -4, /* (231) expr ::= ID LP STAR RP */ + -3, /* (232) expr ::= expr IS NULL */ + -4, /* (233) expr ::= expr IS NOT NULL */ + -3, /* (234) expr ::= expr LT expr */ + -3, /* (235) expr ::= expr GT expr */ + -3, /* (236) expr ::= expr LE expr */ + -3, /* (237) expr ::= expr GE expr */ + -3, /* (238) expr ::= expr NE expr */ + -3, /* (239) expr ::= expr EQ expr */ + -5, /* (240) expr ::= expr BETWEEN expr AND expr */ + -3, /* (241) expr ::= expr AND expr */ + -3, /* (242) expr ::= expr OR expr */ + -3, /* (243) expr ::= expr PLUS expr */ + -3, /* (244) expr ::= expr MINUS expr */ + -3, /* (245) expr ::= expr STAR expr */ + -3, /* (246) expr ::= expr SLASH expr */ + -3, /* (247) expr ::= expr REM expr */ + -3, /* (248) expr ::= expr LIKE expr */ + -5, /* (249) expr ::= expr IN LP exprlist RP */ + -3, /* (250) exprlist ::= exprlist COMMA expritem */ + -1, /* (251) exprlist ::= expritem */ + -1, /* (252) expritem ::= expr */ + 0, /* (253) expritem ::= */ + -3, /* (254) cmd ::= RESET QUERY CACHE */ + -3, /* (255) cmd ::= SYNCDB ids REPLICA */ + -7, /* (256) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (257) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -9, /* (258) cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + -7, /* (259) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (260) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (261) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (262) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (263) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (264) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (265) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (266) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (267) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -3, /* (268) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (269) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (270) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2039,30 +2333,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static void yy_reduce( +static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - int yyact; /* The next action */ + YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; + ParseARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; + yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2080,13 +2378,19 @@ static void yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - return; + /* 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); - return; + /* 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; } @@ -3010,14 +3314,27 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 258: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 258: /* cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ +{ + yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; + + toTSDBType(yymsp[-1].minor.yy0.type); + SArray* K = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + toTSDBType(yymsp[0].minor.yy0.type); + K = tVariantListAppendToken(K, &yymsp[0].minor.yy0, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 259: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 259: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 260: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3028,7 +3345,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 260: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 261: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3042,7 +3359,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 261: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 262: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3054,14 +3371,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 262: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 263: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 263: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 264: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3072,14 +3389,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 264: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 265: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy159, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 265: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 266: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3090,7 +3407,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 266: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 267: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3104,22 +3421,22 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 267: /* cmd ::= KILL CONNECTION INTEGER */ + case 268: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 268: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 269: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 269: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 270: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; } /* @@ -3143,7 +3461,8 @@ static void yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3154,7 +3473,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -3166,7 +3486,8 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3192,7 +3513,8 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* @@ -3201,7 +3523,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3216,7 +3539,8 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* The main parser program. @@ -3245,45 +3569,47 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ + YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser; /* The parser */ + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE - yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif - ParseARG_STORE; + yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - int stateno = yypParser->yytos->stateno; - if( stateno < YY_MIN_REDUCE ){ + if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno); + yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - yymajor = YYNOCODE; + break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3334,10 +3660,9 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3354,6 +3679,8 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3364,8 +3691,7 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - + break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3387,10 +3713,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - yymajor = YYNOCODE; + break; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3405,3 +3731,17 @@ void Parse( #endif return; } + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 93d4570ea8..3d917f2393 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -217,7 +217,8 @@ static SKeyword keywordTable[] = { {"DISTINCT", TK_DISTINCT}, {"PARTITIONS", TK_PARTITIONS}, {"TOPIC", TK_TOPIC}, - {"TOPICS", TK_TOPICS} + {"TOPICS", TK_TOPICS}, + {"LENGTH", TK_LENGTH} }; static const char isIdChar[] = { From ca4289388c76c7737513b8586c395dcfa299d921 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Mon, 31 May 2021 09:28:19 +0800 Subject: [PATCH 02/46] add test case --- tests/script/general/parser/alter_column.sim | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/script/general/parser/alter_column.sim diff --git a/tests/script/general/parser/alter_column.sim b/tests/script/general/parser/alter_column.sim new file mode 100644 index 0000000000..47e59d76d2 --- /dev/null +++ b/tests/script/general/parser/alter_column.sim @@ -0,0 +1,43 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/exec.sh -n dnode1 -s start +sleep 100 +sql connect + +$dbPrefix = m_alt_db +$tbPrefix = m_alt_tb +$mtPrefix = m_alt_mt +$tbNum = 10 +$rowNum = 5 +$totalNum = $tbNum * $rowNum +$ts0 = 1537146000000 +$delta = 600000 +print ========== alter.sim +$i = 0 +$db = $dbPrefix . $i +$mt = $mtPrefix . $i + +sql drop database if exists $db +sql create database $db +sql use $db +##### alter table test, simeplest case +sql create table tb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) +sql insert into tb values (now, 1, "1", "1") +sql alter table tb alter column length c2 20; +if $rows != 0 then + return -1 +endi +sql alter table tb alter column length c3 20; +if $rows != 0 then + return -1 +endi + +##### ILLEGAL OPERATIONS + +# try dropping columns that are defined in metric +sql_error alter table tb alter column length c1 10; + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 0bb4e921c8e1e6656438ed5baca22feb92a140f9 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Mon, 31 May 2021 11:22:50 +0800 Subject: [PATCH 03/46] support stable --- src/client/src/tscSQLParser.c | 8 +- src/inc/ttokendef.h | 1 + src/query/inc/sql.y | 12 + src/query/src/sql.c | 476 ++++++++++--------- tests/script/general/parser/alter_column.sim | 4 +- 5 files changed, 267 insertions(+), 234 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index ae235ebdda..b0ffab1298 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5335,7 +5335,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { if (taosArrayGetSize(pAlterSQL->pAddColumns) != 2) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), NULL); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), NULL); } tVariantListItem* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); @@ -5343,20 +5343,20 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen}; if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg17); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); } SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg21); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); } pItem = taosArrayGet(pAlterSQL->pAddColumns, 1); int64_t nlen = 0; if (tVariantDump(&pItem->pVar, (char *)&nlen, TSDB_DATA_TYPE_BIGINT, false) < 0 || nlen <= 0) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg22); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, nlen); diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 795779a297..e5f1472317 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -210,6 +210,7 @@ + #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index d1327c43c2..3a6e1c0cc0 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -824,6 +824,18 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER STABLE ids(X) cpxName(F) ALTER COLUMN LENGTH ids(A) INTEGER(Z). { + X.n += F.n; + + toTSDBType(A.type); + SArray* K = tVariantListAppendToken(NULL, &A, -1); + toTSDBType(Z.type); + K = tVariantListAppendToken(K, &Z, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 79b919869d..560e499228 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -136,18 +136,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 327 -#define YYNRULE 274 -#define YYNRULE_WITH_ACTION 274 +#define YYNSTATE 331 +#define YYNRULE 275 +#define YYNRULE_WITH_ACTION 275 #define YYNTOKEN 188 -#define YY_MAX_SHIFT 326 -#define YY_MIN_SHIFTREDUCE 523 -#define YY_MAX_SHIFTREDUCE 796 -#define YY_ERROR_ACTION 797 -#define YY_ACCEPT_ACTION 798 -#define YY_NO_ACTION 799 -#define YY_MIN_REDUCE 800 -#define YY_MAX_REDUCE 1073 +#define YY_MAX_SHIFT 330 +#define YY_MIN_SHIFTREDUCE 528 +#define YY_MAX_SHIFTREDUCE 802 +#define YY_ERROR_ACTION 803 +#define YY_ACCEPT_ACTION 804 +#define YY_NO_ACTION 805 +#define YY_MIN_REDUCE 806 +#define YY_MAX_REDUCE 1080 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -214,78 +214,78 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (694) +#define YY_ACTTAB_COUNT (697) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 968, 571, 210, 324, 70, 18, 216, 959, 187, 572, - /* 10 */ 798, 326, 185, 48, 49, 145, 52, 53, 219, 1054, - /* 20 */ 222, 42, 213, 51, 271, 56, 54, 58, 55, 933, - /* 30 */ 650, 187, 947, 47, 46, 187, 932, 45, 44, 43, - /* 40 */ 48, 49, 1053, 52, 53, 218, 1054, 222, 42, 571, - /* 50 */ 51, 271, 56, 54, 58, 55, 959, 572, 300, 299, - /* 60 */ 47, 46, 965, 145, 45, 44, 43, 49, 31, 52, - /* 70 */ 53, 249, 138, 222, 42, 83, 51, 271, 56, 54, - /* 80 */ 58, 55, 287, 1003, 88, 266, 47, 46, 72, 231, - /* 90 */ 45, 44, 43, 524, 525, 526, 527, 528, 529, 530, - /* 100 */ 531, 532, 533, 534, 535, 536, 325, 234, 287, 211, - /* 110 */ 71, 571, 943, 48, 49, 31, 52, 53, 935, 572, - /* 120 */ 222, 42, 571, 51, 271, 56, 54, 58, 55, 268, - /* 130 */ 572, 81, 739, 47, 46, 256, 255, 45, 44, 43, - /* 140 */ 48, 50, 945, 52, 53, 145, 310, 222, 42, 77, - /* 150 */ 51, 271, 56, 54, 58, 55, 212, 37, 232, 944, - /* 160 */ 47, 46, 289, 191, 45, 44, 43, 24, 285, 319, - /* 170 */ 318, 284, 283, 282, 317, 281, 316, 315, 314, 280, - /* 180 */ 313, 312, 907, 31, 895, 896, 897, 898, 899, 900, - /* 190 */ 901, 902, 903, 904, 905, 906, 908, 909, 52, 53, - /* 200 */ 846, 1050, 222, 42, 171, 51, 271, 56, 54, 58, - /* 210 */ 55, 941, 19, 1002, 25, 47, 46, 1049, 959, 45, - /* 220 */ 44, 43, 221, 754, 225, 31, 743, 944, 746, 196, - /* 230 */ 749, 221, 754, 214, 13, 743, 197, 746, 87, 749, - /* 240 */ 84, 122, 121, 195, 45, 44, 43, 109, 56, 54, - /* 250 */ 58, 55, 310, 228, 206, 207, 47, 46, 270, 74, - /* 260 */ 45, 44, 43, 206, 207, 75, 226, 252, 24, 944, - /* 270 */ 319, 318, 77, 252, 745, 317, 748, 316, 315, 314, - /* 280 */ 37, 313, 312, 915, 1048, 674, 913, 914, 671, 204, - /* 290 */ 672, 916, 673, 918, 919, 917, 85, 920, 921, 107, - /* 300 */ 100, 112, 248, 686, 69, 31, 111, 117, 120, 110, - /* 310 */ 8, 203, 5, 34, 161, 114, 236, 237, 689, 160, - /* 320 */ 95, 90, 94, 31, 233, 57, 272, 930, 931, 30, - /* 330 */ 934, 297, 755, 31, 57, 179, 177, 175, 751, 31, - /* 340 */ 145, 755, 174, 125, 124, 123, 290, 751, 220, 944, - /* 350 */ 241, 47, 46, 205, 750, 45, 44, 43, 855, 245, - /* 360 */ 244, 189, 171, 750, 291, 227, 744, 944, 747, 229, - /* 370 */ 323, 322, 130, 320, 298, 847, 99, 944, 98, 171, - /* 380 */ 302, 1, 159, 944, 3, 172, 752, 136, 134, 133, - /* 390 */ 741, 947, 6, 235, 675, 947, 693, 294, 293, 947, - /* 400 */ 720, 721, 250, 705, 65, 711, 32, 140, 82, 61, - /* 410 */ 62, 712, 775, 756, 660, 21, 20, 20, 32, 274, - /* 420 */ 1065, 662, 758, 32, 66, 61, 742, 276, 678, 661, - /* 430 */ 679, 86, 63, 61, 29, 946, 68, 277, 649, 190, - /* 440 */ 15, 106, 14, 105, 676, 192, 677, 186, 17, 193, - /* 450 */ 16, 119, 118, 194, 200, 201, 199, 184, 198, 1013, - /* 460 */ 188, 1012, 223, 1009, 40, 246, 1008, 224, 301, 137, - /* 470 */ 967, 978, 995, 975, 994, 976, 960, 253, 753, 135, - /* 480 */ 980, 139, 143, 155, 156, 942, 251, 940, 704, 257, - /* 490 */ 157, 311, 911, 154, 146, 158, 957, 149, 147, 269, - /* 500 */ 215, 59, 259, 858, 279, 264, 38, 67, 182, 148, - /* 510 */ 35, 288, 854, 64, 1070, 265, 267, 96, 1069, 1067, - /* 520 */ 162, 263, 292, 261, 1064, 102, 295, 1063, 1060, 163, - /* 530 */ 876, 36, 33, 39, 183, 843, 113, 841, 115, 116, - /* 540 */ 839, 838, 238, 173, 836, 835, 834, 833, 832, 831, - /* 550 */ 176, 178, 258, 828, 826, 824, 822, 180, 819, 181, - /* 560 */ 41, 73, 78, 108, 260, 996, 303, 304, 305, 306, - /* 570 */ 307, 308, 309, 208, 321, 796, 230, 278, 239, 240, - /* 580 */ 795, 242, 243, 91, 92, 209, 794, 202, 781, 780, - /* 590 */ 247, 252, 9, 273, 681, 837, 76, 26, 165, 877, - /* 600 */ 166, 126, 167, 164, 169, 168, 170, 127, 830, 2, - /* 610 */ 128, 129, 829, 821, 820, 254, 79, 706, 4, 150, - /* 620 */ 151, 152, 153, 141, 923, 709, 80, 142, 217, 262, - /* 630 */ 27, 713, 144, 10, 11, 757, 28, 7, 12, 22, - /* 640 */ 759, 23, 89, 275, 613, 609, 87, 607, 606, 605, - /* 650 */ 602, 575, 286, 97, 93, 32, 784, 60, 652, 651, - /* 660 */ 648, 597, 595, 101, 103, 587, 593, 589, 591, 585, - /* 670 */ 104, 583, 616, 615, 614, 612, 611, 296, 610, 608, - /* 680 */ 604, 603, 61, 573, 540, 538, 131, 800, 799, 799, - /* 690 */ 799, 799, 799, 132, + /* 0 */ 974, 576, 211, 328, 70, 18, 217, 965, 188, 577, + /* 10 */ 804, 330, 186, 48, 49, 146, 52, 53, 220, 1060, + /* 20 */ 223, 42, 214, 51, 272, 56, 54, 58, 55, 939, + /* 30 */ 655, 188, 953, 47, 46, 188, 938, 45, 44, 43, + /* 40 */ 48, 49, 1059, 52, 53, 219, 1060, 223, 42, 576, + /* 50 */ 51, 272, 56, 54, 58, 55, 965, 577, 304, 303, + /* 60 */ 47, 46, 971, 146, 45, 44, 43, 49, 31, 52, + /* 70 */ 53, 250, 139, 223, 42, 83, 51, 272, 56, 54, + /* 80 */ 58, 55, 288, 1009, 88, 267, 47, 46, 72, 314, + /* 90 */ 45, 44, 43, 529, 530, 531, 532, 533, 534, 535, + /* 100 */ 536, 537, 538, 539, 540, 541, 329, 235, 288, 212, + /* 110 */ 71, 576, 949, 48, 49, 31, 52, 53, 941, 577, + /* 120 */ 223, 42, 576, 51, 272, 56, 54, 58, 55, 269, + /* 130 */ 577, 81, 744, 47, 46, 257, 256, 45, 44, 43, + /* 140 */ 48, 50, 951, 52, 53, 146, 192, 223, 42, 77, + /* 150 */ 51, 272, 56, 54, 58, 55, 213, 37, 947, 950, + /* 160 */ 47, 46, 1, 160, 45, 44, 43, 24, 286, 323, + /* 170 */ 322, 285, 284, 283, 321, 282, 320, 319, 318, 281, + /* 180 */ 317, 316, 913, 31, 901, 902, 903, 904, 905, 906, + /* 190 */ 907, 908, 909, 910, 911, 912, 914, 915, 52, 53, + /* 200 */ 229, 29, 223, 42, 278, 51, 272, 56, 54, 58, + /* 210 */ 55, 694, 19, 1008, 25, 47, 46, 746, 965, 45, + /* 220 */ 44, 43, 222, 759, 226, 31, 748, 950, 751, 197, + /* 230 */ 754, 222, 759, 215, 13, 748, 198, 751, 87, 754, + /* 240 */ 84, 123, 122, 196, 45, 44, 43, 110, 56, 54, + /* 250 */ 58, 55, 314, 747, 208, 209, 47, 46, 271, 74, + /* 260 */ 45, 44, 43, 208, 209, 75, 227, 253, 24, 950, + /* 270 */ 323, 322, 77, 253, 750, 321, 753, 320, 319, 318, + /* 280 */ 37, 317, 316, 921, 1056, 679, 919, 920, 676, 698, + /* 290 */ 677, 922, 678, 924, 925, 923, 85, 926, 927, 108, + /* 300 */ 101, 113, 249, 691, 69, 31, 112, 118, 121, 111, + /* 310 */ 8, 205, 5, 34, 162, 115, 237, 238, 273, 161, + /* 320 */ 95, 90, 94, 31, 234, 57, 232, 936, 937, 30, + /* 330 */ 940, 301, 760, 293, 57, 180, 178, 176, 756, 31, + /* 340 */ 31, 760, 175, 126, 125, 124, 294, 756, 146, 950, + /* 350 */ 242, 47, 46, 1055, 755, 45, 44, 43, 1054, 246, + /* 360 */ 245, 228, 230, 755, 295, 324, 749, 950, 752, 852, + /* 370 */ 327, 326, 131, 172, 137, 135, 134, 3, 173, 1071, + /* 380 */ 302, 306, 221, 950, 950, 861, 757, 953, 953, 172, + /* 390 */ 62, 953, 853, 236, 680, 233, 172, 298, 297, 290, + /* 400 */ 725, 726, 251, 710, 716, 717, 32, 141, 61, 21, + /* 410 */ 65, 780, 63, 761, 763, 20, 82, 20, 665, 275, + /* 420 */ 667, 277, 32, 32, 61, 86, 6, 100, 666, 99, + /* 430 */ 66, 15, 61, 14, 107, 68, 106, 654, 206, 683, + /* 440 */ 17, 684, 16, 681, 207, 682, 120, 119, 952, 190, + /* 450 */ 191, 193, 187, 194, 195, 201, 202, 200, 185, 1019, + /* 460 */ 199, 189, 1018, 224, 40, 1015, 1014, 225, 305, 247, + /* 470 */ 138, 973, 156, 984, 1001, 981, 982, 966, 758, 254, + /* 480 */ 1000, 986, 140, 144, 136, 948, 157, 258, 148, 216, + /* 490 */ 709, 917, 963, 147, 149, 946, 150, 151, 158, 266, + /* 500 */ 159, 864, 280, 260, 265, 67, 64, 59, 38, 270, + /* 510 */ 183, 35, 289, 264, 268, 860, 1077, 96, 291, 1076, + /* 520 */ 1073, 163, 262, 296, 1070, 103, 299, 1069, 1066, 164, + /* 530 */ 882, 36, 33, 39, 184, 849, 114, 847, 116, 117, + /* 540 */ 845, 844, 239, 174, 842, 841, 840, 839, 838, 837, + /* 550 */ 177, 179, 41, 834, 832, 830, 828, 181, 825, 182, + /* 560 */ 259, 252, 315, 73, 78, 109, 261, 1002, 307, 308, + /* 570 */ 309, 310, 311, 312, 210, 313, 231, 325, 279, 802, + /* 580 */ 241, 240, 801, 204, 203, 243, 91, 92, 244, 800, + /* 590 */ 843, 786, 785, 248, 127, 274, 253, 686, 836, 167, + /* 600 */ 128, 166, 883, 165, 168, 169, 171, 129, 170, 835, + /* 610 */ 2, 130, 9, 827, 826, 26, 76, 4, 255, 79, + /* 620 */ 711, 152, 153, 154, 155, 929, 142, 218, 714, 143, + /* 630 */ 80, 263, 764, 718, 145, 10, 11, 762, 27, 7, + /* 640 */ 28, 12, 22, 276, 23, 89, 618, 87, 614, 612, + /* 650 */ 611, 610, 607, 580, 287, 93, 97, 796, 32, 789, + /* 660 */ 657, 656, 653, 98, 60, 102, 602, 600, 592, 598, + /* 670 */ 594, 292, 596, 590, 104, 588, 621, 620, 619, 617, + /* 680 */ 105, 300, 616, 615, 613, 609, 608, 61, 578, 545, + /* 690 */ 132, 543, 806, 805, 805, 805, 133, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 191, 1, 190, 191, 197, 252, 210, 234, 252, 9, @@ -296,68 +296,68 @@ static const YYCODETYPE yy_lookahead[] = { /* 50 */ 23, 24, 25, 26, 27, 28, 234, 9, 33, 34, /* 60 */ 33, 34, 253, 191, 37, 38, 39, 14, 191, 16, /* 70 */ 17, 249, 191, 20, 21, 237, 23, 24, 25, 26, - /* 80 */ 27, 28, 79, 259, 197, 261, 33, 34, 250, 68, + /* 80 */ 27, 28, 79, 259, 197, 261, 33, 34, 250, 81, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 191, 79, 61, /* 110 */ 110, 1, 235, 13, 14, 191, 16, 17, 231, 9, /* 120 */ 20, 21, 1, 23, 24, 25, 26, 27, 28, 257, /* 130 */ 9, 259, 105, 33, 34, 254, 255, 37, 38, 39, - /* 140 */ 13, 14, 226, 16, 17, 191, 81, 20, 21, 104, - /* 150 */ 23, 24, 25, 26, 27, 28, 232, 112, 137, 235, - /* 160 */ 33, 34, 141, 252, 37, 38, 39, 88, 89, 90, + /* 140 */ 13, 14, 226, 16, 17, 191, 252, 20, 21, 104, + /* 150 */ 23, 24, 25, 26, 27, 28, 232, 112, 191, 235, + /* 160 */ 33, 34, 198, 199, 37, 38, 39, 88, 89, 90, /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216, /* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17, - /* 200 */ 196, 252, 20, 21, 200, 23, 24, 25, 26, 27, - /* 210 */ 28, 191, 44, 259, 104, 33, 34, 252, 234, 37, + /* 200 */ 233, 104, 20, 21, 107, 23, 24, 25, 26, 27, + /* 210 */ 28, 37, 44, 259, 104, 33, 34, 1, 234, 37, /* 220 */ 38, 39, 1, 2, 232, 191, 5, 235, 7, 61, /* 230 */ 9, 1, 2, 249, 104, 5, 68, 7, 108, 9, /* 240 */ 110, 73, 74, 75, 37, 38, 39, 76, 25, 26, - /* 250 */ 27, 28, 81, 233, 33, 34, 33, 34, 37, 105, + /* 250 */ 27, 28, 81, 37, 33, 34, 33, 34, 37, 105, /* 260 */ 37, 38, 39, 33, 34, 105, 232, 113, 88, 235, /* 270 */ 90, 91, 104, 113, 5, 95, 7, 97, 98, 99, - /* 280 */ 112, 101, 102, 209, 252, 2, 212, 213, 5, 252, + /* 280 */ 112, 101, 102, 209, 252, 2, 212, 213, 5, 115, /* 290 */ 7, 217, 9, 219, 220, 221, 197, 223, 224, 62, /* 300 */ 63, 64, 134, 109, 136, 191, 69, 70, 71, 72, - /* 310 */ 116, 143, 62, 63, 64, 78, 33, 34, 37, 69, - /* 320 */ 70, 71, 72, 191, 68, 104, 15, 228, 229, 230, - /* 330 */ 231, 75, 111, 191, 104, 62, 63, 64, 117, 191, - /* 340 */ 191, 111, 69, 70, 71, 72, 232, 117, 60, 235, - /* 350 */ 135, 33, 34, 252, 133, 37, 38, 39, 196, 144, - /* 360 */ 145, 252, 200, 133, 232, 210, 5, 235, 7, 210, - /* 370 */ 65, 66, 67, 210, 232, 196, 138, 235, 140, 200, - /* 380 */ 232, 198, 199, 235, 194, 195, 117, 62, 63, 64, - /* 390 */ 1, 236, 104, 137, 111, 236, 115, 141, 142, 236, - /* 400 */ 124, 125, 105, 105, 109, 105, 109, 109, 259, 109, - /* 410 */ 109, 105, 105, 105, 105, 109, 109, 109, 109, 105, - /* 420 */ 236, 105, 111, 109, 129, 109, 37, 105, 5, 105, - /* 430 */ 7, 109, 131, 109, 104, 236, 104, 107, 106, 252, - /* 440 */ 138, 138, 140, 140, 5, 252, 7, 252, 138, 252, - /* 450 */ 140, 76, 77, 252, 252, 252, 252, 252, 252, 227, - /* 460 */ 252, 227, 227, 227, 251, 191, 227, 227, 227, 191, - /* 470 */ 191, 191, 260, 191, 260, 191, 234, 234, 117, 60, - /* 480 */ 191, 191, 191, 238, 191, 234, 192, 191, 117, 256, - /* 490 */ 191, 103, 225, 239, 247, 191, 248, 244, 246, 122, - /* 500 */ 256, 127, 256, 191, 191, 256, 191, 128, 191, 245, - /* 510 */ 191, 191, 191, 130, 191, 121, 126, 191, 191, 191, - /* 520 */ 191, 120, 191, 119, 191, 191, 191, 191, 191, 191, + /* 310 */ 116, 143, 62, 63, 64, 78, 33, 34, 15, 69, + /* 320 */ 70, 71, 72, 191, 68, 104, 68, 228, 229, 230, + /* 330 */ 231, 75, 111, 75, 104, 62, 63, 64, 117, 191, + /* 340 */ 191, 111, 69, 70, 71, 72, 232, 117, 191, 235, + /* 350 */ 135, 33, 34, 252, 133, 37, 38, 39, 252, 144, + /* 360 */ 145, 210, 210, 133, 232, 210, 5, 235, 7, 196, + /* 370 */ 65, 66, 67, 200, 62, 63, 64, 194, 195, 236, + /* 380 */ 232, 232, 60, 235, 235, 196, 117, 236, 236, 200, + /* 390 */ 109, 236, 196, 137, 111, 137, 200, 141, 142, 141, + /* 400 */ 124, 125, 105, 105, 105, 105, 109, 109, 109, 109, + /* 410 */ 109, 105, 131, 105, 111, 109, 259, 109, 105, 105, + /* 420 */ 105, 105, 109, 109, 109, 109, 104, 138, 105, 140, + /* 430 */ 129, 138, 109, 140, 138, 104, 140, 106, 252, 5, + /* 440 */ 138, 7, 140, 5, 252, 7, 76, 77, 236, 252, + /* 450 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 227, + /* 460 */ 252, 252, 227, 227, 251, 227, 227, 227, 227, 191, + /* 470 */ 191, 191, 238, 191, 260, 191, 191, 234, 117, 234, + /* 480 */ 260, 191, 191, 191, 60, 234, 191, 256, 246, 256, + /* 490 */ 117, 225, 248, 247, 245, 191, 244, 243, 191, 121, + /* 500 */ 191, 191, 191, 256, 256, 128, 130, 127, 191, 122, + /* 510 */ 191, 191, 191, 120, 126, 191, 191, 191, 191, 191, + /* 520 */ 191, 191, 119, 191, 191, 191, 191, 191, 191, 191, /* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, /* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 550 */ 191, 191, 118, 191, 191, 191, 191, 191, 191, 191, - /* 560 */ 132, 192, 192, 87, 192, 192, 86, 50, 83, 85, - /* 570 */ 54, 84, 82, 192, 79, 5, 192, 192, 146, 5, - /* 580 */ 5, 146, 5, 197, 197, 192, 5, 192, 90, 89, - /* 590 */ 135, 113, 104, 107, 105, 192, 114, 104, 206, 208, - /* 600 */ 202, 193, 205, 207, 204, 203, 201, 193, 192, 198, - /* 610 */ 193, 193, 192, 192, 192, 109, 109, 105, 194, 243, - /* 620 */ 242, 241, 240, 104, 225, 105, 104, 109, 1, 104, - /* 630 */ 109, 105, 104, 123, 123, 105, 109, 104, 104, 104, - /* 640 */ 111, 104, 76, 107, 9, 5, 108, 5, 5, 5, - /* 650 */ 5, 80, 15, 140, 76, 109, 5, 16, 5, 5, - /* 660 */ 105, 5, 5, 140, 140, 5, 5, 5, 5, 5, - /* 670 */ 139, 5, 5, 5, 5, 5, 5, 138, 5, 5, - /* 680 */ 5, 5, 109, 80, 60, 59, 21, 0, 264, 264, - /* 690 */ 264, 264, 264, 21, 264, 264, 264, 264, 264, 264, + /* 550 */ 191, 191, 132, 191, 191, 191, 191, 191, 191, 191, + /* 560 */ 118, 192, 103, 192, 192, 87, 192, 192, 86, 50, + /* 570 */ 83, 85, 54, 84, 192, 82, 192, 79, 192, 5, + /* 580 */ 5, 146, 5, 192, 192, 146, 197, 197, 5, 5, + /* 590 */ 192, 90, 89, 135, 193, 107, 113, 105, 192, 202, + /* 600 */ 193, 206, 208, 207, 205, 203, 201, 193, 204, 192, + /* 610 */ 198, 193, 104, 192, 192, 104, 114, 194, 109, 109, + /* 620 */ 105, 242, 241, 240, 239, 225, 104, 1, 105, 109, + /* 630 */ 104, 104, 111, 105, 104, 123, 123, 105, 109, 104, + /* 640 */ 109, 104, 104, 107, 104, 76, 9, 108, 5, 5, + /* 650 */ 5, 5, 5, 80, 15, 76, 140, 5, 109, 5, + /* 660 */ 5, 5, 105, 139, 16, 140, 5, 5, 5, 5, + /* 670 */ 5, 138, 5, 5, 140, 5, 5, 5, 5, 5, + /* 680 */ 139, 138, 5, 5, 5, 5, 5, 109, 80, 60, + /* 690 */ 21, 59, 0, 264, 264, 264, 21, 264, 264, 264, /* 700 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 710 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 720 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, @@ -376,104 +376,106 @@ static const YYCODETYPE yy_lookahead[] = { /* 850 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 860 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 870 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 880 */ 264, 264, + /* 880 */ 264, 264, 264, 264, 264, }; -#define YY_SHIFT_COUNT (326) +#define YY_SHIFT_COUNT (330) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (687) +#define YY_SHIFT_MAX (692) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 168, 79, 79, 180, 180, 3, 221, 230, 110, 121, /* 10 */ 121, 121, 121, 121, 121, 121, 121, 121, 0, 48, /* 20 */ 230, 283, 283, 283, 283, 45, 45, 121, 121, 121, - /* 30 */ 29, 121, 121, 171, 3, 65, 65, 694, 694, 694, + /* 30 */ 29, 121, 121, 171, 3, 8, 8, 697, 697, 697, /* 40 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, /* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, /* 60 */ 283, 283, 25, 25, 25, 25, 25, 25, 25, 121, - /* 70 */ 121, 121, 281, 121, 121, 121, 45, 45, 121, 121, + /* 70 */ 121, 121, 174, 121, 121, 121, 45, 45, 121, 121, /* 80 */ 121, 276, 276, 194, 45, 121, 121, 121, 121, 121, /* 90 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 100 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 110 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 120 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - /* 130 */ 121, 121, 121, 121, 121, 121, 121, 419, 419, 419, - /* 140 */ 371, 371, 371, 419, 371, 419, 379, 383, 374, 377, - /* 150 */ 390, 394, 401, 404, 434, 428, 419, 419, 419, 388, - /* 160 */ 3, 3, 419, 419, 476, 480, 517, 485, 484, 516, - /* 170 */ 487, 490, 388, 419, 495, 495, 419, 495, 419, 495, - /* 180 */ 419, 419, 694, 694, 27, 100, 127, 100, 100, 53, - /* 190 */ 182, 223, 223, 223, 223, 237, 250, 273, 318, 318, - /* 200 */ 318, 318, 256, 215, 207, 207, 269, 361, 130, 21, - /* 210 */ 305, 325, 297, 154, 160, 298, 300, 306, 307, 308, - /* 220 */ 389, 288, 311, 301, 295, 309, 314, 316, 322, 324, - /* 230 */ 330, 238, 302, 303, 332, 310, 423, 439, 375, 570, - /* 240 */ 432, 574, 575, 435, 577, 581, 498, 500, 455, 478, - /* 250 */ 486, 488, 482, 489, 493, 506, 507, 512, 519, 520, - /* 260 */ 518, 522, 627, 525, 526, 528, 521, 510, 527, 511, - /* 270 */ 530, 533, 529, 534, 486, 535, 536, 537, 538, 566, - /* 280 */ 635, 640, 642, 643, 644, 645, 571, 637, 578, 513, - /* 290 */ 546, 546, 641, 523, 524, 651, 531, 539, 546, 653, - /* 300 */ 654, 555, 546, 656, 657, 660, 661, 662, 663, 664, - /* 310 */ 666, 667, 668, 669, 670, 671, 673, 674, 675, 676, - /* 320 */ 573, 603, 665, 672, 624, 626, 687, + /* 130 */ 121, 121, 121, 121, 121, 121, 121, 121, 424, 424, + /* 140 */ 424, 373, 373, 373, 424, 373, 424, 377, 376, 380, + /* 150 */ 387, 388, 378, 393, 403, 442, 420, 424, 424, 424, + /* 160 */ 459, 3, 3, 424, 424, 478, 482, 519, 487, 486, + /* 170 */ 518, 489, 493, 459, 424, 498, 498, 424, 498, 424, + /* 180 */ 498, 424, 424, 697, 697, 27, 100, 127, 100, 100, + /* 190 */ 53, 182, 223, 223, 223, 223, 237, 250, 273, 318, + /* 200 */ 318, 318, 318, 256, 258, 215, 207, 207, 269, 361, + /* 210 */ 130, 305, 312, 297, 154, 160, 298, 299, 300, 306, + /* 220 */ 308, 216, 322, 303, 281, 301, 313, 314, 315, 316, + /* 230 */ 323, 97, 289, 293, 296, 331, 302, 434, 438, 370, + /* 240 */ 574, 435, 575, 577, 439, 583, 584, 501, 503, 458, + /* 250 */ 483, 488, 508, 502, 492, 511, 509, 510, 515, 522, + /* 260 */ 523, 520, 526, 626, 527, 528, 530, 529, 512, 531, + /* 270 */ 513, 532, 535, 521, 537, 488, 538, 536, 540, 539, + /* 280 */ 569, 637, 643, 644, 645, 646, 647, 573, 639, 579, + /* 290 */ 516, 652, 524, 533, 549, 549, 648, 525, 534, 654, + /* 300 */ 541, 543, 549, 655, 656, 557, 549, 661, 662, 663, + /* 310 */ 664, 665, 667, 668, 670, 671, 672, 673, 674, 677, + /* 320 */ 678, 679, 680, 681, 578, 608, 669, 675, 629, 632, + /* 330 */ 692, }; -#define YY_REDUCE_COUNT (183) +#define YY_REDUCE_COUNT (184) #define YY_REDUCE_MIN (-247) -#define YY_REDUCE_MAX (424) +#define YY_REDUCE_MAX (423) static const short yy_reduce_ofst[] = { /* 0 */ -178, -27, -27, 74, 74, 99, -244, -217, -119, -76, - /* 10 */ -176, -128, -8, 34, 114, 132, 142, 148, -191, -188, - /* 20 */ -221, -204, 155, 159, 163, -227, -16, -46, 149, 20, - /* 30 */ -113, -84, -123, 4, -193, 162, 179, -162, 183, 190, - /* 40 */ -247, -240, -89, -51, -35, 32, 37, 101, 109, 187, - /* 50 */ 193, 195, 197, 201, 202, 203, 204, 205, 206, 208, - /* 60 */ 184, 199, 232, 234, 235, 236, 239, 240, 241, 274, - /* 70 */ 278, 279, 213, 280, 282, 284, 242, 243, 289, 290, - /* 80 */ 291, 212, 214, 245, 251, 293, 296, 299, 304, 312, - /* 90 */ 313, 315, 317, 319, 320, 321, 323, 326, 327, 328, - /* 100 */ 329, 331, 333, 334, 335, 336, 337, 338, 339, 340, - /* 110 */ 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, - /* 120 */ 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - /* 130 */ 362, 363, 364, 365, 366, 367, 368, 294, 369, 370, - /* 140 */ 233, 244, 246, 372, 249, 373, 248, 247, 252, 264, - /* 150 */ 253, 376, 378, 380, 382, 254, 381, 384, 385, 267, - /* 160 */ 386, 387, 393, 395, 391, 396, 392, 398, 397, 402, - /* 170 */ 400, 405, 399, 403, 408, 414, 416, 417, 420, 418, - /* 180 */ 421, 422, 411, 424, + /* 10 */ -176, -128, -8, 34, 114, 132, 148, 149, -191, -188, + /* 20 */ -221, -204, 151, 152, 155, -227, -16, -46, 157, -33, + /* 30 */ -113, -84, -123, 173, -193, 189, 196, -162, -36, 183, + /* 40 */ -247, -240, -106, 32, 101, 106, 186, 192, 197, 198, + /* 50 */ 199, 200, 201, 202, 203, 204, 205, 206, 208, 209, + /* 60 */ 143, 212, 232, 235, 236, 238, 239, 240, 241, 278, + /* 70 */ 279, 280, 213, 282, 284, 285, 243, 245, 290, 291, + /* 80 */ 292, 214, 220, 234, 251, 295, 304, 307, 309, 310, + /* 90 */ 311, 317, 319, 320, 321, 324, 325, 326, 327, 328, + /* 100 */ 329, 330, 332, 333, 334, 335, 336, 337, 338, 339, + /* 110 */ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + /* 120 */ 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + /* 130 */ 360, 362, 363, 364, 365, 366, 367, 368, 369, 371, + /* 140 */ 372, 231, 233, 247, 374, 248, 375, 244, 246, 242, + /* 150 */ 249, 252, 254, 379, 381, 383, 385, 382, 384, 386, + /* 160 */ 266, 389, 390, 391, 392, 394, 396, 395, 397, 399, + /* 170 */ 402, 404, 405, 400, 398, 401, 407, 406, 414, 417, + /* 180 */ 418, 421, 422, 412, 423, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 797, 910, 856, 922, 844, 853, 1056, 1056, 797, 797, - /* 10 */ 797, 797, 797, 797, 797, 797, 797, 797, 969, 816, - /* 20 */ 1056, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 30 */ 853, 797, 797, 859, 853, 859, 859, 964, 894, 912, - /* 40 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 50 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 60 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 70 */ 797, 797, 971, 977, 974, 797, 797, 797, 979, 797, - /* 80 */ 797, 999, 999, 962, 797, 797, 797, 797, 797, 797, - /* 90 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 100 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 110 */ 797, 797, 797, 842, 797, 840, 797, 797, 797, 797, - /* 120 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 130 */ 827, 797, 797, 797, 797, 797, 797, 818, 818, 818, - /* 140 */ 797, 797, 797, 818, 797, 818, 1006, 1010, 1004, 992, - /* 150 */ 1000, 991, 987, 985, 984, 1014, 818, 818, 818, 857, - /* 160 */ 853, 853, 818, 818, 875, 873, 871, 863, 869, 865, - /* 170 */ 867, 861, 845, 818, 851, 851, 818, 851, 818, 851, - /* 180 */ 818, 818, 894, 912, 797, 1015, 797, 1055, 1005, 1045, - /* 190 */ 1044, 1051, 1043, 1042, 1041, 797, 797, 797, 1037, 1038, - /* 200 */ 1040, 1039, 797, 797, 1047, 1046, 797, 797, 797, 797, - /* 210 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 220 */ 797, 1017, 797, 1011, 1007, 797, 797, 797, 797, 797, - /* 230 */ 797, 797, 797, 797, 924, 797, 797, 797, 797, 797, - /* 240 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 961, - /* 250 */ 797, 797, 797, 797, 797, 973, 972, 797, 797, 797, - /* 260 */ 797, 797, 797, 797, 797, 797, 1001, 797, 993, 797, - /* 270 */ 797, 797, 797, 797, 936, 797, 797, 797, 797, 797, - /* 280 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 290 */ 1068, 1066, 797, 797, 797, 797, 797, 797, 1062, 797, - /* 300 */ 797, 797, 1059, 797, 797, 797, 797, 797, 797, 797, - /* 310 */ 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, - /* 320 */ 878, 797, 825, 823, 797, 814, 797, + /* 0 */ 803, 916, 862, 928, 850, 859, 1062, 1062, 803, 803, + /* 10 */ 803, 803, 803, 803, 803, 803, 803, 803, 975, 822, + /* 20 */ 1062, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 30 */ 859, 803, 803, 865, 859, 865, 865, 970, 900, 918, + /* 40 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 50 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 60 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 70 */ 803, 803, 977, 983, 980, 803, 803, 803, 985, 803, + /* 80 */ 803, 1005, 1005, 968, 803, 803, 803, 803, 803, 803, + /* 90 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 100 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 110 */ 803, 803, 803, 803, 848, 803, 846, 803, 803, 803, + /* 120 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 130 */ 803, 833, 803, 803, 803, 803, 803, 803, 824, 824, + /* 140 */ 824, 803, 803, 803, 824, 803, 824, 1012, 1016, 1010, + /* 150 */ 998, 1006, 997, 993, 991, 990, 1020, 824, 824, 824, + /* 160 */ 863, 859, 859, 824, 824, 881, 879, 877, 869, 875, + /* 170 */ 871, 873, 867, 851, 824, 857, 857, 824, 857, 824, + /* 180 */ 857, 824, 824, 900, 918, 803, 1021, 803, 1061, 1011, + /* 190 */ 1051, 1050, 1057, 1049, 1048, 1047, 803, 803, 803, 1043, + /* 200 */ 1044, 1046, 1045, 803, 803, 803, 1053, 1052, 803, 803, + /* 210 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 220 */ 803, 803, 1023, 803, 1017, 1013, 803, 803, 803, 803, + /* 230 */ 803, 803, 803, 803, 803, 930, 803, 803, 803, 803, + /* 240 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 250 */ 967, 803, 803, 803, 803, 803, 979, 978, 803, 803, + /* 260 */ 803, 803, 803, 803, 803, 803, 803, 1007, 803, 999, + /* 270 */ 803, 803, 803, 803, 803, 942, 803, 803, 803, 803, + /* 280 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 290 */ 803, 803, 803, 803, 1075, 1072, 803, 803, 803, 803, + /* 300 */ 803, 803, 1068, 803, 803, 803, 1065, 803, 803, 803, + /* 310 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, + /* 320 */ 803, 803, 803, 803, 884, 803, 831, 829, 803, 820, + /* 330 */ 803, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1307,12 +1309,13 @@ static const char *const yyRuleName[] = { /* 265 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", /* 266 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", /* 267 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 268 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 269 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 270 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 271 */ "cmd ::= KILL CONNECTION INTEGER", - /* 272 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 273 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 268 */ "cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER", + /* 269 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 270 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 271 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 272 */ "cmd ::= KILL CONNECTION INTEGER", + /* 273 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 274 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -2047,12 +2050,13 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 189, /* (265) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ 189, /* (266) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ 189, /* (267) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 189, /* (268) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 189, /* (269) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 189, /* (270) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 189, /* (271) cmd ::= KILL CONNECTION INTEGER */ - 189, /* (272) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 189, /* (273) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 189, /* (268) cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + 189, /* (269) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 189, /* (270) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 189, /* (271) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 189, /* (272) cmd ::= KILL CONNECTION INTEGER */ + 189, /* (273) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 189, /* (274) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2326,12 +2330,13 @@ static const signed char yyRuleInfoNRhs[] = { -9, /* (265) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ -7, /* (266) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ -7, /* (267) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (268) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (269) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (270) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -3, /* (271) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (272) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (273) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -9, /* (268) cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + -7, /* (269) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (270) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (271) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -3, /* (272) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (273) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (274) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3410,14 +3415,27 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 268: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 268: /* cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ +{ + yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; + + toTSDBType(yymsp[-1].minor.yy0.type); + SArray* K = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + toTSDBType(yymsp[0].minor.yy0.type); + K = tVariantListAppendToken(K, &yymsp[0].minor.yy0, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 269: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 269: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 270: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3428,7 +3446,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 270: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 271: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3442,13 +3460,13 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 271: /* cmd ::= KILL CONNECTION INTEGER */ + case 272: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 272: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 273: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 273: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 274: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/tests/script/general/parser/alter_column.sim b/tests/script/general/parser/alter_column.sim index 12c117c096..7f30498d06 100644 --- a/tests/script/general/parser/alter_column.sim +++ b/tests/script/general/parser/alter_column.sim @@ -38,7 +38,7 @@ endi sql create stable stb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) tags(id int) sql create table tb1 using stb tags(1) sql insert into tb1 values (now, 1, "1", "1") -sql alter table stb alter column length c2 20; +sql alter stable stb alter column length c2 20; if $rows != 0 then return -1 endi @@ -47,7 +47,9 @@ endi # try dropping columns that are defined in metric sql_error alter table tb alter column length c1 10; +sql_error alter stable tb alter column length c2 10; sql_error alter table tb1 alter column length c2 10; +sql_error alter stable tb1 alter column length c2 10; system sh/exec.sh -n dnode1 -s stop -x SIGINT From 424cd0123b52eaf6b0e54947c812b08947cae108 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Mon, 31 May 2021 15:42:50 +0800 Subject: [PATCH 04/46] fix windows compile error --- src/client/src/tscSQLParser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b0ffab1298..978fbaf521 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5353,9 +5353,9 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } pItem = taosArrayGet(pAlterSQL->pAddColumns, 1); - int64_t nlen = 0; + int16_t nlen = 0; - if (tVariantDump(&pItem->pVar, (char *)&nlen, TSDB_DATA_TYPE_BIGINT, false) < 0 || nlen <= 0) { + if (tVariantDump(&pItem->pVar, (char *)&nlen, TSDB_DATA_TYPE_SMALLINT, false) < 0 || nlen <= 0) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } From a613833b5f88d347a63c57551386fb9a6b90b1b4 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Mon, 31 May 2021 17:13:03 +0800 Subject: [PATCH 05/46] [TD-4422]-adding test cases for different combination of drop, child_table_exist, and auto_create_table --- .../insert-drop-exist-auto-NNN.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-NNY.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-NYN.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-NYY.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-YNN.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-YNY.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-YYN.json | 60 ++++++++++++++++++ .../insert-drop-exist-auto-YYY.json | 60 ++++++++++++++++++ .../taosdemoTestInsertWithJson.py | 62 +++++++++++++++++-- 9 files changed, 538 insertions(+), 4 deletions(-) create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json new file mode 100644 index 0000000000..659cbdb8ea --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json new file mode 100644 index 0000000000..1459f484e1 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json new file mode 100644 index 0000000000..06a55eee43 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json new file mode 100644 index 0000000000..deace85f58 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json new file mode 100644 index 0000000000..0339410c7c --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json new file mode 100644 index 0000000000..de04d5b9e6 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json new file mode 100644 index 0000000000..1bde64760a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json new file mode 100644 index 0000000000..77d7d7b927 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "auto_create_table": "yes", + "child_table_exists":"yes", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 5ecc4d70b2..098c2e935e 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -238,10 +238,12 @@ class TDTestCase: tdSql.execute("use dbtest123") tdSql.query("select col2 from stb0") tdSql.checkData(0, 0, 2147483647) - tdSql.query("select t1 from stb1") - tdSql.checkData(0, 0, -127) - tdSql.query("select t2 from stb1") - tdSql.checkData(1, 0, 126) + tdSql.query("select * from stb1 where t1=-127") + tdSql.checkRows(20) + tdSql.query("select * from stb1 where t2=127") + tdSql.checkRows(10) + tdSql.query("select * from stb1 where t2=126") + tdSql.checkRows(10) # insert: test interlace parament os.system("%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath) @@ -251,6 +253,58 @@ class TDTestCase: tdSql.query("select count (*) from stb0") tdSql.checkData(0, 0, 15000) + # insert: auto_create + # todo: add exception input for auto_create_table eg:123 + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json -y " % binPath) # drop = yes, exist = yes, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json -y " % binPath) # drop = yes, exist = yes, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json -y " % binPath) # drop = yes, exist = no, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json -y " % binPath) # drop = yes, exist = no, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json -y " % binPath) # drop = no, exist = yes, auto_create = yes + tdSql.query('show tables') + tdSql.checkRows(0) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json -y " % binPath) # drop = no, exist = yes, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(0) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json -y " % binPath) # drop = no, exist = no, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json -y " % binPath) # drop = no, exist = no, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) os.system("rm -rf ./insert_res.txt") os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") From e4a6d251d91892d8328460b1d09f501fa920d33e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 31 May 2021 18:00:14 +0800 Subject: [PATCH 06/46] [TD-4294] --- tests/pytest/functions/function_session.py | 85 ++++++++++++++ .../pytest/functions/function_stateWindow.py | 109 ++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 tests/pytest/functions/function_session.py create mode 100644 tests/pytest/functions/function_stateWindow.py diff --git a/tests/pytest/functions/function_session.py b/tests/pytest/functions/function_session.py new file mode 100644 index 0000000000..9165440737 --- /dev/null +++ b/tests/pytest/functions/function_session.py @@ -0,0 +1,85 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import * +from util.cases import * +from util.sql import * +#import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute("create table test1 using test tags('beijing')") + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + # operation not allowed on super table + tdSql.error("select count(*) from test session(ts, 1s)") + # operation not allowde on col pro + tdSql.error("select * from test1 session(ts, 1s)") + # operation not allowed on col except primary ts + tdSql.error("select * from test1 session(col1, 1s)") + + tdSql.query("select count(*) from test1 session(ts, 1s)") + + tdSql.checkRows(1) + tdSql.checkData(0, 1, 10) + # append more data + + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + 2000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + tdSql.query("select count(*) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 10) + tdSql.checkData(1, 1, 1) + + tdSql.query("select count(*) from test1 session(ts, 1m)") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 11) + + tdSql.query("select first(col1) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 1) + + tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 10) + tdSql.checkData(1, 1, 1) + tdSql.checkData(1, 1, 1) + + # add more function + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_stateWindow.py b/tests/pytest/functions/function_stateWindow.py new file mode 100644 index 0000000000..8f05b32164 --- /dev/null +++ b/tests/pytest/functions/function_stateWindow.py @@ -0,0 +1,109 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import * +from util.cases import * +from util.sql import * +#import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute("create table test1 using test tags('beijing')") + col0 = 0 + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i, col0, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + # operation not allowed on super table + tdSql.error("select count(*) from test session(ts, 1s)") + # operation not allowde on col pro + tdSql.error("select * from test1 session(ts, 1s)") + # operation not allowed on col except primary ts + tdSql.error("select * from test1 session(col1, 1s)") + + tdSql.query("select count(*) from test1 state_window(col1)") + + tdSql.checkRows(1) + tdSql.checkData(0, 0, self.rowNum) + # append more data + + col0 = col0 + 1 + for i in range(self.rowNum): + tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts + i + 10000, col0, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + + tdSql.query("select count(*) from test1 state_window(col1)") + + tdSql.checkRows(2) + tdSql.checkData(0, 0, self.rowNum) + tdSql.checkData(1, 0, self.rowNum) + + + tdSql.query("select first(col1) from test1 state_window(col1)") + tdSql.checkRows(2) + col0 = col0 - 1 + tdSql.checkData(0, 0, col0) + col0 = col0 + 1 + tdSql.checkData(1, 0, col0) + + tdSql.query("select first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 1) + tdSql.checkData(1, 0, 1) + + tdSql.query("select count(col1), first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 10) + tdSql.checkData(0, 1, 1) + + tdSql.checkData(1, 0, 10) + tdSql.checkData(1, 1, 1) + + + #tdSql.query("select count(*) from test1 session(ts, 1m)") + #tdSql.checkRows(1) + #tdSql.checkData(0, 1, 11) + + #tdSql.query("select first(col1) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(1, 1, 1) + + #tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(0, 2, 10) + #tdSql.checkData(1, 1, 1) + #tdSql.checkData(1, 1, 1) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From f6e0d1926f51961a5c0d2d1f875cfb7c32d8c074 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 31 May 2021 18:45:35 +0800 Subject: [PATCH 07/46] [TD-4294] --- tests/pytest/fulltest.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index c5aba24867..f069897ea9 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -314,6 +314,8 @@ python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py python3 ./test.py -f alter/alter_table.py python3 ./test.py -f query/queryGroupbySort.py +python3 ./test.py -f functions/function_session.py +python3 ./test.py -f functions/function_stateWindow.py python3 ./test.py -f insert/unsignedInt.py python3 ./test.py -f insert/unsignedBigint.py From 8543ac4e65ec0899837a6fd2c4944f6b1e888442 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 31 May 2021 20:48:09 +0800 Subject: [PATCH 08/46] [TD-4294] --- tests/pytest/functions/function_session.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pytest/functions/function_session.py b/tests/pytest/functions/function_session.py index 9165440737..21b6d088ff 100644 --- a/tests/pytest/functions/function_session.py +++ b/tests/pytest/functions/function_session.py @@ -68,6 +68,7 @@ class TDTestCase: tdSql.checkData(0, 1, 1) tdSql.checkData(1, 1, 1) + tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") tdSql.checkRows(2) tdSql.checkData(0, 1, 1) From 9c8507cd7c17d0419b45f268ed757170f23a4755 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 31 May 2021 23:29:59 +0800 Subject: [PATCH 09/46] [TD-4506] return valid msg when no db specified --- src/client/src/tscSQLParser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index f34434e66c..d255abe602 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7186,8 +7186,9 @@ static int32_t getTableNameFromSqlNode(SSqlNode* pSqlNode, SArray* tableNameList } SName name = {0}; - if (tscSetTableFullName(&name, t, pSql) != TSDB_CODE_SUCCESS) { - return invalidOperationMsg(msgBuf, msg1); + int32_t code = tscSetTableFullName(&name, t, pSql); + if (code != TSDB_CODE_SUCCESS) { + return code; } taosArrayPush(tableNameList, &name); From ce7bfcf02452a206c7236ceb9daab399585f5298 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Tue, 1 Jun 2021 08:28:45 +0800 Subject: [PATCH 10/46] fix case issue --- tests/pytest/query/queryInsertValue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/query/queryInsertValue.py b/tests/pytest/query/queryInsertValue.py index 856801b4ee..a6b2a88008 100644 --- a/tests/pytest/query/queryInsertValue.py +++ b/tests/pytest/query/queryInsertValue.py @@ -45,7 +45,7 @@ class TDTestCase: tdSql.query("select * from st") tdSql.checkRows(1) - tdSql.execute("alter table st add column length int") + tdSql.execute("alter table st add column len int") tdSql.execute("insert into t1 values(now, 1, 2)") tdSql.query("select last(*) from st") tdSql.checkData(0, 2, 2); From f26a6a23a56f78b3225dbf33b21c33be0ee7050d Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 1 Jun 2021 09:57:10 +0800 Subject: [PATCH 11/46] [TD-4422] adding test case for auto_create_table exception cases --- .../insert-drop-exist-auto-NN123.json | 60 +++++++++++++++++++ .../insert-drop-exist-auto-NY123.json | 60 +++++++++++++++++++ .../insert-drop-exist-auto-YN123.json | 60 +++++++++++++++++++ .../insert-drop-exist-auto-YY123.json | 60 +++++++++++++++++++ .../taosdemoTestInsertWithJson.py | 29 ++++++++- 5 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json new file mode 100644 index 0000000000..6a0e913590 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json new file mode 100644 index 0000000000..2b021a1595 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json new file mode 100644 index 0000000000..96c9cb07e0 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json new file mode 100644 index 0000000000..ffe7d74a37 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "stbEx_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 098c2e935e..eef6a74804 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -254,7 +254,6 @@ class TDTestCase: tdSql.checkData(0, 0, 15000) # insert: auto_create - # todo: add exception input for auto_create_table eg:123 os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json -y " % binPath) # drop = yes, exist = yes, auto_create = yes tdSql.execute('use db') tdSql.query('show tables') @@ -306,6 +305,34 @@ class TDTestCase: tdSql.query('show tables') tdSql.checkRows(20) + #the following four test cases are for the exception cases for param auto_create_table + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json -y " % binPath) # drop = no, exist = no, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json -y " % binPath) # drop = no, exist = yes, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(0) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json -y " % binPath) # drop = yes, exist = no, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json -y " % binPath) # drop = yes, exist = yes, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + os.system("rm -rf ./insert_res.txt") os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") From 9eb020f900f18befe5d6c3b181944c13a11e0d36 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 1 Jun 2021 18:02:32 +0800 Subject: [PATCH 12/46] [TD-4475] adding draft test case --- tests/pytest/manualTest/manual_alter_block.py | 70 +++++++++++++++++++ .../insert_5Mrows_small_cache.json | 60 ++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 tests/pytest/manualTest/manual_alter_block.py create mode 100644 tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py new file mode 100644 index 0000000000..a06e1bba6f --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -0,0 +1,70 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + tdSql.execute('alter database db blocks 8') + tdSql.query('show databases') + tdSql.checkData(0,9,3) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_small_cache.json" % binPath) + + input("please check memory usage for taosd. After checking, press enter") + + tdSql.execute('alter database db blocks 8') + + os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_small_cache.json" % binPath) + + input("please check memory usage for taosd. After checking, press enter") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json new file mode 100644 index 0000000000..d437735ebc --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 3, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10000, + "childtable_limit": 10, + "childtable_offset":100, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file From fd10ee01ed14ace0dc8f9059cb762a7090b56696 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 1 Jun 2021 18:30:13 +0800 Subject: [PATCH 13/46] [TD-4422] merging json files into 2 json files --- .../insert-drop-exist-auto-N00.json | 181 ++++++++++++++++++ .../insert-drop-exist-auto-Y00.json | 181 ++++++++++++++++++ .../taosdemoTestInsertWithJson.py | 91 +++------ 3 files changed, 386 insertions(+), 67 deletions(-) create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json create mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json new file mode 100644 index 0000000000..3ac8882699 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json new file mode 100644 index 0000000000..ffa1c91b82 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index eef6a74804..638a9c49b9 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -253,84 +253,41 @@ class TDTestCase: tdSql.query("select count (*) from stb0") tdSql.checkData(0, 0, 15000) - # insert: auto_create - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json -y " % binPath) # drop = yes, exist = yes, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json -y " % binPath) # drop = yes, exist = yes, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) + # # insert: auto_create - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json -y " % binPath) # drop = yes, exist = no, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json -y " % binPath) # drop = yes, exist = no, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - tdSql.execute('drop database db') + tdSql.execute('drop database if exists db') tdSql.execute('create database db') tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json -y " % binPath) # drop = no, exist = yes, auto_create = yes - tdSql.query('show tables') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(0) + tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(0) + tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(0) - tdSql.execute('drop database db') - tdSql.execute('create database db') + tdSql.execute('drop database if exists db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json -y " % binPath) # drop = no, exist = yes, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(0) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json -y " % binPath) # drop = no, exist = no, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') + tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123 tdSql.checkRows(20) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json -y " % binPath) # drop = no, exist = no, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') + tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no tdSql.checkRows(20) - - #the following four test cases are for the exception cases for param auto_create_table - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json -y " % binPath) # drop = no, exist = no, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') + tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes tdSql.checkRows(20) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json -y " % binPath) # drop = no, exist = yes, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(0) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json -y " % binPath) # drop = yes, exist = no, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') + tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json -y " % binPath) # drop = yes, exist = yes, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') + tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(20) os.system("rm -rf ./insert_res.txt") From 3ed6933ea86d08e5bf55ab1331d6a7ee662433db Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 1 Jun 2021 18:34:36 +0800 Subject: [PATCH 14/46] [TD-4422] remove useless file --- .../insert-drop-exist-auto-NN123.json | 60 ------------------- .../insert-drop-exist-auto-NNN.json | 60 ------------------- .../insert-drop-exist-auto-NNY.json | 60 ------------------- .../insert-drop-exist-auto-NY123.json | 60 ------------------- .../insert-drop-exist-auto-NYN.json | 60 ------------------- .../insert-drop-exist-auto-NYY.json | 60 ------------------- .../insert-drop-exist-auto-YN123.json | 60 ------------------- .../insert-drop-exist-auto-YNN.json | 60 ------------------- .../insert-drop-exist-auto-YNY.json | 60 ------------------- .../insert-drop-exist-auto-YY123.json | 60 ------------------- .../insert-drop-exist-auto-YYN.json | 60 ------------------- .../insert-drop-exist-auto-YYY.json | 60 ------------------- 12 files changed, 720 deletions(-) delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json delete mode 100644 tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json deleted file mode 100644 index 6a0e913590..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "123", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json deleted file mode 100644 index 659cbdb8ea..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "no", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json deleted file mode 100644 index 1459f484e1..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "yes", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json deleted file mode 100644 index 2b021a1595..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"yes", - "auto_create_table": "123", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json deleted file mode 100644 index 06a55eee43..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"yes", - "auto_create_table": "no", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json deleted file mode 100644 index deace85f58..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "no", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"yes", - "auto_create_table": "yes", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json deleted file mode 100644 index 96c9cb07e0..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "123", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json deleted file mode 100644 index 0339410c7c..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "no", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json deleted file mode 100644 index de04d5b9e6..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"no", - "auto_create_table": "yes", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json deleted file mode 100644 index ffe7d74a37..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"yes", - "auto_create_table": "123", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json deleted file mode 100644 index 1bde64760a..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "child_table_exists":"yes", - "auto_create_table": "no", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json deleted file mode 100644 index 77d7d7b927..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "filetype": "insert", - "cfgdir": "/etc/taos", - "host": "127.0.0.1", - "port": 6030, - "user": "root", - "password": "taosdata", - "thread_count": 4, - "thread_count_create_tbl": 4, - "result_file": "./insert_res.txt", - "confirm_parameter_prompt": "no", - "insert_interval": 0, - "interlace_rows": 100, - "num_of_records_per_req": 100, - "databases": [{ - "dbinfo": { - "name": "db", - "drop": "yes", - "replica": 1, - "days": 10, - "cache": 16, - "blocks": 8, - "precision": "ms", - "keep": 3650, - "minRows": 100, - "maxRows": 4096, - "comp":2, - "walLevel":1, - "cachelast":0, - "quorum":1, - "fsync":3000, - "update": 0 - }, - "super_tables": [{ - "name": "stb", - "auto_create_table": "yes", - "child_table_exists":"yes", - "childtable_count": 20, - "childtable_prefix": "stbEx_", - "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 5, - "childtable_limit": 40, - "childtable_offset":0, - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "now", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT"}] - }] - }] -} \ No newline at end of file From 08f33005b6d1b5d7048ce046e1475558627e832a Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Tue, 1 Jun 2021 19:02:34 +0800 Subject: [PATCH 15/46] [TD-4475] update test case --- tests/pytest/manualTest/manual_alter_block.py | 8 ++- .../taosdemoAllTest/insert_5Mrows_hasTB.json | 60 +++++++++++++++++++ ...all_cache.json => insert_5Mrows_noTB.json} | 0 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json rename tests/pytest/tools/taosdemoAllTest/{insert_5Mrows_small_cache.json => insert_5Mrows_noTB.json} (100%) diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py index a06e1bba6f..6d80006d7d 100644 --- a/tests/pytest/manualTest/manual_alter_block.py +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -47,17 +47,19 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - tdSql.execute('alter database db blocks 8') + tdSql.execute('alter database db blocks 3') tdSql.query('show databases') tdSql.checkData(0,9,3) - os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_small_cache.json" % binPath) + os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_noTB.json" % binPath) input("please check memory usage for taosd. After checking, press enter") tdSql.execute('alter database db blocks 8') + tdSql.query('show databases') + tdSql.checkData(0,9,8) - os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_small_cache.json" % binPath) + os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_hasTB.json" % binPath) input("please check memory usage for taosd. After checking, press enter") diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json new file mode 100644 index 0000000000..9d22dbaabe --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 3, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10000, + "childtable_limit": 500, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json similarity index 100% rename from tests/pytest/tools/taosdemoAllTest/insert_5Mrows_small_cache.json rename to tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json From a96e4cdc290468268cc5bba6321ce49d5d585c5b Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 08:31:46 +0800 Subject: [PATCH 16/46] fix bug --- src/mnode/src/mnodeMnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index ca6d6400ae..ae3a52c9a2 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -485,7 +485,7 @@ static int32_t mnodeGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE; + pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "end_point"); pSchema[cols].bytes = htons(pShow->bytes[cols]); From cd9183889b64778e7ac3d492a1040d6685a5a3cf Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 08:35:06 +0800 Subject: [PATCH 17/46] fix show dnodes long endpoint issue --- src/mnode/src/mnodeDnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index b513da29f4..6c66878811 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -799,7 +799,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE; + pShow->bytes[cols] = TSDB_EP_LEN + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "end_point"); pSchema[cols].bytes = htons(pShow->bytes[cols]); From 3b9d4dede71100efb0101aa0b865d200cdf95f19 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 2 Jun 2021 02:59:01 +0000 Subject: [PATCH 18/46] [TD-4443] join precision us --- tests/pytest/query/queryJoin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py index 59e01615b4..79560447e2 100644 --- a/tests/pytest/query/queryJoin.py +++ b/tests/pytest/query/queryJoin.py @@ -176,7 +176,15 @@ class TDTestCase: tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;") tdSql.error("select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t") - + #TD-4458 join on database which using precision us + tdSql.execute("create database test_join_us precision 'us'") + tdSql.execute("use test_join_us") + ts = 1538548685000000 + for i in range(2): + tdSql.execute("create table t%d (ts timestamp, i int)"%i) + tdSql.execute("insert into t%d values(%d,11)(%d,12)"%(i,ts,ts+1)) + tdSql.query("select t1.ts from t0,t1 where t0.ts = t1.ts") + tdSql.checkData(0,0,'2018-10-03 06:38:05.000000') def stop(self): tdSql.close() From 6439e9addca8be102bbf2353fc191e7dd4e650b5 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 11:55:16 +0800 Subject: [PATCH 19/46] [TD-4475] modifying the test case --- tests/pytest/manualTest/manual_alter_block.py | 3 +++ .../pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json | 8 ++++---- .../pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py index 6d80006d7d..0db74e160a 100644 --- a/tests/pytest/manualTest/manual_alter_block.py +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -15,6 +15,7 @@ import sys from util.log import * from util.cases import * from util.sql import * +from util.dnodes import tdDnodes class TDTestCase: @@ -58,6 +59,8 @@ class TDTestCase: tdSql.execute('alter database db blocks 8') tdSql.query('show databases') tdSql.checkData(0,9,8) + tdDnodes.stop(1) + tdDnodes.start(1) os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_hasTB.json" % binPath) diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json index 9d22dbaabe..2731e0505c 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json +++ b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json @@ -11,7 +11,7 @@ "confirm_parameter_prompt": "no", "insert_interval": 0, "interlace_rows": 100, - "num_of_records_per_req": 100, + "num_of_records_per_req": 32766, "databases": [{ "dbinfo": { "name": "db", @@ -40,7 +40,7 @@ "batch_create_tbl_num": 20, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 10000, + "insert_rows": 100000, "childtable_limit": 500, "childtable_offset":0, "interlace_rows": 0, @@ -48,8 +48,8 @@ "max_sql_len": 1024000, "disorder_ratio": 0, "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "2020-10-01 00:00:00.000", + "timestamp_step": 1, + "start_timestamp": "now", "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json index d437735ebc..8583b9a897 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json +++ b/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json @@ -11,7 +11,7 @@ "confirm_parameter_prompt": "no", "insert_interval": 0, "interlace_rows": 100, - "num_of_records_per_req": 100, + "num_of_records_per_req": 32766, "databases": [{ "dbinfo": { "name": "db", @@ -40,7 +40,7 @@ "batch_create_tbl_num": 20, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 10000, + "insert_rows": 100000, "childtable_limit": 10, "childtable_offset":100, "interlace_rows": 0, @@ -48,8 +48,8 @@ "max_sql_len": 1024000, "disorder_ratio": 0, "disorder_range": 1000, - "timestamp_step": 10, - "start_timestamp": "2020-10-01 00:00:00.000", + "timestamp_step": 1, + "start_timestamp": "2019-10-01 00:00:00.000", "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", From 29ca859f1160f20ae1514d8fba1578d043ce4a7d Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 13:37:36 +0800 Subject: [PATCH 20/46] [TD-4475] add manual test case for hot alter block --- tests/pytest/manualTest/manual_alter_block.py | 23 ++++++++++++------- ...rows_noTB.json => manual_block1_comp.json} | 8 +++---- ...t_5Mrows_hasTB.json => manual_block2.json} | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) rename tests/pytest/tools/taosdemoAllTest/{insert_5Mrows_noTB.json => manual_block1_comp.json} (84%) rename tests/pytest/tools/taosdemoAllTest/{insert_5Mrows_hasTB.json => manual_block2.json} (98%) diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py index 0db74e160a..ccd98b1421 100644 --- a/tests/pytest/manualTest/manual_alter_block.py +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -17,7 +17,8 @@ from util.cases import * from util.sql import * from util.dnodes import tdDnodes - +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -48,27 +49,33 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" + #alter cache block to 3, then check alter tdSql.execute('alter database db blocks 3') tdSql.query('show databases') tdSql.checkData(0,9,3) - os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_noTB.json" % binPath) - + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) input("please check memory usage for taosd. After checking, press enter") + #alter cache block to 8, then check alter tdSql.execute('alter database db blocks 8') tdSql.query('show databases') tdSql.checkData(0,9,8) - tdDnodes.stop(1) - tdDnodes.start(1) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert_5Mrows_hasTB.json" % binPath) + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block2.json" % binPath) input("please check memory usage for taosd. After checking, press enter") + ##expected result the peak memory consumption should increase by around 80MB = 5 blocks of cache + + ##test results + #2021/06/02 before:2621700K after: 2703640K memory usage increased by 80MB = 5 block + # confirm with the change in block. Baosheng Chang + def stop(self): tdSql.close() - tdLog.success("%s successfully executed" % __file__) + tdLog.debug("%s alter block manual check finish" % __file__) tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json similarity index 84% rename from tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json rename to tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json index 8583b9a897..3ced8272b2 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_noTB.json +++ b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json @@ -22,7 +22,7 @@ "blocks": 3, "precision": "ms", "keep": 3650, - "minRows": 100, + "minRows": 1000, "maxRows": 4096, "comp":2, "walLevel":1, @@ -40,7 +40,7 @@ "batch_create_tbl_num": 20, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 100000, + "insert_rows": 10000, "childtable_limit": 10, "childtable_offset":100, "interlace_rows": 0, @@ -53,8 +53,8 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}] + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json b/tests/pytest/tools/taosdemoAllTest/manual_block2.json similarity index 98% rename from tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json rename to tests/pytest/tools/taosdemoAllTest/manual_block2.json index 2731e0505c..434159159b 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert_5Mrows_hasTB.json +++ b/tests/pytest/tools/taosdemoAllTest/manual_block2.json @@ -19,7 +19,7 @@ "replica": 1, "days": 10, "cache": 16, - "blocks": 3, + "blocks": 8, "precision": "ms", "keep": 3650, "minRows": 100, From d4a215dd8a6fb5941beeddd0b5187b3fc3b705bd Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 2 Jun 2021 05:52:00 +0000 Subject: [PATCH 21/46] fix timezone error --- tests/pytest/query/queryJoin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py index 79560447e2..cd50a7bf45 100644 --- a/tests/pytest/query/queryJoin.py +++ b/tests/pytest/query/queryJoin.py @@ -184,7 +184,7 @@ class TDTestCase: tdSql.execute("create table t%d (ts timestamp, i int)"%i) tdSql.execute("insert into t%d values(%d,11)(%d,12)"%(i,ts,ts+1)) tdSql.query("select t1.ts from t0,t1 where t0.ts = t1.ts") - tdSql.checkData(0,0,'2018-10-03 06:38:05.000000') + tdSql.checkData(0,0,'2018-10-03 14:38:05.000000') def stop(self): tdSql.close() From b00ba324f34879b112195fe3d3d741926625e962 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 14:04:20 +0800 Subject: [PATCH 22/46] support modify tag column length --- src/client/src/tscSQLParser.c | 77 ++- src/inc/taosmsg.h | 1 + src/inc/ttokendef.h | 5 +- src/mnode/src/mnodeTable.c | 5 + src/query/inc/sql.y | 42 +- src/query/src/qSqlParser.c | 2 +- src/query/src/sql.c | 569 ++++++++++--------- src/util/src/ttokenizer.c | 2 +- tests/script/general/parser/alter_column.sim | 81 ++- 9 files changed, 472 insertions(+), 312 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 978fbaf521..80768b64f2 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5079,8 +5079,10 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg18 = "primary timestamp column cannot be dropped"; const char* msg19 = "invalid new tag name"; const char* msg20 = "table is not super table"; - const char* msg21 = "only binary/nchar column length could be altered"; - const char* msg22 = "invalid column length"; + const char* msg21 = "only binary/nchar column length could be modified"; + const char* msg22 = "new column length should be bigger than old one"; + const char* msg23 = "only column length coulbe be modified"; + const char* msg24 = "invalid binary/nchar column length"; int32_t code = TSDB_CODE_SUCCESS; @@ -5111,8 +5113,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN || - pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN) { - if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { + pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } } else if ((pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) && (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) { @@ -5334,14 +5336,18 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - if (taosArrayGetSize(pAlterSQL->pAddColumns) != 2) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), NULL); + if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16); } - tVariantListItem* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + + TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; - SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen}; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = strlen(pItem->name)}; if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); } @@ -5352,14 +5358,61 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); } - pItem = taosArrayGet(pAlterSQL->pAddColumns, 1); - int16_t nlen = 0; + if (pItem->type != pColSchema->type) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23); + } - if (tVariantDump(&pItem->pVar, (char *)&nlen, TSDB_DATA_TYPE_SMALLINT, false) < 0 || nlen <= 0) { + if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) || + (pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24); + } + + if (pItem->bytes <= pColSchema->bytes) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } - TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, nlen); + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); + tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + }else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16); + } + + TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0); + if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = strlen(pItem->name)}; + if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); + } + + SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); + + if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10); + } + + if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21); + } + + if (pItem->type != pColSchema->type) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23); + } + + if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) || + (pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24); + } + + if (pItem->bytes <= pColSchema->bytes) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); + } + + TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index ff3cc6e956..413f72720e 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -161,6 +161,7 @@ enum _mgmt_table { #define TSDB_ALTER_TABLE_ADD_COLUMN 5 #define TSDB_ALTER_TABLE_DROP_COLUMN 6 #define TSDB_ALTER_TABLE_CHANGE_COLUMN 7 +#define TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN 8 #define TSDB_FILL_NONE 0 #define TSDB_FILL_NULL 1 diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index e5f1472317..e0c9abed18 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -155,7 +155,7 @@ #define TK_SYNCDB 136 #define TK_ADD 137 #define TK_COLUMN 138 -#define TK_LENGTH 139 +#define TK_MODIFY 139 #define TK_TAG 140 #define TK_CHANGE 141 #define TK_SET 142 @@ -211,6 +211,9 @@ + + + #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 6eca87514b..5b699c5e24 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -3218,6 +3218,11 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { (void)mnodeChangeSuperTableColumn; mError("change table[%s] column[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); code = TSDB_CODE_SUCCESS; + } else if (pAlter->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { + //code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); + (void)mnodeChangeSuperTableColumn; + mError("change table[%s] tag[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); + code = TSDB_CODE_SUCCESS; } else { } } else { diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 3a6e1c0cc0..1b173a272f 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -754,15 +754,9 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -cmd ::= ALTER TABLE ids(X) cpxName(F) ALTER COLUMN LENGTH ids(A) INTEGER(Z). { +cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). { X.n += F.n; - - toTSDBType(A.type); - SArray* K = tVariantListAppendToken(NULL, &A, -1); - toTSDBType(Z.type); - K = tVariantListAppendToken(K, &Z, -1); - - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -806,6 +800,11 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} ///////////////////////////////////ALTER STABLE statement////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). { @@ -824,15 +823,9 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } -cmd ::= ALTER STABLE ids(X) cpxName(F) ALTER COLUMN LENGTH ids(A) INTEGER(Z). { +cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). { X.n += F.n; - - toTSDBType(A.type); - SArray* K = tVariantListAppendToken(NULL, &A, -1); - toTSDBType(Z.type); - K = tVariantListAppendToken(K, &Z, -1); - - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -865,6 +858,23 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } +cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { + X.n += F.n; + + toTSDBType(Y.type); + SArray* A = tVariantListAppendToken(NULL, &Y, -1); + A = tVariantListAppend(A, &Z, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + +cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). { + X.n += F.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + ////////////////////////////////////////kill statement/////////////////////////////////////// cmd ::= KILL CONNECTION INTEGER(Y). {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &Y);} cmd ::= KILL STREAM INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &X);} diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index b912c9ffdc..d41b474953 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -887,7 +887,7 @@ SAlterTableInfo *tSetAlterTableInfo(SStrToken *pTableName, SArray *pCols, SArray pAlterTable->type = type; pAlterTable->tableType = tableType; - if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { + if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || type == TSDB_ALTER_TABLE_CHANGE_COLUMN || type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { pAlterTable->pAddColumns = pCols; assert(pVals == NULL); } else { diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 560e499228..588da79883 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -136,18 +136,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 331 -#define YYNRULE 275 -#define YYNRULE_WITH_ACTION 275 +#define YYNSTATE 337 +#define YYNRULE 278 +#define YYNRULE_WITH_ACTION 278 #define YYNTOKEN 188 -#define YY_MAX_SHIFT 330 -#define YY_MIN_SHIFTREDUCE 528 -#define YY_MAX_SHIFTREDUCE 802 -#define YY_ERROR_ACTION 803 -#define YY_ACCEPT_ACTION 804 -#define YY_NO_ACTION 805 -#define YY_MIN_REDUCE 806 -#define YY_MAX_REDUCE 1080 +#define YY_MAX_SHIFT 336 +#define YY_MIN_SHIFTREDUCE 533 +#define YY_MAX_SHIFTREDUCE 810 +#define YY_ERROR_ACTION 811 +#define YY_ACCEPT_ACTION 812 +#define YY_NO_ACTION 813 +#define YY_MIN_REDUCE 814 +#define YY_MAX_REDUCE 1091 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -214,78 +214,79 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (697) +#define YY_ACTTAB_COUNT (707) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 974, 576, 211, 328, 70, 18, 217, 965, 188, 577, - /* 10 */ 804, 330, 186, 48, 49, 146, 52, 53, 220, 1060, - /* 20 */ 223, 42, 214, 51, 272, 56, 54, 58, 55, 939, - /* 30 */ 655, 188, 953, 47, 46, 188, 938, 45, 44, 43, - /* 40 */ 48, 49, 1059, 52, 53, 219, 1060, 223, 42, 576, - /* 50 */ 51, 272, 56, 54, 58, 55, 965, 577, 304, 303, - /* 60 */ 47, 46, 971, 146, 45, 44, 43, 49, 31, 52, - /* 70 */ 53, 250, 139, 223, 42, 83, 51, 272, 56, 54, - /* 80 */ 58, 55, 288, 1009, 88, 267, 47, 46, 72, 314, - /* 90 */ 45, 44, 43, 529, 530, 531, 532, 533, 534, 535, - /* 100 */ 536, 537, 538, 539, 540, 541, 329, 235, 288, 212, - /* 110 */ 71, 576, 949, 48, 49, 31, 52, 53, 941, 577, - /* 120 */ 223, 42, 576, 51, 272, 56, 54, 58, 55, 269, - /* 130 */ 577, 81, 744, 47, 46, 257, 256, 45, 44, 43, - /* 140 */ 48, 50, 951, 52, 53, 146, 192, 223, 42, 77, - /* 150 */ 51, 272, 56, 54, 58, 55, 213, 37, 947, 950, - /* 160 */ 47, 46, 1, 160, 45, 44, 43, 24, 286, 323, - /* 170 */ 322, 285, 284, 283, 321, 282, 320, 319, 318, 281, - /* 180 */ 317, 316, 913, 31, 901, 902, 903, 904, 905, 906, - /* 190 */ 907, 908, 909, 910, 911, 912, 914, 915, 52, 53, - /* 200 */ 229, 29, 223, 42, 278, 51, 272, 56, 54, 58, - /* 210 */ 55, 694, 19, 1008, 25, 47, 46, 746, 965, 45, - /* 220 */ 44, 43, 222, 759, 226, 31, 748, 950, 751, 197, - /* 230 */ 754, 222, 759, 215, 13, 748, 198, 751, 87, 754, - /* 240 */ 84, 123, 122, 196, 45, 44, 43, 110, 56, 54, - /* 250 */ 58, 55, 314, 747, 208, 209, 47, 46, 271, 74, - /* 260 */ 45, 44, 43, 208, 209, 75, 227, 253, 24, 950, - /* 270 */ 323, 322, 77, 253, 750, 321, 753, 320, 319, 318, - /* 280 */ 37, 317, 316, 921, 1056, 679, 919, 920, 676, 698, - /* 290 */ 677, 922, 678, 924, 925, 923, 85, 926, 927, 108, - /* 300 */ 101, 113, 249, 691, 69, 31, 112, 118, 121, 111, - /* 310 */ 8, 205, 5, 34, 162, 115, 237, 238, 273, 161, - /* 320 */ 95, 90, 94, 31, 234, 57, 232, 936, 937, 30, - /* 330 */ 940, 301, 760, 293, 57, 180, 178, 176, 756, 31, - /* 340 */ 31, 760, 175, 126, 125, 124, 294, 756, 146, 950, - /* 350 */ 242, 47, 46, 1055, 755, 45, 44, 43, 1054, 246, - /* 360 */ 245, 228, 230, 755, 295, 324, 749, 950, 752, 852, - /* 370 */ 327, 326, 131, 172, 137, 135, 134, 3, 173, 1071, - /* 380 */ 302, 306, 221, 950, 950, 861, 757, 953, 953, 172, - /* 390 */ 62, 953, 853, 236, 680, 233, 172, 298, 297, 290, - /* 400 */ 725, 726, 251, 710, 716, 717, 32, 141, 61, 21, - /* 410 */ 65, 780, 63, 761, 763, 20, 82, 20, 665, 275, - /* 420 */ 667, 277, 32, 32, 61, 86, 6, 100, 666, 99, - /* 430 */ 66, 15, 61, 14, 107, 68, 106, 654, 206, 683, - /* 440 */ 17, 684, 16, 681, 207, 682, 120, 119, 952, 190, - /* 450 */ 191, 193, 187, 194, 195, 201, 202, 200, 185, 1019, - /* 460 */ 199, 189, 1018, 224, 40, 1015, 1014, 225, 305, 247, - /* 470 */ 138, 973, 156, 984, 1001, 981, 982, 966, 758, 254, - /* 480 */ 1000, 986, 140, 144, 136, 948, 157, 258, 148, 216, - /* 490 */ 709, 917, 963, 147, 149, 946, 150, 151, 158, 266, - /* 500 */ 159, 864, 280, 260, 265, 67, 64, 59, 38, 270, - /* 510 */ 183, 35, 289, 264, 268, 860, 1077, 96, 291, 1076, - /* 520 */ 1073, 163, 262, 296, 1070, 103, 299, 1069, 1066, 164, - /* 530 */ 882, 36, 33, 39, 184, 849, 114, 847, 116, 117, - /* 540 */ 845, 844, 239, 174, 842, 841, 840, 839, 838, 837, - /* 550 */ 177, 179, 41, 834, 832, 830, 828, 181, 825, 182, - /* 560 */ 259, 252, 315, 73, 78, 109, 261, 1002, 307, 308, - /* 570 */ 309, 310, 311, 312, 210, 313, 231, 325, 279, 802, - /* 580 */ 241, 240, 801, 204, 203, 243, 91, 92, 244, 800, - /* 590 */ 843, 786, 785, 248, 127, 274, 253, 686, 836, 167, - /* 600 */ 128, 166, 883, 165, 168, 169, 171, 129, 170, 835, - /* 610 */ 2, 130, 9, 827, 826, 26, 76, 4, 255, 79, - /* 620 */ 711, 152, 153, 154, 155, 929, 142, 218, 714, 143, - /* 630 */ 80, 263, 764, 718, 145, 10, 11, 762, 27, 7, - /* 640 */ 28, 12, 22, 276, 23, 89, 618, 87, 614, 612, - /* 650 */ 611, 610, 607, 580, 287, 93, 97, 796, 32, 789, - /* 660 */ 657, 656, 653, 98, 60, 102, 602, 600, 592, 598, - /* 670 */ 594, 292, 596, 590, 104, 588, 621, 620, 619, 617, - /* 680 */ 105, 300, 616, 615, 613, 609, 608, 61, 578, 545, - /* 690 */ 132, 543, 806, 805, 805, 805, 133, + /* 0 */ 982, 581, 215, 334, 75, 22, 221, 973, 192, 582, + /* 10 */ 812, 336, 190, 52, 53, 150, 56, 57, 224, 1068, + /* 20 */ 227, 46, 218, 55, 278, 60, 58, 62, 59, 947, + /* 30 */ 660, 192, 961, 51, 50, 192, 946, 49, 48, 47, + /* 40 */ 52, 53, 1067, 56, 57, 223, 1068, 227, 46, 581, + /* 50 */ 55, 278, 60, 58, 62, 59, 973, 582, 310, 309, + /* 60 */ 51, 50, 979, 150, 49, 48, 47, 53, 35, 56, + /* 70 */ 57, 256, 143, 227, 46, 88, 55, 278, 60, 58, + /* 80 */ 62, 59, 294, 1017, 93, 273, 51, 50, 77, 320, + /* 90 */ 49, 48, 47, 534, 535, 536, 537, 538, 539, 540, + /* 100 */ 541, 542, 543, 544, 545, 546, 335, 241, 294, 216, + /* 110 */ 76, 581, 957, 52, 53, 35, 56, 57, 949, 582, + /* 120 */ 227, 46, 581, 55, 278, 60, 58, 62, 59, 275, + /* 130 */ 582, 86, 749, 51, 50, 263, 262, 49, 48, 47, + /* 140 */ 52, 54, 959, 56, 57, 150, 196, 227, 46, 82, + /* 150 */ 55, 278, 60, 58, 62, 59, 217, 41, 955, 958, + /* 160 */ 51, 50, 1, 164, 49, 48, 47, 28, 292, 329, + /* 170 */ 328, 291, 290, 289, 327, 288, 326, 325, 324, 287, + /* 180 */ 323, 322, 921, 35, 909, 910, 911, 912, 913, 914, + /* 190 */ 915, 916, 917, 918, 919, 920, 922, 923, 56, 57, + /* 200 */ 233, 1064, 227, 46, 696, 55, 278, 60, 58, 62, + /* 210 */ 59, 8, 23, 1016, 29, 51, 50, 1063, 973, 49, + /* 220 */ 48, 47, 226, 764, 230, 35, 753, 958, 756, 201, + /* 230 */ 759, 226, 764, 219, 1062, 753, 202, 756, 755, 759, + /* 240 */ 758, 127, 126, 200, 49, 48, 47, 210, 60, 58, + /* 250 */ 62, 59, 3, 177, 212, 213, 51, 50, 277, 79, + /* 260 */ 49, 48, 47, 212, 213, 80, 231, 259, 28, 958, + /* 270 */ 329, 328, 82, 259, 754, 327, 757, 326, 325, 324, + /* 280 */ 41, 323, 322, 929, 114, 684, 927, 928, 681, 320, + /* 290 */ 682, 930, 683, 932, 933, 931, 90, 934, 935, 112, + /* 300 */ 106, 117, 255, 150, 74, 35, 116, 122, 125, 115, + /* 310 */ 237, 209, 5, 38, 166, 119, 243, 244, 211, 165, + /* 320 */ 100, 95, 99, 35, 240, 61, 225, 944, 945, 34, + /* 330 */ 948, 35, 765, 35, 61, 184, 182, 180, 761, 232, + /* 340 */ 234, 765, 179, 130, 129, 128, 299, 761, 35, 958, + /* 350 */ 762, 51, 50, 699, 760, 49, 48, 47, 35, 248, + /* 360 */ 35, 330, 35, 760, 300, 961, 961, 958, 252, 251, + /* 370 */ 6, 87, 301, 279, 302, 958, 13, 958, 194, 238, + /* 380 */ 92, 236, 89, 298, 297, 70, 763, 961, 751, 306, + /* 390 */ 124, 123, 958, 242, 685, 239, 860, 305, 304, 307, + /* 400 */ 176, 308, 958, 312, 958, 71, 958, 333, 332, 135, + /* 410 */ 141, 139, 138, 869, 257, 861, 67, 176, 36, 176, + /* 420 */ 730, 731, 715, 1087, 752, 721, 145, 195, 722, 66, + /* 430 */ 785, 703, 25, 766, 24, 670, 281, 24, 68, 36, + /* 440 */ 36, 672, 283, 671, 197, 66, 91, 66, 33, 191, + /* 450 */ 15, 284, 14, 105, 73, 104, 659, 198, 199, 17, + /* 460 */ 19, 16, 18, 205, 111, 21, 110, 20, 688, 768, + /* 470 */ 689, 686, 206, 687, 204, 1079, 960, 189, 203, 193, + /* 480 */ 1027, 1026, 228, 253, 1023, 1022, 229, 311, 142, 981, + /* 490 */ 992, 989, 44, 990, 994, 974, 260, 144, 1009, 148, + /* 500 */ 140, 160, 956, 1008, 161, 264, 925, 220, 266, 714, + /* 510 */ 954, 321, 971, 156, 151, 162, 152, 158, 276, 153, + /* 520 */ 163, 271, 63, 872, 286, 42, 187, 72, 69, 274, + /* 530 */ 39, 295, 868, 154, 296, 272, 1086, 102, 1085, 270, + /* 540 */ 1082, 268, 167, 303, 1078, 108, 1077, 1074, 168, 265, + /* 550 */ 890, 40, 37, 43, 188, 857, 118, 855, 120, 121, + /* 560 */ 853, 852, 245, 178, 850, 849, 848, 847, 846, 845, + /* 570 */ 181, 183, 842, 840, 838, 836, 185, 833, 45, 186, + /* 580 */ 113, 258, 78, 83, 313, 267, 1010, 314, 315, 316, + /* 590 */ 317, 318, 319, 214, 235, 331, 810, 285, 246, 247, + /* 600 */ 809, 207, 208, 96, 97, 249, 250, 808, 791, 790, + /* 610 */ 254, 81, 259, 851, 691, 280, 844, 171, 170, 891, + /* 620 */ 169, 172, 174, 173, 175, 131, 132, 133, 843, 4, + /* 630 */ 134, 835, 9, 834, 30, 261, 2, 716, 84, 146, + /* 640 */ 155, 157, 937, 159, 719, 85, 222, 147, 269, 31, + /* 650 */ 723, 149, 32, 767, 10, 7, 11, 769, 12, 26, + /* 660 */ 282, 27, 94, 623, 92, 619, 617, 616, 615, 612, + /* 670 */ 585, 293, 98, 64, 101, 36, 662, 661, 658, 607, + /* 680 */ 605, 65, 103, 597, 603, 599, 601, 595, 593, 107, + /* 690 */ 109, 626, 625, 624, 622, 621, 620, 618, 614, 613, + /* 700 */ 583, 66, 550, 548, 814, 136, 137, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 191, 1, 190, 191, 197, 252, 210, 234, 252, 9, @@ -308,57 +309,57 @@ static const YYCODETYPE yy_lookahead[] = { /* 170 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216, /* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17, - /* 200 */ 233, 104, 20, 21, 107, 23, 24, 25, 26, 27, - /* 210 */ 28, 37, 44, 259, 104, 33, 34, 1, 234, 37, + /* 200 */ 233, 252, 20, 21, 109, 23, 24, 25, 26, 27, + /* 210 */ 28, 116, 44, 259, 104, 33, 34, 252, 234, 37, /* 220 */ 38, 39, 1, 2, 232, 191, 5, 235, 7, 61, - /* 230 */ 9, 1, 2, 249, 104, 5, 68, 7, 108, 9, - /* 240 */ 110, 73, 74, 75, 37, 38, 39, 76, 25, 26, - /* 250 */ 27, 28, 81, 37, 33, 34, 33, 34, 37, 105, + /* 230 */ 9, 1, 2, 249, 252, 5, 68, 7, 5, 9, + /* 240 */ 7, 73, 74, 75, 37, 38, 39, 252, 25, 26, + /* 250 */ 27, 28, 194, 195, 33, 34, 33, 34, 37, 105, /* 260 */ 37, 38, 39, 33, 34, 105, 232, 113, 88, 235, /* 270 */ 90, 91, 104, 113, 5, 95, 7, 97, 98, 99, - /* 280 */ 112, 101, 102, 209, 252, 2, 212, 213, 5, 115, + /* 280 */ 112, 101, 102, 209, 76, 2, 212, 213, 5, 81, /* 290 */ 7, 217, 9, 219, 220, 221, 197, 223, 224, 62, - /* 300 */ 63, 64, 134, 109, 136, 191, 69, 70, 71, 72, - /* 310 */ 116, 143, 62, 63, 64, 78, 33, 34, 15, 69, - /* 320 */ 70, 71, 72, 191, 68, 104, 68, 228, 229, 230, - /* 330 */ 231, 75, 111, 75, 104, 62, 63, 64, 117, 191, - /* 340 */ 191, 111, 69, 70, 71, 72, 232, 117, 191, 235, - /* 350 */ 135, 33, 34, 252, 133, 37, 38, 39, 252, 144, - /* 360 */ 145, 210, 210, 133, 232, 210, 5, 235, 7, 196, - /* 370 */ 65, 66, 67, 200, 62, 63, 64, 194, 195, 236, - /* 380 */ 232, 232, 60, 235, 235, 196, 117, 236, 236, 200, - /* 390 */ 109, 236, 196, 137, 111, 137, 200, 141, 142, 141, - /* 400 */ 124, 125, 105, 105, 105, 105, 109, 109, 109, 109, - /* 410 */ 109, 105, 131, 105, 111, 109, 259, 109, 105, 105, - /* 420 */ 105, 105, 109, 109, 109, 109, 104, 138, 105, 140, - /* 430 */ 129, 138, 109, 140, 138, 104, 140, 106, 252, 5, - /* 440 */ 138, 7, 140, 5, 252, 7, 76, 77, 236, 252, - /* 450 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 227, - /* 460 */ 252, 252, 227, 227, 251, 227, 227, 227, 227, 191, - /* 470 */ 191, 191, 238, 191, 260, 191, 191, 234, 117, 234, - /* 480 */ 260, 191, 191, 191, 60, 234, 191, 256, 246, 256, - /* 490 */ 117, 225, 248, 247, 245, 191, 244, 243, 191, 121, - /* 500 */ 191, 191, 191, 256, 256, 128, 130, 127, 191, 122, - /* 510 */ 191, 191, 191, 120, 126, 191, 191, 191, 191, 191, - /* 520 */ 191, 191, 119, 191, 191, 191, 191, 191, 191, 191, - /* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 550 */ 191, 191, 132, 191, 191, 191, 191, 191, 191, 191, - /* 560 */ 118, 192, 103, 192, 192, 87, 192, 192, 86, 50, - /* 570 */ 83, 85, 54, 84, 192, 82, 192, 79, 192, 5, - /* 580 */ 5, 146, 5, 192, 192, 146, 197, 197, 5, 5, - /* 590 */ 192, 90, 89, 135, 193, 107, 113, 105, 192, 202, - /* 600 */ 193, 206, 208, 207, 205, 203, 201, 193, 204, 192, - /* 610 */ 198, 193, 104, 192, 192, 104, 114, 194, 109, 109, - /* 620 */ 105, 242, 241, 240, 239, 225, 104, 1, 105, 109, - /* 630 */ 104, 104, 111, 105, 104, 123, 123, 105, 109, 104, - /* 640 */ 109, 104, 104, 107, 104, 76, 9, 108, 5, 5, - /* 650 */ 5, 5, 5, 80, 15, 76, 140, 5, 109, 5, - /* 660 */ 5, 5, 105, 139, 16, 140, 5, 5, 5, 5, - /* 670 */ 5, 138, 5, 5, 140, 5, 5, 5, 5, 5, - /* 680 */ 139, 138, 5, 5, 5, 5, 5, 109, 80, 60, - /* 690 */ 21, 59, 0, 264, 264, 264, 21, 264, 264, 264, - /* 700 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + /* 300 */ 63, 64, 134, 191, 136, 191, 69, 70, 71, 72, + /* 310 */ 68, 143, 62, 63, 64, 78, 33, 34, 252, 69, + /* 320 */ 70, 71, 72, 191, 68, 104, 60, 228, 229, 230, + /* 330 */ 231, 191, 111, 191, 104, 62, 63, 64, 117, 210, + /* 340 */ 210, 111, 69, 70, 71, 72, 232, 117, 191, 235, + /* 350 */ 117, 33, 34, 37, 133, 37, 38, 39, 191, 135, + /* 360 */ 191, 210, 191, 133, 232, 236, 236, 235, 144, 145, + /* 370 */ 104, 259, 232, 15, 232, 235, 104, 235, 252, 137, + /* 380 */ 108, 139, 110, 141, 142, 109, 117, 236, 1, 232, + /* 390 */ 76, 77, 235, 137, 111, 139, 196, 141, 142, 232, + /* 400 */ 200, 232, 235, 232, 235, 129, 235, 65, 66, 67, + /* 410 */ 62, 63, 64, 196, 105, 196, 109, 200, 109, 200, + /* 420 */ 124, 125, 105, 236, 37, 105, 109, 252, 105, 109, + /* 430 */ 105, 115, 109, 105, 109, 105, 105, 109, 131, 109, + /* 440 */ 109, 105, 105, 105, 252, 109, 109, 109, 104, 252, + /* 450 */ 138, 107, 140, 138, 104, 140, 106, 252, 252, 138, + /* 460 */ 138, 140, 140, 252, 138, 138, 140, 140, 5, 111, + /* 470 */ 7, 5, 252, 7, 252, 236, 236, 252, 252, 252, + /* 480 */ 227, 227, 227, 191, 227, 227, 227, 227, 191, 191, + /* 490 */ 191, 191, 251, 191, 191, 234, 234, 191, 260, 191, + /* 500 */ 60, 238, 234, 260, 191, 256, 225, 256, 256, 117, + /* 510 */ 191, 103, 248, 242, 247, 191, 246, 240, 122, 245, + /* 520 */ 191, 256, 127, 191, 191, 191, 191, 128, 130, 126, + /* 530 */ 191, 191, 191, 244, 191, 121, 191, 191, 191, 120, + /* 540 */ 191, 119, 191, 191, 191, 191, 191, 191, 191, 118, + /* 550 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + /* 560 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + /* 570 */ 191, 191, 191, 191, 191, 191, 191, 191, 132, 191, + /* 580 */ 87, 192, 192, 192, 86, 192, 192, 50, 83, 85, + /* 590 */ 54, 84, 82, 192, 192, 79, 5, 192, 146, 5, + /* 600 */ 5, 192, 192, 197, 197, 146, 5, 5, 90, 89, + /* 610 */ 135, 114, 113, 192, 105, 107, 192, 202, 206, 208, + /* 620 */ 207, 205, 204, 203, 201, 193, 193, 193, 192, 194, + /* 630 */ 193, 192, 104, 192, 104, 109, 198, 105, 109, 104, + /* 640 */ 243, 241, 225, 239, 105, 104, 1, 109, 104, 109, + /* 650 */ 105, 104, 109, 105, 123, 104, 123, 111, 104, 104, + /* 660 */ 107, 104, 76, 9, 108, 5, 5, 5, 5, 5, + /* 670 */ 80, 15, 76, 16, 140, 109, 5, 5, 105, 5, + /* 680 */ 5, 16, 140, 5, 5, 5, 5, 5, 5, 140, + /* 690 */ 140, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 700 */ 80, 109, 60, 59, 0, 21, 21, 264, 264, 264, /* 710 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 720 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 730 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, @@ -376,106 +377,107 @@ static const YYCODETYPE yy_lookahead[] = { /* 850 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 860 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, /* 870 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, - /* 880 */ 264, 264, 264, 264, 264, + /* 880 */ 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + /* 890 */ 264, 264, 264, 264, 264, }; -#define YY_SHIFT_COUNT (330) +#define YY_SHIFT_COUNT (336) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (692) +#define YY_SHIFT_MAX (704) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 168, 79, 79, 180, 180, 3, 221, 230, 110, 121, - /* 10 */ 121, 121, 121, 121, 121, 121, 121, 121, 0, 48, - /* 20 */ 230, 283, 283, 283, 283, 45, 45, 121, 121, 121, - /* 30 */ 29, 121, 121, 171, 3, 8, 8, 697, 697, 697, - /* 40 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, + /* 10 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + /* 20 */ 121, 121, 0, 48, 230, 283, 283, 283, 283, 45, + /* 30 */ 45, 121, 121, 121, 29, 121, 121, 208, 3, 8, + /* 40 */ 8, 707, 707, 707, 230, 230, 230, 230, 230, 230, /* 50 */ 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, - /* 60 */ 283, 283, 25, 25, 25, 25, 25, 25, 25, 121, - /* 70 */ 121, 121, 174, 121, 121, 121, 45, 45, 121, 121, - /* 80 */ 121, 276, 276, 194, 45, 121, 121, 121, 121, 121, + /* 60 */ 230, 230, 230, 230, 283, 283, 283, 25, 25, 25, + /* 70 */ 25, 25, 25, 25, 121, 121, 121, 316, 121, 121, + /* 80 */ 121, 45, 45, 121, 121, 121, 296, 296, 95, 45, /* 90 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 100 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 110 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, /* 120 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - /* 130 */ 121, 121, 121, 121, 121, 121, 121, 121, 424, 424, - /* 140 */ 424, 373, 373, 373, 424, 373, 424, 377, 376, 380, - /* 150 */ 387, 388, 378, 393, 403, 442, 420, 424, 424, 424, - /* 160 */ 459, 3, 3, 424, 424, 478, 482, 519, 487, 486, - /* 170 */ 518, 489, 493, 459, 424, 498, 498, 424, 498, 424, - /* 180 */ 498, 424, 424, 697, 697, 27, 100, 127, 100, 100, - /* 190 */ 53, 182, 223, 223, 223, 223, 237, 250, 273, 318, - /* 200 */ 318, 318, 318, 256, 258, 215, 207, 207, 269, 361, - /* 210 */ 130, 305, 312, 297, 154, 160, 298, 299, 300, 306, - /* 220 */ 308, 216, 322, 303, 281, 301, 313, 314, 315, 316, - /* 230 */ 323, 97, 289, 293, 296, 331, 302, 434, 438, 370, - /* 240 */ 574, 435, 575, 577, 439, 583, 584, 501, 503, 458, - /* 250 */ 483, 488, 508, 502, 492, 511, 509, 510, 515, 522, - /* 260 */ 523, 520, 526, 626, 527, 528, 530, 529, 512, 531, - /* 270 */ 513, 532, 535, 521, 537, 488, 538, 536, 540, 539, - /* 280 */ 569, 637, 643, 644, 645, 646, 647, 573, 639, 579, - /* 290 */ 516, 652, 524, 533, 549, 549, 648, 525, 534, 654, - /* 300 */ 541, 543, 549, 655, 656, 557, 549, 661, 662, 663, - /* 310 */ 664, 665, 667, 668, 670, 671, 672, 673, 674, 677, - /* 320 */ 678, 679, 680, 681, 578, 608, 669, 675, 629, 632, - /* 330 */ 692, + /* 130 */ 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + /* 140 */ 121, 121, 440, 440, 440, 392, 392, 392, 440, 392, + /* 150 */ 440, 399, 398, 395, 396, 403, 414, 419, 422, 431, + /* 160 */ 446, 440, 440, 440, 408, 3, 3, 440, 440, 493, + /* 170 */ 498, 537, 505, 504, 536, 507, 510, 408, 440, 516, + /* 180 */ 516, 440, 516, 440, 516, 440, 440, 707, 707, 27, + /* 190 */ 100, 127, 100, 100, 53, 182, 223, 223, 223, 223, + /* 200 */ 237, 250, 273, 318, 318, 318, 318, 242, 256, 224, + /* 210 */ 207, 207, 233, 269, 272, 342, 348, 309, 154, 160, + /* 220 */ 317, 320, 323, 325, 328, 387, 266, 358, 307, 276, + /* 230 */ 330, 331, 336, 337, 338, 344, 312, 315, 321, 322, + /* 240 */ 326, 350, 327, 463, 466, 314, 591, 452, 594, 595, + /* 250 */ 459, 601, 602, 518, 520, 475, 499, 508, 528, 497, + /* 260 */ 509, 530, 526, 529, 532, 535, 539, 538, 541, 645, + /* 270 */ 544, 545, 547, 540, 531, 543, 533, 548, 551, 546, + /* 280 */ 554, 508, 555, 553, 557, 556, 586, 654, 660, 661, + /* 290 */ 662, 663, 664, 590, 656, 596, 657, 534, 542, 566, + /* 300 */ 566, 566, 566, 665, 549, 550, 566, 566, 566, 671, + /* 310 */ 672, 573, 566, 674, 675, 678, 679, 680, 681, 682, + /* 320 */ 683, 686, 687, 688, 689, 690, 691, 692, 693, 694, + /* 330 */ 592, 620, 684, 685, 642, 644, 704, }; -#define YY_REDUCE_COUNT (184) +#define YY_REDUCE_COUNT (188) #define YY_REDUCE_MIN (-247) -#define YY_REDUCE_MAX (423) +#define YY_REDUCE_MAX (441) static const short yy_reduce_ofst[] = { /* 0 */ -178, -27, -27, 74, 74, 99, -244, -217, -119, -76, - /* 10 */ -176, -128, -8, 34, 114, 132, 148, 149, -191, -188, - /* 20 */ -221, -204, 151, 152, 155, -227, -16, -46, 157, -33, - /* 30 */ -113, -84, -123, 173, -193, 189, 196, -162, -36, 183, - /* 40 */ -247, -240, -106, 32, 101, 106, 186, 192, 197, 198, - /* 50 */ 199, 200, 201, 202, 203, 204, 205, 206, 208, 209, - /* 60 */ 143, 212, 232, 235, 236, 238, 239, 240, 241, 278, - /* 70 */ 279, 280, 213, 282, 284, 285, 243, 245, 290, 291, - /* 80 */ 292, 214, 220, 234, 251, 295, 304, 307, 309, 310, - /* 90 */ 311, 317, 319, 320, 321, 324, 325, 326, 327, 328, - /* 100 */ 329, 330, 332, 333, 334, 335, 336, 337, 338, 339, - /* 110 */ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, - /* 120 */ 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - /* 130 */ 360, 362, 363, 364, 365, 366, 367, 368, 369, 371, - /* 140 */ 372, 231, 233, 247, 374, 248, 375, 244, 246, 242, - /* 150 */ 249, 252, 254, 379, 381, 383, 385, 382, 384, 386, - /* 160 */ 266, 389, 390, 391, 392, 394, 396, 395, 397, 399, - /* 170 */ 402, 404, 405, 400, 398, 401, 407, 406, 414, 417, - /* 180 */ 418, 421, 422, 412, 423, + /* 10 */ -176, -128, -8, 34, 114, 132, 140, 142, 157, 167, + /* 20 */ 169, 171, -191, -188, -221, -204, 129, 130, 151, -227, + /* 30 */ -16, -46, 112, -33, -113, -84, -123, 200, -193, 217, + /* 40 */ 219, -162, -36, 58, -247, -240, -106, -51, -35, -18, + /* 50 */ -5, 66, 126, 175, 192, 197, 205, 206, 211, 220, + /* 60 */ 222, 225, 226, 227, 187, 239, 240, 253, 254, 255, + /* 70 */ 257, 258, 259, 260, 292, 297, 298, 241, 299, 300, + /* 80 */ 302, 261, 262, 303, 306, 308, 238, 243, 263, 268, + /* 90 */ 313, 319, 324, 329, 332, 333, 334, 335, 339, 340, + /* 100 */ 341, 343, 345, 346, 347, 349, 351, 352, 353, 354, + /* 110 */ 355, 356, 357, 359, 360, 361, 362, 363, 364, 365, + /* 120 */ 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, + /* 130 */ 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + /* 140 */ 386, 388, 389, 390, 391, 249, 251, 252, 393, 265, + /* 150 */ 394, 264, 267, 270, 274, 289, 397, 271, 400, 277, + /* 160 */ 404, 401, 402, 405, 281, 406, 407, 409, 410, 411, + /* 170 */ 413, 412, 415, 416, 420, 418, 423, 417, 421, 432, + /* 180 */ 433, 424, 434, 436, 437, 439, 441, 438, 435, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 803, 916, 862, 928, 850, 859, 1062, 1062, 803, 803, - /* 10 */ 803, 803, 803, 803, 803, 803, 803, 803, 975, 822, - /* 20 */ 1062, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 30 */ 859, 803, 803, 865, 859, 865, 865, 970, 900, 918, - /* 40 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 50 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 60 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 70 */ 803, 803, 977, 983, 980, 803, 803, 803, 985, 803, - /* 80 */ 803, 1005, 1005, 968, 803, 803, 803, 803, 803, 803, - /* 90 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 100 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 110 */ 803, 803, 803, 803, 848, 803, 846, 803, 803, 803, - /* 120 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 130 */ 803, 833, 803, 803, 803, 803, 803, 803, 824, 824, - /* 140 */ 824, 803, 803, 803, 824, 803, 824, 1012, 1016, 1010, - /* 150 */ 998, 1006, 997, 993, 991, 990, 1020, 824, 824, 824, - /* 160 */ 863, 859, 859, 824, 824, 881, 879, 877, 869, 875, - /* 170 */ 871, 873, 867, 851, 824, 857, 857, 824, 857, 824, - /* 180 */ 857, 824, 824, 900, 918, 803, 1021, 803, 1061, 1011, - /* 190 */ 1051, 1050, 1057, 1049, 1048, 1047, 803, 803, 803, 1043, - /* 200 */ 1044, 1046, 1045, 803, 803, 803, 1053, 1052, 803, 803, - /* 210 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 220 */ 803, 803, 1023, 803, 1017, 1013, 803, 803, 803, 803, - /* 230 */ 803, 803, 803, 803, 803, 930, 803, 803, 803, 803, - /* 240 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 250 */ 967, 803, 803, 803, 803, 803, 979, 978, 803, 803, - /* 260 */ 803, 803, 803, 803, 803, 803, 803, 1007, 803, 999, - /* 270 */ 803, 803, 803, 803, 803, 942, 803, 803, 803, 803, - /* 280 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 290 */ 803, 803, 803, 803, 1075, 1072, 803, 803, 803, 803, - /* 300 */ 803, 803, 1068, 803, 803, 803, 1065, 803, 803, 803, - /* 310 */ 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, - /* 320 */ 803, 803, 803, 803, 884, 803, 831, 829, 803, 820, - /* 330 */ 803, + /* 0 */ 811, 924, 870, 936, 858, 867, 1070, 1070, 811, 811, + /* 10 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 20 */ 811, 811, 983, 830, 1070, 811, 811, 811, 811, 811, + /* 30 */ 811, 811, 811, 811, 867, 811, 811, 873, 867, 873, + /* 40 */ 873, 978, 908, 926, 811, 811, 811, 811, 811, 811, + /* 50 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 60 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 70 */ 811, 811, 811, 811, 811, 811, 811, 985, 991, 988, + /* 80 */ 811, 811, 811, 993, 811, 811, 1013, 1013, 976, 811, + /* 90 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 100 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 110 */ 811, 811, 811, 811, 811, 811, 811, 811, 856, 811, + /* 120 */ 854, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 130 */ 811, 811, 811, 811, 811, 841, 811, 811, 811, 811, + /* 140 */ 811, 811, 832, 832, 832, 811, 811, 811, 832, 811, + /* 150 */ 832, 1020, 1024, 1018, 1006, 1014, 1005, 1001, 999, 998, + /* 160 */ 1028, 832, 832, 832, 871, 867, 867, 832, 832, 889, + /* 170 */ 887, 885, 877, 883, 879, 881, 875, 859, 832, 865, + /* 180 */ 865, 832, 865, 832, 865, 832, 832, 908, 926, 811, + /* 190 */ 1029, 811, 1069, 1019, 1059, 1058, 1065, 1057, 1056, 1055, + /* 200 */ 811, 811, 811, 1051, 1052, 1054, 1053, 811, 811, 811, + /* 210 */ 1061, 1060, 811, 811, 811, 811, 811, 811, 811, 811, + /* 220 */ 811, 811, 811, 811, 811, 811, 1031, 811, 1025, 1021, + /* 230 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 240 */ 811, 938, 811, 811, 811, 811, 811, 811, 811, 811, + /* 250 */ 811, 811, 811, 811, 811, 811, 975, 811, 811, 811, + /* 260 */ 811, 811, 987, 986, 811, 811, 811, 811, 811, 811, + /* 270 */ 811, 811, 811, 1015, 811, 1007, 811, 811, 811, 811, + /* 280 */ 811, 950, 811, 811, 811, 811, 811, 811, 811, 811, + /* 290 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 1088, + /* 300 */ 1083, 1084, 1081, 811, 811, 811, 1080, 1075, 1076, 811, + /* 310 */ 811, 811, 1073, 811, 811, 811, 811, 811, 811, 811, + /* 320 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, + /* 330 */ 892, 811, 839, 837, 811, 828, 811, }; /********** End of lemon-generated parsing tables *****************************/ @@ -634,7 +636,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SYNCDB => nothing */ 0, /* ADD => nothing */ 0, /* COLUMN => nothing */ - 0, /* LENGTH => nothing */ + 0, /* MODIFY => nothing */ 0, /* TAG => nothing */ 0, /* CHANGE => nothing */ 0, /* SET => nothing */ @@ -909,7 +911,7 @@ static const char *const yyTokenName[] = { /* 136 */ "SYNCDB", /* 137 */ "ADD", /* 138 */ "COLUMN", - /* 139 */ "LENGTH", + /* 139 */ "MODIFY", /* 140 */ "TAG", /* 141 */ "CHANGE", /* 142 */ "SET", @@ -1302,20 +1304,23 @@ static const char *const yyRuleName[] = { /* 258 */ "cmd ::= SYNCDB ids REPLICA", /* 259 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", /* 260 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 261 */ "cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER", + /* 261 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", /* 262 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", /* 263 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", /* 264 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", /* 265 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 266 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 267 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 268 */ "cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER", - /* 269 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 270 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 271 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 272 */ "cmd ::= KILL CONNECTION INTEGER", - /* 273 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 274 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 266 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 267 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 268 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 269 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 270 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 271 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 272 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 273 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 274 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 275 */ "cmd ::= KILL CONNECTION INTEGER", + /* 276 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 277 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -2043,20 +2048,23 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 189, /* (258) cmd ::= SYNCDB ids REPLICA */ 189, /* (259) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ 189, /* (260) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 189, /* (261) cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + 189, /* (261) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ 189, /* (262) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ 189, /* (263) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ 189, /* (264) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ 189, /* (265) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 189, /* (266) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 189, /* (267) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 189, /* (268) cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ - 189, /* (269) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 189, /* (270) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 189, /* (271) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 189, /* (272) cmd ::= KILL CONNECTION INTEGER */ - 189, /* (273) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 189, /* (274) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 189, /* (266) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 189, /* (267) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 189, /* (268) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 189, /* (269) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 189, /* (270) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 189, /* (271) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 189, /* (272) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 189, /* (273) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 189, /* (274) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 189, /* (275) cmd ::= KILL CONNECTION INTEGER */ + 189, /* (276) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 189, /* (277) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2323,20 +2331,23 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (258) cmd ::= SYNCDB ids REPLICA */ -7, /* (259) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ -7, /* (260) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -9, /* (261) cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + -7, /* (261) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ -7, /* (262) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ -7, /* (263) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ -8, /* (264) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ -9, /* (265) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (266) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (267) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -9, /* (268) cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ - -7, /* (269) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (270) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (271) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -3, /* (272) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (273) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (274) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -7, /* (266) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (267) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (268) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (269) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (270) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (271) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (272) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (273) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (274) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (275) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (276) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (277) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3340,16 +3351,10 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 261: /* cmd ::= ALTER TABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + case 261: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { - yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; - - toTSDBType(yymsp[-1].minor.yy0.type); - SArray* K = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - toTSDBType(yymsp[0].minor.yy0.type); - K = tVariantListAppendToken(K, &yymsp[0].minor.yy0, -1); - - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3397,14 +3402,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 266: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 266: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 267: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 267: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 268: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3415,27 +3427,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 268: /* cmd ::= ALTER STABLE ids cpxName ALTER COLUMN LENGTH ids INTEGER */ + case 269: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { - yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; - - toTSDBType(yymsp[-1].minor.yy0.type); - SArray* K = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - toTSDBType(yymsp[0].minor.yy0.type); - K = tVariantListAppendToken(K, &yymsp[0].minor.yy0, -1); - - SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, K, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 269: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 270: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 270: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 271: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3446,7 +3452,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 271: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 272: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3460,13 +3466,32 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 272: /* cmd ::= KILL CONNECTION INTEGER */ + case 273: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ +{ + yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; + + toTSDBType(yymsp[-2].minor.yy0.type); + SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy362, -1); + + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 274: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ +{ + yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy285, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); +} + break; + case 275: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 273: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 276: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 274: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 277: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 24852abbf2..0e661e84c5 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -218,7 +218,7 @@ static SKeyword keywordTable[] = { {"PARTITIONS", TK_PARTITIONS}, {"TOPIC", TK_TOPIC}, {"TOPICS", TK_TOPICS}, - {"LENGTH", TK_LENGTH} + {"MODIFY", TK_MODIFY} }; static const char isIdChar[] = { diff --git a/tests/script/general/parser/alter_column.sim b/tests/script/general/parser/alter_column.sim index 7f30498d06..fe109352d1 100644 --- a/tests/script/general/parser/alter_column.sim +++ b/tests/script/general/parser/alter_column.sim @@ -25,20 +25,49 @@ sql use $db ##### alter table test, simeplest case sql create table tb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) sql insert into tb values (now, 1, "1", "1") -sql alter table tb alter column length c2 20; +sql alter table tb modify column c2 binary(20); if $rows != 0 then return -1 endi -sql alter table tb alter column length c3 20; +sql alter table tb modify column c3 nchar(20); if $rows != 0 then return -1 endi -sql create stable stb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) tags(id int) -sql create table tb1 using stb tags(1) +sql create stable stb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) tags(id1 int, id2 binary(10), id3 nchar(10)) +sql create table tb1 using stb tags(1, "a", "b") sql insert into tb1 values (now, 1, "1", "1") -sql alter stable stb alter column length c2 20; +sql alter stable stb modify column c2 binary(20); +if $rows != 0 then + return -1 +endi +sql alter table stb modify column c2 binary(30); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify column c3 nchar(20); +if $rows != 0 then + return -1 +endi +sql alter table stb modify column c3 nchar(30); +if $rows != 0 then + return -1 +endi + +sql alter table stb modify tag id2 binary(11); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify tag id2 binary(11); +if $rows != 0 then + return -1 +endi +sql alter table stb modify tag id3 nchar(11); +if $rows != 0 then + return -1 +endi +sql alter stable stb modify tag id3 nchar(11); if $rows != 0 then return -1 endi @@ -46,10 +75,44 @@ endi ##### ILLEGAL OPERATIONS # try dropping columns that are defined in metric -sql_error alter table tb alter column length c1 10; -sql_error alter stable tb alter column length c2 10; -sql_error alter table tb1 alter column length c2 10; -sql_error alter stable tb1 alter column length c2 10; +sql_error alter table tb modify column c1 binary(10); +sql_error alter table tb modify column c1 double; +sql_error alter table tb modify column c2 int; +sql_error alter table tb modify column c2 binary(10); +sql_error alter table tb modify column c2 binary(9); +sql_error alter table tb modify column c2 binary(-9); +sql_error alter table tb modify column c2 binary(0); +sql_error alter table tb modify column c2 binary(17000); +sql_error alter table tb modify column c2 nchar(30); +sql_error alter table tb modify column c3 double; +sql_error alter table tb modify column c3 nchar(10); +sql_error alter table tb modify column c3 nchar(0); +sql_error alter table tb modify column c3 nchar(-1); +sql_error alter table tb modify column c3 binary(80); +sql_error alter table tb modify column c3 nchar(17000); +sql_error alter table tb modify column c3 nchar(100), c2 binary(30); +sql_error alter table tb modify column c1 nchar(100), c2 binary(30); +sql_error alter stable tb modify column c2 binary(30); +sql_error alter table tb modify tag c2 binary(30); +sql_error alter table stb modify tag id2 binary(10); +sql_error alter table stb modify tag id2 nchar(30); +sql_error alter stable stb modify tag id2 binary(10); +sql_error alter stable stb modify tag id2 nchar(30); +sql_error alter table stb modify tag id3 nchar(10); +sql_error alter table stb modify tag id3 binary(30); +sql_error alter stable stb modify tag id3 nchar(10); +sql_error alter stable stb modify tag id3 binary(30); +sql_error alter stable stb modify tag id1 binary(30); +sql_error alter stable stb modify tag c1 binary(30); + + +sql_error alter table tb1 modify column c2 binary(30); +sql_error alter table tb1 modify column c3 nchar(30); +sql_error alter table tb1 modify tag id2 binary(30); +sql_error alter table tb1 modify tag id3 nchar(30); +sql_error alter stable tb1 modify tag id2 binary(30); +sql_error alter stable tb1 modify tag id3 nchar(30); +sql_error alter stable tb1 modify column c2 binary(30); system sh/exec.sh -n dnode1 -s stop -x SIGINT From b65442b12e69a1b3f8e1174102b4634392542341 Mon Sep 17 00:00:00 2001 From: tickduan <417921451@qq.com> Date: Wed, 2 Jun 2021 14:17:00 +0800 Subject: [PATCH 23/46] fix stime==INT64_MIN than etime calc error. and add check fp == NULL in taos_open_stream --- src/client/src/tscStream.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 0401d1f3b2..b60824b2fa 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -111,7 +111,9 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) { // failed to get table Meta or vgroup list, retry in 10sec. if (code == TSDB_CODE_SUCCESS) { tscTansformFuncForSTableQuery(pQueryInfo); - tscDebug("0x%"PRIx64" stream:%p, start stream query on:%s", pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name)); + + + tscDebug("0x%"PRIx64" stream:%p, start stream query on:%s QueryInfo->skey=%"PRId64" ekey=%"PRId64" ", pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name), pQueryInfo->window.skey, pQueryInfo->window.ekey); pQueryInfo->command = TSDB_SQL_SELECT; @@ -165,7 +167,11 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) { if (etime > pStream->etime) { etime = pStream->etime; } else if (pStream->interval.intervalUnit != 'y' && pStream->interval.intervalUnit != 'n') { - etime = pStream->stime + (etime - pStream->stime) / pStream->interval.interval * pStream->interval.interval; + if(pStream->stime == INT64_MIN) { + etime = taosTimeTruncate(etime, &pStream->interval, pStream->precision); + } else { + etime = pStream->stime + (etime - pStream->stime) / pStream->interval.interval * pStream->interval.interval; + } } else { etime = taosTimeTruncate(etime, &pStream->interval, pStream->precision); } @@ -349,8 +355,8 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer) tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, now + timer, timer, delay, pStream->stime, etime); } else { - tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, - pStream->stime, timer, delay, pStream->stime - pStream->interval.interval, pStream->stime - 1); + tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 " - %" PRId64 " end, in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream, + pStream->stime, pStream->etime, timer, delay, pStream->stime - pStream->interval.interval, pStream->stime - 1); } pSql->cmd.command = TSDB_SQL_SELECT; @@ -660,6 +666,11 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c STscObj *pObj = (STscObj *)taos; if (pObj == NULL || pObj->signature != pObj) return NULL; + if(fp == NULL){ + tscError(" taos_open_stream api fp param must not NULL."); + return NULL; + } + SSqlObj *pSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { return NULL; From 701ca6419de59d27af7ed5dc22a2c2d99c5c8b91 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 14:22:59 +0800 Subject: [PATCH 24/46] fix bug --- src/client/src/tscUtil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 8042f032c8..b5dfc956dd 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1119,6 +1119,8 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue SOperatorInfo* pSourceOperator = createDummyInputOperator(pSqlObjList[0], pSchema, numOfCol1, pFilterInfo, numOfFilterCols); + pOutput->precision = pSqlObjList[0]->res.precision; + SSchema* schema = NULL; if (px->numOfTables > 1) { SOperatorInfo** p = calloc(px->numOfTables, POINTER_BYTES); @@ -4477,4 +4479,4 @@ SNewVgroupInfo createNewVgroupInfo(SVgroupMsg *pVgroupMsg) { } return info; -} \ No newline at end of file +} From 3b867c876de1da897a04e908b5fef33c20e12a48 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 15:07:17 +0800 Subject: [PATCH 25/46] [TD-4476] add manual test case --- .../taosdemoAllTest/testAutoCreateTemp.py | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py diff --git a/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py b/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py new file mode 100644 index 0000000000..2d98b1c463 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py @@ -0,0 +1,135 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + # insert: auto_create + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json -y " % binPath) # drop = yes, exist = yes, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json -y " % binPath) # drop = yes, exist = yes, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json -y " % binPath) # drop = yes, exist = no, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json -y " % binPath) # drop = yes, exist = no, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json -y " % binPath) # drop = no, exist = yes, auto_create = yes + tdSql.query('show tables') + tdSql.checkRows(0) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json -y " % binPath) # drop = no, exist = yes, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(0) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json -y " % binPath) # drop = no, exist = no, auto_create = yes + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json -y " % binPath) # drop = no, exist = no, auto_create = no + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + #the following four test cases are for the exception cases for param auto_create_table + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json -y " % binPath) # drop = no, exist = no, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + tdSql.execute('drop database db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json -y " % binPath) # drop = no, exist = yes, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(0) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json -y " % binPath) # drop = yes, exist = no, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json -y " % binPath) # drop = yes, exist = yes, auto_create = 123 + tdSql.execute('use db') + tdSql.query('show tables') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From dd5a590423bf7a58f37d8d2aee55ca40ef7f1ebd Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 15:21:35 +0800 Subject: [PATCH 26/46] add keep value check --- src/client/src/tscSQLParser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index f8aa444d9e..50ae545a8e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5648,11 +5648,17 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p0 = taosArrayGet(pKeep, 0); switch (s) { case 1: { + if ((int32_t)p0->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); } break; case 2: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); break; @@ -5661,6 +5667,10 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p1 = taosArrayGet(pKeep, 1); tVariantListItem* p2 = taosArrayGet(pKeep, 2); + if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + } + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64); From 2bcd1f5a597f0d5a4acc1d340845fed48e729186 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 15:25:32 +0800 Subject: [PATCH 27/46] fix windows compile issue --- src/client/src/tscSQLParser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e41a9cb56b..a634362cf2 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5410,7 +5410,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; - SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = strlen(pItem->name)}; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); } @@ -5447,7 +5447,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { } SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; - SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = strlen(pItem->name)}; + SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17); } From 97e9070a21f83d071d320c55f3fddaef0fe9df22 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 16:34:41 +0800 Subject: [PATCH 28/46] [TD-4476] test case finished --- tests/pytest/manualTest/manual_alter_comp.py | 106 ++++++++++++++++++ .../taosdemoAllTest/manual_block1_comp.json | 8 +- 2 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 tests/pytest/manualTest/manual_alter_comp.py diff --git a/tests/pytest/manualTest/manual_alter_comp.py b/tests/pytest/manualTest/manual_alter_comp.py new file mode 100644 index 0000000000..1b6d1d1f81 --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_comp.py @@ -0,0 +1,106 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes + +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getRootPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + print(selfPath) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + print(projPath) + else: + projPath = selfPath[:selfPath.find("tests")] + print("test" + projPath) + + for root, dirs, files in os.walk(projPath): + if ('data' in dirs and 'sim' in root): + rootPath = root + + return rootPath + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + + + def run(self): + dnodePath = self.getRootPath() + os.system(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + #comp is at 14 + tdSql.query('show databases') + tdSql.checkData(0,14,2) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + tdDnodes.stop(1) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data/vnode") + input("please check disk usage for taosd. After checking, press enter") + + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + tdDnodes.start(1) + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 0') + tdSql.query('show databases') + tdSql.checkData(0,14,0) + tdDnodes.stop(1) + tdDnodes.start(1) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + input("please check disk usage for taosd. After checking, press enter") + + ##test result + # 2021/06/02 comp=2: file size = 6.4M comp=0 file size=399M. Test past + # each row entered is identical Tester - Baosheng Chang + + def stop(self): + tdSql.close() + tdLog.debug("%s alter block manual check finish" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json index 3ced8272b2..a6ac674dd7 100644 --- a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json +++ b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json @@ -38,7 +38,7 @@ "childtable_prefix": "stb_", "auto_create_table": "no", "batch_create_tbl_num": 20, - "data_source": "rand", + "data_source": "sample", "insert_mode": "taosc", "insert_rows": 10000, "childtable_limit": 10, @@ -51,9 +51,9 @@ "timestamp_step": 1, "start_timestamp": "2019-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] From 3a12c502c7763bd231f2ff1f23dade5b2e45f5ef Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 16:38:57 +0800 Subject: [PATCH 29/46] [TD-4475] remove temp file --- .../taosdemoAllTest/testAutoCreateTemp.py | 135 ------------------ 1 file changed, 135 deletions(-) delete mode 100644 tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py diff --git a/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py b/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py deleted file mode 100644 index 2d98b1c463..0000000000 --- a/tests/pytest/tools/taosdemoAllTest/testAutoCreateTemp.py +++ /dev/null @@ -1,135 +0,0 @@ -################################################################### -# Copyright (c) 2016 by TAOS Technologies, Inc. -# All rights reserved. -# -# This file is proprietary and confidential to TAOS Technologies. -# No part of this file may be reproduced, stored, transmitted, -# disclosed or used in any form or by any means other than as -# expressly provided by the written permission from Jianhui Tao -# -################################################################### - -# -*- coding: utf-8 -*- - -import sys -from util.log import * -from util.cases import * -from util.sql import * - - -class TDTestCase: - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - - def getBuildPath(self): - selfPath = os.path.dirname(os.path.realpath(__file__)) - - if ("community" in selfPath): - projPath = selfPath[:selfPath.find("community")] - else: - projPath = selfPath[:selfPath.find("tests")] - - for root, dirs, files in os.walk(projPath): - if ("taosd" in files): - rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("packaging" not in rootRealPath): - buildPath = root[:len(root)-len("/build/bin")] - break - return buildPath - - def run(self): - buildPath = self.getBuildPath() - if (buildPath == ""): - tdLog.exit("taosd not found!") - else: - tdLog.info("taosd found in %s" % buildPath) - binPath = buildPath+ "/build/bin/" - - # insert: auto_create - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYY.json -y " % binPath) # drop = yes, exist = yes, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YYN.json -y " % binPath) # drop = yes, exist = yes, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNY.json -y " % binPath) # drop = yes, exist = no, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YNN.json -y " % binPath) # drop = yes, exist = no, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYY.json -y " % binPath) # drop = no, exist = yes, auto_create = yes - tdSql.query('show tables') - tdSql.checkRows(0) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NYN.json -y " % binPath) # drop = no, exist = yes, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(0) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNY.json -y " % binPath) # drop = no, exist = no, auto_create = yes - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NNN.json -y " % binPath) # drop = no, exist = no, auto_create = no - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - #the following four test cases are for the exception cases for param auto_create_table - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NN123.json -y " % binPath) # drop = no, exist = no, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - tdSql.execute('drop database db') - tdSql.execute('create database db') - tdSql.execute('use db') - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-NY123.json -y " % binPath) # drop = no, exist = yes, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(0) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YN123.json -y " % binPath) # drop = yes, exist = no, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - os.system("%staosdemo -f tools/taosdemoAllTest/insert-drop-exist-auto-YY123.json -y " % binPath) # drop = yes, exist = yes, auto_create = 123 - tdSql.execute('use db') - tdSql.query('show tables') - tdSql.checkRows(20) - - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - - -tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) From e39c9eed5de45a0bd01c2402596af5ce5882289e Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Wed, 2 Jun 2021 17:03:55 +0800 Subject: [PATCH 30/46] [TD-4476] modified test case --- tests/pytest/manualTest/manual_alter_comp.py | 32 ++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/pytest/manualTest/manual_alter_comp.py b/tests/pytest/manualTest/manual_alter_comp.py index 1b6d1d1f81..6c3e0fc296 100644 --- a/tests/pytest/manualTest/manual_alter_comp.py +++ b/tests/pytest/manualTest/manual_alter_comp.py @@ -70,31 +70,51 @@ class TDTestCase: binPath = buildPath+ "/build/bin/" #comp is at 14 + #check disk usage when comp=2 tdSql.query('show databases') + tdSql.execute('alter database db blocks 3') # minimize the data in cache tdSql.checkData(0,14,2) os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) - tdDnodes.stop(1) print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data/vnode") + print('comp = 2') input("please check disk usage for taosd. After checking, press enter") - + + #removing all data file os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran input("please check if the pervious data is being deleted. Then, press enter") - tdDnodes.start(1) + + #check disk usage when comp=0 tdSql.prepare() tdSql.query('show databases') tdSql.checkData(0,14,2) tdSql.execute('alter database db comp 0') tdSql.query('show databases') tdSql.checkData(0,14,0) - tdDnodes.stop(1) - tdDnodes.start(1) os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 0') + input("please check disk usage for taosd. After checking, press enter") + + #removing all data file + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + + #check disk usage when comp=1 + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 1') + tdSql.query('show databases') + tdSql.checkData(0,14,1) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 1') input("please check disk usage for taosd. After checking, press enter") ##test result - # 2021/06/02 comp=2: file size = 6.4M comp=0 file size=399M. Test past + # 2021/06/02 comp=2:13M comp=1:57M comp=0:399M. Test past # each row entered is identical Tester - Baosheng Chang def stop(self): From 738bdd253fe962d45f311018b422656498155b45 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Wed, 2 Jun 2021 09:30:59 +0000 Subject: [PATCH 31/46] update jenkins --- tests/Jenkinsfile | 4 ++-- tests/mas/Jenkinsfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Jenkinsfile b/tests/Jenkinsfile index 74cbc35208..a16b8fc1b6 100644 --- a/tests/Jenkinsfile +++ b/tests/Jenkinsfile @@ -29,8 +29,8 @@ pipeline { agent none environment{ - WK = '/var/lib/jenkins/workspace/TDinternal' - WKC= '/var/lib/jenkins/workspace/TDinternal/community' + WK = '/data/lib/jenkins/workspace/TDinternal' + WKC= '/data/lib/jenkins/workspace/TDinternal/community' } stages { diff --git a/tests/mas/Jenkinsfile b/tests/mas/Jenkinsfile index b2a1a5e116..0e6e94a037 100644 --- a/tests/mas/Jenkinsfile +++ b/tests/mas/Jenkinsfile @@ -29,8 +29,8 @@ pipeline { agent none environment{ - WK = '/var/lib/jenkins/workspace/TDinternal' - WKC= '/var/lib/jenkins/workspace/TDinternal/community' + WK = '/data/lib/jenkins/workspace/TDinternal' + WKC= '/data/lib/jenkins/workspace/TDinternal/community' } stages { From dff270c96e5f99863077b5a4a7f6f36f2448dc0f Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Wed, 2 Jun 2021 17:52:05 +0800 Subject: [PATCH 32/46] [TD-4435]: add test case --- .../jdbc/TSDBPreparedStatementTest.java | 127 +++++++++++++++++- 1 file changed, 123 insertions(+), 4 deletions(-) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java index 52858e7f88..277ca447f5 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java @@ -243,15 +243,15 @@ public class TSDBPreparedStatementTest { s.setNString(1, s2, 4); random = 10 + r.nextInt(5); - ArrayList s5 = new ArrayList(); + ArrayList s3 = new ArrayList(); for(int i = 0; i < numOfRows; i++) { if(i % random == 0) { - s5.add(null); + s3.add(null); }else{ - s5.add("test" + i % 10); + s3.add("test" + i % 10); } } - s.setString(2, s5, 10); + s.setString(2, s3, 10); s.columnDataAddBatch(); s.columnDataExecuteBatch(); @@ -268,7 +268,126 @@ public class TSDBPreparedStatementTest { } } + @Test + public void bindDataWithSingleTagTest() throws SQLException { + Statement stmt = conn.createStatement(); + String types[] = new String[] {"tinyint", "smallint", "int", "bigint", "bool", "float", "double", "binary(10)", "nchar(10)"}; + + for (String type : types) { + stmt.execute("drop table if exists weather_test"); + stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t " + type + ")"); + + int numOfRows = 1; + + TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?) values(?, ?, ?)"); + Random r = new Random(); + s.setTableName("w1"); + + switch(type) { + case "tinyint": + case "smallint": + case "int": + case "bigint": + s.setTagInt(0, 1); + break; + case "float": + s.setTagFloat(0, 1.23f); + break; + case "double": + s.setTagDouble(0, 3.14159265); + break; + case "bool": + s.setTagBoolean(0, true); + break; + case "binary(10)": + s.setTagString(0, "test"); + break; + case "nchar(10)": + s.setTagNString(0, "test"); + break; + default: + break; + } + + + ArrayList ts = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + ts.add(System.currentTimeMillis() + i); + } + s.setTimestamp(0, ts); + + int random = 10 + r.nextInt(5); + ArrayList s2 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s2.add("分支" + i % 4); + } + s.setNString(1, s2, 10); + + random = 10 + r.nextInt(5); + ArrayList s3 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s3.add("test" + i % 4); + } + s.setString(2, s3, 10); + + s.columnDataAddBatch(); + s.columnDataExecuteBatch(); + s.columnDataCloseBatch(); + + String sql = "select * from weather_test"; + PreparedStatement statement = conn.prepareStatement(sql); + ResultSet rs = statement.executeQuery(); + int rows = 0; + while(rs.next()) { + rows++; + } + Assert.assertEquals(numOfRows, rows); + } + } + + + @Test + public void bindDataWithMultipleTagsTest() throws SQLException { + Statement stmt = conn.createStatement(); + + stmt.execute("drop table if exists weather_test"); + stmt.execute("create table weather_test(ts timestamp, f1 nchar(10), f2 binary(10)) tags (t1 int, t2 binary(10))"); + + int numOfRows = 1; + + TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags(?,?) (ts, f2) values(?, ?)"); + s.setTableName("w2"); + s.setTagInt(0, 1); + s.setTagString(1, "test"); + + + ArrayList ts = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + ts.add(System.currentTimeMillis() + i); + } + s.setTimestamp(0, ts); + + ArrayList s2 = new ArrayList(); + for(int i = 0; i < numOfRows; i++) { + s2.add("test" + i % 4); + } + s.setString(1, s2, 10); + + s.columnDataAddBatch(); + s.columnDataExecuteBatch(); + s.columnDataCloseBatch(); + + String sql = "select * from weather_test"; + PreparedStatement statement = conn.prepareStatement(sql); + ResultSet rs = statement.executeQuery(); + int rows = 0; + while(rs.next()) { + rows++; + } + Assert.assertEquals(numOfRows, rows); + + } @Test public void setBoolean() throws SQLException { From fa6bc96dacb7533bed01f81c7b615b399d9b3a0c Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 2 Jun 2021 17:59:47 +0800 Subject: [PATCH 33/46] fix case issue --- tests/script/general/db/alter_option.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 170ba21c28..c3bb23855f 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -129,8 +129,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 print ============== step cache From b7ea0532588690be03aa217e71082e75fa307e1d Mon Sep 17 00:00:00 2001 From: lichuang Date: Wed, 2 Jun 2021 18:33:21 +0800 Subject: [PATCH 34/46] [TD-1920]fix compact bug,load dnode-globalcfg mode --- src/dnode/src/dnodeMain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 64da11f312..140f830c9f 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -88,6 +88,7 @@ static SStep tsDnodeSteps[] = { static SStep tsDnodeCompactSteps[] = { {"dnode-tfile", tfInit, tfCleanup}, + {"dnode-globalcfg", taosCheckGlobalCfg, NULL}, {"dnode-storage", dnodeInitStorage, dnodeCleanupStorage}, {"dnode-eps", dnodeInitEps, dnodeCleanupEps}, {"dnode-wal", walInit, walCleanUp}, From b141d31939151c9903f1680bb0d96606b4f26ac1 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 2 Jun 2021 23:11:44 +0800 Subject: [PATCH 35/46] [TD-4507]: disable jdbc build on windows for appveyor. (#6352) --- .appveyor.yml | 98 ++++++++++++++++++++++++------------------------- cmake/env.inc | 14 ++++--- cmake/input.inc | 6 +++ 3 files changed, 63 insertions(+), 55 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ee1dc91767..e7802b3d0d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,49 +1,49 @@ -version: 1.0.{build} -image: - - Visual Studio 2015 - - macos -environment: - matrix: - - ARCH: amd64 - - ARCH: x86 -matrix: - exclude: - - image: macos - ARCH: x86 -for: - - - matrix: - only: - - image: Visual Studio 2015 - clone_folder: c:\dev\TDengine - clone_depth: 1 - - init: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% - - before_build: - - cd c:\dev\TDengine - - md build - - build_script: - - cd build - - cmake -G "NMake Makefiles" .. - - nmake install - - - matrix: - only: - - image: macos - clone_depth: 1 - - build_script: - - mkdir debug - - cd debug - - cmake .. > /dev/null - - make > /dev/null -notifications: -- provider: Email - to: - - sangshuduo@gmail.com - on_build_success: true - on_build_failure: true - on_build_status_changed: true +version: 1.0.{build} +image: + - Visual Studio 2015 + - macos +environment: + matrix: + - ARCH: amd64 + - ARCH: x86 +matrix: + exclude: + - image: macos + ARCH: x86 +for: + - + matrix: + only: + - image: Visual Studio 2015 + clone_folder: c:\dev\TDengine + clone_depth: 1 + + init: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% + + before_build: + - cd c:\dev\TDengine + - md build + + build_script: + - cd build + - cmake -G "NMake Makefiles" .. -DBUILD_JDBC=false + - nmake install + - + matrix: + only: + - image: macos + clone_depth: 1 + + build_script: + - mkdir debug + - cd debug + - cmake .. > /dev/null + - make > /dev/null +notifications: +- provider: Email + to: + - sangshuduo@gmail.com + on_build_success: true + on_build_failure: true + on_build_status_changed: true diff --git a/cmake/env.inc b/cmake/env.inc index 3989993953..6c1ce8fd89 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -14,11 +14,13 @@ MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR}) MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH}) MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH}) -FIND_PROGRAM(TD_MVN_INSTALLED mvn) -IF (TD_MVN_INSTALLED) - MESSAGE(STATUS "MVN is installed and JDBC will be compiled") -ELSE () - MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") +IF (TD_BUILD_JDBC) + FIND_PROGRAM(TD_MVN_INSTALLED mvn) + IF (TD_MVN_INSTALLED) + MESSAGE(STATUS "MVN is installed and JDBC will be compiled") + ELSE () + MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") + ENDIF () ENDIF () # @@ -55,4 +57,4 @@ ELSE () SET(CMAKE_BUILD_TYPE "Debug") MESSAGE(STATUS "Build Debug Version as default") ENDIF() -ENDIF () \ No newline at end of file +ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index 543114ad09..9b72a35d94 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -77,3 +77,9 @@ IF (${JEMALLOC_ENABLED} MATCHES "true") SET(TD_JEMALLOC_ENABLED TRUE) MESSAGE(STATUS "build with jemalloc enabled") ENDIF () + +SET(TD_BUILD_JDBC TRUE) + +IF (${BUILD_JDBC} MATCHES "false") + SET(TD_BUILD_JDBC FALSE) +ENDIF () From 747b88df40acddaedfb4c3a7435eb6e0496d9694 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 3 Jun 2021 00:17:48 +0800 Subject: [PATCH 36/46] [TD-4507]: disable jdbc build on windows for appveyor. (#6353) --- .appveyor.yml | 98 ++++++++++++++++++++++++------------------------- cmake/env.inc | 14 ++++--- cmake/input.inc | 6 +++ 3 files changed, 63 insertions(+), 55 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ee1dc91767..e7802b3d0d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,49 +1,49 @@ -version: 1.0.{build} -image: - - Visual Studio 2015 - - macos -environment: - matrix: - - ARCH: amd64 - - ARCH: x86 -matrix: - exclude: - - image: macos - ARCH: x86 -for: - - - matrix: - only: - - image: Visual Studio 2015 - clone_folder: c:\dev\TDengine - clone_depth: 1 - - init: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% - - before_build: - - cd c:\dev\TDengine - - md build - - build_script: - - cd build - - cmake -G "NMake Makefiles" .. - - nmake install - - - matrix: - only: - - image: macos - clone_depth: 1 - - build_script: - - mkdir debug - - cd debug - - cmake .. > /dev/null - - make > /dev/null -notifications: -- provider: Email - to: - - sangshuduo@gmail.com - on_build_success: true - on_build_failure: true - on_build_status_changed: true +version: 1.0.{build} +image: + - Visual Studio 2015 + - macos +environment: + matrix: + - ARCH: amd64 + - ARCH: x86 +matrix: + exclude: + - image: macos + ARCH: x86 +for: + - + matrix: + only: + - image: Visual Studio 2015 + clone_folder: c:\dev\TDengine + clone_depth: 1 + + init: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH% + + before_build: + - cd c:\dev\TDengine + - md build + + build_script: + - cd build + - cmake -G "NMake Makefiles" .. -DBUILD_JDBC=false + - nmake install + - + matrix: + only: + - image: macos + clone_depth: 1 + + build_script: + - mkdir debug + - cd debug + - cmake .. > /dev/null + - make > /dev/null +notifications: +- provider: Email + to: + - sangshuduo@gmail.com + on_build_success: true + on_build_failure: true + on_build_status_changed: true diff --git a/cmake/env.inc b/cmake/env.inc index efcc996176..17ec6a535e 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -14,11 +14,13 @@ MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR}) MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH}) MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH}) -FIND_PROGRAM(TD_MVN_INSTALLED mvn) -IF (TD_MVN_INSTALLED) - MESSAGE(STATUS "MVN is installed and JDBC will be compiled") -ELSE () - MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") +IF (TD_BUILD_JDBC) + FIND_PROGRAM(TD_MVN_INSTALLED mvn) + IF (TD_MVN_INSTALLED) + MESSAGE(STATUS "MVN is installed and JDBC will be compiled") + ELSE () + MESSAGE(STATUS "MVN is not installed and JDBC is not compiled") + ENDIF () ENDIF () # @@ -54,4 +56,4 @@ ELSE () SET(CMAKE_BUILD_TYPE "Debug") MESSAGE(STATUS "Build Debug Version as default") ENDIF() -ENDIF () \ No newline at end of file +ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index 00e0e1bc0f..5841a46567 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -72,3 +72,9 @@ IF (${RANDOM_NETWORK_FAIL} MATCHES "true") SET(TD_RANDOM_NETWORK_FAIL TRUE) MESSAGE(STATUS "build with random-network-fail enabled") ENDIF () + +SET(TD_BUILD_JDBC TRUE) + +IF (${BUILD_JDBC} MATCHES "false") + SET(TD_BUILD_JDBC FALSE) +ENDIF () From 4679c4bf5d42f135cc578ce07e8e41b59df7a6e3 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Thu, 3 Jun 2021 09:39:52 +0800 Subject: [PATCH 37/46] fix case issue --- tests/script/general/db/topic1.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim index 42613405af..2b4cce5e64 100644 --- a/tests/script/general/db/topic1.sim +++ b/tests/script/general/db/topic1.sim @@ -385,8 +385,8 @@ sql alter database db keep 20 sql_error alter database db keep 10 sql_error alter database db keep 9 sql_error alter database db keep 1 -sql alter database db keep 0 -sql alter database db keep -1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 sql_error alter database db keep 365001 sql_error alter topic db keep 40 From d389df2d848c94011f0e626bd93860db35f4fe99 Mon Sep 17 00:00:00 2001 From: lichuang Date: Thu, 3 Jun 2021 09:41:03 +0800 Subject: [PATCH 38/46] [TD-1920]fix compact bug,load necessary modules --- src/dnode/src/dnodeMain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 140f830c9f..a4ff9df203 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -90,11 +90,15 @@ static SStep tsDnodeCompactSteps[] = { {"dnode-tfile", tfInit, tfCleanup}, {"dnode-globalcfg", taosCheckGlobalCfg, NULL}, {"dnode-storage", dnodeInitStorage, dnodeCleanupStorage}, + {"dnode-cfg", dnodeInitCfg, dnodeCleanupCfg}, {"dnode-eps", dnodeInitEps, dnodeCleanupEps}, + {"dnode-minfos", dnodeInitMInfos, dnodeCleanupMInfos}, {"dnode-wal", walInit, walCleanUp}, + {"dnode-sync", syncInit, syncCleanUp}, {"dnode-mread", dnodeInitMRead, NULL}, {"dnode-mwrite", dnodeInitMWrite, NULL}, {"dnode-mpeer", dnodeInitMPeer, NULL}, + {"dnode-vnodes", dnodeInitVnodes, dnodeCleanupVnodes}, {"dnode-modules", dnodeInitModules, dnodeCleanupModules}, }; From ad31a637f6f913a68c25290098ef0de6c4271997 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Thu, 3 Jun 2021 02:54:57 +0000 Subject: [PATCH 39/46] [TD-4395]update test-all.sh --- tests/test-all.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test-all.sh b/tests/test-all.sh index 47e5de6aa0..6e7963e787 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -233,6 +233,10 @@ totalExampleFailed=0 if [ "${OS}" == "Linux" ]; then corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` + if [ -z "$corepath" ];then + echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied" + corepath="/coredump/" + fi fi if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then From ee9b45ef7d168a5ba5e779375a50bf425d434c68 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Thu, 3 Jun 2021 11:37:48 +0800 Subject: [PATCH 40/46] [TD-4523] add test case --- tests/pytest/alter/alter_keep_exception.py | 44 ++++++++++++++++++++++ tests/pytest/fulltest.sh | 1 + 2 files changed, 45 insertions(+) create mode 100644 tests/pytest/alter/alter_keep_exception.py diff --git a/tests/pytest/alter/alter_keep_exception.py b/tests/pytest/alter/alter_keep_exception.py new file mode 100644 index 0000000000..cddaaa5522 --- /dev/null +++ b/tests/pytest/alter/alter_keep_exception.py @@ -0,0 +1,44 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +#TODO: after TD-4518 and TD-4510 is resolved, add the exception test case for these situations + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.error('alter database keep db 0') + tdSql.error('alter database keep db -10') + tdSql.error('alter database keep db -2147483648') + + #this is the test case problem for keep overflow + #the error is caught, but type is wrong. + #TODO: can be solved in the future, but improvement is minimal + tdSql.error('alter database keep db -2147483649') + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 24ae0ad557..7434d32b9d 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -333,4 +333,5 @@ python3 ./test.py -f tag_lite/alter_tag.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 ./test.py -f tag_lite/drop_auto_create.py +python3 test.py -f alter/alter_keep_exception.py #======================p4-end=============== From e61ee9fb97915aba100b90a3e15cbe4b527669cb Mon Sep 17 00:00:00 2001 From: lichuang Date: Thu, 3 Jun 2021 11:42:36 +0800 Subject: [PATCH 41/46] [TD-4394]add modify column,tag width implementation --- src/mnode/src/mnodeTable.c | 101 ++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 5b699c5e24..be53d353c9 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -93,6 +93,9 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg); static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg); static int32_t mnodeFindSuperTableColumnIndex(SSTableObj *pStable, char *colName); +static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg); +static int32_t mnodeChangeSuperTableTag(SMnodeMsg *pMsg); +static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg); static void mnodeDestroyChildTable(SCTableObj *pTable) { tfree(pTable->info.tableId); @@ -1457,31 +1460,52 @@ static int32_t mnodeChangeSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) { return code; } -static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char *newName) { +static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; SSTableObj *pStable = (SSTableObj *)pMsg->pTable; - int32_t col = mnodeFindSuperTableColumnIndex(pStable, oldName); + int32_t col = mnodeFindSuperTableColumnIndex(pStable, name); if (col < 0) { - mError("msg:%p, app:%p stable:%s, change column, oldName:%s, newName:%s", pMsg, pMsg->rpcMsg.ahandle, - pStable->info.tableId, oldName, newName); + mError("msg:%p, app:%p stable:%s, change column, name:%s", pMsg, pMsg->rpcMsg.ahandle, + pStable->info.tableId, name); return TSDB_CODE_MND_FIELD_NOT_EXIST; } - // int32_t rowSize = 0; - uint32_t len = (uint32_t)strlen(newName); - if (len >= TSDB_COL_NAME_LEN) { - return TSDB_CODE_MND_COL_NAME_TOO_LONG; - } - - if (mnodeFindSuperTableColumnIndex(pStable, newName) >= 0) { - return TSDB_CODE_MND_FIELD_ALREAY_EXIST; - } - // update SSchema *schema = (SSchema *) (pStable->schema + col); - tstrncpy(schema->name, newName, sizeof(schema->name)); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; + mInfo("msg:%p, app:%p stable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, + name, schema->bytes); - mInfo("msg:%p, app:%p stable %s, start to modify column %s to %s", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, - oldName, newName); + SSdbRow row = { + .type = SDB_OPER_GLOBAL, + .pTable = tsSuperTableSdb, + .pObj = pStable, + .pMsg = pMsg, + .fpRsp = mnodeChangeSuperTableColumnCb + }; + + return sdbUpdateRow(&row); +} + +static int32_t mnodeChangeSuperTableTag(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; + SSTableObj *pStable = (SSTableObj *)pMsg->pTable; + int32_t col = mnodeFindSuperTableTagIndex(pStable, name); + if (col < 0) { + mError("msg:%p, app:%p stable:%s, change column, name:%s", pMsg, pMsg->rpcMsg.ahandle, + pStable->info.tableId, name); + return TSDB_CODE_MND_FIELD_NOT_EXIST; + } + + // update + SSchema *schema = (SSchema *) (pStable->schema + col); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; + mInfo("msg:%p, app:%p stable %s, start to modify tag len %s to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId, + name, schema->bytes); SSdbRow row = { .type = SDB_OPER_GLOBAL, @@ -2355,31 +2379,23 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) { return sdbUpdateRow(&row); } -static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg, char *oldName, char *newName) { +static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg) { + SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont; + char* name = pAlter->schema[0].name; SCTableObj *pTable = (SCTableObj *)pMsg->pTable; - int32_t col = mnodeFindNormalTableColumnIndex(pTable, oldName); + int32_t col = mnodeFindNormalTableColumnIndex(pTable, name); if (col < 0) { - mError("msg:%p, app:%p ctable:%s, change column, oldName: %s, newName: %s", pMsg, pMsg->rpcMsg.ahandle, - pTable->info.tableId, oldName, newName); + mError("msg:%p, app:%p ctable:%s, change column, name: %s", pMsg, pMsg->rpcMsg.ahandle, + pTable->info.tableId, name); return TSDB_CODE_MND_FIELD_NOT_EXIST; } - // int32_t rowSize = 0; - uint32_t len = (uint32_t)strlen(newName); - if (len >= TSDB_COL_NAME_LEN) { - return TSDB_CODE_MND_COL_NAME_TOO_LONG; - } - - if (mnodeFindNormalTableColumnIndex(pTable, newName) >= 0) { - return TSDB_CODE_MND_FIELD_ALREAY_EXIST; - } - - // update SSchema *schema = (SSchema *) (pTable->schema + col); - tstrncpy(schema->name, newName, sizeof(schema->name)); + ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR); + schema->bytes = pAlter->schema[0].bytes; - mInfo("msg:%p, app:%p ctable %s, start to modify column %s to %s", pMsg, pMsg->rpcMsg.ahandle, pTable->info.tableId, - oldName, newName); + mInfo("msg:%p, app:%p ctable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pTable->info.tableId, + name, schema->bytes); SSdbRow row = { .type = SDB_OPER_GLOBAL, @@ -3214,15 +3230,9 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropSuperTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - //code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); - (void)mnodeChangeSuperTableColumn; - mError("change table[%s] column[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); - code = TSDB_CODE_SUCCESS; + code = mnodeChangeSuperTableColumn(pMsg); } else if (pAlter->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { - //code = mnodeChangeSuperTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); - (void)mnodeChangeSuperTableColumn; - mError("change table[%s] tag[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); - code = TSDB_CODE_SUCCESS; + code = mnodeChangeSuperTableTag(pMsg); } else { } } else { @@ -3234,10 +3244,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { code = mnodeDropNormalTableColumn(pMsg, pAlter->schema[0].name); } else if (pAlter->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { - //code = mnodeChangeNormalTableColumn(pMsg, pAlter->schema[0].name, pAlter->schema[1].name); - (void)mnodeChangeNormalTableColumn; - mError("change table[%s] column[%s] length to [%d] is not processed", pAlter->tableFname, pAlter->schema[0].name, pAlter->schema[0].bytes); - code = TSDB_CODE_SUCCESS; + code = mnodeChangeNormalTableColumn(pMsg); } else { } } From 622b711ad190b2b628d47b7449d502c885f1ca98 Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 3 Jun 2021 17:00:30 +0800 Subject: [PATCH 42/46] [TD-4533] : describe C/C++ & Java version of Prepare Statement api. --- .../cn/08.connector/01.java/docs.md | 78 +++++++++++++++++++ documentation20/cn/08.connector/docs.md | 55 +++++++++++-- 2 files changed, 127 insertions(+), 6 deletions(-) diff --git a/documentation20/cn/08.connector/01.java/docs.md b/documentation20/cn/08.connector/01.java/docs.md index 5eec33e2f1..4fc10b542b 100644 --- a/documentation20/cn/08.connector/01.java/docs.md +++ b/documentation20/cn/08.connector/01.java/docs.md @@ -266,7 +266,9 @@ while(resultSet.next()){ > 查询和操作关系型数据库一致,使用下标获取返回字段内容时从 1 开始,建议使用字段名称获取。 ### 处理异常 + 在报错后,通过SQLException可以获取到错误的信息和错误码: + ```java try (Statement statement = connection.createStatement()) { // executeQuery @@ -279,11 +281,87 @@ try (Statement statement = connection.createStatement()) { e.printStackTrace(); } ``` + JDBC连接器可能报错的错误码包括3种:JDBC driver本身的报错(错误码在0x2301到0x2350之间),JNI方法的报错(错误码在0x2351到0x2400之间),TDengine其他功能模块的报错。 具体的错误码请参考: * https://github.com/taosdata/TDengine/blob/develop/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java * https://github.com/taosdata/TDengine/blob/develop/src/inc/taoserror.h +### 通过参数绑定写入数据 + +从 2.1.2.0 版本开始,TDengine 的 **JDBC-JNI** 实现大幅改进了参数绑定方式对数据写入(INSERT)场景的支持。采用这种方式写入数据时,能避免 SQL 语法解析的资源消耗,从而在很多情况下显著提升写入性能。(注意:**JDBC-RESTful** 实现并不提供参数绑定这种使用方式。) + +```java +Statement stmt = conn.createStatement(); +Random r = new Random(); + +// INSERT 语句中,VALUES 部分允许指定具体的数据列;如果采取自动建表,则 TAGS 部分需要设定全部 TAGS 列的参数值: +TSDBPreparedStatement s = (TSDBPreparedStatement) conn.prepareStatement("insert into ? using weather_test tags (?, ?) (ts, c1, c2) values(?, ?, ?)"); + +// 设定数据表名: +s.setTableName("w1"); +// 设定 TAGS 取值: +s.setTagInt(0, r.nextInt(10)); +s.setTagString(1, "Beijing"); + +int numOfRows = 10; + +// VALUES 部分以逐列的方式进行设置: +ArrayList ts = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + ts.add(System.currentTimeMillis() + i); +} +s.setTimestamp(0, ts); + +ArrayList s1 = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + s1.add(r.nextInt(100)); +} +s.setInt(1, s1); + +ArrayList s2 = new ArrayList<>(); +for (int i = 0; i < numOfRows; i++){ + s2.add("test" + r.nextInt(100)); +} +s.setString(2, s2, 10); + +// AddBatch 之后,可以再设定新的表名、TAGS、VALUES 取值,这样就能实现一次执行向多个数据表写入: +s.columnDataAddBatch(); +// 执行语句: +s.columnDataExecuteBatch(); +// 执行完毕,释放资源: +s.columnDataCloseBatch(); +``` + +用于设定 TAGS 取值的方法总共有: +```java +public void setTagNull(int index, int type) +public void setTagBoolean(int index, boolean value) +public void setTagInt(int index, int value) +public void setTagByte(int index, byte value) +public void setTagShort(int index, short value) +public void setTagLong(int index, long value) +public void setTagTimestamp(int index, long value) +public void setTagFloat(int index, float value) +public void setTagDouble(int index, double value) +public void setTagString(int index, String value) +public void setTagNString(int index, String value) +``` + +用于设定 VALUES 数据列的取值的方法总共有: +```java +public void setInt(int columnIndex, ArrayList list) throws SQLException +public void setFloat(int columnIndex, ArrayList list) throws SQLException +public void setTimestamp(int columnIndex, ArrayList list) throws SQLException +public void setLong(int columnIndex, ArrayList list) throws SQLException +public void setDouble(int columnIndex, ArrayList list) throws SQLException +public void setBoolean(int columnIndex, ArrayList list) throws SQLException +public void setByte(int columnIndex, ArrayList list) throws SQLException +public void setShort(int columnIndex, ArrayList list) throws SQLException +public void setString(int columnIndex, ArrayList list, int size) throws SQLException +public void setNString(int columnIndex, ArrayList list, int size) throws SQLException +``` + ### 订阅 #### 创建 diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index 9484917993..f3e85cc3dd 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -291,9 +291,25 @@ typedef struct taosField { TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线程同时打开多张表,并可以同时对每张打开的表进行查询或者插入操作。需要指出的是,**客户端应用必须确保对同一张表的操作完全串行化**,即对同一个表的插入或查询操作未完成时(未返回时),不能够执行第二个插入或查询操作。 -### 参数绑定API + +### 参数绑定 API -除了直接调用 `taos_query` 进行查询,TDengine也提供了支持参数绑定的Prepare API,与 MySQL 一样,这些API目前也仅支持用问号`?`来代表待绑定的参数,具体如下: +除了直接调用 `taos_query` 进行查询,TDengine 也提供了支持参数绑定的 Prepare API,与 MySQL 一样,这些 API 目前也仅支持用问号 `?` 来代表待绑定的参数。 + +从 2.1.1.0 和 2.1.2.0 版本开始,TDengine 大幅改进了参数绑定接口对数据写入(INSERT)场景的支持。这样在通过参数绑定接口写入数据时,就避免了 SQL 语法解析的资源消耗,从而在绝大多数情况下显著提升写入性能。此时的典型操作步骤如下: +1. 调用 `taos_stmt_init` 创建参数绑定对象; +2. 调用 `taos_stmt_prepare` 解析 INSERT 语句; +3. 如果 INSERT 语句中预留了表名但没有预留 TAGS,那么调用 `taos_stmt_set_tbname` 来设置表名; +4. 如果 INSERT 语句中既预留了表名又预留了 TAGS(例如 INSERT 语句采取的是自动建表的方式),那么调用 `taos_stmt_set_tbname_tags` 来设置表名和 TAGS 的值; +5. 调用 `taos_stmt_bind_param_batch` 以多列的方式设置 VALUES 的值; +6. 调用 `taos_stmt_add_batch` 把当前绑定的参数加入批处理; +7. 可以重复第 3~6 步,为批处理加入更多的数据行; +8. 调用 `taos_stmt_execute` 执行已经准备好的批处理指令; +9. 执行完毕,调用 `taos_stmt_close` 释放所有资源。 + +除 C/C++ 语言外,TDengine 的 Java 语言 JNI Connector 也提供参数绑定接口支持,具体请另外参见:[参数绑定接口的 Java 用法](https://www.taosdata.com/cn/documentation/connector/java#stmt-java)。 + +接口相关的具体函数如下(也可以参考 [apitest.c](https://github.com/taosdata/TDengine/blob/develop/tests/examples/c/apitest.c) 文件中使用对应函数的方式): - `TAOS_STMT* taos_stmt_init(TAOS *taos)` @@ -301,11 +317,12 @@ TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线 - `int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length)` - 解析一条sql语句,将解析结果和参数信息绑定到stmt上,如果参数length大于0,将使用此参数作为sql语句的长度,如等于0,将自动判断sql语句的长度。 + 解析一条 SQL 语句,将解析结果和参数信息绑定到 stmt 上,如果参数 length 大于 0,将使用此参数作为 SQL 语句的长度,如等于 0,将自动判断 SQL 语句的长度。 - `int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind)` - 进行参数绑定,bind指向一个数组,需保证此数组的元素数量和顺序与sql语句中的参数完全一致。TAOS_BIND 的使用方法与 MySQL中的 MYSQL_BIND 一致,具体定义如下: + 不如 `taos_stmt_bind_param_batch` 效率高,但可以支持非 INSERT 类型的 SQL 语句。 + 进行参数绑定,bind 指向一个数组(代表所要绑定的一行数据),需保证此数组中的元素数量和顺序与 SQL 语句中的参数完全一致。TAOS_BIND 的使用方法与 MySQL 中的 MYSQL_BIND 一致,具体定义如下: ```c typedef struct TAOS_BIND { @@ -319,9 +336,35 @@ typedef struct TAOS_BIND { } TAOS_BIND; ``` +- `int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name)` + + (2.1.1.0 版本新增) + 当 SQL 语句中的表名使用了 `?` 占位时,可以使用此函数绑定一个具体的表名。 + +- `int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags)` + + (2.1.2.0 版本新增) + 当 SQL 语句中的表名和 TAGS 都使用了 `?` 占位时,可以使用此函数绑定具体的表名和具体的 TAGS 取值。最典型的使用场景是使用了自动建表功能的 INSERT 语句(目前版本不支持指定具体的 TAGS 列)。tags 参数中的列数量需要与 SQL 语句中要求的 TAGS 数量完全一致。 + +- `int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind)` + + (2.1.1.0 版本新增) + 以多列的方式传递待绑定的数据,需要保证这里传递的数据列的顺序与 SQL 语句中的 VALUES 参数完全一致。如果这里传递的数据列数少于 SQL 语句的要求,可以再次调用 `taos_stmt_bind_param_batch` 函数来补充数据列,直到列数与 SQL 语句的要求一致为止。TAOS_MULTI_BIND 的具体定义如下: + +```c +typedef struct TAOS_MULTI_BIND { + int buffer_type; + void * buffer; + uintptr_t buffer_length; + int32_t * length; + char * is_null; + int num; // 列的个数,即 buffer 中的参数个数 +} TAOS_MULTI_BIND; +``` + - `int taos_stmt_add_batch(TAOS_STMT *stmt)` - 将当前绑定的参数加入批处理中,调用此函数后,可以再次调用`taos_stmt_bind_param`绑定新的参数。需要注意,此函数仅支持 insert/import 语句,如果是select等其他SQL语句,将返回错误。 + 将当前绑定的参数加入批处理中,调用此函数后,可以再次调用 `taos_stmt_bind_param` 或 `taos_stmt_bind_param_batch` 绑定新的参数。需要注意,此函数仅支持 INSERT/IMPORT 语句,如果是 SELECT 等其他 SQL 语句,将返回错误。 - `int taos_stmt_execute(TAOS_STMT *stmt)` @@ -329,7 +372,7 @@ typedef struct TAOS_BIND { - `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)` - 获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result`以释放资源。 + 获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result` 以释放资源。 - `int taos_stmt_close(TAOS_STMT *stmt)` From f7190b2fdc416f045e43b784099f93552ad55489 Mon Sep 17 00:00:00 2001 From: lichuang Date: Thu, 3 Jun 2021 17:48:25 +0800 Subject: [PATCH 43/46] [TD-1920]fix compact bug:sync sdb to disk when compact end --- src/dnode/src/dnodeMain.c | 6 ++++++ src/mnode/src/mnodeSdb.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index a4ff9df203..cf633502c1 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -95,11 +95,17 @@ static SStep tsDnodeCompactSteps[] = { {"dnode-minfos", dnodeInitMInfos, dnodeCleanupMInfos}, {"dnode-wal", walInit, walCleanUp}, {"dnode-sync", syncInit, syncCleanUp}, + {"dnode-vread", dnodeInitVRead, dnodeCleanupVRead}, + {"dnode-vwrite", dnodeInitVWrite, dnodeCleanupVWrite}, + {"dnode-vmgmt", dnodeInitVMgmt, dnodeCleanupVMgmt}, {"dnode-mread", dnodeInitMRead, NULL}, {"dnode-mwrite", dnodeInitMWrite, NULL}, {"dnode-mpeer", dnodeInitMPeer, NULL}, {"dnode-vnodes", dnodeInitVnodes, dnodeCleanupVnodes}, {"dnode-modules", dnodeInitModules, dnodeCleanupModules}, + {"dnode-mread", NULL, dnodeCleanupMRead}, + {"dnode-mwrite", NULL, dnodeCleanupMWrite}, + {"dnode-mpeer", NULL, dnodeCleanupMPeer}, }; static int dnodeCreateDir(const char *dir) { diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index e9acd5b9bc..a8bcdfa59e 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -1176,9 +1176,10 @@ int32_t mnodeCompactWal() { return -1; } - // close wal - walFsync(tsSdbMgmt.wal, true); - walClose(tsSdbMgmt.wal); + // close sdb and sync to disk + //walFsync(tsSdbMgmt.wal, true); + //walClose(tsSdbMgmt.wal); + sdbCleanUp(); // rename old wal to wal_bak if (taosRename(tsMnodeDir, tsMnodeBakDir) != 0) { From 33c0f3b58af4ec2a4ee18967c24cc72ba3bc53ab Mon Sep 17 00:00:00 2001 From: Elias Soong Date: Thu, 3 Jun 2021 17:56:04 +0800 Subject: [PATCH 44/46] [TD-4533] : fix description about func "taos_stmt_bind_param_batch". --- documentation20/cn/08.connector/docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md index f3e85cc3dd..60f8df95f8 100644 --- a/documentation20/cn/08.connector/docs.md +++ b/documentation20/cn/08.connector/docs.md @@ -349,7 +349,7 @@ typedef struct TAOS_BIND { - `int taos_stmt_bind_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind)` (2.1.1.0 版本新增) - 以多列的方式传递待绑定的数据,需要保证这里传递的数据列的顺序与 SQL 语句中的 VALUES 参数完全一致。如果这里传递的数据列数少于 SQL 语句的要求,可以再次调用 `taos_stmt_bind_param_batch` 函数来补充数据列,直到列数与 SQL 语句的要求一致为止。TAOS_MULTI_BIND 的具体定义如下: + 以多列的方式传递待绑定的数据,需要保证这里传递的数据列的顺序、列的数量与 SQL 语句中的 VALUES 参数完全一致。TAOS_MULTI_BIND 的具体定义如下: ```c typedef struct TAOS_MULTI_BIND { From b1a0b834a19e0d6c09f2b9b457bccc5046549e2c Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Thu, 3 Jun 2021 10:03:19 +0000 Subject: [PATCH 45/46] [TD-4043]fix bug in session window --- src/query/src/qExecutor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 25e7e446bd..b7512ac1f0 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1347,7 +1347,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf pInfo->start = j; } else if (tsList[j] - pInfo->prevTs <= gap) { pInfo->curWindow.ekey = tsList[j]; - //pInfo->prevTs = tsList[j]; + pInfo->prevTs = tsList[j]; pInfo->numOfRows += 1; if (j == 0 && pInfo->start != 0) { pInfo->numOfRows = 1; From bd755045a54b8a8331144457c147d1f8d4fae21c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 3 Jun 2021 21:25:22 +0800 Subject: [PATCH 46/46] fix conflicts while mege from master --- src/client/src/tscSQLParser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 86f23cae8f..84d87af385 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5829,7 +5829,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p switch (s) { case 1: { if ((int32_t)p0->pVar.i64 <= 0) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); } @@ -5837,7 +5837,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p case 2: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); @@ -5848,7 +5848,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p tVariantListItem* p2 = taosArrayGet(pKeep, 2); if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) { - return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); } pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64);