sql.c 151.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/*
** 2000-05-29
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Driver template for the LEMON parser generator.
**
** The "lemon" program processes an LALR(1) input grammar file, then uses
** this template to construct a parser.  The "lemon" program inserts text
** at each "%%" line.  Also, any "P-a-r-s-e" identifer prefix (without the
** interstitial "-" characters) contained in this template is changed into
** the value of the %name directive from the grammar.  Otherwise, the content
** of this template is copied straight through into the generate parser
** source file.
**
** The following is the concatenation of all %include directives from the
** input grammar file:
*/
#include <stdio.h>
/************ Begin %include sections from the grammar ************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "astGenerator.h"
#include "tmsgtype.h"
#include "ttoken.h"
#include "ttokendef.h"
#include "tvariant.h"
38
#include "parserInt.h"
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders".  This section is blank unless
** "lemon" is run with the "-m" command-line option.
***************** Begin makeheaders token definitions *************************/
/**************** End makeheaders token definitions ***************************/

/* The next sections is a series of control #defines.
** various aspects of the generated parser.
**    YYCODETYPE         is the data type used to store the integer codes
**                       that represent terminal and non-terminal symbols.
**                       "unsigned char" is used if there are fewer than
**                       256 symbols.  Larger types otherwise.
**    YYNOCODE           is a number of type YYCODETYPE that is not used for
**                       any terminal or nonterminal symbol.
**    YYFALLBACK         If defined, this indicates that one or more tokens
**                       (also known as: "terminal symbols") have fall-back
**                       values which should be used if the original symbol
**                       would not parse.  This permits keywords to sometimes
**                       be used as identifiers, for example.
**    YYACTIONTYPE       is the data type used for "action codes" - numbers
**                       that indicate what to do in response to the next
**                       token.
**    ParseTOKENTYPE     is the data type used for minor type for terminal
**                       symbols.  Background: A "minor type" is a semantic
**                       value associated with a terminal or non-terminal
**                       symbols.  For example, for an "ID" terminal symbol,
**                       the minor type might be the name of the identifier.
**                       Each non-terminal can have a different minor type.
**                       Terminal symbols all have the same minor type, though.
**                       This macros defines the minor type for terminal 
**                       symbols.
**    YYMINORTYPE        is the data type used for all minor types.
**                       This is typically a union of many types, one of
**                       which is ParseTOKENTYPE.  The entry in the union
**                       for terminal symbols is called "yy0".
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
**                       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_STORE     Code to store %extra_argument into yypParser
**    ParseARG_FETCH     Code to extract %extra_argument from yypParser
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYNTOKEN           Number of terminal symbols
**    YY_MAX_SHIFT       Maximum value for shift actions
**    YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
**    YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
**    YY_ERROR_ACTION    The yy_action[] code for syntax error
**    YY_ACCEPT_ACTION   The yy_action[] code for accept
**    YY_NO_ACTION       The yy_action[] code for no-op
**    YY_MIN_REDUCE      Minimum value for reduce actions
**    YY_MAX_REDUCE      Maximum value for reduce actions
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
H
Haojun Liao 已提交
100
#define YYNOCODE 274
101 102 103 104 105
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
  int yyinit;
  ParseTOKENTYPE yy0;
H
Haojun Liao 已提交
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
  SWindowStateVal yy6;
  SRelationInfo* yy10;
  SCreateDbInfo yy16;
  int32_t yy46;
  int yy47;
  SSessionWindowVal yy97;
  SField yy106;
  SCreatedTableInfo yy150;
  SArray* yy165;
  tSqlExpr* yy202;
  int64_t yy207;
  SCreateAcctInfo yy211;
  SSqlNode* yy278;
  SCreateTableSql* yy326;
  SLimit yy367;
  SVariant yy425;
  SSubclause* yy503;
  SIntervalVal yy532;
124 125 126 127 128 129 130 131 132
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#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 YYFALLBACK 1
H
Haojun Liao 已提交
133 134
#define YYNSTATE             366
#define YYNRULE              303
135
#define YYNTOKEN             191
H
Haojun Liao 已提交
136 137 138 139 140 141 142 143
#define YY_MAX_SHIFT         365
#define YY_MIN_SHIFTREDUCE   587
#define YY_MAX_SHIFTREDUCE   889
#define YY_ERROR_ACTION      890
#define YY_ACCEPT_ACTION     891
#define YY_NO_ACTION         892
#define YY_MIN_REDUCE        893
#define YY_MAX_REDUCE        1195
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
/************* End control #defines *******************************************/

/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
**
** Applications can choose to define yytestcase() in the %include section
** to a macro that can assist in verifying code coverage.  For production
** code the yytestcase() macro should be turned off.  But it is useful
** for testing.
*/
#ifndef yytestcase
# define yytestcase(X)
#endif


/* Next are the tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
** functions that take a state number and lookahead value and return an
** action integer.  
**
** Suppose the action integer is N.  Then the action is determined as
** follows
**
**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead
**                                      token onto the stack and goto state N.
**
**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then
**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.
**
**   N == YY_ERROR_ACTION               A syntax error has occurred.
**
**   N == YY_ACCEPT_ACTION              The parser accepts its input.
**
**   N == YY_NO_ACTION                  No such action.  Denotes unused
**                                      slots in the yy_action[] table.
**
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
**     and YY_MAX_REDUCE
**
** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as either:
**
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
**    (B)   N = yy_default[S]
**
** The (A) formula is preferred.  The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
**
**  yy_action[]        A single table containing all actions.
**  yy_lookahead[]     A table containing the lookahead for each entry in
**                     yy_action.  Used to detect hash collisions.
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
**
*********** Begin parsing tables **********************************************/
H
Haojun Liao 已提交
209
#define YY_ACTTAB_COUNT (782)
210
static const YYACTIONTYPE yy_action[] = {
H
Haojun Liao 已提交
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
 /*     0 */   249,  638,  364,  230,  162,  639,  248,   55,   56,  638,
 /*    10 */    59,   60, 1031,  639,  252,   49,   48,   47,   94,   58,
 /*    20 */   323,   63,   61,   64,   62,  674, 1080,  891,  365,   54,
 /*    30 */    53,  206,   82,   52,   51,   50,  253,   55,   56,  638,
 /*    40 */    59,   60, 1171,  639,  252,   49,   48,   47,   21,   58,
 /*    50 */   323,   63,   61,   64,   62, 1017,  203, 1015, 1016,   54,
 /*    60 */    53,  206, 1018,   52,   51,   50, 1019,  206, 1020, 1021,
 /*    70 */   832,  835, 1172,   55,   56, 1070,   59,   60, 1172, 1118,
 /*    80 */   252,   49,   48,   47,   81,   58,  323,   63,   61,   64,
 /*    90 */    62,  321,  319,  274, 1077,   54,   53,  206,  638,   52,
 /*   100 */    51,   50,  639,   55,   57,  353,   59,   60, 1172,  826,
 /*   110 */   252,   49,   48,   47,  155,   58,  323,   63,   61,   64,
 /*   120 */    62,   42,  319,  359,  358,   54,   53,  162,  357,   52,
 /*   130 */    51,   50,  356,   87,  355,  354,  162,  162,  588,  589,
 /*   140 */   590,  591,  592,  593,  594,  595,  596,  597,  598,  599,
 /*   150 */   600,  601,  153,   56,  231,   59,   60,  236, 1057,  252,
 /*   160 */    49,   48,   47,   87,   58,  323,   63,   61,   64,   62,
 /*   170 */   772,   43,   32,   86,   54,   53,  255,  204,   52,   51,
 /*   180 */    50,  309,  209,  280,  279,   59,   60,  941,  839,  252,
 /*   190 */    49,   48,   47,  188,   58,  323,   63,   61,   64,   62,
 /*   200 */   294,   43,   92,  242,   54,   53,  300, 1045,   52,   51,
 /*   210 */    50, 1119,   93,  292,   42,  317,  359,  358,  316,  315,
 /*   220 */   314,  357,  313,  312,  311,  356,  310,  355,  354,   99,
 /*   230 */    22, 1010,  998,  999, 1000, 1001, 1002, 1003, 1004, 1005,
 /*   240 */  1006, 1007, 1008, 1009, 1011, 1012, 1013,  215,  251,  841,
 /*   250 */   830,  833,  836,  256,  216,  254,  776,  331,  330,  250,
 /*   260 */   137,  136,  135,  217, 1033,  266,  719,  328,   87,  251,
 /*   270 */   841,  830,  833,  836,  270,  269,  228,  229,  831,  834,
 /*   280 */   324,    4,   63,   61,   64,   62,  755,  752,  753,  754,
 /*   290 */    54,   53,  343,  342,   52,   51,   50,  228,  229,  747,
 /*   300 */   744,  745,  746,   52,   51,   50,   43,    3,   39,  178,
 /*   310 */   152,  150,  149,  257,  258,  105,   77,  101,  108, 1039,
 /*   320 */    96,  791,  792,  260,   36,   65,  244,  245,  273,   36,
 /*   330 */    79,  197,  195,  193,   36,  305,  210,  224,  192,  141,
 /*   340 */   140,  139,  138,   36,   36,   36,   65,  122,  116,  126,
 /*   350 */    36,  211, 1028, 1029,   33, 1032,  131,  134,  125,  638,
 /*   360 */    36,  842,  837,  639,  243,  128,   36,  232,  838,   54,
 /*   370 */    53, 1042,  240,   52,   51,   50, 1042,  241,   36,   36,
 /*   380 */    36, 1042,  842,  837, 1166,  261,  332,  333,  334,  838,
 /*   390 */  1042, 1042, 1042,  335,  176,   12,  840, 1042,  756,  757,
 /*   400 */   262,   95,  259,  339,  338,  337,  171, 1042,  363,  362,
 /*   410 */   146,  748,  749, 1041,  246,   80,  808, 1070, 1045, 1070,
 /*   420 */   261,  340,  341,  345,  282, 1042, 1042, 1042,  124,  177,
 /*   430 */    98,  261,  952,  942,  769,  233,   27,  234,  188,  188,
 /*   440 */  1043,  275,  353,  360,  979,   84,   85,  788, 1030,  798,
 /*   450 */   799,   71,   74,  729,  297,  731,  299,   37,  325,    7,
 /*   460 */   742,  743,  730,  157,  828,   66,   24,  740,  741,   37,
 /*   470 */    37,   67,   97,  864,  807,  760,  761,  843,   67,  637,
 /*   480 */    14,   78,   13,   70,   70,  115, 1165,  114,   16,   23,
 /*   490 */    15,   75,   72,   23, 1111,   23,  829,  758,  759,  133,
 /*   500 */   132,   18,  121,   17,  120,   20, 1164,   19, 1129,  226,
 /*   510 */   322,  227,  207, 1056,  718,  208,  212,  205,  213,  214,
 /*   520 */  1044,  219, 1072,  220, 1191,  221,  218,  202, 1128, 1183,
 /*   530 */   238, 1125, 1124,  239,  344,  271,  154,   44,  172, 1079,
 /*   540 */   151, 1110, 1090, 1087, 1088, 1071,  277, 1092, 1040,  156,
 /*   550 */  1068,  281,  235,  283,   31,  161,  285,  165,  288,  173,
 /*   560 */   163,  168,  787,  845,  164,  276, 1038,  174,  166,  169,
 /*   570 */   167,  291,  175,  956,  302,  303,  304,   76,  307,  308,
 /*   580 */   200,   40,  320,  951,  950,  329, 1190,  112,   73, 1189,
 /*   590 */  1186,  179,   46,  336,  295, 1182,  118,  287, 1181, 1178,
 /*   600 */   180,  976,   41,   38,  201,  939,  127,  937,  129,  130,
 /*   610 */   935,  934,  263,  190,  191,  931,  930,  929,  928,  293,
 /*   620 */   927,  926,  925,  194,  196,  922,  920,  918,  916,  198,
 /*   630 */   913,  199,  909,  289,  284,   83,   88,   45,  286, 1112,
 /*   640 */   306,  123,  346,  225,  247,  347,  301,  348,  349,  351,
 /*   650 */   222,  223,  350,  352,  361,  955,  954,  106,  889,  264,
 /*   660 */   265,  888,  267,  268,  887,  870,  933,  869,  272,  183,
 /*   670 */   182,  977,  932,  181,  142,  184,  185,  187,  186,  143,
 /*   680 */   144,  924,  978,  923,    2,   70,  145,  915,  914,  296,
 /*   690 */     8,   28,    1,  763,  278,  170,  789,   89,  158,  160,
 /*   700 */   800,  159,  237,  794,   90,   29,  796,   91,  290,    9,
 /*   710 */    30,   10,   11,   25,   26,  298,  100,   34,   98,  103,
 /*   720 */   652,  102,  690,   35,  104,  687,  685,  684,  683,  681,
 /*   730 */   680,  679,  676,  642,  326,  327,  107,  111,  109,  318,
 /*   740 */   113,  110,    5,   68,  844,  846,    6,   69,  721,   37,
 /*   750 */   117,  119,  720,  717,  668,  666,  658,  664,  660,  662,
 /*   760 */   656,  654,  689,  688,  686,  682,  678,  677,  189,  640,
 /*   770 */   893,  605,  892,  892,  892,  892,  892,  892,  892,  892,
 /*   780 */   147,  148,
290 291
};
static const YYCODETYPE yy_lookahead[] = {
H
Haojun Liao 已提交
292 293 294 295 296 297 298 299
 /*     0 */   200,    1,  194,  195,  194,    5,  200,    7,    8,    1,
 /*    10 */    10,   11,    0,    5,   14,   15,   16,   17,  245,   19,
 /*    20 */    20,   21,   22,   23,   24,    3,  194,  192,  193,   29,
 /*    30 */    30,  261,  259,   33,   34,   35,  200,    7,    8,    1,
 /*    40 */    10,   11,  272,    5,   14,   15,   16,   17,  261,   19,
 /*    50 */    20,   21,   22,   23,   24,  216,  261,  218,  219,   29,
 /*    60 */    30,  261,  223,   33,   34,   35,  227,  261,  229,  230,
 /*    70 */     3,    4,  272,    7,    8,  240,   10,   11,  272,  269,
300
 /*    80 */    14,   15,   16,   17,   84,   19,   20,   21,   22,   23,
H
Haojun Liao 已提交
301 302 303 304 305
 /*    90 */    24,   83,   80,  258,  262,   29,   30,  261,    1,   33,
 /*   100 */    34,   35,    5,    7,    8,   88,   10,   11,  272,   79,
 /*   110 */    14,   15,   16,   17,  194,   19,   20,   21,   22,   23,
 /*   120 */    24,   96,   80,   98,   99,   29,   30,  194,  103,   33,
 /*   130 */    34,   35,  107,   78,  109,  110,  194,  194,   41,   42,
306
 /*   140 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
H
Haojun Liao 已提交
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
 /*   150 */    53,   54,   55,    8,   57,   10,   11,  243,  244,   14,
 /*   160 */    15,   16,   17,   78,   19,   20,   21,   22,   23,   24,
 /*   170 */    33,  116,   78,  118,   29,   30,   64,  261,   33,   34,
 /*   180 */    35,   63,  261,  263,  264,   10,   11,  199,  121,   14,
 /*   190 */    15,   16,   17,  205,   19,   20,   21,   22,   23,   24,
 /*   200 */   267,  116,  269,  238,   29,   30,  112,  242,   33,   34,
 /*   210 */    35,  269,  269,  271,   96,   97,   98,   99,  100,  101,
 /*   220 */   102,  103,  104,  105,  106,  107,  108,  109,  110,  201,
 /*   230 */    40,  216,  217,  218,  219,  220,  221,  222,  223,  224,
 /*   240 */   225,  226,  227,  228,  229,  230,  231,   57,    1,    2,
 /*   250 */     3,    4,    5,  141,   64,  143,  119,  145,  146,   56,
 /*   260 */    70,   71,   72,   73,  236,  139,    3,   77,   78,    1,
 /*   270 */     2,    3,    4,    5,  148,  149,   29,   30,    3,    4,
 /*   280 */    33,   78,   21,   22,   23,   24,    2,    3,    4,    5,
 /*   290 */    29,   30,   29,   30,   33,   34,   35,   29,   30,    2,
 /*   300 */     3,    4,    5,   33,   34,   35,  116,   58,   59,   60,
 /*   310 */    58,   59,   60,   29,   30,   66,   67,   68,   69,  194,
 /*   320 */   201,  122,  123,   64,  194,   78,   29,   30,  138,  194,
 /*   330 */   140,   58,   59,   60,  194,   86,  261,  147,   65,   66,
 /*   340 */    67,   68,   69,  194,  194,  194,   78,   58,   59,   60,
 /*   350 */   194,  261,  233,  234,  235,  236,   67,   68,   69,    1,
 /*   360 */   194,  114,  115,    5,  239,   76,  194,  237,  121,   29,
 /*   370 */    30,  241,  237,   33,   34,   35,  241,  237,  194,  194,
 /*   380 */   194,  241,  114,  115,  261,  194,  237,  237,  237,  121,
 /*   390 */   241,  241,  241,  237,  203,   78,  121,  241,  114,  115,
 /*   400 */   141,   84,  143,  237,  145,  146,  248,  241,   61,   62,
 /*   410 */    63,  114,  115,  241,  238,  201,   72,  240,  242,  240,
 /*   420 */   194,  237,  237,  237,  266,  241,  241,  241,   74,  203,
 /*   430 */   113,  194,  199,  199,   95,  258,   78,  258,  205,  205,
 /*   440 */   203,   79,   88,  214,  215,   79,   79,   79,  234,   79,
 /*   450 */    79,   95,   95,   79,   79,   79,   79,   95,    9,  120,
 /*   460 */     3,    4,   79,   95,    1,   95,   95,    3,    4,   95,
 /*   470 */    95,   95,   95,   79,  130,    3,    4,   79,   95,   79,
 /*   480 */   142,   78,  144,  117,  117,  142,  261,  144,  142,   95,
 /*   490 */   144,  134,  136,   95,  270,   95,   33,    3,    4,   74,
 /*   500 */    75,  142,  142,  144,  144,  142,  261,  144,  232,  261,
 /*   510 */   194,  261,  261,  244,  111,  261,  261,  261,  261,  261,
 /*   520 */   242,  261,  240,  261,  244,  261,  261,  261,  232,  244,
 /*   530 */   232,  232,  232,  232,  232,  194,  194,  260,  246,  194,
 /*   540 */    56,  270,  194,  194,  194,  240,  240,  194,  240,  194,
 /*   550 */   257,  265,  265,  265,  247,  194,  265,  254,  194,  194,
 /*   560 */   256,  251,  121,  114,  255,  196,  194,  194,  253,  250,
 /*   570 */   252,  126,  194,  194,  194,  194,  194,  133,  194,  194,
 /*   580 */   194,  194,  194,  194,  194,  194,  194,  194,  135,  194,
 /*   590 */   194,  194,  132,  194,  128,  194,  194,  124,  194,  194,
 /*   600 */   194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
 /*   610 */   194,  194,  194,  194,  194,  194,  194,  194,  194,  131,
 /*   620 */   194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
 /*   630 */   194,  194,  194,  125,  127,  196,  196,  137,  196,  196,
 /*   640 */    87,   94,   93,  196,  196,   47,  196,   90,   92,   91,
 /*   650 */   196,  196,   51,   89,   80,  204,  204,  201,    3,  150,
 /*   660 */     3,    3,  150,    3,    3,   98,  196,   97,  139,  207,
 /*   670 */   211,  213,  196,  212,  197,  210,  208,  206,  209,  197,
 /*   680 */   197,  196,  215,  196,  198,  117,  197,  196,  196,  112,
 /*   690 */    78,   78,  202,   79,   95,  249,   79,   95,   78,   95,
 /*   700 */    79,   78,    1,   79,   78,   95,   79,   78,   78,  129,
 /*   710 */    95,  129,   78,   78,   78,  112,   74,   85,  113,   66,
 /*   720 */     3,   84,    3,   85,   84,    5,    3,    3,    3,    3,
 /*   730 */     3,    3,    3,   81,   20,   55,   74,  144,   82,    9,
 /*   740 */   144,   82,   78,   10,   79,  114,   78,   10,    3,   95,
 /*   750 */   144,  144,    3,   79,    3,    3,    3,    3,    3,    3,
 /*   760 */     3,    3,    3,    3,    3,    3,    3,    3,   95,   81,
 /*   770 */     0,   56,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   780 */    15,   15,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   790 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   800 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   810 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   820 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   830 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   840 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   850 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   860 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   870 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   880 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   890 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   900 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   910 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   920 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   930 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   940 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   950 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   960 */   273,  273,  273,  273,  273,  273,  273,  273,  273,  273,
 /*   970 */   273,  273,  273,
390
};
H
Haojun Liao 已提交
391
#define YY_SHIFT_COUNT    (365)
392
#define YY_SHIFT_MIN      (0)
H
Haojun Liao 已提交
393
#define YY_SHIFT_MAX      (770)
394
static const unsigned short int yy_shift_ofst[] = {
H
Haojun Liao 已提交
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
 /*     0 */   190,  118,   25,   42,  247,  268,  268,  358,   38,   38,
 /*    10 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*    20 */    38,    0,   97,  268,  284,  297,  297,   85,   85,   38,
 /*    30 */    38,  199,   38,   12,   38,   38,   38,   38,  354,   42,
 /*    40 */    17,   17,   22,  782,  268,  268,  268,  268,  268,  268,
 /*    50 */   268,  268,  268,  268,  268,  268,  268,  268,  268,  268,
 /*    60 */   268,  268,  268,  268,  268,  268,  284,  297,  284,  284,
 /*    70 */    55,  263,  263,  263,  263,  263,  263,    8,  263,   38,
 /*    80 */    38,   38,  137,   38,   38,   38,   85,   85,   38,   38,
 /*    90 */    38,   38,  344,  344,  339,   85,   38,   38,   38,   38,
 /*   100 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*   110 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*   120 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*   130 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*   140 */    38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
 /*   150 */    38,   38,   38,   38,  484,  484,  484,  441,  441,  441,
 /*   160 */   441,  484,  484,  444,  453,  466,  460,  488,  445,  508,
 /*   170 */   473,  507,  500,  484,  484,  484,  553,  553,   42,  484,
 /*   180 */   484,  547,  549,  598,  557,  556,  601,  558,  564,   22,
 /*   190 */   484,  484,  574,  574,  484,  574,  484,  574,  484,  484,
 /*   200 */   782,  782,   30,   66,   66,   96,   66,  145,  175,  261,
 /*   210 */   261,  261,  261,  261,  261,  249,  273,  289,  340,  340,
 /*   220 */   340,  340,  112,  259,  126,  317,  270,  270,   67,  275,
 /*   230 */   347,  252,  362,  366,  367,  368,  370,  371,  356,  357,
 /*   240 */   374,  375,  376,  377,  457,  464,  383,   94,  394,  398,
 /*   250 */   463,  203,  449,  400,  338,  343,  346,  472,  494,  359,
 /*   260 */   360,  403,  363,  425,  655,  509,  657,  658,  512,  660,
 /*   270 */   661,  567,  570,  529,  568,  577,  612,  614,  613,  599,
 /*   280 */   602,  617,  620,  621,  623,  624,  604,  626,  627,  629,
 /*   290 */   701,  630,  610,  580,  615,  582,  634,  577,  635,  603,
 /*   300 */   636,  605,  642,  632,  637,  653,  717,  638,  640,  719,
 /*   310 */   720,  723,  724,  725,  726,  727,  728,  729,  652,  730,
 /*   320 */   662,  656,  659,  664,  665,  631,  668,  714,  680,  733,
 /*   330 */   593,  596,  654,  654,  654,  654,  737,  606,  607,  654,
 /*   340 */   654,  654,  745,  749,  674,  654,  751,  752,  753,  754,
 /*   350 */   755,  756,  757,  758,  759,  760,  761,  762,  763,  764,
 /*   360 */   673,  688,  765,  766,  715,  770,
432
};
433
#define YY_REDUCE_COUNT (201)
H
Haojun Liao 已提交
434 435
#define YY_REDUCE_MIN   (-230)
#define YY_REDUCE_MAX   (492)
436
static const short yy_reduce_ofst[] = {
H
Haojun Liao 已提交
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
 /*     0 */  -165,   15, -161,  119, -200, -194, -164,  -80,  130,  -58,
 /*    10 */   -67,  135,  140,  149,  150,  151,  156,  166,  184,  185,
 /*    20 */   186, -168, -192, -230,  -86,  -35,  176,  177,  179, -190,
 /*    30 */   -57,  158,  125,   28,  191,  226,  237,  172,  -12,  214,
 /*    40 */   233,  234,  229, -227, -213, -205,  -84,  -79,   75,   90,
 /*    50 */   123,  225,  245,  248,  250,  251,  254,  255,  256,  257,
 /*    60 */   258,  260,  262,  264,  265,  266,  269,  278,  280,  285,
 /*    70 */   282,  276,  296,  298,  299,  300,  301,  316,  302,  341,
 /*    80 */   342,  345,  277,  348,  349,  350,  305,  306,  353,  355,
 /*    90 */   361,  364,  224,  271,  292,  308,  365,  372,  373,  378,
 /*   100 */   379,  380,  381,  382,  384,  385,  386,  387,  388,  389,
 /*   110 */   390,  391,  392,  393,  395,  396,  397,  399,  401,  402,
 /*   120 */   404,  405,  406,  407,  408,  409,  410,  411,  412,  413,
 /*   130 */   414,  415,  416,  417,  418,  419,  420,  421,  422,  423,
 /*   140 */   424,  426,  427,  428,  429,  430,  431,  432,  433,  434,
 /*   150 */   435,  436,  437,  438,  369,  439,  440,  286,  287,  288,
 /*   160 */   291,  442,  443,  293,  304,  309,  303,  315,  318,  310,
 /*   170 */   319,  446,  307,  447,  448,  450,  451,  452,  456,  454,
 /*   180 */   455,  458,  461,  459,  462,  465,  468,  469,  471,  467,
 /*   190 */   470,  476,  477,  482,  485,  483,  487,  489,  491,  492,
 /*   200 */   490,  486,
458 459
};
static const YYACTIONTYPE yy_default[] = {
H
Haojun Liao 已提交
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
 /*     0 */   890,  953,  940,  949, 1174, 1174, 1174,  890,  890,  890,
 /*    10 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*    20 */   890, 1081,  910, 1174,  890,  890,  890,  890,  890,  890,
 /*    30 */   890, 1096,  890,  949,  890,  890,  890,  890,  959,  949,
 /*    40 */   959,  959,  890, 1076,  890,  890,  890,  890,  890,  890,
 /*    50 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*    60 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*    70 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*    80 */   890,  890, 1083, 1089, 1086,  890,  890,  890, 1091,  890,
 /*    90 */   890,  890, 1115, 1115, 1074,  890,  890,  890,  890,  890,
 /*   100 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   110 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   120 */   890,  890,  890,  890,  890,  890,  890,  938,  890,  936,
 /*   130 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   140 */   890,  890,  890,  890,  890,  890,  921,  890,  890,  890,
 /*   150 */   890,  890,  890,  908,  912,  912,  912,  890,  890,  890,
 /*   160 */   890,  912,  912, 1122, 1126, 1108, 1120, 1116, 1103, 1101,
 /*   170 */  1099, 1107, 1130,  912,  912,  912,  957,  957,  949,  912,
 /*   180 */   912,  975,  973,  971,  963,  969,  965,  967,  961,  890,
 /*   190 */   912,  912,  947,  947,  912,  947,  912,  947,  912,  912,
 /*   200 */   997, 1014,  890, 1131, 1121,  890, 1173, 1161, 1160, 1169,
 /*   210 */  1168, 1167, 1159, 1158, 1157,  890,  890,  890, 1153, 1156,
 /*   220 */  1155, 1154,  890,  890,  890,  890, 1163, 1162,  890,  890,
 /*   230 */   890,  890,  890,  890,  890,  890,  890,  890, 1127, 1123,
 /*   240 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   250 */   890, 1133,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   260 */   890, 1022,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   270 */   890,  890,  890,  890, 1073,  890,  890,  890,  890, 1085,
 /*   280 */  1084,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   290 */   890,  890, 1117,  890, 1109,  890,  890, 1034,  890,  890,
 /*   300 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   310 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   320 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   330 */   890,  890, 1192, 1187, 1188, 1185,  890,  890,  890, 1184,
 /*   340 */  1179, 1180,  890,  890,  890, 1177,  890,  890,  890,  890,
 /*   350 */   890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
 /*   360 */   981,  890,  919,  917,  890,  890,
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
};
/********** End of lemon-generated parsing tables *****************************/

