sql.c 151.2 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
100
#define YYNOCODE 273
101 102 103 104 105
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
  int yyinit;
  ParseTOKENTYPE yy0;
106 107 108 109 110
  SSqlNode* yy24;
  int yy60;
  SSubclause* yy129;
  SIntervalVal yy136;
  int64_t yy157;
111
  SCreateAcctInfo yy171;
112 113 114 115 116 117 118
  SSessionWindowVal yy251;
  SCreateDbInfo yy254;
  SWindowStateVal yy256;
  SField yy280;
  SRelationInfo* yy292;
  tSqlExpr* yy370;
  SArray* yy413;
119
  SCreateTableSql* yy438;
120 121 122 123
  SVariant yy461;
  SLimit yy503;
  int32_t yy516;
  SCreatedTableInfo yy544;
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
133 134
#define YYNSTATE             365
#define YYNRULE              301
135
#define YYNTOKEN             191
136 137 138 139 140 141 142 143
#define YY_MAX_SHIFT         364
#define YY_MIN_SHIFTREDUCE   584
#define YY_MAX_SHIFTREDUCE   884
#define YY_ERROR_ACTION      885
#define YY_ACCEPT_ACTION     886
#define YY_NO_ACTION         887
#define YY_MIN_REDUCE        888
#define YY_MAX_REDUCE        1188
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 **********************************************/
209
#define YY_ACTTAB_COUNT (779)
210
static const YYACTIONTYPE yy_action[] = {
211 212 213 214 215 216 217 218 219 220 221 222 223 224
 /*     0 */  1073,  635,  155,  363,  230,  636,  671,   55,   56,  635,
 /*    10 */    59,   60, 1032,  636,  252,   49,   48,   47,  162,   58,
 /*    20 */   322,   63,   61,   64,   62,  236, 1050,  242,  206,   54,
 /*    30 */    53, 1038,  635,   52,   51,   50,  636,   55,   56, 1164,
 /*    40 */    59,   60,  936, 1063,  252,   49,   48,   47,  188,   58,
 /*    50 */   322,   63,   61,   64,   62, 1010,  243, 1008, 1009,   54,
 /*    60 */    53,  233, 1011,   52,   51,   50, 1012, 1070, 1013, 1014,
 /*    70 */   280,  279,  947,   55,   56,  246,   59,   60,  188, 1038,
 /*    80 */   252,   49,   48,   47,   81,   58,  322,   63,   61,   64,
 /*    90 */    62,  320, 1112,   99,  292,   54,   53,  352,  635,   52,
 /*   100 */    51,   50,  636,   55,   57,  261,   59,   60,  318,  821,
 /*   110 */   252,   49,   48,   47,  176,   58,  322,   63,   61,   64,
 /*   120 */    62,   42,  249,  358,  357,   54,   53, 1026,  356,   52,
 /*   130 */    51,   50,  355,   87,  354,  353,  886,  364,  585,  586,
225
 /*   140 */   587,  588,  589,  590,  591,  592,  593,  594,  595,  596,
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
 /*   150 */   597,  598,  153,   56,  231,   59,   60,  767, 1063,  252,
 /*   160 */    49,   48,   47,  171,   58,  322,   63,   61,   64,   62,
 /*   170 */   162,   43, 1024,   86,   54,   53,  234,   21,   52,   51,
 /*   180 */    50,  282,  206, 1063,  635,   59,   60,  203,  636,  252,
 /*   190 */    49,   48,   47, 1165,   58,  322,   63,   61,   64,   62,
 /*   200 */   162,  274,  827,  830,   54,   53,  786,  787,   52,   51,
 /*   210 */    50,   36,   42,  316,  358,  357,  315,  314,  313,  356,
 /*   220 */   312,  311,  310,  355,  309,  354,  353, 1004,  992,  993,
 /*   230 */   994,  995,  996,  997,  998,  999, 1000, 1001, 1002, 1003,
 /*   240 */  1005, 1006,  294,  771,   92,   22,   63,   61,   64,   62,
 /*   250 */   826,  829,  318,  232,   54,   53,  204, 1035,   52,   51,
 /*   260 */    50,   27,  215,   36,  251,  836,  825,  828,  831,  216,
 /*   270 */   750,  747,  748,  749, 1111,  137,  136,  135,  217,  162,
 /*   280 */   266,  255,  327,   87,  251,  836,  825,  828,  831,  270,
 /*   290 */   269,   96,  228,  229,  261,  261,  323,  257,  258,  742,
 /*   300 */   739,  740,  741,  177, 1036,  240,    3,   39,  178, 1035,
 /*   310 */   260,  209,  228,  229,  105,   77,  101,  108,  250,  248,
 /*   320 */   834,   43, 1021, 1022,   33, 1025,  244,  245,  197,  195,
 /*   330 */   193,   52,   51,   50,  305,  192,  141,  140,  139,  138,
 /*   340 */     4,   65,  253,  273,   80,   79,  122,  116,  126,  152,
 /*   350 */   150,  149,  224,   93,   36,  131,  134,  125,  256,   36,
 /*   360 */   254,   65,  330,  329,  128,   54,   53,  714,  835,   52,
 /*   370 */    51,   50,   87,   36,   36,   36, 1023,  837,  832,  206,
 /*   380 */    36,   36,  751,  752,  833,   36,   36,  262,   36,  259,
 /*   390 */  1165,  337,  336,  342,  341,  803,  241,  837,  832,  764,
 /*   400 */  1035,  331,  206,   12,  833, 1035,   84,   85,  937,   95,
 /*   410 */    43,  743,  744, 1165,  188,  332,  333,  334,  324, 1035,
 /*   420 */  1035, 1035,  338,  339,    7,  124, 1035, 1035,  340,   94,
 /*   430 */   344, 1034, 1035,  275, 1035,  362,  361,  146,   98,  352,
 /*   440 */   359,  974,  783,   82,   70,   70,  793,  794,   71,   37,
 /*   450 */   724,   74,  297,  802,  726,  299,  737,  738,  157,  735,
 /*   460 */   736,  725,   66,   24,   32,  823,   37,  859,   37,  838,
 /*   470 */    67,   97,  634,   14,  115,   13,  114,   67,   78,   16,
 /*   480 */    18,   15,   17,   23,  121,   23,  120,  210,   23,   72,
 /*   490 */    75,  211,  755,  756,  753,  754, 1159,  824,  300,   20,
 /*   500 */  1158,   19,  133,  132, 1157,  226, 1037, 1049, 1065,  227,
 /*   510 */   207,  713,  208,  212,  205,  213,  214,  219,  220,  221,
 /*   520 */   218,  202, 1184,  840, 1176,   44, 1122, 1121,  321,  271,
 /*   530 */   238, 1118, 1117,  239,  343,  154, 1104, 1072, 1083, 1080,
 /*   540 */  1081, 1085,  156,  161, 1064,  277,  288, 1103, 1033,  173,
 /*   550 */   151,  281,  172, 1031,  174,  175,  951,  782,  306,  302,
 /*   560 */   303,  170,  164,  304,  307,  163,  308, 1061,  295,  291,
 /*   570 */   165,  200,   40,  319,  946,  945,  235,  328, 1183,  112,
 /*   580 */   283, 1182,  285, 1179,   76,  179,  335,   73, 1175,  118,
 /*   590 */  1174, 1171,  180,  971,   46,   41,   38,  201,  934,  127,
 /*   600 */   932,  129,  130,  293,  930,  929,  263,  190,  191,  926,
 /*   610 */   925,  924,  923,  922,  921,  920,  194,  196,  917,  915,
 /*   620 */   913,  911,  289,  198,  908,  199,  904,  287,  284,  276,
 /*   630 */    83,   88,   45,  286, 1105,  123,  345,  346,  347,  348,
 /*   640 */   349,  225,  350,  247,  301,  351,  360,  884,  264,  265,
 /*   650 */   883,  222,  267,  950,  949,  106,  223,  268,  882,  865,
 /*   660 */   864,  272,   70,    8,  928,  296,  927,  758,  183,  182,
 /*   670 */   972,  181,  142,  184,  185,  187,  186,  143,  919,  918,
 /*   680 */   973,  144,  145,  910,  909,   28,  278,   89,   31,  784,
 /*   690 */     2,  166,  167,  158,  168,  169,  795,  159,    1,  789,
281
 /*   700 */   160,   90,  237,  791,   91,  290,   29,    9,   30,   10,
282
 /*   710 */    11,   25,  298,   26,   98,  100,   34,  103,  102,  649,
283
 /*   720 */   684,   35,  104,  682,  681,  680,  678,  677,  676,  673,
284 285
 /*   730 */   639,  107,  109,  325,  110,  839,  317,    5,    6,  841,
 /*   740 */   326,   68,  111,  113,   69,  716,  117,  119,   37,  715,
286
 /*   750 */   712,  665,  663,  655,  661,  657,  659,  653,  651,  686,
287 288
 /*   760 */   685,  683,  679,  675,  674,  189,  602,  637,  888,  887,
 /*   770 */   887,  887,  887,  887,  887,  887,  887,  147,  148,
289 290
};
static const YYCODETYPE yy_lookahead[] = {
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 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
 /*     0 */   194,    1,  194,  194,  195,    5,    3,    7,    8,    1,
 /*    10 */    10,   11,  194,    5,   14,   15,   16,   17,  194,   19,
 /*    20 */    20,   21,   22,   23,   24,  242,  243,  237,  260,   29,
 /*    30 */    30,  241,    1,   33,   34,   35,    5,    7,    8,  271,
 /*    40 */    10,   11,  199,  239,   14,   15,   16,   17,  205,   19,
 /*    50 */    20,   21,   22,   23,   24,  216,  238,  218,  219,   29,
 /*    60 */    30,  257,  223,   33,   34,   35,  227,  261,  229,  230,
 /*    70 */   262,  263,  199,    7,    8,  237,   10,   11,  205,  241,
 /*    80 */    14,   15,   16,   17,   84,   19,   20,   21,   22,   23,
 /*    90 */    24,   83,  268,  201,  270,   29,   30,   88,    1,   33,
 /*   100 */    34,   35,    5,    7,    8,  194,   10,   11,   80,   79,
 /*   110 */    14,   15,   16,   17,  203,   19,   20,   21,   22,   23,
 /*   120 */    24,   96,  200,   98,   99,   29,   30,  235,  103,   33,
 /*   130 */    34,   35,  107,   78,  109,  110,  192,  193,   41,   42,
 /*   140 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   150 */    53,   54,   55,    8,   57,   10,   11,   33,  239,   14,
 /*   160 */    15,   16,   17,  247,   19,   20,   21,   22,   23,   24,
 /*   170 */   194,  116,    0,  118,   29,   30,  257,  260,   33,   34,
 /*   180 */    35,  265,  260,  239,    1,   10,   11,  260,    5,   14,
 /*   190 */    15,   16,   17,  271,   19,   20,   21,   22,   23,   24,
 /*   200 */   194,  257,    3,    4,   29,   30,  122,  123,   33,   34,
 /*   210 */    35,  194,   96,   97,   98,   99,  100,  101,  102,  103,
 /*   220 */   104,  105,  106,  107,  108,  109,  110,  216,  217,  218,
 /*   230 */   219,  220,  221,  222,  223,  224,  225,  226,  227,  228,
 /*   240 */   229,  230,  266,  119,  268,   40,   21,   22,   23,   24,
 /*   250 */     3,    4,   80,  236,   29,   30,  260,  240,   33,   34,
 /*   260 */    35,   78,   57,  194,    1,    2,    3,    4,    5,   64,
 /*   270 */     2,    3,    4,    5,  268,   70,   71,   72,   73,  194,
 /*   280 */   139,   64,   77,   78,    1,    2,    3,    4,    5,  148,
 /*   290 */   149,  201,   29,   30,  194,  194,   33,   29,   30,    2,
 /*   300 */     3,    4,    5,  203,  203,  236,   58,   59,   60,  240,
 /*   310 */    64,  260,   29,   30,   66,   67,   68,   69,   56,  200,
 /*   320 */   121,  116,  232,  233,  234,  235,   29,   30,   58,   59,
 /*   330 */    60,   33,   34,   35,   86,   65,   66,   67,   68,   69,
 /*   340 */    78,   78,  200,  138,  201,  140,   58,   59,   60,   58,
 /*   350 */    59,   60,  147,  268,  194,   67,   68,   69,  141,  194,
 /*   360 */   143,   78,  145,  146,   76,   29,   30,    3,  121,   33,
 /*   370 */    34,   35,   78,  194,  194,  194,  233,  114,  115,  260,
 /*   380 */   194,  194,  114,  115,  121,  194,  194,  141,  194,  143,
 /*   390 */   271,  145,  146,   29,   30,   72,  236,  114,  115,   95,
 /*   400 */   240,  236,  260,   78,  121,  240,   79,   79,  199,   84,
 /*   410 */   116,  114,  115,  271,  205,  236,  236,  236,    9,  240,
 /*   420 */   240,  240,  236,  236,  120,   74,  240,  240,  236,  244,
 /*   430 */   236,  240,  240,   79,  240,   61,   62,   63,  113,   88,
 /*   440 */   214,  215,   79,  258,  117,  117,   79,   79,   95,   95,
 /*   450 */    79,   95,   79,  130,   79,   79,    3,    4,   95,    3,
 /*   460 */     4,   79,   95,   95,   78,    1,   95,   79,   95,   79,
 /*   470 */    95,   95,   79,  142,  142,  144,  144,   95,   78,  142,
 /*   480 */   142,  144,  144,   95,  142,   95,  144,  260,   95,  136,
 /*   490 */   134,  260,    3,    4,    3,    4,  260,   33,  112,  142,
 /*   500 */   260,  144,   74,   75,  260,  260,  241,  243,  239,  260,
 /*   510 */   260,  111,  260,  260,  260,  260,  260,  260,  260,  260,
 /*   520 */   260,  260,  243,  114,  243,  259,  231,  231,  194,  194,
 /*   530 */   231,  231,  231,  231,  231,  194,  269,  194,  194,  194,
 /*   540 */   194,  194,  194,  194,  239,  239,  194,  269,  239,  194,
 /*   550 */    56,  264,  245,  194,  194,  194,  194,  121,   87,  194,
 /*   560 */   194,  248,  254,  194,  194,  255,  194,  256,  128,  126,
 /*   570 */   253,  194,  194,  194,  194,  194,  264,  194,  194,  194,
 /*   580 */   264,  194,  264,  194,  133,  194,  194,  135,  194,  194,
 /*   590 */   194,  194,  194,  194,  132,  194,  194,  194,  194,  194,
 /*   600 */   194,  194,  194,  131,  194,  194,  194,  194,  194,  194,
 /*   610 */   194,  194,  194,  194,  194,  194,  194,  194,  194,  194,
 /*   620 */   194,  194,  125,  194,  194,  194,  194,  124,  127,  196,
 /*   630 */   196,  196,  137,  196,  196,   94,   93,   47,   90,   92,
 /*   640 */    51,  196,   91,  196,  196,   89,   80,    3,  150,    3,
 /*   650 */     3,  196,  150,  204,  204,  201,  196,    3,    3,   98,
 /*   660 */    97,  139,  117,   78,  196,  112,  196,   79,  207,  211,
 /*   670 */   213,  212,  197,  210,  208,  206,  209,  197,  196,  196,
 /*   680 */   215,  197,  197,  196,  196,   78,   95,   95,  246,   79,
 /*   690 */   198,  252,  251,   78,  250,  249,   79,   78,  202,   79,
 /*   700 */    95,   78,    1,   79,   78,   78,   95,  129,   95,  129,
 /*   710 */    78,   78,  112,   78,  113,   74,   85,   66,   84,    3,
 /*   720 */     5,   85,   84,    3,    3,    3,    3,    3,    3,    3,
 /*   730 */    81,   74,   82,   20,   82,   79,    9,   78,   78,  114,
 /*   740 */    55,   10,  144,  144,   10,    3,  144,  144,   95,    3,
 /*   750 */    79,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 /*   760 */     3,    3,    3,    3,    3,   95,   56,   81,    0,  272,
 /*   770 */   272,  272,  272,  272,  272,  272,  272,   15,   15,  272,
 /*   780 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   790 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   800 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   810 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   820 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   830 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   840 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   850 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   860 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   870 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   880 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   890 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   900 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   910 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   920 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   930 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   940 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   950 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 /*   960 */   272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
388
};
389
#define YY_SHIFT_COUNT    (364)
390
#define YY_SHIFT_MIN      (0)
391
#define YY_SHIFT_MAX      (768)
392
static const unsigned short int yy_shift_ofst[] = {
393 394 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
 /*     0 */   205,  116,   25,   28,  263,  283,  283,  183,   31,   31,
 /*    10 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*    20 */    31,    0,   97,  283,  268,  297,  297,  294,  294,   31,
 /*    30 */    31,   84,   31,  172,   31,   31,   31,   31,  351,   28,
 /*    40 */     9,    9,    3,  779,  283,  283,  283,  283,  283,  283,
 /*    50 */   283,  283,  283,  283,  283,  283,  283,  283,  283,  283,
 /*    60 */   283,  283,  283,  283,  283,  283,  268,  297,  268,  268,
 /*    70 */    55,  364,  364,  364,  364,  364,  364,    8,  364,   31,
 /*    80 */    31,   31,  124,   31,   31,   31,  294,  294,   31,   31,
 /*    90 */    31,   31,  323,  323,  304,  294,   31,   31,   31,   31,
 /*   100 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*   110 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*   120 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*   130 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*   140 */    31,   31,   31,   31,   31,   31,   31,   31,   31,   31,
 /*   150 */    31,   31,   31,   31,  494,  494,  494,  436,  436,  436,
 /*   160 */   436,  494,  494,  451,  452,  440,  462,  472,  443,  497,
 /*   170 */   503,  501,  495,  494,  494,  494,  471,  471,   28,  494,
 /*   180 */   494,  541,  543,  590,  548,  547,  589,  551,  556,    3,
 /*   190 */   494,  494,  566,  566,  494,  566,  494,  566,  494,  494,
 /*   200 */   779,  779,   30,   66,   66,   96,   66,  145,  175,  225,
 /*   210 */   225,  225,  225,  225,  225,  248,  270,  288,  336,  336,
 /*   220 */   336,  336,  217,  246,  141,  325,  298,  298,  199,  247,
 /*   230 */   374,  291,  354,  327,  328,  363,  367,  368,  353,  356,
 /*   240 */   371,  373,  375,  376,  453,  456,  382,  386,  388,  390,
 /*   250 */   464,  262,  409,  393,  331,  332,  337,  489,  491,  338,
 /*   260 */   342,  400,  357,  428,  644,  498,  646,  647,  502,  654,
 /*   270 */   655,  561,  563,  522,  545,  553,  585,  588,  607,  591,
 /*   280 */   592,  610,  615,  617,  619,  620,  605,  623,  624,  626,
 /*   290 */   701,  627,  611,  578,  613,  580,  632,  553,  633,  600,
 /*   300 */   635,  601,  641,  631,  634,  651,  716,  636,  638,  715,
 /*   310 */   720,  721,  722,  723,  724,  725,  726,  649,  727,  657,
 /*   320 */   650,  652,  659,  656,  625,  660,  713,  685,  731,  598,
 /*   330 */   599,  653,  653,  653,  653,  734,  602,  603,  653,  653,
 /*   340 */   653,  742,  746,  671,  653,  748,  749,  750,  751,  752,
 /*   350 */   753,  754,  755,  756,  757,  758,  759,  760,  761,  670,
 /*   360 */   686,  762,  763,  710,  768,
430
};
431
#define YY_REDUCE_COUNT (201)
432 433
#define YY_REDUCE_MIN   (-232)
#define YY_REDUCE_MAX   (496)
434
static const short yy_reduce_ofst[] = {
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
 /*     0 */   -56,   11, -161,   90,  -78,  119,  142, -192,   17, -176,
 /*    10 */   -24,   69,  160,  165,  179,  180,  181,  186,  187,  192,
 /*    20 */   194, -194, -191, -232, -217, -210, -162, -196,  -81,    6,
 /*    30 */    85,  -84, -182, -108,  -89,  100,  101,  191, -157,  143,
 /*    40 */  -127,  209,  226,  185,  -83,  -73,   -4,   51,  227,  231,
 /*    50 */   236,  240,  244,  245,  249,  250,  252,  253,  254,  255,
 /*    60 */   256,  257,  258,  259,  260,  261,  264,  265,  279,  281,
 /*    70 */   269,  295,  296,  299,  300,  301,  302,  334,  303,  335,
 /*    80 */   341,  343,  266,  344,  345,  346,  305,  306,  347,  348,
 /*    90 */   349,  352,  267,  278,  307,  309,  355,  359,  360,  361,
 /*   100 */   362,  365,  366,  369,  370,  372,  377,  378,  379,  380,
 /*   110 */   381,  383,  384,  385,  387,  389,  391,  392,  394,  395,
 /*   120 */   396,  397,  398,  399,  401,  402,  403,  404,  405,  406,
 /*   130 */   407,  408,  410,  411,  412,  413,  414,  415,  416,  417,
 /*   140 */   418,  419,  420,  421,  422,  423,  424,  425,  426,  427,
 /*   150 */   429,  430,  431,  432,  433,  434,  435,  287,  312,  316,
 /*   160 */   318,  437,  438,  311,  310,  308,  317,  439,  441,  444,
 /*   170 */   446,  313,  442,  445,  447,  448,  449,  450,  454,  455,
 /*   180 */   460,  457,  459,  458,  461,  463,  466,  467,  469,  465,
 /*   190 */   468,  470,  475,  480,  482,  484,  483,  485,  487,  488,
 /*   200 */   496,  492,
456 457
};
static const YYACTIONTYPE yy_default[] = {
458 459 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
 /*     0 */   885,  948,  935,  944, 1167, 1167, 1167,  885,  885,  885,
 /*    10 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*    20 */   885, 1074,  905, 1167,  885,  885,  885,  885,  885,  885,
 /*    30 */   885, 1089,  885,  944,  885,  885,  885,  885,  954,  944,
 /*    40 */   954,  954,  885, 1069,  885,  885,  885,  885,  885,  885,
 /*    50 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*    60 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*    70 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*    80 */   885,  885, 1076, 1082, 1079,  885,  885,  885, 1084,  885,
 /*    90 */   885,  885, 1108, 1108, 1067,  885,  885,  885,  885,  885,
 /*   100 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   110 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   120 */   885,  885,  885,  885,  885,  885,  885,  933,  885,  931,
 /*   130 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   140 */   885,  885,  885,  885,  885,  885,  916,  885,  885,  885,
 /*   150 */   885,  885,  885,  903,  907,  907,  907,  885,  885,  885,
 /*   160 */   885,  907,  907, 1115, 1119, 1101, 1113, 1109, 1096, 1094,
 /*   170 */  1092, 1100, 1123,  907,  907,  907,  952,  952,  944,  907,
 /*   180 */   907,  970,  968,  966,  958,  964,  960,  962,  956,  885,
 /*   190 */   907,  907,  942,  942,  907,  942,  907,  942,  907,  907,
 /*   200 */   991, 1007,  885, 1124, 1114,  885, 1166, 1154, 1153, 1162,
 /*   210 */  1161, 1160, 1152, 1151, 1150,  885,  885,  885, 1146, 1149,
 /*   220 */  1148, 1147,  885,  885,  885,  885, 1156, 1155,  885,  885,
 /*   230 */   885,  885,  885,  885,  885,  885,  885,  885, 1120, 1116,
 /*   240 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   250 */   885, 1126,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   260 */   885, 1015,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   270 */   885,  885,  885,  885, 1066,  885,  885,  885,  885, 1078,
 /*   280 */  1077,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   290 */   885,  885, 1110,  885, 1102,  885,  885, 1027,  885,  885,
 /*   300 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   310 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   320 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
 /*   330 */   885, 1185, 1180, 1181, 1178,  885,  885,  885, 1177, 1172,
 /*   340 */  1173,  885,  885,  885, 1170,  885,  885,  885,  885,  885,
 /*   350 */   885,  885,  885,  885,  885,  885,  885,  885,  885,  976,
 /*   360 */   885,  914,  912,  885,  885,
495 496 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
};
/********** 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 */
596
    0,  /*       PORT => nothing */
