diff --git a/cmake/version.inc b/cmake/version.inc index 52d62fca6581a4c496531335ee836342b5cc1f24..aa8a4b6463c072b59d54245da4206a6f3b1f351c 100644 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -4,7 +4,7 @@ PROJECT(TDengine) IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "2.0.3.0") + SET(TD_VER_NUMBER "2.0.4.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index c4fba06426bfed3c45b8ec93933afc8e9ff35438..79a792ab65a5327d68f3e75da4ee0610d1f7a6fd 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -191,6 +191,7 @@ SColumn* tscColumnListInsert(SArray* pColList, SColumnIndex* colIndex); SArray* tscColumnListClone(const SArray* src, int16_t tableIndex); void tscColumnListDestroy(SArray* pColList); +void tscDequoteAndTrimToken(SStrToken* pToken); int32_t tscValidateName(SStrToken* pToken); void tscIncStreamExecutionCount(void* pStream); diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 27e2ee8c76b7a90ee9d11e6c132b17932b54da6a..55ca02dfb5d67ea150fc0725191fdc570a6c28c8 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -99,6 +99,7 @@ typedef struct STableMeta { uint8_t tableType; int16_t sversion; int16_t tversion; + char sTableId[TSDB_TABLE_FNAME_LEN]; SCMVgroupInfo vgroupInfo; SCMCorVgroupInfo corVgroupInfo; STableId id; diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 50f82ae662840a80b717cc99934640626a679d1f..030b033653613faf1cc3071bedfaf79613f17ae6 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -23,7 +23,30 @@ #include "tscUtil.h" #include "tschemautil.h" #include "tsclient.h" - +#include "taos.h" +#include "tscSubquery.h" + +#define STR_NOCASE_EQUAL(str1, len1, str2, len2) ((len1 == len2) && 0 == strncasecmp(str1, str2, len1)) + +typedef enum BuildType { + SCREATE_BUILD_TABLE = 1, + SCREATE_BUILD_DB = 2, +} BuildType; + +typedef enum Stage { + SCREATE_CALLBACK_QUERY = 1, + SCREATE_CALLBACK_RETRIEVE = 2, +} Stage; + +// support 'show create table' +typedef struct SCreateBuilder { + char sTableName[TSDB_TABLE_FNAME_LEN]; + char buf[TSDB_TABLE_FNAME_LEN]; + SSqlObj *pParentSql; + SSqlObj *pInterSql; + int32_t (*fp)(void *para, char* result); + Stage callStage; +} SCreateBuilder; static void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnName, int16_t type, size_t valueLength); static int32_t getToStringLength(const char *pData, int32_t length, int32_t type) { @@ -272,14 +295,511 @@ static int32_t tscProcessDescribeTable(SSqlObj *pSql) { tscFieldInfoUpdateOffset(pQueryInfo); return tscSetValueToResObj(pSql, rowLen); } +static int32_t tscGetNthFieldResult(TAOS_ROW row, TAOS_FIELD* fields, int *lengths, int idx, char *result) { + const char *val = row[idx]; + if (val == NULL) { + sprintf(result, "%s", TSDB_DATA_NULL_STR); + return -1; + } + uint8_t type = fields[idx].type; + int32_t length = lengths[idx]; + + switch (type) { + case TSDB_DATA_TYPE_BOOL: + sprintf(result, "%s", ((((int)(*((char *)val))) == 1) ? "true" : "false")); + break; + case TSDB_DATA_TYPE_TINYINT: + sprintf(result, "%d", (int)(*((char *)val))); + break; + case TSDB_DATA_TYPE_SMALLINT: + sprintf(result, "%d", (int)(*((short *)val))); + break; + case TSDB_DATA_TYPE_INT: + sprintf(result, "%d", *((int *)val)); + break; + case TSDB_DATA_TYPE_BIGINT: + sprintf(result, "%"PRId64, *((int64_t *)val)); + break; + case TSDB_DATA_TYPE_FLOAT: + sprintf(result, "%f", GET_FLOAT_VAL(val)); + break; + case TSDB_DATA_TYPE_DOUBLE: + sprintf(result, "%f", GET_DOUBLE_VAL(val)); + break; + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_BINARY: + memcpy(result, val, length); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + ///formatTimestamp(buf, *(int64_t*)val, TSDB_TIME_PRECISION_MICRO); + //memcpy(result, val, strlen(buf)); + sprintf(result, "%"PRId64, *((int64_t *)val)); + break; + default: + break; + } + return 0; +} + +void tscSCreateCallBack(void *param, TAOS_RES *tres, int code) { + if (param == NULL || tres == NULL) { + return; + } + SCreateBuilder *builder = (SCreateBuilder *)(param); + SSqlObj *pParentSql = builder->pParentSql; + SSqlObj *pSql = (SSqlObj *)tres; + + SSqlRes *pRes = &pParentSql->res; + pRes->code = taos_errno(pSql); + if (pRes->code != TSDB_CODE_SUCCESS) { + taos_free_result(pSql); + free(builder); + tscQueueAsyncRes(pParentSql); + return; + } + + if (builder->callStage == SCREATE_CALLBACK_QUERY) { + taos_fetch_rows_a(tres, tscSCreateCallBack, param); + builder->callStage = SCREATE_CALLBACK_RETRIEVE; + } else { + char *result = calloc(1, TSDB_MAX_BINARY_LEN); + pRes->code = builder->fp(builder, result); + + taos_free_result(pSql); + free(builder); + free(result); + + if (pRes->code == TSDB_CODE_SUCCESS) { + (*pParentSql->fp)(pParentSql->param, pParentSql, code); + } else { + tscQueueAsyncRes(pParentSql); + } + } +} + +TAOS_ROW tscFetchRow(void *param) { + SCreateBuilder *builder = (SCreateBuilder *)param; + if (builder == NULL) { + return NULL; + } + SSqlObj *pSql = builder->pInterSql; + if (pSql == NULL || pSql->signature != pSql) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return NULL; + } + + SSqlCmd *pCmd = &pSql->cmd; + SSqlRes *pRes = &pSql->res; + + if (pRes->qhandle == 0 || + pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT || + pCmd->command == TSDB_SQL_INSERT) { + return NULL; + } + + // set the sql object owner + tscSetSqlOwner(pSql); + + // current data set are exhausted, fetch more data from node + if (pRes->row >= pRes->numOfRows && (pRes->completed != true || hasMoreVnodesToTry(pSql) || hasMoreClauseToTry(pSql)) && + (pCmd->command == TSDB_SQL_RETRIEVE || + pCmd->command == TSDB_SQL_RETRIEVE_LOCALMERGE || + pCmd->command == TSDB_SQL_TABLE_JOIN_RETRIEVE || + pCmd->command == TSDB_SQL_FETCH || + pCmd->command == TSDB_SQL_SHOW || + pCmd->command == TSDB_SQL_SHOW_CREATE_TABLE || + pCmd->command == TSDB_SQL_SHOW_CREATE_DATABASE || + pCmd->command == TSDB_SQL_SELECT || + pCmd->command == TSDB_SQL_DESCRIBE_TABLE || + pCmd->command == TSDB_SQL_SERV_STATUS || + pCmd->command == TSDB_SQL_CURRENT_DB || + pCmd->command == TSDB_SQL_SERV_VERSION || + pCmd->command == TSDB_SQL_CLI_VERSION || + pCmd->command == TSDB_SQL_CURRENT_USER )) { + taos_fetch_rows_a(pSql, tscSCreateCallBack, param); + return NULL; + } + + void* data = doSetResultRowData(pSql, true); + + tscClearSqlOwner(pSql); + return data; +} +static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) { + TAOS_ROW row = tscFetchRow(builder); + SSqlObj* pSql = builder->pInterSql; + + if (row == NULL) { + return TSDB_CODE_MND_INVALID_TABLE_NAME; + } + + int32_t* lengths = taos_fetch_lengths(pSql); + int num_fields = taos_num_fields(pSql); + TAOS_FIELD *fields = taos_fetch_fields(pSql); + + char buf[TSDB_COL_NAME_LEN + 16]; + for (int i = 0; i < num_fields; i++) { + memset(buf, 0, sizeof(buf)); + int32_t ret = tscGetNthFieldResult(row, fields, lengths, i, buf); + + if (i == 0) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s", "("); + } + if ((fields[i].type == TSDB_DATA_TYPE_NCHAR + || fields[i].type == TSDB_DATA_TYPE_BINARY + || fields[i].type == TSDB_DATA_TYPE_TIMESTAMP) && 0 == ret) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "\"%s\",", buf); + } else { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s,", buf); + } + if (i == num_fields - 1) { + sprintf(result + strlen(result) - 1, "%s", ")"); + } + } + + if (0 == strlen(result)) { + return TSDB_CODE_MND_INVALID_TABLE_NAME; + } + return TSDB_CODE_SUCCESS; +} + + +// build 'show create table/database' result fields +static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const char *ddl) { + int32_t rowLen = 0; + int16_t ddlLen = (int16_t)strlen(ddl); + SColumnIndex index = {0}; + pSql->cmd.numOfCols = 2; + + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + pQueryInfo->order.order = TSDB_ORDER_ASC; + + TAOS_FIELD f; + if (type == SCREATE_BUILD_TABLE) { + f.type = TSDB_DATA_TYPE_BINARY; + f.bytes = (TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE; + tstrncpy(f.name, "Table", sizeof(f.name)); + } else { + f.type = TSDB_DATA_TYPE_BINARY; + f.bytes = (TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE; + tstrncpy(f.name, "Database", sizeof(f.name)); + } + + SFieldSupInfo* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, + f.bytes, f.bytes - VARSTR_HEADER_SIZE, false); + + rowLen += f.bytes; + f.bytes = (int16_t)(ddlLen + VARSTR_HEADER_SIZE); + f.type = TSDB_DATA_TYPE_BINARY; + if (type == SCREATE_BUILD_TABLE) { + tstrncpy(f.name, "Create Table", sizeof(f.name)); + } else { + tstrncpy(f.name, "Create Database", sizeof(f.name)); + } + + pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, + (int16_t)(ddlLen + VARSTR_HEADER_SIZE), ddlLen, false); + + rowLen += ddlLen + VARSTR_HEADER_SIZE; + + return rowLen; +} +static int32_t tscSCreateSetValueToResObj(SSqlObj *pSql, int32_t rowLen, const char *tableName, const char *ddl) { + SSqlRes *pRes = &pSql->res; + + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + int32_t numOfRows = 1; + if (strlen(ddl) == 0) { + + } + tscInitResObjForLocalQuery(pSql, numOfRows, rowLen); + + TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); + char* dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * numOfRows; + STR_WITH_MAXSIZE_TO_VARSTR(dst, tableName, pField->bytes); + + pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1); + dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * numOfRows; + STR_WITH_MAXSIZE_TO_VARSTR(dst, ddl, pField->bytes); + return 0; +} +static int32_t tscSCreateBuildResult(SSqlObj *pSql, BuildType type, const char *str, const char *result) { + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + int32_t rowLen = tscSCreateBuildResultFields(pSql, type, result); + + tscFieldInfoUpdateOffset(pQueryInfo); + return tscSCreateSetValueToResObj(pSql, rowLen, str, result); +} +int32_t tscRebuildCreateTableStatement(void *param,char *result) { + SCreateBuilder *builder = (SCreateBuilder *)param; + int32_t code = TSDB_CODE_SUCCESS; + + char *buf = calloc(1,TSDB_MAX_BINARY_LEN); + if (buf == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + code = tscGetTableTagValue(builder, buf); + if (code == TSDB_CODE_SUCCESS) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE TABLE %s USING %s TAGS %s", builder->buf, builder->sTableName, buf); + code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_TABLE, builder->buf, result); + } + free(buf); + return code; +} + +static int32_t tscGetDBInfo(SCreateBuilder *builder, char *result) { + TAOS_ROW row = tscFetchRow(builder); + if (row == NULL) { + return TSDB_CODE_MND_DB_NOT_SELECTED; + } + const char *showColumns[] = {"REPLICA", "QUORUM", "DAYS", "KEEP", "BLOCKS", NULL}; + + SSqlObj *pSql = builder->pInterSql; + TAOS_FIELD *fields = taos_fetch_fields(pSql); + int num_fields = taos_num_fields(pSql); + + char buf[TSDB_DB_NAME_LEN + 64] = {0}; + do { + int32_t* lengths = taos_fetch_lengths(pSql); + int32_t ret = tscGetNthFieldResult(row, fields, lengths, 0, buf); + if (0 == ret && STR_NOCASE_EQUAL(buf, strlen(buf), builder->buf, strlen(builder->buf))) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "CREATE DATABASE %s", buf); + for (int i = 1; i < num_fields; i++) { + for (int j = 0; showColumns[j] != NULL; j++) { + if (STR_NOCASE_EQUAL(fields[i].name, strlen(fields[i].name), showColumns[j], strlen(showColumns[j]))) { + memset(buf, 0, sizeof(buf)); + ret = tscGetNthFieldResult(row, fields, lengths, i, buf); + if (ret == 0) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), " %s %s", showColumns[j], buf); + } + } + } + } + break; + } + + row = tscFetchRow(builder); + } while (row != NULL); + + if (0 == strlen(result)) { + return TSDB_CODE_MND_DB_NOT_SELECTED; + } + + return TSDB_CODE_SUCCESS; +} +int32_t tscRebuildCreateDBStatement(void *param,char *result) { + SCreateBuilder *builder = (SCreateBuilder *)param; + int32_t code = TSDB_CODE_SUCCESS; + + char *buf = calloc(1, TSDB_MAX_BINARY_LEN); + if (buf == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + code = tscGetDBInfo(param, buf); + if (code == TSDB_CODE_SUCCESS) { + code = tscSCreateBuildResult(builder->pParentSql, SCREATE_BUILD_DB, builder->buf, buf); + } + free(buf); + return code; +} + +static int32_t tscGetTableTagColumnName(SSqlObj *pSql, char **result) { + char *buf = (char *)malloc(TSDB_MAX_BINARY_LEN); + if (buf == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + buf[0] = 0; + + STableMeta *pMeta = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0)->pTableMeta; + if (pMeta->tableType == TSDB_SUPER_TABLE || pMeta->tableType == TSDB_NORMAL_TABLE || + pMeta->tableType == TSDB_STREAM_TABLE) { + free(buf); + return TSDB_CODE_TSC_INVALID_VALUE; + } + + SSchema *pTagsSchema = tscGetTableTagSchema(pMeta); + int32_t numOfTags = tscGetNumOfTags(pMeta); + for (int32_t i = 0; i < numOfTags; i++) { + if (i != numOfTags - 1) { + snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "%s,", pTagsSchema[i].name); + } else { + snprintf(buf + strlen(buf), TSDB_MAX_BINARY_LEN - strlen(buf), "%s", pTagsSchema[i].name); + } + } + + *result = buf; + return TSDB_CODE_SUCCESS; +} +static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, char *ddl) { + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableMeta * pMeta = pTableMetaInfo->pTableMeta; + + SSqlObj *pInterSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); + if (pInterSql == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + SCreateBuilder *param = (SCreateBuilder *)malloc(sizeof(SCreateBuilder)); + if (param == NULL) { + free(pInterSql); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + char fullName[TSDB_TABLE_FNAME_LEN] = {0}; + extractDBName(pTableMetaInfo->name, fullName); + extractTableName(pMeta->sTableId, param->sTableName); + snprintf(fullName + strlen(fullName), TSDB_TABLE_FNAME_LEN - strlen(fullName), ".%s", param->sTableName); + extractTableName(pTableMetaInfo->name, param->buf); + + param->pParentSql = pSql; + param->pInterSql = pInterSql; + param->fp = tscRebuildCreateTableStatement; + param->callStage = SCREATE_CALLBACK_QUERY; + + char *query = (char *)calloc(1, TSDB_MAX_BINARY_LEN); + if (query == NULL) { + free(param); + free(pInterSql); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + char *columns = NULL; + int32_t code = tscGetTableTagColumnName(pSql, &columns) ; + if (code != TSDB_CODE_SUCCESS) { + free(param); + free(pInterSql); + free(query); + return code; + } + + snprintf(query + strlen(query), TSDB_MAX_BINARY_LEN - strlen(query), "SELECT %s FROM %s WHERE TBNAME IN(\'%s\')", columns, fullName, param->buf); + doAsyncQuery(pSql->pTscObj, pInterSql, tscSCreateCallBack, param, query, strlen(query)); + free(query); + free(columns); + + return TSDB_CODE_TSC_ACTION_IN_PROGRESS; +} +static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName, char *ddl) { + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableMeta * pMeta = pTableMetaInfo->pTableMeta; + + int32_t numOfRows = tscGetNumOfColumns(pMeta); + SSchema *pSchema = tscGetTableSchema(pMeta); + + char *result = ddl; + sprintf(result, "create table %s (", tableName); + for (int32_t i = 0; i < numOfRows; ++i) { + uint8_t type = pSchema[i].type; + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name,tDataTypeDesc[pSchema[i].type].aName,pSchema->bytes); + } else { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[pSchema[i].type].aName); + } + } + sprintf(result + strlen(result) - 1, "%s", ")"); + + return TSDB_CODE_SUCCESS; +} +static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName, char *ddl) { + char *result = ddl; + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableMeta * pMeta = pTableMetaInfo->pTableMeta; + + int32_t numOfRows = tscGetNumOfColumns(pMeta); + int32_t totalRows = numOfRows + tscGetNumOfTags(pMeta); + SSchema *pSchema = tscGetTableSchema(pMeta); + + sprintf(result, "create table %s (", tableName); + for (int32_t i = 0; i < numOfRows; ++i) { + uint8_t type = pSchema[i].type; + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result),"%s %s(%d),", pSchema[i].name,tDataTypeDesc[pSchema[i].type].aName,pSchema->bytes); + } else { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[type].aName); + } + } + snprintf(result + strlen(result) - 1, TSDB_MAX_BINARY_LEN - strlen(result), "%s %s", ")", "TAGS ("); + + for (int32_t i = numOfRows; i < totalRows; i++) { + uint8_t type = pSchema[i].type; + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name,tDataTypeDesc[pSchema[i].type].aName,pSchema->bytes); + } else { + snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[type].aName); + } + } + sprintf(result + strlen(result) - 1, "%s", ")"); + + return TSDB_CODE_SUCCESS; +} + +static int32_t tscProcessShowCreateTable(SSqlObj *pSql) { + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + assert(pTableMetaInfo->pTableMeta != NULL); + + char tableName[TSDB_TABLE_NAME_LEN] = {0}; + extractTableName(pTableMetaInfo->name, tableName); + + char *result = (char *)calloc(1, TSDB_MAX_BINARY_LEN); + int32_t code = TSDB_CODE_SUCCESS; + if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { + code = tscRebuildDDLForSuperTable(pSql, tableName, result); + } else if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { + code = tscRebuildDDLForNormalTable(pSql, tableName, result); + } else if (UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo)) { + code = tscRebuildDDLForSubTable(pSql, tableName, result); + } else { + code = TSDB_CODE_TSC_INVALID_VALUE; + } + + if (code == TSDB_CODE_SUCCESS) { + code = tscSCreateBuildResult(pSql, SCREATE_BUILD_TABLE, tableName, result); + } + free(result); + return code; +} + +static int32_t tscProcessShowCreateDatabase(SSqlObj *pSql) { + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); + + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + + SSqlObj *pInterSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); + if (pInterSql == NULL) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + SCreateBuilder *param = (SCreateBuilder *)malloc(sizeof(SCreateBuilder)); + if (param == NULL) { + free(pInterSql); + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + extractTableName(pTableMetaInfo->name, param->buf); + param->pParentSql = pSql; + param->pInterSql = pInterSql; + param->fp = tscRebuildCreateDBStatement; + param->callStage = SCREATE_CALLBACK_QUERY; + + const char *query = "show databases"; + doAsyncQuery(pSql->pTscObj, pInterSql, tscSCreateCallBack, param, query, strlen(query)); + return TSDB_CODE_TSC_ACTION_IN_PROGRESS; +} static int32_t tscProcessCurrentUser(SSqlObj *pSql) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); - + SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, 0); pExpr->resBytes = TSDB_USER_LEN + TSDB_DATA_TYPE_BINARY; pExpr->resType = TSDB_DATA_TYPE_BINARY; - + char* vx = calloc(1, pExpr->resBytes); if (vx == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -287,7 +807,7 @@ static int32_t tscProcessCurrentUser(SSqlObj *pSql) { size_t size = sizeof(pSql->pTscObj->user); STR_WITH_MAXSIZE_TO_VARSTR(vx, pSql->pTscObj->user, size); - + tscSetLocalQueryResult(pSql, vx, pExpr->aliasName, pExpr->resType, pExpr->resBytes); free(vx); @@ -297,15 +817,15 @@ static int32_t tscProcessCurrentUser(SSqlObj *pSql) { static int32_t tscProcessCurrentDB(SSqlObj *pSql) { char db[TSDB_DB_NAME_LEN] = {0}; extractDBName(pSql->pTscObj->db, db); - + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex); - + SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, 0); pExpr->resType = TSDB_DATA_TYPE_BINARY; - + size_t t = strlen(db); pExpr->resBytes = TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE; - + char* vx = calloc(1, pExpr->resBytes); if (vx == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -316,7 +836,7 @@ static int32_t tscProcessCurrentDB(SSqlObj *pSql) { } else { STR_WITH_SIZE_TO_VARSTR(vx, db, (VarDataLenT)t); } - + tscSetLocalQueryResult(pSql, vx, pExpr->aliasName, pExpr->resType, pExpr->resBytes); free(vx); @@ -326,49 +846,53 @@ static int32_t tscProcessCurrentDB(SSqlObj *pSql) { static int32_t tscProcessServerVer(SSqlObj *pSql) { const char* v = pSql->pTscObj->sversion; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex); - + SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, 0); pExpr->resType = TSDB_DATA_TYPE_BINARY; - + size_t t = strlen(v); pExpr->resBytes = (int16_t)(t + VARSTR_HEADER_SIZE); - + char* vx = calloc(1, pExpr->resBytes); if (vx == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; + } STR_WITH_SIZE_TO_VARSTR(vx, v, (VarDataLenT)t); tscSetLocalQueryResult(pSql, vx, pExpr->aliasName, pExpr->resType, pExpr->resBytes); - + free(vx); return TSDB_CODE_SUCCESS; + } static int32_t tscProcessClientVer(SSqlObj *pSql) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); - + SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, 0); pExpr->resType = TSDB_DATA_TYPE_BINARY; - + size_t t = strlen(version); pExpr->resBytes = (int16_t)(t + VARSTR_HEADER_SIZE); - + char* v = calloc(1, pExpr->resBytes); if (v == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; + } STR_WITH_SIZE_TO_VARSTR(v, version, (VarDataLenT)t); tscSetLocalQueryResult(pSql, v, pExpr->aliasName, pExpr->resType, pExpr->resBytes); - + free(v); return TSDB_CODE_SUCCESS; + } static int32_t tscProcessServStatus(SSqlObj *pSql) { STscObj* pObj = pSql->pTscObj; - + if (pObj->pHb != NULL) { if (pObj->pHb->res.code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { pSql->res.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; @@ -379,9 +903,9 @@ static int32_t tscProcessServStatus(SSqlObj *pSql) { return pSql->res.code; } } - + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); - + SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, 0); int32_t val = 1; tscSetLocalQueryResult(pSql, (char*) &val, pExpr->aliasName, TSDB_DATA_TYPE_INT, sizeof(int32_t)); @@ -393,23 +917,23 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa SSqlRes *pRes = &pSql->res; pCmd->numOfCols = 1; - + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); pQueryInfo->order.order = TSDB_ORDER_ASC; - + tscFieldInfoClear(&pQueryInfo->fieldsInfo); pQueryInfo->fieldsInfo.pFields = taosArrayInit(1, sizeof(TAOS_FIELD)); pQueryInfo->fieldsInfo.pSupportInfo = taosArrayInit(1, sizeof(SFieldSupInfo)); - + TAOS_FIELD f = tscCreateField((int8_t)type, columnName, (int16_t)valueLength); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); - + tscInitResObjForLocalQuery(pSql, 1, (int32_t)valueLength); TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, 0); pInfo->pSqlExpr = taosArrayGetP(pQueryInfo->exprList, 0); - + memcpy(pRes->data, val, pField->bytes); } @@ -428,6 +952,10 @@ int tscProcessLocalCmd(SSqlObj *pSql) { */ pRes->qhandle = 0x1; pRes->numOfRows = 0; + } else if (pCmd->command == TSDB_SQL_SHOW_CREATE_TABLE) { + pRes->code = tscProcessShowCreateTable(pSql); + } else if (pCmd->command == TSDB_SQL_SHOW_CREATE_DATABASE) { + pRes->code = tscProcessShowCreateDatabase(pSql); } else if (pCmd->command == TSDB_SQL_RESET_CACHE) { taosCacheEmpty(tscMetaCache); pRes->code = TSDB_CODE_SUCCESS; @@ -447,12 +975,13 @@ int tscProcessLocalCmd(SSqlObj *pSql) { } // keep the code in local variable in order to avoid invalid read in case of async query + int32_t code = pRes->code; if (code == TSDB_CODE_SUCCESS) { (*pSql->fp)(pSql->param, pSql, code); + } else if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS){ } else { tscQueueAsyncRes(pSql); } - return code; } diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 327aac22d159875ba644890e4a0fd41e1998ecdf..6fd97c09e97dd876fb58f9908a0b04bc8b3d9bfd 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1192,8 +1192,7 @@ int tsParseInsertSql(SSqlObj *pSql) { str += index; if (TK_STRING == sToken.type) { - strdequote(sToken.z); - sToken.n = (uint32_t)strtrim(sToken.z); + tscDequoteAndTrimToken(&sToken); } if (sToken.type == TK_RP) { diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index a6efffe436b29729c1c66f3962328dfeb6fee080..b9d4cc13d1692a9cb349ea348ca6596e3053c71f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -368,7 +368,40 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { return tscGetTableMeta(pSql, pTableMetaInfo); } + case TSDB_SQL_SHOW_CREATE_TABLE: { + SStrToken* pToken = &pInfo->pDCLInfo->a[0]; + const char* msg1 = "invalid table name"; + const char* msg2 = "table name is too long"; + if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (!tscValidateTableNameLength(pToken->n)) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + + if (tscSetTableFullName(pTableMetaInfo, pToken, pSql) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + return tscGetTableMeta(pSql, pTableMetaInfo); + } + case TSDB_SQL_SHOW_CREATE_DATABASE: { + const char* msg1 = "invalid database name"; + const char* msg2 = "table name is too long"; + SStrToken* pToken = &pInfo->pDCLInfo->a[0]; + + if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + if (pToken->n > TSDB_DB_NAME_LEN) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + if (tscSetTableFullName(pTableMetaInfo, pToken, pSql) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } + return TSDB_CODE_SUCCESS; + } case TSDB_SQL_CFG_DNODE: { const char* msg2 = "invalid configure options or values, such as resetlog / debugFlag 135 / balance 'vnode:2-dnode:2' / monitor 1 "; const char* msg3 = "invalid dnode ep"; @@ -5722,7 +5755,7 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) { char msg[512] = {0}; if (pCreate->walLevel != -1 && (pCreate->walLevel < TSDB_MIN_WAL_LEVEL || pCreate->walLevel > TSDB_MAX_WAL_LEVEL)) { - snprintf(msg, tListLen(msg), "invalid db option walLevel: %d, only 0-2 allowed", pCreate->walLevel); + snprintf(msg, tListLen(msg), "invalid db option walLevel: %d, only 1-2 allowed", pCreate->walLevel); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index 244bb8116452fac495f2d140b8b3d8b3e8d96eeb..1e841c68fdad040e53b41ca749dd686c4cbb5e2e 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -170,6 +170,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size pTableMeta->sversion = pTableMetaMsg->sversion; pTableMeta->tversion = pTableMetaMsg->tversion; + tstrncpy(pTableMeta->sTableId, pTableMetaMsg->sTableId, TSDB_TABLE_FNAME_LEN); memcpy(pTableMeta->schema, pTableMetaMsg->schema, schemaSize); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index ddbee3106d890abdc18db907d43c3a528ecba286..8eaa406bce95a4831a80366e62b34efea0cc2a5a 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2093,6 +2093,9 @@ int tscProcessAlterDbMsgRsp(SSqlObj *pSql) { UNUSED(pSql); return 0; } +int tscProcessShowCreateRsp(SSqlObj *pSql) { + return tscLocalResultCommonBuilder(pSql, 1); +} int tscProcessQueryRsp(SSqlObj *pSql) { SSqlRes *pRes = &pSql->res; @@ -2379,6 +2382,10 @@ void tscInitMsgsFp() { tscProcessMsgRsp[TSDB_SQL_ALTER_TABLE] = tscProcessAlterTableMsgRsp; tscProcessMsgRsp[TSDB_SQL_ALTER_DB] = tscProcessAlterDbMsgRsp; + tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_TABLE] = tscProcessShowCreateRsp; + tscProcessMsgRsp[TSDB_SQL_SHOW_CREATE_DATABASE] = tscProcessShowCreateRsp; + + tscKeepConn[TSDB_SQL_SHOW] = 1; tscKeepConn[TSDB_SQL_RETRIEVE] = 1; tscKeepConn[TSDB_SQL_SELECT] = 1; diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 8b79b0278be10d682588d1e1cf6161c081157345..e1a07fdcfe7f9ff2e24ae9f6469bad181dd0786f 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -477,6 +477,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { pCmd->command == TSDB_SQL_TABLE_JOIN_RETRIEVE || pCmd->command == TSDB_SQL_FETCH || pCmd->command == TSDB_SQL_SHOW || + pCmd->command == TSDB_SQL_SHOW_CREATE_TABLE || + pCmd->command == TSDB_SQL_SHOW_CREATE_DATABASE || pCmd->command == TSDB_SQL_SELECT || pCmd->command == TSDB_SQL_DESCRIBE_TABLE || pCmd->command == TSDB_SQL_SERV_STATUS || diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index fed9caebbe078edffa8a5458416b52eca19a380e..35cd09a0336dbb3580d4025aed363fc65acaf4b7 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -136,7 +136,6 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) { etime = pStream->stime + (etime - pStream->stime) / pStream->interval.interval * pStream->interval.interval; } else { etime = taosTimeTruncate(etime, &pStream->interval, pStream->precision); - //etime = taosGetIntervalStartTimestamp(etime, pStream->interval.sliding, pStream->interval.sliding, pStream->interval.slidingUnit, pStream->precision); } pQueryInfo->window.ekey = etime; if (pQueryInfo->window.skey >= pQueryInfo->window.ekey) { @@ -454,17 +453,11 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in } } else { // timewindow based aggregation stream if (stime == 0) { // no data in meter till now - stime = pQueryInfo->window.skey; - if (stime == INT64_MIN) { - stime = (int64_t)taosGetTimestamp(pStream->precision); - stime = taosTimeTruncate(stime, &pStream->interval, pStream->precision); - stime = taosTimeTruncate(stime - 1, &pStream->interval, pStream->precision); - //stime = taosGetIntervalStartTimestamp(stime, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision); - //stime = taosGetIntervalStartTimestamp(stime - 1, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision); - tscWarn("%p stream:%p, last timestamp:0, reset to:%" PRId64, pSql, pStream, stime); + if (pQueryInfo->window.skey != INT64_MIN) { + stime = pQueryInfo->window.skey; } + stime = taosTimeTruncate(stime, &pStream->interval, pStream->precision); } else { - //int64_t newStime = taosGetIntervalStartTimestamp(stime, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision); int64_t newStime = taosTimeTruncate(stime, &pStream->interval, pStream->precision); if (newStime != stime) { tscWarn("%p stream:%p, last timestamp:%" PRId64 ", reset to:%" PRId64, pSql, pStream, stime, newStime); @@ -477,8 +470,10 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in } static int64_t tscGetLaunchTimestamp(const SSqlStream *pStream) { - int64_t timer = pStream->stime - taosGetTimestamp(pStream->precision); - if (timer < 0) timer = 0; + int64_t timer = 0, now = taosGetTimestamp(pStream->precision); + if (pStream->stime > now) { + timer = pStream->stime - now; + } int64_t startDelay = (pStream->precision == TSDB_TIME_PRECISION_MICRO) ? tsStreamCompStartDelay * 1000L : tsStreamCompStartDelay; diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index e66b361191ba6d81f762a5cba9bf3b511f4b57bf..390c3ca92d3b8398d6ca88f11d0c6e45f3f77010 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -23,6 +23,7 @@ #include "tscSubquery.h" #include "tschemautil.h" #include "tsclient.h" +#include "tscSubquery.h" typedef struct SInsertSupporter { SSubqueryState* pState; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 7387c23e1fd8ab96f4d35de36ea0e59ce8f274af..7f445344b1ce334d82ce57102728f47773f86a90 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1268,6 +1268,51 @@ static int32_t validateQuoteToken(SStrToken* pToken) { return TSDB_CODE_SUCCESS; } +void tscDequoteAndTrimToken(SStrToken* pToken) { + assert(pToken->type == TK_STRING); + + uint32_t first = 0, last = pToken->n; + + // trim leading spaces + while (first < last) { + char c = pToken->z[first]; + if (c != ' ' && c != '\t') { + break; + } + first++; + } + + // trim ending spaces + while (first < last) { + char c = pToken->z[last - 1]; + if (c != ' ' && c != '\t') { + break; + } + last--; + } + + // there are still at least two characters + if (first < last - 1) { + char c = pToken->z[first]; + // dequote + if ((c == '\'' || c == '"') && c == pToken->z[last - 1]) { + first++; + last--; + } + } + + // left shift the string and pad spaces + for (uint32_t i = 0; i + first < last; i++) { + pToken->z[i] = pToken->z[first + i]; + } + for (uint32_t i = last - first; i < pToken->n; i++) { + pToken->z[i] = ' '; + } + + // adjust token length + pToken->n = last - first; +} + int32_t tscValidateName(SStrToken* pToken) { if (pToken->type != TK_STRING && pToken->type != TK_ID) { return TSDB_CODE_TSC_INVALID_SQL; @@ -1751,6 +1796,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm SSqlCmd* pCmd = &pNew->cmd; pCmd->command = cmd; pCmd->parseFinished = 1; + pCmd->autoCreated = pSql->cmd.autoCreated; if (tscAddSubqueryInfo(pCmd) != TSDB_CODE_SUCCESS) { tscFreeSqlObj(pNew); @@ -1869,7 +1915,6 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void pNew->pTscObj = pSql->pTscObj; pNew->signature = pNew; - T_REF_INC(pNew->pTscObj); pNew->sqlstr = strdup(pSql->sqlstr); if (pNew->sqlstr == NULL) { diff --git a/src/common/inc/tcmdtype.h b/src/common/inc/tcmdtype.h index 90fb5bf47854313a67e395eea7b99a992a579889..69bbccd67e79eb77e3afd0523dec765e53a5cfa1 100644 --- a/src/common/inc/tcmdtype.h +++ b/src/common/inc/tcmdtype.h @@ -78,6 +78,9 @@ enum { TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_LOCALMERGE, "retrieve-localmerge" ) TSDB_DEFINE_SQL_TYPE( TSDB_SQL_TABLE_JOIN_RETRIEVE, "join-retrieve" ) + TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW_CREATE_TABLE, "show-create-table") + TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW_CREATE_DATABASE, "show-create-database") + /* * build empty result instead of accessing dnode to fetch result * reset the client cache diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 94ec6fde0fef0c0caf8e4c167bd738a306bcd346..a75e712f387cd684486147449adcdfe357a54d67 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -131,7 +131,7 @@ uint16_t tsHttpPort = 6041; // only tcp, range tcp[6041] int32_t tsHttpCacheSessions = 1000; int32_t tsHttpSessionExpire = 36000; int32_t tsHttpMaxThreads = 2; -int32_t tsHttpEnableCompress = 0; +int32_t tsHttpEnableCompress = 1; int32_t tsHttpEnableRecordSql = 0; int32_t tsTelegrafUseFieldNum = 0; diff --git a/src/connector/go b/src/connector/go index 8c58c512b6acda8bcdfa48fdc7140227b5221766..06ec30a0f1762e8169bf6b9045c82bcaa52bcdf0 160000 --- a/src/connector/go +++ b/src/connector/go @@ -1 +1 @@ -Subproject commit 8c58c512b6acda8bcdfa48fdc7140227b5221766 +Subproject commit 06ec30a0f1762e8169bf6b9045c82bcaa52bcdf0 diff --git a/src/connector/jdbc/deploy-pom.xml b/src/connector/jdbc/deploy-pom.xml index 766a58f9babe3e4eec8b482b937378be6b8f0943..3f6ebeff03f538e4963540e015c7fd4b310acc42 100755 --- a/src/connector/jdbc/deploy-pom.xml +++ b/src/connector/jdbc/deploy-pom.xml @@ -5,10 +5,9 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.0-SNAPSHOT + 2.0.6 jar - JDBCDriver https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc TDengine JDBC Driver diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java index bc649a31e1e4c56289284885a73469695ae4eae2..13be9d538d99a2af89e5870afdab7e3e6b8004e8 100755 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java @@ -291,8 +291,8 @@ public class TSDBDriver implements java.sql.Driver { return null; } - String lowerUrl = url.toLowerCase(); - if (!lowerUrl.startsWith(URL_PREFIX) && !lowerUrl.startsWith(URL_PREFIX1)) { +// String lowerUrl = url.toLowerCase(); + if (!url.startsWith(URL_PREFIX) && !url.startsWith(URL_PREFIX1)) { return null; } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index e49e2caca1faed014a79281da4812f791f898e82..50b31a86ccd743b0e56c85e50628f9574bfc8c8e 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -673,6 +673,7 @@ typedef struct { typedef struct STableMetaMsg { int32_t contLen; char tableId[TSDB_TABLE_FNAME_LEN]; // table id + char sTableId[TSDB_TABLE_FNAME_LEN]; uint8_t numOfTags; uint8_t precision; uint8_t tableType; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index c5831a9b8a708c8913bcb374e0c88baa947160e7..a94cdaad15a5c2abe35b7a02502ff8ae95102cd9 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -16,6 +16,7 @@ #ifndef TDENGINE_TTOKENDEF_H #define TDENGINE_TTOKENDEF_H + #define TK_ID 1 #define TK_BOOL 2 #define TK_TINYINT 3 @@ -75,24 +76,24 @@ #define TK_VNODES 57 #define TK_IPTOKEN 58 #define TK_DOT 59 -#define TK_TABLES 60 -#define TK_STABLES 61 -#define TK_VGROUPS 62 -#define TK_DROP 63 -#define TK_TABLE 64 -#define TK_DATABASE 65 -#define TK_DNODE 66 -#define TK_USER 67 -#define TK_ACCOUNT 68 -#define TK_USE 69 -#define TK_DESCRIBE 70 -#define TK_ALTER 71 -#define TK_PASS 72 -#define TK_PRIVILEGE 73 -#define TK_LOCAL 74 -#define TK_IF 75 -#define TK_EXISTS 76 -#define TK_CREATE 77 +#define TK_CREATE 60 +#define TK_TABLE 61 +#define TK_DATABASE 62 +#define TK_TABLES 63 +#define TK_STABLES 64 +#define TK_VGROUPS 65 +#define TK_DROP 66 +#define TK_DNODE 67 +#define TK_USER 68 +#define TK_ACCOUNT 69 +#define TK_USE 70 +#define TK_DESCRIBE 71 +#define TK_ALTER 72 +#define TK_PASS 73 +#define TK_PRIVILEGE 74 +#define TK_LOCAL 75 +#define TK_IF 76 +#define TK_EXISTS 77 #define TK_PPS 78 #define TK_TSERIES 79 #define TK_DBS 80 @@ -222,7 +223,6 @@ #define TK_INTO 204 #define TK_VALUES 205 - #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/inc/twal.h b/src/inc/twal.h index 4fdb7aa275d539ae63129e038c4ae50f59552e1f..cf570aefdc50f26944706f4eddb1d44364986bca 100644 --- a/src/inc/twal.h +++ b/src/inc/twal.h @@ -44,6 +44,7 @@ typedef void* twalh; // WAL HANDLE typedef int (*FWalWrite)(void *ahandle, void *pHead, int type); twalh walOpen(const char *path, const SWalCfg *pCfg); +int walAlter(twalh pWal, const SWalCfg *pCfg); void walClose(twalh); int walRenew(twalh); int walWrite(twalh, SWalHead *); diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 54c049d242c504eee095120f800e023095b8eda6..8558350950de3892e30fac80514177ed3f76f886 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -910,13 +910,13 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { } if (walLevel > 0 && walLevel != pDb->cfg.walLevel) { - mError("db:%s, can't alter walLevel option", pDb->name); - terrno = TSDB_CODE_MND_INVALID_DB_OPTION; + mDebug("db:%s, walLevel:%d change to %d", pDb->name, pDb->cfg.walLevel, walLevel); + newCfg.walLevel = walLevel; } if (fsyncPeriod >= 0 && fsyncPeriod != pDb->cfg.fsyncPeriod) { - mError("db:%s, can't alter fsyncPeriod option", pDb->name); - terrno = TSDB_CODE_MND_INVALID_DB_OPTION; + mDebug("db:%s, fsyncPeriod:%d change to %d", pDb->name, pDb->cfg.fsyncPeriod, fsyncPeriod); + newCfg.fsyncPeriod = fsyncPeriod; } if (replications > 0 && replications != pDb->cfg.replications) { diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index a35f09cd8dfd9e4a447175775bae025770f61e4c..43b80f65c8808bab8f8f452148b1e16d957ef9f9 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -1384,6 +1384,9 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, } pShow->numOfReads += numOfRows; + const int32_t NUM_OF_COLUMNS = 5; + + mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); mnodeDecDbRef(pDb); return numOfRows; @@ -2090,6 +2093,9 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) { pMeta->precision = pDb->cfg.precision; pMeta->tableType = pTable->info.type; tstrncpy(pMeta->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN); + if (pTable->superTable) { + tstrncpy(pMeta->sTableId, pTable->superTable->info.tableId, TSDB_TABLE_FNAME_LEN); + } if (pTable->info.type == TSDB_CHILD_TABLE) { pMeta->sversion = htons(pTable->superTable->sversion); diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index aa6631ff837010e9fffb3663b5b50a57c61b557c..9345bdae2c30e67129ac43bb817db3e8a9a93403 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -660,13 +660,13 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p for (int32_t i = 0; i < pShow->maxReplica; ++i) { pShow->bytes[cols] = 2; pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT; - strcpy(pSchema[cols].name, "dnode"); + snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "dnode%d", i + 1); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "vstatus"); + snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%dstatus", i + 1); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; } diff --git a/src/plugins/http/inc/httpJson.h b/src/plugins/http/inc/httpJson.h index ac0a632137256af96de8503775e5a34fc81b1f1c..fcb74253b99c0cd8921d981e3ba7a4a027bf2b31 100644 --- a/src/plugins/http/inc/httpJson.h +++ b/src/plugins/http/inc/httpJson.h @@ -19,7 +19,7 @@ #include #include -#define JSON_BUFFER_SIZE 10240 +#define JSON_BUFFER_SIZE 16384 struct HttpContext; enum { JsonNumber, JsonString, JsonBoolean, JsonArray, JsonObject, JsonNull }; diff --git a/src/plugins/http/src/httpJson.c b/src/plugins/http/src/httpJson.c index e9a8947df2650a590bc7c7cd0f12c5d6c8a4dd20..7600fb3e43af236c59a5afea0a4ad981019b2b32 100644 --- a/src/plugins/http/src/httpJson.c +++ b/src/plugins/http/src/httpJson.c @@ -52,12 +52,12 @@ int32_t httpWriteBufByFd(struct HttpContext* pContext, const char* buf, int32_t } if (len < 0) { - httpDebug("context:%p, fd:%d, socket write errno:%d, times:%d", pContext, pContext->fd, errno, countWait); + httpDebug("context:%p, fd:%d, socket write errno:%d:%s, times:%d", pContext, pContext->fd, errno, strerror(errno), countWait); if (++countWait > HTTP_WRITE_RETRY_TIMES) break; taosMsleep(HTTP_WRITE_WAIT_TIME_MS); continue; } else if (len == 0) { - httpDebug("context:%p, fd:%d, socket write errno:%d, connect already closed", pContext, pContext->fd, errno); + httpDebug("context:%p, fd:%d, socket write errno:%d:%s, connect already closed", pContext, pContext->fd, errno, strerror(errno)); break; } else { countWait = 0; @@ -131,14 +131,14 @@ int32_t httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) { httpWriteBufNoTrace(buf->pContext, sLen, len); remain = httpWriteBufNoTrace(buf->pContext, (const char*)compressBuf, compressBufLen); } else { - httpTrace("context:%p, fd:%d, last:%d, compress already dumped, response:\n%s", buf->pContext, + httpDebug("context:%p, fd:%d, last:%d, compress already dumped, response:\n%s", buf->pContext, buf->pContext->fd, isTheLast, buf->buf); - return 0; // there is no data to dump. + remain = 0; // there is no data to dump. } } else { httpError("context:%p, fd:%d, failed to compress data, chunkSize:%" PRIu64 ", last:%d, error:%d, response:\n%s", buf->pContext, buf->pContext->fd, srcLen, isTheLast, ret, buf->buf); - return 0; + remain = 0; } } diff --git a/src/plugins/http/src/httpUtil.c b/src/plugins/http/src/httpUtil.c index 2c8879f8804828fdd9de268ab1b6348df3a6b77c..39168ee96dc0ef83dc329614f63543d2c6c7fdfa 100644 --- a/src/plugins/http/src/httpUtil.c +++ b/src/plugins/http/src/httpUtil.c @@ -406,15 +406,21 @@ int32_t httpGzipCompressInit(HttpContext *pContext) { int32_t httpGzipCompress(HttpContext *pContext, char *srcData, int32_t nSrcData, char *destData, int32_t *nDestData, bool isTheLast) { int32_t err = 0; + int32_t lastTotalLen = (int32_t) (pContext->gzipStream.total_out); pContext->gzipStream.next_in = (Bytef *) srcData; pContext->gzipStream.avail_in = (uLong) nSrcData; pContext->gzipStream.next_out = (Bytef *) destData; pContext->gzipStream.avail_out = (uLong) (*nDestData); - while (pContext->gzipStream.avail_in != 0 && pContext->gzipStream.total_out < (uLong) (*nDestData)) { + while (pContext->gzipStream.avail_in != 0) { if (deflate(&pContext->gzipStream, Z_FULL_FLUSH) != Z_OK) { return -1; } + + int32_t cacheLen = pContext->gzipStream.total_out - lastTotalLen; + if (cacheLen >= *nDestData) { + return -2; + } } if (pContext->gzipStream.avail_in != 0) { @@ -427,16 +433,16 @@ int32_t httpGzipCompress(HttpContext *pContext, char *srcData, int32_t nSrcData, break; } if (err != Z_OK) { - return -2; + return -3; } } if (deflateEnd(&pContext->gzipStream) != Z_OK) { - return -3; + return -4; } } - *nDestData = (int32_t) (pContext->gzipStream.total_out); + *nDestData = (int32_t) (pContext->gzipStream.total_out) - lastTotalLen; return 0; } diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 8a5b9d61e2e06768622eedc45b7bd02d3cb14c70..e5d1185330a47b79fec1becd74a01ed779db8c80 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -80,6 +80,7 @@ cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); cmd ::= SHOW VNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); } cmd ::= SHOW VNODES IPTOKEN(X). { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, &X, 0); } + %type dbPrefix {SStrToken} dbPrefix(A) ::=. {A.n = 0; A.type = 0;} dbPrefix(A) ::= ids(X) DOT. {A = X; } @@ -88,6 +89,15 @@ dbPrefix(A) ::= ids(X) DOT. {A = X; } cpxName(A) ::= . {A.n = 0; } cpxName(A) ::= DOT ids(Y). {A = Y; A.n += 1; } +cmd ::= SHOW CREATE TABLE ids(X) cpxName(Y). { + X.n += Y.n; + setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_TABLE, 1, &X); +} + +cmd ::= SHOW CREATE DATABASE ids(X). { + setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &X); +} + cmd ::= SHOW dbPrefix(X) TABLES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &X, 0); } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 3145f39a5e1ca11af517882cb5e7e23b6d1efb26..a18efdeb744ba039c685d5fc1067c95e3ca15d86 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,7 +23,6 @@ ** input grammar file: */ #include -#include /************ Begin %include sections from the grammar ************************/ #include @@ -77,10 +76,8 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser -** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -100,56 +97,48 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 270 +#define YYNOCODE 272 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - int yy112; - SCreateDBInfo yy118; - tVariantList* yy156; - tSQLExprList* yy158; - tSQLExpr* yy190; - SSubclauseInfo* yy333; - SIntervalVal yy340; - TAOS_FIELD yy343; - int64_t yy369; - SCreateTableSQL* yy398; - SLimitVal yy414; - SQuerySQL* yy444; - SCreateAcctSQL yy479; - tVariant yy506; - tFieldList* yy511; + SSubclauseInfo* yy25; + tSQLExpr* yy66; + SCreateAcctSQL yy73; + int yy82; + SQuerySQL* yy150; + SCreateDBInfo yy158; + TAOS_FIELD yy181; + SLimitVal yy188; + tSQLExprList* yy224; + int64_t yy271; + tVariant yy312; + SIntervalVal yy314; + SCreateTableSQL* yy374; + tFieldList* yy449; + tVariantList* yy494; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_PARAM ,pInfo -#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; -#define ParseARG_STORE yypParser->pInfo=pInfo; -#define ParseCTX_SDECL -#define ParseCTX_PDECL -#define ParseCTX_PARAM -#define ParseCTX_FETCH -#define ParseCTX_STORE +#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo +#define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 -#define YYNSTATE 248 -#define YYNRULE 228 -#define YYNRULE_WITH_ACTION 228 +#define YYNSTATE 252 +#define YYNRULE 230 #define YYNTOKEN 206 -#define YY_MAX_SHIFT 247 -#define YY_MIN_SHIFTREDUCE 410 -#define YY_MAX_SHIFTREDUCE 637 -#define YY_ERROR_ACTION 638 -#define YY_ACCEPT_ACTION 639 -#define YY_NO_ACTION 640 -#define YY_MIN_REDUCE 641 -#define YY_MAX_REDUCE 868 +#define YY_MAX_SHIFT 251 +#define YY_MIN_SHIFTREDUCE 416 +#define YY_MAX_SHIFTREDUCE 645 +#define YY_ERROR_ACTION 646 +#define YY_ACCEPT_ACTION 647 +#define YY_NO_ACTION 648 +#define YY_MIN_REDUCE 649 +#define YY_MAX_REDUCE 878 /************* End control #defines *******************************************/ -#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -214,219 +203,223 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (560) +#define YY_ACTTAB_COUNT (566) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 741, 451, 11, 739, 740, 639, 247, 451, 742, 452, - /* 10 */ 744, 745, 743, 35, 36, 452, 37, 38, 156, 245, - /* 20 */ 167, 29, 138, 137, 202, 41, 39, 43, 40, 106, - /* 30 */ 517, 162, 856, 34, 33, 782, 138, 32, 31, 30, - /* 40 */ 35, 36, 771, 37, 38, 161, 856, 167, 29, 771, - /* 50 */ 106, 202, 41, 39, 43, 40, 187, 159, 223, 222, - /* 60 */ 34, 33, 138, 157, 32, 31, 30, 35, 36, 451, - /* 70 */ 37, 38, 855, 142, 167, 29, 760, 452, 202, 41, - /* 80 */ 39, 43, 40, 199, 78, 60, 779, 34, 33, 234, - /* 90 */ 234, 32, 31, 30, 21, 41, 39, 43, 40, 32, - /* 100 */ 31, 30, 56, 34, 33, 852, 808, 32, 31, 30, - /* 110 */ 21, 21, 106, 411, 412, 413, 414, 415, 416, 417, - /* 120 */ 418, 419, 420, 421, 422, 246, 591, 171, 36, 757, - /* 130 */ 37, 38, 225, 50, 167, 29, 21, 62, 202, 41, - /* 140 */ 39, 43, 40, 172, 221, 757, 757, 34, 33, 27, - /* 150 */ 51, 32, 31, 30, 8, 37, 38, 63, 116, 167, - /* 160 */ 29, 101, 758, 202, 41, 39, 43, 40, 809, 226, - /* 170 */ 197, 757, 34, 33, 170, 851, 32, 31, 30, 16, - /* 180 */ 214, 240, 239, 213, 212, 211, 238, 210, 237, 236, - /* 190 */ 235, 209, 737, 760, 725, 726, 727, 728, 729, 730, - /* 200 */ 731, 732, 733, 734, 735, 736, 166, 604, 12, 241, - /* 210 */ 595, 17, 598, 190, 601, 559, 166, 604, 26, 103, - /* 220 */ 595, 597, 598, 600, 601, 34, 33, 151, 760, 32, - /* 230 */ 31, 30, 21, 90, 89, 145, 572, 573, 163, 164, - /* 240 */ 173, 150, 201, 76, 80, 85, 88, 79, 163, 164, - /* 250 */ 166, 604, 549, 82, 595, 106, 598, 100, 601, 244, - /* 260 */ 243, 97, 17, 16, 26, 240, 239, 756, 680, 26, - /* 270 */ 238, 129, 237, 236, 235, 119, 120, 70, 66, 69, - /* 280 */ 203, 165, 163, 164, 689, 533, 180, 129, 530, 186, - /* 290 */ 531, 850, 532, 184, 183, 596, 153, 599, 133, 131, - /* 300 */ 93, 92, 91, 42, 174, 546, 681, 220, 219, 129, - /* 310 */ 18, 61, 541, 42, 603, 593, 175, 176, 563, 189, - /* 320 */ 3, 47, 46, 537, 603, 538, 564, 623, 605, 602, - /* 330 */ 14, 13, 13, 154, 523, 75, 74, 522, 46, 602, - /* 340 */ 48, 22, 207, 535, 155, 536, 22, 42, 10, 9, - /* 350 */ 140, 594, 87, 86, 141, 143, 144, 148, 603, 149, - /* 360 */ 147, 136, 146, 139, 865, 759, 819, 818, 168, 607, - /* 370 */ 815, 814, 169, 602, 751, 224, 781, 773, 786, 788, - /* 380 */ 102, 801, 117, 800, 115, 118, 26, 534, 188, 691, - /* 390 */ 208, 134, 24, 217, 688, 218, 864, 72, 863, 861, - /* 400 */ 121, 95, 709, 25, 23, 135, 678, 81, 558, 676, - /* 410 */ 83, 191, 84, 674, 158, 673, 195, 177, 130, 671, - /* 420 */ 52, 670, 770, 669, 49, 44, 668, 107, 108, 200, - /* 430 */ 667, 194, 659, 132, 665, 663, 198, 196, 192, 661, - /* 440 */ 28, 57, 58, 802, 216, 77, 227, 228, 229, 230, - /* 450 */ 231, 232, 205, 233, 242, 53, 637, 178, 179, 636, - /* 460 */ 152, 64, 67, 182, 181, 672, 635, 628, 94, 96, - /* 470 */ 185, 666, 124, 55, 123, 710, 122, 125, 126, 128, - /* 480 */ 127, 1, 2, 189, 755, 543, 59, 560, 111, 109, - /* 490 */ 112, 110, 104, 113, 114, 160, 19, 193, 5, 565, - /* 500 */ 105, 6, 606, 4, 20, 15, 204, 7, 608, 65, - /* 510 */ 206, 492, 488, 486, 485, 484, 481, 455, 215, 68, - /* 520 */ 45, 71, 22, 519, 73, 518, 516, 54, 476, 474, - /* 530 */ 466, 472, 468, 470, 464, 462, 491, 490, 489, 487, - /* 540 */ 483, 482, 46, 453, 426, 424, 641, 640, 640, 640, - /* 550 */ 640, 640, 640, 640, 640, 640, 640, 640, 98, 99, + /* 0 */ 751, 459, 11, 749, 750, 647, 251, 459, 752, 460, + /* 10 */ 754, 755, 753, 35, 36, 460, 37, 38, 159, 249, + /* 20 */ 170, 29, 141, 459, 206, 41, 39, 43, 40, 140, + /* 30 */ 145, 460, 865, 34, 33, 862, 141, 32, 31, 30, + /* 40 */ 35, 36, 781, 37, 38, 165, 866, 170, 29, 141, + /* 50 */ 62, 206, 41, 39, 43, 40, 191, 525, 164, 866, + /* 60 */ 34, 33, 27, 21, 32, 31, 30, 417, 418, 419, + /* 70 */ 420, 421, 422, 423, 424, 425, 426, 427, 428, 250, + /* 80 */ 35, 36, 181, 37, 38, 227, 226, 170, 29, 781, + /* 90 */ 176, 206, 41, 39, 43, 40, 174, 162, 767, 792, + /* 100 */ 34, 33, 56, 160, 32, 31, 30, 21, 36, 8, + /* 110 */ 37, 38, 63, 118, 170, 29, 770, 108, 206, 41, + /* 120 */ 39, 43, 40, 32, 31, 30, 599, 34, 33, 78, + /* 130 */ 875, 32, 31, 30, 238, 37, 38, 108, 238, 170, + /* 140 */ 29, 184, 766, 206, 41, 39, 43, 40, 188, 187, + /* 150 */ 789, 177, 34, 33, 224, 223, 32, 31, 30, 16, + /* 160 */ 218, 244, 243, 217, 216, 215, 242, 214, 241, 240, + /* 170 */ 239, 213, 747, 818, 735, 736, 737, 738, 739, 740, + /* 180 */ 741, 742, 743, 744, 745, 746, 169, 612, 103, 12, + /* 190 */ 603, 17, 606, 819, 609, 201, 169, 612, 26, 108, + /* 200 */ 603, 108, 606, 861, 609, 153, 169, 612, 173, 567, + /* 210 */ 603, 154, 606, 105, 609, 90, 89, 148, 166, 167, + /* 220 */ 34, 33, 205, 102, 32, 31, 30, 770, 166, 167, + /* 230 */ 26, 21, 557, 41, 39, 43, 40, 549, 166, 167, + /* 240 */ 194, 34, 33, 17, 193, 32, 31, 30, 860, 16, + /* 250 */ 26, 244, 243, 203, 21, 60, 242, 61, 241, 240, + /* 260 */ 239, 248, 247, 96, 175, 229, 767, 76, 80, 245, + /* 270 */ 190, 554, 21, 85, 88, 79, 18, 156, 121, 122, + /* 280 */ 605, 82, 608, 42, 70, 66, 69, 225, 770, 767, + /* 290 */ 135, 133, 601, 42, 611, 768, 93, 92, 91, 690, + /* 300 */ 168, 207, 131, 42, 611, 230, 545, 767, 546, 610, + /* 310 */ 699, 157, 691, 131, 611, 131, 604, 541, 607, 610, + /* 320 */ 538, 571, 539, 47, 540, 46, 580, 581, 602, 610, + /* 330 */ 572, 631, 613, 50, 14, 13, 13, 531, 543, 3, + /* 340 */ 544, 46, 48, 530, 75, 74, 811, 22, 178, 179, + /* 350 */ 51, 211, 10, 9, 829, 22, 87, 86, 101, 99, + /* 360 */ 158, 143, 144, 146, 147, 151, 152, 150, 139, 149, + /* 370 */ 769, 142, 828, 171, 825, 824, 172, 791, 761, 796, + /* 380 */ 228, 783, 798, 104, 810, 119, 120, 701, 117, 212, + /* 390 */ 615, 137, 24, 221, 698, 26, 222, 192, 874, 72, + /* 400 */ 873, 871, 123, 719, 25, 100, 23, 138, 566, 688, + /* 410 */ 81, 686, 83, 84, 684, 195, 780, 683, 161, 542, + /* 420 */ 180, 199, 132, 681, 680, 679, 52, 49, 678, 677, + /* 430 */ 109, 134, 44, 675, 204, 673, 671, 669, 667, 202, + /* 440 */ 200, 198, 196, 28, 136, 220, 57, 58, 812, 77, + /* 450 */ 231, 232, 233, 234, 235, 236, 237, 246, 209, 645, + /* 460 */ 53, 182, 183, 644, 110, 64, 67, 155, 186, 185, + /* 470 */ 682, 643, 94, 636, 676, 189, 126, 125, 720, 124, + /* 480 */ 127, 128, 130, 129, 95, 668, 1, 551, 193, 765, + /* 490 */ 2, 55, 113, 111, 114, 112, 115, 116, 59, 568, + /* 500 */ 163, 106, 197, 5, 573, 107, 6, 65, 614, 19, + /* 510 */ 4, 20, 15, 208, 616, 7, 210, 500, 496, 494, + /* 520 */ 493, 492, 489, 463, 219, 68, 45, 71, 73, 22, + /* 530 */ 527, 526, 524, 54, 484, 482, 474, 480, 476, 478, + /* 540 */ 472, 470, 499, 498, 497, 495, 491, 490, 46, 461, + /* 550 */ 432, 430, 649, 648, 648, 648, 648, 648, 648, 648, + /* 560 */ 648, 648, 648, 648, 97, 98, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 225, 1, 259, 228, 229, 206, 207, 1, 233, 9, - /* 10 */ 235, 236, 237, 13, 14, 9, 16, 17, 208, 209, - /* 20 */ 20, 21, 259, 259, 24, 25, 26, 27, 28, 209, - /* 30 */ 5, 268, 269, 33, 34, 209, 259, 37, 38, 39, - /* 40 */ 13, 14, 243, 16, 17, 268, 269, 20, 21, 243, - /* 50 */ 209, 24, 25, 26, 27, 28, 257, 226, 33, 34, - /* 60 */ 33, 34, 259, 257, 37, 38, 39, 13, 14, 1, - /* 70 */ 16, 17, 269, 259, 20, 21, 245, 9, 24, 25, - /* 80 */ 26, 27, 28, 263, 72, 265, 260, 33, 34, 78, - /* 90 */ 78, 37, 38, 39, 209, 25, 26, 27, 28, 37, - /* 100 */ 38, 39, 102, 33, 34, 259, 265, 37, 38, 39, - /* 110 */ 209, 209, 209, 45, 46, 47, 48, 49, 50, 51, - /* 120 */ 52, 53, 54, 55, 56, 57, 99, 242, 14, 244, - /* 130 */ 16, 17, 209, 103, 20, 21, 209, 246, 24, 25, - /* 140 */ 26, 27, 28, 242, 242, 244, 244, 33, 34, 258, - /* 150 */ 120, 37, 38, 39, 98, 16, 17, 101, 102, 20, - /* 160 */ 21, 209, 239, 24, 25, 26, 27, 28, 265, 242, - /* 170 */ 267, 244, 33, 34, 226, 259, 37, 38, 39, 85, - /* 180 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 190 */ 96, 97, 225, 245, 227, 228, 229, 230, 231, 232, - /* 200 */ 233, 234, 235, 236, 237, 238, 1, 2, 44, 226, - /* 210 */ 5, 98, 7, 261, 9, 99, 1, 2, 105, 103, - /* 220 */ 5, 5, 7, 7, 9, 33, 34, 63, 245, 37, - /* 230 */ 38, 39, 209, 69, 70, 71, 115, 116, 33, 34, - /* 240 */ 63, 77, 37, 64, 65, 66, 67, 68, 33, 34, - /* 250 */ 1, 2, 37, 74, 5, 209, 7, 98, 9, 60, - /* 260 */ 61, 62, 98, 85, 105, 87, 88, 244, 213, 105, - /* 270 */ 92, 216, 94, 95, 96, 64, 65, 66, 67, 68, - /* 280 */ 15, 59, 33, 34, 213, 2, 126, 216, 5, 125, - /* 290 */ 7, 259, 9, 133, 134, 5, 132, 7, 64, 65, - /* 300 */ 66, 67, 68, 98, 127, 103, 213, 130, 131, 216, - /* 310 */ 108, 265, 99, 98, 109, 1, 33, 34, 99, 106, - /* 320 */ 98, 103, 103, 5, 109, 7, 99, 99, 99, 124, - /* 330 */ 103, 103, 103, 259, 99, 128, 129, 99, 103, 124, - /* 340 */ 122, 103, 99, 5, 259, 7, 103, 98, 128, 129, - /* 350 */ 259, 37, 72, 73, 259, 259, 259, 259, 109, 259, - /* 360 */ 259, 259, 259, 259, 245, 245, 240, 240, 240, 104, - /* 370 */ 240, 240, 240, 124, 241, 240, 209, 243, 209, 209, - /* 380 */ 209, 266, 209, 266, 247, 209, 105, 104, 243, 209, - /* 390 */ 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - /* 400 */ 209, 59, 209, 209, 209, 209, 209, 209, 109, 209, - /* 410 */ 209, 262, 209, 209, 262, 209, 262, 209, 209, 209, - /* 420 */ 119, 209, 256, 209, 121, 118, 209, 255, 254, 113, - /* 430 */ 209, 111, 209, 209, 209, 209, 117, 112, 110, 209, - /* 440 */ 123, 210, 210, 210, 75, 84, 83, 49, 80, 82, - /* 450 */ 53, 81, 210, 79, 75, 210, 5, 135, 5, 5, - /* 460 */ 210, 214, 214, 5, 135, 210, 5, 86, 211, 211, - /* 470 */ 126, 210, 218, 107, 222, 224, 223, 221, 219, 217, - /* 480 */ 220, 215, 212, 106, 243, 99, 103, 99, 251, 253, - /* 490 */ 250, 252, 98, 249, 248, 1, 103, 98, 114, 99, - /* 500 */ 98, 114, 99, 98, 103, 98, 100, 98, 104, 72, - /* 510 */ 100, 9, 5, 5, 5, 5, 5, 76, 15, 72, - /* 520 */ 16, 129, 103, 5, 129, 5, 99, 98, 5, 5, - /* 530 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 540 */ 5, 5, 103, 76, 59, 58, 0, 270, 270, 270, - /* 550 */ 270, 270, 270, 270, 270, 270, 270, 270, 21, 21, - /* 560 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 570 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 580 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 590 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 600 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 610 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 620 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 630 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 640 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 650 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 660 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 670 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 680 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 690 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 700 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 710 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 720 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 730 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 740 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 750 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 760 */ 270, 270, 270, 270, 270, 270, + /* 0 */ 226, 1, 260, 229, 230, 207, 208, 1, 234, 9, + /* 10 */ 236, 237, 238, 13, 14, 9, 16, 17, 209, 210, + /* 20 */ 20, 21, 260, 1, 24, 25, 26, 27, 28, 260, + /* 30 */ 260, 9, 270, 33, 34, 260, 260, 37, 38, 39, + /* 40 */ 13, 14, 244, 16, 17, 269, 270, 20, 21, 260, + /* 50 */ 247, 24, 25, 26, 27, 28, 258, 5, 269, 270, + /* 60 */ 33, 34, 259, 210, 37, 38, 39, 45, 46, 47, + /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 80 */ 13, 14, 60, 16, 17, 33, 34, 20, 21, 244, + /* 90 */ 66, 24, 25, 26, 27, 28, 243, 227, 245, 210, + /* 100 */ 33, 34, 102, 258, 37, 38, 39, 210, 14, 98, + /* 110 */ 16, 17, 101, 102, 20, 21, 246, 210, 24, 25, + /* 120 */ 26, 27, 28, 37, 38, 39, 99, 33, 34, 73, + /* 130 */ 246, 37, 38, 39, 78, 16, 17, 210, 78, 20, + /* 140 */ 21, 126, 245, 24, 25, 26, 27, 28, 133, 134, + /* 150 */ 261, 127, 33, 34, 130, 131, 37, 38, 39, 85, + /* 160 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + /* 170 */ 96, 97, 226, 266, 228, 229, 230, 231, 232, 233, + /* 180 */ 234, 235, 236, 237, 238, 239, 1, 2, 210, 44, + /* 190 */ 5, 98, 7, 266, 9, 268, 1, 2, 105, 210, + /* 200 */ 5, 210, 7, 260, 9, 60, 1, 2, 227, 99, + /* 210 */ 5, 66, 7, 103, 9, 70, 71, 72, 33, 34, + /* 220 */ 33, 34, 37, 98, 37, 38, 39, 246, 33, 34, + /* 230 */ 105, 210, 37, 25, 26, 27, 28, 99, 33, 34, + /* 240 */ 262, 33, 34, 98, 106, 37, 38, 39, 260, 85, + /* 250 */ 105, 87, 88, 264, 210, 266, 92, 266, 94, 95, + /* 260 */ 96, 63, 64, 65, 243, 210, 245, 61, 62, 227, + /* 270 */ 125, 103, 210, 67, 68, 69, 108, 132, 61, 62, + /* 280 */ 5, 75, 7, 98, 67, 68, 69, 243, 246, 245, + /* 290 */ 61, 62, 1, 98, 109, 240, 67, 68, 69, 214, + /* 300 */ 59, 15, 217, 98, 109, 243, 5, 245, 7, 124, + /* 310 */ 214, 260, 214, 217, 109, 217, 5, 2, 7, 124, + /* 320 */ 5, 99, 7, 103, 9, 103, 115, 116, 37, 124, + /* 330 */ 99, 99, 99, 103, 103, 103, 103, 99, 5, 98, + /* 340 */ 7, 103, 122, 99, 128, 129, 267, 103, 33, 34, + /* 350 */ 120, 99, 128, 129, 241, 103, 73, 74, 61, 62, + /* 360 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + /* 370 */ 246, 260, 241, 241, 241, 241, 241, 210, 242, 210, + /* 380 */ 241, 244, 210, 210, 267, 210, 210, 210, 248, 210, + /* 390 */ 104, 210, 210, 210, 210, 105, 210, 244, 210, 210, + /* 400 */ 210, 210, 210, 210, 210, 59, 210, 210, 109, 210, + /* 410 */ 210, 210, 210, 210, 210, 263, 257, 210, 263, 104, + /* 420 */ 210, 263, 210, 210, 210, 210, 119, 121, 210, 210, + /* 430 */ 256, 210, 118, 210, 113, 210, 210, 210, 210, 117, + /* 440 */ 112, 111, 110, 123, 210, 76, 211, 211, 211, 84, + /* 450 */ 83, 49, 80, 82, 53, 81, 79, 76, 211, 5, + /* 460 */ 211, 135, 5, 5, 255, 215, 215, 211, 5, 135, + /* 470 */ 211, 5, 212, 86, 211, 126, 219, 223, 225, 224, + /* 480 */ 222, 220, 218, 221, 212, 211, 216, 99, 106, 244, + /* 490 */ 213, 107, 252, 254, 251, 253, 250, 249, 103, 99, + /* 500 */ 1, 98, 98, 114, 99, 98, 114, 73, 99, 103, + /* 510 */ 98, 103, 98, 100, 104, 98, 100, 9, 5, 5, + /* 520 */ 5, 5, 5, 77, 15, 73, 16, 129, 129, 103, + /* 530 */ 5, 5, 99, 98, 5, 5, 5, 5, 5, 5, + /* 540 */ 5, 5, 5, 5, 5, 5, 5, 5, 103, 77, + /* 550 */ 59, 58, 0, 271, 271, 271, 271, 271, 271, 271, + /* 560 */ 271, 271, 271, 271, 21, 21, 271, 271, 271, 271, + /* 570 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 580 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 590 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 600 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 610 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 620 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 630 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 640 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 650 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 660 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 670 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 680 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 690 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 700 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 710 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 720 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 730 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 740 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 750 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 760 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 770 */ 271, 271, }; -#define YY_SHIFT_COUNT (247) +#define YY_SHIFT_COUNT (251) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (546) +#define YY_SHIFT_MAX (552) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 164, 94, 178, 205, 249, 6, 6, 6, 6, 6, - /* 10 */ 6, 0, 68, 249, 283, 283, 283, 113, 6, 6, - /* 20 */ 6, 6, 6, 12, 11, 11, 560, 215, 249, 249, - /* 30 */ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - /* 40 */ 249, 249, 249, 249, 249, 283, 283, 25, 25, 25, - /* 50 */ 25, 25, 25, 56, 25, 159, 6, 6, 6, 6, - /* 60 */ 121, 121, 202, 6, 6, 6, 6, 6, 6, 6, + /* 0 */ 145, 74, 164, 185, 205, 6, 6, 6, 6, 6, + /* 10 */ 6, 0, 22, 205, 315, 315, 315, 93, 6, 6, + /* 20 */ 6, 6, 6, 56, 60, 60, 566, 195, 205, 205, + /* 30 */ 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + /* 40 */ 205, 205, 205, 205, 205, 315, 315, 52, 52, 52, + /* 50 */ 52, 52, 52, 11, 52, 125, 6, 6, 6, 6, + /* 60 */ 211, 211, 168, 6, 6, 6, 6, 6, 6, 6, /* 70 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 80 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 90 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - /* 100 */ 281, 342, 342, 299, 299, 299, 342, 301, 303, 307, - /* 110 */ 316, 319, 325, 320, 328, 317, 281, 342, 342, 369, - /* 120 */ 369, 342, 361, 363, 398, 368, 367, 397, 370, 374, - /* 130 */ 342, 379, 342, 379, 560, 560, 27, 54, 54, 54, - /* 140 */ 114, 139, 70, 70, 70, 179, 192, 192, 192, 192, - /* 150 */ 211, 234, 177, 160, 62, 62, 199, 213, 116, 219, - /* 160 */ 227, 228, 229, 216, 290, 314, 222, 265, 218, 30, - /* 170 */ 235, 238, 243, 207, 220, 318, 338, 280, 451, 322, - /* 180 */ 453, 454, 329, 458, 461, 381, 344, 377, 386, 366, - /* 190 */ 383, 388, 394, 494, 399, 400, 402, 393, 384, 401, - /* 200 */ 387, 403, 405, 404, 407, 406, 409, 410, 437, 502, - /* 210 */ 507, 508, 509, 510, 511, 441, 503, 447, 504, 392, - /* 220 */ 395, 419, 518, 520, 427, 429, 419, 523, 524, 525, - /* 230 */ 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, - /* 240 */ 536, 439, 467, 537, 538, 485, 487, 546, + /* 100 */ 6, 6, 290, 346, 346, 299, 299, 299, 346, 307, + /* 110 */ 306, 314, 321, 322, 328, 330, 332, 320, 290, 346, + /* 120 */ 346, 369, 369, 346, 365, 367, 402, 372, 371, 401, + /* 130 */ 374, 377, 346, 381, 346, 381, 346, 566, 566, 27, + /* 140 */ 67, 67, 67, 94, 119, 208, 208, 208, 206, 187, + /* 150 */ 187, 187, 187, 217, 229, 24, 15, 86, 86, 198, + /* 160 */ 138, 110, 222, 231, 232, 233, 275, 311, 291, 241, + /* 170 */ 286, 220, 230, 238, 244, 252, 216, 224, 301, 333, + /* 180 */ 283, 297, 454, 326, 457, 458, 334, 463, 466, 387, + /* 190 */ 349, 382, 388, 384, 395, 400, 403, 499, 404, 405, + /* 200 */ 407, 406, 389, 408, 392, 409, 412, 410, 414, 413, + /* 210 */ 417, 416, 434, 508, 513, 514, 515, 516, 517, 446, + /* 220 */ 509, 452, 510, 398, 399, 426, 525, 526, 433, 435, + /* 230 */ 426, 529, 530, 531, 532, 533, 534, 535, 536, 537, + /* 240 */ 538, 539, 540, 541, 542, 445, 472, 543, 544, 491, + /* 250 */ 493, 552, }; -#define YY_REDUCE_COUNT (135) -#define YY_REDUCE_MIN (-257) -#define YY_REDUCE_MAX (270) +#define YY_REDUCE_COUNT (138) +#define YY_REDUCE_MIN (-258) +#define YY_REDUCE_MAX (277) static const short yy_reduce_ofst[] = { - /* 0 */ -201, -33, -225, -237, -223, -97, -180, -115, -99, -98, - /* 10 */ -73, -174, -190, -197, -169, -52, -17, -194, -48, -159, - /* 20 */ 46, -77, 23, 55, 71, 93, -109, -257, -236, -186, - /* 30 */ -154, -84, 32, 74, 85, 91, 95, 96, 97, 98, - /* 40 */ 100, 101, 102, 103, 104, 119, 120, 126, 127, 128, - /* 50 */ 130, 131, 132, 133, 135, 134, 167, 169, 170, 171, - /* 60 */ 115, 117, 137, 173, 176, 180, 181, 182, 183, 184, - /* 70 */ 185, 186, 187, 188, 189, 190, 191, 193, 194, 195, - /* 80 */ 196, 197, 198, 200, 201, 203, 204, 206, 208, 209, - /* 90 */ 210, 212, 214, 217, 221, 223, 224, 225, 226, 230, - /* 100 */ 145, 231, 232, 149, 152, 154, 233, 166, 172, 174, - /* 110 */ 236, 239, 237, 240, 244, 246, 241, 242, 245, 247, - /* 120 */ 248, 250, 251, 253, 252, 254, 256, 259, 260, 262, - /* 130 */ 255, 257, 261, 258, 266, 270, + /* 0 */ -202, -54, -226, -224, -211, -73, -11, -147, 21, 44, + /* 10 */ 62, -111, -191, -238, -130, -19, 42, -155, -22, -93, + /* 20 */ -9, 55, -103, 85, 96, 98, -197, -258, -231, -230, + /* 30 */ -225, -57, -12, 51, 100, 101, 102, 103, 104, 105, + /* 40 */ 106, 107, 108, 109, 111, -116, 124, 113, 131, 132, + /* 50 */ 133, 134, 135, 136, 139, 137, 167, 169, 172, 173, + /* 60 */ 79, 117, 140, 175, 176, 177, 179, 181, 182, 183, + /* 70 */ 184, 186, 188, 189, 190, 191, 192, 193, 194, 196, + /* 80 */ 197, 199, 200, 201, 202, 203, 204, 207, 210, 212, + /* 90 */ 213, 214, 215, 218, 219, 221, 223, 225, 226, 227, + /* 100 */ 228, 234, 153, 235, 236, 152, 155, 158, 237, 159, + /* 110 */ 174, 209, 239, 242, 240, 243, 246, 248, 245, 247, + /* 120 */ 249, 250, 251, 256, 253, 255, 254, 257, 258, 261, + /* 130 */ 262, 264, 259, 260, 263, 272, 274, 270, 277, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 638, 690, 679, 858, 858, 638, 638, 638, 638, 638, - /* 10 */ 638, 783, 656, 858, 638, 638, 638, 638, 638, 638, - /* 20 */ 638, 638, 638, 692, 692, 692, 778, 638, 638, 638, - /* 30 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 40 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 50 */ 638, 638, 638, 638, 638, 638, 638, 785, 787, 638, - /* 60 */ 805, 805, 776, 638, 638, 638, 638, 638, 638, 638, - /* 70 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 80 */ 638, 677, 638, 675, 638, 638, 638, 638, 638, 638, - /* 90 */ 638, 638, 638, 638, 638, 638, 638, 664, 638, 638, - /* 100 */ 638, 658, 658, 638, 638, 638, 658, 812, 816, 810, - /* 110 */ 798, 806, 797, 793, 792, 820, 638, 658, 658, 687, - /* 120 */ 687, 658, 708, 706, 704, 696, 702, 698, 700, 694, - /* 130 */ 658, 685, 658, 685, 724, 738, 638, 821, 857, 811, - /* 140 */ 847, 846, 853, 845, 844, 638, 840, 841, 843, 842, - /* 150 */ 638, 638, 638, 638, 849, 848, 638, 638, 638, 638, - /* 160 */ 638, 638, 638, 638, 638, 638, 823, 638, 817, 813, - /* 170 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 180 */ 638, 638, 638, 638, 638, 638, 638, 775, 638, 638, - /* 190 */ 784, 638, 638, 638, 638, 638, 638, 807, 638, 799, - /* 200 */ 638, 638, 638, 638, 638, 638, 638, 752, 638, 638, - /* 210 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 220 */ 638, 862, 638, 638, 638, 746, 860, 638, 638, 638, - /* 230 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, - /* 240 */ 638, 711, 638, 662, 660, 638, 654, 638, + /* 0 */ 646, 700, 689, 868, 868, 646, 646, 646, 646, 646, + /* 10 */ 646, 793, 664, 868, 646, 646, 646, 646, 646, 646, + /* 20 */ 646, 646, 646, 702, 702, 702, 788, 646, 646, 646, + /* 30 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, + /* 40 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, + /* 50 */ 646, 646, 646, 646, 646, 646, 646, 795, 797, 646, + /* 60 */ 815, 815, 786, 646, 646, 646, 646, 646, 646, 646, + /* 70 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, + /* 80 */ 646, 687, 646, 685, 646, 646, 646, 646, 646, 646, + /* 90 */ 646, 646, 646, 646, 646, 646, 674, 646, 646, 646, + /* 100 */ 646, 646, 646, 666, 666, 646, 646, 646, 666, 822, + /* 110 */ 826, 820, 808, 816, 807, 803, 802, 830, 646, 666, + /* 120 */ 666, 697, 697, 666, 718, 716, 714, 706, 712, 708, + /* 130 */ 710, 704, 666, 695, 666, 695, 666, 734, 748, 646, + /* 140 */ 831, 867, 821, 857, 856, 863, 855, 854, 646, 850, + /* 150 */ 851, 853, 852, 646, 646, 646, 646, 859, 858, 646, + /* 160 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 833, + /* 170 */ 646, 827, 823, 646, 646, 646, 646, 646, 646, 646, + /* 180 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, + /* 190 */ 646, 785, 646, 646, 794, 646, 646, 646, 646, 646, + /* 200 */ 646, 817, 646, 809, 646, 646, 646, 646, 646, 646, + /* 210 */ 646, 762, 646, 646, 646, 646, 646, 646, 646, 646, + /* 220 */ 646, 646, 646, 646, 646, 872, 646, 646, 646, 756, + /* 230 */ 870, 646, 646, 646, 646, 646, 646, 646, 646, 646, + /* 240 */ 646, 646, 646, 646, 646, 721, 646, 672, 670, 646, + /* 250 */ 662, 646, }; /********** End of lemon-generated parsing tables *****************************/ @@ -506,12 +499,13 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 1, /* IPTOKEN => ID */ 0, /* DOT => nothing */ + 0, /* CREATE => nothing */ + 0, /* TABLE => nothing */ + 1, /* DATABASE => ID */ 0, /* TABLES => nothing */ 0, /* STABLES => nothing */ 0, /* VGROUPS => nothing */ 0, /* DROP => nothing */ - 0, /* TABLE => nothing */ - 1, /* DATABASE => ID */ 0, /* DNODE => nothing */ 0, /* USER => nothing */ 0, /* ACCOUNT => nothing */ @@ -523,7 +517,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* LOCAL => nothing */ 0, /* IF => nothing */ 0, /* EXISTS => nothing */ - 0, /* CREATE => nothing */ 0, /* PPS => nothing */ 0, /* TSERIES => nothing */ 0, /* DBS => nothing */ @@ -691,7 +684,6 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ - ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -799,24 +791,24 @@ static const char *const yyTokenName[] = { /* 57 */ "VNODES", /* 58 */ "IPTOKEN", /* 59 */ "DOT", - /* 60 */ "TABLES", - /* 61 */ "STABLES", - /* 62 */ "VGROUPS", - /* 63 */ "DROP", - /* 64 */ "TABLE", - /* 65 */ "DATABASE", - /* 66 */ "DNODE", - /* 67 */ "USER", - /* 68 */ "ACCOUNT", - /* 69 */ "USE", - /* 70 */ "DESCRIBE", - /* 71 */ "ALTER", - /* 72 */ "PASS", - /* 73 */ "PRIVILEGE", - /* 74 */ "LOCAL", - /* 75 */ "IF", - /* 76 */ "EXISTS", - /* 77 */ "CREATE", + /* 60 */ "CREATE", + /* 61 */ "TABLE", + /* 62 */ "DATABASE", + /* 63 */ "TABLES", + /* 64 */ "STABLES", + /* 65 */ "VGROUPS", + /* 66 */ "DROP", + /* 67 */ "DNODE", + /* 68 */ "USER", + /* 69 */ "ACCOUNT", + /* 70 */ "USE", + /* 71 */ "DESCRIBE", + /* 72 */ "ALTER", + /* 73 */ "PASS", + /* 74 */ "PRIVILEGE", + /* 75 */ "LOCAL", + /* 76 */ "IF", + /* 77 */ "EXISTS", /* 78 */ "PPS", /* 79 */ "TSERIES", /* 80 */ "DBS", @@ -945,70 +937,71 @@ static const char *const yyTokenName[] = { /* 203 */ "INSERT", /* 204 */ "INTO", /* 205 */ "VALUES", - /* 206 */ "program", - /* 207 */ "cmd", - /* 208 */ "dbPrefix", - /* 209 */ "ids", - /* 210 */ "cpxName", - /* 211 */ "ifexists", - /* 212 */ "alter_db_optr", - /* 213 */ "acct_optr", - /* 214 */ "ifnotexists", - /* 215 */ "db_optr", - /* 216 */ "pps", - /* 217 */ "tseries", - /* 218 */ "dbs", - /* 219 */ "streams", - /* 220 */ "storage", - /* 221 */ "qtime", - /* 222 */ "users", - /* 223 */ "conns", - /* 224 */ "state", - /* 225 */ "keep", - /* 226 */ "tagitemlist", - /* 227 */ "cache", - /* 228 */ "replica", - /* 229 */ "quorum", - /* 230 */ "days", - /* 231 */ "minrows", - /* 232 */ "maxrows", - /* 233 */ "blocks", - /* 234 */ "ctime", - /* 235 */ "wal", - /* 236 */ "fsync", - /* 237 */ "comp", - /* 238 */ "prec", - /* 239 */ "typename", - /* 240 */ "signed", - /* 241 */ "create_table_args", - /* 242 */ "columnlist", - /* 243 */ "select", - /* 244 */ "column", - /* 245 */ "tagitem", - /* 246 */ "selcollist", - /* 247 */ "from", - /* 248 */ "where_opt", - /* 249 */ "interval_opt", - /* 250 */ "fill_opt", - /* 251 */ "sliding_opt", - /* 252 */ "groupby_opt", - /* 253 */ "orderby_opt", - /* 254 */ "having_opt", - /* 255 */ "slimit_opt", - /* 256 */ "limit_opt", - /* 257 */ "union", - /* 258 */ "sclp", - /* 259 */ "expr", - /* 260 */ "as", - /* 261 */ "tablelist", - /* 262 */ "tmvar", - /* 263 */ "sortlist", - /* 264 */ "sortitem", - /* 265 */ "item", - /* 266 */ "sortorder", - /* 267 */ "grouplist", - /* 268 */ "exprlist", - /* 269 */ "expritem", + /* 206 */ "error", + /* 207 */ "program", + /* 208 */ "cmd", + /* 209 */ "dbPrefix", + /* 210 */ "ids", + /* 211 */ "cpxName", + /* 212 */ "ifexists", + /* 213 */ "alter_db_optr", + /* 214 */ "acct_optr", + /* 215 */ "ifnotexists", + /* 216 */ "db_optr", + /* 217 */ "pps", + /* 218 */ "tseries", + /* 219 */ "dbs", + /* 220 */ "streams", + /* 221 */ "storage", + /* 222 */ "qtime", + /* 223 */ "users", + /* 224 */ "conns", + /* 225 */ "state", + /* 226 */ "keep", + /* 227 */ "tagitemlist", + /* 228 */ "cache", + /* 229 */ "replica", + /* 230 */ "quorum", + /* 231 */ "days", + /* 232 */ "minrows", + /* 233 */ "maxrows", + /* 234 */ "blocks", + /* 235 */ "ctime", + /* 236 */ "wal", + /* 237 */ "fsync", + /* 238 */ "comp", + /* 239 */ "prec", + /* 240 */ "typename", + /* 241 */ "signed", + /* 242 */ "create_table_args", + /* 243 */ "columnlist", + /* 244 */ "select", + /* 245 */ "column", + /* 246 */ "tagitem", + /* 247 */ "selcollist", + /* 248 */ "from", + /* 249 */ "where_opt", + /* 250 */ "interval_opt", + /* 251 */ "fill_opt", + /* 252 */ "sliding_opt", + /* 253 */ "groupby_opt", + /* 254 */ "orderby_opt", + /* 255 */ "having_opt", + /* 256 */ "slimit_opt", + /* 257 */ "limit_opt", + /* 258 */ "union", + /* 259 */ "sclp", + /* 260 */ "expr", + /* 261 */ "as", + /* 262 */ "tablelist", + /* 263 */ "tmvar", + /* 264 */ "sortlist", + /* 265 */ "sortitem", + /* 266 */ "item", + /* 267 */ "sortorder", + /* 268 */ "grouplist", + /* 269 */ "exprlist", + /* 270 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1035,215 +1028,217 @@ static const char *const yyRuleName[] = { /* 16 */ "dbPrefix ::= ids DOT", /* 17 */ "cpxName ::=", /* 18 */ "cpxName ::= DOT ids", - /* 19 */ "cmd ::= SHOW dbPrefix TABLES", - /* 20 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids", - /* 21 */ "cmd ::= SHOW dbPrefix STABLES", - /* 22 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids", - /* 23 */ "cmd ::= SHOW dbPrefix VGROUPS", - /* 24 */ "cmd ::= SHOW dbPrefix VGROUPS ids", - /* 25 */ "cmd ::= DROP TABLE ifexists ids cpxName", - /* 26 */ "cmd ::= DROP DATABASE ifexists ids", - /* 27 */ "cmd ::= DROP DNODE ids", - /* 28 */ "cmd ::= DROP USER ids", - /* 29 */ "cmd ::= DROP ACCOUNT ids", - /* 30 */ "cmd ::= USE ids", - /* 31 */ "cmd ::= DESCRIBE ids cpxName", - /* 32 */ "cmd ::= ALTER USER ids PASS ids", - /* 33 */ "cmd ::= ALTER USER ids PRIVILEGE ids", - /* 34 */ "cmd ::= ALTER DNODE ids ids", - /* 35 */ "cmd ::= ALTER DNODE ids ids ids", - /* 36 */ "cmd ::= ALTER LOCAL ids", - /* 37 */ "cmd ::= ALTER LOCAL ids ids", - /* 38 */ "cmd ::= ALTER DATABASE ids alter_db_optr", - /* 39 */ "cmd ::= ALTER ACCOUNT ids acct_optr", - /* 40 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr", - /* 41 */ "ids ::= ID", - /* 42 */ "ids ::= STRING", - /* 43 */ "ifexists ::= IF EXISTS", - /* 44 */ "ifexists ::=", - /* 45 */ "ifnotexists ::= IF NOT EXISTS", - /* 46 */ "ifnotexists ::=", - /* 47 */ "cmd ::= CREATE DNODE ids", - /* 48 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr", - /* 49 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr", - /* 50 */ "cmd ::= CREATE USER ids PASS ids", - /* 51 */ "pps ::=", - /* 52 */ "pps ::= PPS INTEGER", - /* 53 */ "tseries ::=", - /* 54 */ "tseries ::= TSERIES INTEGER", - /* 55 */ "dbs ::=", - /* 56 */ "dbs ::= DBS INTEGER", - /* 57 */ "streams ::=", - /* 58 */ "streams ::= STREAMS INTEGER", - /* 59 */ "storage ::=", - /* 60 */ "storage ::= STORAGE INTEGER", - /* 61 */ "qtime ::=", - /* 62 */ "qtime ::= QTIME INTEGER", - /* 63 */ "users ::=", - /* 64 */ "users ::= USERS INTEGER", - /* 65 */ "conns ::=", - /* 66 */ "conns ::= CONNS INTEGER", - /* 67 */ "state ::=", - /* 68 */ "state ::= STATE ids", - /* 69 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state", - /* 70 */ "keep ::= KEEP tagitemlist", - /* 71 */ "cache ::= CACHE INTEGER", - /* 72 */ "replica ::= REPLICA INTEGER", - /* 73 */ "quorum ::= QUORUM INTEGER", - /* 74 */ "days ::= DAYS INTEGER", - /* 75 */ "minrows ::= MINROWS INTEGER", - /* 76 */ "maxrows ::= MAXROWS INTEGER", - /* 77 */ "blocks ::= BLOCKS INTEGER", - /* 78 */ "ctime ::= CTIME INTEGER", - /* 79 */ "wal ::= WAL INTEGER", - /* 80 */ "fsync ::= FSYNC INTEGER", - /* 81 */ "comp ::= COMP INTEGER", - /* 82 */ "prec ::= PRECISION STRING", - /* 83 */ "db_optr ::=", - /* 84 */ "db_optr ::= db_optr cache", - /* 85 */ "db_optr ::= db_optr replica", - /* 86 */ "db_optr ::= db_optr quorum", - /* 87 */ "db_optr ::= db_optr days", - /* 88 */ "db_optr ::= db_optr minrows", - /* 89 */ "db_optr ::= db_optr maxrows", - /* 90 */ "db_optr ::= db_optr blocks", - /* 91 */ "db_optr ::= db_optr ctime", - /* 92 */ "db_optr ::= db_optr wal", - /* 93 */ "db_optr ::= db_optr fsync", - /* 94 */ "db_optr ::= db_optr comp", - /* 95 */ "db_optr ::= db_optr prec", - /* 96 */ "db_optr ::= db_optr keep", - /* 97 */ "alter_db_optr ::=", - /* 98 */ "alter_db_optr ::= alter_db_optr replica", - /* 99 */ "alter_db_optr ::= alter_db_optr quorum", - /* 100 */ "alter_db_optr ::= alter_db_optr keep", - /* 101 */ "alter_db_optr ::= alter_db_optr blocks", - /* 102 */ "alter_db_optr ::= alter_db_optr comp", - /* 103 */ "alter_db_optr ::= alter_db_optr wal", - /* 104 */ "alter_db_optr ::= alter_db_optr fsync", - /* 105 */ "typename ::= ids", - /* 106 */ "typename ::= ids LP signed RP", - /* 107 */ "signed ::= INTEGER", - /* 108 */ "signed ::= PLUS INTEGER", - /* 109 */ "signed ::= MINUS INTEGER", - /* 110 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args", - /* 111 */ "create_table_args ::= LP columnlist RP", - /* 112 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP", - /* 113 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP", - /* 114 */ "create_table_args ::= AS select", - /* 115 */ "columnlist ::= columnlist COMMA column", - /* 116 */ "columnlist ::= column", - /* 117 */ "column ::= ids typename", - /* 118 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 119 */ "tagitemlist ::= tagitem", - /* 120 */ "tagitem ::= INTEGER", - /* 121 */ "tagitem ::= FLOAT", - /* 122 */ "tagitem ::= STRING", - /* 123 */ "tagitem ::= BOOL", - /* 124 */ "tagitem ::= NULL", - /* 125 */ "tagitem ::= MINUS INTEGER", - /* 126 */ "tagitem ::= MINUS FLOAT", - /* 127 */ "tagitem ::= PLUS INTEGER", - /* 128 */ "tagitem ::= PLUS FLOAT", - /* 129 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", - /* 130 */ "union ::= select", - /* 131 */ "union ::= LP union RP", - /* 132 */ "union ::= union UNION ALL select", - /* 133 */ "union ::= union UNION ALL LP select RP", - /* 134 */ "cmd ::= union", - /* 135 */ "select ::= SELECT selcollist", - /* 136 */ "sclp ::= selcollist COMMA", - /* 137 */ "sclp ::=", - /* 138 */ "selcollist ::= sclp expr as", - /* 139 */ "selcollist ::= sclp STAR", - /* 140 */ "as ::= AS ids", - /* 141 */ "as ::= ids", - /* 142 */ "as ::=", - /* 143 */ "from ::= FROM tablelist", - /* 144 */ "tablelist ::= ids cpxName", - /* 145 */ "tablelist ::= ids cpxName ids", - /* 146 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 147 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 148 */ "tmvar ::= VARIABLE", - /* 149 */ "interval_opt ::= INTERVAL LP tmvar RP", - /* 150 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", - /* 151 */ "interval_opt ::=", - /* 152 */ "fill_opt ::=", - /* 153 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 154 */ "fill_opt ::= FILL LP ID RP", - /* 155 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 156 */ "sliding_opt ::=", - /* 157 */ "orderby_opt ::=", - /* 158 */ "orderby_opt ::= ORDER BY sortlist", - /* 159 */ "sortlist ::= sortlist COMMA item sortorder", - /* 160 */ "sortlist ::= item sortorder", - /* 161 */ "item ::= ids cpxName", - /* 162 */ "sortorder ::= ASC", - /* 163 */ "sortorder ::= DESC", - /* 164 */ "sortorder ::=", - /* 165 */ "groupby_opt ::=", - /* 166 */ "groupby_opt ::= GROUP BY grouplist", - /* 167 */ "grouplist ::= grouplist COMMA item", - /* 168 */ "grouplist ::= item", - /* 169 */ "having_opt ::=", - /* 170 */ "having_opt ::= HAVING expr", - /* 171 */ "limit_opt ::=", - /* 172 */ "limit_opt ::= LIMIT signed", - /* 173 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 174 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 175 */ "slimit_opt ::=", - /* 176 */ "slimit_opt ::= SLIMIT signed", - /* 177 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 178 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 179 */ "where_opt ::=", - /* 180 */ "where_opt ::= WHERE expr", - /* 181 */ "expr ::= LP expr RP", - /* 182 */ "expr ::= ID", - /* 183 */ "expr ::= ID DOT ID", - /* 184 */ "expr ::= ID DOT STAR", - /* 185 */ "expr ::= INTEGER", - /* 186 */ "expr ::= MINUS INTEGER", - /* 187 */ "expr ::= PLUS INTEGER", - /* 188 */ "expr ::= FLOAT", - /* 189 */ "expr ::= MINUS FLOAT", - /* 190 */ "expr ::= PLUS FLOAT", - /* 191 */ "expr ::= STRING", - /* 192 */ "expr ::= NOW", - /* 193 */ "expr ::= VARIABLE", - /* 194 */ "expr ::= BOOL", - /* 195 */ "expr ::= ID LP exprlist RP", - /* 196 */ "expr ::= ID LP STAR RP", - /* 197 */ "expr ::= expr IS NULL", - /* 198 */ "expr ::= expr IS NOT NULL", - /* 199 */ "expr ::= expr LT expr", - /* 200 */ "expr ::= expr GT expr", - /* 201 */ "expr ::= expr LE expr", - /* 202 */ "expr ::= expr GE expr", - /* 203 */ "expr ::= expr NE expr", - /* 204 */ "expr ::= expr EQ expr", - /* 205 */ "expr ::= expr AND expr", - /* 206 */ "expr ::= expr OR expr", - /* 207 */ "expr ::= expr PLUS expr", - /* 208 */ "expr ::= expr MINUS expr", - /* 209 */ "expr ::= expr STAR expr", - /* 210 */ "expr ::= expr SLASH expr", - /* 211 */ "expr ::= expr REM expr", - /* 212 */ "expr ::= expr LIKE expr", - /* 213 */ "expr ::= expr IN LP exprlist RP", - /* 214 */ "exprlist ::= exprlist COMMA expritem", - /* 215 */ "exprlist ::= expritem", - /* 216 */ "expritem ::= expr", - /* 217 */ "expritem ::=", - /* 218 */ "cmd ::= RESET QUERY CACHE", - /* 219 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 220 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 221 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 222 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 223 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 224 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 225 */ "cmd ::= KILL CONNECTION INTEGER", - /* 226 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 227 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 19 */ "cmd ::= SHOW CREATE TABLE ids cpxName", + /* 20 */ "cmd ::= SHOW CREATE DATABASE ids", + /* 21 */ "cmd ::= SHOW dbPrefix TABLES", + /* 22 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids", + /* 23 */ "cmd ::= SHOW dbPrefix STABLES", + /* 24 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids", + /* 25 */ "cmd ::= SHOW dbPrefix VGROUPS", + /* 26 */ "cmd ::= SHOW dbPrefix VGROUPS ids", + /* 27 */ "cmd ::= DROP TABLE ifexists ids cpxName", + /* 28 */ "cmd ::= DROP DATABASE ifexists ids", + /* 29 */ "cmd ::= DROP DNODE ids", + /* 30 */ "cmd ::= DROP USER ids", + /* 31 */ "cmd ::= DROP ACCOUNT ids", + /* 32 */ "cmd ::= USE ids", + /* 33 */ "cmd ::= DESCRIBE ids cpxName", + /* 34 */ "cmd ::= ALTER USER ids PASS ids", + /* 35 */ "cmd ::= ALTER USER ids PRIVILEGE ids", + /* 36 */ "cmd ::= ALTER DNODE ids ids", + /* 37 */ "cmd ::= ALTER DNODE ids ids ids", + /* 38 */ "cmd ::= ALTER LOCAL ids", + /* 39 */ "cmd ::= ALTER LOCAL ids ids", + /* 40 */ "cmd ::= ALTER DATABASE ids alter_db_optr", + /* 41 */ "cmd ::= ALTER ACCOUNT ids acct_optr", + /* 42 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr", + /* 43 */ "ids ::= ID", + /* 44 */ "ids ::= STRING", + /* 45 */ "ifexists ::= IF EXISTS", + /* 46 */ "ifexists ::=", + /* 47 */ "ifnotexists ::= IF NOT EXISTS", + /* 48 */ "ifnotexists ::=", + /* 49 */ "cmd ::= CREATE DNODE ids", + /* 50 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr", + /* 51 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr", + /* 52 */ "cmd ::= CREATE USER ids PASS ids", + /* 53 */ "pps ::=", + /* 54 */ "pps ::= PPS INTEGER", + /* 55 */ "tseries ::=", + /* 56 */ "tseries ::= TSERIES INTEGER", + /* 57 */ "dbs ::=", + /* 58 */ "dbs ::= DBS INTEGER", + /* 59 */ "streams ::=", + /* 60 */ "streams ::= STREAMS INTEGER", + /* 61 */ "storage ::=", + /* 62 */ "storage ::= STORAGE INTEGER", + /* 63 */ "qtime ::=", + /* 64 */ "qtime ::= QTIME INTEGER", + /* 65 */ "users ::=", + /* 66 */ "users ::= USERS INTEGER", + /* 67 */ "conns ::=", + /* 68 */ "conns ::= CONNS INTEGER", + /* 69 */ "state ::=", + /* 70 */ "state ::= STATE ids", + /* 71 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state", + /* 72 */ "keep ::= KEEP tagitemlist", + /* 73 */ "cache ::= CACHE INTEGER", + /* 74 */ "replica ::= REPLICA INTEGER", + /* 75 */ "quorum ::= QUORUM INTEGER", + /* 76 */ "days ::= DAYS INTEGER", + /* 77 */ "minrows ::= MINROWS INTEGER", + /* 78 */ "maxrows ::= MAXROWS INTEGER", + /* 79 */ "blocks ::= BLOCKS INTEGER", + /* 80 */ "ctime ::= CTIME INTEGER", + /* 81 */ "wal ::= WAL INTEGER", + /* 82 */ "fsync ::= FSYNC INTEGER", + /* 83 */ "comp ::= COMP INTEGER", + /* 84 */ "prec ::= PRECISION STRING", + /* 85 */ "db_optr ::=", + /* 86 */ "db_optr ::= db_optr cache", + /* 87 */ "db_optr ::= db_optr replica", + /* 88 */ "db_optr ::= db_optr quorum", + /* 89 */ "db_optr ::= db_optr days", + /* 90 */ "db_optr ::= db_optr minrows", + /* 91 */ "db_optr ::= db_optr maxrows", + /* 92 */ "db_optr ::= db_optr blocks", + /* 93 */ "db_optr ::= db_optr ctime", + /* 94 */ "db_optr ::= db_optr wal", + /* 95 */ "db_optr ::= db_optr fsync", + /* 96 */ "db_optr ::= db_optr comp", + /* 97 */ "db_optr ::= db_optr prec", + /* 98 */ "db_optr ::= db_optr keep", + /* 99 */ "alter_db_optr ::=", + /* 100 */ "alter_db_optr ::= alter_db_optr replica", + /* 101 */ "alter_db_optr ::= alter_db_optr quorum", + /* 102 */ "alter_db_optr ::= alter_db_optr keep", + /* 103 */ "alter_db_optr ::= alter_db_optr blocks", + /* 104 */ "alter_db_optr ::= alter_db_optr comp", + /* 105 */ "alter_db_optr ::= alter_db_optr wal", + /* 106 */ "alter_db_optr ::= alter_db_optr fsync", + /* 107 */ "typename ::= ids", + /* 108 */ "typename ::= ids LP signed RP", + /* 109 */ "signed ::= INTEGER", + /* 110 */ "signed ::= PLUS INTEGER", + /* 111 */ "signed ::= MINUS INTEGER", + /* 112 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args", + /* 113 */ "create_table_args ::= LP columnlist RP", + /* 114 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP", + /* 115 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP", + /* 116 */ "create_table_args ::= AS select", + /* 117 */ "columnlist ::= columnlist COMMA column", + /* 118 */ "columnlist ::= column", + /* 119 */ "column ::= ids typename", + /* 120 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 121 */ "tagitemlist ::= tagitem", + /* 122 */ "tagitem ::= INTEGER", + /* 123 */ "tagitem ::= FLOAT", + /* 124 */ "tagitem ::= STRING", + /* 125 */ "tagitem ::= BOOL", + /* 126 */ "tagitem ::= NULL", + /* 127 */ "tagitem ::= MINUS INTEGER", + /* 128 */ "tagitem ::= MINUS FLOAT", + /* 129 */ "tagitem ::= PLUS INTEGER", + /* 130 */ "tagitem ::= PLUS FLOAT", + /* 131 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", + /* 132 */ "union ::= select", + /* 133 */ "union ::= LP union RP", + /* 134 */ "union ::= union UNION ALL select", + /* 135 */ "union ::= union UNION ALL LP select RP", + /* 136 */ "cmd ::= union", + /* 137 */ "select ::= SELECT selcollist", + /* 138 */ "sclp ::= selcollist COMMA", + /* 139 */ "sclp ::=", + /* 140 */ "selcollist ::= sclp expr as", + /* 141 */ "selcollist ::= sclp STAR", + /* 142 */ "as ::= AS ids", + /* 143 */ "as ::= ids", + /* 144 */ "as ::=", + /* 145 */ "from ::= FROM tablelist", + /* 146 */ "tablelist ::= ids cpxName", + /* 147 */ "tablelist ::= ids cpxName ids", + /* 148 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 149 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 150 */ "tmvar ::= VARIABLE", + /* 151 */ "interval_opt ::= INTERVAL LP tmvar RP", + /* 152 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", + /* 153 */ "interval_opt ::=", + /* 154 */ "fill_opt ::=", + /* 155 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 156 */ "fill_opt ::= FILL LP ID RP", + /* 157 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 158 */ "sliding_opt ::=", + /* 159 */ "orderby_opt ::=", + /* 160 */ "orderby_opt ::= ORDER BY sortlist", + /* 161 */ "sortlist ::= sortlist COMMA item sortorder", + /* 162 */ "sortlist ::= item sortorder", + /* 163 */ "item ::= ids cpxName", + /* 164 */ "sortorder ::= ASC", + /* 165 */ "sortorder ::= DESC", + /* 166 */ "sortorder ::=", + /* 167 */ "groupby_opt ::=", + /* 168 */ "groupby_opt ::= GROUP BY grouplist", + /* 169 */ "grouplist ::= grouplist COMMA item", + /* 170 */ "grouplist ::= item", + /* 171 */ "having_opt ::=", + /* 172 */ "having_opt ::= HAVING expr", + /* 173 */ "limit_opt ::=", + /* 174 */ "limit_opt ::= LIMIT signed", + /* 175 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 176 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 177 */ "slimit_opt ::=", + /* 178 */ "slimit_opt ::= SLIMIT signed", + /* 179 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 180 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 181 */ "where_opt ::=", + /* 182 */ "where_opt ::= WHERE expr", + /* 183 */ "expr ::= LP expr RP", + /* 184 */ "expr ::= ID", + /* 185 */ "expr ::= ID DOT ID", + /* 186 */ "expr ::= ID DOT STAR", + /* 187 */ "expr ::= INTEGER", + /* 188 */ "expr ::= MINUS INTEGER", + /* 189 */ "expr ::= PLUS INTEGER", + /* 190 */ "expr ::= FLOAT", + /* 191 */ "expr ::= MINUS FLOAT", + /* 192 */ "expr ::= PLUS FLOAT", + /* 193 */ "expr ::= STRING", + /* 194 */ "expr ::= NOW", + /* 195 */ "expr ::= VARIABLE", + /* 196 */ "expr ::= BOOL", + /* 197 */ "expr ::= ID LP exprlist RP", + /* 198 */ "expr ::= ID LP STAR RP", + /* 199 */ "expr ::= expr IS NULL", + /* 200 */ "expr ::= expr IS NOT NULL", + /* 201 */ "expr ::= expr LT expr", + /* 202 */ "expr ::= expr GT expr", + /* 203 */ "expr ::= expr LE expr", + /* 204 */ "expr ::= expr GE expr", + /* 205 */ "expr ::= expr NE expr", + /* 206 */ "expr ::= expr EQ expr", + /* 207 */ "expr ::= expr AND expr", + /* 208 */ "expr ::= expr OR expr", + /* 209 */ "expr ::= expr PLUS expr", + /* 210 */ "expr ::= expr MINUS expr", + /* 211 */ "expr ::= expr STAR expr", + /* 212 */ "expr ::= expr SLASH expr", + /* 213 */ "expr ::= expr REM expr", + /* 214 */ "expr ::= expr LIKE expr", + /* 215 */ "expr ::= expr IN LP exprlist RP", + /* 216 */ "exprlist ::= exprlist COMMA expritem", + /* 217 */ "exprlist ::= expritem", + /* 218 */ "expritem ::= expr", + /* 219 */ "expritem ::=", + /* 220 */ "cmd ::= RESET QUERY CACHE", + /* 221 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 222 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 223 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 224 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 225 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 226 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 227 */ "cmd ::= KILL CONNECTION INTEGER", + /* 228 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 229 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1292,29 +1287,28 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypRawParser ParseCTX_PDECL){ - yyParser *yypParser = (yyParser*)yypRawParser; - ParseCTX_STORE +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; #ifdef YYTRACKMAXSTACKDEPTH - yypParser->yyhwm = 0; + pParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - yypParser->yytos = NULL; - yypParser->yystack = NULL; - yypParser->yystksz = 0; - if( yyGrowStack(yypParser) ){ - yypParser->yystack = &yypParser->yystk0; - yypParser->yystksz = 1; + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; + pParser->yyerrcnt = -1; #endif - yypParser->yytos = yypParser->yystack; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1331,14 +1325,11 @@ void ParseInit(void *yypRawParser ParseCTX_PDECL){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ - yyParser *yypParser; - yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( yypParser ){ - ParseCTX_STORE - ParseInit(yypParser ParseCTX_PARAM); - } - return (void*)yypParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1355,8 +1346,7 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1369,50 +1359,50 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 225: /* keep */ - case 226: /* tagitemlist */ - case 250: /* fill_opt */ - case 252: /* groupby_opt */ - case 253: /* orderby_opt */ - case 263: /* sortlist */ - case 267: /* grouplist */ + case 226: /* keep */ + case 227: /* tagitemlist */ + case 251: /* fill_opt */ + case 253: /* groupby_opt */ + case 254: /* orderby_opt */ + case 264: /* sortlist */ + case 268: /* grouplist */ { -tVariantListDestroy((yypminor->yy156)); +tVariantListDestroy((yypminor->yy494)); } break; - case 242: /* columnlist */ + case 243: /* columnlist */ { -tFieldListDestroy((yypminor->yy511)); +tFieldListDestroy((yypminor->yy449)); } break; - case 243: /* select */ + case 244: /* select */ { -doDestroyQuerySql((yypminor->yy444)); +doDestroyQuerySql((yypminor->yy150)); } break; - case 246: /* selcollist */ - case 258: /* sclp */ - case 268: /* exprlist */ + case 247: /* selcollist */ + case 259: /* sclp */ + case 269: /* exprlist */ { -tSQLExprListDestroy((yypminor->yy158)); +tSQLExprListDestroy((yypminor->yy224)); } break; - case 248: /* where_opt */ - case 254: /* having_opt */ - case 259: /* expr */ - case 269: /* expritem */ + case 249: /* where_opt */ + case 255: /* having_opt */ + case 260: /* expr */ + case 270: /* expritem */ { -tSQLExprDestroy((yypminor->yy190)); +tSQLExprDestroy((yypminor->yy66)); } break; - case 257: /* union */ + case 258: /* union */ { -destroyAllSelectClause((yypminor->yy333)); +destroyAllSelectClause((yypminor->yy25)); } break; - case 264: /* sortitem */ + case 265: /* sortitem */ { -tVariantDestroy(&(yypminor->yy506)); +tVariantDestroy(&(yypminor->yy312)); } break; /********* End destructor definitions *****************************************/ @@ -1524,12 +1514,13 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static YYACTIONTYPE yy_find_shift_action( - YYCODETYPE iLookAhead, /* The look-ahead token */ - YYACTIONTYPE stateno /* Current state number */ +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) @@ -1537,19 +1528,15 @@ static YYACTIONTYPE yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", @@ -1564,8 +1551,15 @@ static YYACTIONTYPE yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1579,7 +1573,6 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && iyytos; - yytos->stateno = yyNewState; - yytos->major = yyMajor; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side -** of that rule */ -static const YYCODETYPE yyRuleInfoLhs[] = { - 206, /* (0) program ::= cmd */ - 207, /* (1) cmd ::= SHOW DATABASES */ - 207, /* (2) cmd ::= SHOW MNODES */ - 207, /* (3) cmd ::= SHOW DNODES */ - 207, /* (4) cmd ::= SHOW ACCOUNTS */ - 207, /* (5) cmd ::= SHOW USERS */ - 207, /* (6) cmd ::= SHOW MODULES */ - 207, /* (7) cmd ::= SHOW QUERIES */ - 207, /* (8) cmd ::= SHOW CONNECTIONS */ - 207, /* (9) cmd ::= SHOW STREAMS */ - 207, /* (10) cmd ::= SHOW VARIABLES */ - 207, /* (11) cmd ::= SHOW SCORES */ - 207, /* (12) cmd ::= SHOW GRANTS */ - 207, /* (13) cmd ::= SHOW VNODES */ - 207, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - 208, /* (15) dbPrefix ::= */ - 208, /* (16) dbPrefix ::= ids DOT */ - 210, /* (17) cpxName ::= */ - 210, /* (18) cpxName ::= DOT ids */ - 207, /* (19) cmd ::= SHOW dbPrefix TABLES */ - 207, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - 207, /* (21) cmd ::= SHOW dbPrefix STABLES */ - 207, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - 207, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ - 207, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ - 207, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ - 207, /* (26) cmd ::= DROP DATABASE ifexists ids */ - 207, /* (27) cmd ::= DROP DNODE ids */ - 207, /* (28) cmd ::= DROP USER ids */ - 207, /* (29) cmd ::= DROP ACCOUNT ids */ - 207, /* (30) cmd ::= USE ids */ - 207, /* (31) cmd ::= DESCRIBE ids cpxName */ - 207, /* (32) cmd ::= ALTER USER ids PASS ids */ - 207, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ - 207, /* (34) cmd ::= ALTER DNODE ids ids */ - 207, /* (35) cmd ::= ALTER DNODE ids ids ids */ - 207, /* (36) cmd ::= ALTER LOCAL ids */ - 207, /* (37) cmd ::= ALTER LOCAL ids ids */ - 207, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ - 207, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ - 207, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - 209, /* (41) ids ::= ID */ - 209, /* (42) ids ::= STRING */ - 211, /* (43) ifexists ::= IF EXISTS */ - 211, /* (44) ifexists ::= */ - 214, /* (45) ifnotexists ::= IF NOT EXISTS */ - 214, /* (46) ifnotexists ::= */ - 207, /* (47) cmd ::= CREATE DNODE ids */ - 207, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - 207, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - 207, /* (50) cmd ::= CREATE USER ids PASS ids */ - 216, /* (51) pps ::= */ - 216, /* (52) pps ::= PPS INTEGER */ - 217, /* (53) tseries ::= */ - 217, /* (54) tseries ::= TSERIES INTEGER */ - 218, /* (55) dbs ::= */ - 218, /* (56) dbs ::= DBS INTEGER */ - 219, /* (57) streams ::= */ - 219, /* (58) streams ::= STREAMS INTEGER */ - 220, /* (59) storage ::= */ - 220, /* (60) storage ::= STORAGE INTEGER */ - 221, /* (61) qtime ::= */ - 221, /* (62) qtime ::= QTIME INTEGER */ - 222, /* (63) users ::= */ - 222, /* (64) users ::= USERS INTEGER */ - 223, /* (65) conns ::= */ - 223, /* (66) conns ::= CONNS INTEGER */ - 224, /* (67) state ::= */ - 224, /* (68) state ::= STATE ids */ - 213, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - 225, /* (70) keep ::= KEEP tagitemlist */ - 227, /* (71) cache ::= CACHE INTEGER */ - 228, /* (72) replica ::= REPLICA INTEGER */ - 229, /* (73) quorum ::= QUORUM INTEGER */ - 230, /* (74) days ::= DAYS INTEGER */ - 231, /* (75) minrows ::= MINROWS INTEGER */ - 232, /* (76) maxrows ::= MAXROWS INTEGER */ - 233, /* (77) blocks ::= BLOCKS INTEGER */ - 234, /* (78) ctime ::= CTIME INTEGER */ - 235, /* (79) wal ::= WAL INTEGER */ - 236, /* (80) fsync ::= FSYNC INTEGER */ - 237, /* (81) comp ::= COMP INTEGER */ - 238, /* (82) prec ::= PRECISION STRING */ - 215, /* (83) db_optr ::= */ - 215, /* (84) db_optr ::= db_optr cache */ - 215, /* (85) db_optr ::= db_optr replica */ - 215, /* (86) db_optr ::= db_optr quorum */ - 215, /* (87) db_optr ::= db_optr days */ - 215, /* (88) db_optr ::= db_optr minrows */ - 215, /* (89) db_optr ::= db_optr maxrows */ - 215, /* (90) db_optr ::= db_optr blocks */ - 215, /* (91) db_optr ::= db_optr ctime */ - 215, /* (92) db_optr ::= db_optr wal */ - 215, /* (93) db_optr ::= db_optr fsync */ - 215, /* (94) db_optr ::= db_optr comp */ - 215, /* (95) db_optr ::= db_optr prec */ - 215, /* (96) db_optr ::= db_optr keep */ - 212, /* (97) alter_db_optr ::= */ - 212, /* (98) alter_db_optr ::= alter_db_optr replica */ - 212, /* (99) alter_db_optr ::= alter_db_optr quorum */ - 212, /* (100) alter_db_optr ::= alter_db_optr keep */ - 212, /* (101) alter_db_optr ::= alter_db_optr blocks */ - 212, /* (102) alter_db_optr ::= alter_db_optr comp */ - 212, /* (103) alter_db_optr ::= alter_db_optr wal */ - 212, /* (104) alter_db_optr ::= alter_db_optr fsync */ - 239, /* (105) typename ::= ids */ - 239, /* (106) typename ::= ids LP signed RP */ - 240, /* (107) signed ::= INTEGER */ - 240, /* (108) signed ::= PLUS INTEGER */ - 240, /* (109) signed ::= MINUS INTEGER */ - 207, /* (110) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ - 241, /* (111) create_table_args ::= LP columnlist RP */ - 241, /* (112) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ - 241, /* (113) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ - 241, /* (114) create_table_args ::= AS select */ - 242, /* (115) columnlist ::= columnlist COMMA column */ - 242, /* (116) columnlist ::= column */ - 244, /* (117) column ::= ids typename */ - 226, /* (118) tagitemlist ::= tagitemlist COMMA tagitem */ - 226, /* (119) tagitemlist ::= tagitem */ - 245, /* (120) tagitem ::= INTEGER */ - 245, /* (121) tagitem ::= FLOAT */ - 245, /* (122) tagitem ::= STRING */ - 245, /* (123) tagitem ::= BOOL */ - 245, /* (124) tagitem ::= NULL */ - 245, /* (125) tagitem ::= MINUS INTEGER */ - 245, /* (126) tagitem ::= MINUS FLOAT */ - 245, /* (127) tagitem ::= PLUS INTEGER */ - 245, /* (128) tagitem ::= PLUS FLOAT */ - 243, /* (129) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - 257, /* (130) union ::= select */ - 257, /* (131) union ::= LP union RP */ - 257, /* (132) union ::= union UNION ALL select */ - 257, /* (133) union ::= union UNION ALL LP select RP */ - 207, /* (134) cmd ::= union */ - 243, /* (135) select ::= SELECT selcollist */ - 258, /* (136) sclp ::= selcollist COMMA */ - 258, /* (137) sclp ::= */ - 246, /* (138) selcollist ::= sclp expr as */ - 246, /* (139) selcollist ::= sclp STAR */ - 260, /* (140) as ::= AS ids */ - 260, /* (141) as ::= ids */ - 260, /* (142) as ::= */ - 247, /* (143) from ::= FROM tablelist */ - 261, /* (144) tablelist ::= ids cpxName */ - 261, /* (145) tablelist ::= ids cpxName ids */ - 261, /* (146) tablelist ::= tablelist COMMA ids cpxName */ - 261, /* (147) tablelist ::= tablelist COMMA ids cpxName ids */ - 262, /* (148) tmvar ::= VARIABLE */ - 249, /* (149) interval_opt ::= INTERVAL LP tmvar RP */ - 249, /* (150) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - 249, /* (151) interval_opt ::= */ - 250, /* (152) fill_opt ::= */ - 250, /* (153) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - 250, /* (154) fill_opt ::= FILL LP ID RP */ - 251, /* (155) sliding_opt ::= SLIDING LP tmvar RP */ - 251, /* (156) sliding_opt ::= */ - 253, /* (157) orderby_opt ::= */ - 253, /* (158) orderby_opt ::= ORDER BY sortlist */ - 263, /* (159) sortlist ::= sortlist COMMA item sortorder */ - 263, /* (160) sortlist ::= item sortorder */ - 265, /* (161) item ::= ids cpxName */ - 266, /* (162) sortorder ::= ASC */ - 266, /* (163) sortorder ::= DESC */ - 266, /* (164) sortorder ::= */ - 252, /* (165) groupby_opt ::= */ - 252, /* (166) groupby_opt ::= GROUP BY grouplist */ - 267, /* (167) grouplist ::= grouplist COMMA item */ - 267, /* (168) grouplist ::= item */ - 254, /* (169) having_opt ::= */ - 254, /* (170) having_opt ::= HAVING expr */ - 256, /* (171) limit_opt ::= */ - 256, /* (172) limit_opt ::= LIMIT signed */ - 256, /* (173) limit_opt ::= LIMIT signed OFFSET signed */ - 256, /* (174) limit_opt ::= LIMIT signed COMMA signed */ - 255, /* (175) slimit_opt ::= */ - 255, /* (176) slimit_opt ::= SLIMIT signed */ - 255, /* (177) slimit_opt ::= SLIMIT signed SOFFSET signed */ - 255, /* (178) slimit_opt ::= SLIMIT signed COMMA signed */ - 248, /* (179) where_opt ::= */ - 248, /* (180) where_opt ::= WHERE expr */ - 259, /* (181) expr ::= LP expr RP */ - 259, /* (182) expr ::= ID */ - 259, /* (183) expr ::= ID DOT ID */ - 259, /* (184) expr ::= ID DOT STAR */ - 259, /* (185) expr ::= INTEGER */ - 259, /* (186) expr ::= MINUS INTEGER */ - 259, /* (187) expr ::= PLUS INTEGER */ - 259, /* (188) expr ::= FLOAT */ - 259, /* (189) expr ::= MINUS FLOAT */ - 259, /* (190) expr ::= PLUS FLOAT */ - 259, /* (191) expr ::= STRING */ - 259, /* (192) expr ::= NOW */ - 259, /* (193) expr ::= VARIABLE */ - 259, /* (194) expr ::= BOOL */ - 259, /* (195) expr ::= ID LP exprlist RP */ - 259, /* (196) expr ::= ID LP STAR RP */ - 259, /* (197) expr ::= expr IS NULL */ - 259, /* (198) expr ::= expr IS NOT NULL */ - 259, /* (199) expr ::= expr LT expr */ - 259, /* (200) expr ::= expr GT expr */ - 259, /* (201) expr ::= expr LE expr */ - 259, /* (202) expr ::= expr GE expr */ - 259, /* (203) expr ::= expr NE expr */ - 259, /* (204) expr ::= expr EQ expr */ - 259, /* (205) expr ::= expr AND expr */ - 259, /* (206) expr ::= expr OR expr */ - 259, /* (207) expr ::= expr PLUS expr */ - 259, /* (208) expr ::= expr MINUS expr */ - 259, /* (209) expr ::= expr STAR expr */ - 259, /* (210) expr ::= expr SLASH expr */ - 259, /* (211) expr ::= expr REM expr */ - 259, /* (212) expr ::= expr LIKE expr */ - 259, /* (213) expr ::= expr IN LP exprlist RP */ - 268, /* (214) exprlist ::= exprlist COMMA expritem */ - 268, /* (215) exprlist ::= expritem */ - 269, /* (216) expritem ::= expr */ - 269, /* (217) expritem ::= */ - 207, /* (218) cmd ::= RESET QUERY CACHE */ - 207, /* (219) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 207, /* (220) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 207, /* (221) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 207, /* (222) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 207, /* (223) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 207, /* (224) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 207, /* (225) cmd ::= KILL CONNECTION INTEGER */ - 207, /* (226) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 207, /* (227) cmd ::= KILL QUERY INTEGER COLON INTEGER */ -}; - -/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number -** of symbols on the right-hand side of that rule. */ -static const signed char yyRuleInfoNRhs[] = { - -1, /* (0) program ::= cmd */ - -2, /* (1) cmd ::= SHOW DATABASES */ - -2, /* (2) cmd ::= SHOW MNODES */ - -2, /* (3) cmd ::= SHOW DNODES */ - -2, /* (4) cmd ::= SHOW ACCOUNTS */ - -2, /* (5) cmd ::= SHOW USERS */ - -2, /* (6) cmd ::= SHOW MODULES */ - -2, /* (7) cmd ::= SHOW QUERIES */ - -2, /* (8) cmd ::= SHOW CONNECTIONS */ - -2, /* (9) cmd ::= SHOW STREAMS */ - -2, /* (10) cmd ::= SHOW VARIABLES */ - -2, /* (11) cmd ::= SHOW SCORES */ - -2, /* (12) cmd ::= SHOW GRANTS */ - -2, /* (13) cmd ::= SHOW VNODES */ - -3, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - 0, /* (15) dbPrefix ::= */ - -2, /* (16) dbPrefix ::= ids DOT */ - 0, /* (17) cpxName ::= */ - -2, /* (18) cpxName ::= DOT ids */ - -3, /* (19) cmd ::= SHOW dbPrefix TABLES */ - -5, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - -3, /* (21) cmd ::= SHOW dbPrefix STABLES */ - -5, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - -3, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ - -4, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ - -5, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ - -4, /* (26) cmd ::= DROP DATABASE ifexists ids */ - -3, /* (27) cmd ::= DROP DNODE ids */ - -3, /* (28) cmd ::= DROP USER ids */ - -3, /* (29) cmd ::= DROP ACCOUNT ids */ - -2, /* (30) cmd ::= USE ids */ - -3, /* (31) cmd ::= DESCRIBE ids cpxName */ - -5, /* (32) cmd ::= ALTER USER ids PASS ids */ - -5, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ - -4, /* (34) cmd ::= ALTER DNODE ids ids */ - -5, /* (35) cmd ::= ALTER DNODE ids ids ids */ - -3, /* (36) cmd ::= ALTER LOCAL ids */ - -4, /* (37) cmd ::= ALTER LOCAL ids ids */ - -4, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ - -4, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ - -6, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - -1, /* (41) ids ::= ID */ - -1, /* (42) ids ::= STRING */ - -2, /* (43) ifexists ::= IF EXISTS */ - 0, /* (44) ifexists ::= */ - -3, /* (45) ifnotexists ::= IF NOT EXISTS */ - 0, /* (46) ifnotexists ::= */ - -3, /* (47) cmd ::= CREATE DNODE ids */ - -6, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - -5, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - -5, /* (50) cmd ::= CREATE USER ids PASS ids */ - 0, /* (51) pps ::= */ - -2, /* (52) pps ::= PPS INTEGER */ - 0, /* (53) tseries ::= */ - -2, /* (54) tseries ::= TSERIES INTEGER */ - 0, /* (55) dbs ::= */ - -2, /* (56) dbs ::= DBS INTEGER */ - 0, /* (57) streams ::= */ - -2, /* (58) streams ::= STREAMS INTEGER */ - 0, /* (59) storage ::= */ - -2, /* (60) storage ::= STORAGE INTEGER */ - 0, /* (61) qtime ::= */ - -2, /* (62) qtime ::= QTIME INTEGER */ - 0, /* (63) users ::= */ - -2, /* (64) users ::= USERS INTEGER */ - 0, /* (65) conns ::= */ - -2, /* (66) conns ::= CONNS INTEGER */ - 0, /* (67) state ::= */ - -2, /* (68) state ::= STATE ids */ - -9, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - -2, /* (70) keep ::= KEEP tagitemlist */ - -2, /* (71) cache ::= CACHE INTEGER */ - -2, /* (72) replica ::= REPLICA INTEGER */ - -2, /* (73) quorum ::= QUORUM INTEGER */ - -2, /* (74) days ::= DAYS INTEGER */ - -2, /* (75) minrows ::= MINROWS INTEGER */ - -2, /* (76) maxrows ::= MAXROWS INTEGER */ - -2, /* (77) blocks ::= BLOCKS INTEGER */ - -2, /* (78) ctime ::= CTIME INTEGER */ - -2, /* (79) wal ::= WAL INTEGER */ - -2, /* (80) fsync ::= FSYNC INTEGER */ - -2, /* (81) comp ::= COMP INTEGER */ - -2, /* (82) prec ::= PRECISION STRING */ - 0, /* (83) db_optr ::= */ - -2, /* (84) db_optr ::= db_optr cache */ - -2, /* (85) db_optr ::= db_optr replica */ - -2, /* (86) db_optr ::= db_optr quorum */ - -2, /* (87) db_optr ::= db_optr days */ - -2, /* (88) db_optr ::= db_optr minrows */ - -2, /* (89) db_optr ::= db_optr maxrows */ - -2, /* (90) db_optr ::= db_optr blocks */ - -2, /* (91) db_optr ::= db_optr ctime */ - -2, /* (92) db_optr ::= db_optr wal */ - -2, /* (93) db_optr ::= db_optr fsync */ - -2, /* (94) db_optr ::= db_optr comp */ - -2, /* (95) db_optr ::= db_optr prec */ - -2, /* (96) db_optr ::= db_optr keep */ - 0, /* (97) alter_db_optr ::= */ - -2, /* (98) alter_db_optr ::= alter_db_optr replica */ - -2, /* (99) alter_db_optr ::= alter_db_optr quorum */ - -2, /* (100) alter_db_optr ::= alter_db_optr keep */ - -2, /* (101) alter_db_optr ::= alter_db_optr blocks */ - -2, /* (102) alter_db_optr ::= alter_db_optr comp */ - -2, /* (103) alter_db_optr ::= alter_db_optr wal */ - -2, /* (104) alter_db_optr ::= alter_db_optr fsync */ - -1, /* (105) typename ::= ids */ - -4, /* (106) typename ::= ids LP signed RP */ - -1, /* (107) signed ::= INTEGER */ - -2, /* (108) signed ::= PLUS INTEGER */ - -2, /* (109) signed ::= MINUS INTEGER */ - -6, /* (110) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ - -3, /* (111) create_table_args ::= LP columnlist RP */ - -7, /* (112) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ - -7, /* (113) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ - -2, /* (114) create_table_args ::= AS select */ - -3, /* (115) columnlist ::= columnlist COMMA column */ - -1, /* (116) columnlist ::= column */ - -2, /* (117) column ::= ids typename */ - -3, /* (118) tagitemlist ::= tagitemlist COMMA tagitem */ - -1, /* (119) tagitemlist ::= tagitem */ - -1, /* (120) tagitem ::= INTEGER */ - -1, /* (121) tagitem ::= FLOAT */ - -1, /* (122) tagitem ::= STRING */ - -1, /* (123) tagitem ::= BOOL */ - -1, /* (124) tagitem ::= NULL */ - -2, /* (125) tagitem ::= MINUS INTEGER */ - -2, /* (126) tagitem ::= MINUS FLOAT */ - -2, /* (127) tagitem ::= PLUS INTEGER */ - -2, /* (128) tagitem ::= PLUS FLOAT */ - -12, /* (129) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - -1, /* (130) union ::= select */ - -3, /* (131) union ::= LP union RP */ - -4, /* (132) union ::= union UNION ALL select */ - -6, /* (133) union ::= union UNION ALL LP select RP */ - -1, /* (134) cmd ::= union */ - -2, /* (135) select ::= SELECT selcollist */ - -2, /* (136) sclp ::= selcollist COMMA */ - 0, /* (137) sclp ::= */ - -3, /* (138) selcollist ::= sclp expr as */ - -2, /* (139) selcollist ::= sclp STAR */ - -2, /* (140) as ::= AS ids */ - -1, /* (141) as ::= ids */ - 0, /* (142) as ::= */ - -2, /* (143) from ::= FROM tablelist */ - -2, /* (144) tablelist ::= ids cpxName */ - -3, /* (145) tablelist ::= ids cpxName ids */ - -4, /* (146) tablelist ::= tablelist COMMA ids cpxName */ - -5, /* (147) tablelist ::= tablelist COMMA ids cpxName ids */ - -1, /* (148) tmvar ::= VARIABLE */ - -4, /* (149) interval_opt ::= INTERVAL LP tmvar RP */ - -6, /* (150) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - 0, /* (151) interval_opt ::= */ - 0, /* (152) fill_opt ::= */ - -6, /* (153) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - -4, /* (154) fill_opt ::= FILL LP ID RP */ - -4, /* (155) sliding_opt ::= SLIDING LP tmvar RP */ - 0, /* (156) sliding_opt ::= */ - 0, /* (157) orderby_opt ::= */ - -3, /* (158) orderby_opt ::= ORDER BY sortlist */ - -4, /* (159) sortlist ::= sortlist COMMA item sortorder */ - -2, /* (160) sortlist ::= item sortorder */ - -2, /* (161) item ::= ids cpxName */ - -1, /* (162) sortorder ::= ASC */ - -1, /* (163) sortorder ::= DESC */ - 0, /* (164) sortorder ::= */ - 0, /* (165) groupby_opt ::= */ - -3, /* (166) groupby_opt ::= GROUP BY grouplist */ - -3, /* (167) grouplist ::= grouplist COMMA item */ - -1, /* (168) grouplist ::= item */ - 0, /* (169) having_opt ::= */ - -2, /* (170) having_opt ::= HAVING expr */ - 0, /* (171) limit_opt ::= */ - -2, /* (172) limit_opt ::= LIMIT signed */ - -4, /* (173) limit_opt ::= LIMIT signed OFFSET signed */ - -4, /* (174) limit_opt ::= LIMIT signed COMMA signed */ - 0, /* (175) slimit_opt ::= */ - -2, /* (176) slimit_opt ::= SLIMIT signed */ - -4, /* (177) slimit_opt ::= SLIMIT signed SOFFSET signed */ - -4, /* (178) slimit_opt ::= SLIMIT signed COMMA signed */ - 0, /* (179) where_opt ::= */ - -2, /* (180) where_opt ::= WHERE expr */ - -3, /* (181) expr ::= LP expr RP */ - -1, /* (182) expr ::= ID */ - -3, /* (183) expr ::= ID DOT ID */ - -3, /* (184) expr ::= ID DOT STAR */ - -1, /* (185) expr ::= INTEGER */ - -2, /* (186) expr ::= MINUS INTEGER */ - -2, /* (187) expr ::= PLUS INTEGER */ - -1, /* (188) expr ::= FLOAT */ - -2, /* (189) expr ::= MINUS FLOAT */ - -2, /* (190) expr ::= PLUS FLOAT */ - -1, /* (191) expr ::= STRING */ - -1, /* (192) expr ::= NOW */ - -1, /* (193) expr ::= VARIABLE */ - -1, /* (194) expr ::= BOOL */ - -4, /* (195) expr ::= ID LP exprlist RP */ - -4, /* (196) expr ::= ID LP STAR RP */ - -3, /* (197) expr ::= expr IS NULL */ - -4, /* (198) expr ::= expr IS NOT NULL */ - -3, /* (199) expr ::= expr LT expr */ - -3, /* (200) expr ::= expr GT expr */ - -3, /* (201) expr ::= expr LE expr */ - -3, /* (202) expr ::= expr GE expr */ - -3, /* (203) expr ::= expr NE expr */ - -3, /* (204) expr ::= expr EQ expr */ - -3, /* (205) expr ::= expr AND expr */ - -3, /* (206) expr ::= expr OR expr */ - -3, /* (207) expr ::= expr PLUS expr */ - -3, /* (208) expr ::= expr MINUS expr */ - -3, /* (209) expr ::= expr STAR expr */ - -3, /* (210) expr ::= expr SLASH expr */ - -3, /* (211) expr ::= expr REM expr */ - -3, /* (212) expr ::= expr LIKE expr */ - -5, /* (213) expr ::= expr IN LP exprlist RP */ - -3, /* (214) exprlist ::= exprlist COMMA expritem */ - -1, /* (215) exprlist ::= expritem */ - -1, /* (216) expritem ::= expr */ - 0, /* (217) expritem ::= */ - -3, /* (218) cmd ::= RESET QUERY CACHE */ - -7, /* (219) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (220) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (221) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (222) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (223) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (224) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -3, /* (225) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (226) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (227) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* 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[] = { + { 207, -1 }, /* (0) program ::= cmd */ + { 208, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 208, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 208, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 208, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 208, -2 }, /* (5) cmd ::= SHOW USERS */ + { 208, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 208, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 208, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 208, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 208, -2 }, /* (10) cmd ::= SHOW VARIABLES */ + { 208, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 208, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 208, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 208, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 209, 0 }, /* (15) dbPrefix ::= */ + { 209, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 211, 0 }, /* (17) cpxName ::= */ + { 211, -2 }, /* (18) cpxName ::= DOT ids */ + { 208, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 208, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ + { 208, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ + { 208, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 208, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ + { 208, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 208, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ + { 208, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 208, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ + { 208, -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */ + { 208, -3 }, /* (29) cmd ::= DROP DNODE ids */ + { 208, -3 }, /* (30) cmd ::= DROP USER ids */ + { 208, -3 }, /* (31) cmd ::= DROP ACCOUNT ids */ + { 208, -2 }, /* (32) cmd ::= USE ids */ + { 208, -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */ + { 208, -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */ + { 208, -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 208, -4 }, /* (36) cmd ::= ALTER DNODE ids ids */ + { 208, -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */ + { 208, -3 }, /* (38) cmd ::= ALTER LOCAL ids */ + { 208, -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */ + { 208, -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 208, -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 208, -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 210, -1 }, /* (43) ids ::= ID */ + { 210, -1 }, /* (44) ids ::= STRING */ + { 212, -2 }, /* (45) ifexists ::= IF EXISTS */ + { 212, 0 }, /* (46) ifexists ::= */ + { 215, -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */ + { 215, 0 }, /* (48) ifnotexists ::= */ + { 208, -3 }, /* (49) cmd ::= CREATE DNODE ids */ + { 208, -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 208, -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 208, -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */ + { 217, 0 }, /* (53) pps ::= */ + { 217, -2 }, /* (54) pps ::= PPS INTEGER */ + { 218, 0 }, /* (55) tseries ::= */ + { 218, -2 }, /* (56) tseries ::= TSERIES INTEGER */ + { 219, 0 }, /* (57) dbs ::= */ + { 219, -2 }, /* (58) dbs ::= DBS INTEGER */ + { 220, 0 }, /* (59) streams ::= */ + { 220, -2 }, /* (60) streams ::= STREAMS INTEGER */ + { 221, 0 }, /* (61) storage ::= */ + { 221, -2 }, /* (62) storage ::= STORAGE INTEGER */ + { 222, 0 }, /* (63) qtime ::= */ + { 222, -2 }, /* (64) qtime ::= QTIME INTEGER */ + { 223, 0 }, /* (65) users ::= */ + { 223, -2 }, /* (66) users ::= USERS INTEGER */ + { 224, 0 }, /* (67) conns ::= */ + { 224, -2 }, /* (68) conns ::= CONNS INTEGER */ + { 225, 0 }, /* (69) state ::= */ + { 225, -2 }, /* (70) state ::= STATE ids */ + { 214, -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 226, -2 }, /* (72) keep ::= KEEP tagitemlist */ + { 228, -2 }, /* (73) cache ::= CACHE INTEGER */ + { 229, -2 }, /* (74) replica ::= REPLICA INTEGER */ + { 230, -2 }, /* (75) quorum ::= QUORUM INTEGER */ + { 231, -2 }, /* (76) days ::= DAYS INTEGER */ + { 232, -2 }, /* (77) minrows ::= MINROWS INTEGER */ + { 233, -2 }, /* (78) maxrows ::= MAXROWS INTEGER */ + { 234, -2 }, /* (79) blocks ::= BLOCKS INTEGER */ + { 235, -2 }, /* (80) ctime ::= CTIME INTEGER */ + { 236, -2 }, /* (81) wal ::= WAL INTEGER */ + { 237, -2 }, /* (82) fsync ::= FSYNC INTEGER */ + { 238, -2 }, /* (83) comp ::= COMP INTEGER */ + { 239, -2 }, /* (84) prec ::= PRECISION STRING */ + { 216, 0 }, /* (85) db_optr ::= */ + { 216, -2 }, /* (86) db_optr ::= db_optr cache */ + { 216, -2 }, /* (87) db_optr ::= db_optr replica */ + { 216, -2 }, /* (88) db_optr ::= db_optr quorum */ + { 216, -2 }, /* (89) db_optr ::= db_optr days */ + { 216, -2 }, /* (90) db_optr ::= db_optr minrows */ + { 216, -2 }, /* (91) db_optr ::= db_optr maxrows */ + { 216, -2 }, /* (92) db_optr ::= db_optr blocks */ + { 216, -2 }, /* (93) db_optr ::= db_optr ctime */ + { 216, -2 }, /* (94) db_optr ::= db_optr wal */ + { 216, -2 }, /* (95) db_optr ::= db_optr fsync */ + { 216, -2 }, /* (96) db_optr ::= db_optr comp */ + { 216, -2 }, /* (97) db_optr ::= db_optr prec */ + { 216, -2 }, /* (98) db_optr ::= db_optr keep */ + { 213, 0 }, /* (99) alter_db_optr ::= */ + { 213, -2 }, /* (100) alter_db_optr ::= alter_db_optr replica */ + { 213, -2 }, /* (101) alter_db_optr ::= alter_db_optr quorum */ + { 213, -2 }, /* (102) alter_db_optr ::= alter_db_optr keep */ + { 213, -2 }, /* (103) alter_db_optr ::= alter_db_optr blocks */ + { 213, -2 }, /* (104) alter_db_optr ::= alter_db_optr comp */ + { 213, -2 }, /* (105) alter_db_optr ::= alter_db_optr wal */ + { 213, -2 }, /* (106) alter_db_optr ::= alter_db_optr fsync */ + { 240, -1 }, /* (107) typename ::= ids */ + { 240, -4 }, /* (108) typename ::= ids LP signed RP */ + { 241, -1 }, /* (109) signed ::= INTEGER */ + { 241, -2 }, /* (110) signed ::= PLUS INTEGER */ + { 241, -2 }, /* (111) signed ::= MINUS INTEGER */ + { 208, -6 }, /* (112) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ + { 242, -3 }, /* (113) create_table_args ::= LP columnlist RP */ + { 242, -7 }, /* (114) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ + { 242, -7 }, /* (115) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ + { 242, -2 }, /* (116) create_table_args ::= AS select */ + { 243, -3 }, /* (117) columnlist ::= columnlist COMMA column */ + { 243, -1 }, /* (118) columnlist ::= column */ + { 245, -2 }, /* (119) column ::= ids typename */ + { 227, -3 }, /* (120) tagitemlist ::= tagitemlist COMMA tagitem */ + { 227, -1 }, /* (121) tagitemlist ::= tagitem */ + { 246, -1 }, /* (122) tagitem ::= INTEGER */ + { 246, -1 }, /* (123) tagitem ::= FLOAT */ + { 246, -1 }, /* (124) tagitem ::= STRING */ + { 246, -1 }, /* (125) tagitem ::= BOOL */ + { 246, -1 }, /* (126) tagitem ::= NULL */ + { 246, -2 }, /* (127) tagitem ::= MINUS INTEGER */ + { 246, -2 }, /* (128) tagitem ::= MINUS FLOAT */ + { 246, -2 }, /* (129) tagitem ::= PLUS INTEGER */ + { 246, -2 }, /* (130) tagitem ::= PLUS FLOAT */ + { 244, -12 }, /* (131) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 258, -1 }, /* (132) union ::= select */ + { 258, -3 }, /* (133) union ::= LP union RP */ + { 258, -4 }, /* (134) union ::= union UNION ALL select */ + { 258, -6 }, /* (135) union ::= union UNION ALL LP select RP */ + { 208, -1 }, /* (136) cmd ::= union */ + { 244, -2 }, /* (137) select ::= SELECT selcollist */ + { 259, -2 }, /* (138) sclp ::= selcollist COMMA */ + { 259, 0 }, /* (139) sclp ::= */ + { 247, -3 }, /* (140) selcollist ::= sclp expr as */ + { 247, -2 }, /* (141) selcollist ::= sclp STAR */ + { 261, -2 }, /* (142) as ::= AS ids */ + { 261, -1 }, /* (143) as ::= ids */ + { 261, 0 }, /* (144) as ::= */ + { 248, -2 }, /* (145) from ::= FROM tablelist */ + { 262, -2 }, /* (146) tablelist ::= ids cpxName */ + { 262, -3 }, /* (147) tablelist ::= ids cpxName ids */ + { 262, -4 }, /* (148) tablelist ::= tablelist COMMA ids cpxName */ + { 262, -5 }, /* (149) tablelist ::= tablelist COMMA ids cpxName ids */ + { 263, -1 }, /* (150) tmvar ::= VARIABLE */ + { 250, -4 }, /* (151) interval_opt ::= INTERVAL LP tmvar RP */ + { 250, -6 }, /* (152) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 250, 0 }, /* (153) interval_opt ::= */ + { 251, 0 }, /* (154) fill_opt ::= */ + { 251, -6 }, /* (155) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 251, -4 }, /* (156) fill_opt ::= FILL LP ID RP */ + { 252, -4 }, /* (157) sliding_opt ::= SLIDING LP tmvar RP */ + { 252, 0 }, /* (158) sliding_opt ::= */ + { 254, 0 }, /* (159) orderby_opt ::= */ + { 254, -3 }, /* (160) orderby_opt ::= ORDER BY sortlist */ + { 264, -4 }, /* (161) sortlist ::= sortlist COMMA item sortorder */ + { 264, -2 }, /* (162) sortlist ::= item sortorder */ + { 266, -2 }, /* (163) item ::= ids cpxName */ + { 267, -1 }, /* (164) sortorder ::= ASC */ + { 267, -1 }, /* (165) sortorder ::= DESC */ + { 267, 0 }, /* (166) sortorder ::= */ + { 253, 0 }, /* (167) groupby_opt ::= */ + { 253, -3 }, /* (168) groupby_opt ::= GROUP BY grouplist */ + { 268, -3 }, /* (169) grouplist ::= grouplist COMMA item */ + { 268, -1 }, /* (170) grouplist ::= item */ + { 255, 0 }, /* (171) having_opt ::= */ + { 255, -2 }, /* (172) having_opt ::= HAVING expr */ + { 257, 0 }, /* (173) limit_opt ::= */ + { 257, -2 }, /* (174) limit_opt ::= LIMIT signed */ + { 257, -4 }, /* (175) limit_opt ::= LIMIT signed OFFSET signed */ + { 257, -4 }, /* (176) limit_opt ::= LIMIT signed COMMA signed */ + { 256, 0 }, /* (177) slimit_opt ::= */ + { 256, -2 }, /* (178) slimit_opt ::= SLIMIT signed */ + { 256, -4 }, /* (179) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 256, -4 }, /* (180) slimit_opt ::= SLIMIT signed COMMA signed */ + { 249, 0 }, /* (181) where_opt ::= */ + { 249, -2 }, /* (182) where_opt ::= WHERE expr */ + { 260, -3 }, /* (183) expr ::= LP expr RP */ + { 260, -1 }, /* (184) expr ::= ID */ + { 260, -3 }, /* (185) expr ::= ID DOT ID */ + { 260, -3 }, /* (186) expr ::= ID DOT STAR */ + { 260, -1 }, /* (187) expr ::= INTEGER */ + { 260, -2 }, /* (188) expr ::= MINUS INTEGER */ + { 260, -2 }, /* (189) expr ::= PLUS INTEGER */ + { 260, -1 }, /* (190) expr ::= FLOAT */ + { 260, -2 }, /* (191) expr ::= MINUS FLOAT */ + { 260, -2 }, /* (192) expr ::= PLUS FLOAT */ + { 260, -1 }, /* (193) expr ::= STRING */ + { 260, -1 }, /* (194) expr ::= NOW */ + { 260, -1 }, /* (195) expr ::= VARIABLE */ + { 260, -1 }, /* (196) expr ::= BOOL */ + { 260, -4 }, /* (197) expr ::= ID LP exprlist RP */ + { 260, -4 }, /* (198) expr ::= ID LP STAR RP */ + { 260, -3 }, /* (199) expr ::= expr IS NULL */ + { 260, -4 }, /* (200) expr ::= expr IS NOT NULL */ + { 260, -3 }, /* (201) expr ::= expr LT expr */ + { 260, -3 }, /* (202) expr ::= expr GT expr */ + { 260, -3 }, /* (203) expr ::= expr LE expr */ + { 260, -3 }, /* (204) expr ::= expr GE expr */ + { 260, -3 }, /* (205) expr ::= expr NE expr */ + { 260, -3 }, /* (206) expr ::= expr EQ expr */ + { 260, -3 }, /* (207) expr ::= expr AND expr */ + { 260, -3 }, /* (208) expr ::= expr OR expr */ + { 260, -3 }, /* (209) expr ::= expr PLUS expr */ + { 260, -3 }, /* (210) expr ::= expr MINUS expr */ + { 260, -3 }, /* (211) expr ::= expr STAR expr */ + { 260, -3 }, /* (212) expr ::= expr SLASH expr */ + { 260, -3 }, /* (213) expr ::= expr REM expr */ + { 260, -3 }, /* (214) expr ::= expr LIKE expr */ + { 260, -5 }, /* (215) expr ::= expr IN LP exprlist RP */ + { 269, -3 }, /* (216) exprlist ::= exprlist COMMA expritem */ + { 269, -1 }, /* (217) exprlist ::= expritem */ + { 270, -1 }, /* (218) expritem ::= expr */ + { 270, 0 }, /* (219) expritem ::= */ + { 208, -3 }, /* (220) cmd ::= RESET QUERY CACHE */ + { 208, -7 }, /* (221) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 208, -7 }, /* (222) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 208, -7 }, /* (223) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 208, -7 }, /* (224) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 208, -8 }, /* (225) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 208, -9 }, /* (226) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 208, -3 }, /* (227) cmd ::= KILL CONNECTION INTEGER */ + { 208, -5 }, /* (228) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 208, -5 }, /* (229) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2176,34 +1940,30 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static YYACTIONTYPE yy_reduce( +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 */ - ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - YYACTIONTYPE yyact; /* The next action */ + int yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH + ParseARG_FETCH; (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; + yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2221,19 +1981,13 @@ static YYACTIONTYPE yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; + return; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; + return; } yymsp = yypParser->yytos; } @@ -2309,708 +2063,719 @@ static YYACTIONTYPE yy_reduce( case 18: /* cpxName ::= DOT ids */ {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1; } break; - case 19: /* cmd ::= SHOW dbPrefix TABLES */ + case 19: /* 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 20: /* cmd ::= SHOW CREATE DATABASE ids */ +{ + setDCLSQLElems(pInfo, TSDB_SQL_SHOW_CREATE_DATABASE, 1, &yymsp[0].minor.yy0); +} + break; + case 21: /* cmd ::= SHOW dbPrefix TABLES */ { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-1].minor.yy0, 0); } break; - case 20: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */ + case 22: /* cmd ::= SHOW dbPrefix TABLES LIKE ids */ { setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); } break; - case 21: /* cmd ::= SHOW dbPrefix STABLES */ + case 23: /* cmd ::= SHOW dbPrefix STABLES */ { setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &yymsp[-1].minor.yy0, 0); } break; - case 22: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */ + case 24: /* cmd ::= SHOW dbPrefix STABLES LIKE ids */ { SStrToken token; setDBName(&token, &yymsp[-3].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &yymsp[0].minor.yy0); } break; - case 23: /* cmd ::= SHOW dbPrefix VGROUPS */ + case 25: /* cmd ::= SHOW dbPrefix VGROUPS */ { SStrToken token; setDBName(&token, &yymsp[-1].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } break; - case 24: /* cmd ::= SHOW dbPrefix VGROUPS ids */ + case 26: /* cmd ::= SHOW dbPrefix VGROUPS ids */ { SStrToken token; setDBName(&token, &yymsp[-2].minor.yy0); setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &yymsp[0].minor.yy0); } break; - case 25: /* cmd ::= DROP TABLE ifexists ids cpxName */ + case 27: /* 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); } break; - case 26: /* cmd ::= DROP DATABASE ifexists ids */ + case 28: /* cmd ::= DROP DATABASE ifexists ids */ { setDropDBTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 27: /* cmd ::= DROP DNODE ids */ + case 29: /* cmd ::= DROP DNODE ids */ { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); } break; - case 28: /* cmd ::= DROP USER ids */ + case 30: /* cmd ::= DROP USER ids */ { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0); } break; - case 29: /* cmd ::= DROP ACCOUNT ids */ + case 31: /* cmd ::= DROP ACCOUNT ids */ { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0); } break; - case 30: /* cmd ::= USE ids */ + case 32: /* cmd ::= USE ids */ { setDCLSQLElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);} break; - case 31: /* cmd ::= DESCRIBE ids cpxName */ + case 33: /* cmd ::= DESCRIBE ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; setDCLSQLElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0); } break; - case 32: /* cmd ::= ALTER USER ids PASS ids */ + case 34: /* cmd ::= ALTER USER ids PASS ids */ { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL); } break; - case 33: /* cmd ::= ALTER USER ids PRIVILEGE ids */ + case 35: /* cmd ::= ALTER USER ids PRIVILEGE ids */ { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);} break; - case 34: /* cmd ::= ALTER DNODE ids ids */ + case 36: /* cmd ::= ALTER DNODE ids ids */ { setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 35: /* cmd ::= ALTER DNODE ids ids ids */ + case 37: /* 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 36: /* cmd ::= ALTER LOCAL ids */ + case 38: /* cmd ::= ALTER LOCAL ids */ { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0); } break; - case 37: /* cmd ::= ALTER LOCAL ids ids */ + case 39: /* cmd ::= ALTER LOCAL ids ids */ { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 38: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy118, &t);} + case 40: /* cmd ::= ALTER DATABASE ids alter_db_optr */ +{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy158, &t);} break; - case 39: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy479);} + case 41: /* cmd ::= ALTER ACCOUNT ids acct_optr */ +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy73);} break; - case 40: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy479);} + case 42: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy73);} break; - case 41: /* ids ::= ID */ - case 42: /* ids ::= STRING */ yytestcase(yyruleno==42); + case 43: /* ids ::= ID */ + case 44: /* ids ::= STRING */ yytestcase(yyruleno==44); {yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 43: /* ifexists ::= IF EXISTS */ + case 45: /* ifexists ::= IF EXISTS */ {yymsp[-1].minor.yy0.n = 1;} break; - case 44: /* ifexists ::= */ - case 46: /* ifnotexists ::= */ yytestcase(yyruleno==46); + case 46: /* ifexists ::= */ + case 48: /* ifnotexists ::= */ yytestcase(yyruleno==48); {yymsp[1].minor.yy0.n = 0;} break; - case 45: /* ifnotexists ::= IF NOT EXISTS */ + case 47: /* ifnotexists ::= IF NOT EXISTS */ {yymsp[-2].minor.yy0.n = 1;} break; - case 47: /* cmd ::= CREATE DNODE ids */ + case 49: /* cmd ::= CREATE DNODE ids */ { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; - case 48: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy479);} + case 50: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ +{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy73);} break; - case 49: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy118, &yymsp[-2].minor.yy0);} + case 51: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ +{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy158, &yymsp[-2].minor.yy0);} break; - case 50: /* cmd ::= CREATE USER ids PASS ids */ + case 52: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSQL(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} break; - case 51: /* pps ::= */ - case 53: /* tseries ::= */ yytestcase(yyruleno==53); - case 55: /* dbs ::= */ yytestcase(yyruleno==55); - case 57: /* streams ::= */ yytestcase(yyruleno==57); - case 59: /* storage ::= */ yytestcase(yyruleno==59); - case 61: /* qtime ::= */ yytestcase(yyruleno==61); - case 63: /* users ::= */ yytestcase(yyruleno==63); - case 65: /* conns ::= */ yytestcase(yyruleno==65); - case 67: /* state ::= */ yytestcase(yyruleno==67); + case 53: /* pps ::= */ + case 55: /* tseries ::= */ yytestcase(yyruleno==55); + case 57: /* dbs ::= */ yytestcase(yyruleno==57); + case 59: /* streams ::= */ yytestcase(yyruleno==59); + case 61: /* storage ::= */ yytestcase(yyruleno==61); + case 63: /* qtime ::= */ yytestcase(yyruleno==63); + case 65: /* users ::= */ yytestcase(yyruleno==65); + case 67: /* conns ::= */ yytestcase(yyruleno==67); + case 69: /* state ::= */ yytestcase(yyruleno==69); {yymsp[1].minor.yy0.n = 0; } break; - case 52: /* pps ::= PPS INTEGER */ - case 54: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==54); - case 56: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==56); - case 58: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==58); - case 60: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==60); - case 62: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==62); - case 64: /* users ::= USERS INTEGER */ yytestcase(yyruleno==64); - case 66: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==66); - case 68: /* state ::= STATE ids */ yytestcase(yyruleno==68); + case 54: /* pps ::= PPS INTEGER */ + case 56: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==56); + case 58: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==58); + case 60: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==60); + case 62: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==62); + case 64: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==64); + case 66: /* users ::= USERS INTEGER */ yytestcase(yyruleno==66); + case 68: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==68); + case 70: /* state ::= STATE ids */ yytestcase(yyruleno==70); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 69: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + case 71: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy479.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy479.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy479.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy479.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy479.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy479.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy479.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy479.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy479.stat = yymsp[0].minor.yy0; -} - yymsp[-8].minor.yy479 = yylhsminor.yy479; - break; - case 70: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy156 = yymsp[0].minor.yy156; } - break; - case 71: /* cache ::= CACHE INTEGER */ - case 72: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==72); - case 73: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==73); - case 74: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==74); - case 75: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==75); - case 76: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==76); - case 77: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==77); - case 78: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==78); - case 79: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==79); - case 80: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==80); - case 81: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==81); - case 82: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==82); + yylhsminor.yy73.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy73.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy73.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy73.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy73.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy73.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy73.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy73.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy73.stat = yymsp[0].minor.yy0; +} + yymsp[-8].minor.yy73 = yylhsminor.yy73; + break; + case 72: /* keep ::= KEEP tagitemlist */ +{ yymsp[-1].minor.yy494 = yymsp[0].minor.yy494; } + break; + case 73: /* cache ::= CACHE INTEGER */ + case 74: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==74); + case 75: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==75); + case 76: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==76); + case 77: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==77); + case 78: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==78); + case 79: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==79); + case 80: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==80); + case 81: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==81); + case 82: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==82); + case 83: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==83); + case 84: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==84); { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 83: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy118);} + case 85: /* db_optr ::= */ +{setDefaultCreateDbOption(&yymsp[1].minor.yy158);} break; - case 84: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 86: /* db_optr ::= db_optr cache */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 85: /* db_optr ::= db_optr replica */ - case 98: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==98); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 87: /* db_optr ::= db_optr replica */ + case 100: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==100); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 86: /* db_optr ::= db_optr quorum */ - case 99: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==99); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 88: /* db_optr ::= db_optr quorum */ + case 101: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==101); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 87: /* db_optr ::= db_optr days */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 89: /* db_optr ::= db_optr days */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 88: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 90: /* db_optr ::= db_optr minrows */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 89: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 91: /* db_optr ::= db_optr maxrows */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 90: /* db_optr ::= db_optr blocks */ - case 101: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==101); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 92: /* db_optr ::= db_optr blocks */ + case 103: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==103); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 91: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 93: /* db_optr ::= db_optr ctime */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 92: /* db_optr ::= db_optr wal */ - case 103: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==103); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 94: /* db_optr ::= db_optr wal */ + case 105: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==105); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 93: /* db_optr ::= db_optr fsync */ - case 104: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==104); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 95: /* db_optr ::= db_optr fsync */ + case 106: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==106); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 94: /* db_optr ::= db_optr comp */ - case 102: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==102); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 96: /* db_optr ::= db_optr comp */ + case 104: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==104); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 95: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 97: /* db_optr ::= db_optr prec */ +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 96: /* db_optr ::= db_optr keep */ - case 100: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==100); -{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118.keep = yymsp[0].minor.yy156; } - yymsp[-1].minor.yy118 = yylhsminor.yy118; + case 98: /* db_optr ::= db_optr keep */ + case 102: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==102); +{ yylhsminor.yy158 = yymsp[-1].minor.yy158; yylhsminor.yy158.keep = yymsp[0].minor.yy494; } + yymsp[-1].minor.yy158 = yylhsminor.yy158; break; - case 97: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy118);} + case 99: /* alter_db_optr ::= */ +{ setDefaultCreateDbOption(&yymsp[1].minor.yy158);} break; - case 105: /* typename ::= ids */ + case 107: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSQLSetColumnType (&yylhsminor.yy343, &yymsp[0].minor.yy0); + tSQLSetColumnType (&yylhsminor.yy181, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy343 = yylhsminor.yy343; + yymsp[0].minor.yy181 = yylhsminor.yy181; break; - case 106: /* typename ::= ids LP signed RP */ + case 108: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy369 <= 0) { + if (yymsp[-1].minor.yy271 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSQLSetColumnType(&yylhsminor.yy343, &yymsp[-3].minor.yy0); + tSQLSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy369; // negative value of name length - tSQLSetColumnType(&yylhsminor.yy343, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy271; // negative value of name length + tSQLSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy343 = yylhsminor.yy343; + yymsp[-3].minor.yy181 = yylhsminor.yy181; break; - case 107: /* signed ::= INTEGER */ -{ yylhsminor.yy369 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy369 = yylhsminor.yy369; + case 109: /* signed ::= INTEGER */ +{ yylhsminor.yy271 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy271 = yylhsminor.yy271; break; - case 108: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy369 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 110: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy271 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 109: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy369 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} + case 111: /* signed ::= MINUS INTEGER */ +{ yymsp[-1].minor.yy271 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; - case 110: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ + case 112: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0); } break; - case 111: /* create_table_args ::= LP columnlist RP */ + case 113: /* create_table_args ::= LP columnlist RP */ { - yymsp[-2].minor.yy398 = tSetCreateSQLElems(yymsp[-1].minor.yy511, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); - setSQLInfo(pInfo, yymsp[-2].minor.yy398, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-2].minor.yy374 = tSetCreateSQLElems(yymsp[-1].minor.yy449, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); + setSQLInfo(pInfo, yymsp[-2].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 112: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ + case 114: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ { - yymsp[-6].minor.yy398 = tSetCreateSQLElems(yymsp[-5].minor.yy511, yymsp[-1].minor.yy511, NULL, NULL, NULL, TSQL_CREATE_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy398, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy374 = tSetCreateSQLElems(yymsp[-5].minor.yy449, yymsp[-1].minor.yy449, NULL, NULL, NULL, TSQL_CREATE_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 113: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ + case 115: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; - yymsp[-6].minor.yy398 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy156, NULL, TSQL_CREATE_TABLE_FROM_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy398, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy374 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy494, NULL, TSQL_CREATE_TABLE_FROM_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 114: /* create_table_args ::= AS select */ + case 116: /* create_table_args ::= AS select */ { - yymsp[-1].minor.yy398 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy444, TSQL_CREATE_STREAM); - setSQLInfo(pInfo, yymsp[-1].minor.yy398, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-1].minor.yy374 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy150, TSQL_CREATE_STREAM); + setSQLInfo(pInfo, yymsp[-1].minor.yy374, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 115: /* columnlist ::= columnlist COMMA column */ -{yylhsminor.yy511 = tFieldListAppend(yymsp[-2].minor.yy511, &yymsp[0].minor.yy343); } - yymsp[-2].minor.yy511 = yylhsminor.yy511; + case 117: /* columnlist ::= columnlist COMMA column */ +{yylhsminor.yy449 = tFieldListAppend(yymsp[-2].minor.yy449, &yymsp[0].minor.yy181); } + yymsp[-2].minor.yy449 = yylhsminor.yy449; break; - case 116: /* columnlist ::= column */ -{yylhsminor.yy511 = tFieldListAppend(NULL, &yymsp[0].minor.yy343);} - yymsp[0].minor.yy511 = yylhsminor.yy511; + case 118: /* columnlist ::= column */ +{yylhsminor.yy449 = tFieldListAppend(NULL, &yymsp[0].minor.yy181);} + yymsp[0].minor.yy449 = yylhsminor.yy449; break; - case 117: /* column ::= ids typename */ + case 119: /* column ::= ids typename */ { - tSQLSetColumnInfo(&yylhsminor.yy343, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy343); + tSQLSetColumnInfo(&yylhsminor.yy181, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy181); } - yymsp[-1].minor.yy343 = yylhsminor.yy343; + yymsp[-1].minor.yy181 = yylhsminor.yy181; break; - case 118: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy156 = tVariantListAppend(yymsp[-2].minor.yy156, &yymsp[0].minor.yy506, -1); } - yymsp[-2].minor.yy156 = yylhsminor.yy156; + case 120: /* tagitemlist ::= tagitemlist COMMA tagitem */ +{ yylhsminor.yy494 = tVariantListAppend(yymsp[-2].minor.yy494, &yymsp[0].minor.yy312, -1); } + yymsp[-2].minor.yy494 = yylhsminor.yy494; break; - case 119: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy156 = tVariantListAppend(NULL, &yymsp[0].minor.yy506, -1); } - yymsp[0].minor.yy156 = yylhsminor.yy156; + case 121: /* tagitemlist ::= tagitem */ +{ yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[0].minor.yy312, -1); } + yymsp[0].minor.yy494 = yylhsminor.yy494; break; - case 120: /* tagitem ::= INTEGER */ - case 121: /* tagitem ::= FLOAT */ yytestcase(yyruleno==121); - case 122: /* tagitem ::= STRING */ yytestcase(yyruleno==122); - case 123: /* tagitem ::= BOOL */ yytestcase(yyruleno==123); -{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy506 = yylhsminor.yy506; + case 122: /* tagitem ::= INTEGER */ + case 123: /* tagitem ::= FLOAT */ yytestcase(yyruleno==123); + case 124: /* tagitem ::= STRING */ yytestcase(yyruleno==124); + case 125: /* tagitem ::= BOOL */ yytestcase(yyruleno==125); +{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy312, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 124: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy506 = yylhsminor.yy506; + case 126: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy312, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 125: /* tagitem ::= MINUS INTEGER */ - case 126: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==126); - case 127: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==127); - case 128: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==128); + case 127: /* tagitem ::= MINUS INTEGER */ + case 128: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==128); + case 129: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==129); + case 130: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==130); { 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); - tVariantCreate(&yylhsminor.yy506, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy312, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy506 = yylhsminor.yy506; + yymsp[-1].minor.yy312 = yylhsminor.yy312; break; - case 129: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + case 131: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy444 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy158, yymsp[-9].minor.yy156, yymsp[-8].minor.yy190, yymsp[-4].minor.yy156, yymsp[-3].minor.yy156, &yymsp[-7].minor.yy340, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy156, &yymsp[0].minor.yy414, &yymsp[-1].minor.yy414); + yylhsminor.yy150 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy224, yymsp[-9].minor.yy494, yymsp[-8].minor.yy66, yymsp[-4].minor.yy494, yymsp[-3].minor.yy494, &yymsp[-7].minor.yy314, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy494, &yymsp[0].minor.yy188, &yymsp[-1].minor.yy188); } - yymsp[-11].minor.yy444 = yylhsminor.yy444; + yymsp[-11].minor.yy150 = yylhsminor.yy150; break; - case 130: /* union ::= select */ -{ yylhsminor.yy333 = setSubclause(NULL, yymsp[0].minor.yy444); } - yymsp[0].minor.yy333 = yylhsminor.yy333; + case 132: /* union ::= select */ +{ yylhsminor.yy25 = setSubclause(NULL, yymsp[0].minor.yy150); } + yymsp[0].minor.yy25 = yylhsminor.yy25; break; - case 131: /* union ::= LP union RP */ -{ yymsp[-2].minor.yy333 = yymsp[-1].minor.yy333; } + case 133: /* union ::= LP union RP */ +{ yymsp[-2].minor.yy25 = yymsp[-1].minor.yy25; } break; - case 132: /* union ::= union UNION ALL select */ -{ yylhsminor.yy333 = appendSelectClause(yymsp[-3].minor.yy333, yymsp[0].minor.yy444); } - yymsp[-3].minor.yy333 = yylhsminor.yy333; + case 134: /* union ::= union UNION ALL select */ +{ yylhsminor.yy25 = appendSelectClause(yymsp[-3].minor.yy25, yymsp[0].minor.yy150); } + yymsp[-3].minor.yy25 = yylhsminor.yy25; break; - case 133: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy333 = appendSelectClause(yymsp[-5].minor.yy333, yymsp[-1].minor.yy444); } - yymsp[-5].minor.yy333 = yylhsminor.yy333; + case 135: /* union ::= union UNION ALL LP select RP */ +{ yylhsminor.yy25 = appendSelectClause(yymsp[-5].minor.yy25, yymsp[-1].minor.yy150); } + yymsp[-5].minor.yy25 = yylhsminor.yy25; break; - case 134: /* cmd ::= union */ -{ setSQLInfo(pInfo, yymsp[0].minor.yy333, NULL, TSDB_SQL_SELECT); } + case 136: /* cmd ::= union */ +{ setSQLInfo(pInfo, yymsp[0].minor.yy25, NULL, TSDB_SQL_SELECT); } break; - case 135: /* select ::= SELECT selcollist */ + case 137: /* select ::= SELECT selcollist */ { - yylhsminor.yy444 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy158, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy150 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy224, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy444 = yylhsminor.yy444; + yymsp[-1].minor.yy150 = yylhsminor.yy150; break; - case 136: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy158 = yymsp[-1].minor.yy158;} - yymsp[-1].minor.yy158 = yylhsminor.yy158; + case 138: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy224 = yymsp[-1].minor.yy224;} + yymsp[-1].minor.yy224 = yylhsminor.yy224; break; - case 137: /* sclp ::= */ -{yymsp[1].minor.yy158 = 0;} + case 139: /* sclp ::= */ +{yymsp[1].minor.yy224 = 0;} break; - case 138: /* selcollist ::= sclp expr as */ + case 140: /* selcollist ::= sclp expr as */ { - yylhsminor.yy158 = tSQLExprListAppend(yymsp[-2].minor.yy158, yymsp[-1].minor.yy190, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy224 = tSQLExprListAppend(yymsp[-2].minor.yy224, yymsp[-1].minor.yy66, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-2].minor.yy158 = yylhsminor.yy158; + yymsp[-2].minor.yy224 = yylhsminor.yy224; break; - case 139: /* selcollist ::= sclp STAR */ + case 141: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy158 = tSQLExprListAppend(yymsp[-1].minor.yy158, pNode, 0); + yylhsminor.yy224 = tSQLExprListAppend(yymsp[-1].minor.yy224, pNode, 0); } - yymsp[-1].minor.yy158 = yylhsminor.yy158; + yymsp[-1].minor.yy224 = yylhsminor.yy224; break; - case 140: /* as ::= AS ids */ + case 142: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 141: /* as ::= ids */ + case 143: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 142: /* as ::= */ + case 144: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 143: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy156 = yymsp[0].minor.yy156;} + case 145: /* from ::= FROM tablelist */ +{yymsp[-1].minor.yy494 = yymsp[0].minor.yy494;} break; - case 144: /* tablelist ::= ids cpxName */ + case 146: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy156 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy156 = tVariantListAppendToken(yylhsminor.yy156, &yymsp[-1].minor.yy0, -1); // table alias name + yylhsminor.yy494 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[-1].minor.yy0, -1); // table alias name } - yymsp[-1].minor.yy156 = yylhsminor.yy156; + yymsp[-1].minor.yy494 = yylhsminor.yy494; break; - case 145: /* tablelist ::= ids cpxName ids */ + case 147: /* tablelist ::= ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy156 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy156 = tVariantListAppendToken(yylhsminor.yy156, &yymsp[0].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[0].minor.yy0, -1); } - yymsp[-2].minor.yy156 = yylhsminor.yy156; + yymsp[-2].minor.yy494 = yylhsminor.yy494; break; - case 146: /* tablelist ::= tablelist COMMA ids cpxName */ + case 148: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy156 = tVariantListAppendToken(yymsp[-3].minor.yy156, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy156 = tVariantListAppendToken(yylhsminor.yy156, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yymsp[-3].minor.yy494, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy156 = yylhsminor.yy156; + yymsp[-3].minor.yy494 = yylhsminor.yy494; break; - case 147: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 149: /* tablelist ::= tablelist COMMA ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy156 = tVariantListAppendToken(yymsp[-4].minor.yy156, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy156 = tVariantListAppendToken(yylhsminor.yy156, &yymsp[0].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yymsp[-4].minor.yy494, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy494 = tVariantListAppendToken(yylhsminor.yy494, &yymsp[0].minor.yy0, -1); } - yymsp[-4].minor.yy156 = yylhsminor.yy156; + yymsp[-4].minor.yy494 = yylhsminor.yy494; break; - case 148: /* tmvar ::= VARIABLE */ + case 150: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 149: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy340.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy340.offset.n = 0; yymsp[-3].minor.yy340.offset.z = NULL; yymsp[-3].minor.yy340.offset.type = 0;} + case 151: /* interval_opt ::= INTERVAL LP tmvar RP */ +{yymsp[-3].minor.yy314.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy314.offset.n = 0; yymsp[-3].minor.yy314.offset.z = NULL; yymsp[-3].minor.yy314.offset.type = 0;} break; - case 150: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy340.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy340.offset = yymsp[-1].minor.yy0;} + case 152: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ +{yymsp[-5].minor.yy314.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy314.offset = yymsp[-1].minor.yy0;} break; - case 151: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy340, 0, sizeof(yymsp[1].minor.yy340));} + case 153: /* interval_opt ::= */ +{memset(&yymsp[1].minor.yy314, 0, sizeof(yymsp[1].minor.yy314));} break; - case 152: /* fill_opt ::= */ -{yymsp[1].minor.yy156 = 0; } + case 154: /* fill_opt ::= */ +{yymsp[1].minor.yy494 = 0; } break; - case 153: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 155: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy156, &A, -1, 0); - yymsp[-5].minor.yy156 = yymsp[-1].minor.yy156; + tVariantListInsert(yymsp[-1].minor.yy494, &A, -1, 0); + yymsp[-5].minor.yy494 = yymsp[-1].minor.yy494; } break; - case 154: /* fill_opt ::= FILL LP ID RP */ + case 156: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy156 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy494 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 155: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 157: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 156: /* sliding_opt ::= */ + case 158: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 157: /* orderby_opt ::= */ - case 165: /* groupby_opt ::= */ yytestcase(yyruleno==165); -{yymsp[1].minor.yy156 = 0;} + case 159: /* orderby_opt ::= */ + case 167: /* groupby_opt ::= */ yytestcase(yyruleno==167); +{yymsp[1].minor.yy494 = 0;} break; - case 158: /* orderby_opt ::= ORDER BY sortlist */ - case 166: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==166); -{yymsp[-2].minor.yy156 = yymsp[0].minor.yy156;} + case 160: /* orderby_opt ::= ORDER BY sortlist */ + case 168: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==168); +{yymsp[-2].minor.yy494 = yymsp[0].minor.yy494;} break; - case 159: /* sortlist ::= sortlist COMMA item sortorder */ + case 161: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy156 = tVariantListAppend(yymsp[-3].minor.yy156, &yymsp[-1].minor.yy506, yymsp[0].minor.yy112); + yylhsminor.yy494 = tVariantListAppend(yymsp[-3].minor.yy494, &yymsp[-1].minor.yy312, yymsp[0].minor.yy82); } - yymsp[-3].minor.yy156 = yylhsminor.yy156; + yymsp[-3].minor.yy494 = yylhsminor.yy494; break; - case 160: /* sortlist ::= item sortorder */ + case 162: /* sortlist ::= item sortorder */ { - yylhsminor.yy156 = tVariantListAppend(NULL, &yymsp[-1].minor.yy506, yymsp[0].minor.yy112); + yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[-1].minor.yy312, yymsp[0].minor.yy82); } - yymsp[-1].minor.yy156 = yylhsminor.yy156; + yymsp[-1].minor.yy494 = yylhsminor.yy494; break; - case 161: /* item ::= ids cpxName */ + case 163: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy506, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy312, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy506 = yylhsminor.yy506; + yymsp[-1].minor.yy312 = yylhsminor.yy312; break; - case 162: /* sortorder ::= ASC */ -{yymsp[0].minor.yy112 = TSDB_ORDER_ASC; } + case 164: /* sortorder ::= ASC */ +{yymsp[0].minor.yy82 = TSDB_ORDER_ASC; } break; - case 163: /* sortorder ::= DESC */ -{yymsp[0].minor.yy112 = TSDB_ORDER_DESC;} + case 165: /* sortorder ::= DESC */ +{yymsp[0].minor.yy82 = TSDB_ORDER_DESC;} break; - case 164: /* sortorder ::= */ -{yymsp[1].minor.yy112 = TSDB_ORDER_ASC;} + case 166: /* sortorder ::= */ +{yymsp[1].minor.yy82 = TSDB_ORDER_ASC;} break; - case 167: /* grouplist ::= grouplist COMMA item */ + case 169: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy156 = tVariantListAppend(yymsp[-2].minor.yy156, &yymsp[0].minor.yy506, -1); + yylhsminor.yy494 = tVariantListAppend(yymsp[-2].minor.yy494, &yymsp[0].minor.yy312, -1); } - yymsp[-2].minor.yy156 = yylhsminor.yy156; + yymsp[-2].minor.yy494 = yylhsminor.yy494; break; - case 168: /* grouplist ::= item */ + case 170: /* grouplist ::= item */ { - yylhsminor.yy156 = tVariantListAppend(NULL, &yymsp[0].minor.yy506, -1); + yylhsminor.yy494 = tVariantListAppend(NULL, &yymsp[0].minor.yy312, -1); } - yymsp[0].minor.yy156 = yylhsminor.yy156; + yymsp[0].minor.yy494 = yylhsminor.yy494; break; - case 169: /* having_opt ::= */ - case 179: /* where_opt ::= */ yytestcase(yyruleno==179); - case 217: /* expritem ::= */ yytestcase(yyruleno==217); -{yymsp[1].minor.yy190 = 0;} + case 171: /* having_opt ::= */ + case 181: /* where_opt ::= */ yytestcase(yyruleno==181); + case 219: /* expritem ::= */ yytestcase(yyruleno==219); +{yymsp[1].minor.yy66 = 0;} break; - case 170: /* having_opt ::= HAVING expr */ - case 180: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==180); -{yymsp[-1].minor.yy190 = yymsp[0].minor.yy190;} + case 172: /* having_opt ::= HAVING expr */ + case 182: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==182); +{yymsp[-1].minor.yy66 = yymsp[0].minor.yy66;} break; - case 171: /* limit_opt ::= */ - case 175: /* slimit_opt ::= */ yytestcase(yyruleno==175); -{yymsp[1].minor.yy414.limit = -1; yymsp[1].minor.yy414.offset = 0;} + case 173: /* limit_opt ::= */ + case 177: /* slimit_opt ::= */ yytestcase(yyruleno==177); +{yymsp[1].minor.yy188.limit = -1; yymsp[1].minor.yy188.offset = 0;} break; - case 172: /* limit_opt ::= LIMIT signed */ - case 176: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==176); -{yymsp[-1].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-1].minor.yy414.offset = 0;} + case 174: /* limit_opt ::= LIMIT signed */ + case 178: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==178); +{yymsp[-1].minor.yy188.limit = yymsp[0].minor.yy271; yymsp[-1].minor.yy188.offset = 0;} break; - case 173: /* limit_opt ::= LIMIT signed OFFSET signed */ - case 177: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==177); -{yymsp[-3].minor.yy414.limit = yymsp[-2].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[0].minor.yy369;} + case 175: /* limit_opt ::= LIMIT signed OFFSET signed */ + case 179: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==179); +{yymsp[-3].minor.yy188.limit = yymsp[-2].minor.yy271; yymsp[-3].minor.yy188.offset = yymsp[0].minor.yy271;} break; - case 174: /* limit_opt ::= LIMIT signed COMMA signed */ - case 178: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==178); -{yymsp[-3].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[-2].minor.yy369;} + case 176: /* limit_opt ::= LIMIT signed COMMA signed */ + case 180: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==180); +{yymsp[-3].minor.yy188.limit = yymsp[0].minor.yy271; yymsp[-3].minor.yy188.offset = yymsp[-2].minor.yy271;} break; - case 181: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy190 = yymsp[-1].minor.yy190; } + case 183: /* expr ::= LP expr RP */ +{yymsp[-2].minor.yy66 = yymsp[-1].minor.yy66; } break; - case 182: /* expr ::= ID */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 184: /* expr ::= ID */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 183: /* expr ::= ID DOT ID */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 185: /* expr ::= ID DOT ID */ +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 184: /* expr ::= ID DOT STAR */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 186: /* expr ::= ID DOT STAR */ +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 185: /* expr ::= INTEGER */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 187: /* expr ::= INTEGER */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 186: /* expr ::= MINUS INTEGER */ - case 187: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==187); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy190 = yylhsminor.yy190; + case 188: /* expr ::= MINUS INTEGER */ + case 189: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==189); +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy66 = yylhsminor.yy66; break; - case 188: /* expr ::= FLOAT */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 190: /* expr ::= FLOAT */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 189: /* expr ::= MINUS FLOAT */ - case 190: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==190); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy190 = yylhsminor.yy190; + case 191: /* expr ::= MINUS FLOAT */ + case 192: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==192); +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy66 = yylhsminor.yy66; break; - case 191: /* expr ::= STRING */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 193: /* expr ::= STRING */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 192: /* expr ::= NOW */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 194: /* expr ::= NOW */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 193: /* expr ::= VARIABLE */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 195: /* expr ::= VARIABLE */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 194: /* expr ::= BOOL */ -{yylhsminor.yy190 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 196: /* expr ::= BOOL */ +{yylhsminor.yy66 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 195: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy190 = tSQLExprCreateFunction(yymsp[-1].minor.yy158, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy190 = yylhsminor.yy190; + case 197: /* expr ::= ID LP exprlist RP */ +{ yylhsminor.yy66 = tSQLExprCreateFunction(yymsp[-1].minor.yy224, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy66 = yylhsminor.yy66; break; - case 196: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy190 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy190 = yylhsminor.yy190; + case 198: /* expr ::= ID LP STAR RP */ +{ yylhsminor.yy66 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy66 = yylhsminor.yy66; break; - case 197: /* expr ::= expr IS NULL */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, NULL, TK_ISNULL);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 199: /* expr ::= expr IS NULL */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, NULL, TK_ISNULL);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 198: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-3].minor.yy190, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy190 = yylhsminor.yy190; + case 200: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-3].minor.yy66, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy66 = yylhsminor.yy66; break; - case 199: /* expr ::= expr LT expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_LT);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 201: /* expr ::= expr LT expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LT);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 200: /* expr ::= expr GT expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_GT);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 202: /* expr ::= expr GT expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_GT);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 201: /* expr ::= expr LE expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_LE);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 203: /* expr ::= expr LE expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LE);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 202: /* expr ::= expr GE expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_GE);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 204: /* expr ::= expr GE expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_GE);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 203: /* expr ::= expr NE expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_NE);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 205: /* expr ::= expr NE expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_NE);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 204: /* expr ::= expr EQ expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_EQ);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 206: /* expr ::= expr EQ expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_EQ);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 205: /* expr ::= expr AND expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_AND);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 207: /* expr ::= expr AND expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_AND);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 206: /* expr ::= expr OR expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_OR); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 208: /* expr ::= expr OR expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_OR); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 207: /* expr ::= expr PLUS expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_PLUS); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 209: /* expr ::= expr PLUS expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_PLUS); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 208: /* expr ::= expr MINUS expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_MINUS); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 210: /* expr ::= expr MINUS expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_MINUS); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 209: /* expr ::= expr STAR expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_STAR); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 211: /* expr ::= expr STAR expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_STAR); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 210: /* expr ::= expr SLASH expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_DIVIDE);} - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 212: /* expr ::= expr SLASH expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_DIVIDE);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 211: /* expr ::= expr REM expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_REM); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 213: /* expr ::= expr REM expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_REM); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 212: /* expr ::= expr LIKE expr */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-2].minor.yy190, yymsp[0].minor.yy190, TK_LIKE); } - yymsp[-2].minor.yy190 = yylhsminor.yy190; + case 214: /* expr ::= expr LIKE expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LIKE); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 213: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy190 = tSQLExprCreate(yymsp[-4].minor.yy190, (tSQLExpr*)yymsp[-1].minor.yy158, TK_IN); } - yymsp[-4].minor.yy190 = yylhsminor.yy190; + case 215: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-4].minor.yy66, (tSQLExpr*)yymsp[-1].minor.yy224, TK_IN); } + yymsp[-4].minor.yy66 = yylhsminor.yy66; break; - case 214: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy158 = tSQLExprListAppend(yymsp[-2].minor.yy158,yymsp[0].minor.yy190,0);} - yymsp[-2].minor.yy158 = yylhsminor.yy158; + case 216: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy224 = tSQLExprListAppend(yymsp[-2].minor.yy224,yymsp[0].minor.yy66,0);} + yymsp[-2].minor.yy224 = yylhsminor.yy224; break; - case 215: /* exprlist ::= expritem */ -{yylhsminor.yy158 = tSQLExprListAppend(0,yymsp[0].minor.yy190,0);} - yymsp[0].minor.yy158 = yylhsminor.yy158; + case 217: /* exprlist ::= expritem */ +{yylhsminor.yy224 = tSQLExprListAppend(0,yymsp[0].minor.yy66,0);} + yymsp[0].minor.yy224 = yylhsminor.yy224; break; - case 216: /* expritem ::= expr */ -{yylhsminor.yy190 = yymsp[0].minor.yy190;} - yymsp[0].minor.yy190 = yylhsminor.yy190; + case 218: /* expritem ::= expr */ +{yylhsminor.yy66 = yymsp[0].minor.yy66;} + yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 218: /* cmd ::= RESET QUERY CACHE */ + case 220: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 219: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 221: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy511, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 220: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 222: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3021,14 +2786,14 @@ static YYACTIONTYPE yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 221: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 223: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy511, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 222: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 224: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3039,7 +2804,7 @@ static YYACTIONTYPE yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 223: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 225: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3053,34 +2818,34 @@ static YYACTIONTYPE yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 224: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 226: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy506, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy312, -1); SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 225: /* cmd ::= KILL CONNECTION INTEGER */ + case 227: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSQL(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 226: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 228: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 227: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 229: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); - return yyact; } /* @@ -3105,8 +2869,7 @@ static YYACTIONTYPE yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3117,8 +2880,7 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } #endif /* YYNOERRORRECOVERY */ @@ -3130,8 +2892,7 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3157,8 +2918,7 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* @@ -3167,8 +2927,7 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3183,8 +2942,7 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* The main parser program. @@ -3213,47 +2971,45 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - YYACTIONTYPE yyact; /* The parser action. */ + 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 = (yyParser*)yyp; /* The parser */ - ParseCTX_FETCH - ParseARG_STORE + yyParser *yypParser; /* The parser */ + yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif + ParseARG_STORE; - yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - if( yyact < YY_MIN_REDUCE ){ + int stateno = yypParser->yytos->stateno; + if( stateno < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact); + yyTracePrompt,yyTokenName[yymajor],stateno); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); } } #endif do{ - assert( yyact==yypParser->yytos->stateno ); - yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); + yy_shift(yypParser,yyact,yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - break; + yymajor = YYNOCODE; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3304,9 +3060,10 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE + YYERRORSYMBOL)) >= YY_MIN_REDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3323,8 +3080,6 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; - if( yymajor==YYNOCODE ) break; - yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3335,7 +3090,8 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - break; + yymajor = YYNOCODE; + #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3357,10 +3113,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - break; + yymajor = YYNOCODE; #endif } - }while( yypParser->yytos>yypParser->yystack ); + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3375,17 +3131,3 @@ void Parse( #endif return; } - -/* -** Return the fallback token corresponding to canonical token iToken, or -** 0 if iToken has no fallback. -*/ -int ParseFallback(int iToken){ -#ifdef YYFALLBACK - assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); - return yyFallback[iToken]; -#else - (void)iToken; - return 0; -#endif -} diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index a4e88fb9468e47f91e908ea669456d52b2592765..d89c383d6a4147ae6a2501fca0c73481f1a437f0 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -186,6 +186,12 @@ int32_t vnodeAlter(void *param, SMDCreateVnodeMsg *pVnodeCfg) { return code; } + code = walAlter(pVnode->wal, &pVnode->walCfg); + if (code != TSDB_CODE_SUCCESS) { + pVnode->status = TAOS_VN_STATUS_READY; + return code; + } + code = syncReconfig(pVnode->sync, &pVnode->syncCfg); if (code != TSDB_CODE_SUCCESS) { pVnode->status = TAOS_VN_STATUS_READY; @@ -390,6 +396,7 @@ void vnodeRelease(void *pVnodeRaw) { if (0 == tsEnableVnodeBak) { vInfo("vgId:%d, vnode backup not enabled", pVnode->vgId); } else { + taosRemoveDir(newDir); taosRename(rootDir, newDir); } diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 017eeaf4269aa2de78a8167c73a9e9f3596f7096..58e97075ac3f98197a6b6e17ac135d8bf9405b66 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -58,7 +58,8 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) { return TSDB_CODE_APP_NOT_READY; // TODO: Later, let slave to support query - if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) { + // if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) { + if (pVnode->role != TAOS_SYNC_ROLE_SLAVE && pVnode->role != TAOS_SYNC_ROLE_MASTER) { vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[msgType], pVnode->syncCfg.replica, pVnode->role); return TSDB_CODE_APP_NOT_READY; } diff --git a/src/wal/src/walMain.c b/src/wal/src/walMain.c index bebad69f3224e70efb795dad51e77745ea3053e4..a90c1b171c2c492a029ec0b56810518de1532f51 100644 --- a/src/wal/src/walMain.c +++ b/src/wal/src/walMain.c @@ -69,6 +69,13 @@ static void walModuleInitFunc() { wDebug("WAL module is initialized"); } +static inline bool walNeedFsyncTimer(SWal *pWal) { + if (pWal->fsyncPeriod > 0 && pWal->level == TAOS_WAL_FSYNC) { + return true; + } + return false; +} + void *walOpen(const char *path, const SWalCfg *pCfg) { SWal *pWal = calloc(sizeof(SWal), 1); if (pWal == NULL) { @@ -95,7 +102,7 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { tstrncpy(pWal->path, path, sizeof(pWal->path)); pthread_mutex_init(&pWal->mutex, NULL); - if (pWal->fsyncPeriod > 0 && pWal->level == TAOS_WAL_FSYNC) { + if (walNeedFsyncTimer(pWal)) { pWal->timer = taosTmrStart(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, walTmrCtrl); if (pWal->timer == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -127,6 +134,37 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { return pWal; } +int walAlter(twalh wal, const SWalCfg *pCfg) { + SWal *pWal = wal; + if (pWal == NULL) { + return TSDB_CODE_WAL_APP_ERROR; + } + + if (pWal->level == pCfg->walLevel && pWal->fsyncPeriod == pCfg->fsyncPeriod) { + wDebug("wal:%s, old walLevel:%d fsync:%d, new walLevel:%d fsync:%d not change", pWal->name, pWal->level, + pWal->fsyncPeriod, pCfg->walLevel, pCfg->fsyncPeriod); + return TSDB_CODE_SUCCESS; + } + + wInfo("wal:%s, change old walLevel:%d fsync:%d, new walLevel:%d fsync:%d", pWal->name, pWal->level, pWal->fsyncPeriod, + pCfg->walLevel, pCfg->fsyncPeriod); + + pthread_mutex_lock(&pWal->mutex); + pWal->level = pCfg->walLevel; + pWal->fsyncPeriod = pCfg->fsyncPeriod; + if (walNeedFsyncTimer(pWal)) { + wInfo("wal:%s, reset fsync timer, walLevel:%d fsyncPeriod:%d", pWal->name, pWal->level, pWal->fsyncPeriod); + taosTmrReset(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, &pWal->timer,walTmrCtrl); + } else { + wInfo("wal:%s, stop fsync timer, walLevel:%d fsyncPeriod:%d", pWal->name, pWal->level, pWal->fsyncPeriod); + taosTmrStop(pWal->timer); + pWal->timer = NULL; + } + pthread_mutex_unlock(&pWal->mutex); + + return TSDB_CODE_SUCCESS; +} + void walClose(void *handle) { if (handle == NULL) return; @@ -484,6 +522,12 @@ static void walProcessFsyncTimer(void *param, void *tmrId) { if (fsync(pWal->fd) < 0) { wError("wal:%s, fsync failed(%s)", pWal->name, strerror(errno)); } - - pWal->timer = taosTmrStart(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, walTmrCtrl); + + if (walNeedFsyncTimer(pWal)) { + pWal->timer = taosTmrStart(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, walTmrCtrl); + } else { + wInfo("wal:%s, stop fsync timer for walLevel:%d fsyncPeriod:%d", pWal->name, pWal->level, pWal->fsyncPeriod); + taosTmrStop(pWal->timer); + pWal->timer = NULL; + } } diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java index 1e801bc65894ef437ee41d692f9ef725b4f639ef..74e586d7fdf1a0f8ad65a807134caae7e05f6d4a 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java @@ -11,7 +11,6 @@ public class JDBCConnectorChecker { private static String tbName = "weather"; private Connection connection; - /** * get connection **/ @@ -170,5 +169,4 @@ public class JDBCConnectorChecker { checker.close(); } - } diff --git a/tests/gotest/batchtest.sh b/tests/gotest/batchtest.sh new file mode 100644 index 0000000000000000000000000000000000000000..a027dd0d7ce04c599233157bdd618fad3885c809 --- /dev/null +++ b/tests/gotest/batchtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +bash ./case001/case001.sh +#bash ./case002/case002.sh +#bash ./case003/case003.sh diff --git a/tests/gotest/case001/case001.go b/tests/gotest/case001/case001.go new file mode 100644 index 0000000000000000000000000000000000000000..1d5ede6d21a0bacad34cb807a16b50e0ae643512 --- /dev/null +++ b/tests/gotest/case001/case001.go @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package main + +import ( + "database/sql" + "fmt" + _ "github.com/taosdata/driver-go/taosSql" + "log" + "time" +) + +func main() { + taosDriverName := "taosSql" + demodb := "demodb" + demot := "demot" + + fmt.Printf("\n======== start demo test ========\n") + // open connect to taos server + db, err := sql.Open(taosDriverName, "root:taosdata@/tcp(192.168.1.217:7100)/") + if err != nil { + log.Fatalf("Open database error: %s\n", err) + } + defer db.Close() + + drop_database(db, demodb) + create_database(db, demodb) + use_database(db, demodb) + create_table(db, demot) + insert_data(db, demot) + select_data(db, demot) + + fmt.Printf("\n======== start stmt mode test ========\n") + + demodbStmt := "demodbStmt" + demotStmt := "demotStmt" + drop_database_stmt(db, demodbStmt) + create_database_stmt(db, demodbStmt) + use_database_stmt(db, demodbStmt) + create_table_stmt(db, demotStmt) + insert_data_stmt(db, demotStmt) + select_data_stmt(db, demotStmt) + + fmt.Printf("\n======== end demo test ========\n") +} + +func drop_database(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + res, err := db.Exec("drop database if exists " + demodb) + checkErr(err, "drop database if exists "+demodb) + + affectd, err := res.RowsAffected() + checkErr(err, "drop db, res.RowsAffected") + + et := time.Now().Nanosecond() + + fmt.Printf("drop database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) + + //sleep 50毫秒 + time.Sleep(time.Duration(50)* time.Millisecond) +} + +func create_database(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + // create database + res, err := db.Exec("create database " + demodb) + checkErr(err, "create db, db.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "create db, res.RowsAffected") + + et := time.Now().Nanosecond() + + fmt.Printf("create database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) + + return +} + +func use_database(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + // use database + res, err := db.Exec("use " + demodb) // notes: must no quote to db name + checkErr(err, "use db db.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "use db, res.RowsAffected") + + et := time.Now().Nanosecond() + + fmt.Printf("use database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func create_table(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + // create table + res, err := db.Exec("create table " + demot + " (ts timestamp, id int, name binary(8), len tinyint, flag bool, notes binary(8), fv float, dv double)") + checkErr(err, "create table db.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "create table res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("create table result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func insert_data(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + // insert data + res, err := db.Exec("insert into " + demot + + " values (now, 100, 'beijing', 10, true, 'one', 123.456, 123.456)" + + " (now+1s, 101, 'shanghai', 11, true, 'two', 789.123, 789.123)" + + " (now+2s, 102, 'shenzhen', 12, false, 'three', 456.789, 456.789)") + + checkErr(err, "insert data, db.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "insert data res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("insert data result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func select_data(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + + rows, err := db.Query("select * from ? ", demot) // go text mode + checkErr(err, "select db.Query") + + fmt.Printf("%10s%s%8s %5s %9s%s %s %8s%s %7s%s %8s%s %4s%s %5s%s\n", " ", "ts", " ", "id", " ", "name", " ", "len", " ", "flag", " ", "notes", " ", "fv", " ", " ", "dv") + var affectd int + + //decoder := mahonia.NewDecoder("gbk") // 把原来ANSI格式的文本文件里的字符,用gbk进行解码。 + + for rows.Next() { + var ts string + var name string + var id int + var len int8 + var flag bool + var notes string + var fv float32 + var dv float64 + + err = rows.Scan(&ts, &id, &name, &len, &flag, ¬es, &fv, &dv) + checkErr(err, "select rows.Scan") + + fmt.Printf("%s|\t", ts) + fmt.Printf("%d|\t", id) + fmt.Printf("%10s|\t", name) + fmt.Printf("%d|\t", len) + fmt.Printf("%t|\t", flag) + fmt.Printf("%s|\t", notes) + fmt.Printf("%06.3f|\t", fv) + fmt.Printf("%09.6f|\n\n", dv) + + affectd++ + } + + et := time.Now().Nanosecond() + fmt.Printf("select data result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) + //fmt.Printf("insert data result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1E9) +} + +func drop_database_stmt(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + // drop test db + res, err := db.Exec("drop database if exists " + demodb) + checkErr(err, "drop database "+demodb) + + affectd, err := res.RowsAffected() + checkErr(err, "drop db, res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("drop database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func create_database_stmt(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + // create database + //var stmt interface{} + stmt, err := db.Prepare("create database ?") + checkErr(err, "create db, db.Prepare") + + //var res driver.Result + res, err := stmt.Exec(demodb) + checkErr(err, "create db, stmt.Exec") + + //fmt.Printf("Query OK, %d row(s) affected()", res.RowsAffected()) + affectd, err := res.RowsAffected() + checkErr(err, "create db, res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("create database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func use_database_stmt(db *sql.DB, demodb string) { + st := time.Now().Nanosecond() + // create database + //var stmt interface{} + stmt, err := db.Prepare("use " + demodb) + checkErr(err, "use db, db.Prepare") + + res, err := stmt.Exec() + checkErr(err, "use db, stmt.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "use db, res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("use database result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func create_table_stmt(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + // create table + // (ts timestamp, id int, name binary(8), len tinyint, flag bool, notes binary(8), fv float, dv double) + stmt, err := db.Prepare("create table ? (? timestamp, ? int, ? binary(10), ? tinyint, ? bool, ? binary(8), ? float, ? double)") + checkErr(err, "create table db.Prepare") + + res, err := stmt.Exec(demot, "ts", "id", "name", "len", "flag", "notes", "fv", "dv") + checkErr(err, "create table stmt.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "create table res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("create table result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func insert_data_stmt(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + // insert data into table + stmt, err := db.Prepare("insert into ? values(?, ?, ?, ?, ?, ?, ?, ?) (?, ?, ?, ?, ?, ?, ?, ?) (?, ?, ?, ?, ?, ?, ?, ?)") + checkErr(err, "insert db.Prepare") + + res, err := stmt.Exec(demot, "now", 1000, "'haidian'", 6, true, "'AI world'", 6987.654, 321.987, + "now+1s", 1001, "'changyang'", 7, false, "'DeepMode'", 12356.456, 128634.456, + "now+2s", 1002, "'chuangping'", 8, true, "'database'", 3879.456, 65433478.456) + checkErr(err, "insert data, stmt.Exec") + + affectd, err := res.RowsAffected() + checkErr(err, "res.RowsAffected") + + et := time.Now().Nanosecond() + fmt.Printf("insert data result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func select_data_stmt(db *sql.DB, demot string) { + st := time.Now().Nanosecond() + + stmt, err := db.Prepare("select ?, ?, ?, ?, ?, ?, ?, ? from ?") // go binary mode + checkErr(err, "db.Prepare") + + rows, err := stmt.Query("ts", "id", "name", "len", "flag", "notes", "fv", "dv", demot) + checkErr(err, "stmt.Query") + + fmt.Printf("%10s%s%8s %5s %8s%s %s %10s%s %7s%s %8s%s %11s%s %14s%s\n", " ", "ts", " ", "id", " ", "name", " ", "len", " ", "flag", " ", "notes", " ", "fv", " ", " ", "dv") + var affectd int + for rows.Next() { + var ts string + var name string + var id int + var len int8 + var flag bool + var notes string + var fv float32 + var dv float64 + + err = rows.Scan(&ts, &id, &name, &len, &flag, ¬es, &fv, &dv) + //fmt.Println("start scan fields from row.rs, &fv:", &fv) + //err = rows.Scan(&fv) + checkErr(err, "rows.Scan") + + fmt.Printf("%s|\t", ts) + fmt.Printf("%d|\t", id) + fmt.Printf("%10s|\t", name) + fmt.Printf("%d|\t", len) + fmt.Printf("%t|\t", flag) + fmt.Printf("%s|\t", notes) + fmt.Printf("%06.3f|\t", fv) + fmt.Printf("%09.6f|\n", dv) + + affectd++ + + } + + et := time.Now().Nanosecond() + fmt.Printf("select data result:\n %d row(s) affectd (%6.6fs)\n\n", affectd, (float32(et-st))/1e9) +} + +func checkErr(err error, prompt string) { + if err != nil { + fmt.Printf("%s\n", prompt) + panic(err) + } +} diff --git a/tests/gotest/case001/case001.sh b/tests/gotest/case001/case001.sh new file mode 100644 index 0000000000000000000000000000000000000000..5a9034c4d18e257eaaf9324c570fbc17b01c548b --- /dev/null +++ b/tests/gotest/case001/case001.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +################################################## +# +# Do go test +# +################################################## + +set +e +#set -x + +script_dir="$(dirname $(readlink -f $0))" +#echo "pwd: $script_dir, para0: $0" + +execName=$0 +execName=`echo ${execName##*/}` +goName=`echo ${execName%.*}` + +###### step 1: start one taosd +scriptDir=$script_dir/../../script/sh +bash $scriptDir/stop_dnodes.sh +bash $scriptDir/deploy.sh -n dnode1 -i 1 +bash $scriptDir/cfg.sh -n dnode1 -c walLevel -v 0 +bash $scriptDir/exec.sh -n dnode1 -s start + +###### step 2: set config item +TAOS_CFG=/etc/taos/taos.cfg +HOSTNAME=`hostname -f` + +if [ ! -f ${TAOS_CFG} ]; then + touch -f $TAOS_CFG +fi + +echo " " > $TAOS_CFG +echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG +echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG +echo "serverPort 7100" >> $TAOS_CFG +#echo "dataDir $DATA_DIR" >> $TAOS_CFG +#echo "logDir $LOG_DIR" >> $TAOS_CFG +#echo "scriptDir ${CODE_DIR}/../script" >> $TAOS_CFG +echo "numOfLogLines 100000000" >> $TAOS_CFG +echo "dDebugFlag 135" >> $TAOS_CFG +echo "mDebugFlag 135" >> $TAOS_CFG +echo "sdbDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "tmrDebugFlag 131" >> $TAOS_CFG +echo "cDebugFlag 135" >> $TAOS_CFG +echo "httpDebugFlag 135" >> $TAOS_CFG +echo "monitorDebugFlag 135" >> $TAOS_CFG +echo "udebugFlag 135" >> $TAOS_CFG +echo "tablemetakeeptimer 5" >> $TAOS_CFG +echo "wal 0" >> $TAOS_CFG +echo "asyncLog 0" >> $TAOS_CFG +echo "locale en_US.UTF-8" >> $TAOS_CFG +echo "enableCoreFile 1" >> $TAOS_CFG +echo " " >> $TAOS_CFG + +ulimit -n 600000 +ulimit -c unlimited +# +##sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e +# + +###### step 3: start build +cd $script_dir +rm -f go.* +go mod init $goName +go build +sleep 1s +sudo ./$goName diff --git a/tests/gotest/test.sh b/tests/gotest/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..fe80d4429546513521286db657a961e0ca8ffc14 --- /dev/null +++ b/tests/gotest/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +################################################## +# +# Do go test +# +################################################## + +set +e +#set -x + +FILE_NAME= +RELEASE=0 +while getopts "f:" arg +do + case $arg in + f) + FILE_NAME=$OPTARG + echo "input file: $FILE_NAME" + ;; + ?) + echo "unknow argument" + ;; + esac +done + +# start one taosd +bash ../script/sh/stop_dnodes.sh +bash ../script/sh/deploy.sh -n dnode1 -i 1 +bash ../script/sh/cfg.sh -n dnode1 -c walLevel -v 0 +bash ../script/sh/exec.sh -n dnode1 -s start + +# start build test go file +caseDir=`echo ${FILE_NAME%/*}` +echo "caseDir: $caseDir" +cd $caseDir +rm go.* +go mod init $caseDir +go build +sleep 1s +./$caseDir + diff --git a/tests/perftest-scripts/coverage_test.sh b/tests/perftest-scripts/coverage_test.sh index a0c8fe4b3fe7c3477e233f1628d5ecf7d0744ec1..5085ec89d00def1a2147f24ccbeb488406541775 100755 --- a/tests/perftest-scripts/coverage_test.sh +++ b/tests/perftest-scripts/coverage_test.sh @@ -53,7 +53,7 @@ function buildTDengine { function runGeneralCaseOneByOne { while read -r line; do if [[ $line =~ ^./test.sh* ]]; then - case=`echo $line | grep -w "general\|unique\/mnode\/mgmt33.sim\|unique\/stable\/dnode3.sim\|unique\/cluster\/balance3.sim\|unique\/arbitrator\/offline_replica2_alterTable_online.sim"|awk '{print $NF}'` + case=`echo $line | grep sim$ |awk '{print $NF}'` if [ -n "$case" ]; then ./test.sh -f $case > /dev/null 2>&1 && \ diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 9ebf1584e224c1bd0732d7e209ffc19db9864399..597102a0f0b356f921d284ceaace4d99c6850f24 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -16,6 +16,7 @@ python3 ./test.py -f insert/nchar.py python3 ./test.py -f insert/nchar-unicode.py python3 ./test.py -f insert/multi.py python3 ./test.py -f insert/randomNullCommit.py +python3 insert/retentionpolicy.py python3 ./test.py -f table/column_name.py python3 ./test.py -f table/column_num.py @@ -154,6 +155,7 @@ python3 ./test.py -f stream/new.py python3 ./test.py -f stream/stream1.py python3 ./test.py -f stream/stream2.py python3 ./test.py -f stream/parser.py +python3 ./test.py -f stream/history.py #alter table python3 ./test.py -f alter/alter_table_crash.py @@ -192,3 +194,8 @@ python3 test.py -f query/queryInterval.py # tools python3 test.py -f tools/taosdemo.py + +# subscribe +python3 test.py -f subscribe/singlemeter.py +#python3 test.py -f subscribe/stability.py +python3 test.py -f subscribe/supertable.py \ No newline at end of file diff --git a/tests/pytest/insert/retentionpolicy.py b/tests/pytest/insert/retentionpolicy.py new file mode 100644 index 0000000000000000000000000000000000000000..c50de31cc468b6a2d48c226dae24bc3d1fe4f033 --- /dev/null +++ b/tests/pytest/insert/retentionpolicy.py @@ -0,0 +1,112 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +import datetime +sys.path.insert(0, os.getcwd()) +import taos +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestRetetion: + def init(self): + self.queryRows=0 + tdLog.debug("start to execute %s" % __file__) + tdLog.info("prepare cluster") + tdDnodes.init("") + tdDnodes.setTestCluster(False) + tdDnodes.setValgrind(False) + tdDnodes.stopAll() + tdDnodes.deploy(1) + tdDnodes.start(1) + print(tdDnodes.getDnodesRootDir()) + self.conn = taos.connect(config=tdDnodes.getSimCfgPath()) + tdSql.init(self.conn.cursor()) + tdSql.execute('reset query cache') + def checkRows(self, expectRows,sql): + if self.queryRows == expectRows: + tdLog.info("sql:%s, queryRows:%d == expect:%d" % (sql, self.queryRows, expectRows)) + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, self.queryRows, expectRows) + os.system("timedatectl set-ntp true") + tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + + def run(self): + + tdLog.info("=============== step1") + tdSql.execute('create database test keep 3 days 1;') + tdSql.execute('use test;') + tdSql.execute('create table test(ts timestamp,i int);') + + cmd = 'insert into test values(now-2d,11)(now-1d,11)(now,11)(now+1d,11);' + tdLog.info(cmd) + tdSql.execute(cmd) + tdSql.query('select * from test') + tdSql.checkRows(4) + + tdLog.info("=============== step2") + tdDnodes.stop(1) + os.system("timedatectl set-ntp false") + os.system("date -s $(date -d \"${DATE} 2 days\" \"+%Y%m%d\")") + tdDnodes.start(1) + cmd = 'insert into test values(now,11);' + tdLog.info(cmd) + tdSql.execute(cmd) + queryRows=tdSql.query('select * from test') + if queryRows==4: + tdSql.checkRows(4) + return 0 + else: + tdSql.checkRows(5) + + tdLog.info("=============== step3") + tdDnodes.stop(1) + os.system("date -s $(date -d \"${DATE} 2 days\" \"+%Y%m%d\")") + tdDnodes.start(1) + cmd = 'insert into test values(now-1d,11);' + tdLog.info(cmd) + tdSql.execute(cmd) + queryRows=tdSql.query('select * from test') + tdSql.checkRows(6) + tdLog.info("=============== step4") + tdDnodes.stop(1) + tdDnodes.start(1) + cmd = 'insert into test values(now,11);' + tdLog.info(cmd) + tdSql.execute(cmd) + tdSql.query('select * from test') + tdSql.checkRows(7) + + tdLog.info("=============== step5") + tdDnodes.stop(1) + tdDnodes.start(1) + cmd='select * from test where ts > now-1d' + queryRows=tdSql.query('select * from test where ts > now-1d') + self.checkRows(1,cmd) + + def stop(self): + os.system("timedatectl set-ntp true") + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +clients = TDTestRetetion() +clients.init() +clients.run() +clients.stop() + diff --git a/tests/pytest/stream/history.py b/tests/pytest/stream/history.py new file mode 100644 index 0000000000000000000000000000000000000000..890580001cf40a13ba18f6f81a3bd0faaac67991 --- /dev/null +++ b/tests/pytest/stream/history.py @@ -0,0 +1,63 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.execute("create table cars(ts timestamp, s int) tags(id int)") + tdSql.execute("create table car0 using cars tags(0)") + tdSql.execute("create table car1 using cars tags(1)") + tdSql.execute("create table car2 using cars tags(2)") + tdSql.execute("create table car3 using cars tags(3)") + tdSql.execute("create table car4 using cars tags(4)") + + tdSql.execute("insert into car0 values('2019-01-01 00:00:00.103', 1)") + tdSql.execute("insert into car1 values('2019-01-01 00:00:00.234', 1)") + tdSql.execute("insert into car0 values('2019-01-01 00:00:01.012', 1)") + tdSql.execute("insert into car0 values('2019-01-01 00:00:02.003', 1)") + tdSql.execute("insert into car2 values('2019-01-01 00:00:02.328', 1)") + tdSql.execute("insert into car0 values('2019-01-01 00:00:03.139', 1)") + tdSql.execute("insert into car0 values('2019-01-01 00:00:04.348', 1)") + tdSql.execute("insert into car0 values('2019-01-01 00:00:05.783', 1)") + tdSql.execute("insert into car1 values('2019-01-01 00:00:01.893', 1)") + tdSql.execute("insert into car1 values('2019-01-01 00:00:02.712', 1)") + tdSql.execute("insert into car1 values('2019-01-01 00:00:03.982', 1)") + tdSql.execute("insert into car3 values('2019-01-01 00:00:01.389', 1)") + tdSql.execute("insert into car4 values('2019-01-01 00:00:01.829', 1)") + + tdSql.execute("create table strm as select count(*) from cars interval(4s)") + tdSql.waitedQuery("select * from strm", 2, 100) + tdSql.checkData(0, 1, 11) + tdSql.checkData(1, 1, 2) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemo.py b/tests/pytest/tools/taosdemo.py index 54d33c90f36bc5f5b817f7ea9ec6d8787a3f0d78..5bf8ebaf03beb052f09d80b92c6b6b6d588e4f4f 100644 --- a/tests/pytest/tools/taosdemo.py +++ b/tests/pytest/tools/taosdemo.py @@ -16,6 +16,7 @@ import os from util.log import * from util.cases import * from util.sql import * +from util.dnodes import * class TDTestCase: @@ -25,11 +26,30 @@ class TDTestCase: self.numberOfTables = 10000 self.numberOfRecords = 100 + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath def run(self): tdSql.prepare() - - os.system("yes | taosdemo -t %d -n %d" % (self.numberOfTables, self.numberOfRecords)) + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + os.system("yes | %staosdemo -t %d -n %d" % (binPath,self.numberOfTables, self.numberOfRecords)) tdSql.execute("use test") tdSql.query("select count(*) from meters") diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index 4df79002658056c44670baf0664fccfacefd0261..4dd3957f390237c6dddc6b1f66b14ee177b6dbcf 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -220,3 +220,5 @@ run general/stream/table_del.sim run general/stream/metrics_del.sim run general/stream/table_replica1_vnoden.sim run general/stream/metrics_replica1_vnoden.sim +run general/db/show_create_db.sim +run general/db/show_create_table.sim diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 49c75966ca12524e0ae80fcb58d7d5e710e78293..c8aa2480c509353ede3c6ce6269afa9e6efd62b5 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -218,7 +218,10 @@ if $data12_db != 1 then return -1 endi -sql_error alter database db wal 2 +sql alter database db wal 1 +sql alter database db wal 2 +sql alter database db wal 1 +sql alter database db wal 2 sql_error alter database db wal 0 sql_error alter database db wal 3 sql_error alter database db wal 4 @@ -226,11 +229,13 @@ sql_error alter database db wal -1 sql_error alter database db wal 1000 print ============== step fsync -sql_error alter database db fsync 2 -sql_error alter database db fsync 3 -sql_error alter database db fsync 4 +sql alter database db fsync 0 +sql alter database db fsync 1 +sql alter database db fsync 3600 +sql alter database db fsync 18000 +sql alter database db fsync 180000 +sql_error alter database db fsync 180001 sql_error alter database db fsync -1 -sql_error alter database db fsync 1000 print ============== step comp sql show databases diff --git a/tests/script/general/db/show_create_db.sim b/tests/script/general/db/show_create_db.sim new file mode 100644 index 0000000000000000000000000000000000000000..baa7b253e12154c5d320dd6d8411e223ce1cd4e2 --- /dev/null +++ b/tests/script/general/db/show_create_db.sim @@ -0,0 +1,32 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 + +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print =============== step2 +sql create database db +sql show create database db + +if $rows != 1 then + return -1 +endi + +print =============== step3 +sql use db +sql show create database db + +if $rows != 1 then + return -1 +endi + +if $data00 != db then + return -1 +endi + +sql drop database db + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/db/show_create_table.sim b/tests/script/general/db/show_create_table.sim new file mode 100644 index 0000000000000000000000000000000000000000..83386387093a7c4f778bb5696eea6019fd4691fa --- /dev/null +++ b/tests/script/general/db/show_create_table.sim @@ -0,0 +1,87 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 + +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print ===============create three type table +sql create database db +sql use db +sql create table meters(ts timestamp, f binary(8)) tags(loc int, zone binary(8)) +sql create table t0 using meters tags(1,'ch') +sql create table normalTbl(ts timestamp, zone binary(8)) + +sql use db +sql show create table meters +if $rows != 1 then + return -1 +endi + +print ===============check sub table +sql show create table t0 +if $rows != 1 then + return -1 +endi +if $data00 == 't0' then + return -1 +endi + +print ===============check normal table + +sql show create table normalTbl +if $rows != 1 then + return -1 +endi + +if $data00 == 'normalTbl' then + return -1 +endi + +print ===============check super table +sql show create table meters +if $rows != 1 then + return -1 +endi + +if $data00 == 'meters' then + return -1 +endi + +print ===============check sub table with prefix + +sql show create table db.t0 +if $rows != 1 then + return -1 +endi + +if $data00 == 't0' then + return -1 +endi + +print ===============check normal table with prefix +sql show create table db.normalTbl +if $rows != 1 then + return -1 +endi + +if $data00 == 'normalTbl' then + return -1 +endi + + +print ===============check super table with prefix +sql show create table db.meters +if $rows != 1 then + return -1 +endi + +if $data00 == 'meters' then + return -1 +endi + +sql drop database db + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/http/gzip.sim b/tests/script/general/http/gzip.sim index 0289e337a66f7fbb52752ef51f00432d8f1c3ff6..9c77567abb9874459a2363a93cb62cb57cf02b1a 100644 --- a/tests/script/general/http/gzip.sim +++ b/tests/script/general/http/gzip.sim @@ -3,7 +3,7 @@ sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c maxSQLLength -v 7340032 +system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -18,10 +18,22 @@ sql use d1 sql create table table_rest (ts timestamp, i int) print sql length is 270KB restful d1 table_rest 1591072800 10000 gzip +restful d1 table_rest 1591172800 10000 gzip +restful d1 table_rest 1591272800 10000 gzip +restful d1 table_rest 1591372800 10000 gzip +restful d1 table_rest 1591472800 10000 gzip +restful d1 table_rest 1591572800 10000 gzip +restful d1 table_rest 1591672800 10000 gzip +restful d1 table_rest 1591772800 10000 gzip +restful d1 table_rest 1591872800 10000 gzip +restful d1 table_rest 1591972800 10000 gzip + sql select * from table_rest; print rows: $rows -if $rows != 10000 then +if $rows != 100000 then return -1 endi +system curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:7111/rest/sql --compressed + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index adb22aa265a34b95f61f881984dedb007805a268..9e42adfea9db15e91f836a57ea2e18ebb8b2c5ac 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -79,6 +79,7 @@ cd ../../../debug; make ./test.sh -f general/http/autocreate.sim ./test.sh -f general/http/chunked.sim +./test.sh -f general/http/gzip.sim ./test.sh -f general/http/restful.sim ./test.sh -f general/http/restful_insert.sim ./test.sh -f general/http/restful_limit.sim diff --git a/tests/test-all.sh b/tests/test-all.sh index 275c6b16773bb3df00271ea1628dad706a1f4252..84b663809d03cc87010e048bbe0289f42e5d3a09 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -9,8 +9,9 @@ NC='\033[0m' function runSimCaseOneByOne { while read -r line; do - if [[ $line =~ ^run.* ]]; then - case=`echo $line | awk '{print $NF}'` + if [[ $line =~ ^./test.sh* ]]; then + case=`echo $line | grep sim$ |awk '{print $NF}'` + start_time=`date +%s` ./test.sh -f $case > /dev/null 2>&1 && \ echo -e "${GREEN}$case success${NC}" | tee -a out.log || \ @@ -54,7 +55,7 @@ if [ "$2" != "python" ]; then runSimCaseOneByOne regressionSuite.sim elif [ "$1" == "full" ]; then echo "### run TSIM full test ###" - runSimCaseOneByOne fullGeneralSuite.sim + runSimCaseOneByOne jenkins/basic.txt elif [ "$1" == "smoke" ] || [ -z "$1" ]; then echo "### run TSIM smoke test ###" runSimCaseOneByOne basicSuite.sim