/* The next table maps tokens (terminal symbols) into fallback tokens.  
** If a construct like the following:
** 
**      %fallback ID X Y Z.
**
** appears in the grammar, then ID becomes a fallback token for X, Y,
** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
** but it does not parse, the type of the token is changed to ID and
** the parse is retried before an error is thrown.
**
** This feature can be used, for example, to cause some keywords in a language
** to revert to identifiers if they keyword does not apply in the context where
** it appears.
*/
#ifdef YYFALLBACK
static const YYCODETYPE yyFallback[] = {
    0,  /*          $ => nothing */
    0,  /*         ID => nothing */
    1,  /*       BOOL => ID */
    1,  /*    INTEGER => ID */
    1,  /*      FLOAT => ID */
    1,  /*     STRING => ID */
    1,  /*  TIMESTAMP => ID */
    0,  /*         OR => nothing */
    0,  /*        AND => nothing */
    0,  /*        NOT => nothing */
    0,  /*         EQ => nothing */
    0,  /*         NE => nothing */
    0,  /*     ISNULL => nothing */
    0,  /*    NOTNULL => nothing */
    0,  /*         IS => nothing */
    1,  /*       LIKE => ID */
    1,  /*      MATCH => ID */
    1,  /*     NMATCH => ID */
    1,  /*       GLOB => ID */
    0,  /*    BETWEEN => nothing */
    0,  /*         IN => nothing */
    0,  /*         GT => nothing */
    0,  /*         GE => nothing */
    0,  /*         LT => nothing */
    0,  /*         LE => nothing */
    0,  /*     BITAND => nothing */
    0,  /*      BITOR => nothing */
    0,  /*     LSHIFT => nothing */
    0,  /*     RSHIFT => nothing */
    0,  /*       PLUS => nothing */
    0,  /*      MINUS => nothing */
    0,  /*     DIVIDE => nothing */
    0,  /*      TIMES => nothing */
    0,  /*       STAR => nothing */
    0,  /*      SLASH => nothing */
    0,  /*        REM => nothing */
    0,  /*     CONCAT => nothing */
    0,  /*     UMINUS => nothing */
    0,  /*      UPLUS => nothing */
    0,  /*     BITNOT => nothing */
    0,  /*       SHOW => nothing */
    0,  /*  DATABASES => nothing */
    0,  /*     TOPICS => nothing */
    0,  /*  FUNCTIONS => nothing */
    0,  /*     MNODES => nothing */
    0,  /*     DNODES => nothing */
    0,  /*   ACCOUNTS => nothing */
    0,  /*      USERS => nothing */
    0,  /*    MODULES => nothing */
    0,  /*    QUERIES => nothing */
    0,  /* CONNECTIONS => nothing */
    0,  /*    STREAMS => nothing */
    0,  /*  VARIABLES => nothing */
    0,  /*     SCORES => nothing */
    0,  /*     GRANTS => nothing */
    0,  /*     VNODES => nothing */
    0,  /*        DOT => nothing */
    0,  /*     CREATE => nothing */
    0,  /*      TABLE => nothing */
    1,  /*     STABLE => ID */
    1,  /*   DATABASE => ID */
    0,  /*     TABLES => nothing */
    0,  /*    STABLES => nothing */
    0,  /*    VGROUPS => nothing */
    0,  /*       DROP => nothing */
    0,  /*      TOPIC => nothing */
    0,  /*   FUNCTION => nothing */
    0,  /*      DNODE => nothing */
    0,  /*       USER => nothing */
    0,  /*    ACCOUNT => nothing */
    0,  /*        USE => nothing */
    0,  /*   DESCRIBE => nothing */
    1,  /*       DESC => ID */
    0,  /*      ALTER => nothing */
    0,  /*       PASS => nothing */
    0,  /*  PRIVILEGE => nothing */
    0,  /*      LOCAL => nothing */
    0,  /*    COMPACT => nothing */
    0,  /*         LP => nothing */
    0,  /*         RP => nothing */
    0,  /*         IF => nothing */
    0,  /*     EXISTS => nothing */
598
    0,  /*       PORT => nothing */
599
    1,  /*    IPTOKEN => ID */
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
    0,  /*         AS => nothing */
    0,  /* OUTPUTTYPE => nothing */
    0,  /*  AGGREGATE => nothing */
    0,  /*    BUFSIZE => nothing */
    0,  /*        PPS => nothing */
    0,  /*    TSERIES => nothing */
    0,  /*        DBS => nothing */
    0,  /*    STORAGE => nothing */
    0,  /*      QTIME => nothing */
    0,  /*      CONNS => nothing */
    0,  /*      STATE => nothing */
    0,  /*      COMMA => nothing */
    0,  /*       KEEP => nothing */
    0,  /*      CACHE => nothing */
    0,  /*    REPLICA => nothing */
    0,  /*     QUORUM => nothing */
    0,  /*       DAYS => nothing */
    0,  /*    MINROWS => nothing */
    0,  /*    MAXROWS => nothing */
    0,  /*     BLOCKS => nothing */
    0,  /*      CTIME => nothing */
    0,  /*        WAL => nothing */
    0,  /*      FSYNC => nothing */
    0,  /*       COMP => nothing */
    0,  /*  PRECISION => nothing */
    0,  /*     UPDATE => nothing */
    0,  /*  CACHELAST => nothing */
    0,  /*   UNSIGNED => nothing */
    0,  /*       TAGS => nothing */
    0,  /*      USING => nothing */
    1,  /*       NULL => ID */
    1,  /*        NOW => ID */
    0,  /*     SELECT => nothing */
    0,  /*      UNION => nothing */
    1,  /*        ALL => ID */
    0,  /*   DISTINCT => nothing */
    0,  /*       FROM => nothing */
    0,  /*   VARIABLE => nothing */
    0,  /*   INTERVAL => nothing */
    0,  /*      EVERY => nothing */
    0,  /*    SESSION => nothing */
    0,  /* STATE_WINDOW => nothing */
    0,  /*       FILL => nothing */
    0,  /*    SLIDING => nothing */
    0,  /*      ORDER => nothing */
    0,  /*         BY => nothing */
    1,  /*        ASC => ID */
    0,  /*      GROUP => nothing */
    0,  /*     HAVING => nothing */
    0,  /*      LIMIT => nothing */
    1,  /*     OFFSET => ID */
    0,  /*     SLIMIT => nothing */
    0,  /*    SOFFSET => nothing */
    0,  /*      WHERE => nothing */
    0,  /*      RESET => nothing */
    0,  /*      QUERY => nothing */
    0,  /*     SYNCDB => nothing */
    0,  /*        ADD => nothing */
    0,  /*     COLUMN => nothing */
    0,  /*     MODIFY => nothing */
    0,  /*        TAG => nothing */
    0,  /*     CHANGE => nothing */
    0,  /*        SET => nothing */
    0,  /*       KILL => nothing */
    0,  /* CONNECTION => nothing */
    0,  /*     STREAM => nothing */
    0,  /*      COLON => nothing */
    1,  /*      ABORT => ID */
    1,  /*      AFTER => ID */
    1,  /*     ATTACH => ID */
    1,  /*     BEFORE => ID */
    1,  /*      BEGIN => ID */
    1,  /*    CASCADE => ID */
    1,  /*    CLUSTER => ID */
    1,  /*   CONFLICT => ID */
    1,  /*       COPY => ID */
    1,  /*   DEFERRED => ID */
    1,  /* DELIMITERS => ID */
    1,  /*     DETACH => ID */
    1,  /*       EACH => ID */
    1,  /*        END => ID */
    1,  /*    EXPLAIN => ID */
    1,  /*       FAIL => ID */
    1,  /*        FOR => ID */
    1,  /*     IGNORE => ID */
    1,  /*  IMMEDIATE => ID */
    1,  /*  INITIALLY => ID */
    1,  /*    INSTEAD => ID */
    1,  /*        KEY => ID */
    1,  /*         OF => ID */
    1,  /*      RAISE => ID */
    1,  /*    REPLACE => ID */
    1,  /*   RESTRICT => ID */
    1,  /*        ROW => ID */
    1,  /*  STATEMENT => ID */
    1,  /*    TRIGGER => ID */
    1,  /*       VIEW => ID */
    1,  /*       SEMI => ID */
    1,  /*       NONE => ID */
    1,  /*       PREV => ID */
    1,  /*     LINEAR => ID */
    1,  /*     IMPORT => ID */
    1,  /*     TBNAME => ID */
    1,  /*       JOIN => ID */
    1,  /*     INSERT => ID */
    1,  /*       INTO => ID */
    1,  /*     VALUES => ID */
};
#endif /* YYFALLBACK */

/* The following structure represents a single element of the
** parser's stack.  Information stored includes:
**
**   +  The state number for the parser at this level of the stack.
**
**   +  The value of the token stored at this level of the stack.
**      (In other words, the "major" token.)
**
**   +  The semantic value stored at this level of the stack.  This is
**      the information used by the action routines in the grammar.
**      It is sometimes called the "minor" token.
**
** After the "shift" half of a SHIFTREDUCE action, the stateno field
** actually contains the reduce action for the second half of the
** SHIFTREDUCE.
*/
struct yyStackEntry {
  YYACTIONTYPE stateno;  /* The state-number, or reduce action in SHIFTREDUCE */
  YYCODETYPE major;      /* The major token value.  This is the code
                         ** number for the token at this stack level */
  YYMINORTYPE minor;     /* The user-supplied minor token value.  This
                         ** is the value of the token  */
};
typedef struct yyStackEntry yyStackEntry;