597
    1,  /*    IPTOKEN => ID */
598 599 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
    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",
794 795 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 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
  /*    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",
  /*  231 */ "signed",
  /*  232 */ "create_table_args",
  /*  233 */ "create_stable_args",
  /*  234 */ "create_table_list",
  /*  235 */ "create_from_stable",
  /*  236 */ "columnlist",
  /*  237 */ "tagitemlist1",
  /*  238 */ "tagNamelist",
  /*  239 */ "select",
  /*  240 */ "column",
  /*  241 */ "tagitem1",
  /*  242 */ "tagitemlist",
  /*  243 */ "tagitem",
  /*  244 */ "selcollist",
  /*  245 */ "from",
  /*  246 */ "where_opt",
  /*  247 */ "interval_option",
  /*  248 */ "sliding_opt",
  /*  249 */ "session_option",
  /*  250 */ "windowstate_option",
  /*  251 */ "fill_opt",
  /*  252 */ "groupby_opt",
  /*  253 */ "having_opt",
  /*  254 */ "orderby_opt",
  /*  255 */ "slimit_opt",
  /*  256 */ "limit_opt",
  /*  257 */ "union",
  /*  258 */ "sclp",
  /*  259 */ "distinct",
  /*  260 */ "expr",
  /*  261 */ "as",
  /*  262 */ "tablelist",
  /*  263 */ "sub",
  /*  264 */ "tmvar",
  /*  265 */ "intervalKey",
  /*  266 */ "sortlist",
  /*  267 */ "sortitem",
  /*  268 */ "item",
  /*  269 */ "sortorder",
  /*  270 */ "grouplist",
  /*  271 */ "expritem",
