Merge pull request #5900 from taosdata/feature/qrefactor
Feature/qrefactor
This commit is contained in:
commit
272b524bce
|
@ -69,7 +69,6 @@ IF (TD_LINUX_32)
|
|||
ENDIF ()
|
||||
|
||||
IF (TD_ARM_64)
|
||||
ADD_DEFINITIONS(-D_M_X64)
|
||||
ADD_DEFINITIONS(-D_TD_ARM_64)
|
||||
ADD_DEFINITIONS(-D_TD_ARM_)
|
||||
ADD_DEFINITIONS(-DUSE_LIBICONV)
|
||||
|
@ -86,17 +85,19 @@ IF (TD_ARM_32)
|
|||
ENDIF ()
|
||||
|
||||
IF (TD_MIPS_64)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_64_)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_64)
|
||||
ADD_DEFINITIONS(-DUSE_LIBICONV)
|
||||
MESSAGE(STATUS "mips64 is defined")
|
||||
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||
ENDIF ()
|
||||
|
||||
IF (TD_MIPS_32)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_32_)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_)
|
||||
ADD_DEFINITIONS(-D_TD_MIPS_32)
|
||||
ADD_DEFINITIONS(-DUSE_LIBICONV)
|
||||
MESSAGE(STATUS "mips32 is defined")
|
||||
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||
SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||
ENDIF ()
|
||||
|
||||
IF (TD_APLHINE)
|
||||
|
|
|
@ -49,6 +49,14 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions
|
|||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getResultTimePrecision
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: connectImp
|
||||
|
|
|
@ -671,3 +671,20 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
|
|||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset(JNIEnv *env, jobject jobj) {
|
||||
return (*env)->NewStringUTF(env, (const char *)tsCharset);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision(JNIEnv *env, jobject jobj, jlong con,
|
||||
jlong res) {
|
||||
TAOS *tscon = (TAOS *)con;
|
||||
if (tscon == NULL) {
|
||||
jniError("jobj:%p, connection is closed", jobj);
|
||||
return JNI_CONNECTION_NULL;
|
||||
}
|
||||
|
||||
TAOS_RES *result = (TAOS_RES *)res;
|
||||
if (result == NULL) {
|
||||
jniError("jobj:%p, conn:%p, resultset is null", jobj, tscon);
|
||||
return JNI_RESULT_SET_NULL;
|
||||
}
|
||||
|
||||
return taos_result_precision(result);
|
||||
}
|
|
@ -57,7 +57,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
|
|||
|
||||
strntolower(pSql->sqlstr, sqlstr, (int32_t)sqlLen);
|
||||
|
||||
tscDebugL("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
tscDebugL("0x%"PRIx64" SQL: %s", pSql->self, pSql->sqlstr);
|
||||
pCmd->curSql = pSql->sqlstr;
|
||||
|
||||
int32_t code = tsParseSql(pSql, true);
|
||||
|
@ -283,7 +283,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
|
|||
static void tscAsyncResultCallback(SSchedMsg *pMsg) {
|
||||
SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, (int64_t)pMsg->ahandle);
|
||||
if (pSql == NULL || pSql->signature != pSql) {
|
||||
tscDebug("%p SqlObj is freed, not add into queue async res", pSql);
|
||||
tscDebug("%p SqlObj is freed, not add into queue async res", pMsg->ahandle);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -372,13 +372,13 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
goto _error;
|
||||
}
|
||||
|
||||
tscDebug("%p get %s successfully", pSql, msg);
|
||||
tscDebug("0x%"PRIx64" get %s successfully", pSql->self, msg);
|
||||
if (pSql->pStream == NULL) {
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
|
||||
|
||||
// check if it is a sub-query of super table query first, if true, enter another routine
|
||||
if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, (TSDB_QUERY_TYPE_STABLE_SUBQUERY|TSDB_QUERY_TYPE_SUBQUERY|TSDB_QUERY_TYPE_TAG_FILTER_QUERY))) {
|
||||
tscDebug("%p update local table meta, continue to process sql and send the corresponding query", pSql);
|
||||
tscDebug("0x%"PRIx64" update local table meta, continue to process sql and send the corresponding query", pSql->self);
|
||||
|
||||
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
|
||||
|
@ -402,7 +402,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
return;
|
||||
} else { // continue to process normal async query
|
||||
if (pCmd->parseFinished) {
|
||||
tscDebug("%p update local table meta, continue to process sql and send corresponding query", pSql);
|
||||
tscDebug("0x%"PRIx64" update local table meta, continue to process sql and send corresponding query", pSql->self);
|
||||
|
||||
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||
code = tscGetTableMeta(pSql, pTableMetaInfo);
|
||||
|
@ -416,7 +416,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
assert(pCmd->command != TSDB_SQL_INSERT);
|
||||
|
||||
if (pCmd->command == TSDB_SQL_SELECT) {
|
||||
tscDebug("%p redo parse sql string and proceed", pSql);
|
||||
tscDebug("0x%"PRIx64" redo parse sql string and proceed", pSql->self);
|
||||
pCmd->parseFinished = false;
|
||||
tscResetSqlCmd(pCmd, true);
|
||||
|
||||
|
@ -436,7 +436,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
taosReleaseRef(tscObjRef, pSql->self);
|
||||
return;
|
||||
} else {
|
||||
tscDebug("%p continue parse sql after get table meta", pSql);
|
||||
tscDebug("0x%"PRIx64" continue parse sql after get table meta", pSql->self);
|
||||
|
||||
code = tsParseSql(pSql, false);
|
||||
if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
||||
|
@ -486,7 +486,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
}
|
||||
}
|
||||
|
||||
tscDebug("%p stream:%p meta is updated, start new query, command:%d", pSql, pSql->pStream, pSql->cmd.command);
|
||||
tscDebug("0x%"PRIx64" stream:%p meta is updated, start new query, command:%d", pSql->self, pSql->pStream, pSql->cmd.command);
|
||||
if (!pSql->cmd.parseFinished) {
|
||||
tsParseSql(pSql, false);
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
for (int32_t i = 0; i < numOfBuffer; ++i) {
|
||||
int32_t len = pMemBuffer[i]->fileMeta.flushoutData.nLength;
|
||||
if (len == 0) {
|
||||
tscDebug("%p no data retrieved from orderOfVnode:%d", pSql, i + 1);
|
||||
tscDebug("0x%"PRIx64" no data retrieved from orderOfVnode:%d", pSql->self, i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
if (numOfFlush == 0 || numOfBuffer == 0) {
|
||||
tscLocalReducerEnvDestroy(pMemBuffer, pDesc, finalmodel, pFFModel, numOfBuffer);
|
||||
pCmd->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; // no result, set the result empty
|
||||
tscDebug("%p retrieved no data", pSql);
|
||||
tscDebug("0x%"PRIx64" retrieved no data", pSql->self);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
pReducer->numOfVnode = numOfBuffer;
|
||||
|
||||
pReducer->pDesc = pDesc;
|
||||
tscDebug("%p the number of merged leaves is: %d", pSql, pReducer->numOfBuffer);
|
||||
tscDebug("0x%"PRIx64" the number of merged leaves is: %d", pSql->self, pReducer->numOfBuffer);
|
||||
|
||||
int32_t idx = 0;
|
||||
for (int32_t i = 0; i < numOfBuffer; ++i) {
|
||||
|
@ -258,7 +258,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
ds->pageId = 0;
|
||||
ds->rowIdx = 0;
|
||||
|
||||
tscDebug("%p load data from disk into memory, orderOfVnode:%d, total:%d", pSql, i + 1, idx + 1);
|
||||
tscDebug("0x%"PRIx64" load data from disk into memory, orderOfVnode:%d, total:%d", pSql->self, i + 1, idx + 1);
|
||||
tExtMemBufferLoadData(pMemBuffer[i], &(ds->filePage), j, 0);
|
||||
#ifdef _DEBUG_VIEW
|
||||
printf("load data page into mem for build loser tree: %" PRIu64 " rows\n", ds->filePage.num);
|
||||
|
@ -272,7 +272,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
#endif
|
||||
|
||||
if (ds->filePage.num == 0) { // no data in this flush, the index does not increase
|
||||
tscDebug("%p flush data is empty, ignore %d flush record", pSql, idx);
|
||||
tscDebug("0x%"PRIx64" flush data is empty, ignore %d flush record", pSql->self, idx);
|
||||
tfree(ds);
|
||||
continue;
|
||||
}
|
||||
|
@ -547,10 +547,10 @@ void tscDestroyLocalMerger(SSqlObj *pSql) {
|
|||
pLocalMerge->numOfCompleted = 0;
|
||||
free(pLocalMerge);
|
||||
} else {
|
||||
tscDebug("%p already freed or another free function is invoked", pSql);
|
||||
tscDebug("0x%"PRIx64" already freed or another free function is invoked", pSql->self);
|
||||
}
|
||||
|
||||
tscDebug("%p free local reducer finished", pSql);
|
||||
tscDebug("0x%"PRIx64" free local reducer finished", pSql->self);
|
||||
}
|
||||
|
||||
static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCmd, SColumnModel *pModel) {
|
||||
|
|
|
@ -1089,7 +1089,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
|
|||
str = pCmd->curSql;
|
||||
}
|
||||
|
||||
tscDebug("%p create data block list hashList:%p", pSql, pCmd->pTableBlockHashList);
|
||||
tscDebug("0x%"PRIx64" create data block list hashList:%p", pSql->self, pCmd->pTableBlockHashList);
|
||||
|
||||
while (1) {
|
||||
int32_t index = 0;
|
||||
|
@ -1303,7 +1303,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
|
|||
SSqlCmd* pCmd = &pSql->cmd;
|
||||
|
||||
if ((!pCmd->parseFinished) && (!initial)) {
|
||||
tscDebug("%p resume to parse sql: %s", pSql, pCmd->curSql);
|
||||
tscDebug("0x%"PRIx64" resume to parse sql: %s", pSql->self, pCmd->curSql);
|
||||
}
|
||||
|
||||
ret = tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE);
|
||||
|
|
|
@ -61,7 +61,7 @@ void tscAddIntoSqlList(SSqlObj *pSql) {
|
|||
pSql->stime = taosGetTimestampMs();
|
||||
pSql->listed = 1;
|
||||
|
||||
tscDebug("%p added into sqlList", pSql);
|
||||
tscDebug("0x%"PRIx64" added into sqlList", pSql->self);
|
||||
}
|
||||
|
||||
void tscSaveSlowQueryFpCb(void *param, TAOS_RES *result, int code) {
|
||||
|
@ -99,7 +99,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p query time:%" PRId64 " sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
|
||||
tscDebug("0x%"PRIx64" query time:%" PRId64 " sql:%s", pSql->self, pSql->res.useconds, pSql->sqlstr);
|
||||
int32_t sqlSize = (int32_t)(TSDB_SLOW_QUERY_SQL_LEN + size);
|
||||
|
||||
char *sql = malloc(sqlSize);
|
||||
|
@ -141,7 +141,7 @@ void tscRemoveFromSqlList(SSqlObj *pSql) {
|
|||
pSql->listed = 0;
|
||||
|
||||
tscSaveSlowQuery(pSql);
|
||||
tscDebug("%p removed from sqlList", pSql);
|
||||
tscDebug("0x%"PRIx64" removed from sqlList", pSql->self);
|
||||
}
|
||||
|
||||
void tscKillQuery(STscObj *pObj, uint32_t killId) {
|
||||
|
@ -158,7 +158,7 @@ void tscKillQuery(STscObj *pObj, uint32_t killId) {
|
|||
if (pSql == NULL) {
|
||||
tscError("failed to kill query, id:%d, it may have completed/terminated", killId);
|
||||
} else {
|
||||
tscDebug("%p query is killed, queryId:%d", pSql, killId);
|
||||
tscDebug("0x%"PRIx64" query is killed, queryId:%d", pSql->self, killId);
|
||||
taos_stop_query(pSql);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
|
|||
pthread_mutex_unlock(&pObj->mutex);
|
||||
|
||||
if (pStream) {
|
||||
tscDebug("%p stream:%p is killed, streamId:%d", pStream->pSql, pStream, killId);
|
||||
tscDebug("0x%"PRIx64" stream:%p is killed, streamId:%d", pStream->pSql->self, pStream, killId);
|
||||
if (pStream->callback) {
|
||||
pStream->callback(pStream->param);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
|
|||
pSdesc->num = htobe64(pStream->num);
|
||||
|
||||
pSdesc->useconds = htobe64(pStream->useconds);
|
||||
pSdesc->stime = htobe64(pStream->stime - pStream->interval.interval);
|
||||
pSdesc->stime = (pStream->stime == INT64_MIN) ? htobe64(pStream->stime) : htobe64(pStream->stime - pStream->interval.interval);
|
||||
pSdesc->ctime = htobe64(pStream->ctime);
|
||||
|
||||
pSdesc->slidingTime = htobe64(pStream->interval.sliding);
|
||||
|
|
|
@ -1608,7 +1608,7 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
|
|||
|
||||
int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectList, bool isSTable, bool joinQuery, bool timeWindowQuery) {
|
||||
assert(pSelectList != NULL && pCmd != NULL);
|
||||
|
||||
const char* msg1 = "too many columns in selection clause";
|
||||
const char* msg2 = "functions or others can not be mixed up";
|
||||
const char* msg3 = "not support query expression";
|
||||
const char* msg5 = "invalid function name";
|
||||
|
@ -1657,7 +1657,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis
|
|||
}
|
||||
|
||||
if (pQueryInfo->fieldsInfo.numOfOutput > TSDB_MAX_COLUMNS) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL;
|
||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3078,7 +3078,7 @@ static SColumnFilterInfo* addColumnFilterInfo(SColumn* pColumn) {
|
|||
return pColFilterInfo;
|
||||
}
|
||||
|
||||
static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SColumnFilterInfo* pColumnFilter,
|
||||
static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, STableMeta* pTableMeta, SColumnFilterInfo* pColumnFilter,
|
||||
int16_t colType, tSqlExpr* pExpr) {
|
||||
const char* msg = "not supported filter condition";
|
||||
|
||||
|
@ -3093,6 +3093,12 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
|
|||
if (TSDB_CODE_SUCCESS != retVal) {
|
||||
return retVal;
|
||||
}
|
||||
} else if ((colType == TSDB_DATA_TYPE_TIMESTAMP) && (TSDB_DATA_TYPE_BIGINT == pRight->value.nType)) {
|
||||
STableComInfo tinfo = tscGetTableInfo(pTableMeta);
|
||||
|
||||
if ((tinfo.precision == TSDB_TIME_PRECISION_MILLI) && (pRight->flags & (1 << EXPR_FLAG_US_TIMESTAMP))) {
|
||||
pRight->value.i64 /= 1000;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t retVal = TSDB_CODE_SUCCESS;
|
||||
|
@ -3291,7 +3297,7 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC
|
|||
|
||||
int16_t colType = pSchema->type;
|
||||
|
||||
return doExtractColumnFilterInfo(pCmd, pQueryInfo, pColFilter, colType, pExpr);
|
||||
return doExtractColumnFilterInfo(pCmd, pQueryInfo, pTableMeta, pColFilter, colType, pExpr);
|
||||
}
|
||||
|
||||
static int32_t getTablenameCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr* pTableCond, SStringBuilder* sb) {
|
||||
|
@ -3916,6 +3922,10 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
|
|||
|
||||
const char* msg1 = "query condition between different columns must use 'AND'";
|
||||
|
||||
if ((*pExpr)->flags & (1 << EXPR_FLAG_TS_ERROR)) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL;
|
||||
}
|
||||
|
||||
tSqlExpr* pLeft = (*pExpr)->pLeft;
|
||||
tSqlExpr* pRight = (*pExpr)->pRight;
|
||||
|
||||
|
@ -3953,6 +3963,14 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
|
|||
|
||||
exchangeExpr(*pExpr);
|
||||
|
||||
if (pLeft->tokenId == TK_ID && pRight->tokenId == TK_TIMESTAMP && (pRight->flags & (1 << EXPR_FLAG_TIMESTAMP_VAR))) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL;
|
||||
}
|
||||
|
||||
if ((pLeft->flags & (1 << EXPR_FLAG_TS_ERROR)) || (pRight->flags & (1 << EXPR_FLAG_TS_ERROR))) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL;
|
||||
}
|
||||
|
||||
return handleExprInQueryCond(pCmd, pQueryInfo, pExpr, pCondExpr, type, parentOptr);
|
||||
}
|
||||
|
||||
|
@ -5508,15 +5526,15 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
|
|||
pQueryInfo->clauseLimit = pQueryInfo->limit.limit;
|
||||
pQueryInfo->slimit = pQuerySqlNode->slimit;
|
||||
|
||||
tscDebug("%p limit:%" PRId64 ", offset:%" PRId64 " slimit:%" PRId64 ", soffset:%" PRId64, pSql, pQueryInfo->limit.limit,
|
||||
pQueryInfo->limit.offset, pQueryInfo->slimit.limit, pQueryInfo->slimit.offset);
|
||||
tscDebug("0x%"PRIx64" limit:%" PRId64 ", offset:%" PRId64 " slimit:%" PRId64 ", soffset:%" PRId64, pSql->self,
|
||||
pQueryInfo->limit.limit, pQueryInfo->limit.offset, pQueryInfo->slimit.limit, pQueryInfo->slimit.offset);
|
||||
|
||||
if (pQueryInfo->slimit.offset < 0 || pQueryInfo->limit.offset < 0) {
|
||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg0);
|
||||
}
|
||||
|
||||
if (pQueryInfo->limit.limit == 0) {
|
||||
tscDebug("%p limit 0, no output result", pSql);
|
||||
tscDebug("0x%"PRIx64" limit 0, no output result", pSql->self);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -5538,7 +5556,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
|
|||
}
|
||||
|
||||
if (pQueryInfo->slimit.limit == 0) {
|
||||
tscDebug("%p slimit 0, no output result", pSql);
|
||||
tscDebug("0x%"PRIx64" slimit 0, no output result", pSql->self);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -5556,7 +5574,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
|
|||
|
||||
// No tables included. No results generated. Query results are empty.
|
||||
if (pTableMetaInfo->vgroupList->numOfVgroups == 0) {
|
||||
tscDebug("%p no table in super table, no output result", pSql);
|
||||
tscDebug("0x%"PRIx64" no table in super table, no output result", pSql->self);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -6326,7 +6344,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
|
|||
|
||||
int32_t totalBufSize = 1024;
|
||||
|
||||
char str[1024] = {0};
|
||||
char str[1024+1] = {0};
|
||||
int32_t offset = 0;
|
||||
|
||||
offset += sprintf(str, "num:%d [", size);
|
||||
|
@ -6351,7 +6369,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
|
|||
assert(offset < totalBufSize);
|
||||
str[offset] = ']';
|
||||
assert(offset < totalBufSize);
|
||||
tscDebug("%p select clause:%s", pSql, str);
|
||||
tscDebug("0x%"PRIx64" select clause:%s", pSql->self, str);
|
||||
}
|
||||
|
||||
int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSqlInfo* pInfo) {
|
||||
|
@ -6927,7 +6945,10 @@ static int32_t handleExprInHavingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
|
|||
}
|
||||
}
|
||||
|
||||
int32_t ret = doExtractColumnFilterInfo(pCmd, pQueryInfo, pColFilter, pInfo->field.type, pExpr);
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
|
||||
int32_t ret = doExtractColumnFilterInfo(pCmd, pQueryInfo, pTableMeta, pColFilter, pInfo->field.type, pExpr);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pSql, SRpcEpSet *pEpSet) {
|
|||
// Update the local cached epSet info cached by SqlObj
|
||||
int32_t inUse = pSql->epSet.inUse;
|
||||
tscDumpEpSetFromVgroupInfo(&pSql->epSet, &vgroupInfo);
|
||||
tscDebug("%p update the epSet in SqlObj, in use before:%d, after:%d", pSql, inUse, pSql->epSet.inUse);
|
||||
tscDebug("0x%"PRIx64" update the epSet in SqlObj, in use before:%d, after:%d", pSql->self, inUse, pSql->epSet.inUse);
|
||||
|
||||
}
|
||||
|
||||
|
@ -245,11 +245,11 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
|
|||
|
||||
if (pObj->hbrid != 0) {
|
||||
int32_t waitingDuring = tsShellActivityTimer * 500;
|
||||
tscDebug("%p send heartbeat in %dms", pSql, waitingDuring);
|
||||
tscDebug("0x%"PRIx64" send heartbeat in %dms", pSql->self, waitingDuring);
|
||||
|
||||
taosTmrReset(tscProcessActivityTimer, waitingDuring, (void *)pObj->rid, tscTmr, &pObj->pTimer);
|
||||
} else {
|
||||
tscDebug("%p start to close tscObj:%p, not send heartbeat again", pSql, pObj);
|
||||
tscDebug("0x%"PRIx64" start to close tscObj:%p, not send heartbeat again", pSql->self, pObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
pSql->rpcRid = -1;
|
||||
|
||||
if (pObj->signature != pObj) {
|
||||
tscDebug("%p DB connection is closed, cmd:%d pObj:%p signature:%p", pSql, pCmd->command, pObj, pObj->signature);
|
||||
tscDebug("0x%"PRIx64" DB connection is closed, cmd:%d pObj:%p signature:%p", pSql->self, pCmd->command, pObj, pObj->signature);
|
||||
|
||||
taosRemoveRef(tscObjRef, handle);
|
||||
taosReleaseRef(tscObjRef, handle);
|
||||
|
@ -336,8 +336,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
|
||||
if (pQueryInfo != NULL && pQueryInfo->type == TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
tscDebug("%p sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p",
|
||||
pSql, pCmd->command, pQueryInfo->type, pObj, pObj->signature);
|
||||
tscDebug("0x%"PRIx64" sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p",
|
||||
pSql->self, pCmd->command, pQueryInfo->type, pObj, pObj->signature);
|
||||
|
||||
taosRemoveRef(tscObjRef, handle);
|
||||
taosReleaseRef(tscObjRef, handle);
|
||||
|
@ -396,13 +396,13 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
pRes->rspLen = 0;
|
||||
|
||||
if (pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED) {
|
||||
tscDebug("%p query is cancelled, code:%s", pSql, tstrerror(pRes->code));
|
||||
tscDebug("0x%"PRIx64" query is cancelled, code:%s", pSql->self, tstrerror(pRes->code));
|
||||
} else {
|
||||
pRes->code = rpcMsg->code;
|
||||
}
|
||||
|
||||
if (pRes->code == TSDB_CODE_SUCCESS) {
|
||||
tscDebug("%p reset retry counter to be 0 due to success rsp, old:%d", pSql, pSql->retry);
|
||||
tscDebug("0x%"PRIx64" reset retry counter to be 0 due to success rsp, old:%d", pSql->self, pSql->retry);
|
||||
pSql->retry = 0;
|
||||
}
|
||||
|
||||
|
@ -437,10 +437,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
pMsg->numOfFailedBlocks = htonl(pMsg->numOfFailedBlocks);
|
||||
|
||||
pRes->numOfRows += pMsg->affectedRows;
|
||||
tscDebug("%p SQL cmd:%s, code:%s inserted rows:%d rspLen:%d", pSql, sqlCmd[pCmd->command],
|
||||
tscDebug("0x%"PRIx64" SQL cmd:%s, code:%s inserted rows:%d rspLen:%d", pSql->self, sqlCmd[pCmd->command],
|
||||
tstrerror(pRes->code), pMsg->affectedRows, pRes->rspLen);
|
||||
} else {
|
||||
tscDebug("%p SQL cmd:%s, code:%s rspLen:%d", pSql, sqlCmd[pCmd->command], tstrerror(pRes->code), pRes->rspLen);
|
||||
tscDebug("0x%"PRIx64" SQL cmd:%s, code:%s rspLen:%d", pSql->self, sqlCmd[pCmd->command], tstrerror(pRes->code), pRes->rspLen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
|
||||
if (shouldFree) { // in case of table-meta/vgrouplist query, automatically free it
|
||||
taosRemoveRef(tscObjRef, handle);
|
||||
tscDebug("%p sqlObj is automatically freed", pSql);
|
||||
tscDebug("0x%"PRIx64" sqlObj is automatically freed", pSql->self);
|
||||
}
|
||||
|
||||
taosReleaseRef(tscObjRef, handle);
|
||||
|
@ -522,7 +522,7 @@ int tscProcessSql(SSqlObj *pSql) {
|
|||
assert((pQueryInfo->numOfTables == 0 && pQueryInfo->command == TSDB_SQL_HB) || pQueryInfo->numOfTables > 0);
|
||||
}
|
||||
|
||||
tscDebug("%p SQL cmd:%s will be processed, name:%s, type:%d", pSql, sqlCmd[pCmd->command], name, type);
|
||||
tscDebug("0x%"PRIx64" SQL cmd:%s will be processed, name:%s, type:%d", pSql->self, sqlCmd[pCmd->command], name, type);
|
||||
if (pCmd->command < TSDB_SQL_MGMT) { // the pTableMetaInfo cannot be NULL
|
||||
if (pTableMetaInfo == NULL) {
|
||||
pSql->res.code = TSDB_CODE_TSC_APP_ERROR;
|
||||
|
@ -562,11 +562,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
}
|
||||
|
||||
pRetrieveMsg->header.vgId = htonl(vgId);
|
||||
tscDebug("%p build fetch msg from vgId:%d, vgIndex:%d, qId:%" PRIu64, pSql, vgId, vgIndex, pSql->res.qId);
|
||||
tscDebug("0x%"PRIx64" build fetch msg from vgId:%d, vgIndex:%d, qId:0x%" PRIx64, pSql->self, vgId, vgIndex, pSql->res.qId);
|
||||
} else {
|
||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
pRetrieveMsg->header.vgId = htonl(pTableMeta->vgId);
|
||||
tscDebug("%p build fetch msg from only one vgroup, vgId:%d, qId:%" PRIu64, pSql, pTableMeta->vgId, pSql->res.qId);
|
||||
tscDebug("0x%"PRIx64" build fetch msg from only one vgroup, vgId:%d, qId:0x%" PRIx64, pSql->self, pTableMeta->vgId,
|
||||
pSql->res.qId);
|
||||
}
|
||||
|
||||
pSql->cmd.payloadLen = sizeof(SRetrieveTableMsg);
|
||||
|
@ -605,7 +606,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
taosHashGetClone(tscVgroupMap, &pTableMeta->vgId, sizeof(pTableMeta->vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo));
|
||||
tscDumpEpSetFromVgroupInfo(&pSql->epSet, &vgroupInfo);
|
||||
|
||||
tscDebug("%p build submit msg, vgId:%d numOfTables:%d numberOfEP:%d", pSql, pTableMeta->vgId, pSql->cmd.numOfTablesInSubmit,
|
||||
tscDebug("0x%"PRIx64" build submit msg, vgId:%d numOfTables:%d numberOfEP:%d", pSql->self, pTableMeta->vgId, pSql->cmd.numOfTablesInSubmit,
|
||||
pSql->epSet.numOfEps);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -671,7 +672,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
|
||||
vgId = pVgroupInfo->vgId;
|
||||
tscSetDnodeEpSet(&pSql->epSet, pVgroupInfo);
|
||||
tscDebug("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, pTableMetaInfo->vgroupList->numOfVgroups);
|
||||
tscDebug("0x%"PRIx64" query on stable, vgIndex:%d, numOfVgroups:%d", pSql->self, index, pTableMetaInfo->vgroupList->numOfVgroups);
|
||||
} else {
|
||||
vgId = pTableMeta->vgId;
|
||||
|
||||
|
@ -704,7 +705,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
int32_t numOfTables = (int32_t)taosArrayGetSize(pTableIdList->itemList);
|
||||
pQueryMsg->numOfTables = htonl(numOfTables); // set the number of tables
|
||||
|
||||
tscDebug("%p query on stable, vgId:%d, numOfTables:%d, vgIndex:%d, numOfVgroups:%d", pSql,
|
||||
tscDebug("0x%"PRIx64" query on stable, vgId:%d, numOfTables:%d, vgIndex:%d, numOfVgroups:%d", pSql->self,
|
||||
pTableIdList->vgInfo.vgId, numOfTables, index, numOfVgroups);
|
||||
|
||||
// serialize each table id info
|
||||
|
@ -722,7 +723,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
char n[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
tNameExtractFullName(&pTableMetaInfo->name, n);
|
||||
|
||||
tscDebug("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), n, pTableMeta->id.tid, pTableMeta->id.uid);
|
||||
tscDebug("0x%"PRIx64" vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql->self, htonl(pQueryMsg->head.vgId), n, pTableMeta->id.tid, pTableMeta->id.uid);
|
||||
return pMsg;
|
||||
}
|
||||
|
||||
|
@ -1139,7 +1140,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
int32_t msgLen = (int32_t)(pMsg - pCmd->payload);
|
||||
|
||||
tscDebug("%p msg built success, len:%d bytes", pSql, msgLen);
|
||||
tscDebug("0x%"PRIx64" msg built success, len:%d bytes", pSql->self, msgLen);
|
||||
pCmd->payloadLen = msgLen;
|
||||
pSql->cmd.msgType = TSDB_MSG_TYPE_QUERY;
|
||||
|
||||
|
@ -1837,7 +1838,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
|
||||
|
||||
tscDebug("%p build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql, pCmd->count,
|
||||
tscDebug("0x%"PRIx64" build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql->self, pCmd->count,
|
||||
pCmd->payloadLen);
|
||||
|
||||
return pCmd->payloadLen;
|
||||
|
@ -2017,7 +2018,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
|
|||
}
|
||||
}
|
||||
|
||||
tscDebug("%p recv table meta, uid:%" PRIu64 ", tid:%d, name:%s", pSql, pTableMeta->id.uid, pTableMeta->id.tid,
|
||||
tscDebug("0x%"PRIx64" recv table meta, uid:%" PRIu64 ", tid:%d, name:%s", pSql->self, pTableMeta->id.uid, pTableMeta->id.tid,
|
||||
tNameGetTableName(&pTableMetaInfo->name));
|
||||
|
||||
free(pTableMeta);
|
||||
|
@ -2124,7 +2125,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
|
|||
|
||||
pSql->res.code = TSDB_CODE_SUCCESS;
|
||||
pSql->res.numOfTotal = i;
|
||||
tscDebug("%p load multi-metermeta resp from complete num:%d", pSql, pSql->res.numOfTotal);
|
||||
tscDebug("0x%"PRIx64" load multi-metermeta resp from complete num:%d", pSql->self, pSql->res.numOfTotal);
|
||||
#endif
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2292,7 +2293,7 @@ static void createHbObj(STscObj* pObj) {
|
|||
pSql->signature = pSql;
|
||||
|
||||
registerSqlObj(pSql);
|
||||
tscDebug("%p HB is allocated, pObj:%p", pSql, pObj);
|
||||
tscDebug("0x%"PRIx64" HB is allocated, pObj:%p", pSql->self, pObj);
|
||||
|
||||
pObj->hbrid = pSql->self;
|
||||
}
|
||||
|
@ -2318,7 +2319,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
|
|||
tscUpdateMgmtEpSet(pSql, &pConnect->epSet);
|
||||
|
||||
for (int i = 0; i < pConnect->epSet.numOfEps; ++i) {
|
||||
tscDebug("%p epSet.fqdn[%d]: %s, pObj:%p", pSql, i, pConnect->epSet.fqdn[i], pObj);
|
||||
tscDebug("0x%"PRIx64" epSet.fqdn[%d]: %s, pObj:%p", pSql->self, i, pConnect->epSet.fqdn[i], pObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2362,7 +2363,7 @@ int tscProcessDropTableRsp(SSqlObj *pSql) {
|
|||
tNameExtractFullName(&pTableMetaInfo->name, name);
|
||||
|
||||
taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN));
|
||||
tscDebug("%p remove table meta after drop table:%s, numOfRemain:%d", pSql, name, (int32_t) taosHashGetSize(tscTableMetaInfo));
|
||||
tscDebug("0x%"PRIx64" remove table meta after drop table:%s, numOfRemain:%d", pSql->self, name, (int32_t) taosHashGetSize(tscTableMetaInfo));
|
||||
|
||||
pTableMetaInfo->pTableMeta = NULL;
|
||||
return 0;
|
||||
|
@ -2374,7 +2375,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
|
|||
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
tNameExtractFullName(&pTableMetaInfo->name, name);
|
||||
|
||||
tscDebug("%p remove tableMeta in hashMap after alter-table: %s", pSql, name);
|
||||
tscDebug("0x%"PRIx64" remove tableMeta in hashMap after alter-table: %s", pSql->self, name);
|
||||
|
||||
bool isSuperTable = UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo);
|
||||
taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN));
|
||||
|
@ -2405,7 +2406,7 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
|
|||
|
||||
pRes->data = NULL;
|
||||
tscResetForNextRetrieve(pRes);
|
||||
tscDebug("%p query rsp received, qId:%"PRIu64, pSql, pRes->qId);
|
||||
tscDebug("0x%"PRIx64" query rsp received, qId:0x%"PRIx64, pSql->self, pRes->qId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2463,7 +2464,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
pRes->row = 0;
|
||||
tscDebug("%p numOfRows:%d, offset:%" PRId64 ", complete:%d, qId:%"PRIu64, pSql, pRes->numOfRows, pRes->offset,
|
||||
tscDebug("0x%"PRIx64" numOfRows:%d, offset:%" PRId64 ", complete:%d, qId:0x%"PRIx64, pSql->self, pRes->numOfRows, pRes->offset,
|
||||
pRes->completed, pRes->qId);
|
||||
|
||||
return 0;
|
||||
|
@ -2507,14 +2508,14 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
|
|||
}
|
||||
}
|
||||
|
||||
tscDebug("%p new pSqlObj:%p to get tableMeta, auto create:%d", pSql, pNew, pNew->cmd.autoCreated);
|
||||
|
||||
registerSqlObj(pNew);
|
||||
tscDebug("0x%"PRIx64" new pSqlObj:0x%"PRIx64" to get tableMeta, auto create:%d", pSql->self, pNew->self,
|
||||
pNew->cmd.autoCreated);
|
||||
|
||||
pNew->fp = tscTableMetaCallBack;
|
||||
pNew->param = (void *)pSql->self;
|
||||
|
||||
tscDebug("%p metaRid from %" PRId64 " to %" PRId64 , pSql, pSql->metaRid, pNew->self);
|
||||
tscDebug("0x%"PRIx64" metaRid from %" PRId64 " to %" PRId64 , pSql->self, pSql->metaRid, pNew->self);
|
||||
|
||||
pSql->metaRid = pNew->self;
|
||||
|
||||
|
@ -2585,7 +2586,7 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
|
|||
|
||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
if (pTableMeta) {
|
||||
tscDebug("%p update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64, pSql, name,
|
||||
tscDebug("0x%"PRIx64" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64, pSql->self, name,
|
||||
tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid);
|
||||
}
|
||||
|
||||
|
@ -2645,12 +2646,12 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
|
|||
pNewQueryInfo->numOfTables = pQueryInfo->numOfTables;
|
||||
registerSqlObj(pNew);
|
||||
|
||||
tscDebug("%p svgroupRid from %" PRId64 " to %" PRId64 , pSql, pSql->svgroupRid, pNew->self);
|
||||
tscDebug("0x%"PRIx64" svgroupRid from %" PRId64 " to %" PRId64 , pSql->self, pSql->svgroupRid, pNew->self);
|
||||
|
||||
pSql->svgroupRid = pNew->self;
|
||||
|
||||
|
||||
tscDebug("%p new sqlObj:%p to get vgroupInfo, numOfTables:%d", pSql, pNew, pNewQueryInfo->numOfTables);
|
||||
tscDebug("0x%"PRIx64" new sqlObj:%p to get vgroupInfo, numOfTables:%d", pSql->self, pNew, pNewQueryInfo->numOfTables);
|
||||
|
||||
pNew->fp = tscTableMetaCallBack;
|
||||
pNew->param = (void *)pSql->self;
|
||||
|
|
|
@ -292,7 +292,7 @@ void taos_close(TAOS *taos) {
|
|||
pHb->rpcRid = -1;
|
||||
}
|
||||
|
||||
tscDebug("%p HB is freed", pHb);
|
||||
tscDebug("0x%"PRIx64" HB is freed", pHb->self);
|
||||
taosReleaseRef(tscObjRef, pHb->self);
|
||||
#ifdef __APPLE__
|
||||
// to satisfy later tsem_destroy in taos_free_result
|
||||
|
@ -576,7 +576,7 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
|
|||
cmd == TSDB_SQL_FETCH)) {
|
||||
pQueryInfo->type = TSDB_QUERY_TYPE_FREE_RESOURCE;
|
||||
pCmd->command = (pCmd->command > TSDB_SQL_MGMT) ? TSDB_SQL_RETRIEVE : TSDB_SQL_FETCH;
|
||||
tscDebug("%p send msg to dnode to free qhandle ASAP before free sqlObj, command:%s", pSql, sqlCmd[pCmd->command]);
|
||||
tscDebug("0x%"PRIx64" send msg to dnode to free qhandle ASAP before free sqlObj, command:%s", pSql->self, sqlCmd[pCmd->command]);
|
||||
|
||||
tscProcessSql(pSql);
|
||||
return false;
|
||||
|
@ -594,7 +594,7 @@ void taos_free_result(TAOS_RES *res) {
|
|||
|
||||
bool freeNow = tscKillQueryInDnode(pSql);
|
||||
if (freeNow) {
|
||||
tscDebug("%p free sqlObj in cache", pSql);
|
||||
tscDebug("0x%"PRIx64" free sqlObj in cache", pSql->self);
|
||||
taosReleaseRef(tscObjRef, pSql->self);
|
||||
}
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ static void tscKillSTableQuery(SSqlObj *pSql) {
|
|||
|
||||
tscUnlockByThread(&pSql->squeryLock);
|
||||
|
||||
tscDebug("%p super table query cancelled", pSql);
|
||||
tscDebug("0x%"PRIx64" super table query cancelled", pSql->self);
|
||||
}
|
||||
|
||||
void taos_stop_query(TAOS_RES *res) {
|
||||
|
@ -717,7 +717,7 @@ void taos_stop_query(TAOS_RES *res) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p start to cancel query", res);
|
||||
tscDebug("0x%"PRIx64" start to cancel query", pSql->self);
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
|
||||
// set the error code for master pSqlObj firstly
|
||||
|
@ -744,7 +744,7 @@ void taos_stop_query(TAOS_RES *res) {
|
|||
}
|
||||
}
|
||||
|
||||
tscDebug("%p query is cancelled", res);
|
||||
tscDebug("0x%"PRIx64" query is cancelled", pSql->self);
|
||||
}
|
||||
|
||||
bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
|
||||
|
@ -877,7 +877,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
pRes->numOfClauseTotal = 0;
|
||||
|
||||
|
||||
tscDebug("%p Valid SQL: %s pObj:%p", pSql, sql, pObj);
|
||||
tscDebug("0x%"PRIx64" Valid SQL: %s pObj:%p", pSql->self, sql, pObj);
|
||||
|
||||
int32_t sqlLen = (int32_t)strlen(sql);
|
||||
if (sqlLen > tsMaxSQLStringLen) {
|
||||
|
@ -889,7 +889,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
pSql->sqlstr = realloc(pSql->sqlstr, sqlLen + 1);
|
||||
if (pSql->sqlstr == NULL) {
|
||||
tscError("%p failed to malloc sql string buffer", pSql);
|
||||
tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(pSql), pObj);
|
||||
tscDebug("0x%"PRIx64" Valid SQL result:%d, %s pObj:%p", pSql->self, pRes->code, taos_errstr(pSql), pObj);
|
||||
tfree(pSql);
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
}
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, code, taos_errstr(pSql), pObj);
|
||||
tscDebug("0x%"PRIx64" Valid SQL result:%d, %s pObj:%p", pSql->self, code, taos_errstr(pSql), pObj);
|
||||
}
|
||||
|
||||
taos_free_result(pSql);
|
||||
|
@ -1027,7 +1027,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
pRes->numOfClauseTotal = 0;
|
||||
|
||||
assert(pSql->fp == NULL);
|
||||
tscDebug("%p tableNameList: %s pObj:%p", pSql, tableNameList, pObj);
|
||||
tscDebug("0x%"PRIx64" tableNameList: %s pObj:%p", pSql->self, tableNameList, pObj);
|
||||
|
||||
int32_t tblListLen = (int32_t)strlen(tableNameList);
|
||||
if (tblListLen > MAX_TABLE_NAME_LENGTH) {
|
||||
|
@ -1061,7 +1061,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
|
||||
tscDoQuery(pSql);
|
||||
|
||||
tscDebug("%p load multi table meta result:%d %s pObj:%p", pSql, pRes->code, taos_errstr(pSql), pObj);
|
||||
tscDebug("0x%"PRIx64" load multi table meta result:%d %s pObj:%p", pSql->self, pRes->code, taos_errstr(pSql), pObj);
|
||||
if ((code = pRes->code) != TSDB_CODE_SUCCESS) {
|
||||
tscFreeSqlObj(pSql);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static void setRetryInfo(SSqlStream* pStream, int32_t code) {
|
|||
|
||||
pSql->res.code = code;
|
||||
int64_t retryDelayTime = tscGetRetryDelayTime(pStream, pStream->interval.sliding, pStream->precision);
|
||||
tscDebug("%p stream:%p, get table Meta failed, retry in %" PRId64 "ms", pSql, pStream, retryDelayTime);
|
||||
tscDebug("0x%"PRIx64" stream:%p, get table Meta failed, retry in %" PRId64 "ms", pSql->self, pStream, retryDelayTime);
|
||||
tscSetRetryTimer(pStream, pSql, retryDelayTime);
|
||||
}
|
||||
|
||||
|
@ -101,11 +101,19 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo) && (pTableMetaInfo->pVgroupTables == NULL) && (pTableMetaInfo->vgroupList == NULL || pTableMetaInfo->vgroupList->numOfVgroups <= 0)) {
|
||||
tscDebug("%p empty vgroup list", pSql);
|
||||
pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList);
|
||||
code = TSDB_CODE_TSC_APP_ERROR;
|
||||
}
|
||||
|
||||
// failed to get table Meta or vgroup list, retry in 10sec.
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
tscTansformFuncForSTableQuery(pQueryInfo);
|
||||
tscDebug("%p stream:%p, start stream query on:%s", pSql, pStream, tNameGetTableName(&pTableMetaInfo->name));
|
||||
tscDebug("0x%"PRIx64" stream:%p, start stream query on:%s", pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name));
|
||||
|
||||
pQueryInfo->command = TSDB_SQL_SELECT;
|
||||
|
||||
pSql->fp = tscProcessStreamQueryCallback;
|
||||
pSql->fetchFp = tscProcessStreamQueryCallback;
|
||||
tscDoQuery(pSql);
|
||||
|
@ -131,7 +139,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
|
|||
pStream->numOfRes = 0; // reset the numOfRes.
|
||||
SSqlObj *pSql = pStream->pSql;
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0);
|
||||
tscDebug("%p add into timer", pSql);
|
||||
tscDebug("0x%"PRIx64" add into timer", pSql->self);
|
||||
|
||||
if (pStream->isProject) {
|
||||
/*
|
||||
|
@ -237,7 +245,7 @@ static void tscStreamFillTimeGap(SSqlStream* pStream, TSKEY ts) {
|
|||
}
|
||||
|
||||
if (rowNum > 0) {
|
||||
tscDebug("%p stream:%p %d rows padded", pSql, pStream, rowNum);
|
||||
tscDebug("0x%"PRIx64" stream:%p %d rows padded", pSql, pStream, rowNum);
|
||||
}
|
||||
|
||||
pRes->numOfRows = 0;
|
||||
|
@ -263,7 +271,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
for(int32_t i = 0; i < numOfRows; ++i) {
|
||||
TAOS_ROW row = taos_fetch_row(res);
|
||||
if (row != NULL) {
|
||||
tscDebug("%p stream:%p fetch result", pSql, pStream);
|
||||
tscDebug("0x%"PRIx64" stream:%p fetch result", pSql->self, pStream);
|
||||
tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]);
|
||||
pStream->stime = *(TSKEY *)row[0];
|
||||
// user callback function
|
||||
|
@ -293,7 +301,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
pStream->stime += 1;
|
||||
}
|
||||
|
||||
tscDebug("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, tNameGetTableName(&pTableMetaInfo->name),
|
||||
tscDebug("0x%"PRIx64" stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql->self, pStream, tNameGetTableName(&pTableMetaInfo->name),
|
||||
pStream->numOfRes);
|
||||
|
||||
tfree(pTableMetaInfo->pTableMeta);
|
||||
|
@ -318,8 +326,8 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
|
|||
/*
|
||||
* current time window will be closed, since it too early to exceed the maxRetentWindow value
|
||||
*/
|
||||
tscDebug("%p stream:%p, etime:%" PRId64 " is too old, exceeds the max retention time window:%" PRId64 ", stop the stream",
|
||||
pStream->pSql, pStream, pStream->stime, pStream->etime);
|
||||
tscDebug("0x%"PRIx64" stream:%p, etime:%" PRId64 " is too old, exceeds the max retention time window:%" PRId64 ", stop the stream",
|
||||
pStream->pSql->self, pStream, pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
// Callback function from upper level
|
||||
|
@ -329,10 +337,10 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream,
|
||||
now + timer, timer, delay, pStream->stime, etime);
|
||||
} else {
|
||||
tscDebug("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
tscDebug("0x%"PRIx64" stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql->self, pStream,
|
||||
pStream->stime, timer, delay, pStream->stime - pStream->interval.interval, pStream->stime - 1);
|
||||
}
|
||||
|
||||
|
@ -378,8 +386,8 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
|
|||
*/
|
||||
timer = pStream->interval.sliding;
|
||||
if (pStream->stime > pStream->etime) {
|
||||
tscDebug("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
pStream->stime, pStream->etime);
|
||||
tscDebug("0x%"PRIx64" stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream",
|
||||
pStream->pSql->self, pStream, pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
// Callback function from upper level
|
||||
|
@ -392,7 +400,7 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
|
|||
int64_t stime = taosTimeTruncate(pStream->stime - 1, &pStream->interval, pStream->precision);
|
||||
//int64_t stime = taosGetIntervalStartTimestamp(pStream->stime - 1, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision);
|
||||
if (stime >= pStream->etime) {
|
||||
tscDebug("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
tscDebug("0x%"PRIx64" stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql->self, pStream,
|
||||
pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
|
@ -402,10 +410,12 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
|
|||
taos_close_stream(pStream);
|
||||
return;
|
||||
}
|
||||
|
||||
timer = pStream->stime - taosGetTimestamp(pStream->precision);
|
||||
if (timer < 0) {
|
||||
timer = 0;
|
||||
|
||||
if (pStream->stime > 0) {
|
||||
timer = pStream->stime - taosGetTimestamp(pStream->precision);
|
||||
if (timer < 0) {
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,17 +489,20 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in
|
|||
pStream->interval.interval = tsProjectExecInterval;
|
||||
pStream->interval.sliding = tsProjectExecInterval;
|
||||
|
||||
if (stime != 0) { // first projection start from the latest event timestamp
|
||||
if (stime != INT64_MIN) { // first projection start from the latest event timestamp
|
||||
assert(stime >= pQueryInfo->window.skey);
|
||||
stime += 1; // exclude the last records from table
|
||||
} else {
|
||||
stime = pQueryInfo->window.skey;
|
||||
}
|
||||
} else { // timewindow based aggregation stream
|
||||
if (stime == 0) { // no data in meter till now
|
||||
if (stime == INT64_MIN) { // no data in meter till now
|
||||
if (pQueryInfo->window.skey != INT64_MIN) {
|
||||
stime = pQueryInfo->window.skey;
|
||||
} else {
|
||||
return stime;
|
||||
}
|
||||
|
||||
stime = taosTimeTruncate(stime, &pStream->interval, pStream->precision);
|
||||
} else {
|
||||
int64_t newStime = taosTimeTruncate(stime, &pStream->interval, pStream->precision);
|
||||
|
@ -558,7 +571,7 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) {
|
|||
|
||||
taosTmrReset(tscProcessStreamTimer, (int32_t)starttime, pStream, tscTmr, &pStream->pTimer);
|
||||
|
||||
tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql,
|
||||
tscDebug("0x%"PRIx64" stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql->self,
|
||||
pStream, tNameGetTableName(&pTableMetaInfo->name), pStream->interval.interval, pStream->interval.sliding, starttime, pSql->sqlstr);
|
||||
}
|
||||
|
||||
|
@ -619,7 +632,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
|
|||
if (code == TSDB_CODE_SUCCESS) {
|
||||
tscCreateStream(pStream, pSql, code);
|
||||
} else if (code != TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
||||
tscError("%p open stream failed, sql:%s, code:%s", pSql, sqlstr, tstrerror(pRes->code));
|
||||
tscError("%p open stream failed, sql:%s, code:%s", pSql, sqlstr, tstrerror(code));
|
||||
taosReleaseRef(tscObjRef, pSql->self);
|
||||
free(pStream);
|
||||
return NULL;
|
||||
|
@ -645,7 +658,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
|
|||
|
||||
taosTmrStopA(&(pStream->pTimer));
|
||||
|
||||
tscDebug("%p stream:%p is closed", pSql, pStream);
|
||||
tscDebug("0x%"PRIx64" stream:%p is closed", pSql->self, pStream);
|
||||
// notify CQ to release the pStream object
|
||||
pStream->fp(pStream->param, NULL, NULL);
|
||||
pStream->pSql = NULL;
|
||||
|
|
|
@ -81,14 +81,14 @@ static bool allSubqueryDone(SSqlObj *pParentSql) {
|
|||
SSubqueryState *subState = &pParentSql->subState;
|
||||
|
||||
//lock in caller
|
||||
tscDebug("%p total subqueries: %d", pParentSql, subState->numOfSub);
|
||||
tscDebug("0x%"PRIx64" total subqueries: %d", pParentSql->self, subState->numOfSub);
|
||||
for (int i = 0; i < subState->numOfSub; i++) {
|
||||
if (0 == subState->states[i]) {
|
||||
tscDebug("%p subquery:%p, index: %d NOT finished, abort query completion check", pParentSql, pParentSql->pSubs[i], i);
|
||||
tscDebug("0x%"PRIx64" subquery:%p, index: %d NOT finished, abort query completion check", pParentSql->self, pParentSql->pSubs[i], i);
|
||||
done = false;
|
||||
break;
|
||||
} else {
|
||||
tscDebug("%p subquery:%p, index: %d finished", pParentSql, pParentSql->pSubs[i], i);
|
||||
tscDebug("0x%"PRIx64" subquery:%p, index: %d finished", pParentSql->self, pParentSql->pSubs[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,14 +105,14 @@ static bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
|
|||
bool done = allSubqueryDone(pParentSql);
|
||||
|
||||
if (done) {
|
||||
tscDebug("%p subquery:%p,%d all subs already done", pParentSql, pSql, idx);
|
||||
tscDebug("0x%"PRIx64" subquery:%p,%d all subs already done", pParentSql->self, pSql, idx);
|
||||
|
||||
pthread_mutex_unlock(&subState->mutex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
tscDebug("%p subquery:%p,%d state set to 1", pParentSql, pSql, idx);
|
||||
tscDebug("0x%"PRIx64" subquery:%p,%d state set to 1", pParentSql->self, pSql, idx);
|
||||
|
||||
subState->states[idx] = 1;
|
||||
|
||||
|
@ -158,18 +158,18 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, STimeWindow * win) {
|
|||
SJoinSupporter* pSupporter = pSql->pSubs[i]->param;
|
||||
|
||||
if (pSupporter->pTSBuf == NULL) {
|
||||
tscDebug("%p at least one ts-comp is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
tscDebug("0x%"PRIx64" at least one ts-comp is empty, 0 for secondary query after ts blocks intersecting", pSql->self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsBufResetPos(pSupporter->pTSBuf);
|
||||
|
||||
if (!tsBufNextPos(pSupporter->pTSBuf)) {
|
||||
tscDebug("%p input1 is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
tscDebug("0x%"PRIx64" input1 is empty, 0 for secondary query after ts blocks intersecting", pSql->self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tscDebug("%p sub:%p table idx:%d, input group number:%d", pSql, pSql->pSubs[i], i, pSupporter->pTSBuf->numOfGroups);
|
||||
tscDebug("0x%"PRIx64" sub:%p table idx:%d, input group number:%d", pSql->self, pSql->pSubs[i], i, pSupporter->pTSBuf->numOfGroups);
|
||||
|
||||
ctxlist[i].p = pSupporter;
|
||||
ctxlist[i].res = output;
|
||||
|
@ -375,9 +375,9 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, STimeWindow * win) {
|
|||
TSKEY et = taosGetTimestampUs();
|
||||
|
||||
for (int32_t i = 0; i < joinNum; ++i) {
|
||||
tscDebug("%p sub:%p tblidx:%d, input:%" PRId64 ", final:%" PRId64 " in %d vnodes for secondary query after ts blocks "
|
||||
tscDebug("0x%"PRIx64" sub:%p tblidx:%d, input:%" PRId64 ", final:%" PRId64 " in %d vnodes for secondary query after ts blocks "
|
||||
"intersecting, skey:%" PRId64 ", ekey:%" PRId64 ", numOfVnode:%d, elapsed time:%" PRId64 " us",
|
||||
pSql, pSql->pSubs[i], i, ctxlist[i].numOfInput, ctxlist[i].res->numOfTotal, ctxlist[i].res->numOfGroups, win->skey, win->ekey,
|
||||
pSql->self, pSql->pSubs[i], i, ctxlist[i].numOfInput, ctxlist[i].res->numOfTotal, ctxlist[i].res->numOfGroups, win->skey, win->ekey,
|
||||
tsBufGetNumOfGroup(ctxlist[i].res), et - st);
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
assert(numOfSub > 0);
|
||||
|
||||
// scan all subquery, if one sub query has only ts, ignore it
|
||||
tscDebug("%p start to launch secondary subqueries, %d out of %d needs to query", pSql, numOfSub, pSql->subState.numOfSub);
|
||||
tscDebug("0x%"PRIx64" start to launch secondary subqueries, %d out of %d needs to query", pSql->self, numOfSub, pSql->subState.numOfSub);
|
||||
|
||||
bool success = true;
|
||||
|
||||
|
@ -560,7 +560,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
pSupporter = pPrevSub->param;
|
||||
|
||||
if (taosArrayGetSize(pSupporter->exprList) == 0) {
|
||||
tscDebug("%p subIndex: %d, no need to launch query, ignore it", pSql, i);
|
||||
tscDebug("0x%"PRIx64" subIndex: %d, no need to launch query, ignore it", pSql->self, i);
|
||||
|
||||
tscDestroyJoinSupporter(pSupporter);
|
||||
taos_free_result(pPrevSub);
|
||||
|
@ -665,8 +665,8 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
subquerySetState(pPrevSub, &pSql->subState, i, 0);
|
||||
|
||||
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
|
||||
tscDebug("%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, name:%s",
|
||||
pSql, pNew, 0, pTableMetaInfo->vgroupIndex, pQueryInfo->type, taosArrayGetSize(pQueryInfo->exprList),
|
||||
tscDebug("0x%"PRIx64" subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, name:%s",
|
||||
pSql->self, pNew, 0, pTableMetaInfo->vgroupIndex, pQueryInfo->type, taosArrayGetSize(pQueryInfo->exprList),
|
||||
numOfCols, pQueryInfo->fieldsInfo.numOfOutput, tNameGetTableName(&pTableMetaInfo->name));
|
||||
}
|
||||
|
||||
|
@ -792,7 +792,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
|
|||
|
||||
if (taosArrayGetSize(result) > 0) {
|
||||
SVgroupTableInfo* prevGroup = taosArrayGet(result, taosArrayGetSize(result) - 1);
|
||||
tscDebug("%p vgId:%d, tables:%"PRIzu, pSql, prevGroup->vgInfo.vgId, taosArrayGetSize(prevGroup->itemList));
|
||||
tscDebug("0x%"PRIx64" vgId:%d, tables:%"PRIzu, pSql->self, prevGroup->vgInfo.vgId, taosArrayGetSize(prevGroup->itemList));
|
||||
}
|
||||
|
||||
taosArrayPush(result, &info);
|
||||
|
@ -814,7 +814,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
|
|||
pTableMetaInfo->pVgroupTables = result;
|
||||
|
||||
SVgroupTableInfo* g = taosArrayGet(result, taosArrayGetSize(result) - 1);
|
||||
tscDebug("%p vgId:%d, tables:%"PRIzu, pSql, g->vgInfo.vgId, taosArrayGetSize(g->itemList));
|
||||
tscDebug("0x%"PRIx64" vgId:%d, tables:%"PRIzu, pSql->self, g->vgInfo.vgId, taosArrayGetSize(g->itemList));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -903,7 +903,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
|
|||
|
||||
SSchema* pColSchema = tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, tagColId);
|
||||
|
||||
tscDebug("%p all subquery retrieve <tid, tags> complete, do tags match", pParentSql);
|
||||
tscDebug("0x%"PRIx64" all subquery retrieve <tid, tags> complete, do tags match", pParentSql->self);
|
||||
|
||||
for (int32_t i = 0; i < joinNum; i++) {
|
||||
SJoinSupporter* p = pParentSql->pSubs[i]->param;
|
||||
|
@ -1004,7 +1004,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
|
|||
continue;
|
||||
}
|
||||
|
||||
tscDebug("%p tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql, prev->vgId,
|
||||
tscDebug("0x%"PRIx64" tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql->self, prev->vgId,
|
||||
*(int*) prev->tag, prev->tid, prev->uid, cur->tid, cur->uid);
|
||||
|
||||
assert(stackidx == tableNum);
|
||||
|
@ -1079,7 +1079,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
|
|||
|
||||
taosArrayPush(resList, &ctxlist[i].res);
|
||||
|
||||
tscDebug("%p tags match complete, result num: %"PRIzu, pParentSql, num);
|
||||
tscDebug("0x%"PRIx64" tags match complete, result num: %"PRIzu, pParentSql->self, num);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1183,8 +1183,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
pTableMetaInfo->vgroupIndex += 1;
|
||||
assert(pTableMetaInfo->vgroupIndex < totalVgroups);
|
||||
|
||||
tscDebug("%p tid_tag from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%d",
|
||||
pSql, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pSupporter->num);
|
||||
tscDebug("0x%"PRIx64" tid_tag from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%d",
|
||||
pSql->self, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pSupporter->num);
|
||||
|
||||
pCmd->command = TSDB_SQL_SELECT;
|
||||
tscResetForNextRetrieve(&pSql->res);
|
||||
|
@ -1198,7 +1198,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
// no data exists in next vnode, mark the <tid, tags> query completed
|
||||
// only when there is no subquery exits any more, proceeds to get the intersect of the <tid, tags> tuple sets.
|
||||
if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
|
||||
tscDebug("%p tagRetrieve:%p,%d completed, total:%d", pParentSql, tres, pSupporter->subqueryIndex, pParentSql->subState.numOfSub);
|
||||
tscDebug("0x%"PRIx64" tagRetrieve:%p,%d completed, total:%d", pParentSql->self, tres, pSupporter->subqueryIndex, pParentSql->subState.numOfSub);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1217,7 +1217,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
if (emptyTagList(resList, pParentSql->subState.numOfSub)) { // no results,return.
|
||||
assert(pParentSql->fp != tscJoinQueryCallback);
|
||||
|
||||
tscDebug("%p tag intersect does not generated qualified tables for join, free all sub SqlObj and quit", pParentSql);
|
||||
tscDebug("0x%"PRIx64" tag intersect does not generated qualified tables for join, free all sub SqlObj and quit",
|
||||
pParentSql->self);
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
||||
// set no result command
|
||||
|
@ -1239,7 +1240,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
((SJoinSupporter*)psub->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo->pVgroupTables);
|
||||
|
||||
memset(pParentSql->subState.states, 0, sizeof(pParentSql->subState.states[0]) * pParentSql->subState.numOfSub);
|
||||
tscDebug("%p reset all sub states to 0", pParentSql);
|
||||
tscDebug("0x%"PRIx64" reset all sub states to 0", pParentSql->self);
|
||||
|
||||
issueTsCompQuery(psub, psub->param, pParentSql);
|
||||
}
|
||||
|
@ -1332,7 +1333,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
}
|
||||
|
||||
if (pSupporter->pTSBuf == NULL) {
|
||||
tscDebug("%p create tmp file for ts block:%s, size:%d bytes", pSql, pBuf->path, numOfRows);
|
||||
tscDebug("0x%"PRIx64" create tmp file for ts block:%s, size:%d bytes", pSql->self, pBuf->path, numOfRows);
|
||||
pSupporter->pTSBuf = pBuf;
|
||||
} else {
|
||||
assert(pQueryInfo->numOfTables == 1); // for subquery, only one
|
||||
|
@ -1358,8 +1359,8 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
pTableMetaInfo->vgroupIndex += 1;
|
||||
assert(pTableMetaInfo->vgroupIndex < totalVgroups);
|
||||
|
||||
tscDebug("%p results from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%" PRId64,
|
||||
pSql, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups,
|
||||
tscDebug("0x%"PRIx64" results from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%" PRId64,
|
||||
pSql->self, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups,
|
||||
pRes->numOfClauseTotal);
|
||||
|
||||
pCmd->command = TSDB_SQL_SELECT;
|
||||
|
@ -1382,12 +1383,12 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p all subquery retrieve ts complete, do ts block intersect", pParentSql);
|
||||
tscDebug("0x%"PRIx64" all subquery retrieve ts complete, do ts block intersect", pParentSql->self);
|
||||
|
||||
STimeWindow win = TSWINDOW_INITIALIZER;
|
||||
int64_t num = doTSBlockIntersect(pParentSql, &win);
|
||||
if (num <= 0) { // no result during ts intersect
|
||||
tscDebug("%p no results generated in ts intersection, free all sub SqlObj and quit", pParentSql);
|
||||
tscDebug("0x%"PRIx64" no results generated in ts intersection, free all sub SqlObj and quit", pParentSql->self);
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
||||
// set no result command
|
||||
|
@ -1455,23 +1456,23 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
|
|||
}
|
||||
|
||||
if ((++pTableMetaInfo->vgroupIndex) < numOfVgroups) {
|
||||
tscDebug("%p no result in current vnode anymore, try next vnode, vgIndex:%d", pSql, pTableMetaInfo->vgroupIndex);
|
||||
tscDebug("0x%"PRIx64" no result in current vnode anymore, try next vnode, vgIndex:%d", pSql->self, pTableMetaInfo->vgroupIndex);
|
||||
pSql->cmd.command = TSDB_SQL_SELECT;
|
||||
pSql->fp = tscJoinQueryCallback;
|
||||
|
||||
tscProcessSql(pSql);
|
||||
return;
|
||||
} else {
|
||||
tscDebug("%p no result in current subquery anymore", pSql);
|
||||
tscDebug("0x%"PRIx64" no result in current subquery anymore", pSql->self);
|
||||
}
|
||||
}
|
||||
|
||||
if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
|
||||
tscDebug("%p sub:%p,%d completed, total:%d", pParentSql, tres, pSupporter->subqueryIndex, pState->numOfSub);
|
||||
tscDebug("0x%"PRIx64" sub:%p,%d completed, total:%d", pParentSql->self, tres, pSupporter->subqueryIndex, pState->numOfSub);
|
||||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p all %d secondary subqueries retrieval completed, code:%d", tres, pState->numOfSub, pParentSql->res.code);
|
||||
tscDebug("0x%"PRIx64" all %d secondary subqueries retrieval completed, code:%d", pSql->self, pState->numOfSub, pParentSql->res.code);
|
||||
|
||||
if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
@ -1482,14 +1483,14 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
|
|||
bool stableQuery = tscIsTwoStageSTableQuery(pQueryInfo, 0);
|
||||
for (int32_t i = 0; i < pState->numOfSub; ++i) {
|
||||
if (pParentSql->pSubs[i] == NULL) {
|
||||
tscDebug("%p %p sub:%d not retrieve data", pParentSql, NULL, i);
|
||||
tscDebug("0x%"PRIx64" %p sub:%d not retrieve data", pParentSql->self, NULL, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
SSqlRes* pRes1 = &pParentSql->pSubs[i]->res;
|
||||
|
||||
if (pRes1->row > 0 && pRes1->numOfRows > 0) {
|
||||
tscDebug("%p sub:%p index:%d numOfRows:%d total:%"PRId64 " (not retrieve)", pParentSql, pParentSql->pSubs[i], i,
|
||||
tscDebug("0x%"PRIx64" sub:%p index:%d numOfRows:%d total:%"PRId64 " (not retrieve)", pParentSql->self, pParentSql->pSubs[i], i,
|
||||
pRes1->numOfRows, pRes1->numOfTotal);
|
||||
assert(pRes1->row < pRes1->numOfRows);
|
||||
} else {
|
||||
|
@ -1497,7 +1498,7 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
|
|||
pRes1->numOfClauseTotal += pRes1->numOfRows;
|
||||
}
|
||||
|
||||
tscDebug("%p sub:%p index:%d numOfRows:%d total:%"PRId64, pParentSql, pParentSql->pSubs[i], i,
|
||||
tscDebug("0x%"PRIx64" sub:%p index:%d numOfRows:%d total:%"PRId64, pParentSql->self, pParentSql->pSubs[i], i,
|
||||
pRes1->numOfRows, pRes1->numOfTotal);
|
||||
}
|
||||
}
|
||||
|
@ -1615,7 +1616,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
if ((++pTableMetaInfo->vgroupIndex) < numOfVgroups) {
|
||||
tscDebug("%p no result in current vnode anymore, try next vnode, vgIndex:%d", pSub,
|
||||
tscDebug("0x%"PRIx64" no result in current vnode anymore, try next vnode, vgIndex:%d", pSub->self,
|
||||
pTableMetaInfo->vgroupIndex);
|
||||
pSub->cmd.command = TSDB_SQL_SELECT;
|
||||
pSub->fp = tscJoinQueryCallback;
|
||||
|
@ -1623,7 +1624,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
|
|||
tscProcessSql(pSub);
|
||||
tryNextVnode = true;
|
||||
} else {
|
||||
tscDebug("%p no result in current subquery anymore", pSub);
|
||||
tscDebug("0x%"PRIx64" no result in current subquery anymore", pSub->self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1646,7 +1647,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
|
|||
|
||||
// TODO multi-vnode retrieve for projection query with limitation has bugs, since the global limiation is not handled
|
||||
// retrieve data from current vnode.
|
||||
tscDebug("%p retrieve data from %d subqueries", pSql, numOfFetch);
|
||||
tscDebug("0x%"PRIx64" retrieve data from %d subqueries", pSql->self, numOfFetch);
|
||||
SJoinSupporter* pSupporter = NULL;
|
||||
|
||||
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
|
||||
|
@ -1680,7 +1681,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
|
|||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
|
||||
if (pRes1->row >= pRes1->numOfRows) {
|
||||
tscDebug("%p subquery:%p retrieve data from vnode, subquery:%d, vgroupIndex:%d", pSql, pSql1,
|
||||
tscDebug("0x%"PRIx64" subquery:%p retrieve data from vnode, subquery:%d, vgroupIndex:%d", pSql->self, pSql1,
|
||||
pSupporter->subqueryIndex, pTableMetaInfo->vgroupIndex);
|
||||
|
||||
tscResetForNextRetrieve(pRes1);
|
||||
|
@ -2000,11 +2001,11 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub);
|
||||
tscDebug("%p reset all sub states to 0", pSql);
|
||||
tscDebug("0x%"PRIx64" reset all sub states to 0", pSql->self);
|
||||
|
||||
bool hasEmptySub = false;
|
||||
|
||||
tscDebug("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables);
|
||||
tscDebug("0x%"PRIx64" start subquery, total:%d", pSql->self, pQueryInfo->numOfTables);
|
||||
for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
||||
|
||||
SJoinSupporter *pSupporter = tscCreateJoinSupporter(pSql, i);
|
||||
|
@ -2465,7 +2466,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
tscDebug("%p retrieved query data from %d vnode(s)", pSql, pState->numOfSub);
|
||||
tscDebug("0x%"PRIx64" retrieved query data from %d vnode(s)", pSql->self, pState->numOfSub);
|
||||
pSql->pSubs = calloc(pState->numOfSub, POINTER_BYTES);
|
||||
if (pSql->pSubs == NULL) {
|
||||
tfree(pSql->pSubs);
|
||||
|
@ -2489,7 +2490,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
memset(pState->states, 0, sizeof(*pState->states) * pState->numOfSub);
|
||||
tscDebug("%p reset all sub states to 0", pSql);
|
||||
tscDebug("0x%"PRIx64" reset all sub states to 0", pSql->self);
|
||||
|
||||
pRes->code = TSDB_CODE_SUCCESS;
|
||||
|
||||
|
@ -2531,7 +2532,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
assert(pNewQueryInfo->tsBuf != NULL);
|
||||
}
|
||||
|
||||
tscDebug("%p sub:%p create subquery success. orderOfSub:%d", pSql, pNew, trs->subqueryIndex);
|
||||
tscDebug("0x%"PRIx64" sub:%p create subquery success. orderOfSub:%d", pSql->self, pNew, trs->subqueryIndex);
|
||||
}
|
||||
|
||||
if (i < pState->numOfSub) {
|
||||
|
@ -2553,7 +2554,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
SSqlObj* pSub = pSql->pSubs[j];
|
||||
SRetrieveSupport* pSupport = pSub->param;
|
||||
|
||||
tscDebug("%p sub:%p launch subquery, orderOfSub:%d.", pSql, pSub, pSupport->subqueryIndex);
|
||||
tscDebug("0x%"PRIx64" sub:%p launch subquery, orderOfSub:%d.", pSql->self, pSub, pSupport->subqueryIndex);
|
||||
tscProcessSql(pSub);
|
||||
}
|
||||
|
||||
|
@ -2565,11 +2566,11 @@ static void tscFreeRetrieveSup(SSqlObj *pSql) {
|
|||
|
||||
void* p = atomic_val_compare_exchange_ptr(&pSql->param, trsupport, 0);
|
||||
if (p == NULL) {
|
||||
tscDebug("%p retrieve supp already released", pSql);
|
||||
tscDebug("0x%"PRIx64" retrieve supp already released", pSql->self);
|
||||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p start to free subquery supp obj:%p", pSql, trsupport);
|
||||
tscDebug("0x%"PRIx64" start to free subquery supp obj:%p", pSql->self, trsupport);
|
||||
tfree(trsupport->localBuffer);
|
||||
tfree(trsupport);
|
||||
}
|
||||
|
@ -2673,12 +2674,12 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
|
|||
*/
|
||||
pSql->res.numOfRows = 0;
|
||||
trsupport->numOfRetry = MAX_NUM_OF_SUBQUERY_RETRY; // disable retry efforts
|
||||
tscDebug("%p query is cancelled, sub:%p, orderOfSub:%d abort retrieve, code:%s", pParentSql, pSql,
|
||||
tscDebug("0x%"PRIx64" query is cancelled, sub:%p, orderOfSub:%d abort retrieve, code:%s", pParentSql->self, pSql,
|
||||
subqueryIndex, tstrerror(pParentSql->res.code));
|
||||
}
|
||||
|
||||
if (numOfRows >= 0) { // current query is successful, but other sub query failed, still abort current query.
|
||||
tscDebug("%p sub:%p retrieve numOfRows:%d,orderOfSub:%d", pParentSql, pSql, numOfRows, subqueryIndex);
|
||||
tscDebug("0x%"PRIx64" sub:0x%"PRIx64" retrieve numOfRows:%d,orderOfSub:%d", pParentSql->self, pSql->self, numOfRows, subqueryIndex);
|
||||
tscError("%p sub:%p abort further retrieval due to other queries failure,orderOfSub:%d,code:%s", pParentSql, pSql,
|
||||
subqueryIndex, tstrerror(pParentSql->res.code));
|
||||
} else {
|
||||
|
@ -2697,7 +2698,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
|
|||
}
|
||||
|
||||
if (!subAndCheckDone(pSql, pParentSql, subqueryIndex)) {
|
||||
tscDebug("%p sub:%p,%d freed, not finished, total:%d", pParentSql, pSql, trsupport->subqueryIndex, pState->numOfSub);
|
||||
tscDebug("0x%"PRIx64" sub:%p,%d freed, not finished, total:%d", pParentSql->self, pSql, trsupport->subqueryIndex, pState->numOfSub);
|
||||
|
||||
tscFreeRetrieveSup(pSql);
|
||||
return;
|
||||
|
@ -2738,7 +2739,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
// data in from current vnode is stored in cache and disk
|
||||
uint32_t numOfRowsFromSubquery = (uint32_t)(trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->num);
|
||||
SVgroupsInfo* vgroupsInfo = pTableMetaInfo->vgroupList;
|
||||
tscDebug("%p sub:%p all data retrieved from ep:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pParentSql, pSql,
|
||||
tscDebug("0x%"PRIx64" sub:%p all data retrieved from ep:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pParentSql->self, pSql,
|
||||
vgroupsInfo->vgroups[0].epAddr[0].fqdn, vgroupsInfo->vgroups[0].vgId, numOfRowsFromSubquery, idx);
|
||||
|
||||
tColModelCompact(pDesc->pColumnModel, trsupport->localBuffer, pDesc->pColumnModel->capacity);
|
||||
|
@ -2767,7 +2768,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
}
|
||||
|
||||
if (!subAndCheckDone(pSql, pParentSql, idx)) {
|
||||
tscDebug("%p sub:%p orderOfSub:%d freed, not finished", pParentSql, pSql, trsupport->subqueryIndex);
|
||||
tscDebug("0x%"PRIx64" sub:%p orderOfSub:%d freed, not finished", pParentSql->self, pSql, trsupport->subqueryIndex);
|
||||
|
||||
tscFreeRetrieveSup(pSql);
|
||||
return;
|
||||
|
@ -2776,14 +2777,14 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
// all sub-queries are returned, start to local merge process
|
||||
pDesc->pColumnModel->capacity = trsupport->pExtMemBuffer[idx]->numOfElemsPerPage;
|
||||
|
||||
tscDebug("%p retrieve from %d vnodes completed.final NumOfRows:%" PRId64 ",start to build loser tree", pParentSql,
|
||||
pState->numOfSub, pState->numOfRetrievedRows);
|
||||
tscDebug("0x%"PRIx64" retrieve from %d vnodes completed.final NumOfRows:%" PRId64 ",start to build loser tree",
|
||||
pParentSql->self, pState->numOfSub, pState->numOfRetrievedRows);
|
||||
|
||||
SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, 0);
|
||||
tscClearInterpInfo(pPQueryInfo);
|
||||
|
||||
tscCreateLocalMerger(trsupport->pExtMemBuffer, pState->numOfSub, pDesc, trsupport->pFinalColModel, trsupport->pFFColModel, pParentSql);
|
||||
tscDebug("%p build loser tree completed", pParentSql);
|
||||
tscDebug("0x%"PRIx64" build loser tree completed", pParentSql->self);
|
||||
|
||||
pParentSql->res.precision = pSql->res.precision;
|
||||
pParentSql->res.numOfRows = 0;
|
||||
|
@ -2807,7 +2808,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
// this query has been freed already
|
||||
SRetrieveSupport *trsupport = (SRetrieveSupport *)param;
|
||||
if (pSql->param == NULL || param == NULL) {
|
||||
tscDebug("%p already freed in dnodecallback", pSql);
|
||||
tscDebug("0x%"PRIx64" already freed in dnodecallback", pSql->self);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2822,8 +2823,8 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
|
||||
if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
|
||||
trsupport->numOfRetry = MAX_NUM_OF_SUBQUERY_RETRY;
|
||||
tscDebug("%p query cancelled/failed, sub:%p, vgId:%d, orderOfSub:%d, code:%s, global code:%s",
|
||||
pParentSql, pSql, pVgroup->vgId, trsupport->subqueryIndex, tstrerror(numOfRows), tstrerror(pParentSql->res.code));
|
||||
tscDebug("0x%"PRIx64" query cancelled/failed, sub:%p, vgId:%d, orderOfSub:%d, code:%s, global code:%s",
|
||||
pParentSql->self, pSql, pVgroup->vgId, trsupport->subqueryIndex, tstrerror(numOfRows), tstrerror(pParentSql->res.code));
|
||||
|
||||
tscHandleSubqueryError(param, tres, numOfRows);
|
||||
return;
|
||||
|
@ -2846,7 +2847,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
tscDebug("%p sub:%p reach the max retry times, set global code:%s", pParentSql, pSql, tstrerror(numOfRows));
|
||||
tscDebug("0x%"PRIx64" sub:%p reach the max retry times, set global code:%s", pParentSql->self, pSql, tstrerror(numOfRows));
|
||||
atomic_val_compare_exchange_32(&pParentSql->res.code, TSDB_CODE_SUCCESS, numOfRows); // set global code and abort
|
||||
}
|
||||
|
||||
|
@ -2861,8 +2862,8 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
assert(pRes->numOfRows == numOfRows);
|
||||
int64_t num = atomic_add_fetch_64(&pState->numOfRetrievedRows, numOfRows);
|
||||
|
||||
tscDebug("%p sub:%p retrieve numOfRows:%d totalNumOfRows:%" PRIu64 " from ep:%s, orderOfSub:%d", pParentSql, pSql,
|
||||
pRes->numOfRows, pState->numOfRetrievedRows, pSql->epSet.fqdn[pSql->epSet.inUse], idx);
|
||||
tscDebug("0x%"PRIx64" sub:%p retrieve numOfRows:%d totalNumOfRows:%" PRIu64 " from ep:%s, orderOfSub:%d",
|
||||
pParentSql->self, pSql, pRes->numOfRows, pState->numOfRetrievedRows, pSql->epSet.fqdn[pSql->epSet.inUse], idx);
|
||||
|
||||
if (num > tsMaxNumOfOrderedResults && tscIsProjectionQueryOnSTable(pQueryInfo, 0)) {
|
||||
tscError("%p sub:%p num of OrderedRes is too many, max allowed:%" PRId32 " , current:%" PRId64,
|
||||
|
@ -2985,8 +2986,8 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p sub:%p query complete, ep:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSql, pSql,
|
||||
pVgroup->epAddr[pSql->epSet.inUse].fqdn, pVgroup->vgId, trsupport->subqueryIndex);
|
||||
tscDebug("0x%"PRIx64" sub:0x%"PRIx64" query complete, ep:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSql->self,
|
||||
pSql->self, pVgroup->epAddr[pSql->epSet.inUse].fqdn, pVgroup->vgId, trsupport->subqueryIndex);
|
||||
|
||||
if (pSql->res.qId == 0) { // qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode
|
||||
tscRetrieveFromDnodeCallBack(param, pSql, 0);
|
||||
|
@ -3049,7 +3050,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
|||
}
|
||||
|
||||
if (!subAndCheckDone(tres, pParentObj, pSupporter->index)) {
|
||||
tscDebug("%p insert:%p,%d completed, total:%d", pParentObj, tres, pSupporter->index, pParentObj->subState.numOfSub);
|
||||
tscDebug("0x%"PRIx64" insert:%p,%d completed, total:%d", pParentObj->self, tres, pSupporter->index, pParentObj->subState.numOfSub);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3059,7 +3060,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
|||
doFreeInsertSupporter(pParentObj);
|
||||
|
||||
if (pParentObj->res.code == TSDB_CODE_SUCCESS) {
|
||||
tscDebug("%p Async insertion completed, total inserted:%d", pParentObj, pParentObj->res.numOfRows);
|
||||
tscDebug("0x%"PRIx64" Async insertion completed, total inserted:%d", pParentObj->self, pParentObj->res.numOfRows);
|
||||
|
||||
// todo remove this parameter in async callback function definition.
|
||||
// all data has been sent to vnode, call user function
|
||||
|
@ -3085,14 +3086,14 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
|||
|
||||
subquerySetState(pSql, &pParentObj->subState, i, 0);
|
||||
|
||||
tscDebug("%p, failed sub:%d, %p", pParentObj, i, pSql);
|
||||
tscDebug("0x%"PRIx64", failed sub:%d, %p", pParentObj->self, i, pSql);
|
||||
}
|
||||
}
|
||||
|
||||
tscError("%p Async insertion completed, total inserted:%d rows, numOfFailed:%d, numOfTotal:%d", pParentObj,
|
||||
pParentObj->res.numOfRows, numOfFailed, numOfSub);
|
||||
|
||||
tscDebug("%p cleanup %d tableMeta in hashTable", pParentObj, pParentObj->cmd.numOfTables);
|
||||
tscDebug("0x%"PRIx64" cleanup %d tableMeta in hashTable", pParentObj->self, pParentObj->cmd.numOfTables);
|
||||
for(int32_t i = 0; i < pParentObj->cmd.numOfTables; ++i) {
|
||||
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
||||
tNameExtractFullName(pParentObj->cmd.pTableNameList[i], name);
|
||||
|
@ -3106,7 +3107,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
|||
// in case of insert, redo parsing the sql string and build new submit data block for two reasons:
|
||||
// 1. the table Id(tid & uid) may have been update, the submit block needs to be updated accordingly.
|
||||
// 2. vnode may need the schema information along with submit block to update its local table schema.
|
||||
tscDebug("%p re-parse sql to generate submit data, retry:%d", pParentObj, pParentObj->retry);
|
||||
tscDebug("0x%"PRIx64" re-parse sql to generate submit data, retry:%d", pParentObj->self, pParentObj->retry);
|
||||
pParentObj->retry++;
|
||||
|
||||
int32_t code = tsParseSql(pParentObj, true);
|
||||
|
@ -3158,7 +3159,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
pSup->pSql = pSql;
|
||||
|
||||
pSub->param = pSup;
|
||||
tscDebug("%p sub:%p launch sub insert, orderOfSub:%d", pSql, pSub, i);
|
||||
tscDebug("0x%"PRIx64" sub:%p launch sub insert, orderOfSub:%d", pSql->self, pSub, i);
|
||||
if (pSub->res.code != TSDB_CODE_SUCCESS) {
|
||||
tscHandleInsertRetry(pSql, pSub);
|
||||
}
|
||||
|
@ -3186,14 +3187,14 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub);
|
||||
tscDebug("%p reset all sub states to 0", pSql);
|
||||
tscDebug("0x%"PRIx64" reset all sub states to 0", pSql->self);
|
||||
|
||||
pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES);
|
||||
if (pSql->pSubs == NULL) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
tscDebug("%p submit data to %d vnode(s)", pSql, pSql->subState.numOfSub);
|
||||
tscDebug("0x%"PRIx64" submit data to %d vnode(s)", pSql->self, pSql->subState.numOfSub);
|
||||
|
||||
while(numOfSub < pSql->subState.numOfSub) {
|
||||
SInsertSupporter* pSupporter = calloc(1, sizeof(SInsertSupporter));
|
||||
|
@ -3220,10 +3221,10 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
STableDataBlocks* pTableDataBlock = taosArrayGetP(pCmd->pDataBlocks, numOfSub);
|
||||
pRes->code = tscCopyDataBlockToPayload(pNew, pTableDataBlock);
|
||||
if (pRes->code == TSDB_CODE_SUCCESS) {
|
||||
tscDebug("%p sub:%p create subObj success. orderOfSub:%d", pSql, pNew, numOfSub);
|
||||
tscDebug("0x%"PRIx64" sub:%p create subObj success. orderOfSub:%d", pSql->self, pNew, numOfSub);
|
||||
numOfSub++;
|
||||
} else {
|
||||
tscDebug("%p prepare submit data block failed in async insertion, vnodeIdx:%d, total:%d, code:%s", pSql, numOfSub,
|
||||
tscDebug("0x%"PRIx64" prepare submit data block failed in async insertion, vnodeIdx:%d, total:%d, code:%s", pSql->self, numOfSub,
|
||||
pSql->subState.numOfSub, tstrerror(pRes->code));
|
||||
goto _error;
|
||||
}
|
||||
|
@ -3240,7 +3241,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
// use the local variable
|
||||
for (int32_t j = 0; j < numOfSub; ++j) {
|
||||
SSqlObj *pSub = pSql->pSubs[j];
|
||||
tscDebug("%p sub:%p launch sub insert, orderOfSub:%d", pSql, pSub, j);
|
||||
tscDebug("0x%"PRIx64" sub:%p launch sub insert, orderOfSub:%d", pSql->self, pSub, j);
|
||||
tscProcessSql(pSub);
|
||||
}
|
||||
|
||||
|
|
|
@ -496,10 +496,10 @@ void tscFreeSubobj(SSqlObj* pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p start to free sub SqlObj, numOfSub:%d", pSql, pSql->subState.numOfSub);
|
||||
tscDebug("0x%"PRIx64" start to free sub SqlObj, numOfSub:%d", pSql->self, pSql->subState.numOfSub);
|
||||
|
||||
for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
|
||||
tscDebug("%p free sub SqlObj:%p, index:%d", pSql, pSql->pSubs[i], i);
|
||||
tscDebug("0x%"PRIx64" free sub SqlObj:%p, index:%d", pSql->self, pSql->pSubs[i], i);
|
||||
taos_free_result(pSql->pSubs[i]);
|
||||
pSql->pSubs[i] = NULL;
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ void tscFreeRegisteredSqlObj(void *pSql) {
|
|||
int32_t num = atomic_sub_fetch_32(&pTscObj->numOfObj, 1);
|
||||
int32_t total = atomic_sub_fetch_32(&tscNumOfObj, 1);
|
||||
|
||||
tscDebug("%p free SqlObj, total in tscObj:%d, total:%d", pSql, num, total);
|
||||
tscDebug("0x%"PRIx64" free SqlObj, total in tscObj:%d, total:%d", p->self, num, total);
|
||||
tscFreeSqlObj(p);
|
||||
taosReleaseRef(tscRefId, pTscObj->rid);
|
||||
|
||||
|
@ -553,7 +553,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscDebug("%p start to free sqlObj", pSql);
|
||||
tscDebug("0x%"PRIx64" start to free sqlObj", pSql->self);
|
||||
|
||||
pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
||||
|
||||
|
@ -945,7 +945,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) {
|
|||
tscSortRemoveDataBlockDupRows(pOneTableBlock);
|
||||
char* ekey = (char*)pBlocks->data + pOneTableBlock->rowSize*(pBlocks->numOfRows-1);
|
||||
|
||||
tscDebug("%p name:%s, name:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql, tNameGetTableName(&pOneTableBlock->tableName),
|
||||
tscDebug("0x%"PRIx64" name:%s, name:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql->self, tNameGetTableName(&pOneTableBlock->tableName),
|
||||
pBlocks->tid, pBlocks->numOfRows, pBlocks->sversion, GET_INT64_VAL(pBlocks->data), GET_INT64_VAL(ekey));
|
||||
|
||||
int32_t len = pBlocks->numOfRows * (pOneTableBlock->rowSize + expandSize) + sizeof(STColumn) * tscGetNumOfColumns(pOneTableBlock->pTableMeta);
|
||||
|
@ -2109,7 +2109,7 @@ void registerSqlObj(SSqlObj* pSql) {
|
|||
|
||||
int32_t num = atomic_add_fetch_32(&pSql->pTscObj->numOfObj, 1);
|
||||
int32_t total = atomic_add_fetch_32(&tscNumOfObj, 1);
|
||||
tscDebug("%p new SqlObj from %p, total in tscObj:%d, total:%d", pSql, pSql->pTscObj, num, total);
|
||||
tscDebug("0x%"PRIx64" new SqlObj from %p, total in tscObj:%d, total:%d", pSql->self, pSql->pTscObj, num, total);
|
||||
}
|
||||
|
||||
SSqlObj* createSimpleSubObj(SSqlObj* pSql, __async_cb_func_t fp, void* param, int32_t cmd) {
|
||||
|
@ -2376,7 +2376,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
|
|||
|
||||
tscPrintSelectClause(pNew, 0);
|
||||
} else {
|
||||
tscDebug("%p new sub insertion: %p, vnodeIdx:%d", pSql, pNew, pTableMetaInfo->vgroupIndex);
|
||||
tscDebug("0x%"PRIx64" new sub insertion: %p, vnodeIdx:%d", pSql->self, pNew, pTableMetaInfo->vgroupIndex);
|
||||
}
|
||||
|
||||
registerSqlObj(pNew);
|
||||
|
@ -2627,7 +2627,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
|
||||
int32_t totalVgroups = pTableMetaInfo->vgroupList->numOfVgroups;
|
||||
if (++pTableMetaInfo->vgroupIndex < totalVgroups) {
|
||||
tscDebug("%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%" PRId64, pSql,
|
||||
tscDebug("0x%"PRIx64" results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%" PRId64, pSql->self,
|
||||
pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pRes->numOfClauseTotal);
|
||||
|
||||
/*
|
||||
|
@ -2646,8 +2646,8 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
pQueryInfo->limit.offset = pRes->offset;
|
||||
assert((pRes->offset >= 0 && pRes->numOfRows == 0) || (pRes->offset == 0 && pRes->numOfRows >= 0));
|
||||
|
||||
tscDebug("%p new query to next vgroup, index:%d, limit:%" PRId64 ", offset:%" PRId64 ", glimit:%" PRId64,
|
||||
pSql, pTableMetaInfo->vgroupIndex, pQueryInfo->limit.limit, pQueryInfo->limit.offset, pQueryInfo->clauseLimit);
|
||||
tscDebug("0x%"PRIx64" new query to next vgroup, index:%d, limit:%" PRId64 ", offset:%" PRId64 ", glimit:%" PRId64,
|
||||
pSql->self, pTableMetaInfo->vgroupIndex, pQueryInfo->limit.limit, pQueryInfo->limit.offset, pQueryInfo->clauseLimit);
|
||||
|
||||
/*
|
||||
* For project query with super table join, the numOfSub is equalled to the number of all subqueries.
|
||||
|
@ -2664,7 +2664,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
pSql->fp = fp;
|
||||
tscProcessSql(pSql);
|
||||
} else {
|
||||
tscDebug("%p try all %d vnodes, query complete. current numOfRes:%" PRId64, pSql, totalVgroups, pRes->numOfClauseTotal);
|
||||
tscDebug("0x%"PRIx64" try all %d vnodes, query complete. current numOfRes:%" PRId64, pSql->self, totalVgroups, pRes->numOfClauseTotal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2690,7 +2690,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
pSql->subState.numOfSub = 0;
|
||||
pSql->fp = fp;
|
||||
|
||||
tscDebug("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
tscDebug("0x%"PRIx64" try data in the next subclause:%d, total subclause:%d", pSql->self, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
if (pCmd->command > TSDB_SQL_LOCAL) {
|
||||
tscProcessLocalCmd(pSql);
|
||||
} else {
|
||||
|
|
|
@ -48,8 +48,12 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
|
|||
case TSDB_DATA_TYPE_INT:{
|
||||
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true);
|
||||
if (ret != 0) {
|
||||
pVar->nType = -1; // -1 means error type
|
||||
return;
|
||||
// data overflow, try unsigned parse the input number
|
||||
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false);
|
||||
if (ret != 0) {
|
||||
pVar->nType = -1; // -1 means error type
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -525,6 +529,8 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
|
|||
}
|
||||
|
||||
bool code = false;
|
||||
|
||||
uint64_t ui = 0;
|
||||
switch(type) {
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
code = IS_VALID_TINYINT(*result); break;
|
||||
|
@ -535,13 +541,17 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
|
|||
case TSDB_DATA_TYPE_BIGINT:
|
||||
code = IS_VALID_BIGINT(*result); break;
|
||||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
code = IS_VALID_UTINYINT(*result); break;
|
||||
ui = *result;
|
||||
code = IS_VALID_UTINYINT(ui); break;
|
||||
case TSDB_DATA_TYPE_USMALLINT:
|
||||
code = IS_VALID_USMALLINT(*result); break;
|
||||
ui = *result;
|
||||
code = IS_VALID_USMALLINT(ui); break;
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
code = IS_VALID_UINT(*result); break;
|
||||
ui = *result;
|
||||
code = IS_VALID_UINT(ui); break;
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
code = IS_VALID_UBIGINT(*result); break;
|
||||
ui = *result;
|
||||
code = IS_VALID_UBIGINT(ui); break;
|
||||
}
|
||||
|
||||
return code? 0:-1;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d99751356e285696f57bc604304ffafd10287439
|
||||
Subproject commit 050667e5b4d0eafa5387e4283e713559b421203f
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="taos",
|
||||
version="2.0.7",
|
||||
version="2.0.8",
|
||||
author="Taosdata Inc.",
|
||||
author_email="support@taosdata.com",
|
||||
description="TDengine python client package",
|
||||
|
|
|
@ -42,7 +42,7 @@ class TDengineCursor(object):
|
|||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
def next(self):
|
||||
if self._result is None or self._fields is None:
|
||||
raise OperationalError("Invalid use of fetch iterator")
|
||||
|
||||
|
|
|
@ -310,8 +310,23 @@ void *cqCreate(void *handle, uint64_t uid, int32_t sid, const char* dstTable, ch
|
|||
}
|
||||
SCqContext *pContext = handle;
|
||||
int64_t rid = 0;
|
||||
|
||||
pthread_mutex_lock(&pContext->mutex);
|
||||
|
||||
SCqObj *pObj = pContext->pHead;
|
||||
while (pObj) {
|
||||
if (pObj->uid == uid) {
|
||||
rid = pObj->rid;
|
||||
pthread_mutex_unlock(&pContext->mutex);
|
||||
return (void *)rid;
|
||||
}
|
||||
|
||||
pObj = pObj->next;
|
||||
}
|
||||
|
||||
SCqObj *pObj = calloc(sizeof(SCqObj), 1);
|
||||
pthread_mutex_unlock(&pContext->mutex);
|
||||
|
||||
pObj = calloc(sizeof(SCqObj), 1);
|
||||
if (pObj == NULL) return NULL;
|
||||
|
||||
pObj->uid = uid;
|
||||
|
@ -386,12 +401,15 @@ static void doCreateStream(void *param, TAOS_RES *result, int32_t code) {
|
|||
if (pObj == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SCqContext* pContext = pObj->pContext;
|
||||
SSqlObj* pSql = (SSqlObj*)result;
|
||||
if (atomic_val_compare_exchange_ptr(&(pContext->dbConn), NULL, pSql->pTscObj) != NULL) {
|
||||
taos_close(pSql->pTscObj);
|
||||
SSqlObj* pSql = (SSqlObj*)result;
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
if (atomic_val_compare_exchange_ptr(&(pContext->dbConn), NULL, pSql->pTscObj) != NULL) {
|
||||
taos_close(pSql->pTscObj);
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&pContext->mutex);
|
||||
cqCreateStream(pContext, pObj);
|
||||
pthread_mutex_unlock(&pContext->mutex);
|
||||
|
@ -427,10 +445,11 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
|
|||
pObj->tmrId = taosTmrStart(cqProcessCreateTimer, 1000, (void *)pObj->rid, pContext->tmrCtrl);
|
||||
return;
|
||||
}
|
||||
|
||||
pObj->tmrId = 0;
|
||||
|
||||
if (pObj->pStream == NULL) {
|
||||
pObj->pStream = taos_open_stream(pContext->dbConn, pObj->sqlStr, cqProcessStreamRes, 0, (void *)pObj->rid, NULL);
|
||||
pObj->pStream = taos_open_stream(pContext->dbConn, pObj->sqlStr, cqProcessStreamRes, INT64_MIN, (void *)pObj->rid, NULL);
|
||||
|
||||
// TODO the pObj->pStream may be released if error happens
|
||||
if (pObj->pStream) {
|
||||
|
|
|
@ -210,6 +210,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
#define TK_SPACE 300
|
||||
#define TK_COMMENT 301
|
||||
#define TK_ILLEGAL 302
|
||||
|
|
|
@ -199,15 +199,19 @@ void updateBuffer(Command *cmd) {
|
|||
}
|
||||
|
||||
int isReadyGo(Command *cmd) {
|
||||
char total[MAX_COMMAND_SIZE];
|
||||
char *total = malloc(MAX_COMMAND_SIZE);
|
||||
memset(total, 0, MAX_COMMAND_SIZE);
|
||||
sprintf(total, "%s%s", cmd->buffer, cmd->command);
|
||||
|
||||
char *reg_str =
|
||||
"(^.*;\\s*$)|(^\\s*$)|(^\\s*exit\\s*$)|(^\\s*q\\s*$)|(^\\s*quit\\s*$)|(^"
|
||||
"\\s*clear\\s*$)";
|
||||
if (regex_match(total, reg_str, REG_EXTENDED | REG_ICASE)) return 1;
|
||||
if (regex_match(total, reg_str, REG_EXTENDED | REG_ICASE)) {
|
||||
free(total);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free(total);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,10 @@ extern "C" {
|
|||
#include "osArm32.h"
|
||||
#endif
|
||||
|
||||
#ifdef _TD_MIPS_64
|
||||
#include "osMips64.h"
|
||||
#endif
|
||||
|
||||
#ifdef _TD_LINUX_64
|
||||
#include "osLinux64.h"
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_MIPS64_H
|
||||
#define TDENGINE_OS_MIPS64_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <argp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <endian.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <math.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <pthread.h>
|
||||
#include <pwd.h>
|
||||
#include <regex.h>
|
||||
#include <semaphore.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/sendfile.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/un.h>
|
||||
#include <syslog.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
#include <wordexp.h>
|
||||
#include <wctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/resource.h>
|
||||
#include <error.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -217,7 +217,7 @@ void taosSetCoreDump() {}
|
|||
|
||||
int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
|
||||
struct statvfs info;
|
||||
if (statvfs(tsDataDir, &info)) {
|
||||
if (statvfs(dataDir, &info)) {
|
||||
uError("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
|
|
|
@ -319,7 +319,7 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
|
|||
|
||||
int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
|
||||
struct statvfs info;
|
||||
if (statvfs(tsDataDir, &info)) {
|
||||
if (statvfs(dataDir, &info)) {
|
||||
uError("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
|
|
|
@ -25,7 +25,7 @@ const char *httpContextStateStr(HttpContextState state);
|
|||
HttpContext *httpCreateContext(SOCKET fd);
|
||||
bool httpInitContext(HttpContext *pContext);
|
||||
HttpContext *httpGetContext(void * pContext);
|
||||
void httpReleaseContext(HttpContext *pContext, bool clearRes);
|
||||
void httpReleaseContext(HttpContext *pContext/*, bool clearRes*/);
|
||||
void httpCloseContextByServer(HttpContext *pContext);
|
||||
void httpCloseContextByApp(HttpContext *pContext);
|
||||
void httpNotifyContextClose(HttpContext *pContext);
|
||||
|
|
|
@ -146,20 +146,20 @@ HttpContext *httpGetContext(void *ptr) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void httpReleaseContext(HttpContext *pContext, bool clearRes) {
|
||||
void httpReleaseContext(HttpContext *pContext/*, bool clearRes*/) {
|
||||
int32_t refCount = atomic_sub_fetch_32(&pContext->refCount, 1);
|
||||
if (refCount < 0) {
|
||||
httpError("context:%p, is already released, refCount:%d", pContext, refCount);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (clearRes) {
|
||||
if (pContext->parser) {
|
||||
httpClearParser(pContext->parser);
|
||||
}
|
||||
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
|
||||
}
|
||||
|
||||
*/
|
||||
HttpContext **ppContext = pContext->ppContext;
|
||||
httpTrace("context:%p, is released, data:%p refCount:%d", pContext, ppContext, refCount);
|
||||
|
||||
|
@ -217,7 +217,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
|
|||
httpContextStateStr(pContext->state), pContext->state);
|
||||
}
|
||||
|
||||
httpReleaseContext(pContext, true);
|
||||
httpReleaseContext(pContext/*, true*/);
|
||||
}
|
||||
|
||||
void httpCloseContextByServer(HttpContext *pContext) {
|
||||
|
@ -235,5 +235,5 @@ void httpCloseContextByServer(HttpContext *pContext) {
|
|||
|
||||
pContext->parsed = false;
|
||||
httpRemoveContextFromEpoll(pContext);
|
||||
httpReleaseContext(pContext, true);
|
||||
httpReleaseContext(pContext/*, true*/);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ bool httpProcessData(HttpContext* pContext) {
|
|||
*/
|
||||
// httpCloseContextByApp(pContext);
|
||||
} else {
|
||||
httpClearParser(pContext->parser);
|
||||
httpProcessRequest(pContext);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ static void httpProcessHttpData(void *param) {
|
|||
if (!httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_READY)) {
|
||||
httpDebug("context:%p, fd:%d, state:%s, not in ready state, ignore read events", pContext, pContext->fd,
|
||||
httpContextStateStr(pContext->state));
|
||||
httpReleaseContext(pContext, true);
|
||||
httpReleaseContext(pContext/*, true*/);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void httpProcessHttpData(void *param) {
|
|||
(*(pThread->processData))(pContext);
|
||||
atomic_fetch_add_32(&pServer->requestNum, 1);
|
||||
} else {
|
||||
httpReleaseContext(pContext, false);
|
||||
httpReleaseContext(pContext/*, false*/);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ static void *httpAcceptHttpConnection(void *arg) {
|
|||
httpError("context:%p, fd:%d, ip:%s, thread:%s, failed to add http fd for epoll, error:%s", pContext, connFd,
|
||||
pContext->ipstr, pThread->label, strerror(errno));
|
||||
taosCloseSocket(pContext->fd);
|
||||
httpReleaseContext(pContext, true);
|
||||
httpReleaseContext(pContext/*, true*/);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,6 +376,8 @@ void httpExecCmd(HttpContext *pContext) {
|
|||
httpCloseContextByApp(pContext);
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
|
||||
}
|
||||
|
||||
void httpProcessRequestCb(void *param, TAOS_RES *result, int32_t code) {
|
||||
|
|
|
@ -44,6 +44,12 @@ enum SQL_NODE_FROM_TYPE {
|
|||
SQL_NODE_FROM_NAMELIST = 2,
|
||||
};
|
||||
|
||||
enum SQL_EXPR_FLAG {
|
||||
EXPR_FLAG_TS_ERROR = 1,
|
||||
EXPR_FLAG_US_TIMESTAMP = 2,
|
||||
EXPR_FLAG_TIMESTAMP_VAR = 3,
|
||||
};
|
||||
|
||||
extern char tTokenTypeSwitcher[13];
|
||||
|
||||
#define toTSDBType(x) \
|
||||
|
@ -237,7 +243,8 @@ typedef struct tSqlExpr {
|
|||
SStrToken colInfo; // table column info
|
||||
tVariant value; // the use input value
|
||||
SStrToken token; // original sql expr string
|
||||
|
||||
uint32_t flags;
|
||||
|
||||
struct tSqlExpr *pLeft; // left child
|
||||
struct tSqlExpr *pRight; // right child
|
||||
struct SArray *pParam; // function parameters list
|
||||
|
|
|
@ -674,6 +674,8 @@ expr(A) ::= PLUS(X) FLOAT(Y). { X.n += Y.n; X.type = TK_FLOAT; A = tSqlExprCr
|
|||
expr(A) ::= STRING(X). { A = tSqlExprCreateIdValue(&X, TK_STRING);}
|
||||
expr(A) ::= NOW(X). { A = tSqlExprCreateIdValue(&X, TK_NOW); }
|
||||
expr(A) ::= VARIABLE(X). { A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
|
||||
expr(A) ::= PLUS(X) VARIABLE(Y). { X.n += Y.n; X.type = TK_VARIABLE; A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
|
||||
expr(A) ::= MINUS(X) VARIABLE(Y). { X.n += Y.n; X.type = TK_VARIABLE; A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
|
||||
expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);}
|
||||
expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);}
|
||||
|
||||
|
|
|
@ -2482,6 +2482,29 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* keep the intermediate results during scan data blocks in the format of:
|
||||
* +-----------------------------------+-------------one value pair-----------+------------next value pair-----------+
|
||||
* |-------------pointer area----------|----ts---+-----+-----n tags-----------|----ts---+-----+-----n tags-----------|
|
||||
* +..[Value Pointer1][Value Pointer2].|timestamp|value|tags1|tags2|....|tagsn|timestamp|value|tags1|tags2|....|tagsn+
|
||||
*/
|
||||
static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) {
|
||||
char *tmp = (char *)pTopBotInfo + sizeof(STopBotInfo);
|
||||
pTopBotInfo->res = (tValuePair**) tmp;
|
||||
tmp += POINTER_BYTES * pCtx->param[0].i64;
|
||||
|
||||
size_t size = sizeof(tValuePair) + pCtx->tagInfo.tagsLen;
|
||||
// assert(pCtx->param[0].i64 > 0);
|
||||
|
||||
for (int32_t i = 0; i < pCtx->param[0].i64; ++i) {
|
||||
pTopBotInfo->res[i] = (tValuePair*) tmp;
|
||||
pTopBotInfo->res[i]->pTags = tmp + sizeof(tValuePair);
|
||||
tmp += size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const char *maxval) {
|
||||
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||
if (pResInfo == NULL) {
|
||||
|
@ -2495,6 +2518,10 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
|
|||
return true;
|
||||
}
|
||||
|
||||
if ((void *)pTopBotInfo->res[0] != (void *)((char *)pTopBotInfo + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) {
|
||||
buildTopBotStruct(pTopBotInfo, pCtx);
|
||||
}
|
||||
|
||||
tValuePair **pRes = (tValuePair**) pTopBotInfo->res;
|
||||
|
||||
if (pCtx->functionId == TSDB_FUNC_TOP) {
|
||||
|
@ -2534,27 +2561,6 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* keep the intermediate results during scan data blocks in the format of:
|
||||
* +-----------------------------------+-------------one value pair-----------+------------next value pair-----------+
|
||||
* |-------------pointer area----------|----ts---+-----+-----n tags-----------|----ts---+-----+-----n tags-----------|
|
||||
* +..[Value Pointer1][Value Pointer2].|timestamp|value|tags1|tags2|....|tagsn|timestamp|value|tags1|tags2|....|tagsn+
|
||||
*/
|
||||
static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) {
|
||||
char *tmp = (char *)pTopBotInfo + sizeof(STopBotInfo);
|
||||
pTopBotInfo->res = (tValuePair**) tmp;
|
||||
tmp += POINTER_BYTES * pCtx->param[0].i64;
|
||||
|
||||
size_t size = sizeof(tValuePair) + pCtx->tagInfo.tagsLen;
|
||||
// assert(pCtx->param[0].i64 > 0);
|
||||
|
||||
for (int32_t i = 0; i < pCtx->param[0].i64; ++i) {
|
||||
pTopBotInfo->res[i] = (tValuePair*) tmp;
|
||||
pTopBotInfo->res[i]->pTags = tmp + sizeof(tValuePair);
|
||||
tmp += size;
|
||||
}
|
||||
}
|
||||
|
||||
static bool top_bottom_function_setup(SQLFunctionCtx *pCtx) {
|
||||
if (!function_setup(pCtx)) {
|
||||
return false;
|
||||
|
@ -2609,6 +2615,10 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
|||
|
||||
STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
|
||||
assert(pRes->num >= 0);
|
||||
|
||||
if ((void *)pRes->res[0] != (void *)((char *)pRes + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) {
|
||||
buildTopBotStruct(pRes, pCtx);
|
||||
}
|
||||
|
||||
SET_VAL(pCtx, 1, 1);
|
||||
TSKEY ts = GET_TS_DATA(pCtx, index);
|
||||
|
|
|
@ -1359,7 +1359,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
|
|||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||
|
||||
if (type == TSDB_DATA_TYPE_FLOAT || type == TSDB_DATA_TYPE_DOUBLE) {
|
||||
qError("QInfo:%"PRIu64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv));
|
||||
qError("QInfo:0x%"PRIx64" group by not supported on double/float columns, abort", GET_QID(pRuntimeEnv));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1746,7 +1746,7 @@ static void* destroySQLFunctionCtx(SQLFunctionCtx* pCtx, int32_t numOfOutput) {
|
|||
}
|
||||
|
||||
static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOfTables) {
|
||||
qDebug("QInfo:%"PRIu64" setup runtime env", GET_QID(pRuntimeEnv));
|
||||
qDebug("QInfo:0x%"PRIx64" setup runtime env", GET_QID(pRuntimeEnv));
|
||||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||
|
||||
pRuntimeEnv->prevGroupId = INT32_MIN;
|
||||
|
@ -1779,7 +1779,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
|
|||
*(int64_t*) pRuntimeEnv->prevRow[0] = INT64_MIN;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" init runtime environment completed", GET_QID(pRuntimeEnv));
|
||||
qDebug("QInfo:0x%"PRIx64" init runtime environment completed", GET_QID(pRuntimeEnv));
|
||||
|
||||
// group by normal column, sliding window query, interval query are handled by interval query processor
|
||||
// interval (down sampling operation)
|
||||
|
@ -1879,12 +1879,15 @@ static void doFreeQueryHandle(SQueryRuntimeEnv* pRuntimeEnv) {
|
|||
}
|
||||
|
||||
static void destroyTsComp(SQueryRuntimeEnv *pRuntimeEnv, SQuery *pQuery) {
|
||||
if (isTsCompQuery(pQuery)) {
|
||||
|
||||
if (isTsCompQuery(pQuery) && pRuntimeEnv->outputBuf && pRuntimeEnv->outputBuf->pDataBlock && taosArrayGetSize(pRuntimeEnv->outputBuf->pDataBlock) > 0) {
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(pRuntimeEnv->outputBuf->pDataBlock, 0);
|
||||
FILE *f = *(FILE **)pColInfoData->pData; // TODO refactor
|
||||
if (f) {
|
||||
fclose(f);
|
||||
*(FILE **)pColInfoData->pData = NULL;
|
||||
if (pColInfoData) {
|
||||
FILE *f = *(FILE **)pColInfoData->pData; // TODO refactor
|
||||
if (f) {
|
||||
fclose(f);
|
||||
*(FILE **)pColInfoData->pData = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1893,7 +1896,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
|
|||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||
SQInfo* pQInfo = (SQInfo*) pRuntimeEnv->qinfo;
|
||||
|
||||
qDebug("QInfo:%"PRIu64" teardown runtime env", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" teardown runtime env", pQInfo->qId);
|
||||
|
||||
if (pRuntimeEnv->sasArray != NULL) {
|
||||
for(int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
||||
|
@ -2119,7 +2122,7 @@ bool colIdCheck(SQuery *pQuery, uint64_t qId) {
|
|||
// load data column information is incorrect
|
||||
for (int32_t i = 0; i < pQuery->numOfCols - 1; ++i) {
|
||||
if (pQuery->colList[i].colId == pQuery->colList[i + 1].colId) {
|
||||
qError("QInfo:%"PRIu64" invalid data load column for query", qId);
|
||||
qError("QInfo:0x%"PRIx64" invalid data load column for query", qId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2206,13 +2209,13 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
|
|||
SQuery* pQuery = pQInfo->runtimeEnv.pQuery;
|
||||
|
||||
// in case of point-interpolation query, use asc order scan
|
||||
char msg[] = "QInfo:%"PRIu64" scan order changed for %s query, old:%d, new:%d, qrange exchanged, old qrange:%" PRId64
|
||||
char msg[] = "QInfo:0x%"PRIx64" scan order changed for %s query, old:%d, new:%d, qrange exchanged, old qrange:%" PRId64
|
||||
"-%" PRId64 ", new qrange:%" PRId64 "-%" PRId64;
|
||||
|
||||
// todo handle the case the the order irrelevant query type mixed up with order critical query type
|
||||
// descending order query for last_row query
|
||||
if (isFirstLastRowQuery(pQuery)) {
|
||||
qDebug("QInfo:%"PRIu64" scan order changed for last_row query, old:%d, new:%d", pQInfo->qId, pQuery->order.order, TSDB_ORDER_ASC);
|
||||
qDebug("QInfo:0x%"PRIx64" scan order changed for last_row query, old:%d, new:%d", pQInfo->qId, pQuery->order.order, TSDB_ORDER_ASC);
|
||||
|
||||
pQuery->order.order = TSDB_ORDER_ASC;
|
||||
if (pQuery->window.skey > pQuery->window.ekey) {
|
||||
|
@ -2690,7 +2693,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
|
|||
*status = updateBlockLoadStatus(pRuntimeEnv->pQuery, *status);
|
||||
|
||||
if ((*status) == BLK_DATA_NO_NEEDED || (*status) == BLK_DATA_DISCARD) {
|
||||
qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
|
||||
qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
|
||||
pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
pCost->discardBlocks += 1;
|
||||
} else if ((*status) == BLK_DATA_STATIS_NEEDED) {
|
||||
|
@ -2733,7 +2736,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
|
|||
(char*)&(pBlock->pBlockStatis[i].max));
|
||||
if (!load) { // current block has been discard due to filter applied
|
||||
pCost->discardBlocks += 1;
|
||||
qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId,
|
||||
qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId,
|
||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
(*status) = BLK_DATA_DISCARD;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2745,7 +2748,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
|
|||
// current block has been discard due to filter applied
|
||||
if (!doFilterByBlockStatistics(pRuntimeEnv, pBlock->pBlockStatis, pTableScanInfo->pCtx, pBlockInfo->rows)) {
|
||||
pCost->discardBlocks += 1;
|
||||
qDebug("QInfo:%"PRIu64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
|
||||
qDebug("QInfo:0x%"PRIx64" data block discard, brange:%" PRId64 "-%" PRId64 ", rows:%d", pQInfo->qId, pBlockInfo->window.skey,
|
||||
pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
(*status) = BLK_DATA_DISCARD;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -3412,10 +3415,10 @@ void setCtxTagForJoin(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, SExpr
|
|||
|
||||
int16_t tagType = pCtx[0].tag.nType;
|
||||
if (tagType == TSDB_DATA_TYPE_BINARY || tagType == TSDB_DATA_TYPE_NCHAR) {
|
||||
qDebug("QInfo:%"PRIu64" set tag value for join comparison, colId:%" PRId64 ", val:%s", GET_QID(pRuntimeEnv),
|
||||
qDebug("QInfo:0x%"PRIx64" set tag value for join comparison, colId:%" PRId64 ", val:%s", GET_QID(pRuntimeEnv),
|
||||
pExprInfo->base.arg->argValue.i64, pCtx[0].tag.pz);
|
||||
} else {
|
||||
qDebug("QInfo:%"PRIu64" set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, GET_QID(pRuntimeEnv),
|
||||
qDebug("QInfo:0x%"PRIx64" set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, GET_QID(pRuntimeEnv),
|
||||
pExprInfo->base.arg->argValue.i64, pCtx[0].tag.i64);
|
||||
}
|
||||
}
|
||||
|
@ -3435,9 +3438,9 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
|
|||
// failed to find data with the specified tag value and vnodeId
|
||||
if (!tsBufIsValidElem(&elem)) {
|
||||
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
|
||||
qError("QInfo:%"PRIu64" failed to find tag:%s in ts_comp", GET_QID(pRuntimeEnv), pTag->pz);
|
||||
qError("QInfo:0x%"PRIx64" failed to find tag:%s in ts_comp", GET_QID(pRuntimeEnv), pTag->pz);
|
||||
} else {
|
||||
qError("QInfo:%"PRIu64" failed to find tag:%" PRId64 " in ts_comp", GET_QID(pRuntimeEnv), pTag->i64);
|
||||
qError("QInfo:0x%"PRIx64" failed to find tag:%" PRId64 " in ts_comp", GET_QID(pRuntimeEnv), pTag->i64);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -3446,17 +3449,17 @@ int32_t setTimestampListJoinInfo(SQueryRuntimeEnv* pRuntimeEnv, tVariant* pTag,
|
|||
// Keep the cursor info of current table
|
||||
pTableQueryInfo->cur = tsBufGetCursor(pRuntimeEnv->pTsBuf);
|
||||
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
|
||||
qDebug("QInfo:%"PRIu64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
qDebug("QInfo:0x%"PRIx64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
} else {
|
||||
qDebug("QInfo:%"PRIu64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
qDebug("QInfo:0x%"PRIx64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
}
|
||||
|
||||
} else {
|
||||
tsBufSetCursor(pRuntimeEnv->pTsBuf, &pTableQueryInfo->cur);
|
||||
if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) {
|
||||
qDebug("QInfo:%"PRIu64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
qDebug("QInfo:0x%"PRIx64" find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
} else {
|
||||
qDebug("QInfo:%"PRIu64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
qDebug("QInfo:0x%"PRIx64" find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", GET_QID(pRuntimeEnv), pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3594,7 +3597,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
|
|||
int32_t start = 0;
|
||||
int32_t step = -1;
|
||||
|
||||
qDebug("QInfo:%"PRIu64" start to copy data from windowResInfo to output buf", GET_QID(pRuntimeEnv));
|
||||
qDebug("QInfo:0x%"PRIx64" start to copy data from windowResInfo to output buf", GET_QID(pRuntimeEnv));
|
||||
if (orderType == TSDB_ORDER_ASC) {
|
||||
start = pGroupResInfo->index;
|
||||
step = 1;
|
||||
|
@ -3634,7 +3637,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
|
|||
}
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" copy data to query buf completed", GET_QID(pRuntimeEnv));
|
||||
qDebug("QInfo:0x%"PRIx64" copy data to query buf completed", GET_QID(pRuntimeEnv));
|
||||
pBlock->info.rows = numOfResult;
|
||||
return 0;
|
||||
}
|
||||
|
@ -3720,11 +3723,11 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
|
|||
data += sizeof(STableIdInfo);
|
||||
total++;
|
||||
|
||||
qDebug("QInfo:%"PRIu64" set subscribe info, tid:%d, uid:%"PRIu64", skey:%"PRId64, pQInfo->qId, item->tid, item->uid, item->key);
|
||||
qDebug("QInfo:0x%"PRIx64" set subscribe info, tid:%d, uid:%"PRIu64", skey:%"PRId64, pQInfo->qId, item->tid, item->uid, item->key);
|
||||
item = taosHashIterate(pRuntimeEnv->pTableRetrieveTsMap, item);
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" set %d subscribe info", pQInfo->qId, total);
|
||||
qDebug("QInfo:0x%"PRIx64" set %d subscribe info", pQInfo->qId, total);
|
||||
// Check if query is completed or not for stable query or normal table query respectively.
|
||||
if (Q_STATUS_EQUAL(pRuntimeEnv->status, QUERY_COMPLETED) && pRuntimeEnv->proot->status == OP_EXEC_DONE) {
|
||||
setQueryStatus(pRuntimeEnv, QUERY_OVER);
|
||||
|
@ -3763,12 +3766,12 @@ void queryCostStatis(SQInfo *pQInfo) {
|
|||
pSummary->numOfTimeWindows = 0;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" :cost summary: elapsed time:%"PRId64" us, first merge:%"PRId64" us, total blocks:%d, "
|
||||
qDebug("QInfo:0x%"PRIx64" :cost summary: elapsed time:%"PRId64" us, first merge:%"PRId64" us, total blocks:%d, "
|
||||
"load block statis:%d, load data block:%d, total rows:%"PRId64 ", check rows:%"PRId64,
|
||||
pQInfo->qId, pSummary->elapsedTime, pSummary->firstStageMergeTime, pSummary->totalBlocks, pSummary->loadBlockStatis,
|
||||
pSummary->loadBlocks, pSummary->totalRows, pSummary->totalCheckedRows);
|
||||
|
||||
qDebug("QInfo:%"PRIu64" :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb, hashTable:%.2f Kb", pQInfo->qId, pSummary->winInfoSize/1024.0,
|
||||
qDebug("QInfo:0x%"PRIx64" :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb, hashTable:%.2f Kb", pQInfo->qId, pSummary->winInfoSize/1024.0,
|
||||
pSummary->numOfTimeWindows, pSummary->tableInfoSize/1024.0, pSummary->hashSize/1024.0);
|
||||
}
|
||||
|
||||
|
@ -3804,7 +3807,7 @@ void queryCostStatis(SQInfo *pQInfo) {
|
|||
//
|
||||
// int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock);
|
||||
//
|
||||
// qDebug("QInfo:%"PRIu64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, GET_QID(pRuntimeEnv),
|
||||
// qDebug("QInfo:0x%"PRIx64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, GET_QID(pRuntimeEnv),
|
||||
// pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes, pQuery->current->lastKey);
|
||||
//}
|
||||
|
||||
|
@ -3834,7 +3837,7 @@ void queryCostStatis(SQInfo *pQInfo) {
|
|||
// pTableQueryInfo->lastKey = (QUERY_IS_ASC_QUERY(pQuery)) ? blockInfo.window.ekey : blockInfo.window.skey;
|
||||
// pTableQueryInfo->lastKey += step;
|
||||
//
|
||||
// qDebug("QInfo:%"PRIu64" skip rows:%d, offset:%" PRId64, GET_QID(pRuntimeEnv), blockInfo.rows,
|
||||
// qDebug("QInfo:0x%"PRIx64" skip rows:%d, offset:%" PRId64, GET_QID(pRuntimeEnv), blockInfo.rows,
|
||||
// pQuery->limit.offset);
|
||||
// } else { // find the appropriated start position in current block
|
||||
// updateOffsetVal(pRuntimeEnv, &blockInfo);
|
||||
|
@ -3882,7 +3885,7 @@ void queryCostStatis(SQInfo *pQInfo) {
|
|||
// int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock);
|
||||
// pRuntimeEnv->resultRowInfo.curIndex = index; // restore the window index
|
||||
//
|
||||
// qDebug("QInfo:%"PRIu64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%" PRId64,
|
||||
// qDebug("QInfo:0x%"PRIx64" check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%" PRId64,
|
||||
// GET_QID(pRuntimeEnv), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes,
|
||||
// pQuery->current->lastKey);
|
||||
//
|
||||
|
@ -4313,7 +4316,7 @@ static SSDataBlock* doTableScan(void* param) {
|
|||
pResultRowInfo->prevSKey = pResultRowInfo->pResult[0]->win.skey;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" start to repeat scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
|
||||
qDebug("QInfo:0x%"PRIx64" start to repeat scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
|
||||
GET_QID(pRuntimeEnv), cond.twindow.skey, cond.twindow.ekey);
|
||||
}
|
||||
|
||||
|
@ -4323,7 +4326,7 @@ static SSDataBlock* doTableScan(void* param) {
|
|||
STsdbQueryCond cond = createTsdbQueryCond(pQuery, &pQuery->window);
|
||||
tsdbResetQueryHandle(pTableScanInfo->pQueryHandle, &cond);
|
||||
|
||||
qDebug("QInfo:%"PRIu64" start to reverse scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
|
||||
qDebug("QInfo:0x%"PRIx64" start to reverse scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
|
||||
GET_QID(pRuntimeEnv), cond.twindow.skey, cond.twindow.ekey);
|
||||
|
||||
pRuntimeEnv->scanFlag = REVERSE_SCAN;
|
||||
|
@ -5582,14 +5585,14 @@ static SSDataBlock* doTagScan(void* param) {
|
|||
count += 1;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" create (tableId, tag) info completed, rows:%d", GET_QID(pRuntimeEnv), count);
|
||||
qDebug("QInfo:0x%"PRIx64" create (tableId, tag) info completed, rows:%d", GET_QID(pRuntimeEnv), count);
|
||||
} else if (functionId == TSDB_FUNC_COUNT) {// handle the "count(tbname)" query
|
||||
SColumnInfoData* pColInfo = taosArrayGet(pRes->pDataBlock, 0);
|
||||
*(int64_t*)pColInfo->pData = pInfo->totalTables;
|
||||
count = 1;
|
||||
|
||||
pOperator->status = OP_EXEC_DONE;
|
||||
qDebug("QInfo:%"PRIu64" create count(tbname) query, res:%d rows:1", GET_QID(pRuntimeEnv), count);
|
||||
qDebug("QInfo:0x%"PRIx64" create count(tbname) query, res:%d rows:1", GET_QID(pRuntimeEnv), count);
|
||||
} else { // return only the tags|table name etc.
|
||||
SExprInfo* pExprInfo = pOperator->pExpr; // todo use the column list instead of exprinfo
|
||||
|
||||
|
@ -5628,7 +5631,7 @@ static SSDataBlock* doTagScan(void* param) {
|
|||
pOperator->status = OP_EXEC_DONE;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" create tag values results completed, rows:%d", GET_QID(pRuntimeEnv), count);
|
||||
qDebug("QInfo:0x%"PRIx64" create tag values results completed, rows:%d", GET_QID(pRuntimeEnv), count);
|
||||
}
|
||||
|
||||
pRes->info.rows = count;
|
||||
|
@ -6420,13 +6423,13 @@ static int32_t createFilterInfo(SQuery *pQuery, uint64_t qId) {
|
|||
int32_t lower = pSingleColFilter->filterInfo.lowerRelOptr;
|
||||
int32_t upper = pSingleColFilter->filterInfo.upperRelOptr;
|
||||
if (lower == TSDB_RELATION_INVALID && upper == TSDB_RELATION_INVALID) {
|
||||
qError("QInfo:%"PRIu64" invalid filter info", qId);
|
||||
qError("QInfo:0x%"PRIx64" invalid filter info", qId);
|
||||
return TSDB_CODE_QRY_INVALID_MSG;
|
||||
}
|
||||
|
||||
pSingleColFilter->fp = getFilterOperator(lower, upper);
|
||||
if (pSingleColFilter->fp == NULL) {
|
||||
qError("QInfo:%"PRIu64" invalid filter info", qId);
|
||||
qError("QInfo:0x%"PRIx64" invalid filter info", qId);
|
||||
return TSDB_CODE_QRY_INVALID_MSG;
|
||||
}
|
||||
|
||||
|
@ -6657,7 +6660,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
|
|||
// todo refactor
|
||||
pQInfo->query.queryBlockDist = (numOfOutput == 1 && pExprs[0].base.colInfo.colId == TSDB_BLOCK_DIST_COLUMN_INDEX);
|
||||
|
||||
qDebug("qmsg:%p QInfo:%" PRIu64 "-%p created", pQueryMsg, pQInfo->qId, pQInfo);
|
||||
qDebug("qmsg:%p QInfo:0x%" PRIx64 "-%p created", pQueryMsg, pQInfo->qId, pQInfo);
|
||||
return pQInfo;
|
||||
|
||||
_cleanup_qinfo:
|
||||
|
@ -6732,7 +6735,7 @@ int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQInfo *p
|
|||
|
||||
if ((QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.skey > pQuery->window.ekey)) ||
|
||||
(!QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.ekey > pQuery->window.skey))) {
|
||||
qDebug("QInfo:%"PRIu64" no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo->qId, pQuery->window.skey,
|
||||
qDebug("QInfo:0x%"PRIx64" no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo->qId, pQuery->window.skey,
|
||||
pQuery->window.ekey, pQuery->order.order);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
|
||||
pRuntimeEnv->tableqinfoGroupInfo.numOfTables = 0;
|
||||
|
@ -6741,7 +6744,7 @@ int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQInfo *p
|
|||
}
|
||||
|
||||
if (pRuntimeEnv->tableqinfoGroupInfo.numOfTables == 0) {
|
||||
qDebug("QInfo:%"PRIu64" no table qualified for tag filter, abort query", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" no table qualified for tag filter, abort query", pQInfo->qId);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -6822,7 +6825,7 @@ void freeQInfo(SQInfo *pQInfo) {
|
|||
return;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" start to free QInfo", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" start to free QInfo", pQInfo->qId);
|
||||
|
||||
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
|
||||
releaseQueryBuf(pRuntimeEnv->tableqinfoGroupInfo.numOfTables);
|
||||
|
@ -6873,7 +6876,7 @@ void freeQInfo(SQInfo *pQInfo) {
|
|||
taosArrayDestroy(pRuntimeEnv->groupResInfo.pRows);
|
||||
pQInfo->signature = 0;
|
||||
|
||||
qDebug("QInfo:%"PRIu64" QInfo is freed", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" QInfo is freed", pQInfo->qId);
|
||||
|
||||
tfree(pQInfo);
|
||||
}
|
||||
|
@ -6893,7 +6896,7 @@ int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) {
|
|||
off_t s = lseek(fileno(f), 0, SEEK_END);
|
||||
assert(s == pRuntimeEnv->outputBuf->info.rows);
|
||||
|
||||
qDebug("QInfo:%"PRIu64" ts comp data return, file:%p, size:%"PRId64, pQInfo->qId, f, (uint64_t)s);
|
||||
qDebug("QInfo:0x%"PRIx64" ts comp data return, file:%p, size:%"PRId64, pQInfo->qId, f, (uint64_t)s);
|
||||
if (fseek(f, 0, SEEK_SET) >= 0) {
|
||||
size_t sz = fread(data, 1, s, f);
|
||||
if(sz < s) { // todo handle error
|
||||
|
@ -6925,11 +6928,11 @@ int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) {
|
|||
}
|
||||
|
||||
pRuntimeEnv->resultInfo.total += pRuntimeEnv->outputBuf->info.rows;
|
||||
qDebug("QInfo:%"PRIu64" current numOfRes rows:%d, total:%" PRId64, pQInfo->qId,
|
||||
qDebug("QInfo:0x%"PRIx64" current numOfRes rows:%d, total:%" PRId64, pQInfo->qId,
|
||||
pRuntimeEnv->outputBuf->info.rows, pRuntimeEnv->resultInfo.total);
|
||||
|
||||
if (pQuery->limit.limit > 0 && pQuery->limit.limit == pRuntimeEnv->resultInfo.total) {
|
||||
qDebug("QInfo:%"PRIu64" results limitation reached, limitation:%"PRId64, pQInfo->qId, pQuery->limit.limit);
|
||||
qDebug("QInfo:0x%"PRIx64" results limitation reached, limitation:%"PRId64, pQInfo->qId, pQuery->limit.limit);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_OVER);
|
||||
}
|
||||
|
||||
|
|
|
@ -354,45 +354,14 @@ static FORCE_INLINE int32_t primaryKeyComparator(int64_t f1, int64_t f2, int32_t
|
|||
|
||||
static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, int32_t type, int32_t bytes) {
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t first = *(int32_t *) f1;
|
||||
int32_t second = *(int32_t *) f2;
|
||||
if (first == second) {
|
||||
return 0;
|
||||
}
|
||||
return (first < second) ? -1 : 1;
|
||||
};
|
||||
case TSDB_DATA_TYPE_DOUBLE: {
|
||||
DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2));
|
||||
};
|
||||
case TSDB_DATA_TYPE_FLOAT: {
|
||||
DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2));
|
||||
};
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
int64_t first = *(int64_t *)f1;
|
||||
int64_t second = *(int64_t *)f2;
|
||||
if (first == second) {
|
||||
return 0;
|
||||
}
|
||||
return (first < second) ? -1 : 1;
|
||||
};
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t first = *(int16_t *)f1;
|
||||
int16_t second = *(int16_t *)f2;
|
||||
if (first == second) {
|
||||
return 0;
|
||||
}
|
||||
return (first < second) ? -1 : 1;
|
||||
};
|
||||
case TSDB_DATA_TYPE_INT: DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2));
|
||||
case TSDB_DATA_TYPE_DOUBLE: DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2));
|
||||
case TSDB_DATA_TYPE_FLOAT: DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2));
|
||||
case TSDB_DATA_TYPE_BIGINT: DEFAULT_COMP(GET_INT64_VAL(f1), GET_INT64_VAL(f2));
|
||||
case TSDB_DATA_TYPE_SMALLINT:DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2));
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t first = *(int8_t *)f1;
|
||||
int8_t second = *(int8_t *)f2;
|
||||
if (first == second) {
|
||||
return 0;
|
||||
}
|
||||
return (first < second) ? -1 : 1;
|
||||
};
|
||||
case TSDB_DATA_TYPE_TINYINT: DEFAULT_COMP(GET_INT8_VAL(f1), GET_INT8_VAL(f2));
|
||||
|
||||
case TSDB_DATA_TYPE_BINARY: {
|
||||
int32_t len1 = varDataLen(f1);
|
||||
int32_t len2 = varDataLen(f2);
|
||||
|
@ -415,6 +384,10 @@ static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, i
|
|||
}
|
||||
return (ret < 0) ? -1 : 1;
|
||||
};
|
||||
case TSDB_DATA_TYPE_UTINYINT: DEFAULT_COMP(GET_UINT8_VAL(f1), GET_UINT8_VAL(f2));
|
||||
case TSDB_DATA_TYPE_USMALLINT: DEFAULT_COMP(GET_UINT16_VAL(f1), GET_UINT16_VAL(f2));
|
||||
case TSDB_DATA_TYPE_UINT: DEFAULT_COMP(GET_UINT32_VAL(f1), GET_UINT32_VAL(f2));
|
||||
case TSDB_DATA_TYPE_UBIGINT: DEFAULT_COMP(GET_UINT64_VAL(f1), GET_UINT64_VAL(f2));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pa
|
|||
|
||||
pResBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t));
|
||||
|
||||
qDebug("QInfo:%"PRIu64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, pResBuf->pageSize,
|
||||
qDebug("QInfo:0x%"PRIx64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId, pResBuf->pageSize,
|
||||
pResBuf->inMemPages, pResBuf->path);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -410,13 +410,13 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
|
|||
}
|
||||
|
||||
if (pResultBuf->file != NULL) {
|
||||
qDebug("QInfo:%"PRIu64" res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb",
|
||||
qDebug("QInfo:0x%"PRIx64" res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb",
|
||||
pResultBuf->qId, pResultBuf->totalBufSize/1024.0, listNEles(pResultBuf->lruList) * pResultBuf->pageSize / 1024.0,
|
||||
pResultBuf->fileSize/1024.0);
|
||||
|
||||
fclose(pResultBuf->file);
|
||||
} else {
|
||||
qDebug("QInfo:%"PRIu64" res output buffer closed, total:%.2f Kb, no file created", pResultBuf->qId,
|
||||
qDebug("QInfo:0x%"PRIx64" res output buffer closed, total:%.2f Kb, no file created", pResultBuf->qId,
|
||||
pResultBuf->totalBufSize/1024.0);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,12 +144,15 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
|
|||
pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT;
|
||||
pSqlExpr->tokenId = TK_TIMESTAMP; // TK_TIMESTAMP used to denote the time value is in microsecond
|
||||
pSqlExpr->type = SQL_NODE_VALUE;
|
||||
pSqlExpr->flags |= 1 << EXPR_FLAG_US_TIMESTAMP;
|
||||
} else if (optrType == TK_VARIABLE) {
|
||||
int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->value.i64);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
pSqlExpr->flags |= 1 << EXPR_FLAG_US_TIMESTAMP;
|
||||
pSqlExpr->flags |= 1 << EXPR_FLAG_TIMESTAMP_VAR;
|
||||
pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT;
|
||||
pSqlExpr->tokenId = TK_TIMESTAMP;
|
||||
pSqlExpr->type = SQL_NODE_VALUE;
|
||||
|
@ -217,6 +220,15 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
|
|||
pExpr->value.nType = TSDB_DATA_TYPE_BIGINT;
|
||||
pExpr->tokenId = pLeft->tokenId;
|
||||
pExpr->type = SQL_NODE_VALUE;
|
||||
pExpr->flags = pLeft->flags | pRight->flags;
|
||||
|
||||
if ((pLeft->flags & (1 << EXPR_FLAG_TIMESTAMP_VAR)) && (pRight->flags & (1 << EXPR_FLAG_TIMESTAMP_VAR))) {
|
||||
pExpr->flags |= 1 << EXPR_FLAG_TS_ERROR;
|
||||
} else {
|
||||
pExpr->flags &= ~(1 << EXPR_FLAG_TIMESTAMP_VAR);
|
||||
pExpr->flags &= ~(1 << EXPR_FLAG_TS_ERROR);
|
||||
}
|
||||
|
||||
|
||||
switch (optrType) {
|
||||
case TK_PLUS: {
|
||||
|
@ -245,7 +257,6 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
|
|||
|
||||
tSqlExprDestroy(pLeft);
|
||||
tSqlExprDestroy(pRight);
|
||||
|
||||
} else if ((pLeft->tokenId == TK_FLOAT && pRight->tokenId == TK_INTEGER) ||
|
||||
(pLeft->tokenId == TK_INTEGER && pRight->tokenId == TK_FLOAT) ||
|
||||
(pLeft->tokenId == TK_FLOAT && pRight->tokenId == TK_FLOAT)) {
|
||||
|
|
|
@ -205,7 +205,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
|
|||
|
||||
int64_t curOwner = 0;
|
||||
if ((curOwner = atomic_val_compare_exchange_64(&pQInfo->owner, 0, threadId)) != 0) {
|
||||
qError("QInfo:%"PRIu64"-%p qhandle is now executed by thread:%p", pQInfo->qId, pQInfo, (void*) curOwner);
|
||||
qError("QInfo:0x%"PRIx64"-%p qhandle is now executed by thread:%p", pQInfo->qId, pQInfo, (void*) curOwner);
|
||||
pQInfo->code = TSDB_CODE_QRY_IN_EXEC;
|
||||
return false;
|
||||
}
|
||||
|
@ -215,13 +215,13 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
|
|||
pQInfo->startExecTs = taosGetTimestampSec();
|
||||
|
||||
if (isQueryKilled(pQInfo)) {
|
||||
qDebug("QInfo:%"PRIu64" it is already killed, abort", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId);
|
||||
return doBuildResCheck(pQInfo);
|
||||
}
|
||||
|
||||
SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv;
|
||||
if (pRuntimeEnv->tableqinfoGroupInfo.numOfTables == 0) {
|
||||
qDebug("QInfo:%"PRIu64" no table exists for query, abort", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" no table exists for query, abort", pQInfo->qId);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
|
||||
return doBuildResCheck(pQInfo);
|
||||
}
|
||||
|
@ -230,21 +230,21 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
|
|||
int32_t ret = setjmp(pQInfo->runtimeEnv.env);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
pQInfo->code = ret;
|
||||
qDebug("QInfo:%"PRIu64" query abort due to error/cancel occurs, code:%s", pQInfo->qId, tstrerror(pQInfo->code));
|
||||
qDebug("QInfo:0x%"PRIx64" query abort due to error/cancel occurs, code:%s", pQInfo->qId, tstrerror(pQInfo->code));
|
||||
return doBuildResCheck(pQInfo);
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" query task is launched", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" query task is launched", pQInfo->qId);
|
||||
|
||||
pRuntimeEnv->outputBuf = pRuntimeEnv->proot->exec(pRuntimeEnv->proot);
|
||||
|
||||
if (isQueryKilled(pQInfo)) {
|
||||
qDebug("QInfo:%"PRIu64" query is killed", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" query is killed", pQInfo->qId);
|
||||
} else if (GET_NUM_OF_RESULTS(pRuntimeEnv) == 0) {
|
||||
qDebug("QInfo:%"PRIu64" over, %u tables queried, %"PRId64" rows are returned", pQInfo->qId, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
|
||||
qDebug("QInfo:0x%"PRIx64" over, %u tables queried, %"PRId64" rows are returned", pQInfo->qId, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
|
||||
pRuntimeEnv->resultInfo.total);
|
||||
} else {
|
||||
qDebug("QInfo:%"PRIu64" query paused, %d rows returned, numOfTotal:%" PRId64 " rows",
|
||||
qDebug("QInfo:0x%"PRIx64" query paused, %d rows returned, numOfTotal:%" PRId64 " rows",
|
||||
pQInfo->qId, GET_NUM_OF_RESULTS(pRuntimeEnv), pRuntimeEnv->resultInfo.total + GET_NUM_OF_RESULTS(pRuntimeEnv));
|
||||
}
|
||||
|
||||
|
@ -255,13 +255,13 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
|
|||
SQInfo *pQInfo = (SQInfo *)qinfo;
|
||||
|
||||
if (pQInfo == NULL || !isValidQInfo(pQInfo)) {
|
||||
qError("QInfo:%"PRIu64" invalid qhandle", pQInfo->qId);
|
||||
qError("QInfo:0x%"PRIx64" invalid qhandle", pQInfo->qId);
|
||||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
*buildRes = false;
|
||||
if (IS_QUERY_KILLED(pQInfo)) {
|
||||
qDebug("QInfo:%"PRIu64" query is killed, code:0x%08x", pQInfo->qId, pQInfo->code);
|
||||
qDebug("QInfo:0x%"PRIx64" query is killed, code:0x%08x", pQInfo->qId, pQInfo->code);
|
||||
return pQInfo->code;
|
||||
}
|
||||
|
||||
|
@ -281,11 +281,11 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
|
|||
assert(pQInfo->rspContext == NULL);
|
||||
if (pQInfo->dataReady == QUERY_RESULT_READY) {
|
||||
*buildRes = true;
|
||||
qDebug("QInfo:%"PRIu64" retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo->qId, pQuery->resultRowSize,
|
||||
qDebug("QInfo:0x%"PRIx64" retrieve result info, rowsize:%d, rows:%d, code:%s", pQInfo->qId, pQuery->resultRowSize,
|
||||
GET_NUM_OF_RESULTS(pRuntimeEnv), tstrerror(pQInfo->code));
|
||||
} else {
|
||||
*buildRes = false;
|
||||
qDebug("QInfo:%"PRIu64" retrieve req set query return result after paused", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" retrieve req set query return result after paused", pQInfo->qId);
|
||||
pQInfo->rspContext = pRspContext;
|
||||
assert(pQInfo->rspContext != NULL);
|
||||
}
|
||||
|
@ -344,10 +344,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
|
|||
// here current thread hold the refcount, so it is safe to free tsdbQueryHandle.
|
||||
*continueExec = false;
|
||||
(*pRsp)->completed = 1; // notify no more result to client
|
||||
qDebug("QInfo:%"PRIu64" no more results to retrieve", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" no more results to retrieve", pQInfo->qId);
|
||||
} else {
|
||||
*continueExec = true;
|
||||
qDebug("QInfo:%"PRIu64" has more results to retrieve", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" has more results to retrieve", pQInfo->qId);
|
||||
}
|
||||
|
||||
// the memory should be freed if the code of pQInfo is not TSDB_CODE_SUCCESS
|
||||
|
@ -373,7 +373,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
|
|||
return TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" query killed", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" query killed", pQInfo->qId);
|
||||
setQueryKilled(pQInfo);
|
||||
|
||||
// Wait for the query executing thread being stopped/
|
||||
|
@ -401,7 +401,7 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
|
|||
return;
|
||||
}
|
||||
|
||||
qDebug("QInfo:%"PRIu64" query completed", pQInfo->qId);
|
||||
qDebug("QInfo:0x%"PRIx64" query completed", pQInfo->qId);
|
||||
queryCostStatis(pQInfo); // print the query cost summary
|
||||
freeQInfo(pQInfo);
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
|
|||
|
||||
SQueryMgmt *pQueryMgmt = pMgmt;
|
||||
if (pQueryMgmt->qinfoPool == NULL) {
|
||||
qError("QInfo:%"PRIu64"-%p failed to add qhandle into qMgmt, since qMgmt is closed", qId, (void*)qInfo);
|
||||
qError("QInfo:0x%"PRIx64"-%p failed to add qhandle into qMgmt, since qMgmt is closed", qId, (void*)qInfo);
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
|
|||
pthread_mutex_lock(&pQueryMgmt->lock);
|
||||
if (pQueryMgmt->closed) {
|
||||
pthread_mutex_unlock(&pQueryMgmt->lock);
|
||||
qError("QInfo:%"PRIu64"-%p failed to add qhandle into cache, since qMgmt is colsing", qId, (void*)qInfo);
|
||||
qError("QInfo:0x%"PRIx64"-%p failed to add qhandle into cache, since qMgmt is colsing", qId, (void*)qInfo);
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
|
@ -138,17 +138,17 @@ typedef union {
|
|||
#define ParseCTX_STORE
|
||||
#define YYFALLBACK 1
|
||||
#define YYNSTATE 315
|
||||
#define YYNRULE 267
|
||||
#define YYNRULE_WITH_ACTION 267
|
||||
#define YYNRULE 269
|
||||
#define YYNRULE_WITH_ACTION 269
|
||||
#define YYNTOKEN 187
|
||||
#define YY_MAX_SHIFT 314
|
||||
#define YY_MIN_SHIFTREDUCE 506
|
||||
#define YY_MAX_SHIFTREDUCE 772
|
||||
#define YY_ERROR_ACTION 773
|
||||
#define YY_ACCEPT_ACTION 774
|
||||
#define YY_NO_ACTION 775
|
||||
#define YY_MIN_REDUCE 776
|
||||
#define YY_MAX_REDUCE 1042
|
||||
#define YY_MIN_SHIFTREDUCE 508
|
||||
#define YY_MAX_SHIFTREDUCE 776
|
||||
#define YY_ERROR_ACTION 777
|
||||
#define YY_ACCEPT_ACTION 778
|
||||
#define YY_NO_ACTION 779
|
||||
#define YY_MIN_REDUCE 780
|
||||
#define YY_MAX_REDUCE 1048
|
||||
/************* End control #defines *******************************************/
|
||||
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
|
||||
|
||||
|
@ -215,77 +215,76 @@ typedef union {
|
|||
** yy_default[] Default action for each state.
|
||||
**
|
||||
*********** Begin parsing tables **********************************************/
|
||||
#define YY_ACTTAB_COUNT (681)
|
||||
#define YY_ACTTAB_COUNT (672)
|
||||
static const YYACTIONTYPE yy_action[] = {
|
||||
/* 0 */ 133, 553, 202, 312, 206, 140, 943, 17, 85, 554,
|
||||
/* 10 */ 774, 314, 179, 47, 48, 140, 51, 52, 30, 181,
|
||||
/* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1023,
|
||||
/* 30 */ 922, 209, 1024, 46, 45, 185, 181, 44, 43, 42,
|
||||
/* 40 */ 47, 48, 910, 51, 52, 208, 1024, 214, 41, 553,
|
||||
/* 50 */ 50, 262, 55, 53, 57, 54, 934, 554, 1020, 203,
|
||||
/* 60 */ 46, 45, 919, 247, 44, 43, 42, 48, 940, 51,
|
||||
/* 70 */ 52, 242, 974, 214, 41, 553, 50, 262, 55, 53,
|
||||
/* 80 */ 57, 54, 975, 554, 257, 278, 46, 45, 298, 225,
|
||||
/* 90 */ 44, 43, 42, 507, 508, 509, 510, 511, 512, 513,
|
||||
/* 100 */ 514, 515, 516, 517, 518, 519, 313, 632, 1019, 231,
|
||||
/* 110 */ 70, 553, 30, 47, 48, 1018, 51, 52, 821, 554,
|
||||
/* 0 */ 133, 555, 204, 312, 208, 140, 947, 17, 85, 556,
|
||||
/* 10 */ 778, 314, 179, 47, 48, 140, 51, 52, 30, 181,
|
||||
/* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1029,
|
||||
/* 30 */ 926, 211, 1030, 46, 45, 185, 181, 44, 43, 42,
|
||||
/* 40 */ 47, 48, 914, 51, 52, 210, 1030, 214, 41, 555,
|
||||
/* 50 */ 50, 262, 55, 53, 57, 54, 938, 556, 1026, 205,
|
||||
/* 60 */ 46, 45, 923, 247, 44, 43, 42, 48, 944, 51,
|
||||
/* 70 */ 52, 242, 978, 214, 41, 555, 50, 262, 55, 53,
|
||||
/* 80 */ 57, 54, 979, 556, 257, 278, 46, 45, 298, 225,
|
||||
/* 90 */ 44, 43, 42, 509, 510, 511, 512, 513, 514, 515,
|
||||
/* 100 */ 516, 517, 518, 519, 520, 521, 313, 634, 1025, 231,
|
||||
/* 110 */ 70, 555, 30, 47, 48, 1024, 51, 52, 825, 556,
|
||||
/* 120 */ 214, 41, 166, 50, 262, 55, 53, 57, 54, 44,
|
||||
/* 130 */ 43, 42, 718, 46, 45, 288, 287, 44, 43, 42,
|
||||
/* 140 */ 47, 49, 830, 51, 52, 198, 166, 214, 41, 234,
|
||||
/* 150 */ 50, 262, 55, 53, 57, 54, 918, 238, 237, 227,
|
||||
/* 130 */ 43, 42, 720, 46, 45, 288, 287, 44, 43, 42,
|
||||
/* 140 */ 47, 49, 834, 51, 52, 198, 166, 214, 41, 234,
|
||||
/* 150 */ 50, 262, 55, 53, 57, 54, 922, 238, 237, 227,
|
||||
/* 160 */ 46, 45, 285, 284, 44, 43, 42, 23, 276, 307,
|
||||
/* 170 */ 306, 275, 274, 273, 305, 272, 304, 303, 302, 271,
|
||||
/* 180 */ 301, 300, 882, 140, 870, 871, 872, 873, 874, 875,
|
||||
/* 190 */ 876, 877, 878, 879, 880, 881, 883, 884, 51, 52,
|
||||
/* 200 */ 822, 219, 214, 41, 166, 50, 262, 55, 53, 57,
|
||||
/* 210 */ 54, 223, 18, 82, 25, 46, 45, 199, 226, 44,
|
||||
/* 220 */ 43, 42, 213, 731, 934, 221, 722, 922, 725, 190,
|
||||
/* 230 */ 728, 183, 213, 731, 140, 191, 722, 908, 725, 204,
|
||||
/* 240 */ 728, 118, 117, 189, 905, 906, 29, 909, 259, 74,
|
||||
/* 250 */ 78, 922, 30, 920, 210, 211, 308, 36, 261, 69,
|
||||
/* 260 */ 23, 916, 307, 306, 210, 211, 61, 305, 30, 304,
|
||||
/* 270 */ 303, 302, 74, 301, 300, 890, 3, 167, 888, 889,
|
||||
/* 280 */ 36, 224, 922, 891, 280, 893, 894, 892, 62, 895,
|
||||
/* 290 */ 896, 907, 656, 217, 12, 653, 919, 654, 84, 655,
|
||||
/* 300 */ 81, 79, 241, 220, 68, 55, 53, 57, 54, 218,
|
||||
/* 310 */ 197, 184, 919, 46, 45, 30, 278, 44, 43, 42,
|
||||
/* 320 */ 80, 103, 108, 228, 229, 56, 263, 97, 107, 113,
|
||||
/* 330 */ 116, 106, 732, 71, 671, 56, 186, 110, 730, 30,
|
||||
/* 340 */ 180, 30, 732, 5, 156, 30, 699, 700, 730, 33,
|
||||
/* 350 */ 155, 92, 87, 91, 729, 668, 281, 678, 105, 919,
|
||||
/* 360 */ 174, 170, 24, 298, 729, 245, 172, 169, 121, 120,
|
||||
/* 370 */ 119, 46, 45, 1, 154, 44, 43, 42, 720, 724,
|
||||
/* 380 */ 282, 727, 286, 919, 243, 919, 290, 187, 31, 919,
|
||||
/* 390 */ 311, 310, 126, 684, 212, 64, 690, 135, 691, 752,
|
||||
/* 400 */ 60, 657, 20, 19, 733, 723, 642, 726, 19, 265,
|
||||
/* 410 */ 31, 188, 675, 31, 721, 65, 96, 95, 194, 644,
|
||||
/* 420 */ 267, 643, 735, 60, 83, 60, 28, 14, 13, 268,
|
||||
/* 430 */ 102, 101, 67, 660, 631, 661, 195, 658, 6, 659,
|
||||
/* 440 */ 16, 15, 115, 114, 131, 129, 193, 178, 192, 182,
|
||||
/* 450 */ 1034, 921, 985, 984, 215, 981, 980, 239, 216, 289,
|
||||
/* 460 */ 132, 942, 39, 950, 952, 134, 138, 935, 246, 967,
|
||||
/* 470 */ 130, 966, 917, 150, 151, 915, 299, 152, 683, 248,
|
||||
/* 480 */ 886, 104, 291, 149, 147, 153, 833, 142, 932, 141,
|
||||
/* 490 */ 270, 66, 205, 37, 250, 176, 34, 279, 829, 1039,
|
||||
/* 500 */ 93, 255, 1038, 1036, 143, 63, 58, 157, 283, 1033,
|
||||
/* 510 */ 99, 1032, 260, 1030, 158, 851, 256, 35, 258, 32,
|
||||
/* 520 */ 38, 177, 818, 109, 254, 816, 111, 112, 252, 814,
|
||||
/* 530 */ 813, 230, 168, 811, 810, 809, 808, 807, 806, 171,
|
||||
/* 540 */ 173, 803, 801, 799, 797, 795, 175, 249, 244, 72,
|
||||
/* 550 */ 75, 251, 40, 968, 292, 293, 294, 295, 296, 200,
|
||||
/* 560 */ 297, 222, 269, 309, 772, 233, 232, 771, 88, 201,
|
||||
/* 570 */ 235, 196, 89, 236, 770, 758, 757, 240, 245, 8,
|
||||
/* 580 */ 264, 73, 663, 136, 812, 161, 165, 685, 852, 159,
|
||||
/* 590 */ 160, 162, 164, 163, 122, 123, 805, 76, 124, 804,
|
||||
/* 600 */ 4, 688, 137, 125, 796, 77, 146, 144, 148, 145,
|
||||
/* 610 */ 207, 2, 898, 253, 26, 692, 139, 9, 10, 734,
|
||||
/* 620 */ 27, 7, 11, 21, 736, 22, 86, 266, 595, 591,
|
||||
/* 630 */ 84, 589, 588, 587, 584, 557, 277, 90, 94, 31,
|
||||
/* 640 */ 634, 59, 633, 630, 579, 98, 100, 577, 569, 575,
|
||||
/* 650 */ 571, 573, 567, 565, 598, 597, 596, 594, 593, 592,
|
||||
/* 660 */ 590, 586, 585, 60, 555, 523, 521, 776, 775, 775,
|
||||
/* 670 */ 775, 775, 775, 775, 775, 775, 775, 775, 775, 127,
|
||||
/* 680 */ 128,
|
||||
/* 180 */ 301, 300, 886, 140, 874, 875, 876, 877, 878, 879,
|
||||
/* 190 */ 880, 881, 882, 883, 884, 885, 887, 888, 51, 52,
|
||||
/* 200 */ 826, 219, 214, 41, 166, 50, 262, 55, 53, 57,
|
||||
/* 210 */ 54, 223, 18, 82, 25, 46, 45, 1, 154, 44,
|
||||
/* 220 */ 43, 42, 213, 735, 938, 722, 724, 926, 727, 190,
|
||||
/* 230 */ 730, 226, 213, 735, 140, 191, 724, 912, 727, 206,
|
||||
/* 240 */ 730, 118, 117, 189, 909, 910, 29, 913, 259, 74,
|
||||
/* 250 */ 78, 726, 30, 729, 200, 201, 221, 36, 261, 199,
|
||||
/* 260 */ 23, 723, 307, 306, 200, 201, 924, 305, 30, 304,
|
||||
/* 270 */ 303, 302, 74, 301, 300, 894, 183, 308, 892, 893,
|
||||
/* 280 */ 36, 224, 926, 895, 280, 897, 898, 896, 184, 899,
|
||||
/* 290 */ 900, 920, 658, 217, 69, 655, 923, 656, 725, 657,
|
||||
/* 300 */ 728, 79, 241, 926, 68, 55, 53, 57, 54, 218,
|
||||
/* 310 */ 197, 212, 923, 46, 45, 30, 278, 44, 43, 42,
|
||||
/* 320 */ 673, 103, 108, 228, 229, 56, 911, 97, 107, 113,
|
||||
/* 330 */ 116, 106, 736, 220, 263, 56, 186, 110, 732, 30,
|
||||
/* 340 */ 180, 30, 736, 5, 156, 30, 3, 167, 732, 33,
|
||||
/* 350 */ 155, 92, 87, 91, 731, 6, 281, 701, 702, 923,
|
||||
/* 360 */ 174, 170, 28, 733, 731, 268, 172, 169, 121, 120,
|
||||
/* 370 */ 119, 46, 45, 105, 80, 44, 43, 42, 298, 662,
|
||||
/* 380 */ 282, 663, 286, 923, 670, 923, 290, 71, 12, 923,
|
||||
/* 390 */ 187, 24, 84, 188, 81, 311, 310, 126, 677, 243,
|
||||
/* 400 */ 680, 659, 660, 31, 661, 686, 1040, 692, 245, 135,
|
||||
/* 410 */ 734, 60, 693, 756, 737, 61, 20, 19, 19, 64,
|
||||
/* 420 */ 644, 265, 646, 267, 31, 31, 60, 83, 645, 67,
|
||||
/* 430 */ 739, 633, 60, 925, 96, 95, 194, 62, 195, 65,
|
||||
/* 440 */ 193, 14, 13, 102, 101, 115, 114, 131, 129, 16,
|
||||
/* 450 */ 15, 178, 192, 182, 989, 988, 215, 239, 985, 132,
|
||||
/* 460 */ 984, 216, 289, 946, 39, 971, 954, 956, 134, 138,
|
||||
/* 470 */ 970, 939, 246, 130, 921, 151, 919, 150, 152, 153,
|
||||
/* 480 */ 248, 837, 270, 685, 890, 299, 104, 291, 148, 37,
|
||||
/* 490 */ 145, 176, 936, 141, 34, 58, 207, 250, 255, 66,
|
||||
/* 500 */ 63, 142, 279, 833, 1045, 260, 143, 258, 144, 256,
|
||||
/* 510 */ 93, 1044, 1042, 254, 157, 146, 283, 1039, 99, 1038,
|
||||
/* 520 */ 1036, 252, 158, 855, 35, 32, 38, 177, 249, 822,
|
||||
/* 530 */ 109, 820, 111, 112, 818, 817, 230, 168, 815, 814,
|
||||
/* 540 */ 813, 812, 811, 810, 171, 173, 807, 805, 803, 801,
|
||||
/* 550 */ 799, 175, 40, 244, 72, 75, 251, 292, 972, 293,
|
||||
/* 560 */ 294, 296, 295, 297, 309, 776, 202, 222, 269, 232,
|
||||
/* 570 */ 233, 203, 775, 235, 88, 89, 236, 196, 774, 762,
|
||||
/* 580 */ 761, 240, 245, 8, 73, 264, 209, 665, 687, 816,
|
||||
/* 590 */ 165, 856, 161, 159, 160, 122, 162, 163, 123, 164,
|
||||
/* 600 */ 809, 2, 76, 124, 125, 808, 800, 136, 137, 4,
|
||||
/* 610 */ 690, 149, 147, 77, 253, 26, 694, 139, 902, 9,
|
||||
/* 620 */ 10, 27, 738, 7, 11, 740, 21, 22, 266, 86,
|
||||
/* 630 */ 597, 593, 84, 591, 590, 589, 586, 559, 277, 90,
|
||||
/* 640 */ 94, 31, 636, 59, 635, 632, 581, 579, 571, 577,
|
||||
/* 650 */ 573, 575, 569, 567, 98, 100, 600, 599, 598, 596,
|
||||
/* 660 */ 595, 594, 592, 588, 587, 60, 557, 525, 523, 780,
|
||||
/* 670 */ 127, 128,
|
||||
};
|
||||
static const YYCODETYPE yy_lookahead[] = {
|
||||
/* 0 */ 190, 1, 189, 190, 209, 190, 190, 251, 196, 9,
|
||||
|
@ -309,54 +308,54 @@ static const YYCODETYPE yy_lookahead[] = {
|
|||
/* 180 */ 101, 102, 208, 190, 210, 211, 212, 213, 214, 215,
|
||||
/* 190 */ 216, 217, 218, 219, 220, 221, 222, 223, 16, 17,
|
||||
/* 200 */ 195, 209, 20, 21, 199, 23, 24, 25, 26, 27,
|
||||
/* 210 */ 28, 67, 44, 196, 104, 33, 34, 251, 190, 37,
|
||||
/* 220 */ 38, 39, 1, 2, 233, 209, 5, 235, 7, 61,
|
||||
/* 230 */ 9, 251, 1, 2, 190, 67, 5, 0, 7, 248,
|
||||
/* 210 */ 28, 67, 44, 196, 104, 33, 34, 197, 198, 37,
|
||||
/* 220 */ 38, 39, 1, 2, 233, 1, 5, 235, 7, 61,
|
||||
/* 230 */ 9, 190, 1, 2, 190, 67, 5, 0, 7, 248,
|
||||
/* 240 */ 9, 73, 74, 75, 227, 228, 229, 230, 255, 104,
|
||||
/* 250 */ 257, 235, 190, 225, 33, 34, 209, 112, 37, 196,
|
||||
/* 260 */ 88, 190, 90, 91, 33, 34, 109, 95, 190, 97,
|
||||
/* 270 */ 98, 99, 104, 101, 102, 208, 193, 194, 211, 212,
|
||||
/* 280 */ 112, 137, 235, 216, 140, 218, 219, 220, 131, 222,
|
||||
/* 290 */ 223, 228, 2, 231, 104, 5, 234, 7, 108, 9,
|
||||
/* 300 */ 110, 257, 134, 232, 136, 25, 26, 27, 28, 231,
|
||||
/* 310 */ 142, 251, 234, 33, 34, 190, 79, 37, 38, 39,
|
||||
/* 320 */ 236, 62, 63, 33, 34, 104, 15, 68, 69, 70,
|
||||
/* 330 */ 71, 72, 111, 249, 37, 104, 251, 78, 117, 190,
|
||||
/* 340 */ 251, 190, 111, 62, 63, 190, 124, 125, 117, 68,
|
||||
/* 350 */ 69, 70, 71, 72, 133, 109, 231, 105, 76, 234,
|
||||
/* 360 */ 62, 63, 116, 81, 133, 113, 68, 69, 70, 71,
|
||||
/* 370 */ 72, 33, 34, 197, 198, 37, 38, 39, 1, 5,
|
||||
/* 380 */ 231, 7, 231, 234, 105, 234, 231, 251, 109, 234,
|
||||
/* 390 */ 64, 65, 66, 105, 60, 109, 105, 109, 105, 105,
|
||||
/* 400 */ 109, 111, 109, 109, 105, 5, 105, 7, 109, 105,
|
||||
/* 410 */ 109, 251, 115, 109, 37, 129, 138, 139, 251, 105,
|
||||
/* 420 */ 105, 105, 111, 109, 109, 109, 104, 138, 139, 107,
|
||||
/* 430 */ 138, 139, 104, 5, 106, 7, 251, 5, 104, 7,
|
||||
/* 440 */ 138, 139, 76, 77, 62, 63, 251, 251, 251, 251,
|
||||
/* 450 */ 235, 235, 226, 226, 226, 226, 226, 190, 226, 226,
|
||||
/* 460 */ 190, 190, 250, 190, 190, 190, 190, 233, 233, 258,
|
||||
/* 470 */ 60, 258, 233, 237, 190, 190, 103, 190, 117, 254,
|
||||
/* 480 */ 224, 87, 86, 238, 240, 190, 190, 245, 247, 246,
|
||||
/* 490 */ 190, 128, 254, 190, 254, 190, 190, 190, 190, 190,
|
||||
/* 500 */ 190, 254, 190, 190, 244, 130, 127, 190, 190, 190,
|
||||
/* 510 */ 190, 190, 122, 190, 190, 190, 121, 190, 126, 190,
|
||||
/* 520 */ 190, 190, 190, 190, 120, 190, 190, 190, 119, 190,
|
||||
/* 250 */ 257, 5, 190, 7, 33, 34, 209, 112, 37, 251,
|
||||
/* 260 */ 88, 37, 90, 91, 33, 34, 225, 95, 190, 97,
|
||||
/* 270 */ 98, 99, 104, 101, 102, 208, 251, 209, 211, 212,
|
||||
/* 280 */ 112, 137, 235, 216, 140, 218, 219, 220, 251, 222,
|
||||
/* 290 */ 223, 190, 2, 231, 196, 5, 234, 7, 5, 9,
|
||||
/* 300 */ 7, 257, 134, 235, 136, 25, 26, 27, 28, 231,
|
||||
/* 310 */ 142, 60, 234, 33, 34, 190, 79, 37, 38, 39,
|
||||
/* 320 */ 37, 62, 63, 33, 34, 104, 228, 68, 69, 70,
|
||||
/* 330 */ 71, 72, 111, 232, 15, 104, 251, 78, 117, 190,
|
||||
/* 340 */ 251, 190, 111, 62, 63, 190, 193, 194, 117, 68,
|
||||
/* 350 */ 69, 70, 71, 72, 133, 104, 231, 124, 125, 234,
|
||||
/* 360 */ 62, 63, 104, 117, 133, 107, 68, 69, 70, 71,
|
||||
/* 370 */ 72, 33, 34, 76, 236, 37, 38, 39, 81, 5,
|
||||
/* 380 */ 231, 7, 231, 234, 109, 234, 231, 249, 104, 234,
|
||||
/* 390 */ 251, 116, 108, 251, 110, 64, 65, 66, 115, 105,
|
||||
/* 400 */ 105, 111, 5, 109, 7, 105, 235, 105, 113, 109,
|
||||
/* 410 */ 117, 109, 105, 105, 105, 109, 109, 109, 109, 109,
|
||||
/* 420 */ 105, 105, 105, 105, 109, 109, 109, 109, 105, 104,
|
||||
/* 430 */ 111, 106, 109, 235, 138, 139, 251, 131, 251, 129,
|
||||
/* 440 */ 251, 138, 139, 138, 139, 76, 77, 62, 63, 138,
|
||||
/* 450 */ 139, 251, 251, 251, 226, 226, 226, 190, 226, 190,
|
||||
/* 460 */ 226, 226, 226, 190, 250, 258, 190, 190, 190, 190,
|
||||
/* 470 */ 258, 233, 233, 60, 233, 190, 190, 237, 190, 190,
|
||||
/* 480 */ 254, 190, 190, 117, 224, 103, 87, 86, 239, 190,
|
||||
/* 490 */ 242, 190, 247, 246, 190, 127, 254, 254, 254, 128,
|
||||
/* 500 */ 130, 245, 190, 190, 190, 122, 244, 126, 243, 121,
|
||||
/* 510 */ 190, 190, 190, 120, 190, 241, 190, 190, 190, 190,
|
||||
/* 520 */ 190, 119, 190, 190, 190, 190, 190, 190, 118, 190,
|
||||
/* 530 */ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
/* 540 */ 190, 190, 190, 190, 190, 190, 190, 118, 191, 191,
|
||||
/* 550 */ 191, 191, 132, 191, 50, 83, 85, 54, 84, 191,
|
||||
/* 560 */ 82, 191, 191, 79, 5, 5, 145, 5, 196, 191,
|
||||
/* 570 */ 145, 191, 196, 5, 5, 90, 89, 135, 113, 104,
|
||||
/* 580 */ 107, 114, 105, 104, 191, 201, 200, 105, 207, 206,
|
||||
/* 590 */ 205, 204, 203, 202, 192, 192, 191, 109, 192, 191,
|
||||
/* 600 */ 193, 105, 109, 192, 191, 104, 241, 243, 239, 242,
|
||||
/* 610 */ 1, 197, 224, 104, 109, 105, 104, 123, 123, 105,
|
||||
/* 620 */ 109, 104, 104, 104, 111, 104, 76, 107, 9, 5,
|
||||
/* 630 */ 108, 5, 5, 5, 5, 80, 15, 76, 139, 109,
|
||||
/* 640 */ 5, 16, 5, 105, 5, 139, 139, 5, 5, 5,
|
||||
/* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
/* 660 */ 5, 5, 5, 109, 80, 60, 59, 0, 262, 262,
|
||||
/* 670 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 21,
|
||||
/* 680 */ 21, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 540 */ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
/* 550 */ 190, 190, 132, 191, 191, 191, 191, 50, 191, 83,
|
||||
/* 560 */ 85, 84, 54, 82, 79, 5, 191, 191, 191, 145,
|
||||
/* 570 */ 5, 191, 5, 145, 196, 196, 5, 191, 5, 90,
|
||||
/* 580 */ 89, 135, 113, 104, 114, 107, 1, 105, 105, 191,
|
||||
/* 590 */ 200, 207, 201, 206, 205, 192, 204, 202, 192, 203,
|
||||
/* 600 */ 191, 197, 109, 192, 192, 191, 191, 104, 109, 193,
|
||||
/* 610 */ 105, 238, 240, 104, 104, 109, 105, 104, 224, 123,
|
||||
/* 620 */ 123, 109, 105, 104, 104, 111, 104, 104, 107, 76,
|
||||
/* 630 */ 9, 5, 108, 5, 5, 5, 5, 80, 15, 76,
|
||||
/* 640 */ 139, 109, 5, 16, 5, 105, 5, 5, 5, 5,
|
||||
/* 650 */ 5, 5, 5, 5, 139, 139, 5, 5, 5, 5,
|
||||
/* 660 */ 5, 5, 5, 5, 5, 109, 80, 60, 59, 0,
|
||||
/* 670 */ 21, 21, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 680 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 690 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 700 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 710 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
|
@ -373,102 +372,101 @@ static const YYCODETYPE yy_lookahead[] = {
|
|||
/* 820 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 830 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 840 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 850 */ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 860 */ 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
/* 850 */ 262, 262, 262, 262, 262, 262, 262, 262, 262,
|
||||
};
|
||||
#define YY_SHIFT_COUNT (314)
|
||||
#define YY_SHIFT_MIN (0)
|
||||
#define YY_SHIFT_MAX (667)
|
||||
#define YY_SHIFT_MAX (669)
|
||||
static const unsigned short int yy_shift_ofst[] = {
|
||||
/* 0 */ 168, 79, 79, 172, 172, 6, 221, 231, 74, 74,
|
||||
/* 10 */ 74, 74, 74, 74, 74, 74, 74, 0, 48, 231,
|
||||
/* 20 */ 290, 290, 290, 290, 110, 145, 74, 74, 74, 237,
|
||||
/* 30 */ 74, 74, 282, 6, 7, 7, 681, 681, 681, 231,
|
||||
/* 30 */ 74, 74, 297, 6, 7, 7, 672, 672, 672, 231,
|
||||
/* 40 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
|
||||
/* 50 */ 231, 231, 231, 231, 231, 231, 231, 231, 231, 290,
|
||||
/* 60 */ 290, 102, 102, 102, 102, 102, 102, 102, 74, 74,
|
||||
/* 70 */ 74, 297, 74, 145, 145, 74, 74, 74, 222, 222,
|
||||
/* 80 */ 246, 145, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 70 */ 74, 283, 74, 145, 145, 74, 74, 74, 233, 233,
|
||||
/* 80 */ 275, 145, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 90 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 100 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 110 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 120 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
||||
/* 130 */ 74, 74, 410, 410, 410, 361, 361, 361, 410, 361,
|
||||
/* 140 */ 410, 363, 375, 379, 390, 392, 395, 404, 409, 429,
|
||||
/* 150 */ 420, 410, 410, 410, 373, 6, 6, 410, 410, 394,
|
||||
/* 160 */ 396, 504, 472, 471, 503, 474, 478, 373, 410, 484,
|
||||
/* 170 */ 484, 410, 484, 410, 484, 410, 681, 681, 27, 100,
|
||||
/* 130 */ 74, 74, 413, 413, 413, 366, 366, 366, 413, 366,
|
||||
/* 140 */ 413, 371, 370, 368, 383, 381, 388, 393, 402, 410,
|
||||
/* 150 */ 420, 413, 413, 413, 382, 6, 6, 413, 413, 399,
|
||||
/* 160 */ 401, 507, 476, 475, 508, 477, 481, 382, 413, 485,
|
||||
/* 170 */ 485, 413, 485, 413, 485, 413, 672, 672, 27, 100,
|
||||
/* 180 */ 127, 100, 100, 53, 182, 280, 280, 280, 280, 259,
|
||||
/* 190 */ 281, 298, 338, 338, 338, 338, 22, 14, 92, 92,
|
||||
/* 200 */ 190, 144, 326, 279, 252, 288, 291, 293, 294, 299,
|
||||
/* 210 */ 374, 400, 377, 334, 311, 157, 286, 301, 304, 314,
|
||||
/* 220 */ 315, 316, 322, 278, 289, 292, 328, 302, 428, 432,
|
||||
/* 230 */ 366, 382, 559, 421, 560, 562, 425, 568, 569, 485,
|
||||
/* 240 */ 487, 442, 465, 473, 475, 467, 477, 488, 482, 479,
|
||||
/* 250 */ 496, 493, 501, 609, 509, 510, 512, 505, 494, 511,
|
||||
/* 260 */ 495, 514, 517, 513, 518, 473, 519, 520, 521, 522,
|
||||
/* 270 */ 550, 619, 624, 626, 627, 628, 629, 555, 621, 561,
|
||||
/* 280 */ 499, 530, 530, 625, 506, 507, 530, 635, 637, 538,
|
||||
/* 290 */ 530, 639, 642, 643, 644, 645, 646, 647, 648, 649,
|
||||
/* 300 */ 650, 651, 652, 653, 654, 655, 656, 657, 554, 584,
|
||||
/* 310 */ 658, 659, 605, 607, 667,
|
||||
/* 200 */ 246, 293, 284, 144, 331, 294, 295, 300, 302, 307,
|
||||
/* 210 */ 308, 309, 224, 251, 319, 306, 310, 315, 316, 317,
|
||||
/* 220 */ 318, 323, 258, 296, 303, 305, 325, 311, 374, 397,
|
||||
/* 230 */ 369, 385, 560, 424, 565, 567, 428, 571, 573, 489,
|
||||
/* 240 */ 491, 446, 469, 478, 479, 470, 482, 493, 483, 503,
|
||||
/* 250 */ 505, 499, 509, 585, 510, 511, 513, 506, 496, 512,
|
||||
/* 260 */ 497, 517, 519, 514, 520, 478, 522, 521, 523, 524,
|
||||
/* 270 */ 553, 621, 626, 628, 629, 630, 631, 557, 623, 563,
|
||||
/* 280 */ 501, 532, 532, 627, 515, 516, 532, 637, 639, 540,
|
||||
/* 290 */ 532, 641, 642, 643, 644, 645, 646, 647, 648, 651,
|
||||
/* 300 */ 652, 653, 654, 655, 656, 657, 658, 659, 556, 586,
|
||||
/* 310 */ 649, 650, 607, 609, 669,
|
||||
};
|
||||
#define YY_REDUCE_COUNT (177)
|
||||
#define YY_REDUCE_MIN (-244)
|
||||
#define YY_REDUCE_MAX (414)
|
||||
#define YY_REDUCE_MAX (416)
|
||||
static const short yy_reduce_ofst[] = {
|
||||
/* 0 */ -177, -26, -26, 67, 67, 17, -229, -215, -172, -175,
|
||||
/* 10 */ -7, 62, 78, 125, 149, 151, 155, -184, -187, -232,
|
||||
/* 20 */ -205, -8, 16, 47, -190, -9, -185, 44, 71, -188,
|
||||
/* 30 */ 28, -78, -77, 63, -53, 5, 84, 176, 83, -244,
|
||||
/* 40 */ -239, -216, -193, -143, -136, -106, -34, -20, 60, 85,
|
||||
/* 50 */ 89, 136, 160, 167, 185, 195, 196, 197, 198, 215,
|
||||
/* 60 */ 216, 226, 227, 228, 229, 230, 232, 233, 267, 270,
|
||||
/* 70 */ 271, 212, 273, 234, 235, 274, 275, 276, 211, 213,
|
||||
/* 80 */ 236, 239, 284, 285, 287, 295, 296, 300, 303, 305,
|
||||
/* 90 */ 306, 307, 308, 309, 310, 312, 313, 317, 318, 319,
|
||||
/* 100 */ 320, 321, 323, 324, 325, 327, 329, 330, 331, 332,
|
||||
/* 110 */ 333, 335, 336, 337, 339, 340, 341, 342, 343, 344,
|
||||
/* 120 */ 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
|
||||
/* 130 */ 355, 356, 357, 358, 359, 225, 238, 240, 360, 247,
|
||||
/* 140 */ 362, 241, 243, 242, 260, 364, 367, 365, 244, 369,
|
||||
/* 150 */ 245, 368, 370, 371, 256, 372, 376, 378, 380, 381,
|
||||
/* 160 */ 383, 385, 384, 387, 391, 389, 386, 388, 393, 402,
|
||||
/* 170 */ 403, 405, 406, 408, 411, 413, 414, 407,
|
||||
/* 20 */ -205, -8, 47, 68, -190, -9, -185, 44, 101, -188,
|
||||
/* 30 */ 41, -78, -77, 98, -53, 5, 138, 20, 153, -244,
|
||||
/* 40 */ -239, -216, -193, -143, -136, -106, 8, 25, 37, 85,
|
||||
/* 50 */ 89, 139, 142, 185, 187, 189, 200, 201, 202, 171,
|
||||
/* 60 */ 198, 228, 229, 230, 232, 234, 235, 236, 267, 269,
|
||||
/* 70 */ 273, 214, 276, 238, 239, 277, 278, 279, 207, 212,
|
||||
/* 80 */ 240, 241, 285, 286, 288, 289, 291, 292, 299, 301,
|
||||
/* 90 */ 304, 312, 313, 314, 320, 321, 322, 324, 326, 327,
|
||||
/* 100 */ 328, 329, 330, 332, 333, 334, 335, 336, 337, 339,
|
||||
/* 110 */ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
|
||||
/* 120 */ 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
|
||||
/* 130 */ 360, 361, 362, 363, 364, 226, 242, 243, 365, 244,
|
||||
/* 140 */ 367, 245, 247, 256, 262, 265, 248, 274, 372, 249,
|
||||
/* 150 */ 373, 375, 376, 377, 260, 378, 379, 380, 386, 384,
|
||||
/* 160 */ 387, 389, 391, 392, 395, 396, 390, 394, 398, 403,
|
||||
/* 170 */ 406, 409, 411, 414, 412, 415, 404, 416,
|
||||
};
|
||||
static const YYACTIONTYPE yy_default[] = {
|
||||
/* 0 */ 773, 885, 831, 897, 819, 828, 1026, 1026, 773, 773,
|
||||
/* 10 */ 773, 773, 773, 773, 773, 773, 773, 944, 792, 1026,
|
||||
/* 20 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 828,
|
||||
/* 30 */ 773, 773, 834, 828, 834, 834, 939, 869, 887, 773,
|
||||
/* 40 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 50 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 60 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 70 */ 773, 946, 949, 773, 773, 951, 773, 773, 971, 971,
|
||||
/* 80 */ 937, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 90 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 100 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 817,
|
||||
/* 110 */ 773, 815, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 120 */ 773, 773, 773, 773, 773, 773, 802, 773, 773, 773,
|
||||
/* 130 */ 773, 773, 794, 794, 794, 773, 773, 773, 794, 773,
|
||||
/* 140 */ 794, 978, 982, 976, 964, 972, 963, 959, 957, 956,
|
||||
/* 150 */ 986, 794, 794, 794, 832, 828, 828, 794, 794, 850,
|
||||
/* 160 */ 848, 846, 838, 844, 840, 842, 836, 820, 794, 826,
|
||||
/* 170 */ 826, 794, 826, 794, 826, 794, 869, 887, 773, 987,
|
||||
/* 180 */ 773, 1025, 977, 1015, 1014, 1021, 1013, 1012, 1011, 773,
|
||||
/* 190 */ 773, 773, 1007, 1008, 1010, 1009, 773, 773, 1017, 1016,
|
||||
/* 200 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 210 */ 773, 773, 773, 989, 773, 983, 979, 773, 773, 773,
|
||||
/* 220 */ 773, 773, 773, 773, 773, 773, 899, 773, 773, 773,
|
||||
/* 230 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 240 */ 773, 773, 936, 773, 773, 773, 773, 947, 773, 773,
|
||||
/* 250 */ 773, 773, 773, 773, 773, 773, 773, 973, 773, 965,
|
||||
/* 260 */ 773, 773, 773, 773, 773, 911, 773, 773, 773, 773,
|
||||
/* 270 */ 773, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 280 */ 773, 1037, 1035, 773, 773, 773, 1031, 773, 773, 773,
|
||||
/* 290 */ 1029, 773, 773, 773, 773, 773, 773, 773, 773, 773,
|
||||
/* 300 */ 773, 773, 773, 773, 773, 773, 773, 773, 853, 773,
|
||||
/* 310 */ 800, 798, 773, 790, 773,
|
||||
/* 0 */ 777, 889, 835, 901, 823, 832, 1032, 1032, 777, 777,
|
||||
/* 10 */ 777, 777, 777, 777, 777, 777, 777, 948, 796, 1032,
|
||||
/* 20 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 832,
|
||||
/* 30 */ 777, 777, 838, 832, 838, 838, 943, 873, 891, 777,
|
||||
/* 40 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 50 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 60 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 70 */ 777, 950, 953, 777, 777, 955, 777, 777, 975, 975,
|
||||
/* 80 */ 941, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 90 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 100 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 821,
|
||||
/* 110 */ 777, 819, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 120 */ 777, 777, 777, 777, 777, 777, 806, 777, 777, 777,
|
||||
/* 130 */ 777, 777, 798, 798, 798, 777, 777, 777, 798, 777,
|
||||
/* 140 */ 798, 982, 986, 980, 968, 976, 967, 963, 961, 960,
|
||||
/* 150 */ 990, 798, 798, 798, 836, 832, 832, 798, 798, 854,
|
||||
/* 160 */ 852, 850, 842, 848, 844, 846, 840, 824, 798, 830,
|
||||
/* 170 */ 830, 798, 830, 798, 830, 798, 873, 891, 777, 991,
|
||||
/* 180 */ 777, 1031, 981, 1021, 1020, 1027, 1019, 1018, 1017, 777,
|
||||
/* 190 */ 777, 777, 1013, 1014, 1016, 1015, 777, 777, 1023, 1022,
|
||||
/* 200 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 210 */ 777, 777, 777, 993, 777, 987, 983, 777, 777, 777,
|
||||
/* 220 */ 777, 777, 777, 777, 777, 777, 903, 777, 777, 777,
|
||||
/* 230 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 240 */ 777, 777, 940, 777, 777, 777, 777, 951, 777, 777,
|
||||
/* 250 */ 777, 777, 777, 777, 777, 777, 777, 977, 777, 969,
|
||||
/* 260 */ 777, 777, 777, 777, 777, 915, 777, 777, 777, 777,
|
||||
/* 270 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 280 */ 777, 1043, 1041, 777, 777, 777, 1037, 777, 777, 777,
|
||||
/* 290 */ 1035, 777, 777, 777, 777, 777, 777, 777, 777, 777,
|
||||
/* 300 */ 777, 777, 777, 777, 777, 777, 777, 777, 857, 777,
|
||||
/* 310 */ 804, 802, 777, 794, 777,
|
||||
};
|
||||
/********** End of lemon-generated parsing tables *****************************/
|
||||
|
||||
|
@ -1256,48 +1254,50 @@ static const char *const yyRuleName[] = {
|
|||
/* 222 */ "expr ::= STRING",
|
||||
/* 223 */ "expr ::= NOW",
|
||||
/* 224 */ "expr ::= VARIABLE",
|
||||
/* 225 */ "expr ::= BOOL",
|
||||
/* 226 */ "expr ::= NULL",
|
||||
/* 227 */ "expr ::= ID LP exprlist RP",
|
||||
/* 228 */ "expr ::= ID LP STAR RP",
|
||||
/* 229 */ "expr ::= expr IS NULL",
|
||||
/* 230 */ "expr ::= expr IS NOT NULL",
|
||||
/* 231 */ "expr ::= expr LT expr",
|
||||
/* 232 */ "expr ::= expr GT expr",
|
||||
/* 233 */ "expr ::= expr LE expr",
|
||||
/* 234 */ "expr ::= expr GE expr",
|
||||
/* 235 */ "expr ::= expr NE expr",
|
||||
/* 236 */ "expr ::= expr EQ expr",
|
||||
/* 237 */ "expr ::= expr BETWEEN expr AND expr",
|
||||
/* 238 */ "expr ::= expr AND expr",
|
||||
/* 239 */ "expr ::= expr OR expr",
|
||||
/* 240 */ "expr ::= expr PLUS expr",
|
||||
/* 241 */ "expr ::= expr MINUS expr",
|
||||
/* 242 */ "expr ::= expr STAR expr",
|
||||
/* 243 */ "expr ::= expr SLASH expr",
|
||||
/* 244 */ "expr ::= expr REM expr",
|
||||
/* 245 */ "expr ::= expr LIKE expr",
|
||||
/* 246 */ "expr ::= expr IN LP exprlist RP",
|
||||
/* 247 */ "exprlist ::= exprlist COMMA expritem",
|
||||
/* 248 */ "exprlist ::= expritem",
|
||||
/* 249 */ "expritem ::= expr",
|
||||
/* 250 */ "expritem ::=",
|
||||
/* 251 */ "cmd ::= RESET QUERY CACHE",
|
||||
/* 252 */ "cmd ::= SYNCDB ids REPLICA",
|
||||
/* 253 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
|
||||
/* 254 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
|
||||
/* 255 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
|
||||
/* 256 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
|
||||
/* 257 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
|
||||
/* 258 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
|
||||
/* 259 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
|
||||
/* 260 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
|
||||
/* 261 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
|
||||
/* 262 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
|
||||
/* 263 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
|
||||
/* 264 */ "cmd ::= KILL CONNECTION INTEGER",
|
||||
/* 265 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
|
||||
/* 266 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
|
||||
/* 225 */ "expr ::= PLUS VARIABLE",
|
||||
/* 226 */ "expr ::= MINUS VARIABLE",
|
||||
/* 227 */ "expr ::= BOOL",
|
||||
/* 228 */ "expr ::= NULL",
|
||||
/* 229 */ "expr ::= ID LP exprlist RP",
|
||||
/* 230 */ "expr ::= ID LP STAR RP",
|
||||
/* 231 */ "expr ::= expr IS NULL",
|
||||
/* 232 */ "expr ::= expr IS NOT NULL",
|
||||
/* 233 */ "expr ::= expr LT expr",
|
||||
/* 234 */ "expr ::= expr GT expr",
|
||||
/* 235 */ "expr ::= expr LE expr",
|
||||
/* 236 */ "expr ::= expr GE expr",
|
||||
/* 237 */ "expr ::= expr NE expr",
|
||||
/* 238 */ "expr ::= expr EQ expr",
|
||||
/* 239 */ "expr ::= expr BETWEEN expr AND expr",
|
||||
/* 240 */ "expr ::= expr AND expr",
|
||||
/* 241 */ "expr ::= expr OR expr",
|
||||
/* 242 */ "expr ::= expr PLUS expr",
|
||||
/* 243 */ "expr ::= expr MINUS expr",
|
||||
/* 244 */ "expr ::= expr STAR expr",
|
||||
/* 245 */ "expr ::= expr SLASH expr",
|
||||
/* 246 */ "expr ::= expr REM expr",
|
||||
/* 247 */ "expr ::= expr LIKE expr",
|
||||
/* 248 */ "expr ::= expr IN LP exprlist RP",
|
||||
/* 249 */ "exprlist ::= exprlist COMMA expritem",
|
||||
/* 250 */ "exprlist ::= expritem",
|
||||
/* 251 */ "expritem ::= expr",
|
||||
/* 252 */ "expritem ::=",
|
||||
/* 253 */ "cmd ::= RESET QUERY CACHE",
|
||||
/* 254 */ "cmd ::= SYNCDB ids REPLICA",
|
||||
/* 255 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
|
||||
/* 256 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
|
||||
/* 257 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
|
||||
/* 258 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
|
||||
/* 259 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
|
||||
/* 260 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
|
||||
/* 261 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
|
||||
/* 262 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
|
||||
/* 263 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
|
||||
/* 264 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
|
||||
/* 265 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
|
||||
/* 266 */ "cmd ::= KILL CONNECTION INTEGER",
|
||||
/* 267 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
|
||||
/* 268 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
|
||||
};
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
@ -1982,48 +1982,50 @@ static const YYCODETYPE yyRuleInfoLhs[] = {
|
|||
251, /* (222) expr ::= STRING */
|
||||
251, /* (223) expr ::= NOW */
|
||||
251, /* (224) expr ::= VARIABLE */
|
||||
251, /* (225) expr ::= BOOL */
|
||||
251, /* (226) expr ::= NULL */
|
||||
251, /* (227) expr ::= ID LP exprlist RP */
|
||||
251, /* (228) expr ::= ID LP STAR RP */
|
||||
251, /* (229) expr ::= expr IS NULL */
|
||||
251, /* (230) expr ::= expr IS NOT NULL */
|
||||
251, /* (231) expr ::= expr LT expr */
|
||||
251, /* (232) expr ::= expr GT expr */
|
||||
251, /* (233) expr ::= expr LE expr */
|
||||
251, /* (234) expr ::= expr GE expr */
|
||||
251, /* (235) expr ::= expr NE expr */
|
||||
251, /* (236) expr ::= expr EQ expr */
|
||||
251, /* (237) expr ::= expr BETWEEN expr AND expr */
|
||||
251, /* (238) expr ::= expr AND expr */
|
||||
251, /* (239) expr ::= expr OR expr */
|
||||
251, /* (240) expr ::= expr PLUS expr */
|
||||
251, /* (241) expr ::= expr MINUS expr */
|
||||
251, /* (242) expr ::= expr STAR expr */
|
||||
251, /* (243) expr ::= expr SLASH expr */
|
||||
251, /* (244) expr ::= expr REM expr */
|
||||
251, /* (245) expr ::= expr LIKE expr */
|
||||
251, /* (246) expr ::= expr IN LP exprlist RP */
|
||||
260, /* (247) exprlist ::= exprlist COMMA expritem */
|
||||
260, /* (248) exprlist ::= expritem */
|
||||
261, /* (249) expritem ::= expr */
|
||||
261, /* (250) expritem ::= */
|
||||
188, /* (251) cmd ::= RESET QUERY CACHE */
|
||||
188, /* (252) cmd ::= SYNCDB ids REPLICA */
|
||||
188, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
188, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
188, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
188, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
188, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
188, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
188, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
188, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
188, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
188, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
188, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
188, /* (264) cmd ::= KILL CONNECTION INTEGER */
|
||||
188, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
188, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
251, /* (225) expr ::= PLUS VARIABLE */
|
||||
251, /* (226) expr ::= MINUS VARIABLE */
|
||||
251, /* (227) expr ::= BOOL */
|
||||
251, /* (228) expr ::= NULL */
|
||||
251, /* (229) expr ::= ID LP exprlist RP */
|
||||
251, /* (230) expr ::= ID LP STAR RP */
|
||||
251, /* (231) expr ::= expr IS NULL */
|
||||
251, /* (232) expr ::= expr IS NOT NULL */
|
||||
251, /* (233) expr ::= expr LT expr */
|
||||
251, /* (234) expr ::= expr GT expr */
|
||||
251, /* (235) expr ::= expr LE expr */
|
||||
251, /* (236) expr ::= expr GE expr */
|
||||
251, /* (237) expr ::= expr NE expr */
|
||||
251, /* (238) expr ::= expr EQ expr */
|
||||
251, /* (239) expr ::= expr BETWEEN expr AND expr */
|
||||
251, /* (240) expr ::= expr AND expr */
|
||||
251, /* (241) expr ::= expr OR expr */
|
||||
251, /* (242) expr ::= expr PLUS expr */
|
||||
251, /* (243) expr ::= expr MINUS expr */
|
||||
251, /* (244) expr ::= expr STAR expr */
|
||||
251, /* (245) expr ::= expr SLASH expr */
|
||||
251, /* (246) expr ::= expr REM expr */
|
||||
251, /* (247) expr ::= expr LIKE expr */
|
||||
251, /* (248) expr ::= expr IN LP exprlist RP */
|
||||
260, /* (249) exprlist ::= exprlist COMMA expritem */
|
||||
260, /* (250) exprlist ::= expritem */
|
||||
261, /* (251) expritem ::= expr */
|
||||
261, /* (252) expritem ::= */
|
||||
188, /* (253) cmd ::= RESET QUERY CACHE */
|
||||
188, /* (254) cmd ::= SYNCDB ids REPLICA */
|
||||
188, /* (255) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
188, /* (256) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
188, /* (257) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
188, /* (258) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
188, /* (259) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
188, /* (260) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
188, /* (261) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
188, /* (262) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
188, /* (263) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
188, /* (264) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
188, /* (265) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
188, /* (266) cmd ::= KILL CONNECTION INTEGER */
|
||||
188, /* (267) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
188, /* (268) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
};
|
||||
|
||||
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
|
||||
|
@ -2254,48 +2256,50 @@ static const signed char yyRuleInfoNRhs[] = {
|
|||
-1, /* (222) expr ::= STRING */
|
||||
-1, /* (223) expr ::= NOW */
|
||||
-1, /* (224) expr ::= VARIABLE */
|
||||
-1, /* (225) expr ::= BOOL */
|
||||
-1, /* (226) expr ::= NULL */
|
||||
-4, /* (227) expr ::= ID LP exprlist RP */
|
||||
-4, /* (228) expr ::= ID LP STAR RP */
|
||||
-3, /* (229) expr ::= expr IS NULL */
|
||||
-4, /* (230) expr ::= expr IS NOT NULL */
|
||||
-3, /* (231) expr ::= expr LT expr */
|
||||
-3, /* (232) expr ::= expr GT expr */
|
||||
-3, /* (233) expr ::= expr LE expr */
|
||||
-3, /* (234) expr ::= expr GE expr */
|
||||
-3, /* (235) expr ::= expr NE expr */
|
||||
-3, /* (236) expr ::= expr EQ expr */
|
||||
-5, /* (237) expr ::= expr BETWEEN expr AND expr */
|
||||
-3, /* (238) expr ::= expr AND expr */
|
||||
-3, /* (239) expr ::= expr OR expr */
|
||||
-3, /* (240) expr ::= expr PLUS expr */
|
||||
-3, /* (241) expr ::= expr MINUS expr */
|
||||
-3, /* (242) expr ::= expr STAR expr */
|
||||
-3, /* (243) expr ::= expr SLASH expr */
|
||||
-3, /* (244) expr ::= expr REM expr */
|
||||
-3, /* (245) expr ::= expr LIKE expr */
|
||||
-5, /* (246) expr ::= expr IN LP exprlist RP */
|
||||
-3, /* (247) exprlist ::= exprlist COMMA expritem */
|
||||
-1, /* (248) exprlist ::= expritem */
|
||||
-1, /* (249) expritem ::= expr */
|
||||
0, /* (250) expritem ::= */
|
||||
-3, /* (251) cmd ::= RESET QUERY CACHE */
|
||||
-3, /* (252) cmd ::= SYNCDB ids REPLICA */
|
||||
-7, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
-7, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
-7, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
-7, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
-8, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
-9, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
-7, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
-7, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
-7, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
-7, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
-8, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
-3, /* (264) cmd ::= KILL CONNECTION INTEGER */
|
||||
-5, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
-5, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
-2, /* (225) expr ::= PLUS VARIABLE */
|
||||
-2, /* (226) expr ::= MINUS VARIABLE */
|
||||
-1, /* (227) expr ::= BOOL */
|
||||
-1, /* (228) expr ::= NULL */
|
||||
-4, /* (229) expr ::= ID LP exprlist RP */
|
||||
-4, /* (230) expr ::= ID LP STAR RP */
|
||||
-3, /* (231) expr ::= expr IS NULL */
|
||||
-4, /* (232) expr ::= expr IS NOT NULL */
|
||||
-3, /* (233) expr ::= expr LT expr */
|
||||
-3, /* (234) expr ::= expr GT expr */
|
||||
-3, /* (235) expr ::= expr LE expr */
|
||||
-3, /* (236) expr ::= expr GE expr */
|
||||
-3, /* (237) expr ::= expr NE expr */
|
||||
-3, /* (238) expr ::= expr EQ expr */
|
||||
-5, /* (239) expr ::= expr BETWEEN expr AND expr */
|
||||
-3, /* (240) expr ::= expr AND expr */
|
||||
-3, /* (241) expr ::= expr OR expr */
|
||||
-3, /* (242) expr ::= expr PLUS expr */
|
||||
-3, /* (243) expr ::= expr MINUS expr */
|
||||
-3, /* (244) expr ::= expr STAR expr */
|
||||
-3, /* (245) expr ::= expr SLASH expr */
|
||||
-3, /* (246) expr ::= expr REM expr */
|
||||
-3, /* (247) expr ::= expr LIKE expr */
|
||||
-5, /* (248) expr ::= expr IN LP exprlist RP */
|
||||
-3, /* (249) exprlist ::= exprlist COMMA expritem */
|
||||
-1, /* (250) exprlist ::= expritem */
|
||||
-1, /* (251) expritem ::= expr */
|
||||
0, /* (252) expritem ::= */
|
||||
-3, /* (253) cmd ::= RESET QUERY CACHE */
|
||||
-3, /* (254) cmd ::= SYNCDB ids REPLICA */
|
||||
-7, /* (255) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
-7, /* (256) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
-7, /* (257) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
-7, /* (258) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
-8, /* (259) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
-9, /* (260) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
-7, /* (261) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
-7, /* (262) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
-7, /* (263) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
-7, /* (264) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
-8, /* (265) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
-3, /* (266) cmd ::= KILL CONNECTION INTEGER */
|
||||
-5, /* (267) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
-5, /* (268) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
};
|
||||
|
||||
static void yy_accept(yyParser*); /* Forward Declaration */
|
||||
|
@ -3090,7 +3094,7 @@ static YYACTIONTYPE yy_reduce(
|
|||
break;
|
||||
case 200: /* having_opt ::= */
|
||||
case 210: /* where_opt ::= */ yytestcase(yyruleno==210);
|
||||
case 250: /* expritem ::= */ yytestcase(yyruleno==250);
|
||||
case 252: /* expritem ::= */ yytestcase(yyruleno==252);
|
||||
{yymsp[1].minor.yy170 = 0;}
|
||||
break;
|
||||
case 201: /* having_opt ::= HAVING expr */
|
||||
|
@ -3163,120 +3167,125 @@ static YYACTIONTYPE yy_reduce(
|
|||
{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
|
||||
yymsp[0].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 225: /* expr ::= BOOL */
|
||||
case 225: /* expr ::= PLUS VARIABLE */
|
||||
case 226: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==226);
|
||||
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
|
||||
yymsp[-1].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 227: /* expr ::= BOOL */
|
||||
{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
|
||||
yymsp[0].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 226: /* expr ::= NULL */
|
||||
case 228: /* expr ::= NULL */
|
||||
{ yylhsminor.yy170 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
|
||||
yymsp[0].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 227: /* expr ::= ID LP exprlist RP */
|
||||
case 229: /* expr ::= ID LP exprlist RP */
|
||||
{ yylhsminor.yy170 = tSqlExprCreateFunction(yymsp[-1].minor.yy429, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
|
||||
yymsp[-3].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 228: /* expr ::= ID LP STAR RP */
|
||||
case 230: /* expr ::= ID LP STAR RP */
|
||||
{ yylhsminor.yy170 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
|
||||
yymsp[-3].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 229: /* expr ::= expr IS NULL */
|
||||
case 231: /* expr ::= expr IS NULL */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, NULL, TK_ISNULL);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 230: /* expr ::= expr IS NOT NULL */
|
||||
case 232: /* expr ::= expr IS NOT NULL */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-3].minor.yy170, NULL, TK_NOTNULL);}
|
||||
yymsp[-3].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 231: /* expr ::= expr LT expr */
|
||||
case 233: /* expr ::= expr LT expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LT);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 232: /* expr ::= expr GT expr */
|
||||
case 234: /* expr ::= expr GT expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GT);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 233: /* expr ::= expr LE expr */
|
||||
case 235: /* expr ::= expr LE expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LE);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 234: /* expr ::= expr GE expr */
|
||||
case 236: /* expr ::= expr GE expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_GE);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 235: /* expr ::= expr NE expr */
|
||||
case 237: /* expr ::= expr NE expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_NE);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 236: /* expr ::= expr EQ expr */
|
||||
case 238: /* expr ::= expr EQ expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_EQ);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 237: /* expr ::= expr BETWEEN expr AND expr */
|
||||
case 239: /* expr ::= expr BETWEEN expr AND expr */
|
||||
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy170); yylhsminor.yy170 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy170, yymsp[-2].minor.yy170, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy170, TK_LE), TK_AND);}
|
||||
yymsp[-4].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 238: /* expr ::= expr AND expr */
|
||||
case 240: /* expr ::= expr AND expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_AND);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 239: /* expr ::= expr OR expr */
|
||||
case 241: /* expr ::= expr OR expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_OR); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 240: /* expr ::= expr PLUS expr */
|
||||
case 242: /* expr ::= expr PLUS expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_PLUS); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 241: /* expr ::= expr MINUS expr */
|
||||
case 243: /* expr ::= expr MINUS expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_MINUS); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 242: /* expr ::= expr STAR expr */
|
||||
case 244: /* expr ::= expr STAR expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_STAR); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 243: /* expr ::= expr SLASH expr */
|
||||
case 245: /* expr ::= expr SLASH expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_DIVIDE);}
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 244: /* expr ::= expr REM expr */
|
||||
case 246: /* expr ::= expr REM expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_REM); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 245: /* expr ::= expr LIKE expr */
|
||||
case 247: /* expr ::= expr LIKE expr */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-2].minor.yy170, yymsp[0].minor.yy170, TK_LIKE); }
|
||||
yymsp[-2].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 246: /* expr ::= expr IN LP exprlist RP */
|
||||
case 248: /* expr ::= expr IN LP exprlist RP */
|
||||
{yylhsminor.yy170 = tSqlExprCreate(yymsp[-4].minor.yy170, (tSqlExpr*)yymsp[-1].minor.yy429, TK_IN); }
|
||||
yymsp[-4].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 247: /* exprlist ::= exprlist COMMA expritem */
|
||||
case 249: /* exprlist ::= exprlist COMMA expritem */
|
||||
{yylhsminor.yy429 = tSqlExprListAppend(yymsp[-2].minor.yy429,yymsp[0].minor.yy170,0, 0);}
|
||||
yymsp[-2].minor.yy429 = yylhsminor.yy429;
|
||||
break;
|
||||
case 248: /* exprlist ::= expritem */
|
||||
case 250: /* exprlist ::= expritem */
|
||||
{yylhsminor.yy429 = tSqlExprListAppend(0,yymsp[0].minor.yy170,0, 0);}
|
||||
yymsp[0].minor.yy429 = yylhsminor.yy429;
|
||||
break;
|
||||
case 249: /* expritem ::= expr */
|
||||
case 251: /* expritem ::= expr */
|
||||
{yylhsminor.yy170 = yymsp[0].minor.yy170;}
|
||||
yymsp[0].minor.yy170 = yylhsminor.yy170;
|
||||
break;
|
||||
case 251: /* cmd ::= RESET QUERY CACHE */
|
||||
case 253: /* cmd ::= RESET QUERY CACHE */
|
||||
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
|
||||
break;
|
||||
case 252: /* cmd ::= SYNCDB ids REPLICA */
|
||||
case 254: /* cmd ::= SYNCDB ids REPLICA */
|
||||
{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
|
||||
break;
|
||||
case 253: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
case 255: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
|
||||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 254: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
case 256: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
|
||||
|
@ -3287,14 +3296,14 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 255: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
case 257: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
|
||||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 256: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
case 258: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
|
||||
|
@ -3305,7 +3314,7 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 257: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
case 259: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
{
|
||||
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
|
||||
|
||||
|
@ -3319,7 +3328,7 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 258: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
case 260: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
{
|
||||
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
|
||||
|
||||
|
@ -3331,14 +3340,14 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 259: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
case 261: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
|
||||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 260: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
case 262: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
|
||||
|
@ -3349,14 +3358,14 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 261: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
case 263: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy429, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
|
||||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 262: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
case 264: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
{
|
||||
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
|
||||
|
||||
|
@ -3367,7 +3376,7 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 263: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
case 265: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
{
|
||||
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
|
||||
|
||||
|
@ -3381,13 +3390,13 @@ static YYACTIONTYPE yy_reduce(
|
|||
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
|
||||
}
|
||||
break;
|
||||
case 264: /* cmd ::= KILL CONNECTION INTEGER */
|
||||
case 266: /* cmd ::= KILL CONNECTION INTEGER */
|
||||
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
|
||||
break;
|
||||
case 265: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
case 267: /* 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 266: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
case 268: /* 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:
|
||||
|
|
|
@ -286,7 +286,7 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
|
|||
}
|
||||
|
||||
taosArrayPush(pTableCheckInfo, &info);
|
||||
tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %"PRIu64, pQueryHandle, info.tableId.uid,
|
||||
tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" 0x%"PRIx64, pQueryHandle, info.tableId.uid,
|
||||
info.tableId.tid, info.lastKey, pQueryHandle->qId);
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
|
|||
|
||||
tsdbMayTakeMemSnapshot(pQueryHandle, psTable);
|
||||
|
||||
tsdbDebug("%p total numOfTable:%" PRIzu " in query, %"PRIu64, pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qId);
|
||||
tsdbDebug("%p total numOfTable:%" PRIzu " in query, 0x%"PRIx64, pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qId);
|
||||
return (TsdbQueryHandleT) pQueryHandle;
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
|
|||
SDataRow row = (SDataRow)SL_GET_NODE_DATA(node);
|
||||
TSKEY key = dataRowKey(row); // first timestamp in buffer
|
||||
tsdbDebug("%p uid:%" PRId64 ", tid:%d check data in mem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
|
||||
"-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %"PRIu64,
|
||||
"-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", 0x%"PRIx64,
|
||||
pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, key, order, pMem->keyFirst, pMem->keyLast,
|
||||
pCheckInfo->lastKey, pMem->numOfRows, pHandle->qId);
|
||||
|
||||
|
@ -662,7 +662,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
|
|||
}
|
||||
|
||||
} else {
|
||||
tsdbDebug("%p uid:%"PRId64", tid:%d no data in mem, %"PRIu64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
|
||||
tsdbDebug("%p uid:%"PRId64", tid:%d no data in mem, 0x%"PRIx64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
|
||||
pHandle->qId);
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
|
|||
SDataRow row = (SDataRow)SL_GET_NODE_DATA(node);
|
||||
TSKEY key = dataRowKey(row); // first timestamp in buffer
|
||||
tsdbDebug("%p uid:%" PRId64 ", tid:%d check data in imem from skey:%" PRId64 ", order:%d, ts range in buf:%" PRId64
|
||||
"-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", %"PRIu64,
|
||||
"-%" PRId64 ", lastKey:%" PRId64 ", numOfRows:%"PRId64", 0x%"PRIx64,
|
||||
pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, key, order, pIMem->keyFirst, pIMem->keyLast,
|
||||
pCheckInfo->lastKey, pIMem->numOfRows, pHandle->qId);
|
||||
|
||||
|
@ -683,7 +683,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
|
|||
assert(pCheckInfo->lastKey >= key);
|
||||
}
|
||||
} else {
|
||||
tsdbDebug("%p uid:%"PRId64", tid:%d no data in imem, %"PRIu64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
|
||||
tsdbDebug("%p uid:%"PRId64", tid:%d no data in imem, 0x%"PRIx64, pHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid,
|
||||
pHandle->qId);
|
||||
}
|
||||
|
||||
|
@ -811,7 +811,7 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
|
|||
}
|
||||
|
||||
pCheckInfo->lastKey = dataRowKey(row); // first timestamp in buffer
|
||||
tsdbDebug("%p uid:%" PRId64", tid:%d check data in buffer from skey:%" PRId64 ", order:%d, %"PRIu64, pHandle,
|
||||
tsdbDebug("%p uid:%" PRId64", tid:%d check data in buffer from skey:%" PRId64 ", order:%d, 0x%"PRIx64, pHandle,
|
||||
pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, pCheckInfo->lastKey, pHandle->order, pHandle->qId);
|
||||
|
||||
// all data in mem are checked already.
|
||||
|
@ -986,21 +986,21 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
|
|||
STSchema *pSchema = tsdbGetTableSchema(pCheckInfo->pTableObj);
|
||||
int32_t code = tdInitDataCols(pQueryHandle->pDataCols, pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tsdbError("%p failed to malloc buf for pDataCols, %"PRIu64, pQueryHandle, pQueryHandle->qId);
|
||||
tsdbError("%p failed to malloc buf for pDataCols, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId);
|
||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
code = tdInitDataCols(pQueryHandle->rhelper.pDCols[0], pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tsdbError("%p failed to malloc buf for rhelper.pDataCols[0], %"PRIu64, pQueryHandle, pQueryHandle->qId);
|
||||
tsdbError("%p failed to malloc buf for rhelper.pDataCols[0], 0x%"PRIx64, pQueryHandle, pQueryHandle->qId);
|
||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
code = tdInitDataCols(pQueryHandle->rhelper.pDCols[1], pSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tsdbError("%p failed to malloc buf for rhelper.pDataCols[1], %"PRIu64, pQueryHandle, pQueryHandle->qId);
|
||||
tsdbError("%p failed to malloc buf for rhelper.pDataCols[1], 0x%"PRIx64, pQueryHandle, pQueryHandle->qId);
|
||||
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
|
||||
goto _error;
|
||||
}
|
||||
|
@ -1036,14 +1036,14 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
|
|||
int64_t elapsedTime = (taosGetTimestampUs() - st);
|
||||
pQueryHandle->cost.blockLoadTime += elapsedTime;
|
||||
|
||||
tsdbDebug("%p load file block into buffer, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, elapsed time:%"PRId64 " us, %"PRIu64,
|
||||
tsdbDebug("%p load file block into buffer, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, elapsed time:%"PRId64 " us, 0x%"PRIx64,
|
||||
pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, elapsedTime, pQueryHandle->qId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
||||
_error:
|
||||
pBlock->numOfRows = 0;
|
||||
|
||||
tsdbError("%p error occurs in loading file block, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, %"PRIu64,
|
||||
tsdbError("%p error occurs in loading file block, index:%d, brange:%"PRId64"-%"PRId64", rows:%d, 0x%"PRIx64,
|
||||
pQueryHandle, slotIndex, pBlock->keyFirst, pBlock->keyLast, pBlock->numOfRows, pQueryHandle->qId);
|
||||
return terrno;
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
|
|||
assert(cur->pos >= 0 && cur->pos <= binfo.rows);
|
||||
|
||||
TSKEY key = (row != NULL)? dataRowKey(row):TSKEY_INITIAL_VAL;
|
||||
tsdbDebug("%p key in mem:%"PRId64", %"PRIu64, pQueryHandle, key, pQueryHandle->qId);
|
||||
tsdbDebug("%p key in mem:%"PRId64", 0x%"PRIx64, pQueryHandle, key, pQueryHandle->qId);
|
||||
|
||||
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) ||
|
||||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) {
|
||||
|
@ -1406,7 +1406,11 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
|
|||
SET_DOUBLE_PTR(pData, value);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
*(TSKEY *)pData = tdGetKey(*(TKEY *)value);
|
||||
if (pColInfo->info.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
||||
*(TSKEY *)pData = tdGetKey(*(TKEY *)value);
|
||||
} else {
|
||||
*(TSKEY *)pData = *(TSKEY *)value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
memcpy(pData, value, pColInfo->info.bytes);
|
||||
|
@ -1547,7 +1551,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STabl
|
|||
updateInfoAfterMerge(pQueryHandle, pCheckInfo, numOfRows, pos);
|
||||
doCheckGeneratedBlockRange(pQueryHandle);
|
||||
|
||||
tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %"PRIu64,
|
||||
tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, 0x%"PRIx64,
|
||||
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, cur->mixBlock, cur->win.skey,
|
||||
cur->win.ekey, cur->rows, pQueryHandle->qId);
|
||||
}
|
||||
|
@ -1601,7 +1605,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
|
|||
int32_t endPos = getEndPosInDataBlock(pQueryHandle, &blockInfo);
|
||||
|
||||
tsdbDebug("%p uid:%" PRIu64",tid:%d start merge data block, file block range:%"PRIu64"-%"PRIu64" rows:%d, start:%d,"
|
||||
"end:%d, %"PRIu64,
|
||||
"end:%d, 0x%"PRIx64,
|
||||
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, blockInfo.window.skey, blockInfo.window.ekey,
|
||||
blockInfo.rows, cur->pos, endPos, pQueryHandle->qId);
|
||||
|
||||
|
@ -1743,7 +1747,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
|
|||
updateInfoAfterMerge(pQueryHandle, pCheckInfo, numOfRows, pos);
|
||||
doCheckGeneratedBlockRange(pQueryHandle);
|
||||
|
||||
tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, %"PRIu64,
|
||||
tsdbDebug("%p uid:%" PRIu64",tid:%d data block created, mixblock:%d, brange:%"PRIu64"-%"PRIu64" rows:%d, 0x%"PRIx64,
|
||||
pQueryHandle, pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, cur->mixBlock, cur->win.skey,
|
||||
cur->win.ekey, cur->rows, pQueryHandle->qId);
|
||||
}
|
||||
|
@ -1919,12 +1923,12 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
|
|||
memcpy(pQueryHandle->pDataBlockInfo, sup.pDataBlockInfo[0], sizeof(STableBlockInfo) * numOfBlocks);
|
||||
cleanBlockOrderSupporter(&sup, numOfQualTables);
|
||||
|
||||
tsdbDebug("%p create data blocks info struct completed for 1 table, %d blocks not sorted %"PRIu64, pQueryHandle, cnt,
|
||||
tsdbDebug("%p create data blocks info struct completed for 1 table, %d blocks not sorted 0x%"PRIx64, pQueryHandle, cnt,
|
||||
pQueryHandle->qId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %"PRIu64, pQueryHandle, cnt,
|
||||
tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables 0x%"PRIx64, pQueryHandle, cnt,
|
||||
numOfQualTables, pQueryHandle->qId);
|
||||
|
||||
assert(cnt <= numOfBlocks && numOfQualTables <= numOfTables); // the pTableQueryInfo[j]->numOfBlocks may be 0
|
||||
|
@ -1961,7 +1965,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
|
|||
* }
|
||||
*/
|
||||
|
||||
tsdbDebug("%p %d data blocks sort completed, %"PRIu64, pQueryHandle, cnt, pQueryHandle->qId);
|
||||
tsdbDebug("%p %d data blocks sort completed, 0x%"PRIx64, pQueryHandle, cnt, pQueryHandle->qId);
|
||||
cleanBlockOrderSupporter(&sup, numOfTables);
|
||||
free(pTree);
|
||||
|
||||
|
@ -2019,7 +2023,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
|
|||
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && win.skey > pQueryHandle->window.ekey) ||
|
||||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && win.ekey < pQueryHandle->window.ekey)) {
|
||||
tsdbUnLockFS(REPO_FS(pQueryHandle->pTsdb));
|
||||
tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %"PRIu64, pQueryHandle,
|
||||
tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, 0x%"PRIx64, pQueryHandle,
|
||||
pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qId);
|
||||
pQueryHandle->pFileGroup = NULL;
|
||||
assert(pQueryHandle->numOfBlocks == 0);
|
||||
|
@ -2043,7 +2047,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
|
|||
break;
|
||||
}
|
||||
|
||||
tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %"PRIu64, pQueryHandle, numOfBlocks, numOfTables,
|
||||
tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, 0x%"PRIx64, pQueryHandle, numOfBlocks, numOfTables,
|
||||
pQueryHandle->pFileGroup->fid, pQueryHandle->qId);
|
||||
|
||||
assert(numOfBlocks >= 0);
|
||||
|
@ -2135,7 +2139,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
|
|||
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && win.skey > pQueryHandle->window.ekey) ||
|
||||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && win.ekey < pQueryHandle->window.ekey)) {
|
||||
tsdbUnLockFS(REPO_FS(pQueryHandle->pTsdb));
|
||||
tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, %"PRIu64, pQueryHandle,
|
||||
tsdbDebug("%p remain files are not qualified for qrange:%" PRId64 "-%" PRId64 ", ignore, 0x%"PRIx64, pQueryHandle,
|
||||
pQueryHandle->window.skey, pQueryHandle->window.ekey, pQueryHandle->qId);
|
||||
pQueryHandle->pFileGroup = NULL;
|
||||
break;
|
||||
|
@ -2159,7 +2163,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
|
|||
break;
|
||||
}
|
||||
|
||||
tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %"PRIu64, pQueryHandle, numOfBlocks, numOfTables,
|
||||
tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, 0x%"PRIx64, pQueryHandle, numOfBlocks, numOfTables,
|
||||
pQueryHandle->pFileGroup->fid, pQueryHandle->qId);
|
||||
|
||||
if (numOfBlocks == 0) {
|
||||
|
@ -2207,7 +2211,7 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
|
|||
if ((!cur->mixBlock) || cur->blockCompleted) {
|
||||
// all data blocks in current file has been checked already, try next file if exists
|
||||
} else {
|
||||
tsdbDebug("%p continue in current data block, index:%d, pos:%d, %"PRIu64, pQueryHandle, cur->slot, cur->pos,
|
||||
tsdbDebug("%p continue in current data block, index:%d, pos:%d, 0x%"PRIx64, pQueryHandle, cur->slot, cur->pos,
|
||||
pQueryHandle->qId);
|
||||
int32_t code = handleDataMergeIfNeeded(pQueryHandle, pBlockInfo->compBlock, pCheckInfo);
|
||||
*exists = (pQueryHandle->realNumOfRows > 0);
|
||||
|
@ -2336,7 +2340,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
|
|||
}
|
||||
|
||||
int64_t elapsedTime = taosGetTimestampUs() - st;
|
||||
tsdbDebug("%p build data block from cache completed, elapsed time:%"PRId64" us, numOfRows:%d, numOfCols:%d, %"PRIu64, pQueryHandle,
|
||||
tsdbDebug("%p build data block from cache completed, elapsed time:%"PRId64" us, numOfRows:%d, numOfCols:%d, 0x%"PRIx64, pQueryHandle,
|
||||
elapsedTime, numOfRows, numOfCols, pQueryHandle->qId);
|
||||
|
||||
return numOfRows;
|
||||
|
@ -3206,9 +3210,10 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons
|
|||
pGroupInfo->numOfTables = (uint32_t) taosArrayGetSize(res);
|
||||
pGroupInfo->pGroupList = createTableGroup(res, pTagSchema, pColIndex, numOfCols, skey);
|
||||
|
||||
tsdbDebug("%p no table name/tag condition, all tables belong to one group, numOfTables:%u", tsdb, pGroupInfo->numOfTables);
|
||||
taosArrayDestroy(res);
|
||||
tsdbDebug("%p no table name/tag condition, all tables qualified, numOfTables:%u, group:%zu", tsdb,
|
||||
pGroupInfo->numOfTables, taosArrayGetSize(pGroupInfo->pGroupList));
|
||||
|
||||
taosArrayDestroy(res);
|
||||
if (tsdbUnlockRepoMeta(tsdb) < 0) goto _error;
|
||||
return ret;
|
||||
}
|
||||
|
@ -3391,7 +3396,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
|
|||
pQueryHandle->next = doFreeColumnInfoData(pQueryHandle->next);
|
||||
|
||||
SIOCostSummary* pCost = &pQueryHandle->cost;
|
||||
tsdbDebug("%p :io-cost summary: statis-info:%"PRId64" us, datablock:%" PRId64" us, check data:%"PRId64" us, %"PRIu64,
|
||||
tsdbDebug("%p :io-cost summary: statis-info:%"PRId64" us, datablock:%" PRId64" us, check data:%"PRId64" us, 0x%"PRIx64,
|
||||
pQueryHandle, pCost->statisInfoLoadTime, pCost->blockLoadTime, pCost->checkForNextTime, pQueryHandle->qId);
|
||||
|
||||
tfree(pQueryHandle);
|
||||
|
|
|
@ -398,6 +398,10 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
|
|||
case TSDB_DATA_TYPE_SMALLINT: DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2));
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
case TSDB_DATA_TYPE_BOOL: DEFAULT_COMP(GET_INT8_VAL(f1), GET_INT8_VAL(f2));
|
||||
case TSDB_DATA_TYPE_UTINYINT: DEFAULT_COMP(GET_UINT8_VAL(f1), GET_UINT8_VAL(f2));
|
||||
case TSDB_DATA_TYPE_USMALLINT: DEFAULT_COMP(GET_UINT16_VAL(f1), GET_UINT16_VAL(f2));
|
||||
case TSDB_DATA_TYPE_UINT: DEFAULT_COMP(GET_UINT32_VAL(f1), GET_UINT32_VAL(f2));
|
||||
case TSDB_DATA_TYPE_UBIGINT: DEFAULT_COMP(GET_UINT64_VAL(f1), GET_UINT64_VAL(f2));
|
||||
case TSDB_DATA_TYPE_NCHAR: {
|
||||
tstr* t1 = (tstr*) f1;
|
||||
tstr* t2 = (tstr*) f2;
|
||||
|
|
|
@ -736,7 +736,7 @@ static uint32_t table[16][256] = {
|
|||
0x9c221d09, 0x6e2e10f7, 0x7dd67004, 0x8fda7dfa}
|
||||
|
||||
};
|
||||
#ifndef _TD_ARM_
|
||||
#if !defined(_TD_ARM_) && !defined(_TD_MIPS_)
|
||||
static uint32_t long_shifts[4][256] = {
|
||||
{0x00000000, 0xe040e0ac, 0xc56db7a9, 0x252d5705, 0x8f3719a3, 0x6f77f90f,
|
||||
0x4a5aae0a, 0xaa1a4ea6, 0x1b8245b7, 0xfbc2a51b, 0xdeeff21e, 0x3eaf12b2,
|
||||
|
@ -1187,7 +1187,7 @@ uint32_t crc32c_sf(uint32_t crci, crc_stream input, size_t length) {
|
|||
}
|
||||
return (uint32_t)crc ^ 0xffffffff;
|
||||
}
|
||||
#ifndef _TD_ARM_
|
||||
#if !defined(_TD_ARM_) && !defined(_TD_MIPS_)
|
||||
/* Apply the zeros operator table to crc. */
|
||||
static uint32_t shift_crc(uint32_t shift_table[][256], uint32_t crc) {
|
||||
return shift_table[0][crc & 0xff] ^ shift_table[1][(crc >> 8) & 0xff] ^
|
||||
|
@ -1198,7 +1198,7 @@ static uint32_t shift_crc(uint32_t shift_table[][256], uint32_t crc) {
|
|||
version. Otherwise, use the software version. */
|
||||
uint32_t (*crc32c)(uint32_t crci, crc_stream bytes, size_t len) = crc32c_sf;
|
||||
|
||||
#ifndef _TD_ARM_
|
||||
#if !defined(_TD_ARM_) && !defined(_TD_MIPS_)
|
||||
/* Compute CRC-32C using the Intel hardware instruction. */
|
||||
uint32_t crc32c_hw(uint32_t crc, crc_stream buf, size_t len) {
|
||||
crc_stream next = buf;
|
||||
|
@ -1353,7 +1353,7 @@ uint32_t crc32c_hw(uint32_t crc, crc_stream buf, size_t len) {
|
|||
#endif // #ifndef _TD_ARM_
|
||||
|
||||
void taosResolveCRC() {
|
||||
#if defined _TD_ARM_ || defined WINDOWS
|
||||
#if defined _TD_ARM_ || defined _TD_MIPS_ || defined WINDOWS
|
||||
crc32c = crc32c_sf;
|
||||
#else
|
||||
int sse42;
|
||||
|
|
|
@ -416,7 +416,8 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
|
|||
}
|
||||
}
|
||||
|
||||
if (dflag & DEBUG_SCREEN) taosWrite(1, buffer, (uint32_t)len);
|
||||
if (dflag & DEBUG_SCREEN)
|
||||
taosWrite(1, buffer, (uint32_t)len);
|
||||
if (dflag == 255) nInfo(buffer, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -291,16 +291,16 @@ static void taosNetCheckPort(uint32_t hostIp, int32_t startPort, int32_t endPort
|
|||
info.port = port;
|
||||
ret = taosNetCheckTcpPort(&info);
|
||||
if (ret != 0) {
|
||||
uError("failed to test TCP port:%d", port);
|
||||
printf("failed to test TCP port:%d\n", port);
|
||||
} else {
|
||||
uInfo("successed to test TCP port:%d", port);
|
||||
printf("successed to test TCP port:%d\n", port);
|
||||
}
|
||||
|
||||
ret = taosNetCheckUdpPort(&info);
|
||||
if (ret != 0) {
|
||||
uError("failed to test UDP port:%d", port);
|
||||
printf("failed to test UDP port:%d\n", port);
|
||||
} else {
|
||||
uInfo("successed to test UDP port:%d", port);
|
||||
printf("successed to test UDP port:%d\n", port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,9 +464,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
|
|||
|
||||
int32_t ret = taosNetCheckRpc(host, port, sendpkgLen, spi, NULL);
|
||||
if (ret < 0) {
|
||||
uError("failed to test TCP port:%d", port);
|
||||
printf("failed to test TCP port:%d\n", port);
|
||||
} else {
|
||||
uInfo("successed to test TCP port:%d", port);
|
||||
printf("successed to test TCP port:%d\n", port);
|
||||
}
|
||||
|
||||
if (pkgLen >= tsRpcMaxUdpSize) {
|
||||
|
@ -477,9 +477,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
|
|||
|
||||
ret = taosNetCheckRpc(host, port, pkgLen, spi, NULL);
|
||||
if (ret < 0) {
|
||||
uError("failed to test UDP port:%d", port);
|
||||
printf("failed to test UDP port:%d\n", port);
|
||||
} else {
|
||||
uInfo("successed to test UDP port:%d", port);
|
||||
printf("successed to test UDP port:%d\n", port);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ static void taosNetTestServer(char *host, int32_t startPort, int32_t pkgLen) {
|
|||
}
|
||||
|
||||
void taosNetTest(char *role, char *host, int32_t port, int32_t pkgLen) {
|
||||
tscEmbedded = 1;
|
||||
// tscEmbedded = 1;
|
||||
if (host == NULL) host = tsLocalFqdn;
|
||||
if (port == 0) port = tsServerPort;
|
||||
if (pkgLen <= 10) pkgLen = 1000;
|
||||
|
@ -559,5 +559,5 @@ void taosNetTest(char *role, char *host, int32_t port, int32_t pkgLen) {
|
|||
taosNetTestStartup(host, port);
|
||||
}
|
||||
|
||||
tscEmbedded = 0;
|
||||
// tscEmbedded = 0;
|
||||
}
|
||||
|
|
|
@ -538,7 +538,7 @@ static void taosTmrModuleInit(void) {
|
|||
|
||||
void* taosTmrInit(int maxNumOfTmrs, int resolution, int longest, const char* label) {
|
||||
const char* ret = monotonicInit();
|
||||
tmrInfo("ttimer monotonic clock source:%s", ret);
|
||||
tmrDebug("ttimer monotonic clock source:%s", ret);
|
||||
|
||||
pthread_once(&tmrModuleInit, taosTmrModuleInit);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, uint64_t qId, v
|
|||
}
|
||||
} else {
|
||||
*freeHandle = true;
|
||||
vTrace("QInfo:%"PRIu64"-%p exec completed, free handle:%d", qId, *handle, *freeHandle);
|
||||
vTrace("QInfo:0x%"PRIx64"-%p exec completed, free handle:%d", qId, *handle, *freeHandle);
|
||||
}
|
||||
} else {
|
||||
SRetrieveTableRsp *pRsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp));
|
||||
|
@ -244,7 +244,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
|||
if (handle == NULL) { // failed to register qhandle
|
||||
pRsp->code = terrno;
|
||||
terrno = 0;
|
||||
vError("vgId:%d, QInfo:%"PRIu64 "-%p register qhandle failed, return to app, code:%s", pVnode->vgId, qId, (void *)pQInfo,
|
||||
vError("vgId:%d, QInfo:0x%"PRIx64 "-%p register qhandle failed, return to app, code:%s", pVnode->vgId, qId, (void *)pQInfo,
|
||||
tstrerror(pRsp->code));
|
||||
qDestroyQueryInfo(pQInfo); // destroy it directly
|
||||
return pRsp->code;
|
||||
|
@ -255,7 +255,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
|||
|
||||
if (handle != NULL &&
|
||||
vnodeNotifyCurrentQhandle(pRead->rpcHandle, qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
|
||||
vError("vgId:%d, QInfo:%"PRIu64 "-%p, query discarded since link is broken, %p", pVnode->vgId, qId, *handle,
|
||||
vError("vgId:%d, QInfo:0x%"PRIx64 "-%p, query discarded since link is broken, %p", pVnode->vgId, qId, *handle,
|
||||
pRead->rpcHandle);
|
||||
pRsp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
||||
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
|
||||
|
@ -266,7 +266,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
|||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
vTrace("vgId:%d, QInfo:%"PRIu64 "-%p, dnode query msg disposed, create qhandle and returns to app", vgId, qId, *handle);
|
||||
vTrace("vgId:%d, QInfo:0x%"PRIx64 "-%p, dnode query msg disposed, create qhandle and returns to app", vgId, qId, *handle);
|
||||
code = vnodePutItemIntoReadQueue(pVnode, handle, pRead->rpcHandle);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pRsp->code = code;
|
||||
|
@ -331,7 +331,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
|
|||
pRetrieve->free = htons(pRetrieve->free);
|
||||
pRetrieve->qId = htobe64(pRetrieve->qId);
|
||||
|
||||
vTrace("vgId:%d, qId:%" PRIu64 ", retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, pRetrieve->qId,
|
||||
vTrace("vgId:%d, qId:0x%" PRIx64 ", retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, pRetrieve->qId,
|
||||
pRetrieve->free, pRead->rpcHandle);
|
||||
|
||||
memset(pRet, 0, sizeof(SRspRet));
|
||||
|
@ -414,7 +414,7 @@ int32_t vnodeNotifyCurrentQhandle(void *handle, uint64_t qId, void *qhandle, int
|
|||
pMsg->header.vgId = htonl(vgId);
|
||||
pMsg->header.contLen = htonl(sizeof(SRetrieveTableMsg));
|
||||
|
||||
vTrace("QInfo:%"PRIu64"-%p register qhandle to connect:%p", qId, qhandle, handle);
|
||||
vTrace("QInfo:0x%"PRIx64"-%p register qhandle to connect:%p", qId, qhandle, handle);
|
||||
return rpcReportProgress(handle, (char *)pMsg, sizeof(SRetrieveTableMsg));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,358 +20,367 @@ using System.Runtime.InteropServices;
|
|||
using System.Collections;
|
||||
|
||||
namespace TDengineDriver
|
||||
{
|
||||
class TDengineTest
|
||||
{
|
||||
//connect parameters
|
||||
private string host;
|
||||
private string configDir;
|
||||
private string user;
|
||||
private string password;
|
||||
private short port = 0;
|
||||
|
||||
//sql parameters
|
||||
private string dbName;
|
||||
private string tbName;
|
||||
|
||||
|
||||
private bool isInsertData;
|
||||
private bool isQueryData;
|
||||
|
||||
private long tableCount;
|
||||
private long totalRows;
|
||||
private long batchRows;
|
||||
private long beginTimestamp = 1551369600000L;
|
||||
|
||||
private IntPtr conn = IntPtr.Zero;
|
||||
private long rowsInserted = 0;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
TDengineTest tester = new TDengineTest();
|
||||
tester.ReadArgument(args);
|
||||
|
||||
|
||||
tester.InitTDengine();
|
||||
tester.ConnectTDengine();
|
||||
{
|
||||
class TDengineTest
|
||||
{
|
||||
//connect parameters
|
||||
private string host;
|
||||
private string configDir;
|
||||
private string user;
|
||||
private string password;
|
||||
private short port = 0;
|
||||
|
||||
//sql parameters
|
||||
private string dbName;
|
||||
private string tbName;
|
||||
|
||||
|
||||
private bool isInsertData;
|
||||
private bool isQueryData;
|
||||
|
||||
private long tableCount;
|
||||
private long totalRows;
|
||||
private long batchRows;
|
||||
private long beginTimestamp = 1551369600000L;
|
||||
|
||||
private IntPtr conn = IntPtr.Zero;
|
||||
private long rowsInserted = 0;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
TDengineTest tester = new TDengineTest();
|
||||
tester.ReadArgument(args);
|
||||
|
||||
|
||||
tester.InitTDengine();
|
||||
tester.ConnectTDengine();
|
||||
tester.createDatabase();
|
||||
tester.useDatabase();
|
||||
tester.useDatabase();
|
||||
tester.checkDropTable();
|
||||
tester.createTable();
|
||||
tester.checkInsert();
|
||||
tester.checkSelect();
|
||||
tester.checkDropTable();
|
||||
|
||||
tester.CloseConnection();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public long GetArgumentAsLong(String[] argv, String argName, int minVal, int maxVal, int defaultValue)
|
||||
{
|
||||
int argc = argv.Length;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
if (argName != argv[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i < argc - 1)
|
||||
{
|
||||
String tmp = argv[i + 1];
|
||||
if (tmp[0] == '-')
|
||||
{
|
||||
Console.WriteLine("option {0:G} requires an argument", tmp);
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
long tmpVal = Convert.ToInt64(tmp);
|
||||
if (tmpVal < minVal || tmpVal > maxVal)
|
||||
{
|
||||
Console.WriteLine("option {0:G} should in range [{1:G}, {2:G}]", argName, minVal, maxVal);
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
return tmpVal;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String GetArgumentAsString(String[] argv, String argName, String defaultValue)
|
||||
{
|
||||
int argc = argv.Length;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
if (argName != argv[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i < argc - 1)
|
||||
{
|
||||
String tmp = argv[i + 1];
|
||||
if (tmp[0] == '-')
|
||||
{
|
||||
Console.WriteLine("option {0:G} requires an argument", tmp);
|
||||
ExitProgram();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void PrintHelp(String[] argv)
|
||||
{
|
||||
for (int i = 0; i < argv.Length; ++i)
|
||||
{
|
||||
if ("--help" == argv[i])
|
||||
{
|
||||
String indent = " ";
|
||||
Console.WriteLine("taosTest is simple example to operate TDengine use C# Language.\n");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-h");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "TDEngine server IP address to connect");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-u");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is root");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-p");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is taosdata");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-d");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Database used to create table or import data, default is db");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-s");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Super Tables used to create table, default is mt");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-t");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Table prefixs, default is t");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-w");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to insert data");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-r");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to query data");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-n");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many Tables to create, default is 10");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-b");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows per insert batch, default is 10");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-i");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows to insert, default is 100");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-c");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Configuration directory");
|
||||
|
||||
ExitProgram();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadArgument(String[] argv)
|
||||
{
|
||||
PrintHelp(argv);
|
||||
host = this.GetArgumentAsString(argv, "-h", "127.0.0.1");
|
||||
user = this.GetArgumentAsString(argv, "-u", "root");
|
||||
password = this.GetArgumentAsString(argv, "-p", "taosdata");
|
||||
dbName = this.GetArgumentAsString(argv, "-db", "test");
|
||||
tbName = this.GetArgumentAsString(argv, "-s", "weather");
|
||||
|
||||
isInsertData = this.GetArgumentAsLong(argv, "-w", 0, 1, 1) != 0;
|
||||
isQueryData = this.GetArgumentAsLong(argv, "-r", 0, 1, 1) != 0;
|
||||
tableCount = this.GetArgumentAsLong(argv, "-n", 1, 10000, 10);
|
||||
batchRows = this.GetArgumentAsLong(argv, "-b", 1, 1000, 500);
|
||||
totalRows = this.GetArgumentAsLong(argv, "-i", 1, 10000000, 10000);
|
||||
configDir = this.GetArgumentAsString(argv, "-c", "C:/TDengine/cfg");
|
||||
}
|
||||
|
||||
public void InitTDengine()
|
||||
{
|
||||
TDengine.Options((int)TDengineInitOption.TDDB_OPTION_CONFIGDIR, this.configDir);
|
||||
TDengine.Options((int)TDengineInitOption.TDDB_OPTION_SHELL_ACTIVITY_TIMER, "60");
|
||||
TDengine.Init();
|
||||
Console.WriteLine("get connection starting...");
|
||||
}
|
||||
|
||||
public void ConnectTDengine()
|
||||
{
|
||||
string db = "";
|
||||
this.conn = TDengine.Connect(this.host, this.user, this.password, db, this.port);
|
||||
if (this.conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("connection failed: " + this.host);
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("[ OK ] Connection established.");
|
||||
}
|
||||
}
|
||||
public void createDatabase()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("create database if not exists ").Append(this.dbName);
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void useDatabase()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("use ").Append(this.dbName);
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkSelect()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("select * from test.weather");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void createTable()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("create table if not exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("(ts timestamp, temperature float, humidity int)");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkInsert()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkDropTable()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("drop table if exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void execute(string sql)
|
||||
{
|
||||
DateTime dt1 = DateTime.Now;
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
DateTime dt2 = DateTime.Now;
|
||||
TimeSpan span = dt2 - dt1;
|
||||
|
||||
if (res != IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("[OK] time cost: " + span.ToString() + "ms, execute statement ====> " + sql.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
||||
public void ExecuteQuery(string sql)
|
||||
{
|
||||
|
||||
DateTime dt1 = DateTime.Now;
|
||||
long queryRows = 0;
|
||||
IntPtr res = TDengine.Query(conn, sql);
|
||||
if (res == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine(sql + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
}
|
||||
DateTime dt2 = DateTime.Now;
|
||||
TimeSpan span = dt2 - dt1;
|
||||
Console.WriteLine("[OK] time cost: " + span.ToString() + "ms, execute statement ====> " + sql.ToString());
|
||||
int fieldCount = TDengine.FieldCount(res);
|
||||
|
||||
List<TDengineMeta> metas = TDengine.FetchFields(res);
|
||||
for (int j = 0; j < metas.Count; j++)
|
||||
{
|
||||
TDengineMeta meta = (TDengineMeta)metas[j];
|
||||
}
|
||||
|
||||
IntPtr rowdata;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
while ((rowdata = TDengine.FetchRows(res)) != IntPtr.Zero)
|
||||
{
|
||||
queryRows++;
|
||||
for (int fields = 0; fields < fieldCount; ++fields)
|
||||
{
|
||||
TDengineMeta meta = metas[fields];
|
||||
int offset = IntPtr.Size * fields;
|
||||
IntPtr data = Marshal.ReadIntPtr(rowdata, offset);
|
||||
|
||||
builder.Append("---");
|
||||
|
||||
if (data == IntPtr.Zero)
|
||||
{
|
||||
builder.Append("NULL");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ((TDengineDataType)meta.type)
|
||||
{
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BOOL:
|
||||
bool v1 = Marshal.ReadByte(data) == 0 ? false : true;
|
||||
builder.Append(v1);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_TINYINT:
|
||||
byte v2 = Marshal.ReadByte(data);
|
||||
builder.Append(v2);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_SMALLINT:
|
||||
short v3 = Marshal.ReadInt16(data);
|
||||
builder.Append(v3);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_INT:
|
||||
int v4 = Marshal.ReadInt32(data);
|
||||
builder.Append(v4);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BIGINT:
|
||||
long v5 = Marshal.ReadInt64(data);
|
||||
builder.Append(v5);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_FLOAT:
|
||||
float v6 = (float)Marshal.PtrToStructure(data, typeof(float));
|
||||
builder.Append(v6);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_DOUBLE:
|
||||
double v7 = (double)Marshal.PtrToStructure(data, typeof(double));
|
||||
builder.Append(v7);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BINARY:
|
||||
string v8 = Marshal.PtrToStringAnsi(data);
|
||||
builder.Append(v8);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP:
|
||||
long v9 = Marshal.ReadInt64(data);
|
||||
builder.Append(v9);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_NCHAR:
|
||||
string v10 = Marshal.PtrToStringAnsi(data);
|
||||
builder.Append(v10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.Append("---");
|
||||
|
||||
if (queryRows <= 10)
|
||||
{
|
||||
Console.WriteLine(builder.ToString());
|
||||
}
|
||||
builder.Clear();
|
||||
}
|
||||
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.Write("Query is not complete, Error {0:G}", TDengine.ErrorNo(res), TDengine.Error(res));
|
||||
}
|
||||
|
||||
TDengine.FreeResult(res);
|
||||
|
||||
}
|
||||
|
||||
public void CloseConnection()
|
||||
{
|
||||
if (this.conn != IntPtr.Zero)
|
||||
{
|
||||
TDengine.Close(this.conn);
|
||||
Console.WriteLine("connection closed.");
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram()
|
||||
{
|
||||
TDengine.Cleanup();
|
||||
System.Environment.Exit(0);
|
||||
}
|
||||
tester.checkDropTable();
|
||||
|
||||
tester.CloseConnection();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public long GetArgumentAsLong(String[] argv, String argName, int minVal, int maxVal, int defaultValue)
|
||||
{
|
||||
int argc = argv.Length;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
if (argName != argv[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i < argc - 1)
|
||||
{
|
||||
String tmp = argv[i + 1];
|
||||
if (tmp[0] == '-')
|
||||
{
|
||||
Console.WriteLine("option {0:G} requires an argument", tmp);
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
long tmpVal = Convert.ToInt64(tmp);
|
||||
if (tmpVal < minVal || tmpVal > maxVal)
|
||||
{
|
||||
Console.WriteLine("option {0:G} should in range [{1:G}, {2:G}]", argName, minVal, maxVal);
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
return tmpVal;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String GetArgumentAsString(String[] argv, String argName, String defaultValue)
|
||||
{
|
||||
int argc = argv.Length;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
if (argName != argv[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i < argc - 1)
|
||||
{
|
||||
String tmp = argv[i + 1];
|
||||
if (tmp[0] == '-')
|
||||
{
|
||||
Console.WriteLine("option {0:G} requires an argument", tmp);
|
||||
ExitProgram();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void PrintHelp(String[] argv)
|
||||
{
|
||||
for (int i = 0; i < argv.Length; ++i)
|
||||
{
|
||||
if ("--help" == argv[i])
|
||||
{
|
||||
String indent = " ";
|
||||
Console.WriteLine("taosTest is simple example to operate TDengine use C# Language.\n");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-h");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "TDEngine server IP address to connect");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-u");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is root");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-p");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is taosdata");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-d");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Database used to create table or import data, default is db");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-s");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Super Tables used to create table, default is mt");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-t");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Table prefixs, default is t");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-w");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to insert data");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-r");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to query data");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-n");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many Tables to create, default is 10");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-b");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows per insert batch, default is 10");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-i");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows to insert, default is 100");
|
||||
Console.WriteLine("{0:G}{1:G}", indent, "-c");
|
||||
Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Configuration directory");
|
||||
|
||||
ExitProgram();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadArgument(String[] argv)
|
||||
{
|
||||
PrintHelp(argv);
|
||||
host = this.GetArgumentAsString(argv, "-h", "127.0.0.1");
|
||||
user = this.GetArgumentAsString(argv, "-u", "root");
|
||||
password = this.GetArgumentAsString(argv, "-p", "taosdata");
|
||||
dbName = this.GetArgumentAsString(argv, "-db", "test");
|
||||
tbName = this.GetArgumentAsString(argv, "-s", "weather");
|
||||
|
||||
isInsertData = this.GetArgumentAsLong(argv, "-w", 0, 1, 1) != 0;
|
||||
isQueryData = this.GetArgumentAsLong(argv, "-r", 0, 1, 1) != 0;
|
||||
tableCount = this.GetArgumentAsLong(argv, "-n", 1, 10000, 10);
|
||||
batchRows = this.GetArgumentAsLong(argv, "-b", 1, 1000, 500);
|
||||
totalRows = this.GetArgumentAsLong(argv, "-i", 1, 10000000, 10000);
|
||||
configDir = this.GetArgumentAsString(argv, "-c", "C:/TDengine/cfg");
|
||||
}
|
||||
|
||||
public void InitTDengine()
|
||||
{
|
||||
TDengine.Options((int)TDengineInitOption.TDDB_OPTION_CONFIGDIR, this.configDir);
|
||||
TDengine.Options((int)TDengineInitOption.TDDB_OPTION_SHELL_ACTIVITY_TIMER, "60");
|
||||
TDengine.Init();
|
||||
Console.WriteLine("get connection starting...");
|
||||
}
|
||||
|
||||
public void ConnectTDengine()
|
||||
{
|
||||
string db = "";
|
||||
this.conn = TDengine.Connect(this.host, this.user, this.password, db, this.port);
|
||||
if (this.conn == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("connection failed: " + this.host);
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("[ OK ] Connection established.");
|
||||
}
|
||||
}
|
||||
public void createDatabase()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("create database if not exists ").Append(this.dbName);
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void useDatabase()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("use ").Append(this.dbName);
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkSelect()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("select * from test.weather");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void createTable()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("create table if not exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("(ts timestamp, temperature float, humidity int)");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkInsert()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void checkDropTable()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("drop table if exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("");
|
||||
execute(sql.ToString());
|
||||
}
|
||||
public void execute(string sql)
|
||||
{
|
||||
DateTime dt1 = DateTime.Now;
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
DateTime dt2 = DateTime.Now;
|
||||
TimeSpan span = dt2 - dt1;
|
||||
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
||||
public void ExecuteQuery(string sql)
|
||||
{
|
||||
|
||||
DateTime dt1 = DateTime.Now;
|
||||
long queryRows = 0;
|
||||
IntPtr res = TDengine.Query(conn, sql);
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
DateTime dt2 = DateTime.Now;
|
||||
TimeSpan span = dt2 - dt1;
|
||||
Console.WriteLine("[OK] time cost: " + span.ToString() + "ms, execute statement ====> " + sql.ToString());
|
||||
int fieldCount = TDengine.FieldCount(res);
|
||||
|
||||
List<TDengineMeta> metas = TDengine.FetchFields(res);
|
||||
for (int j = 0; j < metas.Count; j++)
|
||||
{
|
||||
TDengineMeta meta = (TDengineMeta)metas[j];
|
||||
}
|
||||
|
||||
IntPtr rowdata;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
while ((rowdata = TDengine.FetchRows(res)) != IntPtr.Zero)
|
||||
{
|
||||
queryRows++;
|
||||
for (int fields = 0; fields < fieldCount; ++fields)
|
||||
{
|
||||
TDengineMeta meta = metas[fields];
|
||||
int offset = IntPtr.Size * fields;
|
||||
IntPtr data = Marshal.ReadIntPtr(rowdata, offset);
|
||||
|
||||
builder.Append("---");
|
||||
|
||||
if (data == IntPtr.Zero)
|
||||
{
|
||||
builder.Append("NULL");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ((TDengineDataType)meta.type)
|
||||
{
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BOOL:
|
||||
bool v1 = Marshal.ReadByte(data) == 0 ? false : true;
|
||||
builder.Append(v1);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_TINYINT:
|
||||
byte v2 = Marshal.ReadByte(data);
|
||||
builder.Append(v2);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_SMALLINT:
|
||||
short v3 = Marshal.ReadInt16(data);
|
||||
builder.Append(v3);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_INT:
|
||||
int v4 = Marshal.ReadInt32(data);
|
||||
builder.Append(v4);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BIGINT:
|
||||
long v5 = Marshal.ReadInt64(data);
|
||||
builder.Append(v5);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_FLOAT:
|
||||
float v6 = (float)Marshal.PtrToStructure(data, typeof(float));
|
||||
builder.Append(v6);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_DOUBLE:
|
||||
double v7 = (double)Marshal.PtrToStructure(data, typeof(double));
|
||||
builder.Append(v7);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_BINARY:
|
||||
string v8 = Marshal.PtrToStringAnsi(data);
|
||||
builder.Append(v8);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP:
|
||||
long v9 = Marshal.ReadInt64(data);
|
||||
builder.Append(v9);
|
||||
break;
|
||||
case TDengineDataType.TSDB_DATA_TYPE_NCHAR:
|
||||
string v10 = Marshal.PtrToStringAnsi(data);
|
||||
builder.Append(v10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.Append("---");
|
||||
|
||||
if (queryRows <= 10)
|
||||
{
|
||||
Console.WriteLine(builder.ToString());
|
||||
}
|
||||
builder.Clear();
|
||||
}
|
||||
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.Write("Query is not complete, Error {0:G}", TDengine.ErrorNo(res), TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
|
||||
TDengine.FreeResult(res);
|
||||
|
||||
}
|
||||
|
||||
public void CloseConnection()
|
||||
{
|
||||
if (this.conn != IntPtr.Zero)
|
||||
{
|
||||
TDengine.Close(this.conn);
|
||||
Console.WriteLine("connection closed.");
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitProgram()
|
||||
{
|
||||
TDengine.Cleanup();
|
||||
System.Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace TDengineDriver
|
|||
public void ReadArgument(String[] argv)
|
||||
{
|
||||
PrintHelp(argv);
|
||||
host = this.GetArgumentAsString(argv, "-h", "192.168.100.128");
|
||||
host = this.GetArgumentAsString(argv, "-h", "127.0.0.1");
|
||||
user = this.GetArgumentAsString(argv, "-u", "root");
|
||||
password = this.GetArgumentAsString(argv, "-p", "taosdata");
|
||||
dbName = this.GetArgumentAsString(argv, "-d", "db");
|
||||
|
@ -212,42 +212,54 @@ namespace TDengineDriver
|
|||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("create database if not exists ").Append(this.dbName);
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
|
||||
sql.Clear();
|
||||
sql.Append("use ").Append(this.dbName);
|
||||
res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
|
||||
sql.Clear();
|
||||
sql.Append("create table if not exists ").Append(this.stableName).Append("(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10)) tags(t1 int)");
|
||||
res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
|
||||
|
@ -257,14 +269,18 @@ namespace TDengineDriver
|
|||
sql = sql.Append("create table if not exists ").Append(this.tablePrefix).Append(i)
|
||||
.Append(" using ").Append(this.stableName).Append(" tags(").Append(i).Append(")");
|
||||
res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
ExitProgram();
|
||||
Console.WriteLine(sql.ToString() + " success");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
@ -298,9 +314,13 @@ namespace TDengineDriver
|
|||
.Append(", 5, 6, 7, 'abc', 'def')");
|
||||
}
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res == IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
|
||||
int affectRows = TDengine.AffectRows(res);
|
||||
|
@ -326,16 +346,20 @@ namespace TDengineDriver
|
|||
|
||||
System.DateTime start = new System.DateTime();
|
||||
long queryRows = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < 1/*this.tableCount*/; ++i)
|
||||
{
|
||||
String sql = "select * from " + this.dbName + "." + tablePrefix + i;
|
||||
Console.WriteLine(sql);
|
||||
|
||||
IntPtr res = TDengine.Query(conn, sql);
|
||||
if (res == IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql + " failure, reason: " + TDengine.Error(res));
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
ExitProgram();
|
||||
}
|
||||
|
||||
|
@ -439,8 +463,10 @@ namespace TDengineDriver
|
|||
|
||||
if (TDengine.ErrorNo(res) != 0)
|
||||
{
|
||||
Console.Write("Query is not complete, Error {0:G}", TDengine.ErrorNo(res), TDengine.Error(res));
|
||||
Console.Write("Query is not complete, Error {0:G}",
|
||||
TDengine.ErrorNo(res), TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
|
|
@ -370,16 +370,19 @@ namespace TDengineDriver
|
|||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("DROP DATABASE IF EXISTS ").Append(this.dbName);
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
CleanAndExitProgram(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
CleanAndExitProgram(1);
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CreateDb()
|
||||
|
@ -387,14 +390,18 @@ namespace TDengineDriver
|
|||
StringBuilder sql = new StringBuilder();
|
||||
sql.Append("CREATE DATABASE IF NOT EXISTS ").Append(this.dbName).Append(" replica ").Append(this.replica).Append(" keep 36500");
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
CleanAndExitProgram(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
CleanAndExitProgram(1);
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
@ -408,14 +415,18 @@ namespace TDengineDriver
|
|||
Append(this.dbName).Append(".").Append(this.stablePrefix).
|
||||
Append("(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned) tags(t1 int)");
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
CleanAndExitProgram(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res));
|
||||
CleanAndExitProgram(1);
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
@ -495,9 +506,13 @@ namespace TDengineDriver
|
|||
|
||||
IntPtr res = TDengine.Query(conn, sql);
|
||||
DebugPrintFormat("res: {0}\n", res);
|
||||
if (res == IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
Console.WriteLine(sql + " failure, reason: " + TDengine.Error(res));
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
CleanAndExitProgram(1);
|
||||
}
|
||||
|
||||
|
@ -782,9 +797,13 @@ namespace TDengineDriver
|
|||
}
|
||||
VerbosePrint(sql.ToString() + "\n");
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res == IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " failure, reason: " + TDengine.Error(res) + "\n");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
|
||||
inserted += this.batchRows;
|
||||
|
@ -861,14 +880,18 @@ namespace TDengineDriver
|
|||
sql = sql.Append("(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned)");
|
||||
}
|
||||
IntPtr res = TDengine.Query(this.conn, sql.ToString());
|
||||
if (res != IntPtr.Zero)
|
||||
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
Console.Write(sql.ToString() + " failure, ");
|
||||
if (res != IntPtr.Zero) {
|
||||
Console.Write("reason: " + TDengine.Error(res));
|
||||
}
|
||||
Console.WriteLine("");
|
||||
CleanAndExitProgram(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
VerbosePrint(sql.ToString() + " failure, reason: " + TDengine.Error(res) + "\n");
|
||||
CleanAndExitProgram(1);
|
||||
VerbosePrint(sql.ToString() + " success\n");
|
||||
}
|
||||
TDengine.FreeResult(res);
|
||||
}
|
||||
|
|
|
@ -435,11 +435,15 @@ void verify_async(TAOS* taos) {
|
|||
}
|
||||
|
||||
void stream_callback(void *param, TAOS_RES *res, TAOS_ROW row) {
|
||||
if (res == NULL || row == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
int num_fields = taos_num_fields(res);
|
||||
TAOS_FIELD* fields = taos_fetch_fields(res);
|
||||
|
||||
printf("got one row from stream_callback\n");
|
||||
char temp[256];
|
||||
char temp[256] = {0};
|
||||
taos_print_row(temp, row, fields, num_fields);
|
||||
puts(temp);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"database/sql"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"runtime"
|
||||
|
@ -26,8 +27,6 @@ import (
|
|||
"time"
|
||||
|
||||
_ "github.com/taosdata/driver-go/taosSql"
|
||||
|
||||
//"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -48,6 +47,7 @@ type config struct {
|
|||
dbName string
|
||||
supTblName string
|
||||
tablePrefix string
|
||||
mode string
|
||||
numOftables int
|
||||
numOfRecordsPerTable int
|
||||
numOfRecordsPerReq int
|
||||
|
@ -70,6 +70,7 @@ func init() {
|
|||
flag.StringVar(&configPara.password, "P", "taosdata", "The password to use when connecting to the server.")
|
||||
flag.StringVar(&configPara.dbName, "d", "test", "Destination database.")
|
||||
flag.StringVar(&configPara.tablePrefix, "m", "d", "Table prefix name.")
|
||||
flag.StringVar(&configPara.mode, "M", "r", "mode,r:raw,s:stmt")
|
||||
flag.IntVar(&configPara.numOftables, "t", 2, "The number of tables.")
|
||||
flag.IntVar(&configPara.numOfRecordsPerTable, "n", 10, "The number of records per table.")
|
||||
flag.IntVar(&configPara.numOfRecordsPerReq, "r", 3, "The number of records per request.")
|
||||
|
@ -94,6 +95,7 @@ func printAllArgs() {
|
|||
fmt.Printf("usr: %v\n", configPara.user)
|
||||
fmt.Printf("password: %v\n", configPara.password)
|
||||
fmt.Printf("dbName: %v\n", configPara.dbName)
|
||||
fmt.Printf("mode: %v\n", configPara.mode)
|
||||
fmt.Printf("tablePrefix: %v\n", configPara.tablePrefix)
|
||||
fmt.Printf("numOftables: %v\n", configPara.numOftables)
|
||||
fmt.Printf("numOfRecordsPerTable: %v\n", configPara.numOfRecordsPerTable)
|
||||
|
@ -119,6 +121,24 @@ func main() {
|
|||
//defer db.Close()
|
||||
rand.Seed(time.Now().Unix())
|
||||
|
||||
if configPara.mode == "s" {
|
||||
fmt.Printf("\n======== start stmt mode test ========\n")
|
||||
db, err := sql.Open("taosSql", url)
|
||||
if err != nil {
|
||||
log.Fatalf("Open database error: %s\n", err)
|
||||
}
|
||||
defer db.Close()
|
||||
demodbStmt := configPara.dbName
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
||||
createDatabase(configPara.dbName, configPara.supTblName)
|
||||
fmt.Printf("======== create database success! ========\n\n")
|
||||
|
||||
|
@ -407,6 +427,132 @@ func selectTest(dbName string, tbPrefix string, supTblName string) {
|
|||
checkErr(err, "rows next iteration error")
|
||||
}
|
||||
}
|
||||
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("insert 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)
|
||||
|
|
|
@ -64,7 +64,7 @@ function runQueryPerfTest {
|
|||
[ -f $PERFORMANCE_TEST_REPORT ] && rm $PERFORMANCE_TEST_REPORT
|
||||
nohup $WORK_DIR/TDengine/debug/build/bin/taosd -c /etc/taosperf/ > /dev/null 2>&1 &
|
||||
echoInfo "Wait TDengine to start"
|
||||
sleep 120
|
||||
sleep 300
|
||||
echoInfo "Run Performance Test"
|
||||
cd $WORK_DIR/TDengine/tests/pytest
|
||||
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
from util.dnodes import *
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to execute {__file__}")
|
||||
tdSql.init(conn.cursor(), logSql)
|
||||
|
||||
def run(self):
|
||||
tdSql.execute("drop database if exists db")
|
||||
tdSql.execute("create database if not exists db keep 36500")
|
||||
tdSql.execute("use db")
|
||||
|
||||
tdLog.printNoPrefix("==========step1:create table && insert data")
|
||||
tdSql.execute("create table stbtag (ts timestamp, c1 int) TAGS(t1 int)")
|
||||
tdSql.execute("create table tag1 using stbtag tags(1)")
|
||||
|
||||
tdLog.printNoPrefix("==========step2:alter stb add tag create new chiltable")
|
||||
tdSql.execute("alter table stbtag add tag t2 int")
|
||||
tdSql.execute("alter table stbtag add tag t3 tinyint")
|
||||
tdSql.execute("alter table stbtag add tag t4 smallint ")
|
||||
tdSql.execute("alter table stbtag add tag t5 bigint")
|
||||
tdSql.execute("alter table stbtag add tag t6 float ")
|
||||
tdSql.execute("alter table stbtag add tag t7 double ")
|
||||
tdSql.execute("alter table stbtag add tag t8 bool ")
|
||||
tdSql.execute("alter table stbtag add tag t9 binary(10) ")
|
||||
tdSql.execute("alter table stbtag add tag t10 nchar(10)")
|
||||
|
||||
tdSql.execute("create table tag2 using stbtag tags(2, 22, 23, 24, 25, 26.1, 27.1, 1, 'binary9', 'nchar10')")
|
||||
tdSql.query( "select tbname, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 from stbtag" )
|
||||
tdSql.checkData(1, 0, "tag2")
|
||||
tdSql.checkData(1, 1, 2)
|
||||
tdSql.checkData(1, 2, 22)
|
||||
tdSql.checkData(1, 3, 23)
|
||||
tdSql.checkData(1, 4, 24)
|
||||
tdSql.checkData(1, 5, 25)
|
||||
tdSql.checkData(1, 6, 26.1)
|
||||
tdSql.checkData(1, 7, 27.1)
|
||||
tdSql.checkData(1, 8, 1)
|
||||
tdSql.checkData(1, 9, "binary9")
|
||||
tdSql.checkData(1, 10, "nchar10")
|
||||
|
||||
tdLog.printNoPrefix("==========step3:alter stb drop tag create new chiltable")
|
||||
tdSql.execute("alter table stbtag drop tag t2 ")
|
||||
tdSql.execute("alter table stbtag drop tag t3 ")
|
||||
tdSql.execute("alter table stbtag drop tag t4 ")
|
||||
tdSql.execute("alter table stbtag drop tag t5 ")
|
||||
tdSql.execute("alter table stbtag drop tag t6 ")
|
||||
tdSql.execute("alter table stbtag drop tag t7 ")
|
||||
tdSql.execute("alter table stbtag drop tag t8 ")
|
||||
tdSql.execute("alter table stbtag drop tag t9 ")
|
||||
tdSql.execute("alter table stbtag drop tag t10 ")
|
||||
|
||||
tdSql.execute("create table tag3 using stbtag tags(3)")
|
||||
tdSql.query("select * from stbtag where tbname like 'tag3' ")
|
||||
tdSql.checkCols(3)
|
||||
tdSql.query("select tbname, t1 from stbtag where tbname like 'tag3' ")
|
||||
tdSql.checkData(0, 1, 3)
|
||||
|
||||
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,73 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
from util.dnodes import *
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to execute {__file__}")
|
||||
tdSql.init(conn.cursor(), logSql)
|
||||
|
||||
def run(self):
|
||||
tdSql.execute("drop database if exists db")
|
||||
tdSql.execute("create database if not exists db keep 36500")
|
||||
tdSql.execute("use db")
|
||||
|
||||
tdLog.printNoPrefix("==========step1:create table && insert data")
|
||||
# timestamp list:
|
||||
# 0 -> "1970-01-01 08:00:00" | -28800000 -> "1970-01-01 00:00:00" | -946800000000 -> "1940-01-01 00:00:00"
|
||||
# -631180800000 -> "1950-01-01 00:00:00"
|
||||
ts1 = 0
|
||||
ts2 = -28800000
|
||||
ts3 = -946800000000
|
||||
ts4 = "1950-01-01 00:00:00"
|
||||
tdSql.execute(
|
||||
"create table stb2ts (ts timestamp, ts1 timestamp, ts2 timestamp, c1 int, ts3 timestamp) TAGS(t1 int)"
|
||||
)
|
||||
tdSql.execute("create table t2ts1 using stb2ts tags(1)")
|
||||
|
||||
tdSql.execute(f"insert into t2ts1 values ({ts1}, {ts1}, {ts1}, 1, {ts1})")
|
||||
tdSql.execute(f"insert into t2ts1 values ({ts2}, {ts2}, {ts2}, 2, {ts2})")
|
||||
tdSql.execute(f"insert into t2ts1 values ({ts3}, {ts3}, {ts3}, 4, {ts3})")
|
||||
tdSql.execute(f"insert into t2ts1 values ('{ts4}', '{ts4}', '{ts4}', 3, '{ts4}')")
|
||||
|
||||
tdLog.printNoPrefix("==========step2:check inserted data")
|
||||
tdSql.query("select * from stb2ts where ts1=0 and ts2='1970-01-01 08:00:00' ")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 4,'1970-01-01 08:00:00')
|
||||
|
||||
tdSql.query("select * from stb2ts where ts1=-28800000 and ts2='1970-01-01 00:00:00' ")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 4, '1970-01-01 00:00:00')
|
||||
|
||||
tdSql.query("select * from stb2ts where ts1=-946800000000 and ts2='1940-01-01 00:00:00' ")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 4, '1940-01-01 00:00:00')
|
||||
|
||||
tdSql.query("select * from stb2ts where ts1=-631180800000 and ts2='1950-01-01 00:00:00' ")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 4, '1950-01-01 00:00:00')
|
||||
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -219,6 +219,10 @@ python3 ./test.py -f query/bug3351.py
|
|||
python3 ./test.py -f query/bug3375.py
|
||||
python3 ./test.py -f query/queryJoin10tables.py
|
||||
python3 ./test.py -f query/queryStddevWithGroupby.py
|
||||
python3 ./test.py -f query/querySecondtscolumnTowherenow.py
|
||||
python3 ./test.py -f query/queryFilterTswithDateUnit.py
|
||||
|
||||
|
||||
|
||||
#stream
|
||||
python3 ./test.py -f stream/metric_1.py
|
||||
|
@ -234,6 +238,8 @@ python3 ./test.py -f stream/table_n.py
|
|||
|
||||
#alter table
|
||||
python3 ./test.py -f alter/alter_table_crash.py
|
||||
python3 ./test.py -f alter/alterTabAddTagWithNULL.py
|
||||
python3 ./test.py -f alter/alterTimestampColDataProcess.py
|
||||
|
||||
# client
|
||||
python3 ./test.py -f client/client.py
|
||||
|
@ -303,6 +309,11 @@ python3 ./test.py -f insert/unsignedSmallint.py
|
|||
python3 ./test.py -f insert/unsignedTinyint.py
|
||||
python3 ./test.py -f query/filterAllUnsignedIntTypes.py
|
||||
|
||||
python3 ./test.py -f tag_lite/unsignedInt.py
|
||||
python3 ./test.py -f tag_lite/unsignedBigint.py
|
||||
python3 ./test.py -f tag_lite/unsignedSmallint.py
|
||||
python3 ./test.py -f tag_lite/unsignedTinyint.py
|
||||
|
||||
python3 ./test.py -f functions/function_percentile2.py
|
||||
python3 ./test.py -f insert/boundary2.py
|
||||
python3 ./test.py -f alter/alter_debugFlag.py
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
from util.dnodes import *
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to execute {__file__}")
|
||||
tdSql.init(conn.cursor(), logSql)
|
||||
|
||||
def insertnow(self, tsp1, tsp2, tsp3):
|
||||
|
||||
tdSql.execute(
|
||||
"create table stbts (ts timestamp, ts1 timestamp, c1 int, ts2 timestamp) TAGS(t1 int)"
|
||||
)
|
||||
tdSql.execute("create table tts1 using stbts tags(1)")
|
||||
|
||||
tdSql.execute("insert into tts1 values (now+1d, now+1d, 6, now+1d)")
|
||||
tdSql.execute("insert into tts1 values (now, now, 5, now)")
|
||||
tdSql.execute("insert into tts1 values (now-1d, now-1d, 4, now-1d)")
|
||||
tdSql.execute(f"insert into tts1 values ({tsp1}, {tsp1}, 3, {tsp1})")
|
||||
tdSql.execute(f"insert into tts1 values ({tsp2}, {tsp2}, 2, {tsp2})")
|
||||
tdSql.execute(f"insert into tts1 values ({tsp3}, {tsp3}, 1, {tsp3})")
|
||||
|
||||
|
||||
def querynow(self):
|
||||
|
||||
tdLog.printNoPrefix("==========step query: execute query operation")
|
||||
time.sleep(1)
|
||||
|
||||
cols = ["ts", "ts1", "ts2"]
|
||||
|
||||
for col in cols:
|
||||
tdSql.error(f" select * from tts1 where {col} = 1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1d ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1m ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1m ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1m ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1m ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1m ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1m ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1s ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1s ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1s ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1s ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1s ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1s ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1a ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1h ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1w ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1w ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1w ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1w ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1w ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1w ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1u ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 0d ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 0s ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 0a ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 0m ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 0h ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 0u ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 0w ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1m+1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1w-1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 0a/1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1d/0s ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1s*1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 0w/0d ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1m+1h ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1w-1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 0a/1u ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1d/0s ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1s*1a ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 0w/0d ")
|
||||
|
||||
tdSql.error(f" select * from tts1 where {col} = 1u+1 ")
|
||||
tdSql.error(f" select * from tts1 where {col} < 1a-1 ")
|
||||
tdSql.error(f" select * from tts1 where {col} > 1s*1 ")
|
||||
tdSql.error(f" select * from tts1 where {col} >= 1m/1 ")
|
||||
tdSql.error(f" select * from tts1 where {col} <= 1h/0 ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 0/1d ")
|
||||
tdSql.error(f" select * from tts1 where {col} <> 1w+'2010-01-01 00:00:00' ")
|
||||
|
||||
|
||||
def run(self):
|
||||
tdSql.execute("drop database if exists dbms")
|
||||
tdSql.execute("drop database if exists dbus")
|
||||
|
||||
# timestamp list:
|
||||
# 0 -> "1970-01-01 08:00:00" | -28800000 -> "1970-01-01 00:00:00" | -946800000000 -> "1940-01-01 00:00:00"
|
||||
# -631180800000 -> "1950-01-01 00:00:00"
|
||||
|
||||
tdLog.printNoPrefix("==========step1:create table precision ms && insert data && query")
|
||||
# create databases precision is ms
|
||||
tdSql.execute("create database if not exists dbms keep 36500")
|
||||
tdSql.execute("use dbms")
|
||||
tsp1 = 0
|
||||
tsp2 = -28800000
|
||||
tsp3 = -946800000000
|
||||
self.insertnow(tsp1,tsp2,tsp3)
|
||||
self.querynow()
|
||||
|
||||
tdLog.printNoPrefix("==========step2:create table precision us && insert data && query")
|
||||
# create databases precision is us
|
||||
tdSql.execute("create database if not exists dbus keep 36500 precision 'us' ")
|
||||
tdSql.execute("use dbus")
|
||||
tsp2 = -28800000 * 1000
|
||||
tsp3 = -946800000000 * 1000
|
||||
self.insertnow(tsp1,tsp2,tsp3)
|
||||
self.querynow()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -16,7 +16,7 @@ import taos
|
|||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
|
||||
from util.dnodes import *
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
|
@ -122,6 +122,32 @@ class TDTestCase:
|
|||
tdSql.query("SELECT server_status()")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
# https://jira.taosdata.com:18080/browse/TD-3800
|
||||
tdSql.execute("create table m1(ts timestamp, k int) tags(a int)")
|
||||
tdSql.execute("create table tm0 using m1 tags(1)")
|
||||
tdSql.execute("create table tm1 using m1 tags(2)")
|
||||
tdSql.execute("insert into tm0 values('2020-3-1 1:1:1', 112)")
|
||||
tdSql.execute("insert into tm1 values('2020-1-1 1:1:1', 1)('2020-3-1 0:1:1', 421)")
|
||||
|
||||
tdSql.query("select last(*) from m1 group by tbname")
|
||||
tdSql.checkData(0, 0, "2020-03-01 01:01:01")
|
||||
tdSql.checkData(0, 1, 112)
|
||||
tdSql.checkData(0, 2, "tm0")
|
||||
tdSql.checkData(1, 0, "2020-03-01 00:01:01")
|
||||
tdSql.checkData(1, 1, 421)
|
||||
tdSql.checkData(1, 2, "tm1")
|
||||
|
||||
tdDnodes.stop(1)
|
||||
tdDnodes.start(1)
|
||||
|
||||
tdSql.query("select last(*) from m1 group by tbname")
|
||||
tdSql.checkData(0, 0, "2020-03-01 01:01:01")
|
||||
tdSql.checkData(0, 1, 112)
|
||||
tdSql.checkData(0, 2, "tm0")
|
||||
tdSql.checkData(1, 0, "2020-03-01 00:01:01")
|
||||
tdSql.checkData(1, 1, 421)
|
||||
tdSql.checkData(1, 2, "tm1")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success("%s successfully executed" % __file__)
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
###################################################################
|
||||
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is proprietary and confidential to TAOS Technologies.
|
||||
# No part of this file may be reproduced, stored, transmitted,
|
||||
# disclosed or used in any form or by any means other than as
|
||||
# expressly provided by the written permission from Jianhui Tao
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
from util.dnodes import *
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to execute {__file__}")
|
||||
tdSql.init(conn.cursor(), logSql)
|
||||
|
||||
def run(self):
|
||||
tdSql.execute("drop database if exists db")
|
||||
tdSql.execute("create database if not exists db keep 36500")
|
||||
tdSql.execute("use db")
|
||||
|
||||
tdLog.printNoPrefix("==========step1:create table && insert data")
|
||||
# timestamp list:
|
||||
# 0->"1970-01-01 08:00:00" | -28800000->"1970-01-01 00:00:00" | -946800000000->"1940-01-01 00:00:00"
|
||||
ts1 = 0
|
||||
ts2 = -28800000
|
||||
ts3 = -946800000000
|
||||
tdSql.execute(
|
||||
"create table stb2ts (ts timestamp, ts1 timestamp, ts2 timestamp, c1 int, ts3 timestamp) TAGS(t1 int)"
|
||||
)
|
||||
tdSql.execute("create table t2ts1 using stb2ts tags(1)")
|
||||
|
||||
tdSql.execute("insert into t2ts1 values (now, now, now, 1, now)")
|
||||
tdSql.execute("insert into t2ts1 values (now-1m, now-1m, now-1m, 1, now-1m)")
|
||||
tdSql.execute(f"insert into t2ts1 values ({ts1}, {ts1}, {ts1}, 1, {ts1})")
|
||||
# tdSql.execute(f"insert into t2ts1 values ({ts2}, {ts2}, {ts2}, 1, {ts2})")
|
||||
# tdSql.execute(f"insert into t2ts1 values ({ts3}, {ts3}, {ts3}, 1, {ts3})")
|
||||
|
||||
tdLog.printNoPrefix("==========step2:query")
|
||||
time.sleep(1)
|
||||
# query primary key timestamp column
|
||||
tdSql.execute("select * from t2ts1 where ts < now")
|
||||
ts_len1 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts <= now")
|
||||
ts_len2 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts > now")
|
||||
ts_len3 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts >= now")
|
||||
ts_len4 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts = now")
|
||||
ts_len5 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts <> now")
|
||||
ts_len6 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts between 0 and now")
|
||||
ts_len7 = len(tdSql.cursor.fetchall())
|
||||
tdSql.execute("select * from t2ts1 where ts between now and now+100d")
|
||||
ts_len8 = len(tdSql.cursor.fetchall())
|
||||
|
||||
# query noemal timestamp column
|
||||
tdSql.query("select * from t2ts1 where ts1 < now")
|
||||
tdSql.checkRows(ts_len1)
|
||||
tdSql.query("select * from t2ts1 where ts2 < now")
|
||||
tdSql.checkRows(ts_len1)
|
||||
tdSql.query("select * from t2ts1 where ts3 < now")
|
||||
tdSql.checkRows(ts_len1)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 <= now")
|
||||
tdSql.checkRows(ts_len2)
|
||||
tdSql.query("select * from t2ts1 where ts2 <= now")
|
||||
tdSql.checkRows(ts_len2)
|
||||
tdSql.query("select * from t2ts1 where ts3 <= now")
|
||||
tdSql.checkRows(ts_len2)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 > now")
|
||||
tdSql.checkRows(ts_len3)
|
||||
tdSql.query("select * from t2ts1 where ts2 > now")
|
||||
tdSql.checkRows(ts_len3)
|
||||
tdSql.query("select * from t2ts1 where ts3 > now")
|
||||
tdSql.checkRows(ts_len3)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 >= now")
|
||||
tdSql.checkRows(ts_len4)
|
||||
tdSql.query("select * from t2ts1 where ts2 >= now")
|
||||
tdSql.checkRows(ts_len4)
|
||||
tdSql.query("select * from t2ts1 where ts3 >= now")
|
||||
tdSql.checkRows(ts_len4)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 = now")
|
||||
tdSql.checkRows(ts_len5)
|
||||
tdSql.query("select * from t2ts1 where ts2 = now")
|
||||
tdSql.checkRows(ts_len5)
|
||||
tdSql.query("select * from t2ts1 where ts2 = now")
|
||||
tdSql.checkRows(ts_len5)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 <> now")
|
||||
tdSql.checkRows(ts_len6)
|
||||
tdSql.query("select * from t2ts1 where ts2 <> now")
|
||||
tdSql.checkRows(ts_len6)
|
||||
tdSql.query("select * from t2ts1 where ts3 <> now")
|
||||
tdSql.checkRows(ts_len6)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 between 0 and now")
|
||||
tdSql.checkRows(ts_len7)
|
||||
tdSql.query("select * from t2ts1 where ts2 between 0 and now")
|
||||
tdSql.checkRows(ts_len7)
|
||||
tdSql.query("select * from t2ts1 where ts3 between 0 and now")
|
||||
tdSql.checkRows(ts_len7)
|
||||
|
||||
tdSql.query("select * from t2ts1 where ts1 between now and now+100d")
|
||||
tdSql.checkRows(ts_len8)
|
||||
tdSql.query("select * from t2ts1 where ts2 between now and now+100d")
|
||||
tdSql.checkRows(ts_len8)
|
||||
tdSql.query("select * from t2ts1 where ts3 between now and now+100d")
|
||||
tdSql.checkRows(ts_len8)
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -42,7 +42,7 @@ class TDTestCase:
|
|||
|
||||
tdLog.info("=============== step3")
|
||||
start = time.time()
|
||||
tdSql.waitedQuery("select * from st", 1, 120)
|
||||
tdSql.waitedQuery("select * from st", 1, 180)
|
||||
delay = int(time.time() - start) + 80
|
||||
v = tdSql.getData(0, 3)
|
||||
if v >= 51:
|
||||
|
|
|
@ -88,6 +88,8 @@ class TDTestCase:
|
|||
except Exception as e:
|
||||
tdLog.info(repr(e))
|
||||
|
||||
|
||||
time.sleep(5)
|
||||
tdSql.query("show streams")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 2, 's0')
|
||||
|
@ -146,6 +148,7 @@ class TDTestCase:
|
|||
except Exception as e:
|
||||
tdLog.info(repr(e))
|
||||
|
||||
time.sleep(5)
|
||||
tdSql.query("show streams")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 2, 's1')
|
||||
|
|
|
@ -47,7 +47,7 @@ class TDTestCase:
|
|||
"select * from iostrm",
|
||||
]
|
||||
for sql in sqls:
|
||||
(rows, _) = tdSql.waitedQuery(sql, 1, 120)
|
||||
(rows, _) = tdSql.waitedQuery(sql, 1, 240)
|
||||
if rows < 1:
|
||||
tdLog.exit("failed: sql:%s, expect at least one row" % sql)
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ class TDTestCase:
|
|||
|
||||
print("alter table test.meters add column col10 int")
|
||||
tdSql.execute("alter table test.meters add column col10 int")
|
||||
print("insert into test.t9 values (now, 1, 2, 3, 4, 0.1, 0.01,'test', '测试', TRUE, 1610000000000, 0)")
|
||||
tdSql.execute("insert into test.t9 values (now, 1, 2, 3, 4, 0.1, 0.01,'test', '测试', TRUE, 1610000000000, 0)")
|
||||
print("insert into test.t9 values (now, 1, 2, 3, 4, 0)")
|
||||
tdSql.execute("insert into test.t9 values (now, 1, 2, 3, 4, 0)")
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
|
|
|
@ -87,6 +87,7 @@ class TDSql:
|
|||
self.queryResult = self.cursor.fetchall()
|
||||
self.queryRows = len(self.queryResult)
|
||||
self.queryCols = len(self.cursor.description)
|
||||
tdLog.info("sql: %s, try to retrieve %d rows,get %d rows" % (sql, expectRows, self.queryRows))
|
||||
if self.queryRows >= expectRows:
|
||||
return (self.queryRows, i)
|
||||
time.sleep(1)
|
||||
|
@ -105,6 +106,14 @@ class TDSql:
|
|||
args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectRows)
|
||||
tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args)
|
||||
|
||||
def checkCols(self, expectCols):
|
||||
if self.queryCols == expectCols:
|
||||
tdLog.info("sql:%s, queryCols:%d == expect:%d" % (self.sql, self.queryCols, expectCols))
|
||||
else:
|
||||
caller = inspect.getframeinfo(inspect.stack()[1][0])
|
||||
args = (caller.filename, caller.lineno, self.sql, self.queryCols, expectCols)
|
||||
tdLog.exit("%s(%d) failed: sql:%s, queryCols:%d != expect:%d" % args)
|
||||
|
||||
def checkRowCol(self, row, col):
|
||||
caller = inspect.getframeinfo(inspect.stack()[2][0])
|
||||
if row < 0:
|
||||
|
|
|
@ -269,4 +269,50 @@ if $data14 != @test2@ then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql drop table stest
|
||||
sql drop table stest
|
||||
|
||||
print ===================>td-3779
|
||||
sql create table m1(ts timestamp, k int) tags(a int);
|
||||
sql create table tm0 using m1 tags(1);
|
||||
sql create table tm1 using m1 tags(2);
|
||||
sql insert into tm0 values('2020-3-1 1:1:1', 112);
|
||||
sql insert into tm1 values('2020-1-1 1:1:1', 1)('2020-3-1 0:1:1', 421);
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
sleep 1000
|
||||
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
print ================== server restart completed
|
||||
sleep 1000
|
||||
sql connect
|
||||
sql use first_db0;
|
||||
|
||||
sql select last(*) from m1 group by tbname;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != @20-03-01 01:01:01.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 112 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != @tm0@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data10 != @20-03-01 00:01:01.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data11 != 421 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data12 != @tm1@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql drop table m1
|
|
@ -160,7 +160,7 @@ if $data03 != @abc15@ then
|
|||
endi
|
||||
|
||||
sql select top(c6, 3) from select_tags_mt0 interval(10a)
|
||||
sql select top(c3,10) from select_tags_mt0 interval(10a) group by tbname
|
||||
sql select top(c3,10) from select_tags_mt0 interval(10a) group by tbname,t1,t2
|
||||
sql select top(c6, 3) from select_tags_mt0 interval(10a) group by tbname;
|
||||
|
||||
sql select top(c6, 10) from select_tags_mt0 interval(10a);
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
system sh/stop_dnodes.sh
|
||||
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/cfg.sh -n dnode1 -c walLevel -v 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
sleep 2000
|
||||
sql connect
|
||||
|
||||
print ======================== dnode1 start
|
||||
|
||||
$dbPrefix = s3_db
|
||||
$tbPrefix = s3_tb
|
||||
$mtPrefix = s3_mt
|
||||
$stPrefix = s3_st
|
||||
$tbNum = 10
|
||||
$rowNum = 20
|
||||
$totalNum = 200
|
||||
|
||||
print =============== step1
|
||||
$i = 0
|
||||
$db = $dbPrefix . $i
|
||||
$mt = $mtPrefix . $i
|
||||
$st = $stPrefix . $i
|
||||
|
||||
sql drop databae $db -x step1
|
||||
step1:
|
||||
sql create database $db keep 36500
|
||||
sql use $db
|
||||
sql create stable $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
|
||||
|
||||
sql create table cq1 as select count(*) from $mt interval(10s);
|
||||
|
||||
sleep 1000
|
||||
|
||||
sql create table $st using $mt tags(1);
|
||||
|
||||
sql insert into $st values (-50000, 1, 1.0);
|
||||
sql insert into $st values (-10000, 1, 1.0);
|
||||
sql insert into $st values (10000, 1, 1.0);
|
||||
|
||||
|
||||
$i = 0
|
||||
while $i < 12
|
||||
sql select * from cq1;
|
||||
|
||||
if $rows != 3 then
|
||||
sleep 10000
|
||||
else
|
||||
if $data00 != @70-01-01 07:59:10.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @70-01-01 07:59:50.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != @70-01-01 08:00:10.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 1 then
|
||||
return -1
|
||||
endi
|
||||
$i = 12
|
||||
endi
|
||||
|
||||
$i = $i + 1
|
||||
endw
|
||||
|
|
@ -164,7 +164,6 @@ void *simExecuteScript(void *inputScript) {
|
|||
}
|
||||
|
||||
if (script->killed || script->linePos >= script->numOfLines) {
|
||||
printf("killed ---------------------->\n");
|
||||
script = simProcessCallOver(script);
|
||||
if (script == NULL) {
|
||||
printf("abort now!\n");
|
||||
|
|
Loading…
Reference in New Issue