/* The state of the parser is completely contained in an instance of
** the following structure */
struct yyParser {
  yyStackEntry *yytos;          /* Pointer to top element of the stack */
#ifdef YYTRACKMAXSTACKDEPTH
  int yyhwm;                    /* High-water mark of the stack */
#endif
#ifndef YYNOERRORRECOVERY
  int yyerrcnt;                 /* Shifts left before out of the error */
#endif
  ParseARG_SDECL                /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
  yyStackEntry yystk0;          /* First stack entry */
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
  yyStackEntry *yystackEnd;            /* Last entry in the stack */
#endif
};
typedef struct yyParser yyParser;

#ifndef NDEBUG
#include <stdio.h>
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */

#ifndef NDEBUG
/* 
** Turn parser tracing on by giving a stream to which to write the trace
** and a prompt to preface each trace message.  Tracing is turned off
** by making either argument NULL 
**
** Inputs:
** <ul>
** <li> A FILE* to which trace output should be written.
**      If NULL, then tracing is turned off.
** <li> A prefix string written at the beginning of every
**      line of trace output.  If NULL, then tracing is
**      turned off.
** </ul>
**
** Outputs:
** None.
*/
void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
  yyTraceFILE = TraceFILE;
  yyTracePrompt = zTracePrompt;
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
}
#endif /* NDEBUG */

#if defined(YYCOVERAGE) || !defined(NDEBUG)
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
  /*    0 */ "$",
  /*    1 */ "ID",
  /*    2 */ "BOOL",
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
  /*    3 */ "INTEGER",
  /*    4 */ "FLOAT",
  /*    5 */ "STRING",
  /*    6 */ "TIMESTAMP",
  /*    7 */ "OR",
  /*    8 */ "AND",
  /*    9 */ "NOT",
  /*   10 */ "EQ",
  /*   11 */ "NE",
  /*   12 */ "ISNULL",
  /*   13 */ "NOTNULL",
  /*   14 */ "IS",
  /*   15 */ "LIKE",
  /*   16 */ "MATCH",
  /*   17 */ "NMATCH",
  /*   18 */ "GLOB",
  /*   19 */ "BETWEEN",
  /*   20 */ "IN",
  /*   21 */ "GT",
  /*   22 */ "GE",
  /*   23 */ "LT",
  /*   24 */ "LE",
  /*   25 */ "BITAND",
  /*   26 */ "BITOR",
  /*   27 */ "LSHIFT",
  /*   28 */ "RSHIFT",
  /*   29 */ "PLUS",
  /*   30 */ "MINUS",
  /*   31 */ "DIVIDE",
  /*   32 */ "TIMES",
  /*   33 */ "STAR",
  /*   34 */ "SLASH",
  /*   35 */ "REM",
  /*   36 */ "CONCAT",
  /*   37 */ "UMINUS",
  /*   38 */ "UPLUS",
  /*   39 */ "BITNOT",
  /*   40 */ "SHOW",
  /*   41 */ "DATABASES",
  /*   42 */ "TOPICS",
  /*   43 */ "FUNCTIONS",
  /*   44 */ "MNODES",
  /*   45 */ "DNODES",
  /*   46 */ "ACCOUNTS",
  /*   47 */ "USERS",
  /*   48 */ "MODULES",
  /*   49 */ "QUERIES",
  /*   50 */ "CONNECTIONS",
  /*   51 */ "STREAMS",
  /*   52 */ "VARIABLES",
  /*   53 */ "SCORES",
  /*   54 */ "GRANTS",
  /*   55 */ "VNODES",
  /*   56 */ "DOT",
  /*   57 */ "CREATE",
  /*   58 */ "TABLE",
  /*   59 */ "STABLE",
  /*   60 */ "DATABASE",
  /*   61 */ "TABLES",
  /*   62 */ "STABLES",
  /*   63 */ "VGROUPS",
  /*   64 */ "DROP",
  /*   65 */ "TOPIC",
  /*   66 */ "FUNCTION",
  /*   67 */ "DNODE",
  /*   68 */ "USER",
  /*   69 */ "ACCOUNT",
  /*   70 */ "USE",
  /*   71 */ "DESCRIBE",
  /*   72 */ "DESC",
  /*   73 */ "ALTER",
  /*   74 */ "PASS",
  /*   75 */ "PRIVILEGE",
  /*   76 */ "LOCAL",
  /*   77 */ "COMPACT",
  /*   78 */ "LP",
  /*   79 */ "RP",
  /*   80 */ "IF",
  /*   81 */ "EXISTS",
  /*   82 */ "PORT",
  /*   83 */ "IPTOKEN",
  /*   84 */ "AS",
  /*   85 */ "OUTPUTTYPE",
  /*   86 */ "AGGREGATE",
  /*   87 */ "BUFSIZE",
  /*   88 */ "PPS",
  /*   89 */ "TSERIES",
  /*   90 */ "DBS",
  /*   91 */ "STORAGE",
  /*   92 */ "QTIME",
  /*   93 */ "CONNS",
  /*   94 */ "STATE",
  /*   95 */ "COMMA",
  /*   96 */ "KEEP",
  /*   97 */ "CACHE",
  /*   98 */ "REPLICA",
  /*   99 */ "QUORUM",
  /*  100 */ "DAYS",
  /*  101 */ "MINROWS",
  /*  102 */ "MAXROWS",
  /*  103 */ "BLOCKS",
  /*  104 */ "CTIME",
  /*  105 */ "WAL",
  /*  106 */ "FSYNC",
  /*  107 */ "COMP",
  /*  108 */ "PRECISION",
  /*  109 */ "UPDATE",
  /*  110 */ "CACHELAST",
  /*  111 */ "UNSIGNED",
  /*  112 */ "TAGS",
  /*  113 */ "USING",
  /*  114 */ "NULL",
  /*  115 */ "NOW",
  /*  116 */ "SELECT",
  /*  117 */ "UNION",
  /*  118 */ "ALL",
  /*  119 */ "DISTINCT",
  /*  120 */ "FROM",
  /*  121 */ "VARIABLE",
  /*  122 */ "INTERVAL",
  /*  123 */ "EVERY",
  /*  124 */ "SESSION",
  /*  125 */ "STATE_WINDOW",
  /*  126 */ "FILL",
  /*  127 */ "SLIDING",
  /*  128 */ "ORDER",
  /*  129 */ "BY",
  /*  130 */ "ASC",
  /*  131 */ "GROUP",
  /*  132 */ "HAVING",
  /*  133 */ "LIMIT",
  /*  134 */ "OFFSET",
  /*  135 */ "SLIMIT",
  /*  136 */ "SOFFSET",
  /*  137 */ "WHERE",
  /*  138 */ "RESET",
  /*  139 */ "QUERY",
  /*  140 */ "SYNCDB",
  /*  141 */ "ADD",
  /*  142 */ "COLUMN",
  /*  143 */ "MODIFY",
  /*  144 */ "TAG",
  /*  145 */ "CHANGE",
  /*  146 */ "SET",
  /*  147 */ "KILL",
  /*  148 */ "CONNECTION",
  /*  149 */ "STREAM",
  /*  150 */ "COLON",
  /*  151 */ "ABORT",
  /*  152 */ "AFTER",
  /*  153 */ "ATTACH",
  /*  154 */ "BEFORE",
  /*  155 */ "BEGIN",
  /*  156 */ "CASCADE",
  /*  157 */ "CLUSTER",
  /*  158 */ "CONFLICT",
  /*  159 */ "COPY",
  /*  160 */ "DEFERRED",
  /*  161 */ "DELIMITERS",
  /*  162 */ "DETACH",
  /*  163 */ "EACH",
  /*  164 */ "END",
  /*  165 */ "EXPLAIN",
  /*  166 */ "FAIL",
  /*  167 */ "FOR",
  /*  168 */ "IGNORE",
  /*  169 */ "IMMEDIATE",
  /*  170 */ "INITIALLY",
  /*  171 */ "INSTEAD",
  /*  172 */ "KEY",
  /*  173 */ "OF",
  /*  174 */ "RAISE",
  /*  175 */ "REPLACE",
  /*  176 */ "RESTRICT",
  /*  177 */ "ROW",
  /*  178 */ "STATEMENT",
  /*  179 */ "TRIGGER",
  /*  180 */ "VIEW",
  /*  181 */ "SEMI",
  /*  182 */ "NONE",
  /*  183 */ "PREV",
  /*  184 */ "LINEAR",
  /*  185 */ "IMPORT",
  /*  186 */ "TBNAME",
  /*  187 */ "JOIN",
  /*  188 */ "INSERT",
  /*  189 */ "INTO",
  /*  190 */ "VALUES",
  /*  191 */ "error",
  /*  192 */ "program",
  /*  193 */ "cmd",
  /*  194 */ "ids",
  /*  195 */ "dbPrefix",
  /*  196 */ "cpxName",
  /*  197 */ "ifexists",
  /*  198 */ "alter_db_optr",
  /*  199 */ "acct_optr",
  /*  200 */ "exprlist",
  /*  201 */ "ifnotexists",
  /*  202 */ "db_optr",
  /*  203 */ "typename",
  /*  204 */ "bufsize",
  /*  205 */ "pps",
  /*  206 */ "tseries",
  /*  207 */ "dbs",
  /*  208 */ "streams",
  /*  209 */ "storage",
  /*  210 */ "qtime",
  /*  211 */ "users",
  /*  212 */ "conns",
  /*  213 */ "state",
  /*  214 */ "intitemlist",
  /*  215 */ "intitem",
  /*  216 */ "keep",
  /*  217 */ "cache",
  /*  218 */ "replica",
  /*  219 */ "quorum",
  /*  220 */ "days",
  /*  221 */ "minrows",
  /*  222 */ "maxrows",
  /*  223 */ "blocks",
  /*  224 */ "ctime",
  /*  225 */ "wal",
  /*  226 */ "fsync",
  /*  227 */ "comp",
  /*  228 */ "prec",
  /*  229 */ "update",
  /*  230 */ "cachelast",
H
Haojun Liao 已提交
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
  /*  231 */ "vgroups",
  /*  232 */ "signed",
  /*  233 */ "create_table_args",
  /*  234 */ "create_stable_args",
  /*  235 */ "create_table_list",
  /*  236 */ "create_from_stable",
  /*  237 */ "columnlist",
  /*  238 */ "tagitemlist1",
  /*  239 */ "tagNamelist",
  /*  240 */ "select",
  /*  241 */ "column",
  /*  242 */ "tagitem1",
  /*  243 */ "tagitemlist",
  /*  244 */ "tagitem",
  /*  245 */ "selcollist",
  /*  246 */ "from",
  /*  247 */ "where_opt",
  /*  248 */ "interval_option",
  /*  249 */ "sliding_opt",
  /*  250 */ "session_option",
  /*  251 */ "windowstate_option",
  /*  252 */ "fill_opt",
  /*  253 */ "groupby_opt",
  /*  254 */ "having_opt",
  /*  255 */ "orderby_opt",
  /*  256 */ "slimit_opt",
  /*  257 */ "limit_opt",
  /*  258 */ "union",
  /*  259 */ "sclp",
  /*  260 */ "distinct",
  /*  261 */ "expr",
  /*  262 */ "as",
  /*  263 */ "tablelist",
  /*  264 */ "sub",
  /*  265 */ "tmvar",
  /*  266 */ "intervalKey",
  /*  267 */ "sortlist",
  /*  268 */ "sortitem",
  /*  269 */ "item",
  /*  270 */ "sortorder",
  /*  271 */ "grouplist",
  /*  272 */ "expritem",
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
 /*   0 */ "program ::= cmd",
 /*   1 */ "cmd ::= SHOW DATABASES",
 /*   2 */ "cmd ::= SHOW TOPICS",
 /*   3 */ "cmd ::= SHOW FUNCTIONS",
 /*   4 */ "cmd ::= SHOW MNODES",
 /*   5 */ "cmd ::= SHOW DNODES",
 /*   6 */ "cmd ::= SHOW ACCOUNTS",
 /*   7 */ "cmd ::= SHOW USERS",
 /*   8 */ "cmd ::= SHOW MODULES",
 /*   9 */ "cmd ::= SHOW QUERIES",
 /*  10 */ "cmd ::= SHOW CONNECTIONS",
 /*  11 */ "cmd ::= SHOW STREAMS",
 /*  12 */ "cmd ::= SHOW VARIABLES",
 /*  13 */ "cmd ::= SHOW SCORES",
 /*  14 */ "cmd ::= SHOW GRANTS",
 /*  15 */ "cmd ::= SHOW VNODES",
 /*  16 */ "cmd ::= SHOW VNODES ids",
 /*  17 */ "dbPrefix ::=",
 /*  18 */ "dbPrefix ::= ids DOT",
 /*  19 */ "cpxName ::=",
 /*  20 */ "cpxName ::= DOT ids",
 /*  21 */ "cmd ::= SHOW CREATE TABLE ids cpxName",
 /*  22 */ "cmd ::= SHOW CREATE STABLE ids cpxName",
 /*  23 */ "cmd ::= SHOW CREATE DATABASE ids",
 /*  24 */ "cmd ::= SHOW dbPrefix TABLES",
 /*  25 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids",
 /*  26 */ "cmd ::= SHOW dbPrefix STABLES",
 /*  27 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids",
 /*  28 */ "cmd ::= SHOW dbPrefix VGROUPS",
 /*  29 */ "cmd ::= SHOW dbPrefix VGROUPS ids",
 /*  30 */ "cmd ::= DROP TABLE ifexists ids cpxName",
 /*  31 */ "cmd ::= DROP STABLE ifexists ids cpxName",
 /*  32 */ "cmd ::= DROP DATABASE ifexists ids",
 /*  33 */ "cmd ::= DROP TOPIC ifexists ids",
 /*  34 */ "cmd ::= DROP FUNCTION ids",
 /*  35 */ "cmd ::= DROP DNODE ids",
 /*  36 */ "cmd ::= DROP USER ids",
 /*  37 */ "cmd ::= DROP ACCOUNT ids",
 /*  38 */ "cmd ::= USE ids",
 /*  39 */ "cmd ::= DESCRIBE ids cpxName",
 /*  40 */ "cmd ::= DESC ids cpxName",
 /*  41 */ "cmd ::= ALTER USER ids PASS ids",
 /*  42 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
 /*  43 */ "cmd ::= ALTER DNODE ids ids",
 /*  44 */ "cmd ::= ALTER DNODE ids ids ids",
 /*  45 */ "cmd ::= ALTER LOCAL ids",
 /*  46 */ "cmd ::= ALTER LOCAL ids ids",
 /*  47 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
1121 1122 1123 1124 1125 1126 1127 1128 1129
 /*  48 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
 /*  49 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
 /*  50 */ "cmd ::= COMPACT VNODES IN LP exprlist RP",
 /*  51 */ "ids ::= ID",
 /*  52 */ "ids ::= STRING",
 /*  53 */ "ifexists ::= IF EXISTS",
 /*  54 */ "ifexists ::=",
 /*  55 */ "ifnotexists ::= IF NOT EXISTS",
 /*  56 */ "ifnotexists ::=",
1130
 /*  57 */ "cmd ::= CREATE DNODE ids PORT ids",
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
 /*  58 */ "cmd ::= CREATE DNODE IPTOKEN PORT ids",
 /*  59 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
 /*  60 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
 /*  61 */ "cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize",
 /*  62 */ "cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize",
 /*  63 */ "cmd ::= CREATE USER ids PASS ids",
 /*  64 */ "bufsize ::=",
 /*  65 */ "bufsize ::= BUFSIZE INTEGER",
 /*  66 */ "pps ::=",
 /*  67 */ "pps ::= PPS INTEGER",
 /*  68 */ "tseries ::=",
 /*  69 */ "tseries ::= TSERIES INTEGER",
 /*  70 */ "dbs ::=",
 /*  71 */ "dbs ::= DBS INTEGER",
 /*  72 */ "streams ::=",
 /*  73 */ "streams ::= STREAMS INTEGER",
 /*  74 */ "storage ::=",
 /*  75 */ "storage ::= STORAGE INTEGER",
 /*  76 */ "qtime ::=",
 /*  77 */ "qtime ::= QTIME INTEGER",
 /*  78 */ "users ::=",
 /*  79 */ "users ::= USERS INTEGER",
 /*  80 */ "conns ::=",
 /*  81 */ "conns ::= CONNS INTEGER",
 /*  82 */ "state ::=",
 /*  83 */ "state ::= STATE ids",
 /*  84 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
 /*  85 */ "intitemlist ::= intitemlist COMMA intitem",
 /*  86 */ "intitemlist ::= intitem",
 /*  87 */ "intitem ::= INTEGER",
 /*  88 */ "keep ::= KEEP intitemlist",
 /*  89 */ "cache ::= CACHE INTEGER",
 /*  90 */ "replica ::= REPLICA INTEGER",
 /*  91 */ "quorum ::= QUORUM INTEGER",
 /*  92 */ "days ::= DAYS INTEGER",
 /*  93 */ "minrows ::= MINROWS INTEGER",
 /*  94 */ "maxrows ::= MAXROWS INTEGER",
 /*  95 */ "blocks ::= BLOCKS INTEGER",
 /*  96 */ "ctime ::= CTIME INTEGER",
 /*  97 */ "wal ::= WAL INTEGER",
 /*  98 */ "fsync ::= FSYNC INTEGER",
 /*  99 */ "comp ::= COMP INTEGER",
 /* 100 */ "prec ::= PRECISION STRING",
 /* 101 */ "update ::= UPDATE INTEGER",
 /* 102 */ "cachelast ::= CACHELAST INTEGER",