1063 1064 1065 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
};
#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",
1118 1119 1120 1121 1122 1123 1124 1125 1126
 /*  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 ::=",
1127
 /*  57 */ "cmd ::= CREATE DNODE ids PORT ids",
1128 1129 1130 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 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
 /*  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",
 /* 103 */ "db_optr ::=",
 /* 104 */ "db_optr ::= db_optr cache",
 /* 105 */ "db_optr ::= db_optr replica",
 /* 106 */ "db_optr ::= db_optr quorum",
 /* 107 */ "db_optr ::= db_optr days",
 /* 108 */ "db_optr ::= db_optr minrows",
 /* 109 */ "db_optr ::= db_optr maxrows",
 /* 110 */ "db_optr ::= db_optr blocks",
 /* 111 */ "db_optr ::= db_optr ctime",
 /* 112 */ "db_optr ::= db_optr wal",
 /* 113 */ "db_optr ::= db_optr fsync",
 /* 114 */ "db_optr ::= db_optr comp",
 /* 115 */ "db_optr ::= db_optr prec",
 /* 116 */ "db_optr ::= db_optr keep",
 /* 117 */ "db_optr ::= db_optr update",
 /* 118 */ "db_optr ::= db_optr cachelast",
 /* 119 */ "alter_db_optr ::=",
 /* 120 */ "alter_db_optr ::= alter_db_optr replica",
 /* 121 */ "alter_db_optr ::= alter_db_optr quorum",
 /* 122 */ "alter_db_optr ::= alter_db_optr keep",
 /* 123 */ "alter_db_optr ::= alter_db_optr blocks",
 /* 124 */ "alter_db_optr ::= alter_db_optr comp",
 /* 125 */ "alter_db_optr ::= alter_db_optr update",
 /* 126 */ "alter_db_optr ::= alter_db_optr cachelast",
 /* 127 */ "typename ::= ids",
 /* 128 */ "typename ::= ids LP signed RP",
 /* 129 */ "typename ::= ids UNSIGNED",
 /* 130 */ "signed ::= INTEGER",
 /* 131 */ "signed ::= PLUS INTEGER",
 /* 132 */ "signed ::= MINUS INTEGER",
 /* 133 */ "cmd ::= CREATE TABLE create_table_args",
 /* 134 */ "cmd ::= CREATE TABLE create_stable_args",
 /* 135 */ "cmd ::= CREATE STABLE create_stable_args",
 /* 136 */ "cmd ::= CREATE TABLE create_table_list",
 /* 137 */ "create_table_list ::= create_from_stable",
 /* 138 */ "create_table_list ::= create_table_list create_from_stable",
 /* 139 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
 /* 140 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
 /* 141 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP",
 /* 142 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP",
 /* 143 */ "tagNamelist ::= tagNamelist COMMA ids",
 /* 144 */ "tagNamelist ::= ids",
 /* 145 */ "create_table_args ::= ifnotexists ids cpxName AS select",
 /* 146 */ "columnlist ::= columnlist COMMA column",
 /* 147 */ "columnlist ::= column",
 /* 148 */ "column ::= ids typename",
 /* 149 */ "tagitemlist1 ::= tagitemlist1 COMMA tagitem1",
 /* 150 */ "tagitemlist1 ::= tagitem1",
 /* 151 */ "tagitem1 ::= MINUS INTEGER",
 /* 152 */ "tagitem1 ::= MINUS FLOAT",
 /* 153 */ "tagitem1 ::= PLUS INTEGER",
 /* 154 */ "tagitem1 ::= PLUS FLOAT",
 /* 155 */ "tagitem1 ::= INTEGER",
 /* 156 */ "tagitem1 ::= FLOAT",
 /* 157 */ "tagitem1 ::= STRING",
 /* 158 */ "tagitem1 ::= BOOL",
 /* 159 */ "tagitem1 ::= NULL",
 /* 160 */ "tagitem1 ::= NOW",
 /* 161 */ "tagitemlist ::= tagitemlist COMMA tagitem",
 /* 162 */ "tagitemlist ::= tagitem",
 /* 163 */ "tagitem ::= INTEGER",
 /* 164 */ "tagitem ::= FLOAT",
 /* 165 */ "tagitem ::= STRING",
 /* 166 */ "tagitem ::= BOOL",
 /* 167 */ "tagitem ::= NULL",
 /* 168 */ "tagitem ::= NOW",
 /* 169 */ "tagitem ::= MINUS INTEGER",
 /* 170 */ "tagitem ::= MINUS FLOAT",
 /* 171 */ "tagitem ::= PLUS INTEGER",
 /* 172 */ "tagitem ::= PLUS FLOAT",
 /* 173 */ "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",
 /* 174 */ "select ::= LP select RP",
 /* 175 */ "union ::= select",
 /* 176 */ "union ::= union UNION ALL select",
 /* 177 */ "union ::= union UNION select",
 /* 178 */ "cmd ::= union",
 /* 179 */ "select ::= SELECT selcollist",
 /* 180 */ "sclp ::= selcollist COMMA",
 /* 181 */ "sclp ::=",
 /* 182 */ "selcollist ::= sclp distinct expr as",
 /* 183 */ "selcollist ::= sclp STAR",
 /* 184 */ "as ::= AS ids",
 /* 185 */ "as ::= ids",
 /* 186 */ "as ::=",
 /* 187 */ "distinct ::= DISTINCT",
 /* 188 */ "distinct ::=",
 /* 189 */ "from ::= FROM tablelist",
 /* 190 */ "from ::= FROM sub",
 /* 191 */ "sub ::= LP union RP",
 /* 192 */ "sub ::= LP union RP ids",
 /* 193 */ "sub ::= sub COMMA LP union RP ids",
 /* 194 */ "tablelist ::= ids cpxName",
 /* 195 */ "tablelist ::= ids cpxName ids",
 /* 196 */ "tablelist ::= tablelist COMMA ids cpxName",
 /* 197 */ "tablelist ::= tablelist COMMA ids cpxName ids",
 /* 198 */ "tmvar ::= VARIABLE",
 /* 199 */ "interval_option ::= intervalKey LP tmvar RP",
 /* 200 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP",
 /* 201 */ "interval_option ::=",
 /* 202 */ "intervalKey ::= INTERVAL",
 /* 203 */ "intervalKey ::= EVERY",
 /* 204 */ "session_option ::=",
 /* 205 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
 /* 206 */ "windowstate_option ::=",
 /* 207 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
 /* 208 */ "fill_opt ::=",
 /* 209 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
 /* 210 */ "fill_opt ::= FILL LP ID RP",
 /* 211 */ "sliding_opt ::= SLIDING LP tmvar RP",
 /* 212 */ "sliding_opt ::=",
 /* 213 */ "orderby_opt ::=",
 /* 214 */ "orderby_opt ::= ORDER BY sortlist",
 /* 215 */ "sortlist ::= sortlist COMMA item sortorder",
 /* 216 */ "sortlist ::= item sortorder",
 /* 217 */ "item ::= ids cpxName",
 /* 218 */ "sortorder ::= ASC",
 /* 219 */ "sortorder ::= DESC",
 /* 220 */ "sortorder ::=",
 /* 221 */ "groupby_opt ::=",
 /* 222 */ "groupby_opt ::= GROUP BY grouplist",
 /* 223 */ "grouplist ::= grouplist COMMA item",
 /* 224 */ "grouplist ::= item",
 /* 225 */ "having_opt ::=",
 /* 226 */ "having_opt ::= HAVING expr",
 /* 227 */ "limit_opt ::=",
 /* 228 */ "limit_opt ::= LIMIT signed",
 /* 229 */ "limit_opt ::= LIMIT signed OFFSET signed",
 /* 230 */ "limit_opt ::= LIMIT signed COMMA signed",
 /* 231 */ "slimit_opt ::=",
 /* 232 */ "slimit_opt ::= SLIMIT signed",
 /* 233 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
 /* 234 */ "slimit_opt ::= SLIMIT signed COMMA signed",
 /* 235 */ "where_opt ::=",
 /* 236 */ "where_opt ::= WHERE expr",
 /* 237 */ "expr ::= LP expr RP",
 /* 238 */ "expr ::= ID",
 /* 239 */ "expr ::= ID DOT ID",
 /* 240 */ "expr ::= ID DOT STAR",
 /* 241 */ "expr ::= INTEGER",
 /* 242 */ "expr ::= MINUS INTEGER",
 /* 243 */ "expr ::= PLUS INTEGER",
 /* 244 */ "expr ::= FLOAT",
 /* 245 */ "expr ::= MINUS FLOAT",
 /* 246 */ "expr ::= PLUS FLOAT",
 /* 247 */ "expr ::= STRING",
 /* 248 */ "expr ::= NOW",
 /* 249 */ "expr ::= VARIABLE",
 /* 250 */ "expr ::= PLUS VARIABLE",
 /* 251 */ "expr ::= MINUS VARIABLE",
 /* 252 */ "expr ::= BOOL",
 /* 253 */ "expr ::= NULL",
 /* 254 */ "expr ::= ID LP exprlist RP",
 /* 255 */ "expr ::= ID LP STAR RP",
 /* 256 */ "expr ::= expr IS NULL",
 /* 257 */ "expr ::= expr IS NOT NULL",
 /* 258 */ "expr ::= expr LT expr",
 /* 259 */ "expr ::= expr GT expr",
 /* 260 */ "expr ::= expr LE expr",
 /* 261 */ "expr ::= expr GE expr",
 /* 262 */ "expr ::= expr NE expr",
 /* 263 */ "expr ::= expr EQ expr",
 /* 264 */ "expr ::= expr BETWEEN expr AND expr",
 /* 265 */ "expr ::= expr AND expr",
 /* 266 */ "expr ::= expr OR expr",
 /* 267 */ "expr ::= expr PLUS expr",
 /* 268 */ "expr ::= expr MINUS expr",
 /* 269 */ "expr ::= expr STAR expr",
 /* 270 */ "expr ::= expr SLASH expr",
 /* 271 */ "expr ::= expr REM expr",
 /* 272 */ "expr ::= expr LIKE expr",
 /* 273 */ "expr ::= expr MATCH expr",
 /* 274 */ "expr ::= expr NMATCH expr",
 /* 275 */ "expr ::= expr IN LP exprlist RP",
 /* 276 */ "exprlist ::= exprlist COMMA expritem",
 /* 277 */ "exprlist ::= expritem",
 /* 278 */ "expritem ::= expr",
 /* 279 */ "expritem ::=",
 /* 280 */ "cmd ::= RESET QUERY CACHE",
 /* 281 */ "cmd ::= SYNCDB ids REPLICA",
 /* 282 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
 /* 283 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
 /* 284 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
 /* 285 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
 /* 286 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
 /* 287 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
 /* 288 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
 /* 289 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
 /* 290 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
 /* 291 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
 /* 292 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
 /* 293 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
 /* 294 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
 /* 295 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
 /* 296 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
 /* 297 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
 /* 298 */ "cmd ::= KILL CONNECTION INTEGER",
 /* 299 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
 /* 300 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
1371 1372 1373 1374 1375 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
};
#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 ***************************************/
1491 1492 1493
    case 200: /* exprlist */
    case 244: /* selcollist */
    case 258: /* sclp */
