[td-225]merge develop.
This commit is contained in:
commit
2df82f06a1
|
@ -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)
|
||||
|
|
|
@ -32,7 +32,7 @@ ELSEIF (TD_WINDOWS)
|
|||
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
|
||||
#INSTALL(TARGETS shell RUNTIME DESTINATION .)
|
||||
IF (TD_MVN_INSTALLED)
|
||||
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.27-dist.jar DESTINATION connector/jdbc)
|
||||
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.28-dist.jar DESTINATION connector/jdbc)
|
||||
ENDIF ()
|
||||
ELSEIF (TD_DARWIN)
|
||||
SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh")
|
||||
|
|
|
@ -144,7 +144,7 @@ TDengine集群中加入一个新的dnode时,涉及集群相关的一些参数
|
|||
- numOfMnodes:系统中管理节点个数。默认值:3。
|
||||
- balance:是否启动负载均衡。0:否,1:是。默认值:1。
|
||||
- mnodeEqualVnodeNum: 一个mnode等同于vnode消耗的个数。默认值:4。
|
||||
- offlineThreshold: dnode离线阈值,超过该时间将导致该dnode从集群中删除。单位为秒,默认值:86400*10(即10天)。
|
||||
- offlineThreshold: dnode离线阈值,超过该时间将导致该dnode从集群中删除。单位为秒,默认值:86400*100(即100天)。
|
||||
- statusInterval: dnode向mnode报告状态时长。单位为秒,默认值:1。
|
||||
- maxTablesPerVnode: 每个vnode中能够创建的最大表个数。默认值:1000000。
|
||||
- maxVgroupsPerDb: 每个数据库中能够使用的最大vgroup个数。
|
||||
|
|
|
@ -48,15 +48,15 @@ TDengine 缺省的时间戳是毫秒精度,但通过修改配置参数 enableM
|
|||
| 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63 用于 NULL |
|
||||
| 4 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] |
|
||||
| 5 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] |
|
||||
| 6 | BINARY | 自定义 | 用于记录 ASCII 型字符串。理论上,最长可以有 16374 字节,但由于每行数据最多 16K 字节,实际上限一般小于理论值。 binary 仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如 binary(20) 定义了最长为 20 个字符的字符串,每个字符占 1 byte 的存储空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。 |
|
||||
| 6 | BINARY | 自定义 | 记录二进制字节型字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 nchar。理论上,最长可以有 16374 字节,但由于每行数据最多 16K 字节,实际上限一般小于理论值。binary 仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如 binary(20) 定义了最长为 20 个字节型字符的字符串,每个字节型字符占 1 byte 的存储空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。 |
|
||||
| 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768 用于 NULL |
|
||||
| 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128 用于 NULL |
|
||||
| 9 | BOOL | 1 | 布尔型,{true, false} |
|
||||
| 10 | NCHAR | 自定义 | 用于记录非 ASCII 型字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 |
|
||||
| 10 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 |
|
||||
|
||||
**Tips**:
|
||||
1. TDengine 对 SQL 语句中的英文字符不区分大小写,自动转化为小写执行。因此用户大小写敏感的字符串及密码,需要使用单引号将字符串引起来。
|
||||
2. 应避免使用 BINARY 类型来保存非 ASCII 型的字符串,会很容易导致数据乱码等错误。正确的做法是使用 NCHAR 类型来保存中文字符。
|
||||
2. **注意**,虽然 Binary 类型在底层存储上支持字节型的二进制字符,但不同编程语言对二进制数据的处理方式并不保证一致,因此建议在 Binary 类型中只存储 ASCII 可见字符,而避免存储不可见字符。多字节的数据,例如中文字符,则需要使用 nchar 类型进行保存。如果强行使用 Binary 类型保存中文字符,虽然有时也能正常读写,但并不带有字符集信息,很容易出现数据乱码甚至数据损坏。
|
||||
|
||||
## <a class="anchor" id="management"></a>数据库管理
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ TDengine 目前尚不支持删除功能,未来根据用户需求可能会支
|
|||
|
||||
批量插入。每条写入语句可以一张表同时插入多条记录,也可以同时插入多张表的多条记录。
|
||||
|
||||
## 12. 最有效的写入数据的方法是什么?windows系统下插入的nchar类数据中的汉字被解析成了乱码如何解决?
|
||||
## 12. windows系统下插入的nchar类数据中的汉字被解析成了乱码如何解决?
|
||||
|
||||
Windows下插入nchar类的数据中如果有中文,请先确认系统的地区设置成了中国(在Control Panel里可以设置),这时cmd中的`taos`客户端应该已经可以正常工作了;如果是在IDE里开发Java应用,比如Eclipse, Intellij,请确认IDE里的文件编码为GBK(这是Java默认的编码类型),然后在生成Connection时,初始化客户端的配置,具体语句如下:
|
||||
```JAVA
|
||||
|
|
|
@ -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 = tscGetQueryInfo(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) {
|
||||
|
@ -490,7 +490,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);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,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;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,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;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
|
|||
pMerger->numOfVnode = numOfBuffer;
|
||||
|
||||
pMerger->pDesc = pDesc;
|
||||
tscDebug("%p the number of merged leaves is: %d", pSql, pMerger->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) {
|
||||
|
@ -194,7 +194,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);
|
||||
|
@ -208,7 +208,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;
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ void tscDestroyLocalMerger(SSqlObj *pSql) {
|
|||
|
||||
free(pLocalMerge);
|
||||
|
||||
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) {
|
||||
|
|
|
@ -1095,7 +1095,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;
|
||||
|
@ -1309,7 +1309,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);
|
||||
|
|
|
@ -1663,7 +1663,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
|
|||
}
|
||||
|
||||
if (pQueryInfo->fieldsInfo.numOfOutput > TSDB_MAX_COLUMNS) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL;
|
||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3086,7 +3086,7 @@ static SColumnFilterInfo* addColumnFilterInfo(SColumnFilterList* filterList) {
|
|||
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";
|
||||
|
||||
|
@ -3101,6 +3101,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;
|
||||
|
@ -3926,6 +3932,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;
|
||||
|
||||
|
@ -3963,6 +3973,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);
|
||||
}
|
||||
|
||||
|
@ -5547,15 +5565,15 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseI
|
|||
pQueryInfo->clauseLimit = pQueryInfo->limit.limit;
|
||||
pQueryInfo->slimit = pSqlNode->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;
|
||||
}
|
||||
|
@ -5577,7 +5595,7 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseI
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -5595,7 +5613,7 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseI
|
|||
|
||||
// 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;
|
||||
}
|
||||
|
@ -6357,7 +6375,7 @@ void tscPrintSelNodeList(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);
|
||||
|
@ -6383,7 +6401,7 @@ void tscPrintSelNodeList(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) {
|
||||
|
|
|
@ -148,7 +148,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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -246,11 +246,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,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);
|
||||
|
@ -337,8 +337,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
|||
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfo(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);
|
||||
|
@ -397,13 +397,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;
|
||||
}
|
||||
|
||||
|
@ -438,10 +438,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,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);
|
||||
|
@ -523,7 +523,7 @@ int tscProcessSql(SSqlObj *pSql, SQueryInfo* pQueryInfo) {
|
|||
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;
|
||||
|
@ -564,11 +564,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);
|
||||
|
@ -607,7 +608,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;
|
||||
}
|
||||
|
@ -673,7 +674,7 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
|
|||
|
||||
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;
|
||||
|
||||
|
@ -706,7 +707,7 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
|
|||
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
|
||||
|
@ -724,7 +725,7 @@ static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STab
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1027,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;
|
||||
|
||||
|
@ -1744,7 +1745,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;
|
||||
|
@ -1924,7 +1925,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);
|
||||
|
@ -2031,7 +2032,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;
|
||||
|
@ -2200,7 +2201,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;
|
||||
}
|
||||
|
@ -2226,7 +2227,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2270,7 +2271,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));
|
||||
|
||||
tfree(pTableMetaInfo->pTableMeta);
|
||||
return 0;
|
||||
|
@ -2282,7 +2283,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));
|
||||
|
@ -2314,7 +2315,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;
|
||||
}
|
||||
|
||||
|
@ -2374,7 +2375,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;
|
||||
|
@ -2418,14 +2419,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;
|
||||
|
||||
|
@ -2496,7 +2497,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);
|
||||
}
|
||||
|
||||
|
@ -2556,12 +2557,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, NULL);
|
||||
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,10 +101,18 @@ 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;
|
||||
|
@ -131,7 +139,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
|
|||
pStream->numOfRes = 0; // reset the numOfRes.
|
||||
SSqlObj *pSql = pStream->pSql;
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfo(&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;
|
||||
|
|
|
@ -82,14 +82,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,14 +106,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;
|
||||
|
||||
|
@ -159,18 +159,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;
|
||||
|
@ -376,9 +376,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);
|
||||
}
|
||||
|
||||
|
@ -531,7 +531,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;
|
||||
|
||||
|
@ -542,7 +542,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);
|
||||
|
@ -565,7 +565,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tscClearSubqueryInfo(&pNew->cmd);
|
||||
pSql->pSubs[i] = pNew;
|
||||
|
||||
|
@ -647,8 +647,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));
|
||||
}
|
||||
|
||||
|
@ -776,7 +776,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);
|
||||
|
@ -798,7 +798,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -888,8 +888,8 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
|
|||
int32_t size = p0->tagSize - sizeof(int16_t);
|
||||
|
||||
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;
|
||||
|
@ -989,8 +989,8 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
|
|||
tableMIdx = taosArrayGet(tagCond, slot);
|
||||
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);
|
||||
|
@ -1065,7 +1065,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;
|
||||
|
@ -1169,8 +1169,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);
|
||||
|
@ -1184,7 +1184,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;
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1203,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
|
||||
|
@ -1225,8 +1226,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
@ -1318,7 +1319,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
|
||||
|
@ -1344,8 +1345,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;
|
||||
|
@ -1368,12 +1369,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
|
||||
|
@ -1441,23 +1442,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, NULL);
|
||||
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);
|
||||
|
@ -1468,14 +1469,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 {
|
||||
|
@ -1483,7 +1484,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);
|
||||
}
|
||||
}
|
||||
|
@ -1600,7 +1601,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;
|
||||
|
@ -1608,7 +1609,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
|
|||
tscProcessSql(pSub, NULL);
|
||||
tryNextVnode = true;
|
||||
} else {
|
||||
tscDebug("%p no result in current subquery anymore", pSub);
|
||||
tscDebug("0x%"PRIx64" no result in current subquery anymore", pSub->self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1631,7 +1632,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) {
|
||||
|
@ -1665,7 +1666,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);
|
||||
|
@ -1984,10 +1985,9 @@ 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("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables);
|
||||
|
||||
tscDebug("0x%"PRIx64" reset all sub states to 0", pSql->self);
|
||||
|
||||
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);
|
||||
if (pSupporter == NULL) { // failed to create support struct, abort current query
|
||||
|
@ -2443,7 +2443,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);
|
||||
|
@ -2467,7 +2467,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;
|
||||
|
||||
|
@ -2509,7 +2509,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) {
|
||||
|
@ -2531,7 +2531,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, NULL);
|
||||
}
|
||||
|
||||
|
@ -2543,11 +2543,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);
|
||||
}
|
||||
|
@ -2651,12 +2651,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 {
|
||||
|
@ -2675,7 +2675,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;
|
||||
|
@ -2716,7 +2716,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);
|
||||
|
@ -2745,7 +2745,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;
|
||||
|
@ -2754,14 +2754,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 = tscGetQueryInfo(&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;
|
||||
|
@ -2788,7 +2788,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;
|
||||
}
|
||||
|
||||
|
@ -2803,8 +2803,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;
|
||||
|
@ -2827,7 +2827,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
|
||||
}
|
||||
|
||||
|
@ -2842,8 +2842,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,
|
||||
|
@ -2967,8 +2967,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);
|
||||
|
@ -3031,7 +3031,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;
|
||||
}
|
||||
|
||||
|
@ -3041,7 +3041,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
|
||||
|
@ -3067,14 +3067,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);
|
||||
|
@ -3088,7 +3088,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);
|
||||
|
@ -3140,7 +3140,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);
|
||||
}
|
||||
|
@ -3168,14 +3168,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));
|
||||
|
@ -3202,10 +3202,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;
|
||||
}
|
||||
|
@ -3222,7 +3222,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, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -841,10 +841,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;
|
||||
}
|
||||
|
@ -875,7 +875,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);
|
||||
|
||||
|
@ -898,7 +898,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;
|
||||
|
||||
|
@ -1294,7 +1294,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);
|
||||
|
@ -2483,7 +2483,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) {
|
||||
|
@ -2751,7 +2751,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
|
|||
|
||||
tscPrintSelNodeList(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);
|
||||
|
@ -3034,7 +3034,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);
|
||||
|
||||
/*
|
||||
|
@ -3053,8 +3053,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.
|
||||
|
@ -3071,7 +3071,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
pSql->fp = fp;
|
||||
tscProcessSql(pSql, NULL);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3097,7 +3097,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;
|
||||
|
|
|
@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
|
|||
ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME}
|
||||
POST_BUILD
|
||||
COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.27-dist.jar ${LIBRARY_OUTPUT_PATH}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.28-dist.jar ${LIBRARY_OUTPUT_PATH}
|
||||
COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
|
||||
COMMENT "build jdbc driver")
|
||||
ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME})
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>2.0.27</version>
|
||||
<version>2.0.28</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JDBCDriver</name>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>2.0.27</version>
|
||||
<version>2.0.28</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>JDBCDriver</name>
|
||||
<url>https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc</url>
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||
|
||||
public abstract class AbstractResultSet extends WrapperImpl implements ResultSet {
|
||||
private int fetchSize;
|
||||
protected boolean wasNull;
|
||||
|
||||
protected void checkAvailability(int columnIndex, int bounds) throws SQLException {
|
||||
if (isClosed())
|
||||
|
@ -28,7 +29,7 @@ public abstract class AbstractResultSet extends WrapperImpl implements ResultSet
|
|||
|
||||
@Override
|
||||
public boolean wasNull() throws SQLException {
|
||||
return false;
|
||||
return wasNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,12 +6,10 @@ import com.google.common.primitives.Ints;
|
|||
import com.google.common.primitives.Longs;
|
||||
import com.google.common.primitives.Shorts;
|
||||
import com.taosdata.jdbc.*;
|
||||
import com.taosdata.jdbc.utils.UtcTimestampUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.time.Instant;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -89,7 +87,7 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
String timestampFormat = this.statement.getConnection().getClientInfo(TSDBDriver.PROPERTY_KEY_TIMESTAMP_FORMAT);
|
||||
if ("TIMESTAMP".equalsIgnoreCase(timestampFormat)) {
|
||||
Long value = row.getLong(colIndex);
|
||||
//TODO:
|
||||
//TODO: this implementation has bug if the timestamp bigger than 9999_9999_9999_9
|
||||
if (value < 1_0000_0000_0000_0L)
|
||||
return new Timestamp(value);
|
||||
long epochSec = value / 1000_000l;
|
||||
|
@ -164,12 +162,12 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasNull() throws SQLException {
|
||||
if (isClosed())
|
||||
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_RESULTSET_CLOSED);
|
||||
return resultSet.isEmpty();
|
||||
}
|
||||
// @Override
|
||||
// public boolean wasNull() throws SQLException {
|
||||
// if (isClosed())
|
||||
// throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_RESULTSET_CLOSED);
|
||||
// return resultSet.isEmpty();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getString(int columnIndex) throws SQLException {
|
||||
|
@ -188,8 +186,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return false;
|
||||
}
|
||||
wasNull = false;
|
||||
if (value instanceof Boolean)
|
||||
return (boolean) value;
|
||||
return Boolean.valueOf(value.toString());
|
||||
|
@ -200,8 +201,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
long valueAsLong = Long.parseLong(value.toString());
|
||||
if (valueAsLong == Byte.MIN_VALUE)
|
||||
return 0;
|
||||
|
@ -221,8 +225,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
long valueAsLong = Long.parseLong(value.toString());
|
||||
if (valueAsLong == Short.MIN_VALUE)
|
||||
return 0;
|
||||
|
@ -236,8 +243,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
long valueAsLong = Long.parseLong(value.toString());
|
||||
if (valueAsLong == Integer.MIN_VALUE)
|
||||
return 0;
|
||||
|
@ -251,12 +261,14 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
if (value instanceof Timestamp) {
|
||||
return ((Timestamp) value).getTime();
|
||||
}
|
||||
|
||||
long valueAsLong = 0;
|
||||
try {
|
||||
valueAsLong = Long.parseLong(value.toString());
|
||||
|
@ -273,8 +285,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
if (value instanceof Float || value instanceof Double)
|
||||
return (float) value;
|
||||
return Float.parseFloat(value.toString());
|
||||
|
@ -285,8 +300,11 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
|
|||
checkAvailability(columnIndex, resultSet.get(pos).size());
|
||||
|
||||
Object value = resultSet.get(pos).get(columnIndex - 1);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
wasNull = true;
|
||||
return 0;
|
||||
}
|
||||
wasNull = false;
|
||||
if (value instanceof Double || value instanceof Float)
|
||||
return (double) value;
|
||||
return Double.parseDouble(value.toString());
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.taosdata.jdbc.cases;
|
||||
|
||||
import com.taosdata.jdbc.TSDBDriver;
|
||||
import com.taosdata.jdbc.utils.TimestampUtil;
|
||||
import org.junit.*;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class TD3841Test {
|
||||
private static final String host = "127.0.0.1";
|
||||
private static Properties properties;
|
||||
private static Connection conn_restful;
|
||||
private static Connection conn_jni;
|
||||
|
||||
@Test
|
||||
public void testRestful() throws SQLException {
|
||||
String url = "jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata";
|
||||
conn_restful = DriverManager.getConnection(url, properties);
|
||||
|
||||
try (Statement stmt = conn_restful.createStatement()) {
|
||||
stmt.execute("drop database if exists test_null");
|
||||
stmt.execute("create database if not exists test_null");
|
||||
stmt.execute("use test_null");
|
||||
stmt.execute("create table weather(ts timestamp, f1 timestamp, f2 int, f3 bigint, f4 float, f5 double, f6 smallint, f7 tinyint, f8 bool, f9 binary(64), f10 nchar(64))");
|
||||
stmt.executeUpdate("insert into weather(ts, f1) values(now+1s, " + TimestampUtil.datetimeToLong("2021-04-21 12:00:00.000") + ")");
|
||||
ResultSet rs = stmt.executeQuery("select * from weather");
|
||||
rs.next();
|
||||
|
||||
Assert.assertEquals("2021-04-21 12:00:00.000", TimestampUtil.longToDatetime(rs.getTimestamp(2).getTime()));
|
||||
Assert.assertEquals(true, rs.getInt(3) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getLong(4) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getFloat(5) == 0.0f && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getDouble(6) == 0.0f && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getByte(7) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getShort(8) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(null, rs.getBytes(9));
|
||||
Assert.assertEquals(null, rs.getString(10));
|
||||
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJNI() throws SQLException {
|
||||
final String url = "jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata";
|
||||
conn_jni = DriverManager.getConnection(url, properties);
|
||||
|
||||
try (Statement stmt = conn_jni.createStatement()) {
|
||||
stmt.execute("drop database if exists test_null");
|
||||
stmt.execute("create database if not exists test_null");
|
||||
stmt.execute("use test_null");
|
||||
stmt.execute("create table weather(ts timestamp, f1 timestamp, f2 int, f3 bigint, f4 float, f5 double, f6 smallint, f7 tinyint, f8 bool, f9 binary(64), f10 nchar(64))");
|
||||
stmt.executeUpdate("insert into weather(ts, f1) values(now+1s, " + TimestampUtil.datetimeToLong("2021-04-21 12:00:00.000") + ")");
|
||||
ResultSet rs = stmt.executeQuery("select * from weather");
|
||||
rs.next();
|
||||
|
||||
Assert.assertEquals("2021-04-21 12:00:00.000", TimestampUtil.longToDatetime(rs.getTimestamp(2).getTime()));
|
||||
Assert.assertEquals(true, rs.getInt(3) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getLong(4) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getFloat(5) == 0.0f && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getDouble(6) == 0.0f && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getByte(7) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(true, rs.getShort(8) == 0 && rs.wasNull());
|
||||
Assert.assertEquals(null, rs.getBytes(9));
|
||||
Assert.assertEquals(null, rs.getString(10));
|
||||
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
properties = new Properties();
|
||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
||||
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws SQLException {
|
||||
if (conn_restful != null)
|
||||
conn_restful.close();
|
||||
if (conn_jni != null)
|
||||
conn_jni.close();
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
@ -214,8 +214,8 @@ static struct argp_option options[] = {
|
|||
// dump format options
|
||||
{"schemaonly", 's', 0, 0, "Only dump schema.", 3},
|
||||
{"with-property", 'M', 0, 0, "Dump schema with properties.", 3},
|
||||
{"start-time", 'S', "START_TIME", 0, "Start time to dump.", 3},
|
||||
{"end-time", 'E', "END_TIME", 0, "End time to dump. Epoch or ISO8601/RFC3339 format is acceptable. For example: 2017-10-01T18:00:00+0800", 3},
|
||||
{"start-time", 'S', "START_TIME", 0, "Start time to dump. Either Epoch or ISO8601/RFC3339 format is acceptable. Epoch precision millisecond. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 3},
|
||||
{"end-time", 'E', "END_TIME", 0, "End time to dump. Either Epoch or ISO8601/RFC3339 format is acceptable. Epoch precision millisecond. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 3},
|
||||
{"data-batch", 'N', "DATA_BATCH", 0, "Number of data point per insert statement. Default is 1.", 3},
|
||||
{"max-sql-len", 'L', "SQL_LEN", 0, "Max length of one sql. Default is 65480.", 3},
|
||||
{"table-batch", 't', "TABLE_BATCH", 0, "Number of table dumpout into one output file. Default is 1.", 3},
|
||||
|
@ -482,7 +482,8 @@ static int queryDbImpl(TAOS *taos, char *command) {
|
|||
|
||||
static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-E") == 0) {
|
||||
if ((strcmp(argv[i], "-S") == 0)
|
||||
|| (strcmp(argv[i], "-E") == 0)) {
|
||||
if (argv[i+1]) {
|
||||
char *tmp = strdup(argv[++i]);
|
||||
|
||||
|
@ -509,7 +510,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
|||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
errorPrint("%s() LN%d, -E need a valid value following!\n", __func__, __LINE__);
|
||||
errorPrint("%s need a valid value following!\n", argv[i]);
|
||||
exit(-1);
|
||||
}
|
||||
} else if (strcmp(argv[i], "-g") == 0) {
|
||||
|
@ -522,7 +523,8 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
/* Parse our arguments; every option seen by parse_opt will be
|
||||
reflected in arguments. */
|
||||
parse_args(argc, argv, &g_args);
|
||||
if (argc > 1)
|
||||
parse_args(argc, argv, &g_args);
|
||||
|
||||
argp_parse(&argp, argc, argv, 0, 0, &g_args);
|
||||
|
||||
|
|
|
@ -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_TABLELIST = 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) \
|
||||
|
@ -229,7 +235,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
|
||||
|
|
|
@ -669,6 +669,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);}
|
||||
|
||||
|
|
|
@ -2476,6 +2476,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) {
|
||||
|
@ -2489,6 +2512,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) {
|
||||
|
@ -2528,27 +2555,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;
|
||||
|
@ -2603,6 +2609,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);
|
||||
|
|
|
@ -1272,7 +1272,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
|
|||
int16_t type = pColInfoData->info.type;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1659,7 +1659,7 @@ static void* destroySQLFunctionCtx(SQLFunctionCtx* pCtx, int32_t numOfOutput) {
|
|||
}
|
||||
|
||||
static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOfTables, SArray* pOperator, void* merger) {
|
||||
qDebug("QInfo:%"PRIu64" setup runtime env", GET_QID(pRuntimeEnv));
|
||||
qDebug("QInfo:0x%"PRIx64" setup runtime env", GET_QID(pRuntimeEnv));
|
||||
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||
|
||||
pRuntimeEnv->prevGroupId = INT32_MIN;
|
||||
|
@ -1692,7 +1692,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)
|
||||
|
@ -1832,12 +1832,14 @@ static void doFreeQueryHandle(SQueryRuntimeEnv* pRuntimeEnv) {
|
|||
}
|
||||
|
||||
static void destroyTsComp(SQueryRuntimeEnv *pRuntimeEnv, SQueryAttr *pQueryAttr) {
|
||||
if (pQueryAttr->tsCompQuery) {
|
||||
if (pQueryAttr->tsCompQuery && 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1846,7 +1848,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
|
|||
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||
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 < pQueryAttr->numOfOutput; ++i) {
|
||||
|
@ -2019,7 +2021,7 @@ bool colIdCheck(SQueryAttr *pQueryAttr, uint64_t qId) {
|
|||
// load data column information is incorrect
|
||||
for (int32_t i = 0; i < pQueryAttr->numOfCols - 1; ++i) {
|
||||
if (pQueryAttr->tableCols[i].colId == pQueryAttr->tableCols[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;
|
||||
}
|
||||
}
|
||||
|
@ -2106,14 +2108,13 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
|
|||
SQueryAttr* pQueryAttr = pQInfo->runtimeEnv.pQueryAttr;
|
||||
|
||||
// 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(pQueryAttr)) {
|
||||
qDebug("QInfo:%"PRIu64" scan order changed for last_row query, old:%d, new:%d", pQInfo->qId,
|
||||
pQueryAttr->order.order, TSDB_ORDER_ASC);
|
||||
qDebug("QInfo:0x%"PRIx64" scan order changed for last_row query, old:%d, new:%d", pQInfo->qId, pQueryAttr->order.order, TSDB_ORDER_ASC);
|
||||
|
||||
pQueryAttr->order.order = TSDB_ORDER_ASC;
|
||||
if (pQueryAttr->window.skey > pQueryAttr->window.ekey) {
|
||||
|
@ -2590,7 +2591,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
|
|||
*status = updateBlockLoadStatus(pRuntimeEnv->pQueryAttr, *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) {
|
||||
|
@ -2633,7 +2634,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;
|
||||
|
@ -2645,7 +2646,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;
|
||||
|
@ -3313,10 +3314,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:%p set tag value for join comparison, colId:%" PRId64 ", val:%s", pRuntimeEnv->qinfo,
|
||||
qDebug("QInfo:0x%"PRIx64" set tag value for join comparison, colId:%" PRId64 ", val:%s", GET_QID(pRuntimeEnv),
|
||||
pExprInfo->base.param[0].i64, pCtx[0].tag.pz);
|
||||
} else {
|
||||
qDebug("QInfo:%p set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, pRuntimeEnv->qinfo,
|
||||
qDebug("QInfo:0x%"PRIx64" set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, GET_QID(pRuntimeEnv),
|
||||
pExprInfo->base.param[0].i64, pCtx[0].tag.i64);
|
||||
}
|
||||
}
|
||||
|
@ -3336,9 +3337,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;
|
||||
|
@ -3347,17 +3348,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3492,7 +3493,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;
|
||||
|
@ -3532,7 +3533,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;
|
||||
}
|
||||
|
@ -3619,11 +3620,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);
|
||||
|
@ -3662,12 +3663,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);
|
||||
}
|
||||
|
||||
|
@ -3703,8 +3704,8 @@ 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),
|
||||
// pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes, pQueryAttr->current->lastKey);
|
||||
// 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);
|
||||
//}
|
||||
|
||||
//void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||
|
@ -3733,8 +3734,8 @@ void queryCostStatis(SQInfo *pQInfo) {
|
|||
// pTableQueryInfo->lastKey = (QUERY_IS_ASC_QUERY(pQueryAttr)) ? blockInfo.window.ekey : blockInfo.window.skey;
|
||||
// pTableQueryInfo->lastKey += step;
|
||||
//
|
||||
// qDebug("QInfo:%"PRIu64" skip rows:%d, offset:%" PRId64, GET_QID(pRuntimeEnv), blockInfo.rows,
|
||||
// pQueryAttr->limit.offset);
|
||||
// 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);
|
||||
// break;
|
||||
|
@ -3781,7 +3782,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,
|
||||
// pQueryAttr->current->lastKey);
|
||||
//
|
||||
|
@ -4225,7 +4226,7 @@ static SSDataBlock* doTableScan(void* param, bool *newgroup) {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -4236,7 +4237,7 @@ static SSDataBlock* doTableScan(void* param, bool *newgroup) {
|
|||
STsdbQueryCond cond = createTsdbQueryCond(pQueryAttr, &pQueryAttr->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;
|
||||
|
@ -5714,14 +5715,14 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
|||
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
|
||||
|
||||
|
@ -5760,7 +5761,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
|||
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;
|
||||
|
@ -6557,13 +6558,13 @@ static int32_t doCreateFilterInfo(SColumnInfo* pCols, int32_t numOfCols, int32_t
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -6834,7 +6835,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:
|
||||
|
@ -6910,7 +6911,7 @@ int32_t initQInfo(STsBufInfo* pTsBufInfo, void* tsdb, void* sourceOptr, SQInfo*
|
|||
|
||||
if ((QUERY_IS_ASC_QUERY(pQueryAttr) && (pQueryAttr->window.skey > pQueryAttr->window.ekey)) ||
|
||||
(!QUERY_IS_ASC_QUERY(pQueryAttr) && (pQueryAttr->window.ekey > pQueryAttr->window.skey))) {
|
||||
qDebug("QInfo:%"PRIu64" no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo->qId, pQueryAttr->window.skey,
|
||||
qDebug("QInfo:0x%"PRIx64" no result in time range %" PRId64 "-%" PRId64 ", order %d", pQInfo->qId, pQueryAttr->window.skey,
|
||||
pQueryAttr->window.ekey, pQueryAttr->order.order);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
|
||||
pRuntimeEnv->tableqinfoGroupInfo.numOfTables = 0;
|
||||
|
@ -6919,7 +6920,7 @@ int32_t initQInfo(STsBufInfo* pTsBufInfo, void* tsdb, void* sourceOptr, SQInfo*
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -7005,7 +7006,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);
|
||||
|
@ -7024,7 +7025,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);
|
||||
}
|
||||
|
@ -7044,7 +7045,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
|
||||
|
@ -7076,11 +7077,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 (pQueryAttr->limit.limit > 0 && pQueryAttr->limit.limit == pRuntimeEnv->resultInfo.total) {
|
||||
qDebug("QInfo:%"PRIu64" results limitation reached, limitation:%"PRId64, pQInfo->qId, pQueryAttr->limit.limit);
|
||||
qDebug("QInfo:0x%"PRIx64" results limitation reached, limitation:%"PRId64, pQInfo->qId, pQueryAttr->limit.limit);
|
||||
setQueryStatus(pRuntimeEnv, QUERY_OVER);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,45 +367,14 @@ static int32_t tsCompareFunc(TSKEY k1, TSKEY k2, int32_t order) {
|
|||
|
||||
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);
|
||||
|
@ -428,6 +397,10 @@ int32_t columnValueAscendingComparator(char *f1, char *f2, int32_t type, int32_t
|
|||
}
|
||||
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)) {
|
||||
|
|
|
@ -206,7 +206,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,22 +230,22 @@ 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);
|
||||
|
||||
bool newgroup = false;
|
||||
pRuntimeEnv->outputBuf = pRuntimeEnv->proot->exec(pRuntimeEnv->proot, &newgroup);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -256,13 +256,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;
|
||||
}
|
||||
|
||||
|
@ -282,11 +282,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, pQueryAttr->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);
|
||||
}
|
||||
|
@ -345,10 +345,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
|
||||
|
@ -374,7 +374,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/
|
||||
|
@ -402,7 +402,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);
|
||||
}
|
||||
|
@ -485,7 +485,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;
|
||||
}
|
||||
|
@ -493,7 +493,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 {
|
||||
|
|
|
@ -128,16 +128,16 @@ typedef union {
|
|||
#define ParseARG_STORE yypParser->pInfo = pInfo
|
||||
#define YYFALLBACK 1
|
||||
#define YYNSTATE 315
|
||||
#define YYNRULE 267
|
||||
#define YYNRULE 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 the yytestcase() macro to be a no-op if is not already defined
|
||||
|
@ -203,76 +203,77 @@ typedef union {
|
|||
** yy_default[] Default action for each state.
|
||||
**
|
||||
*********** Begin parsing tables **********************************************/
|
||||
#define YY_ACTTAB_COUNT (680)
|
||||
#define YY_ACTTAB_COUNT (683)
|
||||
static const YYACTIONTYPE yy_action[] = {
|
||||
/* 0 */ 133, 553, 202, 312, 206, 140, 943, 226, 140, 554,
|
||||
/* 10 */ 774, 314, 17, 47, 48, 140, 51, 52, 30, 181,
|
||||
/* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1023,
|
||||
/* 30 */ 922, 209, 1024, 46, 45, 179, 181, 44, 43, 42,
|
||||
/* 40 */ 47, 48, 920, 51, 52, 208, 1024, 214, 41, 553,
|
||||
/* 50 */ 50, 262, 55, 53, 57, 54, 934, 554, 185, 203,
|
||||
/* 60 */ 46, 45, 919, 247, 44, 43, 42, 48, 940, 51,
|
||||
/* 70 */ 52, 242, 974, 214, 41, 79, 50, 262, 55, 53,
|
||||
/* 80 */ 57, 54, 975, 632, 257, 30, 46, 45, 278, 225,
|
||||
/* 90 */ 44, 43, 42, 507, 508, 509, 510, 511, 512, 513,
|
||||
/* 100 */ 514, 515, 516, 517, 518, 519, 313, 553, 85, 231,
|
||||
/* 110 */ 70, 288, 287, 47, 48, 554, 51, 52, 298, 219,
|
||||
/* 120 */ 214, 41, 553, 50, 262, 55, 53, 57, 54, 918,
|
||||
/* 130 */ 554, 105, 718, 46, 45, 1020, 298, 44, 43, 42,
|
||||
/* 140 */ 47, 49, 910, 51, 52, 922, 140, 214, 41, 234,
|
||||
/* 150 */ 50, 262, 55, 53, 57, 54, 1019, 238, 237, 227,
|
||||
/* 0 */ 133, 555, 204, 312, 208, 140, 947, 226, 140, 556,
|
||||
/* 10 */ 778, 314, 17, 47, 48, 140, 51, 52, 30, 181,
|
||||
/* 20 */ 214, 41, 181, 50, 262, 55, 53, 57, 54, 1029,
|
||||
/* 30 */ 926, 211, 1030, 46, 45, 179, 181, 44, 43, 42,
|
||||
/* 40 */ 47, 48, 924, 51, 52, 210, 1030, 214, 41, 555,
|
||||
/* 50 */ 50, 262, 55, 53, 57, 54, 938, 556, 185, 205,
|
||||
/* 60 */ 46, 45, 923, 247, 44, 43, 42, 48, 944, 51,
|
||||
/* 70 */ 52, 242, 978, 214, 41, 79, 50, 262, 55, 53,
|
||||
/* 80 */ 57, 54, 979, 634, 257, 30, 46, 45, 278, 225,
|
||||
/* 90 */ 44, 43, 42, 509, 510, 511, 512, 513, 514, 515,
|
||||
/* 100 */ 516, 517, 518, 519, 520, 521, 313, 555, 85, 231,
|
||||
/* 110 */ 70, 288, 287, 47, 48, 556, 51, 52, 298, 219,
|
||||
/* 120 */ 214, 41, 555, 50, 262, 55, 53, 57, 54, 922,
|
||||
/* 130 */ 556, 105, 720, 46, 45, 1026, 298, 44, 43, 42,
|
||||
/* 140 */ 47, 49, 914, 51, 52, 926, 140, 214, 41, 234,
|
||||
/* 150 */ 50, 262, 55, 53, 57, 54, 1025, 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, 30, 870, 871, 872, 873, 874, 875,
|
||||
/* 190 */ 876, 877, 878, 879, 880, 881, 883, 884, 51, 52,
|
||||
/* 200 */ 821, 1018, 214, 41, 166, 50, 262, 55, 53, 57,
|
||||
/* 210 */ 54, 259, 18, 78, 82, 46, 45, 198, 223, 44,
|
||||
/* 220 */ 43, 42, 213, 731, 217, 25, 722, 919, 725, 190,
|
||||
/* 230 */ 728, 221, 213, 731, 199, 191, 722, 724, 725, 727,
|
||||
/* 240 */ 728, 118, 117, 189, 263, 905, 906, 29, 909, 44,
|
||||
/* 250 */ 43, 42, 30, 74, 210, 211, 308, 922, 261, 30,
|
||||
/* 260 */ 23, 36, 307, 306, 210, 211, 934, 305, 30, 304,
|
||||
/* 270 */ 303, 302, 74, 301, 300, 890, 908, 183, 888, 889,
|
||||
/* 280 */ 36, 204, 922, 891, 916, 893, 894, 892, 224, 895,
|
||||
/* 290 */ 896, 280, 656, 218, 830, 653, 919, 654, 166, 655,
|
||||
/* 300 */ 281, 69, 241, 919, 68, 55, 53, 57, 54, 282,
|
||||
/* 310 */ 197, 671, 919, 46, 45, 30, 822, 44, 43, 42,
|
||||
/* 320 */ 166, 103, 108, 228, 229, 56, 220, 97, 107, 113,
|
||||
/* 330 */ 116, 106, 732, 907, 723, 56, 726, 110, 730, 30,
|
||||
/* 340 */ 735, 12, 732, 5, 156, 84, 184, 81, 730, 33,
|
||||
/* 350 */ 155, 92, 87, 91, 729, 278, 286, 1, 154, 919,
|
||||
/* 360 */ 174, 170, 186, 212, 729, 80, 172, 169, 121, 120,
|
||||
/* 370 */ 119, 46, 45, 3, 167, 44, 43, 42, 71, 720,
|
||||
/* 380 */ 290, 699, 700, 919, 311, 310, 126, 243, 668, 675,
|
||||
/* 390 */ 678, 31, 684, 690, 180, 24, 135, 60, 245, 691,
|
||||
/* 400 */ 752, 657, 733, 20, 19, 61, 19, 6, 64, 642,
|
||||
/* 410 */ 265, 1034, 644, 31, 31, 721, 60, 267, 643, 187,
|
||||
/* 420 */ 28, 83, 60, 268, 96, 95, 188, 62, 65, 14,
|
||||
/* 430 */ 13, 102, 101, 660, 67, 661, 631, 194, 16, 15,
|
||||
/* 440 */ 658, 195, 659, 115, 114, 131, 129, 193, 178, 192,
|
||||
/* 450 */ 182, 921, 985, 984, 215, 981, 239, 980, 132, 942,
|
||||
/* 460 */ 216, 289, 39, 950, 952, 967, 134, 966, 138, 935,
|
||||
/* 470 */ 246, 130, 248, 917, 151, 915, 150, 205, 683, 250,
|
||||
/* 480 */ 152, 886, 299, 153, 291, 148, 146, 260, 142, 932,
|
||||
/* 490 */ 141, 58, 833, 270, 66, 255, 143, 37, 63, 176,
|
||||
/* 500 */ 34, 279, 829, 258, 144, 1039, 93, 256, 1038, 1036,
|
||||
/* 510 */ 157, 254, 283, 1033, 99, 1032, 1030, 158, 851, 35,
|
||||
/* 520 */ 252, 145, 32, 38, 177, 818, 109, 816, 111, 40,
|
||||
/* 530 */ 112, 814, 813, 230, 168, 811, 810, 809, 808, 807,
|
||||
/* 540 */ 806, 171, 173, 803, 801, 799, 797, 795, 175, 249,
|
||||
/* 550 */ 244, 72, 75, 104, 251, 968, 292, 293, 294, 295,
|
||||
/* 560 */ 296, 297, 309, 200, 222, 269, 772, 232, 201, 233,
|
||||
/* 570 */ 771, 88, 89, 196, 235, 236, 770, 758, 757, 240,
|
||||
/* 580 */ 245, 8, 264, 73, 812, 663, 805, 161, 852, 159,
|
||||
/* 590 */ 160, 163, 162, 164, 165, 122, 123, 124, 804, 76,
|
||||
/* 600 */ 125, 796, 4, 2, 685, 136, 137, 688, 77, 149,
|
||||
/* 610 */ 147, 207, 253, 86, 692, 898, 139, 9, 10, 26,
|
||||
/* 620 */ 27, 734, 7, 11, 736, 21, 22, 266, 595, 591,
|
||||
/* 630 */ 589, 84, 588, 587, 584, 557, 277, 94, 90, 31,
|
||||
/* 640 */ 634, 633, 59, 630, 579, 577, 98, 569, 575, 571,
|
||||
/* 650 */ 573, 567, 565, 100, 598, 597, 596, 594, 593, 592,
|
||||
/* 660 */ 590, 586, 585, 60, 555, 523, 521, 776, 775, 127,
|
||||
/* 670 */ 775, 775, 775, 775, 775, 775, 775, 775, 775, 128,
|
||||
/* 180 */ 301, 300, 886, 30, 874, 875, 876, 877, 878, 879,
|
||||
/* 190 */ 880, 881, 882, 883, 884, 885, 887, 888, 51, 52,
|
||||
/* 200 */ 825, 1024, 214, 41, 166, 50, 262, 55, 53, 57,
|
||||
/* 210 */ 54, 259, 18, 78, 82, 46, 45, 61, 223, 44,
|
||||
/* 220 */ 43, 42, 213, 735, 217, 25, 724, 923, 727, 190,
|
||||
/* 230 */ 730, 221, 213, 735, 198, 191, 724, 912, 727, 62,
|
||||
/* 240 */ 730, 118, 117, 189, 69, 909, 910, 29, 913, 44,
|
||||
/* 250 */ 43, 42, 30, 74, 200, 201, 308, 926, 261, 30,
|
||||
/* 260 */ 23, 36, 307, 306, 200, 201, 938, 305, 30, 304,
|
||||
/* 270 */ 303, 302, 74, 301, 300, 894, 911, 199, 892, 893,
|
||||
/* 280 */ 36, 206, 926, 895, 920, 897, 898, 896, 224, 899,
|
||||
/* 290 */ 900, 280, 658, 218, 834, 655, 923, 656, 166, 657,
|
||||
/* 300 */ 281, 673, 241, 923, 68, 55, 53, 57, 54, 282,
|
||||
/* 310 */ 197, 263, 923, 46, 45, 30, 278, 44, 43, 42,
|
||||
/* 320 */ 80, 103, 108, 228, 229, 56, 220, 97, 107, 113,
|
||||
/* 330 */ 116, 106, 736, 71, 726, 56, 729, 110, 732, 30,
|
||||
/* 340 */ 1, 154, 736, 5, 156, 725, 183, 728, 732, 33,
|
||||
/* 350 */ 155, 92, 87, 91, 731, 680, 286, 184, 826, 923,
|
||||
/* 360 */ 174, 170, 166, 245, 731, 212, 172, 169, 121, 120,
|
||||
/* 370 */ 119, 46, 45, 3, 167, 44, 43, 42, 12, 677,
|
||||
/* 380 */ 290, 722, 84, 923, 81, 670, 311, 310, 126, 701,
|
||||
/* 390 */ 702, 243, 24, 686, 692, 31, 693, 135, 60, 756,
|
||||
/* 400 */ 20, 659, 737, 19, 64, 186, 19, 739, 644, 6,
|
||||
/* 410 */ 180, 265, 31, 187, 646, 31, 267, 723, 60, 645,
|
||||
/* 420 */ 83, 188, 28, 60, 65, 268, 662, 67, 663, 633,
|
||||
/* 430 */ 96, 95, 660, 194, 661, 115, 114, 14, 13, 102,
|
||||
/* 440 */ 101, 195, 16, 15, 131, 129, 733, 193, 178, 192,
|
||||
/* 450 */ 182, 1040, 925, 989, 988, 215, 985, 734, 239, 984,
|
||||
/* 460 */ 216, 289, 132, 946, 39, 971, 954, 970, 956, 939,
|
||||
/* 470 */ 246, 130, 248, 134, 138, 921, 150, 244, 151, 207,
|
||||
/* 480 */ 250, 299, 685, 149, 919, 255, 142, 936, 143, 141,
|
||||
/* 490 */ 144, 152, 256, 153, 260, 258, 66, 145, 837, 270,
|
||||
/* 500 */ 63, 37, 58, 176, 34, 254, 279, 833, 1045, 252,
|
||||
/* 510 */ 93, 1044, 1042, 249, 147, 157, 283, 1039, 99, 1038,
|
||||
/* 520 */ 146, 1036, 158, 855, 35, 32, 38, 177, 822, 40,
|
||||
/* 530 */ 109, 104, 820, 111, 112, 818, 817, 230, 168, 815,
|
||||
/* 540 */ 814, 813, 812, 811, 810, 171, 173, 807, 805, 803,
|
||||
/* 550 */ 291, 801, 799, 175, 292, 72, 75, 293, 251, 972,
|
||||
/* 560 */ 294, 295, 296, 297, 309, 776, 202, 232, 222, 269,
|
||||
/* 570 */ 233, 775, 236, 235, 774, 761, 203, 762, 88, 196,
|
||||
/* 580 */ 89, 240, 245, 264, 8, 73, 76, 665, 687, 690,
|
||||
/* 590 */ 816, 161, 136, 122, 856, 159, 164, 160, 162, 163,
|
||||
/* 600 */ 165, 123, 809, 2, 890, 124, 808, 4, 125, 800,
|
||||
/* 610 */ 137, 209, 77, 148, 253, 26, 694, 139, 9, 902,
|
||||
/* 620 */ 10, 27, 738, 7, 11, 740, 21, 22, 266, 86,
|
||||
/* 630 */ 597, 593, 84, 591, 590, 589, 586, 559, 277, 90,
|
||||
/* 640 */ 31, 94, 98, 59, 100, 636, 635, 632, 581, 579,
|
||||
/* 650 */ 571, 577, 573, 575, 569, 567, 600, 599, 598, 596,
|
||||
/* 660 */ 595, 594, 592, 588, 587, 60, 557, 525, 523, 780,
|
||||
/* 670 */ 779, 779, 779, 779, 779, 779, 779, 779, 779, 779,
|
||||
/* 680 */ 779, 127, 128,
|
||||
};
|
||||
static const YYCODETYPE yy_lookahead[] = {
|
||||
/* 0 */ 191, 1, 190, 191, 210, 191, 191, 191, 191, 9,
|
||||
|
@ -296,54 +297,54 @@ static const YYCODETYPE yy_lookahead[] = {
|
|||
/* 180 */ 101, 102, 209, 191, 211, 212, 213, 214, 215, 216,
|
||||
/* 190 */ 217, 218, 219, 220, 221, 222, 223, 224, 16, 17,
|
||||
/* 200 */ 196, 252, 20, 21, 200, 23, 24, 25, 26, 27,
|
||||
/* 210 */ 28, 256, 44, 258, 197, 33, 34, 252, 67, 37,
|
||||
/* 210 */ 28, 256, 44, 258, 197, 33, 34, 109, 67, 37,
|
||||
/* 220 */ 38, 39, 1, 2, 232, 104, 5, 235, 7, 61,
|
||||
/* 230 */ 9, 210, 1, 2, 252, 67, 5, 5, 7, 7,
|
||||
/* 240 */ 9, 73, 74, 75, 15, 228, 229, 230, 231, 37,
|
||||
/* 230 */ 9, 210, 1, 2, 252, 67, 5, 0, 7, 131,
|
||||
/* 240 */ 9, 73, 74, 75, 197, 228, 229, 230, 231, 37,
|
||||
/* 250 */ 38, 39, 191, 104, 33, 34, 210, 236, 37, 191,
|
||||
/* 260 */ 88, 112, 90, 91, 33, 34, 234, 95, 191, 97,
|
||||
/* 270 */ 98, 99, 104, 101, 102, 209, 0, 252, 212, 213,
|
||||
/* 270 */ 98, 99, 104, 101, 102, 209, 229, 252, 212, 213,
|
||||
/* 280 */ 112, 249, 236, 217, 191, 219, 220, 221, 137, 223,
|
||||
/* 290 */ 224, 140, 2, 232, 196, 5, 235, 7, 200, 9,
|
||||
/* 300 */ 232, 197, 134, 235, 136, 25, 26, 27, 28, 232,
|
||||
/* 310 */ 142, 37, 235, 33, 34, 191, 196, 37, 38, 39,
|
||||
/* 320 */ 200, 62, 63, 33, 34, 104, 233, 68, 69, 70,
|
||||
/* 330 */ 71, 72, 111, 229, 5, 104, 7, 78, 117, 191,
|
||||
/* 340 */ 111, 104, 111, 62, 63, 108, 252, 110, 117, 68,
|
||||
/* 350 */ 69, 70, 71, 72, 133, 79, 232, 198, 199, 235,
|
||||
/* 360 */ 62, 63, 252, 60, 133, 237, 68, 69, 70, 71,
|
||||
/* 370 */ 72, 33, 34, 194, 195, 37, 38, 39, 250, 1,
|
||||
/* 380 */ 232, 124, 125, 235, 64, 65, 66, 105, 109, 115,
|
||||
/* 390 */ 105, 109, 105, 105, 252, 116, 109, 109, 113, 105,
|
||||
/* 400 */ 105, 111, 105, 109, 109, 109, 109, 104, 109, 105,
|
||||
/* 410 */ 105, 236, 105, 109, 109, 37, 109, 105, 105, 252,
|
||||
/* 420 */ 104, 109, 109, 107, 138, 139, 252, 131, 129, 138,
|
||||
/* 430 */ 139, 138, 139, 5, 104, 7, 106, 252, 138, 139,
|
||||
/* 440 */ 5, 252, 7, 76, 77, 62, 63, 252, 252, 252,
|
||||
/* 450 */ 252, 236, 227, 227, 227, 227, 191, 227, 191, 191,
|
||||
/* 460 */ 227, 227, 251, 191, 191, 259, 191, 259, 191, 234,
|
||||
/* 470 */ 234, 60, 255, 234, 191, 191, 238, 255, 117, 255,
|
||||
/* 480 */ 191, 225, 103, 191, 86, 240, 242, 122, 246, 248,
|
||||
/* 490 */ 247, 127, 191, 191, 128, 255, 245, 191, 130, 191,
|
||||
/* 500 */ 191, 191, 191, 126, 244, 191, 191, 121, 191, 191,
|
||||
/* 510 */ 191, 120, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
/* 520 */ 119, 243, 191, 191, 191, 191, 191, 191, 191, 132,
|
||||
/* 530 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
/* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 118,
|
||||
/* 550 */ 192, 192, 192, 87, 192, 192, 50, 83, 85, 54,
|
||||
/* 560 */ 84, 82, 79, 192, 192, 192, 5, 145, 192, 5,
|
||||
/* 570 */ 5, 197, 197, 192, 145, 5, 5, 90, 89, 135,
|
||||
/* 580 */ 113, 104, 107, 114, 192, 105, 192, 202, 208, 207,
|
||||
/* 590 */ 206, 203, 205, 204, 201, 193, 193, 193, 192, 109,
|
||||
/* 600 */ 193, 192, 194, 198, 105, 104, 109, 105, 104, 239,
|
||||
/* 610 */ 241, 1, 104, 76, 105, 225, 104, 123, 123, 109,
|
||||
/* 620 */ 109, 105, 104, 104, 111, 104, 104, 107, 9, 5,
|
||||
/* 630 */ 5, 108, 5, 5, 5, 80, 15, 139, 76, 109,
|
||||
/* 640 */ 5, 5, 16, 105, 5, 5, 139, 5, 5, 5,
|
||||
/* 650 */ 5, 5, 5, 139, 5, 5, 5, 5, 5, 5,
|
||||
/* 660 */ 5, 5, 5, 109, 80, 60, 59, 0, 263, 21,
|
||||
/* 670 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 21,
|
||||
/* 680 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 300 */ 232, 37, 134, 235, 136, 25, 26, 27, 28, 232,
|
||||
/* 310 */ 142, 15, 235, 33, 34, 191, 79, 37, 38, 39,
|
||||
/* 320 */ 237, 62, 63, 33, 34, 104, 233, 68, 69, 70,
|
||||
/* 330 */ 71, 72, 111, 250, 5, 104, 7, 78, 117, 191,
|
||||
/* 340 */ 198, 199, 111, 62, 63, 5, 252, 7, 117, 68,
|
||||
/* 350 */ 69, 70, 71, 72, 133, 105, 232, 252, 196, 235,
|
||||
/* 360 */ 62, 63, 200, 113, 133, 60, 68, 69, 70, 71,
|
||||
/* 370 */ 72, 33, 34, 194, 195, 37, 38, 39, 104, 115,
|
||||
/* 380 */ 232, 1, 108, 235, 110, 109, 64, 65, 66, 124,
|
||||
/* 390 */ 125, 105, 116, 105, 105, 109, 105, 109, 109, 105,
|
||||
/* 400 */ 109, 111, 105, 109, 109, 252, 109, 111, 105, 104,
|
||||
/* 410 */ 252, 105, 109, 252, 105, 109, 105, 37, 109, 105,
|
||||
/* 420 */ 109, 252, 104, 109, 129, 107, 5, 104, 7, 106,
|
||||
/* 430 */ 138, 139, 5, 252, 7, 76, 77, 138, 139, 138,
|
||||
/* 440 */ 139, 252, 138, 139, 62, 63, 117, 252, 252, 252,
|
||||
/* 450 */ 252, 236, 236, 227, 227, 227, 227, 117, 191, 227,
|
||||
/* 460 */ 227, 227, 191, 191, 251, 259, 191, 259, 191, 234,
|
||||
/* 470 */ 234, 60, 255, 191, 191, 234, 238, 192, 191, 255,
|
||||
/* 480 */ 255, 103, 117, 239, 191, 255, 246, 248, 245, 247,
|
||||
/* 490 */ 244, 191, 121, 191, 122, 126, 128, 243, 191, 191,
|
||||
/* 500 */ 130, 191, 127, 191, 191, 120, 191, 191, 191, 119,
|
||||
/* 510 */ 191, 191, 191, 118, 241, 191, 191, 191, 191, 191,
|
||||
/* 520 */ 242, 191, 191, 191, 191, 191, 191, 191, 191, 132,
|
||||
/* 530 */ 191, 87, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
/* 540 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
/* 550 */ 86, 191, 191, 191, 50, 192, 192, 83, 192, 192,
|
||||
/* 560 */ 85, 54, 84, 82, 79, 5, 192, 145, 192, 192,
|
||||
/* 570 */ 5, 5, 5, 145, 5, 89, 192, 90, 197, 192,
|
||||
/* 580 */ 197, 135, 113, 107, 104, 114, 109, 105, 105, 105,
|
||||
/* 590 */ 192, 202, 104, 193, 208, 207, 204, 206, 205, 203,
|
||||
/* 600 */ 201, 193, 192, 198, 225, 193, 192, 194, 193, 192,
|
||||
/* 610 */ 109, 1, 104, 240, 104, 109, 105, 104, 123, 225,
|
||||
/* 620 */ 123, 109, 105, 104, 104, 111, 104, 104, 107, 76,
|
||||
/* 630 */ 9, 5, 108, 5, 5, 5, 5, 80, 15, 76,
|
||||
/* 640 */ 109, 139, 139, 16, 139, 5, 5, 105, 5, 5,
|
||||
/* 650 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
/* 660 */ 5, 5, 5, 5, 5, 109, 80, 60, 59, 0,
|
||||
/* 670 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 680 */ 263, 21, 21, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 690 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 700 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 710 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
|
@ -361,101 +362,101 @@ static const YYCODETYPE yy_lookahead[] = {
|
|||
/* 830 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 840 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 850 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 860 */ 263, 263, 263, 263, 263, 263, 263,
|
||||
/* 860 */ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
|
||||
};
|
||||
#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, 9, 221, 231, 106, 106,
|
||||
/* 10 */ 106, 106, 106, 106, 106, 106, 106, 0, 48, 231,
|
||||
/* 20 */ 290, 290, 290, 290, 121, 149, 106, 106, 106, 276,
|
||||
/* 30 */ 106, 106, 55, 9, 37, 37, 680, 680, 680, 231,
|
||||
/* 20 */ 290, 290, 290, 290, 121, 149, 106, 106, 106, 237,
|
||||
/* 30 */ 106, 106, 55, 9, 37, 37, 683, 683, 683, 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, 78, 78, 78, 78, 78, 78, 78, 106, 106,
|
||||
/* 70 */ 106, 274, 106, 149, 149, 106, 106, 106, 257, 257,
|
||||
/* 80 */ 279, 149, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 70 */ 106, 264, 106, 149, 149, 106, 106, 106, 265, 265,
|
||||
/* 80 */ 276, 149, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 90 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 100 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 110 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 120 */ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
|
||||
/* 130 */ 106, 106, 411, 411, 411, 361, 361, 361, 411, 361,
|
||||
/* 140 */ 411, 366, 368, 364, 365, 377, 386, 391, 401, 431,
|
||||
/* 150 */ 397, 411, 411, 411, 379, 9, 9, 411, 411, 466,
|
||||
/* 160 */ 398, 506, 474, 473, 505, 476, 479, 379, 411, 483,
|
||||
/* 170 */ 483, 411, 483, 411, 483, 411, 680, 680, 27, 100,
|
||||
/* 130 */ 106, 106, 411, 411, 411, 365, 365, 365, 411, 365,
|
||||
/* 140 */ 411, 368, 370, 375, 372, 369, 371, 385, 390, 395,
|
||||
/* 150 */ 397, 411, 411, 411, 378, 9, 9, 411, 411, 444,
|
||||
/* 160 */ 464, 504, 474, 475, 507, 478, 481, 378, 411, 485,
|
||||
/* 170 */ 485, 411, 485, 411, 485, 411, 683, 683, 27, 100,
|
||||
/* 180 */ 127, 100, 100, 53, 182, 280, 280, 280, 280, 259,
|
||||
/* 190 */ 281, 298, 338, 338, 338, 338, 22, 14, 212, 212,
|
||||
/* 200 */ 237, 151, 320, 282, 285, 287, 288, 294, 295, 297,
|
||||
/* 210 */ 232, 329, 378, 303, 229, 296, 299, 304, 305, 307,
|
||||
/* 220 */ 312, 313, 316, 286, 291, 293, 330, 300, 428, 435,
|
||||
/* 230 */ 367, 383, 561, 422, 564, 565, 429, 570, 571, 487,
|
||||
/* 240 */ 489, 444, 467, 475, 477, 469, 480, 490, 499, 501,
|
||||
/* 250 */ 502, 497, 504, 610, 508, 509, 512, 510, 494, 511,
|
||||
/* 260 */ 495, 516, 518, 513, 519, 475, 521, 520, 522, 523,
|
||||
/* 270 */ 537, 619, 624, 625, 627, 628, 629, 555, 621, 562,
|
||||
/* 280 */ 498, 530, 530, 626, 507, 514, 530, 635, 636, 538,
|
||||
/* 290 */ 530, 639, 640, 642, 643, 644, 645, 646, 647, 649,
|
||||
/* 300 */ 650, 651, 652, 653, 654, 655, 656, 657, 554, 584,
|
||||
/* 310 */ 648, 658, 605, 607, 667,
|
||||
/* 200 */ 329, 340, 274, 151, 322, 286, 250, 288, 289, 291,
|
||||
/* 210 */ 294, 297, 380, 305, 296, 108, 295, 303, 306, 309,
|
||||
/* 220 */ 311, 314, 318, 292, 299, 301, 323, 304, 421, 427,
|
||||
/* 230 */ 359, 382, 560, 422, 565, 566, 428, 567, 569, 487,
|
||||
/* 240 */ 486, 446, 469, 476, 480, 471, 482, 477, 483, 488,
|
||||
/* 250 */ 484, 501, 508, 610, 510, 511, 513, 506, 495, 512,
|
||||
/* 260 */ 497, 517, 519, 514, 520, 476, 522, 521, 523, 524,
|
||||
/* 270 */ 553, 621, 626, 628, 629, 630, 631, 557, 623, 563,
|
||||
/* 280 */ 502, 531, 531, 627, 503, 505, 531, 640, 641, 542,
|
||||
/* 290 */ 531, 643, 644, 645, 646, 647, 648, 649, 650, 651,
|
||||
/* 300 */ 652, 653, 654, 655, 656, 657, 658, 659, 556, 586,
|
||||
/* 310 */ 660, 661, 607, 609, 669,
|
||||
};
|
||||
#define YY_REDUCE_COUNT (177)
|
||||
#define YY_REDUCE_MIN (-240)
|
||||
#define YY_REDUCE_MAX (409)
|
||||
#define YY_REDUCE_MAX (417)
|
||||
static const short yy_reduce_ofst[] = {
|
||||
/* 0 */ -178, -27, -27, 66, 66, 17, -230, -216, -173, -176,
|
||||
/* 10 */ -45, -8, 61, 68, 77, 124, 148, -185, -188, -233,
|
||||
/* 20 */ -206, -91, 21, 46, -191, 32, -186, -183, 93, -89,
|
||||
/* 30 */ -184, -106, 4, 104, 98, 120, 128, 159, 179, -240,
|
||||
/* 40 */ -217, -194, -117, -96, -51, -35, -18, 25, 94, 110,
|
||||
/* 50 */ 142, 167, 174, 185, 189, 195, 196, 197, 198, 175,
|
||||
/* 60 */ 215, 225, 226, 227, 228, 230, 233, 234, 265, 267,
|
||||
/* 70 */ 268, 211, 272, 235, 236, 273, 275, 277, 206, 208,
|
||||
/* 80 */ 238, 239, 283, 284, 289, 292, 301, 302, 306, 308,
|
||||
/* 90 */ 309, 310, 311, 314, 315, 317, 318, 319, 321, 322,
|
||||
/* 100 */ 323, 324, 325, 326, 327, 328, 331, 332, 333, 334,
|
||||
/* 110 */ 335, 336, 337, 339, 340, 341, 342, 343, 344, 345,
|
||||
/* 120 */ 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
|
||||
/* 130 */ 356, 357, 358, 359, 360, 217, 222, 224, 362, 240,
|
||||
/* 140 */ 363, 241, 243, 242, 251, 260, 278, 244, 369, 245,
|
||||
/* 150 */ 370, 371, 372, 373, 256, 374, 375, 376, 381, 380,
|
||||
/* 160 */ 382, 384, 385, 387, 388, 389, 393, 390, 392, 402,
|
||||
/* 170 */ 403, 394, 404, 406, 407, 409, 405, 408,
|
||||
/* 30 */ -184, -106, 4, 47, 98, 162, 83, 142, 179, -240,
|
||||
/* 40 */ -217, -194, -117, -96, -51, -18, 25, 94, 105, 153,
|
||||
/* 50 */ 158, 161, 169, 181, 189, 195, 196, 197, 198, 215,
|
||||
/* 60 */ 216, 226, 227, 228, 229, 232, 233, 234, 267, 271,
|
||||
/* 70 */ 272, 213, 275, 235, 236, 277, 282, 283, 206, 208,
|
||||
/* 80 */ 238, 241, 287, 293, 300, 302, 307, 308, 310, 312,
|
||||
/* 90 */ 313, 315, 316, 317, 319, 320, 321, 324, 325, 326,
|
||||
/* 100 */ 327, 328, 330, 331, 332, 333, 334, 335, 336, 337,
|
||||
/* 110 */ 339, 341, 342, 343, 344, 345, 346, 347, 348, 349,
|
||||
/* 120 */ 350, 351, 352, 353, 354, 355, 356, 357, 358, 360,
|
||||
/* 130 */ 361, 362, 285, 363, 364, 217, 224, 225, 366, 230,
|
||||
/* 140 */ 367, 239, 242, 240, 243, 246, 254, 278, 273, 373,
|
||||
/* 150 */ 244, 374, 376, 377, 379, 381, 383, 384, 387, 386,
|
||||
/* 160 */ 388, 391, 389, 393, 396, 392, 399, 394, 398, 400,
|
||||
/* 170 */ 408, 410, 412, 414, 415, 417, 405, 413,
|
||||
};
|
||||
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 *****************************/
|
||||
|
||||
|
@ -1243,48 +1244,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 */
|
||||
|
||||
|
@ -1975,48 +1978,50 @@ static const struct {
|
|||
{ 252, -1 }, /* (222) expr ::= STRING */
|
||||
{ 252, -1 }, /* (223) expr ::= NOW */
|
||||
{ 252, -1 }, /* (224) expr ::= VARIABLE */
|
||||
{ 252, -1 }, /* (225) expr ::= BOOL */
|
||||
{ 252, -1 }, /* (226) expr ::= NULL */
|
||||
{ 252, -4 }, /* (227) expr ::= ID LP exprlist RP */
|
||||
{ 252, -4 }, /* (228) expr ::= ID LP STAR RP */
|
||||
{ 252, -3 }, /* (229) expr ::= expr IS NULL */
|
||||
{ 252, -4 }, /* (230) expr ::= expr IS NOT NULL */
|
||||
{ 252, -3 }, /* (231) expr ::= expr LT expr */
|
||||
{ 252, -3 }, /* (232) expr ::= expr GT expr */
|
||||
{ 252, -3 }, /* (233) expr ::= expr LE expr */
|
||||
{ 252, -3 }, /* (234) expr ::= expr GE expr */
|
||||
{ 252, -3 }, /* (235) expr ::= expr NE expr */
|
||||
{ 252, -3 }, /* (236) expr ::= expr EQ expr */
|
||||
{ 252, -5 }, /* (237) expr ::= expr BETWEEN expr AND expr */
|
||||
{ 252, -3 }, /* (238) expr ::= expr AND expr */
|
||||
{ 252, -3 }, /* (239) expr ::= expr OR expr */
|
||||
{ 252, -3 }, /* (240) expr ::= expr PLUS expr */
|
||||
{ 252, -3 }, /* (241) expr ::= expr MINUS expr */
|
||||
{ 252, -3 }, /* (242) expr ::= expr STAR expr */
|
||||
{ 252, -3 }, /* (243) expr ::= expr SLASH expr */
|
||||
{ 252, -3 }, /* (244) expr ::= expr REM expr */
|
||||
{ 252, -3 }, /* (245) expr ::= expr LIKE expr */
|
||||
{ 252, -5 }, /* (246) expr ::= expr IN LP exprlist RP */
|
||||
{ 261, -3 }, /* (247) exprlist ::= exprlist COMMA expritem */
|
||||
{ 261, -1 }, /* (248) exprlist ::= expritem */
|
||||
{ 262, -1 }, /* (249) expritem ::= expr */
|
||||
{ 262, 0 }, /* (250) expritem ::= */
|
||||
{ 189, -3 }, /* (251) cmd ::= RESET QUERY CACHE */
|
||||
{ 189, -3 }, /* (252) cmd ::= SYNCDB ids REPLICA */
|
||||
{ 189, -7 }, /* (253) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
{ 189, -7 }, /* (254) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
{ 189, -7 }, /* (255) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
{ 189, -7 }, /* (256) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
{ 189, -8 }, /* (257) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
{ 189, -9 }, /* (258) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
{ 189, -7 }, /* (259) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
{ 189, -7 }, /* (260) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
{ 189, -7 }, /* (261) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
{ 189, -7 }, /* (262) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
{ 189, -8 }, /* (263) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
{ 189, -3 }, /* (264) cmd ::= KILL CONNECTION INTEGER */
|
||||
{ 189, -5 }, /* (265) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
{ 189, -5 }, /* (266) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
{ 252, -2 }, /* (225) expr ::= PLUS VARIABLE */
|
||||
{ 252, -2 }, /* (226) expr ::= MINUS VARIABLE */
|
||||
{ 252, -1 }, /* (227) expr ::= BOOL */
|
||||
{ 252, -1 }, /* (228) expr ::= NULL */
|
||||
{ 252, -4 }, /* (229) expr ::= ID LP exprlist RP */
|
||||
{ 252, -4 }, /* (230) expr ::= ID LP STAR RP */
|
||||
{ 252, -3 }, /* (231) expr ::= expr IS NULL */
|
||||
{ 252, -4 }, /* (232) expr ::= expr IS NOT NULL */
|
||||
{ 252, -3 }, /* (233) expr ::= expr LT expr */
|
||||
{ 252, -3 }, /* (234) expr ::= expr GT expr */
|
||||
{ 252, -3 }, /* (235) expr ::= expr LE expr */
|
||||
{ 252, -3 }, /* (236) expr ::= expr GE expr */
|
||||
{ 252, -3 }, /* (237) expr ::= expr NE expr */
|
||||
{ 252, -3 }, /* (238) expr ::= expr EQ expr */
|
||||
{ 252, -5 }, /* (239) expr ::= expr BETWEEN expr AND expr */
|
||||
{ 252, -3 }, /* (240) expr ::= expr AND expr */
|
||||
{ 252, -3 }, /* (241) expr ::= expr OR expr */
|
||||
{ 252, -3 }, /* (242) expr ::= expr PLUS expr */
|
||||
{ 252, -3 }, /* (243) expr ::= expr MINUS expr */
|
||||
{ 252, -3 }, /* (244) expr ::= expr STAR expr */
|
||||
{ 252, -3 }, /* (245) expr ::= expr SLASH expr */
|
||||
{ 252, -3 }, /* (246) expr ::= expr REM expr */
|
||||
{ 252, -3 }, /* (247) expr ::= expr LIKE expr */
|
||||
{ 252, -5 }, /* (248) expr ::= expr IN LP exprlist RP */
|
||||
{ 261, -3 }, /* (249) exprlist ::= exprlist COMMA expritem */
|
||||
{ 261, -1 }, /* (250) exprlist ::= expritem */
|
||||
{ 262, -1 }, /* (251) expritem ::= expr */
|
||||
{ 262, 0 }, /* (252) expritem ::= */
|
||||
{ 189, -3 }, /* (253) cmd ::= RESET QUERY CACHE */
|
||||
{ 189, -3 }, /* (254) cmd ::= SYNCDB ids REPLICA */
|
||||
{ 189, -7 }, /* (255) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
|
||||
{ 189, -7 }, /* (256) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
|
||||
{ 189, -7 }, /* (257) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
|
||||
{ 189, -7 }, /* (258) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
|
||||
{ 189, -8 }, /* (259) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
|
||||
{ 189, -9 }, /* (260) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
|
||||
{ 189, -7 }, /* (261) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
|
||||
{ 189, -7 }, /* (262) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
|
||||
{ 189, -7 }, /* (263) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
|
||||
{ 189, -7 }, /* (264) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
|
||||
{ 189, -8 }, /* (265) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
|
||||
{ 189, -3 }, /* (266) cmd ::= KILL CONNECTION INTEGER */
|
||||
{ 189, -5 }, /* (267) cmd ::= KILL STREAM INTEGER COLON INTEGER */
|
||||
{ 189, -5 }, /* (268) cmd ::= KILL QUERY INTEGER COLON INTEGER */
|
||||
};
|
||||
|
||||
static void yy_accept(yyParser*); /* Forward Declaration */
|
||||
|
@ -2794,7 +2799,7 @@ static void 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.yy118 = 0;}
|
||||
break;
|
||||
case 201: /* having_opt ::= HAVING expr */
|
||||
|
@ -2867,120 +2872,125 @@ static void yy_reduce(
|
|||
{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
|
||||
yymsp[0].minor.yy118 = yylhsminor.yy118;
|
||||
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.yy118 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
|
||||
yymsp[-1].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 227: /* expr ::= BOOL */
|
||||
{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
|
||||
yymsp[0].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 226: /* expr ::= NULL */
|
||||
case 228: /* expr ::= NULL */
|
||||
{ yylhsminor.yy118 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
|
||||
yymsp[0].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 227: /* expr ::= ID LP exprlist RP */
|
||||
case 229: /* expr ::= ID LP exprlist RP */
|
||||
{ yylhsminor.yy118 = tSqlExprCreateFunction(yymsp[-1].minor.yy159, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
|
||||
yymsp[-3].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 228: /* expr ::= ID LP STAR RP */
|
||||
case 230: /* expr ::= ID LP STAR RP */
|
||||
{ yylhsminor.yy118 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
|
||||
yymsp[-3].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 229: /* expr ::= expr IS NULL */
|
||||
case 231: /* expr ::= expr IS NULL */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, NULL, TK_ISNULL);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 230: /* expr ::= expr IS NOT NULL */
|
||||
case 232: /* expr ::= expr IS NOT NULL */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-3].minor.yy118, NULL, TK_NOTNULL);}
|
||||
yymsp[-3].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 231: /* expr ::= expr LT expr */
|
||||
case 233: /* expr ::= expr LT expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LT);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 232: /* expr ::= expr GT expr */
|
||||
case 234: /* expr ::= expr GT expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GT);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 233: /* expr ::= expr LE expr */
|
||||
case 235: /* expr ::= expr LE expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LE);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 234: /* expr ::= expr GE expr */
|
||||
case 236: /* expr ::= expr GE expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_GE);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 235: /* expr ::= expr NE expr */
|
||||
case 237: /* expr ::= expr NE expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_NE);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 236: /* expr ::= expr EQ expr */
|
||||
case 238: /* expr ::= expr EQ expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_EQ);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 237: /* expr ::= expr BETWEEN expr AND expr */
|
||||
case 239: /* expr ::= expr BETWEEN expr AND expr */
|
||||
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy118); yylhsminor.yy118 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy118, yymsp[-2].minor.yy118, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy118, TK_LE), TK_AND);}
|
||||
yymsp[-4].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 238: /* expr ::= expr AND expr */
|
||||
case 240: /* expr ::= expr AND expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_AND);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 239: /* expr ::= expr OR expr */
|
||||
case 241: /* expr ::= expr OR expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_OR); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 240: /* expr ::= expr PLUS expr */
|
||||
case 242: /* expr ::= expr PLUS expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_PLUS); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 241: /* expr ::= expr MINUS expr */
|
||||
case 243: /* expr ::= expr MINUS expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_MINUS); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 242: /* expr ::= expr STAR expr */
|
||||
case 244: /* expr ::= expr STAR expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_STAR); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 243: /* expr ::= expr SLASH expr */
|
||||
case 245: /* expr ::= expr SLASH expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_DIVIDE);}
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 244: /* expr ::= expr REM expr */
|
||||
case 246: /* expr ::= expr REM expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_REM); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 245: /* expr ::= expr LIKE expr */
|
||||
case 247: /* expr ::= expr LIKE expr */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-2].minor.yy118, yymsp[0].minor.yy118, TK_LIKE); }
|
||||
yymsp[-2].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 246: /* expr ::= expr IN LP exprlist RP */
|
||||
case 248: /* expr ::= expr IN LP exprlist RP */
|
||||
{yylhsminor.yy118 = tSqlExprCreate(yymsp[-4].minor.yy118, (tSqlExpr*)yymsp[-1].minor.yy159, TK_IN); }
|
||||
yymsp[-4].minor.yy118 = yylhsminor.yy118;
|
||||
break;
|
||||
case 247: /* exprlist ::= exprlist COMMA expritem */
|
||||
case 249: /* exprlist ::= exprlist COMMA expritem */
|
||||
{yylhsminor.yy159 = tSqlExprListAppend(yymsp[-2].minor.yy159,yymsp[0].minor.yy118,0, 0);}
|
||||
yymsp[-2].minor.yy159 = yylhsminor.yy159;
|
||||
break;
|
||||
case 248: /* exprlist ::= expritem */
|
||||
case 250: /* exprlist ::= expritem */
|
||||
{yylhsminor.yy159 = tSqlExprListAppend(0,yymsp[0].minor.yy118,0, 0);}
|
||||
yymsp[0].minor.yy159 = yylhsminor.yy159;
|
||||
break;
|
||||
case 249: /* expritem ::= expr */
|
||||
case 251: /* expritem ::= expr */
|
||||
{yylhsminor.yy118 = yymsp[0].minor.yy118;}
|
||||
yymsp[0].minor.yy118 = yylhsminor.yy118;
|
||||
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.yy159, 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;
|
||||
|
||||
|
@ -2991,14 +3001,14 @@ static void 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.yy159, 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;
|
||||
|
||||
|
@ -3009,7 +3019,7 @@ static void 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;
|
||||
|
||||
|
@ -3023,7 +3033,7 @@ static void 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;
|
||||
|
||||
|
@ -3035,14 +3045,14 @@ static void 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.yy159, 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;
|
||||
|
||||
|
@ -3053,14 +3063,14 @@ static void 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.yy159, 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;
|
||||
|
||||
|
@ -3071,7 +3081,7 @@ static void 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;
|
||||
|
||||
|
@ -3085,13 +3095,13 @@ static void 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);
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@
|
|||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>2.0.20</version>
|
||||
<version>2.0.28</version>
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${project.basedir}/src/main/resources/taos-jdbcdriver-2.0.20-dist.jar</systemPath>-->
|
||||
<!-- <systemPath>${project.basedir}/src/main/resources/taos-jdbcdriver-2.0.28-dist.jar</systemPath>-->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@MapperScan(basePackages = {"com.taosdata.example.springbootdemo.dao"})
|
||||
@SpringBootApplication
|
||||
public class SpringbootdemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringbootdemoApplication.class, args);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class WeatherController {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("/{temperature}/{humidity}")
|
||||
public int saveWeather(@PathVariable float temperature, @PathVariable int humidity) {
|
||||
public int saveWeather(@PathVariable float temperature, @PathVariable float humidity) {
|
||||
return weatherService.save(temperature, humidity);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ public class Weather {
|
|||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
|
||||
private Timestamp ts;
|
||||
private float temperature;
|
||||
private float humidity;
|
||||
private Float temperature;
|
||||
private Float humidity;
|
||||
private String location;
|
||||
private int groupId;
|
||||
|
||||
|
@ -30,19 +30,19 @@ public class Weather {
|
|||
this.ts = ts;
|
||||
}
|
||||
|
||||
public float getTemperature() {
|
||||
public Float getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public void setTemperature(float temperature) {
|
||||
public void setTemperature(Float temperature) {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
|
||||
public float getHumidity() {
|
||||
public Float getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
public void setHumidity(float humidity) {
|
||||
public void setHumidity(Float humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WeatherService {
|
|||
return weatherMapper.select(limit, offset);
|
||||
}
|
||||
|
||||
public int save(float temperature, int humidity) {
|
||||
public int save(float temperature, float humidity) {
|
||||
Weather weather = new Weather();
|
||||
weather.setTemperature(temperature);
|
||||
weather.setHumidity(humidity);
|
||||
|
|
|
@ -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
|
|
@ -161,7 +161,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
|
||||
|
Loading…
Reference in New Issue