H
Haojun Liao 已提交
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375
 /* 103 */ "vgroups ::= VGROUPS INTEGER",
 /* 104 */ "db_optr ::=",
 /* 105 */ "db_optr ::= db_optr cache",
 /* 106 */ "db_optr ::= db_optr replica",
 /* 107 */ "db_optr ::= db_optr quorum",
 /* 108 */ "db_optr ::= db_optr days",
 /* 109 */ "db_optr ::= db_optr minrows",
 /* 110 */ "db_optr ::= db_optr maxrows",
 /* 111 */ "db_optr ::= db_optr blocks",
 /* 112 */ "db_optr ::= db_optr ctime",
 /* 113 */ "db_optr ::= db_optr wal",
 /* 114 */ "db_optr ::= db_optr fsync",
 /* 115 */ "db_optr ::= db_optr comp",
 /* 116 */ "db_optr ::= db_optr prec",
 /* 117 */ "db_optr ::= db_optr keep",
 /* 118 */ "db_optr ::= db_optr update",
 /* 119 */ "db_optr ::= db_optr cachelast",
 /* 120 */ "db_optr ::= db_optr vgroups",
 /* 121 */ "alter_db_optr ::=",
 /* 122 */ "alter_db_optr ::= alter_db_optr replica",
 /* 123 */ "alter_db_optr ::= alter_db_optr quorum",
 /* 124 */ "alter_db_optr ::= alter_db_optr keep",
 /* 125 */ "alter_db_optr ::= alter_db_optr blocks",
 /* 126 */ "alter_db_optr ::= alter_db_optr comp",
 /* 127 */ "alter_db_optr ::= alter_db_optr update",
 /* 128 */ "alter_db_optr ::= alter_db_optr cachelast",
 /* 129 */ "typename ::= ids",
 /* 130 */ "typename ::= ids LP signed RP",
 /* 131 */ "typename ::= ids UNSIGNED",
 /* 132 */ "signed ::= INTEGER",
 /* 133 */ "signed ::= PLUS INTEGER",
 /* 134 */ "signed ::= MINUS INTEGER",
 /* 135 */ "cmd ::= CREATE TABLE create_table_args",
 /* 136 */ "cmd ::= CREATE TABLE create_stable_args",
 /* 137 */ "cmd ::= CREATE STABLE create_stable_args",
 /* 138 */ "cmd ::= CREATE TABLE create_table_list",
 /* 139 */ "create_table_list ::= create_from_stable",
 /* 140 */ "create_table_list ::= create_table_list create_from_stable",
 /* 141 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
 /* 142 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
 /* 143 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP",
 /* 144 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP",
 /* 145 */ "tagNamelist ::= tagNamelist COMMA ids",
 /* 146 */ "tagNamelist ::= ids",
 /* 147 */ "create_table_args ::= ifnotexists ids cpxName AS select",
 /* 148 */ "columnlist ::= columnlist COMMA column",
 /* 149 */ "columnlist ::= column",
 /* 150 */ "column ::= ids typename",
 /* 151 */ "tagitemlist1 ::= tagitemlist1 COMMA tagitem1",
 /* 152 */ "tagitemlist1 ::= tagitem1",
 /* 153 */ "tagitem1 ::= MINUS INTEGER",
 /* 154 */ "tagitem1 ::= MINUS FLOAT",
 /* 155 */ "tagitem1 ::= PLUS INTEGER",
 /* 156 */ "tagitem1 ::= PLUS FLOAT",
 /* 157 */ "tagitem1 ::= INTEGER",
 /* 158 */ "tagitem1 ::= FLOAT",
 /* 159 */ "tagitem1 ::= STRING",
 /* 160 */ "tagitem1 ::= BOOL",
 /* 161 */ "tagitem1 ::= NULL",
 /* 162 */ "tagitem1 ::= NOW",
 /* 163 */ "tagitemlist ::= tagitemlist COMMA tagitem",
 /* 164 */ "tagitemlist ::= tagitem",
 /* 165 */ "tagitem ::= INTEGER",
 /* 166 */ "tagitem ::= FLOAT",
 /* 167 */ "tagitem ::= STRING",
 /* 168 */ "tagitem ::= BOOL",
 /* 169 */ "tagitem ::= NULL",
 /* 170 */ "tagitem ::= NOW",
 /* 171 */ "tagitem ::= MINUS INTEGER",
 /* 172 */ "tagitem ::= MINUS FLOAT",
 /* 173 */ "tagitem ::= PLUS INTEGER",
 /* 174 */ "tagitem ::= PLUS FLOAT",
 /* 175 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt",
 /* 176 */ "select ::= LP select RP",
 /* 177 */ "union ::= select",
 /* 178 */ "union ::= union UNION ALL select",
 /* 179 */ "union ::= union UNION select",
 /* 180 */ "cmd ::= union",
 /* 181 */ "select ::= SELECT selcollist",
 /* 182 */ "sclp ::= selcollist COMMA",
 /* 183 */ "sclp ::=",
 /* 184 */ "selcollist ::= sclp distinct expr as",
 /* 185 */ "selcollist ::= sclp STAR",
 /* 186 */ "as ::= AS ids",
 /* 187 */ "as ::= ids",
 /* 188 */ "as ::=",
 /* 189 */ "distinct ::= DISTINCT",
 /* 190 */ "distinct ::=",
 /* 191 */ "from ::= FROM tablelist",
 /* 192 */ "from ::= FROM sub",
 /* 193 */ "sub ::= LP union RP",
 /* 194 */ "sub ::= LP union RP ids",
 /* 195 */ "sub ::= sub COMMA LP union RP ids",
 /* 196 */ "tablelist ::= ids cpxName",
 /* 197 */ "tablelist ::= ids cpxName ids",
 /* 198 */ "tablelist ::= tablelist COMMA ids cpxName",
 /* 199 */ "tablelist ::= tablelist COMMA ids cpxName ids",
 /* 200 */ "tmvar ::= VARIABLE",
 /* 201 */ "interval_option ::= intervalKey LP tmvar RP",
 /* 202 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP",
 /* 203 */ "interval_option ::=",
 /* 204 */ "intervalKey ::= INTERVAL",
 /* 205 */ "intervalKey ::= EVERY",
 /* 206 */ "session_option ::=",
 /* 207 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
 /* 208 */ "windowstate_option ::=",
 /* 209 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
 /* 210 */ "fill_opt ::=",
 /* 211 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
 /* 212 */ "fill_opt ::= FILL LP ID RP",
 /* 213 */ "sliding_opt ::= SLIDING LP tmvar RP",
 /* 214 */ "sliding_opt ::=",
 /* 215 */ "orderby_opt ::=",
 /* 216 */ "orderby_opt ::= ORDER BY sortlist",
 /* 217 */ "sortlist ::= sortlist COMMA item sortorder",
 /* 218 */ "sortlist ::= item sortorder",
 /* 219 */ "item ::= ids cpxName",
 /* 220 */ "sortorder ::= ASC",
 /* 221 */ "sortorder ::= DESC",
 /* 222 */ "sortorder ::=",
 /* 223 */ "groupby_opt ::=",
 /* 224 */ "groupby_opt ::= GROUP BY grouplist",
 /* 225 */ "grouplist ::= grouplist COMMA item",
 /* 226 */ "grouplist ::= item",
 /* 227 */ "having_opt ::=",
 /* 228 */ "having_opt ::= HAVING expr",
 /* 229 */ "limit_opt ::=",
 /* 230 */ "limit_opt ::= LIMIT signed",
 /* 231 */ "limit_opt ::= LIMIT signed OFFSET signed",
 /* 232 */ "limit_opt ::= LIMIT signed COMMA signed",
 /* 233 */ "slimit_opt ::=",
 /* 234 */ "slimit_opt ::= SLIMIT signed",
 /* 235 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
 /* 236 */ "slimit_opt ::= SLIMIT signed COMMA signed",
 /* 237 */ "where_opt ::=",
 /* 238 */ "where_opt ::= WHERE expr",
 /* 239 */ "expr ::= LP expr RP",
 /* 240 */ "expr ::= ID",
 /* 241 */ "expr ::= ID DOT ID",
 /* 242 */ "expr ::= ID DOT STAR",
 /* 243 */ "expr ::= INTEGER",
 /* 244 */ "expr ::= MINUS INTEGER",
 /* 245 */ "expr ::= PLUS INTEGER",
 /* 246 */ "expr ::= FLOAT",
 /* 247 */ "expr ::= MINUS FLOAT",
 /* 248 */ "expr ::= PLUS FLOAT",
 /* 249 */ "expr ::= STRING",
 /* 250 */ "expr ::= NOW",
 /* 251 */ "expr ::= VARIABLE",
 /* 252 */ "expr ::= PLUS VARIABLE",
 /* 253 */ "expr ::= MINUS VARIABLE",
 /* 254 */ "expr ::= BOOL",
 /* 255 */ "expr ::= NULL",
 /* 256 */ "expr ::= ID LP exprlist RP",
 /* 257 */ "expr ::= ID LP STAR RP",
 /* 258 */ "expr ::= expr IS NULL",
 /* 259 */ "expr ::= expr IS NOT NULL",
 /* 260 */ "expr ::= expr LT expr",
 /* 261 */ "expr ::= expr GT expr",
 /* 262 */ "expr ::= expr LE expr",
 /* 263 */ "expr ::= expr GE expr",
 /* 264 */ "expr ::= expr NE expr",
 /* 265 */ "expr ::= expr EQ expr",
 /* 266 */ "expr ::= expr BETWEEN expr AND expr",
 /* 267 */ "expr ::= expr AND expr",
 /* 268 */ "expr ::= expr OR expr",
 /* 269 */ "expr ::= expr PLUS expr",
 /* 270 */ "expr ::= expr MINUS expr",
 /* 271 */ "expr ::= expr STAR expr",
 /* 272 */ "expr ::= expr SLASH expr",
 /* 273 */ "expr ::= expr REM expr",
 /* 274 */ "expr ::= expr LIKE expr",
 /* 275 */ "expr ::= expr MATCH expr",
 /* 276 */ "expr ::= expr NMATCH expr",
 /* 277 */ "expr ::= expr IN LP exprlist RP",
 /* 278 */ "exprlist ::= exprlist COMMA expritem",
 /* 279 */ "exprlist ::= expritem",
 /* 280 */ "expritem ::= expr",
 /* 281 */ "expritem ::=",
 /* 282 */ "cmd ::= RESET QUERY CACHE",
 /* 283 */ "cmd ::= SYNCDB ids REPLICA",
 /* 284 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
 /* 285 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
 /* 286 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
 /* 287 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
 /* 288 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
 /* 289 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
 /* 290 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
 /* 291 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
 /* 292 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
 /* 293 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
 /* 294 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
 /* 295 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
 /* 296 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
 /* 297 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
 /* 298 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
 /* 299 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
 /* 300 */ "cmd ::= KILL CONNECTION INTEGER",
 /* 301 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
 /* 302 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number
** of errors.  Return 0 on success.
*/
static int yyGrowStack(yyParser *p){
  int newSize;
  int idx;
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
  idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
  if( p->yystack==&p->yystk0 ){
    pNew = malloc(newSize*sizeof(pNew[0]));
    if( pNew ) pNew[0] = p->yystk0;
  }else{
    pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
  }
  if( pNew ){
    p->yystack = pNew;
    p->yytos = &p->yystack[idx];
#ifndef NDEBUG
    if( yyTraceFILE ){
      fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
              yyTracePrompt, p->yystksz, newSize);
    }
#endif
    p->yystksz = newSize;
  }
  return pNew==0; 
}
#endif

/* Datatype of the argument to the memory allocated passed as the
** second argument to ParseAlloc() below.  This can be changed by
** putting an appropriate #define in the %include section of the input
** grammar.
*/
#ifndef YYMALLOCARGTYPE
# define YYMALLOCARGTYPE size_t
#endif

/* Initialize a new parser that has already been allocated.
*/
void ParseInit(void *yypParser){
  yyParser *pParser = (yyParser*)yypParser;
#ifdef YYTRACKMAXSTACKDEPTH
  pParser->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;
  }
#endif
#ifndef YYNOERRORRECOVERY
  pParser->yyerrcnt = -1;
#endif
  pParser->yytos = pParser->yystack;
  pParser->yystack[0].stateno = 0;
  pParser->yystack[0].major = 0;
#if YYSTACKDEPTH>0
  pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
#endif
}

#ifndef Parse_ENGINEALWAYSONSTACK
/* 
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
** malloc.
**
** Inputs:
** A pointer to the function used to allocate memory.
**
** Outputs:
** 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;
}
#endif /* Parse_ENGINEALWAYSONSTACK */


/* The following function deletes the "minor type" or semantic value
** associated with a symbol.  The symbol can be either a terminal
** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
** a pointer to the value to be deleted.  The code used to do the 
** deletions is derived from the %destructor and/or %token_destructor
** directives of the input grammar.
*/
static void yy_destructor(
  yyParser *yypParser,    /* The parser */
  YYCODETYPE yymajor,     /* Type code for object to destroy */
  YYMINORTYPE *yypminor   /* The object to be destroyed */
){
  ParseARG_FETCH;
  switch( yymajor ){
    /* Here is inserted the actions which take place when a
    ** terminal or non-terminal is destroyed.  This can happen
    ** when the symbol is popped from the stack during a
    ** reduce or during error processing or when a parser is 
    ** being destroyed before it is finished parsing.
    **
    ** Note: during a reduce, the only symbols destroyed are those
    ** which appear on the RHS of the rule, but which are *not* used
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
1496
    case 200: /* exprlist */
H
Haojun Liao 已提交
1497 1498
    case 245: /* selcollist */
    case 259: /* sclp */
1499
{
H
Haojun Liao 已提交
1500
tSqlExprListDestroy((yypminor->yy165));
1501 1502
}
      break;
1503 1504
    case 214: /* intitemlist */
    case 216: /* keep */
H
Haojun Liao 已提交
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515
    case 237: /* columnlist */
    case 238: /* tagitemlist1 */
    case 239: /* tagNamelist */
    case 243: /* tagitemlist */
    case 252: /* fill_opt */
    case 253: /* groupby_opt */
    case 255: /* orderby_opt */
    case 267: /* sortlist */
    case 271: /* grouplist */
{
taosArrayDestroy((yypminor->yy165));
1516 1517
}
      break;
H
Haojun Liao 已提交
1518
    case 235: /* create_table_list */
1519
{
H
Haojun Liao 已提交
1520
destroyCreateTableSql((yypminor->yy326));
1521 1522
}
      break;
H
Haojun Liao 已提交
1523
    case 240: /* select */
1524
{
H
Haojun Liao 已提交
1525
destroySqlNode((yypminor->yy278));
1526 1527
}
      break;
H
Haojun Liao 已提交
1528 1529 1530
    case 246: /* from */
    case 263: /* tablelist */
    case 264: /* sub */
1531
{
H
Haojun Liao 已提交
1532
destroyRelationInfo((yypminor->yy10));
1533 1534
}
      break;
H
Haojun Liao 已提交
1535 1536 1537 1538
    case 247: /* where_opt */
    case 254: /* having_opt */
    case 261: /* expr */
    case 272: /* expritem */
1539
{
H
Haojun Liao 已提交
1540
tSqlExprDestroy((yypminor->yy202));
1541 1542
}
      break;
H
Haojun Liao 已提交
1543
    case 258: /* union */
1544
{
H
Haojun Liao 已提交
1545
destroyAllSqlNode((yypminor->yy503));
1546 1547
}
      break;
H
Haojun Liao 已提交
1548
    case 268: /* sortitem */
1549
{
H
Haojun Liao 已提交
1550
taosVariantDestroy(&(yypminor->yy425));
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843
}
      break;
/********* End destructor definitions *****************************************/
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
*/
static void yy_pop_parser_stack(yyParser *pParser){
  yyStackEntry *yytos;
  assert( pParser->yytos!=0 );
  assert( pParser->yytos > pParser->yystack );
  yytos = pParser->yytos--;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yy_destructor(pParser, yytos->major, &yytos->minor);
}

/*
** Clear all secondary memory allocations from the parser
*/
void ParseFinalize(void *p){
  yyParser *pParser = (yyParser*)p;
  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
#endif
}

#ifndef Parse_ENGINEALWAYSONSTACK
/* 
** Deallocate and destroy a parser.  Destructors are called for
** all stack elements before shutting the parser down.
**
** If the YYPARSEFREENEVERNULL macro exists (for example because it
** is defined in a %include section of the input grammar) then it is
** assumed that the input pointer is never NULL.
*/
void ParseFree(
  void *p,                    /* The parser to be deleted */
  void (*freeProc)(void*)     /* Function used to reclaim memory */
){
#ifndef YYPARSEFREENEVERNULL
  if( p==0 ) return;
#endif
  ParseFinalize(p);
  (*freeProc)(p);
}
#endif /* Parse_ENGINEALWAYSONSTACK */

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
int ParseStackPeak(void *p){
  yyParser *pParser = (yyParser*)p;
  return pParser->yyhwm;
}
#endif

/* This array of booleans keeps track of the parser statement
** coverage.  The element yycoverage[X][Y] is set when the parser
** is in state X and has a lookahead token Y.  In a well-tested
** systems, every element of this matrix should end up being set.
*/
#if defined(YYCOVERAGE)
static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
#endif

/*
** Write into out a description of every state/lookahead combination that
**
**   (1)  has not been used by the parser, and
**   (2)  is not a syntax error.
**
** Return the number of missed state/lookahead combinations.
*/
#if defined(YYCOVERAGE)
int ParseCoverage(FILE *out){
  int stateno, iLookAhead, i;
  int nMissed = 0;
  for(stateno=0; stateno<YYNSTATE; stateno++){
    i = yy_shift_ofst[stateno];
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
      if( out ){
        fprintf(out,"State %d lookahead %s %s\n", stateno,
                yyTokenName[iLookAhead],
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
      }
    }
  }
  return nMissed;
}
#endif

/*
** 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 */
){
  int i;
  int stateno = pParser->yytos->stateno;
 
  if( stateno>YY_MAX_SHIFT ) return stateno;
  assert( stateno <= YY_SHIFT_COUNT );
#if defined(YYCOVERAGE)
  yycoverage[stateno][iLookAhead] = 1;
#endif
  do{
    i = yy_shift_ofst[stateno];
    assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) );
    assert( iLookAhead!=YYNOCODE );
    assert( iLookAhead < YYNTOKEN );
    i += iLookAhead;
    if( yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK
      YYCODETYPE iFallback;            /* Fallback token */
      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
             && (iFallback = yyFallback[iLookAhead])!=0 ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
        }
#endif
        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
        iLookAhead = iFallback;
        continue;
      }
#endif
#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
          j<YY_ACTTAB_COUNT &&
#endif
          yy_lookahead[j]==YYWILDCARD && iLookAhead>0
        ){
#ifndef NDEBUG
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead],
               yyTokenName[YYWILDCARD]);
          }
#endif /* NDEBUG */
          return yy_action[j];
        }
      }
#endif /* YYWILDCARD */
      return yy_default[stateno];
    }else{
      return yy_action[i];
    }
  }while(1);
}

/*
** Find the appropriate action for a parser given the non-terminal
** look-ahead token iLookAhead.
*/
static int yy_find_reduce_action(
  int stateno,              /* Current state number */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
#ifdef YYERRORSYMBOL
  if( stateno>YY_REDUCE_COUNT ){
    return yy_default[stateno];
  }
#else
  assert( stateno<=YY_REDUCE_COUNT );
#endif
  i = yy_reduce_ofst[stateno];
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
#ifdef YYERRORSYMBOL
  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
    return yy_default[stateno];
  }
#else
  assert( i>=0 && i<YY_ACTTAB_COUNT );
  assert( yy_lookahead[i]==iLookAhead );
#endif
  return yy_action[i];
}

/*
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser){
   ParseARG_FETCH;
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
/******** End %stack_overflow code ********************************************/
   ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
}

/*
** Print tracing information for a SHIFT action
*/
#ifndef NDEBUG
static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
  if( yyTraceFILE ){
    if( yyNewState<YYNSTATE ){
      fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
         yyNewState);
    }else{
      fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
         yyNewState - YY_MIN_REDUCE);
    }
  }
}
#else
# define yyTraceShift(X,Y,Z)
#endif

/*
** Perform a shift action.
*/
static void yy_shift(
  yyParser *yypParser,          /* The parser to be shifted */
  int yyNewState,               /* The new state to shift in */
  int yyMajor,                  /* The major token to shift in */
  ParseTOKENTYPE yyMinor        /* The minor token to shift in */
){
  yyStackEntry *yytos;
  yypParser->yytos++;
#ifdef YYTRACKMAXSTACKDEPTH
  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
    yypParser->yyhwm++;
    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
  }
#endif
#if YYSTACKDEPTH>0 
  if( yypParser->yytos>yypParser->yystackEnd ){
    yypParser->yytos--;
    yyStackOverflow(yypParser);
    return;
  }
#else
  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
    if( yyGrowStack(yypParser) ){
      yypParser->yytos--;
      yyStackOverflow(yypParser);
      return;
    }
  }