1494
{
1495
tSqlExprListDestroy((yypminor->yy413));
1496 1497
}
      break;
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
    case 214: /* intitemlist */
    case 216: /* keep */
    case 236: /* columnlist */
    case 237: /* tagitemlist1 */
    case 238: /* tagNamelist */
    case 242: /* tagitemlist */
    case 251: /* fill_opt */
    case 252: /* groupby_opt */
    case 254: /* orderby_opt */
    case 266: /* sortlist */
    case 270: /* grouplist */
{
taosArrayDestroy((yypminor->yy413));
1511 1512
}
      break;
1513
    case 234: /* create_table_list */
1514
{
1515
destroyCreateTableSql((yypminor->yy438));
1516 1517
}
      break;
1518
    case 239: /* select */
1519
{
1520
destroySqlNode((yypminor->yy24));
1521 1522
}
      break;
1523 1524 1525
    case 245: /* from */
    case 262: /* tablelist */
    case 263: /* sub */
1526
{
1527
destroyRelationInfo((yypminor->yy292));
1528 1529
}
      break;
1530 1531 1532 1533
    case 246: /* where_opt */
    case 253: /* having_opt */
    case 260: /* expr */
    case 271: /* expritem */
1534
{
1535
tSqlExprDestroy((yypminor->yy370));
1536 1537
}
      break;