#endif
  if( yyNewState > YY_MAX_SHIFT ){
    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
  }
  yytos = yypParser->yytos;
  yytos->stateno = (YYACTIONTYPE)yyNewState;
  yytos->major = (YYCODETYPE)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[] = {
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
  {  192,   -1 }, /* (0) program ::= cmd */
  {  193,   -2 }, /* (1) cmd ::= SHOW DATABASES */
  {  193,   -2 }, /* (2) cmd ::= SHOW TOPICS */
  {  193,   -2 }, /* (3) cmd ::= SHOW FUNCTIONS */
  {  193,   -2 }, /* (4) cmd ::= SHOW MNODES */
  {  193,   -2 }, /* (5) cmd ::= SHOW DNODES */
  {  193,   -2 }, /* (6) cmd ::= SHOW ACCOUNTS */
  {  193,   -2 }, /* (7) cmd ::= SHOW USERS */
  {  193,   -2 }, /* (8) cmd ::= SHOW MODULES */
  {  193,   -2 }, /* (9) cmd ::= SHOW QUERIES */
  {  193,   -2 }, /* (10) cmd ::= SHOW CONNECTIONS */
  {  193,   -2 }, /* (11) cmd ::= SHOW STREAMS */
  {  193,   -2 }, /* (12) cmd ::= SHOW VARIABLES */
  {  193,   -2 }, /* (13) cmd ::= SHOW SCORES */
  {  193,   -2 }, /* (14) cmd ::= SHOW GRANTS */
  {  193,   -2 }, /* (15) cmd ::= SHOW VNODES */
  {  193,   -3 }, /* (16) cmd ::= SHOW VNODES ids */
  {  195,    0 }, /* (17) dbPrefix ::= */
  {  195,   -2 }, /* (18) dbPrefix ::= ids DOT */
  {  196,    0 }, /* (19) cpxName ::= */
  {  196,   -2 }, /* (20) cpxName ::= DOT ids */
  {  193,   -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */
  {  193,   -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */
  {  193,   -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */
  {  193,   -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */
  {  193,   -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */
  {  193,   -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */
  {  193,   -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */
  {  193,   -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */
  {  193,   -4 }, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */
  {  193,   -5 }, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */
  {  193,   -5 }, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */
  {  193,   -4 }, /* (32) cmd ::= DROP DATABASE ifexists ids */
  {  193,   -4 }, /* (33) cmd ::= DROP TOPIC ifexists ids */
  {  193,   -3 }, /* (34) cmd ::= DROP FUNCTION ids */
  {  193,   -3 }, /* (35) cmd ::= DROP DNODE ids */
  {  193,   -3 }, /* (36) cmd ::= DROP USER ids */
  {  193,   -3 }, /* (37) cmd ::= DROP ACCOUNT ids */
  {  193,   -2 }, /* (38) cmd ::= USE ids */
  {  193,   -3 }, /* (39) cmd ::= DESCRIBE ids cpxName */
  {  193,   -3 }, /* (40) cmd ::= DESC ids cpxName */
  {  193,   -5 }, /* (41) cmd ::= ALTER USER ids PASS ids */
  {  193,   -5 }, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */
  {  193,   -4 }, /* (43) cmd ::= ALTER DNODE ids ids */
  {  193,   -5 }, /* (44) cmd ::= ALTER DNODE ids ids ids */
  {  193,   -3 }, /* (45) cmd ::= ALTER LOCAL ids */
  {  193,   -4 }, /* (46) cmd ::= ALTER LOCAL ids ids */
  {  193,   -4 }, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */
  {  193,   -4 }, /* (48) cmd ::= ALTER ACCOUNT ids acct_optr */
  {  193,   -6 }, /* (49) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
  {  193,   -6 }, /* (50) cmd ::= COMPACT VNODES IN LP exprlist RP */
  {  194,   -1 }, /* (51) ids ::= ID */
  {  194,   -1 }, /* (52) ids ::= STRING */
  {  197,   -2 }, /* (53) ifexists ::= IF EXISTS */
  {  197,    0 }, /* (54) ifexists ::= */
  {  201,   -3 }, /* (55) ifnotexists ::= IF NOT EXISTS */
  {  201,    0 }, /* (56) ifnotexists ::= */
  {  193,   -5 }, /* (57) cmd ::= CREATE DNODE ids PORT ids */
  {  193,   -5 }, /* (58) cmd ::= CREATE DNODE IPTOKEN PORT ids */
  {  193,   -6 }, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
  {  193,   -5 }, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
  {  193,   -8 }, /* (61) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
  {  193,   -9 }, /* (62) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
  {  193,   -5 }, /* (63) cmd ::= CREATE USER ids PASS ids */
  {  204,    0 }, /* (64) bufsize ::= */
  {  204,   -2 }, /* (65) bufsize ::= BUFSIZE INTEGER */
  {  205,    0 }, /* (66) pps ::= */
  {  205,   -2 }, /* (67) pps ::= PPS INTEGER */
  {  206,    0 }, /* (68) tseries ::= */
  {  206,   -2 }, /* (69) tseries ::= TSERIES INTEGER */
  {  207,    0 }, /* (70) dbs ::= */
  {  207,   -2 }, /* (71) dbs ::= DBS INTEGER */
  {  208,    0 }, /* (72) streams ::= */
  {  208,   -2 }, /* (73) streams ::= STREAMS INTEGER */
  {  209,    0 }, /* (74) storage ::= */
  {  209,   -2 }, /* (75) storage ::= STORAGE INTEGER */
  {  210,    0 }, /* (76) qtime ::= */
  {  210,   -2 }, /* (77) qtime ::= QTIME INTEGER */
  {  211,    0 }, /* (78) users ::= */
  {  211,   -2 }, /* (79) users ::= USERS INTEGER */
  {  212,    0 }, /* (80) conns ::= */
  {  212,   -2 }, /* (81) conns ::= CONNS INTEGER */
  {  213,    0 }, /* (82) state ::= */
  {  213,   -2 }, /* (83) state ::= STATE ids */
  {  199,   -9 }, /* (84) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
  {  214,   -3 }, /* (85) intitemlist ::= intitemlist COMMA intitem */
  {  214,   -1 }, /* (86) intitemlist ::= intitem */
  {  215,   -1 }, /* (87) intitem ::= INTEGER */
  {  216,   -2 }, /* (88) keep ::= KEEP intitemlist */
  {  217,   -2 }, /* (89) cache ::= CACHE INTEGER */
  {  218,   -2 }, /* (90) replica ::= REPLICA INTEGER */
  {  219,   -2 }, /* (91) quorum ::= QUORUM INTEGER */
  {  220,   -2 }, /* (92) days ::= DAYS INTEGER */
  {  221,   -2 }, /* (93) minrows ::= MINROWS INTEGER */
  {  222,   -2 }, /* (94) maxrows ::= MAXROWS INTEGER */
  {  223,   -2 }, /* (95) blocks ::= BLOCKS INTEGER */
  {  224,   -2 }, /* (96) ctime ::= CTIME INTEGER */
  {  225,   -2 }, /* (97) wal ::= WAL INTEGER */
  {  226,   -2 }, /* (98) fsync ::= FSYNC INTEGER */
  {  227,   -2 }, /* (99) comp ::= COMP INTEGER */
  {  228,   -2 }, /* (100) prec ::= PRECISION STRING */
  {  229,   -2 }, /* (101) update ::= UPDATE INTEGER */
  {  230,   -2 }, /* (102) cachelast ::= CACHELAST INTEGER */
H
Haojun Liao 已提交
1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146
  {  231,   -2 }, /* (103) vgroups ::= VGROUPS INTEGER */
  {  202,    0 }, /* (104) db_optr ::= */
  {  202,   -2 }, /* (105) db_optr ::= db_optr cache */
  {  202,   -2 }, /* (106) db_optr ::= db_optr replica */
  {  202,   -2 }, /* (107) db_optr ::= db_optr quorum */
  {  202,   -2 }, /* (108) db_optr ::= db_optr days */
  {  202,   -2 }, /* (109) db_optr ::= db_optr minrows */
  {  202,   -2 }, /* (110) db_optr ::= db_optr maxrows */
  {  202,   -2 }, /* (111) db_optr ::= db_optr blocks */
  {  202,   -2 }, /* (112) db_optr ::= db_optr ctime */
  {  202,   -2 }, /* (113) db_optr ::= db_optr wal */
  {  202,   -2 }, /* (114) db_optr ::= db_optr fsync */
  {  202,   -2 }, /* (115) db_optr ::= db_optr comp */
  {  202,   -2 }, /* (116) db_optr ::= db_optr prec */
  {  202,   -2 }, /* (117) db_optr ::= db_optr keep */
  {  202,   -2 }, /* (118) db_optr ::= db_optr update */
  {  202,   -2 }, /* (119) db_optr ::= db_optr cachelast */
  {  202,   -2 }, /* (120) db_optr ::= db_optr vgroups */
  {  198,    0 }, /* (121) alter_db_optr ::= */
  {  198,   -2 }, /* (122) alter_db_optr ::= alter_db_optr replica */
  {  198,   -2 }, /* (123) alter_db_optr ::= alter_db_optr quorum */
  {  198,   -2 }, /* (124) alter_db_optr ::= alter_db_optr keep */
  {  198,   -2 }, /* (125) alter_db_optr ::= alter_db_optr blocks */
  {  198,   -2 }, /* (126) alter_db_optr ::= alter_db_optr comp */
  {  198,   -2 }, /* (127) alter_db_optr ::= alter_db_optr update */
  {  198,   -2 }, /* (128) alter_db_optr ::= alter_db_optr cachelast */
  {  203,   -1 }, /* (129) typename ::= ids */
  {  203,   -4 }, /* (130) typename ::= ids LP signed RP */
  {  203,   -2 }, /* (131) typename ::= ids UNSIGNED */
  {  232,   -1 }, /* (132) signed ::= INTEGER */
  {  232,   -2 }, /* (133) signed ::= PLUS INTEGER */
  {  232,   -2 }, /* (134) signed ::= MINUS INTEGER */
  {  193,   -3 }, /* (135) cmd ::= CREATE TABLE create_table_args */
  {  193,   -3 }, /* (136) cmd ::= CREATE TABLE create_stable_args */
  {  193,   -3 }, /* (137) cmd ::= CREATE STABLE create_stable_args */
  {  193,   -3 }, /* (138) cmd ::= CREATE TABLE create_table_list */
  {  235,   -1 }, /* (139) create_table_list ::= create_from_stable */
  {  235,   -2 }, /* (140) create_table_list ::= create_table_list create_from_stable */
  {  233,   -6 }, /* (141) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
  {  234,  -10 }, /* (142) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
  {  236,  -10 }, /* (143) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
  {  236,  -13 }, /* (144) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
  {  239,   -3 }, /* (145) tagNamelist ::= tagNamelist COMMA ids */
  {  239,   -1 }, /* (146) tagNamelist ::= ids */
  {  233,   -5 }, /* (147) create_table_args ::= ifnotexists ids cpxName AS select */
  {  237,   -3 }, /* (148) columnlist ::= columnlist COMMA column */
  {  237,   -1 }, /* (149) columnlist ::= column */
  {  241,   -2 }, /* (150) column ::= ids typename */
  {  238,   -3 }, /* (151) tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */
  {  238,   -1 }, /* (152) tagitemlist1 ::= tagitem1 */
  {  242,   -2 }, /* (153) tagitem1 ::= MINUS INTEGER */
  {  242,   -2 }, /* (154) tagitem1 ::= MINUS FLOAT */
  {  242,   -2 }, /* (155) tagitem1 ::= PLUS INTEGER */
  {  242,   -2 }, /* (156) tagitem1 ::= PLUS FLOAT */
  {  242,   -1 }, /* (157) tagitem1 ::= INTEGER */
  {  242,   -1 }, /* (158) tagitem1 ::= FLOAT */
  {  242,   -1 }, /* (159) tagitem1 ::= STRING */
  {  242,   -1 }, /* (160) tagitem1 ::= BOOL */
  {  242,   -1 }, /* (161) tagitem1 ::= NULL */
  {  242,   -1 }, /* (162) tagitem1 ::= NOW */
  {  243,   -3 }, /* (163) tagitemlist ::= tagitemlist COMMA tagitem */
  {  243,   -1 }, /* (164) tagitemlist ::= tagitem */
  {  244,   -1 }, /* (165) tagitem ::= INTEGER */
  {  244,   -1 }, /* (166) tagitem ::= FLOAT */
  {  244,   -1 }, /* (167) tagitem ::= STRING */
  {  244,   -1 }, /* (168) tagitem ::= BOOL */
  {  244,   -1 }, /* (169) tagitem ::= NULL */
  {  244,   -1 }, /* (170) tagitem ::= NOW */
  {  244,   -2 }, /* (171) tagitem ::= MINUS INTEGER */
  {  244,   -2 }, /* (172) tagitem ::= MINUS FLOAT */
  {  244,   -2 }, /* (173) tagitem ::= PLUS INTEGER */
  {  244,   -2 }, /* (174) tagitem ::= PLUS FLOAT */
  {  240,  -14 }, /* (175) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
  {  240,   -3 }, /* (176) select ::= LP select RP */
  {  258,   -1 }, /* (177) union ::= select */
  {  258,   -4 }, /* (178) union ::= union UNION ALL select */
  {  258,   -3 }, /* (179) union ::= union UNION select */
  {  193,   -1 }, /* (180) cmd ::= union */
  {  240,   -2 }, /* (181) select ::= SELECT selcollist */
  {  259,   -2 }, /* (182) sclp ::= selcollist COMMA */
  {  259,    0 }, /* (183) sclp ::= */
  {  245,   -4 }, /* (184) selcollist ::= sclp distinct expr as */
  {  245,   -2 }, /* (185) selcollist ::= sclp STAR */
  {  262,   -2 }, /* (186) as ::= AS ids */
  {  262,   -1 }, /* (187) as ::= ids */
  {  262,    0 }, /* (188) as ::= */
  {  260,   -1 }, /* (189) distinct ::= DISTINCT */
  {  260,    0 }, /* (190) distinct ::= */
  {  246,   -2 }, /* (191) from ::= FROM tablelist */
  {  246,   -2 }, /* (192) from ::= FROM sub */
  {  264,   -3 }, /* (193) sub ::= LP union RP */
  {  264,   -4 }, /* (194) sub ::= LP union RP ids */
  {  264,   -6 }, /* (195) sub ::= sub COMMA LP union RP ids */
  {  263,   -2 }, /* (196) tablelist ::= ids cpxName */
  {  263,   -3 }, /* (197) tablelist ::= ids cpxName ids */
  {  263,   -4 }, /* (198) tablelist ::= tablelist COMMA ids cpxName */
  {  263,   -5 }, /* (199) tablelist ::= tablelist COMMA ids cpxName ids */
  {  265,   -1 }, /* (200) tmvar ::= VARIABLE */
  {  248,   -4 }, /* (201) interval_option ::= intervalKey LP tmvar RP */
  {  248,   -6 }, /* (202) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
  {  248,    0 }, /* (203) interval_option ::= */
  {  266,   -1 }, /* (204) intervalKey ::= INTERVAL */
  {  266,   -1 }, /* (205) intervalKey ::= EVERY */
  {  250,    0 }, /* (206) session_option ::= */
  {  250,   -7 }, /* (207) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
  {  251,    0 }, /* (208) windowstate_option ::= */
  {  251,   -4 }, /* (209) windowstate_option ::= STATE_WINDOW LP ids RP */
  {  252,    0 }, /* (210) fill_opt ::= */
  {  252,   -6 }, /* (211) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
  {  252,   -4 }, /* (212) fill_opt ::= FILL LP ID RP */
  {  249,   -4 }, /* (213) sliding_opt ::= SLIDING LP tmvar RP */
  {  249,    0 }, /* (214) sliding_opt ::= */
  {  255,    0 }, /* (215) orderby_opt ::= */
  {  255,   -3 }, /* (216) orderby_opt ::= ORDER BY sortlist */
  {  267,   -4 }, /* (217) sortlist ::= sortlist COMMA item sortorder */
  {  267,   -2 }, /* (218) sortlist ::= item sortorder */
  {  269,   -2 }, /* (219) item ::= ids cpxName */
  {  270,   -1 }, /* (220) sortorder ::= ASC */
  {  270,   -1 }, /* (221) sortorder ::= DESC */
  {  270,    0 }, /* (222) sortorder ::= */
  {  253,    0 }, /* (223) groupby_opt ::= */
  {  253,   -3 }, /* (224) groupby_opt ::= GROUP BY grouplist */
  {  271,   -3 }, /* (225) grouplist ::= grouplist COMMA item */
  {  271,   -1 }, /* (226) grouplist ::= item */
  {  254,    0 }, /* (227) having_opt ::= */
  {  254,   -2 }, /* (228) having_opt ::= HAVING expr */
  {  257,    0 }, /* (229) limit_opt ::= */
  {  257,   -2 }, /* (230) limit_opt ::= LIMIT signed */
  {  257,   -4 }, /* (231) limit_opt ::= LIMIT signed OFFSET signed */
  {  257,   -4 }, /* (232) limit_opt ::= LIMIT signed COMMA signed */
  {  256,    0 }, /* (233) slimit_opt ::= */
  {  256,   -2 }, /* (234) slimit_opt ::= SLIMIT signed */
  {  256,   -4 }, /* (235) slimit_opt ::= SLIMIT signed SOFFSET signed */
  {  256,   -4 }, /* (236) slimit_opt ::= SLIMIT signed COMMA signed */
  {  247,    0 }, /* (237) where_opt ::= */
  {  247,   -2 }, /* (238) where_opt ::= WHERE expr */
  {  261,   -3 }, /* (239) expr ::= LP expr RP */
  {  261,   -1 }, /* (240) expr ::= ID */
  {  261,   -3 }, /* (241) expr ::= ID DOT ID */
  {  261,   -3 }, /* (242) expr ::= ID DOT STAR */
  {  261,   -1 }, /* (243) expr ::= INTEGER */
  {  261,   -2 }, /* (244) expr ::= MINUS INTEGER */
  {  261,   -2 }, /* (245) expr ::= PLUS INTEGER */
  {  261,   -1 }, /* (246) expr ::= FLOAT */
  {  261,   -2 }, /* (247) expr ::= MINUS FLOAT */
  {  261,   -2 }, /* (248) expr ::= PLUS FLOAT */
  {  261,   -1 }, /* (249) expr ::= STRING */
  {  261,   -1 }, /* (250) expr ::= NOW */
  {  261,   -1 }, /* (251) expr ::= VARIABLE */
  {  261,   -2 }, /* (252) expr ::= PLUS VARIABLE */
  {  261,   -2 }, /* (253) expr ::= MINUS VARIABLE */
  {  261,   -1 }, /* (254) expr ::= BOOL */
  {  261,   -1 }, /* (255) expr ::= NULL */
  {  261,   -4 }, /* (256) expr ::= ID LP exprlist RP */
  {  261,   -4 }, /* (257) expr ::= ID LP STAR RP */
  {  261,   -3 }, /* (258) expr ::= expr IS NULL */
  {  261,   -4 }, /* (259) expr ::= expr IS NOT NULL */
  {  261,   -3 }, /* (260) expr ::= expr LT expr */
  {  261,   -3 }, /* (261) expr ::= expr GT expr */
  {  261,   -3 }, /* (262) expr ::= expr LE expr */
  {  261,   -3 }, /* (263) expr ::= expr GE expr */
  {  261,   -3 }, /* (264) expr ::= expr NE expr */
  {  261,   -3 }, /* (265) expr ::= expr EQ expr */
  {  261,   -5 }, /* (266) expr ::= expr BETWEEN expr AND expr */
  {  261,   -3 }, /* (267) expr ::= expr AND expr */
  {  261,   -3 }, /* (268) expr ::= expr OR expr */
  {  261,   -3 }, /* (269) expr ::= expr PLUS expr */
  {  261,   -3 }, /* (270) expr ::= expr MINUS expr */
  {  261,   -3 }, /* (271) expr ::= expr STAR expr */
  {  261,   -3 }, /* (272) expr ::= expr SLASH expr */
  {  261,   -3 }, /* (273) expr ::= expr REM expr */
  {  261,   -3 }, /* (274) expr ::= expr LIKE expr */
  {  261,   -3 }, /* (275) expr ::= expr MATCH expr */
  {  261,   -3 }, /* (276) expr ::= expr NMATCH expr */
  {  261,   -5 }, /* (277) expr ::= expr IN LP exprlist RP */
  {  200,   -3 }, /* (278) exprlist ::= exprlist COMMA expritem */
  {  200,   -1 }, /* (279) exprlist ::= expritem */
  {  272,   -1 }, /* (280) expritem ::= expr */
  {  272,    0 }, /* (281) expritem ::= */
  {  193,   -3 }, /* (282) cmd ::= RESET QUERY CACHE */
  {  193,   -3 }, /* (283) cmd ::= SYNCDB ids REPLICA */
  {  193,   -7 }, /* (284) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
  {  193,   -7 }, /* (285) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
  {  193,   -7 }, /* (286) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
  {  193,   -7 }, /* (287) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
  {  193,   -7 }, /* (288) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
  {  193,   -8 }, /* (289) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
  {  193,   -9 }, /* (290) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
  {  193,   -7 }, /* (291) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
  {  193,   -7 }, /* (292) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
  {  193,   -7 }, /* (293) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
  {  193,   -7 }, /* (294) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
  {  193,   -7 }, /* (295) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
  {  193,   -7 }, /* (296) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
  {  193,   -8 }, /* (297) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
  {  193,   -9 }, /* (298) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
  {  193,   -7 }, /* (299) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
  {  193,   -3 }, /* (300) cmd ::= KILL CONNECTION INTEGER */
  {  193,   -5 }, /* (301) cmd ::= KILL STREAM INTEGER COLON INTEGER */
  {  193,   -5 }, /* (302) cmd ::= KILL QUERY INTEGER COLON INTEGER */
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
**
** The yyLookahead and yyLookaheadToken parameters provide reduce actions
** access to the lookahead token (if any).  The yyLookahead will be YYNOCODE
** if the lookahead token has already been consumed.  As this procedure is
** 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(
  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 */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
  (void)yyLookahead;
  (void)yyLookaheadToken;
  yymsp = yypParser->yytos;
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    yysize = yyRuleInfo[yyruleno].nrhs;
    if( yysize ){
      fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
        yyTracePrompt,
        yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno);
    }else{
      fprintf(yyTraceFILE, "%sReduce %d [%s].\n",
        yyTracePrompt, yyruleno, yyRuleName[yyruleno]);
    }
  }
#endif /* NDEBUG */

  /* Check that the stack is large enough to grow by a single entry
  ** if the RHS of the rule is empty.  This ensures that there is room
  ** enough on the stack to push the LHS value */
  if( yyRuleInfo[yyruleno].nrhs==0 ){
#ifdef YYTRACKMAXSTACKDEPTH
    if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
      yypParser->yyhwm++;
      assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
    }
#endif
#if YYSTACKDEPTH>0 
    if( yypParser->yytos>=yypParser->yystackEnd ){
      yyStackOverflow(yypParser);
      return;
    }
#else
    if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
      if( yyGrowStack(yypParser) ){
        yyStackOverflow(yypParser);
        return;
      }
      yymsp = yypParser->yytos;
    }
#endif
  }

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
/********** Begin reduce actions **********************************************/
        YYMINORTYPE yylhsminor;
      case 0: /* program ::= cmd */
H
Haojun Liao 已提交
2227 2228 2229
      case 135: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==135);
      case 136: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==136);
      case 137: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==137);
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321
{}
        break;
      case 1: /* cmd ::= SHOW DATABASES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);}
        break;
      case 2: /* cmd ::= SHOW TOPICS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_TP, 0, 0);}
        break;
      case 3: /* cmd ::= SHOW FUNCTIONS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_FUNCTION, 0, 0);}
        break;
      case 4: /* cmd ::= SHOW MNODES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);}
        break;
      case 5: /* cmd ::= SHOW DNODES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);}
        break;
      case 6: /* cmd ::= SHOW ACCOUNTS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);}
        break;
      case 7: /* cmd ::= SHOW USERS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_USER, 0, 0);}
        break;
      case 8: /* cmd ::= SHOW MODULES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0);  }
        break;
      case 9: /* cmd ::= SHOW QUERIES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0);  }
        break;
      case 10: /* cmd ::= SHOW CONNECTIONS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);}
        break;
      case 11: /* cmd ::= SHOW STREAMS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0);  }
        break;
      case 12: /* cmd ::= SHOW VARIABLES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0);  }
        break;
      case 13: /* cmd ::= SHOW SCORES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0);   }
        break;
      case 14: /* cmd ::= SHOW GRANTS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0);   }
        break;
      case 15: /* cmd ::= SHOW VNODES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); }
        break;
      case 16: /* cmd ::= SHOW VNODES ids */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &yymsp[0].minor.yy0, 0); }
        break;
      case 17: /* dbPrefix ::= */
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.type = 0;}
        break;
      case 18: /* dbPrefix ::= ids DOT */
{yylhsminor.yy0 = yymsp[-1].minor.yy0;  }
  yymsp[-1].minor.yy0 = yylhsminor.yy0;
        break;
      case 19: /* cpxName ::= */
{yymsp[1].minor.yy0.n = 0;  }
        break;
      case 20: /* cpxName ::= DOT ids */
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1;    }
        break;
      case 21: /* cmd ::= SHOW CREATE TABLE ids cpxName */
{
   yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
   setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &yymsp[-1].minor.yy0);
}
        break;
      case 22: /* cmd ::= SHOW CREATE STABLE ids cpxName */
{
   yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
   setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_STABLE, 1, &yymsp[-1].minor.yy0);
}
        break;
      case 23: /* cmd ::= SHOW CREATE DATABASE ids */
{
  setDCLSqlElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0);
}
        break;
      case 24: /* cmd ::= SHOW dbPrefix TABLES */
{
    setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0);
}
        break;
      case 25: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */
{
    setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 26: /* cmd ::= SHOW dbPrefix STABLES */
{
S
Shengliang Guan 已提交
2322
    setShowOptions(pInfo, TSDB_MGMT_TABLE_STB, &yymsp[-1].minor.yy0, 0);
2323 2324 2325 2326 2327 2328
}
        break;
      case 27: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */
{
    SToken token;
    tSetDbName(&token, &yymsp[-3].minor.yy0);
S
Shengliang Guan 已提交
2329
    setShowOptions(pInfo, TSDB_MGMT_TABLE_STB, &token, &yymsp[0].minor.yy0);
2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404
}
        break;
      case 28: /* cmd ::= SHOW dbPrefix VGROUPS */
{
    SToken token;
    tSetDbName(&token, &yymsp[-1].minor.yy0);
    setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0);
}
        break;
      case 29: /* cmd ::= SHOW dbPrefix VGROUPS ids */
{
    SToken token;
    tSetDbName(&token, &yymsp[-2].minor.yy0);
    setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0);
}
        break;
      case 30: /* cmd ::= DROP TABLE ifexists ids cpxName */
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, -1);
}
        break;
      case 31: /* cmd ::= DROP STABLE ifexists ids cpxName */
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1, TSDB_SUPER_TABLE);
}
        break;
      case 32: /* cmd ::= DROP DATABASE ifexists ids */
{ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_DEFAULT, -1); }
        break;
      case 33: /* cmd ::= DROP TOPIC ifexists ids */
{ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, TSDB_DB_TYPE_TOPIC, -1); }
        break;
      case 34: /* cmd ::= DROP FUNCTION ids */
{ setDropFuncInfo(pInfo, TSDB_SQL_DROP_FUNCTION, &yymsp[0].minor.yy0); }
        break;
      case 35: /* cmd ::= DROP DNODE ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0);    }
        break;
      case 36: /* cmd ::= DROP USER ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0);     }
        break;
      case 37: /* cmd ::= DROP ACCOUNT ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0);  }
        break;
      case 38: /* cmd ::= USE ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);}
        break;
      case 39: /* cmd ::= DESCRIBE ids cpxName */
      case 40: /* cmd ::= DESC ids cpxName */ yytestcase(yyruleno==40);
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    setDCLSqlElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0);
}
        break;
      case 41: /* cmd ::= ALTER USER ids PASS ids */
{ setAlterUserSql(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL);    }
        break;
      case 42: /* cmd ::= ALTER USER ids PRIVILEGE ids */
{ setAlterUserSql(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);}
        break;
      case 43: /* cmd ::= ALTER DNODE ids ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
        break;
      case 44: /* cmd ::= ALTER DNODE ids ids ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);      }
        break;
      case 45: /* cmd ::= ALTER LOCAL ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0);              }
        break;
      case 46: /* cmd ::= ALTER LOCAL ids ids */
{ setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);          }
        break;
      case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */
H
Haojun Liao 已提交
2405
{ SToken t = {0};  setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy16, &t);}
2406
        break;
2407
      case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */
H
Haojun Liao 已提交
2408
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy211);}
2409
        break;
2410
      case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
H
Haojun Liao 已提交
2411
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);}
2412
        break;
2413
      case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */
H
Haojun Liao 已提交
2414
{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy165);}
2415
        break;
2416 2417
      case 51: /* ids ::= ID */
      case 52: /* ids ::= STRING */ yytestcase(yyruleno==52);
2418 2419 2420
{yylhsminor.yy0 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
2421
      case 53: /* ifexists ::= IF EXISTS */
2422 2423
{ yymsp[-1].minor.yy0.n = 1;}
        break;
2424 2425
      case 54: /* ifexists ::= */
      case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56);
H
Haojun Liao 已提交
2426
      case 190: /* distinct ::= */ yytestcase(yyruleno==190);
2427 2428
{ yymsp[1].minor.yy0.n = 0;}
        break;
2429
      case 55: /* ifnotexists ::= IF NOT EXISTS */
2430 2431
{ yymsp[-2].minor.yy0.n = 1;}
        break;
2432
      case 57: /* cmd ::= CREATE DNODE ids PORT ids */
2433
      case 58: /* cmd ::= CREATE DNODE IPTOKEN PORT ids */ yytestcase(yyruleno==58);
2434
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
2435
        break;
2436
      case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
H
Haojun Liao 已提交
2437
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);}
2438
        break;
2439
      case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
H
Haojun Liao 已提交
2440
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy16, &yymsp[-2].minor.yy0);}
2441
        break;
2442
      case 61: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
H
Haojun Liao 已提交
2443
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy106, &yymsp[0].minor.yy0, 1);}
2444
        break;
2445
      case 62: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
H
Haojun Liao 已提交
2446
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy106, &yymsp[0].minor.yy0, 2);}
2447
        break;
2448
      case 63: /* cmd ::= CREATE USER ids PASS ids */
2449 2450
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
        break;
2451 2452 2453 2454 2455 2456 2457 2458 2459 2460
      case 64: /* bufsize ::= */
      case 66: /* pps ::= */ yytestcase(yyruleno==66);
      case 68: /* tseries ::= */ yytestcase(yyruleno==68);
      case 70: /* dbs ::= */ yytestcase(yyruleno==70);
      case 72: /* streams ::= */ yytestcase(yyruleno==72);
      case 74: /* storage ::= */ yytestcase(yyruleno==74);
      case 76: /* qtime ::= */ yytestcase(yyruleno==76);
      case 78: /* users ::= */ yytestcase(yyruleno==78);
      case 80: /* conns ::= */ yytestcase(yyruleno==80);
      case 82: /* state ::= */ yytestcase(yyruleno==82);
2461 2462
{ yymsp[1].minor.yy0.n = 0;   }
        break;
2463 2464 2465 2466 2467 2468 2469 2470 2471 2472
      case 65: /* bufsize ::= BUFSIZE INTEGER */
      case 67: /* pps ::= PPS INTEGER */ yytestcase(yyruleno==67);
      case 69: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==69);
      case 71: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==71);
      case 73: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==73);
      case 75: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==75);
      case 77: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==77);
      case 79: /* users ::= USERS INTEGER */ yytestcase(yyruleno==79);
      case 81: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==81);
      case 83: /* state ::= STATE ids */ yytestcase(yyruleno==83);
2473 2474
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;     }
        break;
2475
      case 84: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
2476
{
H
Haojun Liao 已提交
2477 2478 2479 2480 2481 2482 2483 2484 2485
    yylhsminor.yy211.maxUsers   = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
    yylhsminor.yy211.maxDbs     = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
    yylhsminor.yy211.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
    yylhsminor.yy211.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
    yylhsminor.yy211.maxPointsPerSecond     = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
    yylhsminor.yy211.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy211.maxQueryTime   = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy211.maxConnections   = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
    yylhsminor.yy211.stat    = yymsp[0].minor.yy0;
2486
}
H
Haojun Liao 已提交
2487
  yymsp[-8].minor.yy211 = yylhsminor.yy211;
2488
        break;
2489
      case 85: /* intitemlist ::= intitemlist COMMA intitem */
H
Haojun Liao 已提交
2490 2491 2492
      case 163: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==163);
{ yylhsminor.yy165 = tListItemAppend(yymsp[-2].minor.yy165, &yymsp[0].minor.yy425, -1);    }
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
2493
        break;
2494
      case 86: /* intitemlist ::= intitem */
H
Haojun Liao 已提交
2495 2496 2497
      case 164: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==164);
{ yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[0].minor.yy425, -1); }
  yymsp[0].minor.yy165 = yylhsminor.yy165;
2498
        break;
2499
      case 87: /* intitem ::= INTEGER */
H
Haojun Liao 已提交
2500 2501 2502 2503 2504 2505
      case 165: /* tagitem ::= INTEGER */ yytestcase(yyruleno==165);
      case 166: /* tagitem ::= FLOAT */ yytestcase(yyruleno==166);
      case 167: /* tagitem ::= STRING */ yytestcase(yyruleno==167);
      case 168: /* tagitem ::= BOOL */ yytestcase(yyruleno==168);
{ toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); }
  yymsp[0].minor.yy425 = yylhsminor.yy425;
2506
        break;
2507
      case 88: /* keep ::= KEEP intitemlist */
H
Haojun Liao 已提交
2508
{ yymsp[-1].minor.yy165 = yymsp[0].minor.yy165; }
2509
        break;
2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523
      case 89: /* cache ::= CACHE INTEGER */
      case 90: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==90);
      case 91: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==91);
      case 92: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==92);
      case 93: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==93);
      case 94: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==94);
      case 95: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==95);
      case 96: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==96);
      case 97: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==97);
      case 98: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==98);
      case 99: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==99);
      case 100: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==100);
      case 101: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==101);
      case 102: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==102);
H
Haojun Liao 已提交
2524
      case 103: /* vgroups ::= VGROUPS INTEGER */ yytestcase(yyruleno==103);
2525 2526
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
        break;
H
Haojun Liao 已提交
2527 2528
      case 104: /* db_optr ::= */
{setDefaultCreateDbOption(&yymsp[1].minor.yy16);}
2529
        break;
H
Haojun Liao 已提交
2530 2531 2532
      case 105: /* db_optr ::= db_optr cache */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2533
        break;
H
Haojun Liao 已提交
2534 2535 2536 2537
      case 106: /* db_optr ::= db_optr replica */
      case 122: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==122);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2538
        break;
H
Haojun Liao 已提交
2539 2540 2541 2542
      case 107: /* db_optr ::= db_optr quorum */
      case 123: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==123);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2543
        break;
H
Haojun Liao 已提交
2544 2545 2546
      case 108: /* db_optr ::= db_optr days */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2547
        break;
H
Haojun Liao 已提交
2548 2549 2550
      case 109: /* db_optr ::= db_optr minrows */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2551
        break;
H
Haojun Liao 已提交
2552 2553 2554
      case 110: /* db_optr ::= db_optr maxrows */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2555
        break;
H
Haojun Liao 已提交
2556 2557 2558 2559
      case 111: /* db_optr ::= db_optr blocks */
      case 125: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==125);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2560
        break;
H
Haojun Liao 已提交
2561 2562 2563
      case 112: /* db_optr ::= db_optr ctime */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2564
        break;
H
Haojun Liao 已提交
2565 2566 2567
      case 113: /* db_optr ::= db_optr wal */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2568
        break;
H
Haojun Liao 已提交
2569 2570 2571
      case 114: /* db_optr ::= db_optr fsync */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2572
        break;
H
Haojun Liao 已提交
2573 2574 2575 2576
      case 115: /* db_optr ::= db_optr comp */
      case 126: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==126);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2577
        break;
H
Haojun Liao 已提交
2578 2579 2580
      case 116: /* db_optr ::= db_optr prec */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.precision = yymsp[0].minor.yy0; }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2581
        break;
H
Haojun Liao 已提交
2582 2583 2584 2585
      case 117: /* db_optr ::= db_optr keep */
      case 124: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==124);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.keep = yymsp[0].minor.yy165; }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2586
        break;
H
Haojun Liao 已提交
2587 2588 2589 2590
      case 118: /* db_optr ::= db_optr update */
      case 127: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==127);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2591
        break;
H
Haojun Liao 已提交
2592 2593 2594 2595
      case 119: /* db_optr ::= db_optr cachelast */
      case 128: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==128);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2596
        break;
H
Haojun Liao 已提交
2597 2598 2599
      case 120: /* db_optr ::= db_optr vgroups */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.numOfVgroups = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy16 = yylhsminor.yy16;
2600
        break;
H
Haojun Liao 已提交
2601 2602 2603 2604
      case 121: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy16);}
        break;
      case 129: /* typename ::= ids */
2605 2606
{ 
  yymsp[0].minor.yy0.type = 0;
H
Haojun Liao 已提交
2607
  tSetColumnType (&yylhsminor.yy106, &yymsp[0].minor.yy0);
2608
}
H
Haojun Liao 已提交
2609
  yymsp[0].minor.yy106 = yylhsminor.yy106;
2610
        break;
H
Haojun Liao 已提交
2611
      case 130: /* typename ::= ids LP signed RP */