1538
    case 257: /* union */
1539
{
1540
destroyAllSqlNode((yypminor->yy129));
1541 1542
}
      break;
1543
    case 267: /* sortitem */
1544
{
1545
taosVariantDestroy(&(yypminor->yy461));
1546 1547 1548 1549 1550 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
}
      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[] = {
1839 1840 1841 1842 1843 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 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
  {  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 */
  {  202,    0 }, /* (103) db_optr ::= */
  {  202,   -2 }, /* (104) db_optr ::= db_optr cache */
  {  202,   -2 }, /* (105) db_optr ::= db_optr replica */
  {  202,   -2 }, /* (106) db_optr ::= db_optr quorum */
  {  202,   -2 }, /* (107) db_optr ::= db_optr days */
  {  202,   -2 }, /* (108) db_optr ::= db_optr minrows */
  {  202,   -2 }, /* (109) db_optr ::= db_optr maxrows */
  {  202,   -2 }, /* (110) db_optr ::= db_optr blocks */
  {  202,   -2 }, /* (111) db_optr ::= db_optr ctime */
  {  202,   -2 }, /* (112) db_optr ::= db_optr wal */
  {  202,   -2 }, /* (113) db_optr ::= db_optr fsync */
  {  202,   -2 }, /* (114) db_optr ::= db_optr comp */
  {  202,   -2 }, /* (115) db_optr ::= db_optr prec */
  {  202,   -2 }, /* (116) db_optr ::= db_optr keep */
  {  202,   -2 }, /* (117) db_optr ::= db_optr update */
  {  202,   -2 }, /* (118) db_optr ::= db_optr cachelast */
  {  198,    0 }, /* (119) alter_db_optr ::= */
  {  198,   -2 }, /* (120) alter_db_optr ::= alter_db_optr replica */
  {  198,   -2 }, /* (121) alter_db_optr ::= alter_db_optr quorum */
  {  198,   -2 }, /* (122) alter_db_optr ::= alter_db_optr keep */
  {  198,   -2 }, /* (123) alter_db_optr ::= alter_db_optr blocks */
  {  198,   -2 }, /* (124) alter_db_optr ::= alter_db_optr comp */
  {  198,   -2 }, /* (125) alter_db_optr ::= alter_db_optr update */
  {  198,   -2 }, /* (126) alter_db_optr ::= alter_db_optr cachelast */
  {  203,   -1 }, /* (127) typename ::= ids */
  {  203,   -4 }, /* (128) typename ::= ids LP signed RP */
  {  203,   -2 }, /* (129) typename ::= ids UNSIGNED */
  {  231,   -1 }, /* (130) signed ::= INTEGER */
  {  231,   -2 }, /* (131) signed ::= PLUS INTEGER */
  {  231,   -2 }, /* (132) signed ::= MINUS INTEGER */
  {  193,   -3 }, /* (133) cmd ::= CREATE TABLE create_table_args */
  {  193,   -3 }, /* (134) cmd ::= CREATE TABLE create_stable_args */
  {  193,   -3 }, /* (135) cmd ::= CREATE STABLE create_stable_args */
  {  193,   -3 }, /* (136) cmd ::= CREATE TABLE create_table_list */
  {  234,   -1 }, /* (137) create_table_list ::= create_from_stable */
  {  234,   -2 }, /* (138) create_table_list ::= create_table_list create_from_stable */
  {  232,   -6 }, /* (139) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
  {  233,  -10 }, /* (140) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
  {  235,  -10 }, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
  {  235,  -13 }, /* (142) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
  {  238,   -3 }, /* (143) tagNamelist ::= tagNamelist COMMA ids */
  {  238,   -1 }, /* (144) tagNamelist ::= ids */
  {  232,   -5 }, /* (145) create_table_args ::= ifnotexists ids cpxName AS select */
  {  236,   -3 }, /* (146) columnlist ::= columnlist COMMA column */
  {  236,   -1 }, /* (147) columnlist ::= column */
  {  240,   -2 }, /* (148) column ::= ids typename */
  {  237,   -3 }, /* (149) tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */
  {  237,   -1 }, /* (150) tagitemlist1 ::= tagitem1 */
  {  241,   -2 }, /* (151) tagitem1 ::= MINUS INTEGER */
  {  241,   -2 }, /* (152) tagitem1 ::= MINUS FLOAT */
  {  241,   -2 }, /* (153) tagitem1 ::= PLUS INTEGER */
  {  241,   -2 }, /* (154) tagitem1 ::= PLUS FLOAT */
  {  241,   -1 }, /* (155) tagitem1 ::= INTEGER */
  {  241,   -1 }, /* (156) tagitem1 ::= FLOAT */
  {  241,   -1 }, /* (157) tagitem1 ::= STRING */
  {  241,   -1 }, /* (158) tagitem1 ::= BOOL */
  {  241,   -1 }, /* (159) tagitem1 ::= NULL */
  {  241,   -1 }, /* (160) tagitem1 ::= NOW */
  {  242,   -3 }, /* (161) tagitemlist ::= tagitemlist COMMA tagitem */
  {  242,   -1 }, /* (162) tagitemlist ::= tagitem */
  {  243,   -1 }, /* (163) tagitem ::= INTEGER */
  {  243,   -1 }, /* (164) tagitem ::= FLOAT */
  {  243,   -1 }, /* (165) tagitem ::= STRING */
  {  243,   -1 }, /* (166) tagitem ::= BOOL */
  {  243,   -1 }, /* (167) tagitem ::= NULL */
  {  243,   -1 }, /* (168) tagitem ::= NOW */
  {  243,   -2 }, /* (169) tagitem ::= MINUS INTEGER */
  {  243,   -2 }, /* (170) tagitem ::= MINUS FLOAT */
  {  243,   -2 }, /* (171) tagitem ::= PLUS INTEGER */
  {  243,   -2 }, /* (172) tagitem ::= PLUS FLOAT */
  {  239,  -14 }, /* (173) 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 */
  {  239,   -3 }, /* (174) select ::= LP select RP */
  {  257,   -1 }, /* (175) union ::= select */
  {  257,   -4 }, /* (176) union ::= union UNION ALL select */
  {  257,   -3 }, /* (177) union ::= union UNION select */
  {  193,   -1 }, /* (178) cmd ::= union */
  {  239,   -2 }, /* (179) select ::= SELECT selcollist */
  {  258,   -2 }, /* (180) sclp ::= selcollist COMMA */
  {  258,    0 }, /* (181) sclp ::= */
  {  244,   -4 }, /* (182) selcollist ::= sclp distinct expr as */
  {  244,   -2 }, /* (183) selcollist ::= sclp STAR */
  {  261,   -2 }, /* (184) as ::= AS ids */
  {  261,   -1 }, /* (185) as ::= ids */
  {  261,    0 }, /* (186) as ::= */
  {  259,   -1 }, /* (187) distinct ::= DISTINCT */
  {  259,    0 }, /* (188) distinct ::= */
  {  245,   -2 }, /* (189) from ::= FROM tablelist */
  {  245,   -2 }, /* (190) from ::= FROM sub */
  {  263,   -3 }, /* (191) sub ::= LP union RP */
  {  263,   -4 }, /* (192) sub ::= LP union RP ids */
  {  263,   -6 }, /* (193) sub ::= sub COMMA LP union RP ids */
  {  262,   -2 }, /* (194) tablelist ::= ids cpxName */
  {  262,   -3 }, /* (195) tablelist ::= ids cpxName ids */
  {  262,   -4 }, /* (196) tablelist ::= tablelist COMMA ids cpxName */
  {  262,   -5 }, /* (197) tablelist ::= tablelist COMMA ids cpxName ids */
  {  264,   -1 }, /* (198) tmvar ::= VARIABLE */
  {  247,   -4 }, /* (199) interval_option ::= intervalKey LP tmvar RP */
  {  247,   -6 }, /* (200) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
  {  247,    0 }, /* (201) interval_option ::= */
  {  265,   -1 }, /* (202) intervalKey ::= INTERVAL */
  {  265,   -1 }, /* (203) intervalKey ::= EVERY */
  {  249,    0 }, /* (204) session_option ::= */
  {  249,   -7 }, /* (205) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
  {  250,    0 }, /* (206) windowstate_option ::= */
  {  250,   -4 }, /* (207) windowstate_option ::= STATE_WINDOW LP ids RP */
  {  251,    0 }, /* (208) fill_opt ::= */
  {  251,   -6 }, /* (209) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
  {  251,   -4 }, /* (210) fill_opt ::= FILL LP ID RP */
  {  248,   -4 }, /* (211) sliding_opt ::= SLIDING LP tmvar RP */
  {  248,    0 }, /* (212) sliding_opt ::= */
  {  254,    0 }, /* (213) orderby_opt ::= */
  {  254,   -3 }, /* (214) orderby_opt ::= ORDER BY sortlist */
  {  266,   -4 }, /* (215) sortlist ::= sortlist COMMA item sortorder */
  {  266,   -2 }, /* (216) sortlist ::= item sortorder */
  {  268,   -2 }, /* (217) item ::= ids cpxName */
  {  269,   -1 }, /* (218) sortorder ::= ASC */
  {  269,   -1 }, /* (219) sortorder ::= DESC */
  {  269,    0 }, /* (220) sortorder ::= */
  {  252,    0 }, /* (221) groupby_opt ::= */
  {  252,   -3 }, /* (222) groupby_opt ::= GROUP BY grouplist */
  {  270,   -3 }, /* (223) grouplist ::= grouplist COMMA item */
  {  270,   -1 }, /* (224) grouplist ::= item */
  {  253,    0 }, /* (225) having_opt ::= */
  {  253,   -2 }, /* (226) having_opt ::= HAVING expr */
  {  256,    0 }, /* (227) limit_opt ::= */
  {  256,   -2 }, /* (228) limit_opt ::= LIMIT signed */
  {  256,   -4 }, /* (229) limit_opt ::= LIMIT signed OFFSET signed */
  {  256,   -4 }, /* (230) limit_opt ::= LIMIT signed COMMA signed */
  {  255,    0 }, /* (231) slimit_opt ::= */
  {  255,   -2 }, /* (232) slimit_opt ::= SLIMIT signed */
  {  255,   -4 }, /* (233) slimit_opt ::= SLIMIT signed SOFFSET signed */
  {  255,   -4 }, /* (234) slimit_opt ::= SLIMIT signed COMMA signed */
  {  246,    0 }, /* (235) where_opt ::= */
  {  246,   -2 }, /* (236) where_opt ::= WHERE expr */
  {  260,   -3 }, /* (237) expr ::= LP expr RP */
  {  260,   -1 }, /* (238) expr ::= ID */
  {  260,   -3 }, /* (239) expr ::= ID DOT ID */
  {  260,   -3 }, /* (240) expr ::= ID DOT STAR */
  {  260,   -1 }, /* (241) expr ::= INTEGER */
  {  260,   -2 }, /* (242) expr ::= MINUS INTEGER */
  {  260,   -2 }, /* (243) expr ::= PLUS INTEGER */
  {  260,   -1 }, /* (244) expr ::= FLOAT */
  {  260,   -2 }, /* (245) expr ::= MINUS FLOAT */
  {  260,   -2 }, /* (246) expr ::= PLUS FLOAT */
  {  260,   -1 }, /* (247) expr ::= STRING */
  {  260,   -1 }, /* (248) expr ::= NOW */
  {  260,   -1 }, /* (249) expr ::= VARIABLE */
  {  260,   -2 }, /* (250) expr ::= PLUS VARIABLE */
  {  260,   -2 }, /* (251) expr ::= MINUS VARIABLE */
  {  260,   -1 }, /* (252) expr ::= BOOL */
  {  260,   -1 }, /* (253) expr ::= NULL */
  {  260,   -4 }, /* (254) expr ::= ID LP exprlist RP */
  {  260,   -4 }, /* (255) expr ::= ID LP STAR RP */
  {  260,   -3 }, /* (256) expr ::= expr IS NULL */
  {  260,   -4 }, /* (257) expr ::= expr IS NOT NULL */
  {  260,   -3 }, /* (258) expr ::= expr LT expr */
  {  260,   -3 }, /* (259) expr ::= expr GT expr */
  {  260,   -3 }, /* (260) expr ::= expr LE expr */
  {  260,   -3 }, /* (261) expr ::= expr GE expr */
  {  260,   -3 }, /* (262) expr ::= expr NE expr */
  {  260,   -3 }, /* (263) expr ::= expr EQ expr */
  {  260,   -5 }, /* (264) expr ::= expr BETWEEN expr AND expr */
  {  260,   -3 }, /* (265) expr ::= expr AND expr */
  {  260,   -3 }, /* (266) expr ::= expr OR expr */
  {  260,   -3 }, /* (267) expr ::= expr PLUS expr */
  {  260,   -3 }, /* (268) expr ::= expr MINUS expr */
  {  260,   -3 }, /* (269) expr ::= expr STAR expr */
  {  260,   -3 }, /* (270) expr ::= expr SLASH expr */
  {  260,   -3 }, /* (271) expr ::= expr REM expr */
  {  260,   -3 }, /* (272) expr ::= expr LIKE expr */
  {  260,   -3 }, /* (273) expr ::= expr MATCH expr */
  {  260,   -3 }, /* (274) expr ::= expr NMATCH expr */
  {  260,   -5 }, /* (275) expr ::= expr IN LP exprlist RP */
  {  200,   -3 }, /* (276) exprlist ::= exprlist COMMA expritem */
  {  200,   -1 }, /* (277) exprlist ::= expritem */
  {  271,   -1 }, /* (278) expritem ::= expr */
  {  271,    0 }, /* (279) expritem ::= */
  {  193,   -3 }, /* (280) cmd ::= RESET QUERY CACHE */
  {  193,   -3 }, /* (281) cmd ::= SYNCDB ids REPLICA */
  {  193,   -7 }, /* (282) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
  {  193,   -7 }, /* (283) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
  {  193,   -7 }, /* (284) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
  {  193,   -7 }, /* (285) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
  {  193,   -7 }, /* (286) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
  {  193,   -8 }, /* (287) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
  {  193,   -9 }, /* (288) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
  {  193,   -7 }, /* (289) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
  {  193,   -7 }, /* (290) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
  {  193,   -7 }, /* (291) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
  {  193,   -7 }, /* (292) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
  {  193,   -7 }, /* (293) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
  {  193,   -7 }, /* (294) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
  {  193,   -8 }, /* (295) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
  {  193,   -9 }, /* (296) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
  {  193,   -7 }, /* (297) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
  {  193,   -3 }, /* (298) cmd ::= KILL CONNECTION INTEGER */
  {  193,   -5 }, /* (299) cmd ::= KILL STREAM INTEGER COLON INTEGER */
  {  193,   -5 }, /* (300) cmd ::= KILL QUERY INTEGER COLON INTEGER */
2140 2141 2142 2143 2144 2145 2146 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
};

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 */
2220 2221 2222
      case 133: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==133);
      case 134: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==134);
      case 135: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==135);