2612
{
H
Haojun Liao 已提交
2613
  if (yymsp[-1].minor.yy207 <= 0) {
2614
    yymsp[-3].minor.yy0.type = 0;
H
Haojun Liao 已提交
2615
    tSetColumnType(&yylhsminor.yy106, &yymsp[-3].minor.yy0);
2616
  } else {
H
Haojun Liao 已提交
2617 2618
    yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy207;  // negative value of name length
    tSetColumnType(&yylhsminor.yy106, &yymsp[-3].minor.yy0);
2619 2620
  }
}
H
Haojun Liao 已提交
2621
  yymsp[-3].minor.yy106 = yylhsminor.yy106;
2622
        break;
H
Haojun Liao 已提交
2623
      case 131: /* typename ::= ids UNSIGNED */
2624 2625 2626
{
  yymsp[-1].minor.yy0.type = 0;
  yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
H
Haojun Liao 已提交
2627
  tSetColumnType (&yylhsminor.yy106, &yymsp[-1].minor.yy0);
2628
}
H
Haojun Liao 已提交
2629
  yymsp[-1].minor.yy106 = yylhsminor.yy106;
2630
        break;
H
Haojun Liao 已提交
2631 2632 2633
      case 132: /* signed ::= INTEGER */
{ yylhsminor.yy207 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[0].minor.yy207 = yylhsminor.yy207;
2634
        break;
H
Haojun Liao 已提交
2635 2636
      case 133: /* signed ::= PLUS INTEGER */
{ yymsp[-1].minor.yy207 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
2637
        break;
H
Haojun Liao 已提交
2638 2639
      case 134: /* signed ::= MINUS INTEGER */
{ yymsp[-1].minor.yy207 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
2640
        break;
H
Haojun Liao 已提交
2641 2642
      case 138: /* cmd ::= CREATE TABLE create_table_list */
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy326;}
2643
        break;
H
Haojun Liao 已提交
2644
      case 139: /* create_table_list ::= create_from_stable */
2645 2646 2647 2648
{
  SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
  pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));

H
Haojun Liao 已提交
2649
  taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy150);
2650
  pCreateTable->type = TSQL_CREATE_CTABLE;
H
Haojun Liao 已提交
2651
  yylhsminor.yy326 = pCreateTable;
2652
}
H
Haojun Liao 已提交
2653
  yymsp[0].minor.yy326 = yylhsminor.yy326;
2654
        break;
H
Haojun Liao 已提交
2655
      case 140: /* create_table_list ::= create_table_list create_from_stable */
2656
{
H
Haojun Liao 已提交
2657 2658
  taosArrayPush(yymsp[-1].minor.yy326->childTableInfo, &yymsp[0].minor.yy150);
  yylhsminor.yy326 = yymsp[-1].minor.yy326;
2659
}
H
Haojun Liao 已提交
2660
  yymsp[-1].minor.yy326 = yylhsminor.yy326;
2661
        break;
H
Haojun Liao 已提交
2662
      case 141: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
2663
{
H
Haojun Liao 已提交
2664 2665
  yylhsminor.yy326 = tSetCreateTableInfo(yymsp[-1].minor.yy165, NULL, NULL, TSQL_CREATE_TABLE);
  setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_TABLE);
2666 2667 2668 2669

  yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
  setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
}
H
Haojun Liao 已提交
2670
  yymsp[-5].minor.yy326 = yylhsminor.yy326;
2671
        break;
H
Haojun Liao 已提交
2672
      case 142: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
2673
{
H
Haojun Liao 已提交
2674 2675
  yylhsminor.yy326 = tSetCreateTableInfo(yymsp[-5].minor.yy165, yymsp[-1].minor.yy165, NULL, TSQL_CREATE_STABLE);
  setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_TABLE);
2676 2677 2678 2679

  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
  setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
H
Haojun Liao 已提交
2680
  yymsp[-9].minor.yy326 = yylhsminor.yy326;
2681
        break;
H
Haojun Liao 已提交
2682
      case 143: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
2683 2684 2685
{
  yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
H
Haojun Liao 已提交
2686
  yylhsminor.yy150 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy165, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
2687
}
H
Haojun Liao 已提交
2688
  yymsp[-9].minor.yy150 = yylhsminor.yy150;
2689
        break;
H
Haojun Liao 已提交
2690
      case 144: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
2691 2692 2693
{
  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
  yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
H
Haojun Liao 已提交
2694
  yylhsminor.yy150 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy165, yymsp[-1].minor.yy165, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
2695
}
H
Haojun Liao 已提交
2696
  yymsp[-12].minor.yy150 = yylhsminor.yy150;
2697
        break;
H
Haojun Liao 已提交
2698 2699 2700
      case 145: /* tagNamelist ::= tagNamelist COMMA ids */
{taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy0); yylhsminor.yy165 = yymsp[-2].minor.yy165;  }
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
2701
        break;
H
Haojun Liao 已提交
2702 2703 2704
      case 146: /* tagNamelist ::= ids */
{yylhsminor.yy165 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy0);}
  yymsp[0].minor.yy165 = yylhsminor.yy165;
2705
        break;
H
Haojun Liao 已提交
2706
      case 147: /* create_table_args ::= ifnotexists ids cpxName AS select */
2707
{
H
Haojun Liao 已提交
2708 2709
  yylhsminor.yy326 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy278, TSQL_CREATE_STREAM);
  setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_TABLE);
2710 2711 2712 2713

  yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n;
  setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0);
}
H
Haojun Liao 已提交
2714
  yymsp[-4].minor.yy326 = yylhsminor.yy326;
2715
        break;
H
Haojun Liao 已提交
2716 2717 2718
      case 148: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy106); yylhsminor.yy165 = yymsp[-2].minor.yy165;  }
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
2719
        break;
H
Haojun Liao 已提交
2720 2721 2722
      case 149: /* columnlist ::= column */
{yylhsminor.yy165 = taosArrayInit(4, sizeof(SField)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy106);}
  yymsp[0].minor.yy165 = yylhsminor.yy165;
2723
        break;
H
Haojun Liao 已提交
2724
      case 150: /* column ::= ids typename */
2725
{
H
Haojun Liao 已提交
2726
  tSetColumnInfo(&yylhsminor.yy106, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy106);
2727
}
H
Haojun Liao 已提交
2728
  yymsp[-1].minor.yy106 = yylhsminor.yy106;
2729
        break;
H
Haojun Liao 已提交
2730 2731 2732
      case 151: /* tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */
{ taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy0); yylhsminor.yy165 = yymsp[-2].minor.yy165;}
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
2733
        break;
H
Haojun Liao 已提交
2734 2735 2736
      case 152: /* tagitemlist1 ::= tagitem1 */
{ yylhsminor.yy165 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy0); }
  yymsp[0].minor.yy165 = yylhsminor.yy165;
2737
        break;
H
Haojun Liao 已提交
2738 2739 2740 2741
      case 153: /* tagitem1 ::= MINUS INTEGER */
      case 154: /* tagitem1 ::= MINUS FLOAT */ yytestcase(yyruleno==154);
      case 155: /* tagitem1 ::= PLUS INTEGER */ yytestcase(yyruleno==155);
      case 156: /* tagitem1 ::= PLUS FLOAT */ yytestcase(yyruleno==156);
2742 2743 2744
{ yylhsminor.yy0.n = yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n; yylhsminor.yy0.type = yymsp[0].minor.yy0.type; }
  yymsp[-1].minor.yy0 = yylhsminor.yy0;
        break;
H
Haojun Liao 已提交
2745 2746 2747 2748 2749 2750
      case 157: /* tagitem1 ::= INTEGER */
      case 158: /* tagitem1 ::= FLOAT */ yytestcase(yyruleno==158);
      case 159: /* tagitem1 ::= STRING */ yytestcase(yyruleno==159);
      case 160: /* tagitem1 ::= BOOL */ yytestcase(yyruleno==160);
      case 161: /* tagitem1 ::= NULL */ yytestcase(yyruleno==161);
      case 162: /* tagitem1 ::= NOW */ yytestcase(yyruleno==162);
2751 2752 2753
{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
H
Haojun Liao 已提交
2754 2755 2756
      case 169: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); }
  yymsp[0].minor.yy425 = yylhsminor.yy425;
2757
        break;
H
Haojun Liao 已提交
2758 2759 2760
      case 170: /* tagitem ::= NOW */
{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type);}
  yymsp[0].minor.yy425 = yylhsminor.yy425;
2761
        break;
H
Haojun Liao 已提交
2762 2763 2764 2765
      case 171: /* tagitem ::= MINUS INTEGER */
      case 172: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==172);
      case 173: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==173);
      case 174: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==174);
2766 2767 2768 2769
{
    yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
    yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
    toTSDBType(yymsp[-1].minor.yy0.type);
H
Haojun Liao 已提交
2770
    taosVariantCreate(&yylhsminor.yy425, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type);
2771
}
H
Haojun Liao 已提交
2772
  yymsp[-1].minor.yy425 = yylhsminor.yy425;
2773
        break;
H
Haojun Liao 已提交
2774
      case 175: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
2775
{
H
Haojun Liao 已提交
2776
  yylhsminor.yy278 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy165, yymsp[-11].minor.yy10, yymsp[-10].minor.yy202, yymsp[-4].minor.yy165, yymsp[-2].minor.yy165, &yymsp[-9].minor.yy532, &yymsp[-7].minor.yy97, &yymsp[-6].minor.yy6, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy165, &yymsp[0].minor.yy367, &yymsp[-1].minor.yy367, yymsp[-3].minor.yy202);
2777
}
H
Haojun Liao 已提交
2778
  yymsp[-13].minor.yy278 = yylhsminor.yy278;
2779
        break;
H
Haojun Liao 已提交
2780 2781
      case 176: /* select ::= LP select RP */
{yymsp[-2].minor.yy278 = yymsp[-1].minor.yy278;}
2782
        break;
H
Haojun Liao 已提交
2783 2784 2785
      case 177: /* union ::= select */
{ yylhsminor.yy503 = setSubclause(NULL, yymsp[0].minor.yy278); }
  yymsp[0].minor.yy503 = yylhsminor.yy503;
2786
        break;
H
Haojun Liao 已提交
2787 2788 2789
      case 178: /* union ::= union UNION ALL select */
{ yylhsminor.yy503 = appendSelectClause(yymsp[-3].minor.yy503, SQL_TYPE_UNIONALL, yymsp[0].minor.yy278);  }
  yymsp[-3].minor.yy503 = yylhsminor.yy503;
2790
        break;
H
Haojun Liao 已提交
2791 2792 2793
      case 179: /* union ::= union UNION select */
{ yylhsminor.yy503 = appendSelectClause(yymsp[-2].minor.yy503, SQL_TYPE_UNION, yymsp[0].minor.yy278);  }
  yymsp[-2].minor.yy503 = yylhsminor.yy503;
2794
        break;
H
Haojun Liao 已提交
2795 2796
      case 180: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy503, NULL, TSDB_SQL_SELECT); }
2797
        break;
H
Haojun Liao 已提交
2798
      case 181: /* select ::= SELECT selcollist */
2799
{
H
Haojun Liao 已提交
2800
  yylhsminor.yy278 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy165, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
2801
}
H
Haojun Liao 已提交
2802
  yymsp[-1].minor.yy278 = yylhsminor.yy278;
2803
        break;
H
Haojun Liao 已提交
2804 2805 2806
      case 182: /* sclp ::= selcollist COMMA */
{yylhsminor.yy165 = yymsp[-1].minor.yy165;}
  yymsp[-1].minor.yy165 = yylhsminor.yy165;
2807
        break;
H
Haojun Liao 已提交
2808 2809 2810
      case 183: /* sclp ::= */
      case 215: /* orderby_opt ::= */ yytestcase(yyruleno==215);
{yymsp[1].minor.yy165 = 0;}
2811
        break;
H
Haojun Liao 已提交
2812
      case 184: /* selcollist ::= sclp distinct expr as */
2813
{
H
Haojun Liao 已提交
2814
   yylhsminor.yy165 = tSqlExprListAppend(yymsp[-3].minor.yy165, yymsp[-1].minor.yy202,  yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
2815
}
H
Haojun Liao 已提交
2816
  yymsp[-3].minor.yy165 = yylhsminor.yy165;
2817
        break;
H
Haojun Liao 已提交
2818
      case 185: /* selcollist ::= sclp STAR */
2819 2820
{
   tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
H
Haojun Liao 已提交
2821
   yylhsminor.yy165 = tSqlExprListAppend(yymsp[-1].minor.yy165, pNode, 0, 0);
2822
}
H
Haojun Liao 已提交
2823
  yymsp[-1].minor.yy165 = yylhsminor.yy165;
2824
        break;
H
Haojun Liao 已提交
2825
      case 186: /* as ::= AS ids */
2826 2827
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;    }
        break;
H
Haojun Liao 已提交
2828
      case 187: /* as ::= ids */
2829 2830 2831
{ yylhsminor.yy0 = yymsp[0].minor.yy0;    }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
H
Haojun Liao 已提交
2832
      case 188: /* as ::= */
2833 2834
{ yymsp[1].minor.yy0.n = 0;  }
        break;
H
Haojun Liao 已提交
2835
      case 189: /* distinct ::= DISTINCT */
2836 2837 2838
{ yylhsminor.yy0 = yymsp[0].minor.yy0;  }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
H
Haojun Liao 已提交
2839 2840 2841
      case 191: /* from ::= FROM tablelist */
      case 192: /* from ::= FROM sub */ yytestcase(yyruleno==192);
{yymsp[-1].minor.yy10 = yymsp[0].minor.yy10;}
2842
        break;
H
Haojun Liao 已提交
2843 2844
      case 193: /* sub ::= LP union RP */
{yymsp[-2].minor.yy10 = addSubquery(NULL, yymsp[-1].minor.yy503, NULL);}
2845
        break;
H
Haojun Liao 已提交
2846 2847
      case 194: /* sub ::= LP union RP ids */
{yymsp[-3].minor.yy10 = addSubquery(NULL, yymsp[-2].minor.yy503, &yymsp[0].minor.yy0);}
2848
        break;
H
Haojun Liao 已提交
2849 2850 2851
      case 195: /* sub ::= sub COMMA LP union RP ids */
{yylhsminor.yy10 = addSubquery(yymsp[-5].minor.yy10, yymsp[-2].minor.yy503, &yymsp[0].minor.yy0);}
  yymsp[-5].minor.yy10 = yylhsminor.yy10;
2852
        break;
H
Haojun Liao 已提交
2853
      case 196: /* tablelist ::= ids cpxName */
2854 2855
{
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
H
Haojun Liao 已提交
2856
  yylhsminor.yy10 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
2857
}
H
Haojun Liao 已提交
2858
  yymsp[-1].minor.yy10 = yylhsminor.yy10;
2859
        break;
H
Haojun Liao 已提交
2860
      case 197: /* tablelist ::= ids cpxName ids */
2861 2862
{
  yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
H
Haojun Liao 已提交
2863
  yylhsminor.yy10 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
2864
}
H
Haojun Liao 已提交
2865
  yymsp[-2].minor.yy10 = yylhsminor.yy10;
2866
        break;
H
Haojun Liao 已提交
2867
      case 198: /* tablelist ::= tablelist COMMA ids cpxName */
2868 2869
{
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
H
Haojun Liao 已提交
2870
  yylhsminor.yy10 = setTableNameList(yymsp[-3].minor.yy10, &yymsp[-1].minor.yy0, NULL);
2871
}
H
Haojun Liao 已提交
2872
  yymsp[-3].minor.yy10 = yylhsminor.yy10;
2873
        break;
H
Haojun Liao 已提交
2874
      case 199: /* tablelist ::= tablelist COMMA ids cpxName ids */
2875 2876
{
  yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
H
Haojun Liao 已提交
2877
  yylhsminor.yy10 = setTableNameList(yymsp[-4].minor.yy10, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
2878
}
H
Haojun Liao 已提交
2879
  yymsp[-4].minor.yy10 = yylhsminor.yy10;
2880
        break;
H
Haojun Liao 已提交
2881
      case 200: /* tmvar ::= VARIABLE */
2882 2883 2884
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
H
Haojun Liao 已提交
2885 2886 2887
      case 201: /* interval_option ::= intervalKey LP tmvar RP */
{yylhsminor.yy532.interval = yymsp[-1].minor.yy0; yylhsminor.yy532.offset.n = 0; yylhsminor.yy532.token = yymsp[-3].minor.yy46;}
  yymsp[-3].minor.yy532 = yylhsminor.yy532;
2888
        break;
H
Haojun Liao 已提交
2889 2890 2891
      case 202: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{yylhsminor.yy532.interval = yymsp[-3].minor.yy0; yylhsminor.yy532.offset = yymsp[-1].minor.yy0;   yylhsminor.yy532.token = yymsp[-5].minor.yy46;}
  yymsp[-5].minor.yy532 = yylhsminor.yy532;
2892
        break;
H
Haojun Liao 已提交
2893 2894
      case 203: /* interval_option ::= */
{memset(&yymsp[1].minor.yy532, 0, sizeof(yymsp[1].minor.yy532));}
2895
        break;
H
Haojun Liao 已提交
2896 2897
      case 204: /* intervalKey ::= INTERVAL */
{yymsp[0].minor.yy46 = TK_INTERVAL;}
2898
        break;
H
Haojun Liao 已提交
2899 2900
      case 205: /* intervalKey ::= EVERY */
{yymsp[0].minor.yy46 = TK_EVERY;   }
2901
        break;
H
Haojun Liao 已提交
2902 2903
      case 206: /* session_option ::= */
{yymsp[1].minor.yy97.col.n = 0; yymsp[1].minor.yy97.gap.n = 0;}
2904
        break;
H
Haojun Liao 已提交
2905
      case 207: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
2906 2907
{
   yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
2908 2909
   yymsp[-6].minor.yy97.col = yymsp[-4].minor.yy0;
   yymsp[-6].minor.yy97.gap = yymsp[-1].minor.yy0;
2910 2911
}
        break;
H
Haojun Liao 已提交
2912 2913
      case 208: /* windowstate_option ::= */
{ yymsp[1].minor.yy6.col.n = 0; yymsp[1].minor.yy6.col.z = NULL;}
2914
        break;
H
Haojun Liao 已提交
2915 2916
      case 209: /* windowstate_option ::= STATE_WINDOW LP ids RP */
{ yymsp[-3].minor.yy6.col = yymsp[-1].minor.yy0; }
2917
        break;
H
Haojun Liao 已提交
2918 2919
      case 210: /* fill_opt ::= */
{ yymsp[1].minor.yy165 = 0;     }
2920
        break;
H
Haojun Liao 已提交
2921
      case 211: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
2922 2923 2924 2925 2926
{
    SVariant A = {0};
    toTSDBType(yymsp[-3].minor.yy0.type);
    taosVariantCreate(&A, yymsp[-3].minor.yy0.z, yymsp[-3].minor.yy0.n, yymsp[-3].minor.yy0.type);

H
Haojun Liao 已提交
2927 2928
    tListItemInsert(yymsp[-1].minor.yy165, &A, -1, 0);
    yymsp[-5].minor.yy165 = yymsp[-1].minor.yy165;
2929 2930
}
        break;
H
Haojun Liao 已提交
2931
      case 212: /* fill_opt ::= FILL LP ID RP */
2932 2933
{
    toTSDBType(yymsp[-1].minor.yy0.type);
H
Haojun Liao 已提交
2934
    yymsp[-3].minor.yy165 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
2935 2936
}
        break;
H
Haojun Liao 已提交
2937
      case 213: /* sliding_opt ::= SLIDING LP tmvar RP */
2938 2939
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0;     }
        break;
H
Haojun Liao 已提交
2940
      case 214: /* sliding_opt ::= */
2941 2942
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0;   }
        break;
H
Haojun Liao 已提交
2943 2944
      case 216: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy165 = yymsp[0].minor.yy165;}
2945
        break;
H
Haojun Liao 已提交
2946
      case 217: /* sortlist ::= sortlist COMMA item sortorder */
2947
{
H
Haojun Liao 已提交
2948
    yylhsminor.yy165 = tListItemAppend(yymsp[-3].minor.yy165, &yymsp[-1].minor.yy425, yymsp[0].minor.yy47);
2949
}
H
Haojun Liao 已提交
2950
  yymsp[-3].minor.yy165 = yylhsminor.yy165;
2951
        break;
H
Haojun Liao 已提交
2952
      case 218: /* sortlist ::= item sortorder */
2953
{
H
Haojun Liao 已提交
2954
  yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[-1].minor.yy425, yymsp[0].minor.yy47);
2955
}
H
Haojun Liao 已提交
2956
  yymsp[-1].minor.yy165 = yylhsminor.yy165;
2957
        break;
H
Haojun Liao 已提交
2958
      case 219: /* item ::= ids cpxName */
2959 2960 2961 2962
{
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;

H
Haojun Liao 已提交
2963
  taosVariantCreate(&yylhsminor.yy425, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type);
2964
}
H
Haojun Liao 已提交
2965
  yymsp[-1].minor.yy425 = yylhsminor.yy425;
2966
        break;
H
Haojun Liao 已提交
2967 2968
      case 220: /* sortorder ::= ASC */
{ yymsp[0].minor.yy47 = TSDB_ORDER_ASC; }
2969
        break;
H
Haojun Liao 已提交
2970 2971
      case 221: /* sortorder ::= DESC */
{ yymsp[0].minor.yy47 = TSDB_ORDER_DESC;}
2972
        break;
H
Haojun Liao 已提交
2973 2974
      case 222: /* sortorder ::= */
{ yymsp[1].minor.yy47 = TSDB_ORDER_ASC; }
2975
        break;
H
Haojun Liao 已提交
2976 2977
      case 223: /* groupby_opt ::= */
{ yymsp[1].minor.yy165 = 0;}
2978
        break;
H
Haojun Liao 已提交
2979 2980
      case 224: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy165 = yymsp[0].minor.yy165;}
2981
        break;
H
Haojun Liao 已提交
2982
      case 225: /* grouplist ::= grouplist COMMA item */
2983
{
H
Haojun Liao 已提交
2984
  yylhsminor.yy165 = tListItemAppend(yymsp[-2].minor.yy165, &yymsp[0].minor.yy425, -1);
2985
}
H
Haojun Liao 已提交
2986
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
2987
        break;
H
Haojun Liao 已提交
2988
      case 226: /* grouplist ::= item */
2989
{
H
Haojun Liao 已提交
2990
  yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[0].minor.yy425, -1);
2991
}
H
Haojun Liao 已提交
2992
  yymsp[0].minor.yy165 = yylhsminor.yy165;
2993
        break;
H
Haojun Liao 已提交
2994 2995 2996 2997
      case 227: /* having_opt ::= */
      case 237: /* where_opt ::= */ yytestcase(yyruleno==237);
      case 281: /* expritem ::= */ yytestcase(yyruleno==281);
{yymsp[1].minor.yy202 = 0;}
2998
        break;
H
Haojun Liao 已提交
2999 3000 3001
      case 228: /* having_opt ::= HAVING expr */
      case 238: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==238);
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
3002
        break;
H
Haojun Liao 已提交
3003 3004 3005
      case 229: /* limit_opt ::= */
      case 233: /* slimit_opt ::= */ yytestcase(yyruleno==233);
{yymsp[1].minor.yy367.limit = -1; yymsp[1].minor.yy367.offset = 0;}
3006
        break;
H
Haojun Liao 已提交
3007 3008 3009
      case 230: /* limit_opt ::= LIMIT signed */
      case 234: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==234);
{yymsp[-1].minor.yy367.limit = yymsp[0].minor.yy207;  yymsp[-1].minor.yy367.offset = 0;}
3010
        break;
H
Haojun Liao 已提交
3011 3012
      case 231: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy367.limit = yymsp[-2].minor.yy207;  yymsp[-3].minor.yy367.offset = yymsp[0].minor.yy207;}
3013
        break;
H
Haojun Liao 已提交
3014 3015
      case 232: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy367.limit = yymsp[0].minor.yy207;  yymsp[-3].minor.yy367.offset = yymsp[-2].minor.yy207;}
3016
        break;
H
Haojun Liao 已提交
3017 3018
      case 235: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy367.limit = yymsp[-2].minor.yy207;  yymsp[-3].minor.yy367.offset = yymsp[0].minor.yy207;}
3019
        break;
H
Haojun Liao 已提交
3020 3021
      case 236: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy367.limit = yymsp[0].minor.yy207;  yymsp[-3].minor.yy367.offset = yymsp[-2].minor.yy207;}
3022
        break;
H
Haojun Liao 已提交
3023 3024 3025
      case 239: /* expr ::= LP expr RP */
{yylhsminor.yy202 = yymsp[-1].minor.yy202; yylhsminor.yy202->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy202->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3026
        break;
H
Haojun Liao 已提交
3027 3028 3029
      case 240: /* expr ::= ID */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3030
        break;
H
Haojun Liao 已提交
3031 3032 3033
      case 241: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3034
        break;
H
Haojun Liao 已提交
3035 3036 3037
      case 242: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3038
        break;
H
Haojun Liao 已提交
3039 3040 3041
      case 243: /* expr ::= INTEGER */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3042
        break;
H
Haojun Liao 已提交
3043 3044 3045 3046
      case 244: /* expr ::= MINUS INTEGER */
      case 245: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==245);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
  yymsp[-1].minor.yy202 = yylhsminor.yy202;
3047
        break;
H
Haojun Liao 已提交
3048 3049 3050
      case 246: /* expr ::= FLOAT */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3051
        break;
H
Haojun Liao 已提交
3052 3053 3054 3055
      case 247: /* expr ::= MINUS FLOAT */
      case 248: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==248);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
  yymsp[-1].minor.yy202 = yylhsminor.yy202;
3056
        break;
H
Haojun Liao 已提交
3057 3058 3059
      case 249: /* expr ::= STRING */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3060
        break;
H
Haojun Liao 已提交
3061 3062 3063
      case 250: /* expr ::= NOW */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3064
        break;
H
Haojun Liao 已提交
3065 3066 3067
      case 251: /* expr ::= VARIABLE */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3068
        break;
H
Haojun Liao 已提交
3069 3070 3071 3072
      case 252: /* expr ::= PLUS VARIABLE */
      case 253: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==253);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
  yymsp[-1].minor.yy202 = yylhsminor.yy202;
3073
        break;
H
Haojun Liao 已提交
3074 3075 3076
      case 254: /* expr ::= BOOL */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3077
        break;
H
Haojun Liao 已提交
3078 3079 3080
      case 255: /* expr ::= NULL */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3081
        break;
H
Haojun Liao 已提交
3082 3083 3084
      case 256: /* expr ::= ID LP exprlist RP */
{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy202 = tSqlExprCreateFunction(yymsp[-1].minor.yy165, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
  yymsp[-3].minor.yy202 = yylhsminor.yy202;
3085
        break;
H
Haojun Liao 已提交
3086 3087 3088
      case 257: /* expr ::= ID LP STAR RP */
{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy202 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
  yymsp[-3].minor.yy202 = yylhsminor.yy202;
3089
        break;
H
Haojun Liao 已提交
3090 3091 3092
      case 258: /* expr ::= expr IS NULL */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, NULL, TK_ISNULL);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3093
        break;
H
Haojun Liao 已提交
3094 3095 3096
      case 259: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-3].minor.yy202, NULL, TK_NOTNULL);}
  yymsp[-3].minor.yy202 = yylhsminor.yy202;
3097
        break;
H
Haojun Liao 已提交
3098 3099 3100
      case 260: /* expr ::= expr LT expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LT);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3101
        break;
H
Haojun Liao 已提交
3102 3103 3104
      case 261: /* expr ::= expr GT expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_GT);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3105
        break;
H
Haojun Liao 已提交
3106 3107 3108
      case 262: /* expr ::= expr LE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LE);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3109
        break;
H
Haojun Liao 已提交
3110 3111 3112
      case 263: /* expr ::= expr GE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_GE);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3113
        break;
H
Haojun Liao 已提交
3114 3115 3116
      case 264: /* expr ::= expr NE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_NE);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3117
        break;
H
Haojun Liao 已提交
3118 3119 3120
      case 265: /* expr ::= expr EQ expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_EQ);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3121
        break;
H
Haojun Liao 已提交
3122 3123 3124
      case 266: /* expr ::= expr BETWEEN expr AND expr */
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy202); yylhsminor.yy202 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy202, yymsp[-2].minor.yy202, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy202, TK_LE), TK_AND);}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
3125
        break;
H
Haojun Liao 已提交
3126 3127 3128
      case 267: /* expr ::= expr AND expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_AND);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3129
        break;
H
Haojun Liao 已提交
3130 3131 3132
      case 268: /* expr ::= expr OR expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_OR); }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3133
        break;
H
Haojun Liao 已提交
3134 3135 3136
      case 269: /* expr ::= expr PLUS expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_PLUS);  }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3137
        break;
H
Haojun Liao 已提交
3138 3139 3140
      case 270: /* expr ::= expr MINUS expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_MINUS); }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3141
        break;
H
Haojun Liao 已提交
3142 3143 3144
      case 271: /* expr ::= expr STAR expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_STAR);  }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3145
        break;
H
Haojun Liao 已提交
3146 3147 3148
      case 272: /* expr ::= expr SLASH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_DIVIDE);}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3149
        break;
H
Haojun Liao 已提交
3150 3151 3152
      case 273: /* expr ::= expr REM expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_REM);   }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3153
        break;
H
Haojun Liao 已提交
3154 3155 3156
      case 274: /* expr ::= expr LIKE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LIKE);  }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3157
        break;
H
Haojun Liao 已提交
3158 3159 3160
      case 275: /* expr ::= expr MATCH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_MATCH);  }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3161
        break;
H
Haojun Liao 已提交
3162 3163 3164
      case 276: /* expr ::= expr NMATCH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_NMATCH);  }
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
3165
        break;
H
Haojun Liao 已提交
3166 3167 3168
      case 277: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-4].minor.yy202, (tSqlExpr*)yymsp[-1].minor.yy165, TK_IN); }
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
3169
        break;
H
Haojun Liao 已提交
3170 3171 3172
      case 278: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy165 = tSqlExprListAppend(yymsp[-2].minor.yy165,yymsp[0].minor.yy202,0, 0);}
  yymsp[-2].minor.yy165 = yylhsminor.yy165;
3173
        break;
H
Haojun Liao 已提交
3174 3175 3176
      case 279: /* exprlist ::= expritem */
{yylhsminor.yy165 = tSqlExprListAppend(0,yymsp[0].minor.yy202,0, 0);}
  yymsp[0].minor.yy165 = yylhsminor.yy165;
3177
        break;
H
Haojun Liao 已提交
3178 3179 3180
      case 280: /* expritem ::= expr */
{yylhsminor.yy202 = yymsp[0].minor.yy202;}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
3181
        break;
H
Haojun Liao 已提交
3182
      case 282: /* cmd ::= RESET QUERY CACHE */
3183 3184
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
        break;
H
Haojun Liao 已提交
3185
      case 283: /* cmd ::= SYNCDB ids REPLICA */
3186 3187
{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
        break;
H
Haojun Liao 已提交
3188
      case 284: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
3189 3190
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3191
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
3192 3193 3194
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3195
      case 285: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
3196 3197 3198 3199 3200 3201 3202 3203
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
    toTSDBType(yymsp[0].minor.yy0.type);
    SArray* K = tListItemAppendToken(NULL, &yymsp[0].minor.yy0, -1);
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3204
      case 286: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
3205 3206
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3207
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
3208 3209 3210
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3211
      case 287: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
3212 3213
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3214
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
3215 3216 3217
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3218
      case 288: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
3219 3220 3221 3222 3223 3224 3225 3226 3227 3228
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[0].minor.yy0, -1);

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3229
      case 289: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;

    toTSDBType(yymsp[-1].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1);

    toTSDBType(yymsp[0].minor.yy0.type);
    A = tListItemAppendToken(A, &yymsp[0].minor.yy0, -1);

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3243
      case 290: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
3244 3245 3246 3247 3248
{
    yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;

    toTSDBType(yymsp[-2].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
H
Haojun Liao 已提交
3249
    A = tListItemAppend(A, &yymsp[0].minor.yy425, -1);
3250 3251 3252 3253 3254

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3255
      case 291: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
3256 3257
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3258
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
3259 3260 3261
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3262
      case 292: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
3263 3264
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3265
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
3266 3267 3268
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3269
      case 293: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
3270 3271 3272 3273 3274 3275 3276 3277 3278 3279
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
    SArray* K = tListItemAppendToken(NULL, &yymsp[0].minor.yy0, -1);

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3280
      case 294: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
3281 3282
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3283
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
3284 3285 3286
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3287
      case 295: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
3288 3289
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3290
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
3291 3292 3293
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3294
      case 296: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
3295 3296 3297 3298 3299 3300 3301 3302 3303 3304
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;

    toTSDBType(yymsp[0].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[0].minor.yy0, -1);

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3305
      case 297: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318
{
    yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;

    toTSDBType(yymsp[-1].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1);

    toTSDBType(yymsp[0].minor.yy0.type);
    A = tListItemAppendToken(A, &yymsp[0].minor.yy0, -1);

    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE);
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3319
      case 298: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
3320 3321 3322 3323 3324
{
    yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;

    toTSDBType(yymsp[-2].minor.yy0.type);
    SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
H
Haojun Liao 已提交
3325
    A = tListItemAppend(A, &yymsp[0].minor.yy425, -1);
3326 3327 3328 3329 3330

    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;
H
Haojun Liao 已提交
3331
      case 299: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
3332 3333
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
H
Haojun Liao 已提交
3334
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
3335 3336 3337
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
H
Haojun Liao 已提交
3338
      case 300: /* cmd ::= KILL CONNECTION INTEGER */
3339 3340
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
        break;
H
Haojun Liao 已提交
3341
      case 301: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
3342 3343
{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;
H
Haojun Liao 已提交
3344
      case 302: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638
{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( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);

  /* There are no SHIFTREDUCE actions on nonterminals because the table
  ** generator has simplified them to pure REDUCE actions. */
  assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );

  /* It is not possible for a REDUCE to be followed by an error */
  assert( yyact!=YY_ERROR_ACTION );

  yymsp += yysize+1;
  yypParser->yytos = yymsp;
  yymsp->stateno = (YYACTIONTYPE)yyact;
  yymsp->major = (YYCODETYPE)yygoto;
  yyTraceShift(yypParser, yyact, "... then shift");
}

/*
** The following code executes when the parse fails
*/
#ifndef YYNOERRORRECOVERY
static void yy_parse_failed(
  yyParser *yypParser           /* The parser */
){
  ParseARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser fails */
/************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/
  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
}
#endif /* YYNOERRORRECOVERY */

/*
** The following code executes when a syntax error first occurs.
*/
static void yy_syntax_error(
  yyParser *yypParser,           /* The parser */
  int yymajor,                   /* The major type of the error token */
  ParseTOKENTYPE yyminor         /* The minor type of the error token */
){
  ParseARG_FETCH;
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/

  pInfo->valid = false;
  int32_t outputBufLen = tListLen(pInfo->msg);
  int32_t len = 0;

  if(TOKEN.z) {
    char msg[] = "syntax error near \"%s\"";
    int32_t sqlLen = strlen(&TOKEN.z[0]);

    if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > outputBufLen) {
        char tmpstr[128] = {0};
        memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1);
        len = sprintf(pInfo->msg, msg, tmpstr);
    } else {
        len = sprintf(pInfo->msg, msg, &TOKEN.z[0]);
    }

  } else {
    len = sprintf(pInfo->msg, "Incomplete SQL statement");
  }

  assert(len <= outputBufLen);
/************ End %syntax_error code ******************************************/
  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
  ParseARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
#ifndef YYNOERRORRECOVERY
  yypParser->yyerrcnt = -1;
#endif
  assert( yypParser->yytos==yypParser->yystack );
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
/*********** Begin %parse_accept code *****************************************/

/*********** End %parse_accept code *******************************************/
  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "ParseAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void Parse(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  ParseTOKENTYPE yyminor       /* The value for the token */
  ParseARG_PDECL               /* Optional %extra_argument parameter */
){
  YYMINORTYPE yyminorunion;
  unsigned int 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 */

  yypParser = (yyParser*)yyp;
  assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
  yyendofinput = (yymajor==0);
#endif
  ParseARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
    int stateno = yypParser->yytos->stateno;
    if( stateno < YY_MIN_REDUCE ){
      fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
              yyTracePrompt,yyTokenName[yymajor],stateno);
    }else{
      fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
              yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
    }
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
    if( yyact >= YY_MIN_REDUCE ){
      yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
    }else if( yyact <= YY_MAX_SHIFTREDUCE ){
      yy_shift(yypParser,yyact,yymajor,yyminor);
#ifndef YYNOERRORRECOVERY
      yypParser->yyerrcnt--;
#endif
      yymajor = YYNOCODE;
    }else if( yyact==YY_ACCEPT_ACTION ){
      yypParser->yytos--;
      yy_accept(yypParser);
      return;
    }else{
      assert( yyact == YY_ERROR_ACTION );
      yyminorunion.yy0 = yyminor;
#ifdef YYERRORSYMBOL
      int yymx;
#endif
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".  
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
        yy_syntax_error(yypParser,yymajor,yyminor);
      }
      yymx = yypParser->yytos->major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
        yymajor = YYNOCODE;
      }else{
        while( yypParser->yytos >= yypParser->yystack
            && yymx != YYERRORSYMBOL
            && (yyact = yy_find_reduce_action(
                        yypParser->yytos->stateno,
                        YYERRORSYMBOL)) >= YY_MIN_REDUCE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
          yypParser->yyerrcnt = -1;
#endif
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#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
      ** error routine and continue going as if nothing had happened.
      **
      ** Applications can set this macro (for example inside %include) if
      ** they intend to abandon the parse upon the first syntax error seen.
      */
      yy_syntax_error(yypParser,yymajor, yyminor);
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      yymajor = YYNOCODE;
      
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
        yy_syntax_error(yypParser,yymajor, yyminor);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
#ifndef YYNOERRORRECOVERY
        yypParser->yyerrcnt = -1;
#endif
      }
      yymajor = YYNOCODE;
#endif
    }
  }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
  if( yyTraceFILE ){
    yyStackEntry *i;
    char cDiv = '[';
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
      fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
      cDiv = ' ';
    }
    fprintf(yyTraceFILE,"]\n");
  }
#endif
  return;
}