2223 2224 2225 2226 2227 2228 2229 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
{}
        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 已提交
2315
    setShowOptions(pInfo, TSDB_MGMT_TABLE_STB, &yymsp[-1].minor.yy0, 0);
2316 2317 2318 2319 2320 2321
}
        break;
      case 27: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */
{
    SToken token;
    tSetDbName(&token, &yymsp[-3].minor.yy0);
S
Shengliang Guan 已提交
2322
    setShowOptions(pInfo, TSDB_MGMT_TABLE_STB, &token, &yymsp[0].minor.yy0);
2323 2324 2325 2326 2327 2328 2329 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
}
        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 */
2398
{ SToken t = {0};  setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy254, &t);}
2399
        break;
2400
      case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */
2401
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy171);}
2402
        break;
2403
      case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
2404
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);}
2405
        break;
2406
      case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */
2407
{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy413);}
2408
        break;
2409 2410
      case 51: /* ids ::= ID */
      case 52: /* ids ::= STRING */ yytestcase(yyruleno==52);
2411 2412 2413
{yylhsminor.yy0 = yymsp[0].minor.yy0; }
  yymsp[0].minor.yy0 = yylhsminor.yy0;
        break;
2414
      case 53: /* ifexists ::= IF EXISTS */
2415 2416
{ yymsp[-1].minor.yy0.n = 1;}
        break;
2417 2418
      case 54: /* ifexists ::= */
      case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56);
2419
      case 188: /* distinct ::= */ yytestcase(yyruleno==188);
2420 2421
{ yymsp[1].minor.yy0.n = 0;}
        break;
2422
      case 55: /* ifnotexists ::= IF NOT EXISTS */
2423 2424
{ yymsp[-2].minor.yy0.n = 1;}
        break;
2425
      case 57: /* cmd ::= CREATE DNODE ids PORT ids */
2426
      case 58: /* cmd ::= CREATE DNODE IPTOKEN PORT ids */ yytestcase(yyruleno==58);
2427
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
2428
        break;
2429
      case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
2430
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy171);}
2431
        break;
2432
      case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
2433
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy254, &yymsp[-2].minor.yy0);}
2434
        break;
2435
      case 61: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
2436
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy280, &yymsp[0].minor.yy0, 1);}
2437
        break;
2438
      case 62: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
2439
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy280, &yymsp[0].minor.yy0, 2);}
2440
        break;
2441
      case 63: /* cmd ::= CREATE USER ids PASS ids */
2442 2443
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
        break;
2444 2445 2446 2447 2448 2449 2450 2451 2452 2453
      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);
2454 2455
{ yymsp[1].minor.yy0.n = 0;   }
        break;
2456 2457 2458 2459 2460 2461 2462 2463 2464 2465
      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);
2466 2467
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;     }
        break;
2468
      case 84: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
2469
{
2470 2471 2472 2473 2474 2475 2476 2477 2478
    yylhsminor.yy171.maxUsers   = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
    yylhsminor.yy171.maxDbs     = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
    yylhsminor.yy171.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
    yylhsminor.yy171.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
    yylhsminor.yy171.maxPointsPerSecond     = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
    yylhsminor.yy171.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy171.maxQueryTime   = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
    yylhsminor.yy171.maxConnections   = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
    yylhsminor.yy171.stat    = yymsp[0].minor.yy0;
2479
}
2480
  yymsp[-8].minor.yy171 = yylhsminor.yy171;
2481
        break;
2482 2483
      case 85: /* intitemlist ::= intitemlist COMMA intitem */
      case 161: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==161);
2484 2485
{ yylhsminor.yy413 = tListItemAppend(yymsp[-2].minor.yy413, &yymsp[0].minor.yy461, -1);    }
  yymsp[-2].minor.yy413 = yylhsminor.yy413;
2486
        break;
2487 2488
      case 86: /* intitemlist ::= intitem */
      case 162: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==162);
2489 2490
{ yylhsminor.yy413 = tListItemAppend(NULL, &yymsp[0].minor.yy461, -1); }
  yymsp[0].minor.yy413 = yylhsminor.yy413;
2491
        break;
2492 2493 2494 2495 2496
      case 87: /* intitem ::= INTEGER */
      case 163: /* tagitem ::= INTEGER */ yytestcase(yyruleno==163);
      case 164: /* tagitem ::= FLOAT */ yytestcase(yyruleno==164);
      case 165: /* tagitem ::= STRING */ yytestcase(yyruleno==165);
      case 166: /* tagitem ::= BOOL */ yytestcase(yyruleno==166);
2497 2498
{ toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy461, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); }
  yymsp[0].minor.yy461 = yylhsminor.yy461;
2499
        break;
2500
      case 88: /* keep ::= KEEP intitemlist */
2501
{ yymsp[-1].minor.yy413 = yymsp[0].minor.yy413; }
2502
        break;
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516
      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);
2517 2518
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
        break;
2519
      case 103: /* db_optr ::= */
2520
{setDefaultCreateDbOption(&yymsp[1].minor.yy254);}
2521
        break;
2522
      case 104: /* db_optr ::= db_optr cache */
2523 2524
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2525
        break;
2526 2527
      case 105: /* db_optr ::= db_optr replica */
      case 120: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==120);
2528 2529
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2530
        break;
2531 2532
      case 106: /* db_optr ::= db_optr quorum */
      case 121: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==121);
2533 2534
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2535
        break;
2536
      case 107: /* db_optr ::= db_optr days */
2537 2538
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2539
        break;
2540
      case 108: /* db_optr ::= db_optr minrows */
2541 2542
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2543
        break;
2544
      case 109: /* db_optr ::= db_optr maxrows */
2545 2546
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2547
        break;
2548 2549
      case 110: /* db_optr ::= db_optr blocks */
      case 123: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==123);
2550 2551
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2552
        break;
2553
      case 111: /* db_optr ::= db_optr ctime */
2554 2555
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2556
        break;
2557
      case 112: /* db_optr ::= db_optr wal */
2558 2559
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2560
        break;
2561
      case 113: /* db_optr ::= db_optr fsync */
2562 2563
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2564
        break;
2565 2566
      case 114: /* db_optr ::= db_optr comp */
      case 124: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==124);
2567 2568
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2569
        break;
2570
      case 115: /* db_optr ::= db_optr prec */
2571 2572
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.precision = yymsp[0].minor.yy0; }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2573
        break;
2574 2575
      case 116: /* db_optr ::= db_optr keep */
      case 122: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==122);
2576 2577
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.keep = yymsp[0].minor.yy413; }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2578
        break;
2579 2580
      case 117: /* db_optr ::= db_optr update */
      case 125: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==125);
2581 2582
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2583
        break;
2584 2585
      case 118: /* db_optr ::= db_optr cachelast */
      case 126: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==126);
2586 2587
{ yylhsminor.yy254 = yymsp[-1].minor.yy254; yylhsminor.yy254.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2588
        break;
2589
      case 119: /* alter_db_optr ::= */
2590
{ setDefaultCreateDbOption(&yymsp[1].minor.yy254);}
2591
        break;
2592
      case 127: /* typename ::= ids */
2593 2594
{ 
  yymsp[0].minor.yy0.type = 0;
2595
  tSetColumnType (&yylhsminor.yy280, &yymsp[0].minor.yy0);
2596
}
2597
  yymsp[0].minor.yy280 = yylhsminor.yy280;
2598
        break;
2599
      case 128: /* typename ::= ids LP signed RP */
2600
{
2601
  if (yymsp[-1].minor.yy157 <= 0) {
2602
    yymsp[-3].minor.yy0.type = 0;
2603
    tSetColumnType(&yylhsminor.yy280, &yymsp[-3].minor.yy0);
2604
  } else {
2605 2606
    yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy157;  // negative value of name length
    tSetColumnType(&yylhsminor.yy280, &yymsp[-3].minor.yy0);
2607 2608
  }
}
2609
  yymsp[-3].minor.yy280 = yylhsminor.yy280;
2610
        break;
2611
      case 129: /* typename ::= ids UNSIGNED */
2612 2613 2614
{
  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);
2615
  tSetColumnType (&yylhsminor.yy280, &yymsp[-1].minor.yy0);
2616
}
2617
  yymsp[-1].minor.yy280 = yylhsminor.yy280;
2618
        break;
2619
      case 130: /* signed ::= INTEGER */
2620 2621
{ yylhsminor.yy157 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
  yymsp[0].minor.yy157 = yylhsminor.yy157;
2622
        break;
2623
      case 131: /* signed ::= PLUS INTEGER */
2624
{ yymsp[-1].minor.yy157 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
2625
        break;
2626
      case 132: /* signed ::= MINUS INTEGER */
2627
{ yymsp[-1].minor.yy157 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
2628
        break;
2629
      case 136: /* cmd ::= CREATE TABLE create_table_list */
2630
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy438;}
2631
        break;
2632
      case 137: /* create_table_list ::= create_from_stable */
2633 2634 2635 2636
{
  SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
  pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));

2637
  taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy544);
2638
  pCreateTable->type = TSQL_CREATE_CTABLE;
2639
  yylhsminor.yy438 = pCreateTable;
2640
}
2641
  yymsp[0].minor.yy438 = yylhsminor.yy438;
2642
        break;
2643
      case 138: /* create_table_list ::= create_table_list create_from_stable */
2644
{
2645
  taosArrayPush(yymsp[-1].minor.yy438->childTableInfo, &yymsp[0].minor.yy544);
2646
  yylhsminor.yy438 = yymsp[-1].minor.yy438;
2647
}
2648
  yymsp[-1].minor.yy438 = yylhsminor.yy438;
2649
        break;
2650
      case 139: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
2651
{
2652
  yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-1].minor.yy413, NULL, NULL, TSQL_CREATE_TABLE);
2653
  setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
2654 2655 2656 2657

  yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
  setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
}
2658
  yymsp[-5].minor.yy438 = yylhsminor.yy438;
2659
        break;
2660
      case 140: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
2661
{
2662
  yylhsminor.yy438 = tSetCreateTableInfo(yymsp[-5].minor.yy413, yymsp[-1].minor.yy413, NULL, TSQL_CREATE_STABLE);
2663
  setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
2664 2665 2666 2667

  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
  setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
}
2668
  yymsp[-9].minor.yy438 = yylhsminor.yy438;
2669
        break;
2670
      case 141: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
2671 2672 2673
{
  yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
2674
  yylhsminor.yy544 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy413, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
2675
}
2676
  yymsp[-9].minor.yy544 = yylhsminor.yy544;
2677
        break;
2678
      case 142: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
2679 2680 2681
{
  yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
  yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
2682
  yylhsminor.yy544 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy413, yymsp[-1].minor.yy413, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
2683
}
2684
  yymsp[-12].minor.yy544 = yylhsminor.yy544;
2685
        break;
2686
      case 143: /* tagNamelist ::= tagNamelist COMMA ids */
2687 2688
{taosArrayPush(yymsp[-2].minor.yy413, &yymsp[0].minor.yy0); yylhsminor.yy413 = yymsp[-2].minor.yy413;  }
  yymsp[-2].minor.yy413 = yylhsminor.yy413;
2689
        break;
2690
      case 144: /* tagNamelist ::= ids */
2691 2692
{yylhsminor.yy413 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy413, &yymsp[0].minor.yy0);}
  yymsp[0].minor.yy413 = yylhsminor.yy413;
2693
        break;
2694
      case 145: /* create_table_args ::= ifnotexists ids cpxName AS select */
2695
{
2696
  yylhsminor.yy438 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy24, TSQL_CREATE_STREAM);
2697
  setSqlInfo(pInfo, yylhsminor.yy438, NULL, TSDB_SQL_CREATE_TABLE);
2698 2699 2700 2701

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

2915 2916
    tListItemInsert(yymsp[-1].minor.yy413, &A, -1, 0);
    yymsp[-5].minor.yy413 = yymsp[-1].minor.yy413;
2917 2918
}
        break;
2919
      case 210: /* fill_opt ::= FILL LP ID RP */
2920 2921
{
    toTSDBType(yymsp[-1].minor.yy0.type);
2922
    yymsp[-3].minor.yy413 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
2923 2924
}
        break;
2925
      case 211: /* sliding_opt ::= SLIDING LP tmvar RP */
2926 2927
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0;     }
        break;
2928
      case 212: /* sliding_opt ::= */
2929 2930
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0;   }
        break;
2931
      case 214: /* orderby_opt ::= ORDER BY sortlist */
2932
{yymsp[-2].minor.yy413 = yymsp[0].minor.yy413;}
2933
        break;
2934
      case 215: /* sortlist ::= sortlist COMMA item sortorder */
2935
{
2936
    yylhsminor.yy413 = tListItemAppend(yymsp[-3].minor.yy413, &yymsp[-1].minor.yy461, yymsp[0].minor.yy60);
2937
}
2938
  yymsp[-3].minor.yy413 = yylhsminor.yy413;
2939
        break;
2940
      case 216: /* sortlist ::= item sortorder */
2941
{
2942
  yylhsminor.yy413 = tListItemAppend(NULL, &yymsp[-1].minor.yy461, yymsp[0].minor.yy60);
2943
}
2944
  yymsp[-1].minor.yy413 = yylhsminor.yy413;
2945
        break;
2946
      case 217: /* item ::= ids cpxName */
2947 2948 2949 2950
{
  toTSDBType(yymsp[-1].minor.yy0.type);
  yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;

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

    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;
3243
      case 289: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
3244 3245
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
3246
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy413, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
3247 3248 3249
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
3250
      case 290: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
3251 3252
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
3253
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy413, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
3254 3255 3256
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
3257
      case 291: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
3258 3259 3260 3261 3262 3263 3264 3265 3266 3267
{
    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;
3268
      case 292: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
3269 3270
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
3271
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy413, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
3272 3273 3274
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
3275
      case 293: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
3276 3277
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
3278
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy413, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
3279 3280 3281
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
3282
      case 294: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
3283 3284 3285 3286 3287 3288 3289 3290 3291 3292
{
    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;
3293
      case 295: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306
{
    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;
3307
      case 296: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
3308 3309 3310 3311 3312
{
    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);
3313
    A = tListItemAppend(A, &yymsp[0].minor.yy461, -1);
3314 3315 3316 3317 3318

    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;
3319
      case 297: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
3320 3321
{
    yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
3322
    SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy413, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
3323 3324 3325
    setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
        break;
3326
      case 298: /* cmd ::= KILL CONNECTION INTEGER */
3327 3328
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
        break;
3329
      case 299: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
3330 3331
{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;
3332
      case 300: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 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
{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;
}