merge 3.0
This commit is contained in:
commit
f24f2eff42
|
@ -1,5 +1,5 @@
|
|||
|
||||
# zlib
|
||||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG df8678f
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
# zlib
|
||||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 2.1.1
|
||||
GIT_TAG 9dc2fec
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# zlib
|
||||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosws-rs.git
|
||||
GIT_TAG 9de599d
|
||||
|
|
|
@ -27,10 +27,6 @@ else ()
|
|||
cat("${TD_SUPPORT_DIR}/taosadapter_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
if(TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||
cat("${TD_SUPPORT_DIR}/jemalloc_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
@ -418,18 +414,6 @@ if(${BUILD_ADDR2LINE})
|
|||
endif(NOT ${TD_WINDOWS})
|
||||
endif(${BUILD_ADDR2LINE})
|
||||
|
||||
# jemalloc
|
||||
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(jemalloc
|
||||
PREFIX "jemalloc"
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/
|
||||
BUILD_COMMAND ${MAKE}
|
||||
)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/build/include)
|
||||
ENDIF ()
|
||||
|
||||
# ================================================================================================
|
||||
# Build test
|
||||
|
|
|
@ -25,9 +25,9 @@ TDengine 分布式架构的逻辑结构图如下:
|
|||
|
||||
**管理节点(mnode):** 一个虚拟的逻辑单元,负责所有数据节点运行状态的监控和维护,以及节点之间的负载均衡(图中 M)。同时,管理节点也负责元数据(包括用户、数据库、超级表等)的存储和管理,因此也称为 Meta Node。TDengine 集群中可配置多个(最多不超过 3 个)mnode,它们自动构建成为一个虚拟管理节点组(图中 M1,M2,M3)。mnode 支持多副本,采用 RAFT 一致性协议,保证系统的高可用与高可靠,任何数据更新操作只能在 Leader 上进行。mnode 集群的第一个节点在集群部署时自动完成,其他节点的创建与删除由用户通过 SQL 命令完成。每个 dnode 上至多有一个 mnode,由所属的数据节点的 EP 来唯一标识。每个 dnode 通过内部消息交互自动获取整个集群中所有 mnode 所在的 dnode 的 EP。
|
||||
|
||||
**弹性计算点(qnode):** 一个虚拟的逻辑单元,运行查询计算任务,也包括基于系统表来实现的 show 命令(图中 Q)。集群中可配置多个 qnode,在整个集群内部共享使用(图中 Q1,Q2,Q3)。qnode 不与具体的 DB 绑定,即一个 qnode 可以同时执行多个 DB 的查询任务。每个 dnode 上至多有一个 qnode,由所属的数据节点的 EP 来唯一标识。客户端通过与 mnode 交互,获取可用的 qnode 列表,当没有可用的 qnode 时,计算任务在 vnode 中执行。
|
||||
**弹性计算节点(qnode):** 一个虚拟的逻辑单元,运行查询计算任务,也包括基于系统表来实现的 show 命令(图中 Q)。集群中可配置多个 qnode,在整个集群内部共享使用(图中 Q1,Q2,Q3)。qnode 不与具体的 DB 绑定,即一个 qnode 可以同时执行多个 DB 的查询任务。每个 dnode 上至多有一个 qnode,由所属的数据节点的 EP 来唯一标识。客户端通过与 mnode 交互,获取可用的 qnode 列表,当没有可用的 qnode 时,计算任务在 vnode 中执行。
|
||||
|
||||
**流计算点(snode):** 一个虚拟的逻辑单元,只运行流计算任务(图中 S)。集群中可配置多个 snode,在整个集群内部共享使用(图中 S1,S2,S3)。snode 不与具体的 stream 绑定,即一个 snode 可以同时执行多个 stream 的计算任务。每个 dnode 上至多有一个 snode,由所属的数据节点的 EP 来唯一标识。由 mnode 调度可用的 snode 完成流计算任务,当没有可用的 snode 时,流计算任务在 vnode 中执行。
|
||||
**流计算节点(snode):** 一个虚拟的逻辑单元,只运行流计算任务(图中 S)。集群中可配置多个 snode,在整个集群内部共享使用(图中 S1,S2,S3)。snode 不与具体的 stream 绑定,即一个 snode 可以同时执行多个 stream 的计算任务。每个 dnode 上至多有一个 snode,由所属的数据节点的 EP 来唯一标识。由 mnode 调度可用的 snode 完成流计算任务,当没有可用的 snode 时,流计算任务在 vnode 中执行。
|
||||
|
||||
**虚拟节点组(VGroup):** 不同数据节点上的 vnode 可以组成一个虚拟节点组(vgroup),采用 RAFT 一致性协议,保证系统的高可用与高可靠。写操作只能在 leader vnode 上进行,系统采用异步复制的方式将数据同步到 follower vnode,这样确保了一份数据在多个物理节点上有拷贝。一个 vgroup 里虚拟节点个数就是数据的副本数。如果一个 DB 的副本数为 N,系统必须有至少 N 数据节点。副本数在创建 DB 时通过参数 replica 可以指定,缺省为 1。使用 TDengine 的多副本特性,可以不再需要昂贵的磁盘阵列等存储设备,就可以获得同样的数据高可靠性。虚拟节点组由管理节点创建、管理,并且由管理节点分配一个系统唯一的 ID,VGroup ID。如果两个虚拟节点的 VGroup ID 相同,说明他们属于同一个组,数据互为备份。虚拟节点组里虚拟节点的个数是可以动态改变的,容许只有一个,也就是没有数据复制。VGroup ID 是永远不变的,即使一个虚拟节点组被删除,它的 ID 也不会被收回重复利用。
|
||||
|
||||
|
@ -103,11 +103,11 @@ TDengine 存储的数据包括采集的时序数据以及库、表相关的元
|
|||
|
||||
vnode(虚拟数据节点)负责为采集的时序数据提供写入、查询和计算功能。为便于负载均衡、数据恢复、支持异构环境,TDengine 将一个数据节点根据其计算和存储资源切分为多个 vnode。这些 vnode 的管理是 TDengine 自动完成的,对应用完全透明。
|
||||
|
||||
对于单独一个数据采集点,无论其数据量多大,一个 vnode(或 vgroup,如果副本数大于 1)有足够的计算资源和存储资源来处理(如果每秒生成一条 16 字节的记录,一年产生的原始数据不到 0.5G),因此 TDengine 将一张表(一个数据采集点)的所有数据都存放在一个 vnode 里,而不会让同一个采集点的数据分布到两个或多个 dnode 上。而且一个 vnode 可存储多个数据采集点(表)的数据,一个 vnode 可容纳的表的数目的上限为一百万。设计上,一个 vnode 里所有的表都属于同一个 DB。一个数据节点上,除非特殊配置,一个 DB 拥有的 vnode 数目不会超过系统核的数目。
|
||||
对于单独一个数据采集点,无论其数据量多大,一个 vnode(或 vgroup,如果副本数大于 1)有足够的计算资源和存储资源来处理(如果每秒生成一条 16 字节的记录,一年产生的原始数据不到 0.5G),因此 TDengine 将一张表(一个数据采集点)的所有数据都存放在一个 vnode 里,而不会让同一个采集点的数据分布到两个或多个 dnode 上。而且一个 vnode 可存储多个数据采集点(表)的数据,一个 vnode 可容纳的表的数目的上限为一百万。设计上,一个 vnode 里所有的表都属于同一个 DB。
|
||||
|
||||
TDengine 3.0 采用 hash 一致性算法,确定每张数据表所在的 vnode。创建 DB 时,系统会立刻分配指定数目的 vnode,并确定每个 vnode 所负责的数据表范围。当创建一张表时,系统根据数据表名计算出所在的 vnodeID,立即在该 vnode 创建表。如果 DB 有多个副本,系统不是只创建一个 vnode,而是一个 vgroup(虚拟数据节点组)。系统对 vnode 的数目没有任何限制,仅仅受限于物理节点本身的计算和存储资源。
|
||||
|
||||
每张表的 meta data(包含 schema,标签等)也存放于 vnode 里,而不是集中存放于 mnode,实际上这是对 Meta 数据的分片,这样便于高效并行的进行标签过滤操作。
|
||||
每张表的 meta data(包含 schema,标签等)也存放于 vnode 里,而不是集中存放于 mnode,实际上这是对 meta 数据的分片,这样便于高效并行的进行标签过滤操作。
|
||||
|
||||
### 数据分区
|
||||
|
||||
|
|
|
@ -271,8 +271,6 @@ DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
|
|||
DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw);
|
||||
DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw);
|
||||
DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char* tbname);
|
||||
|
||||
|
||||
DLL_EXPORT void tmq_free_raw(tmq_raw_data raw);
|
||||
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed by tmq_free_json_meta
|
||||
DLL_EXPORT void tmq_free_json_meta(char* jsonMeta);
|
||||
|
|
|
@ -1404,7 +1404,7 @@ typedef struct STableScanAnalyzeInfo {
|
|||
uint32_t skipBlocks;
|
||||
uint32_t filterOutBlocks;
|
||||
double elapsedTime;
|
||||
uint64_t filterTime;
|
||||
double filterTime;
|
||||
} STableScanAnalyzeInfo;
|
||||
|
||||
int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp);
|
||||
|
|
|
@ -157,6 +157,13 @@ typedef enum EFunctionType {
|
|||
FUNCTION_TYPE_UDF = 10000
|
||||
} EFunctionType;
|
||||
|
||||
typedef enum EFuncReturnRows {
|
||||
FUNC_RETURN_ROWS_NORMAL = 1,
|
||||
FUNC_RETURN_ROWS_INDEFINITE,
|
||||
FUNC_RETURN_ROWS_N,
|
||||
FUNC_RETURN_ROWS_N_MINUS_1
|
||||
} EFuncReturnRows;
|
||||
|
||||
struct SqlFunctionCtx;
|
||||
struct SResultRowEntryInfo;
|
||||
struct STimeWindow;
|
||||
|
@ -167,6 +174,8 @@ void fmFuncMgtDestroy();
|
|||
|
||||
int32_t fmGetFuncInfo(SFunctionNode* pFunc, char* pMsg, int32_t msgLen);
|
||||
|
||||
EFuncReturnRows fmGetFuncReturnRows(SFunctionNode* pFunc);
|
||||
|
||||
bool fmIsBuiltinFunc(const char* pFunc);
|
||||
|
||||
bool fmIsAggFunc(int32_t funcId);
|
||||
|
@ -198,6 +207,7 @@ bool fmIsImplicitTsFunc(int32_t funcId);
|
|||
bool fmIsClientPseudoColumnFunc(int32_t funcId);
|
||||
bool fmIsMultiRowsFunc(int32_t funcId);
|
||||
bool fmIsKeepOrderFunc(int32_t funcId);
|
||||
bool fmIsCumulativeFunc(int32_t funcId);
|
||||
|
||||
int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc);
|
||||
|
||||
|
|
|
@ -253,6 +253,7 @@ typedef struct SSelectStmt {
|
|||
char stmtName[TSDB_TABLE_NAME_LEN];
|
||||
uint8_t precision;
|
||||
int32_t selectFuncNum;
|
||||
int32_t returnRows; // EFuncReturnRows
|
||||
bool isEmptyResult;
|
||||
bool isTimeLineResult;
|
||||
bool isSubquery;
|
||||
|
|
|
@ -84,32 +84,11 @@
|
|||
typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType;
|
||||
|
||||
typedef enum {
|
||||
SCHEMA_ACTION_CREATE_STABLE,
|
||||
SCHEMA_ACTION_ADD_COLUMN,
|
||||
SCHEMA_ACTION_ADD_TAG,
|
||||
SCHEMA_ACTION_CHANGE_COLUMN_SIZE,
|
||||
SCHEMA_ACTION_CHANGE_TAG_SIZE,
|
||||
SCHEMA_ACTION_NULL,
|
||||
SCHEMA_ACTION_COLUMN,
|
||||
SCHEMA_ACTION_TAG
|
||||
} ESchemaAction;
|
||||
|
||||
typedef struct {
|
||||
char sTableName[TSDB_TABLE_NAME_LEN];
|
||||
SArray *tags;
|
||||
SArray *fields;
|
||||
} SCreateSTableActionInfo;
|
||||
|
||||
typedef struct {
|
||||
char sTableName[TSDB_TABLE_NAME_LEN];
|
||||
SSmlKv *field;
|
||||
} SAlterSTableActionInfo;
|
||||
|
||||
typedef struct {
|
||||
ESchemaAction action;
|
||||
union {
|
||||
SCreateSTableActionInfo createSTable;
|
||||
SAlterSTableActionInfo alterSTable;
|
||||
};
|
||||
} SSchemaAction;
|
||||
|
||||
typedef struct {
|
||||
const char *measure;
|
||||
const char *tags;
|
||||
|
@ -226,6 +205,7 @@ static inline bool smlCheckDuplicateKey(const char *key, int32_t keyLen, SHashOb
|
|||
}
|
||||
|
||||
static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2) {
|
||||
if(pBuf->buf){
|
||||
memset(pBuf->buf, 0, pBuf->len);
|
||||
if (msg1) strncat(pBuf->buf, msg1, pBuf->len);
|
||||
int32_t left = pBuf->len - strlen(pBuf->buf);
|
||||
|
@ -233,11 +213,12 @@ static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const
|
|||
strncat(pBuf->buf, ":", left - 1);
|
||||
strncat(pBuf->buf, msg2, left - 2);
|
||||
}
|
||||
}
|
||||
return TSDB_CODE_SML_INVALID_DATA;
|
||||
}
|
||||
|
||||
static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSmlKv *kv, bool isTag,
|
||||
SSchemaAction *action, bool *actionNeeded, SSmlHandle *info) {
|
||||
ESchemaAction *action, SSmlHandle *info) {
|
||||
uint16_t *index = (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen);
|
||||
if (index) {
|
||||
if (colField[*index].type != kv->type) {
|
||||
|
@ -251,25 +232,17 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm
|
|||
(colField[*index].type == TSDB_DATA_TYPE_NCHAR &&
|
||||
((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) {
|
||||
if (isTag) {
|
||||
action->action = SCHEMA_ACTION_CHANGE_TAG_SIZE;
|
||||
*action = SCHEMA_ACTION_TAG;
|
||||
} else {
|
||||
action->action = SCHEMA_ACTION_CHANGE_COLUMN_SIZE;
|
||||
*action = SCHEMA_ACTION_COLUMN;
|
||||
}
|
||||
action->alterSTable.field = kv;
|
||||
*actionNeeded = true;
|
||||
}
|
||||
} else {
|
||||
if (isTag) {
|
||||
action->action = SCHEMA_ACTION_ADD_TAG;
|
||||
*action = SCHEMA_ACTION_TAG;
|
||||
} else {
|
||||
action->action = SCHEMA_ACTION_ADD_COLUMN;
|
||||
*action = SCHEMA_ACTION_COLUMN;
|
||||
}
|
||||
action->alterSTable.field = kv;
|
||||
*actionNeeded = true;
|
||||
}
|
||||
if (*actionNeeded) {
|
||||
uDebug("SML:0x%" PRIx64 " generate schema action. kv->name: %s, action: %d", info->id, kv->key,
|
||||
action->action);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -284,171 +257,25 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) {
|
|||
} else if (type == TSDB_DATA_TYPE_NCHAR && result > (TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE){
|
||||
result = (TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
|
||||
}
|
||||
|
||||
if (type == TSDB_DATA_TYPE_NCHAR){
|
||||
result = result * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
|
||||
}else if (type == TSDB_DATA_TYPE_BINARY){
|
||||
result = result + VARSTR_HEADER_SIZE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int32_t smlBuildColumnDescription(SSmlKv *field, char *buf, int32_t bufSize, int32_t *outBytes) {
|
||||
uint8_t type = field->type;
|
||||
char tname[TSDB_TABLE_NAME_LEN] = {0};
|
||||
memcpy(tname, field->key, field->keyLen);
|
||||
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
|
||||
int32_t bytes = smlFindNearestPowerOf2(field->length, type);
|
||||
int out = snprintf(buf, bufSize, "`%s` %s(%d)", tname, tDataTypes[field->type].name, bytes);
|
||||
*outBytes = out;
|
||||
} else {
|
||||
int out = snprintf(buf, bufSize, "`%s` %s", tname, tDataTypes[type].name);
|
||||
*outBytes = out;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
|
||||
int32_t code = 0;
|
||||
int32_t outBytes = 0;
|
||||
char *result = (char *)taosMemoryCalloc(1, TSDB_MAX_ALLOWED_SQL_LEN);
|
||||
int32_t capacity = TSDB_MAX_ALLOWED_SQL_LEN;
|
||||
|
||||
uDebug("SML:0x%" PRIx64 " apply schema action. action: %d", info->id, action->action);
|
||||
switch (action->action) {
|
||||
case SCHEMA_ACTION_ADD_COLUMN: {
|
||||
int n = sprintf(result, "alter stable `%s` add column ", action->alterSTable.sTableName);
|
||||
smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes);
|
||||
TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery
|
||||
code = taos_errno(res);
|
||||
const char *errStr = taos_errstr(res);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action. error: %s", info->id, errStr);
|
||||
taosMsleep(100);
|
||||
}
|
||||
taos_free_result(res);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCHEMA_ACTION_ADD_TAG: {
|
||||
int n = sprintf(result, "alter stable `%s` add tag ", action->alterSTable.sTableName);
|
||||
smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes);
|
||||
TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery
|
||||
code = taos_errno(res);
|
||||
const char *errStr = taos_errstr(res);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res));
|
||||
taosMsleep(100);
|
||||
}
|
||||
taos_free_result(res);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCHEMA_ACTION_CHANGE_COLUMN_SIZE: {
|
||||
int n = sprintf(result, "alter stable `%s` modify column ", action->alterSTable.sTableName);
|
||||
smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes);
|
||||
TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery
|
||||
code = taos_errno(res);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res));
|
||||
taosMsleep(100);
|
||||
}
|
||||
taos_free_result(res);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCHEMA_ACTION_CHANGE_TAG_SIZE: {
|
||||
int n = sprintf(result, "alter stable `%s` modify tag ", action->alterSTable.sTableName);
|
||||
smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes);
|
||||
TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery
|
||||
code = taos_errno(res);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res));
|
||||
taosMsleep(100);
|
||||
}
|
||||
taos_free_result(res);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCHEMA_ACTION_CREATE_STABLE: {
|
||||
int n = sprintf(result, "create stable `%s` (", action->createSTable.sTableName);
|
||||
char *pos = result + n;
|
||||
int freeBytes = capacity - n;
|
||||
|
||||
SArray *cols = action->createSTable.fields;
|
||||
|
||||
for (int i = 0; i < taosArrayGetSize(cols); i++) {
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i);
|
||||
smlBuildColumnDescription(kv, pos, freeBytes, &outBytes);
|
||||
pos += outBytes;
|
||||
freeBytes -= outBytes;
|
||||
*pos = ',';
|
||||
++pos;
|
||||
--freeBytes;
|
||||
}
|
||||
|
||||
--pos;
|
||||
++freeBytes;
|
||||
|
||||
outBytes = snprintf(pos, freeBytes, ") tags (");
|
||||
pos += outBytes;
|
||||
freeBytes -= outBytes;
|
||||
|
||||
cols = action->createSTable.tags;
|
||||
for (int i = 0; i < taosArrayGetSize(cols); i++) {
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i);
|
||||
smlBuildColumnDescription(kv, pos, freeBytes, &outBytes);
|
||||
pos += outBytes;
|
||||
freeBytes -= outBytes;
|
||||
*pos = ',';
|
||||
++pos;
|
||||
--freeBytes;
|
||||
}
|
||||
if (taosArrayGetSize(cols) == 0) {
|
||||
outBytes = snprintf(pos, freeBytes, "`%s` %s(%d)", tsSmlTagName, tDataTypes[TSDB_DATA_TYPE_NCHAR].name, 1);
|
||||
pos += outBytes;
|
||||
freeBytes -= outBytes;
|
||||
*pos = ',';
|
||||
++pos;
|
||||
--freeBytes;
|
||||
}
|
||||
pos--;
|
||||
++freeBytes;
|
||||
outBytes = snprintf(pos, freeBytes, ")");
|
||||
TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result);
|
||||
code = taos_errno(res);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res));
|
||||
taosMsleep(100);
|
||||
}
|
||||
taos_free_result(res);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
taosMemoryFreeClear(result);
|
||||
if (code != 0) {
|
||||
uError("SML:0x%" PRIx64 " apply schema action failure. %s", info->id, tstrerror(code));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols,
|
||||
SSchemaAction *action, bool isTag) {
|
||||
ESchemaAction *action, bool isTag) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
for (int j = 0; j < taosArrayGetSize(cols); ++j) {
|
||||
if(j == 0 && !isTag) continue;
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, j);
|
||||
bool actionNeeded = false;
|
||||
code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, &actionNeeded, info);
|
||||
code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, info);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
if (actionNeeded) {
|
||||
code = smlApplySchemaAction(info, action);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -475,6 +302,144 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t getBytes(uint8_t type, int32_t length){
|
||||
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
|
||||
return smlFindNearestPowerOf2(length, type);
|
||||
} else {
|
||||
return tDataTypes[type].bytes;
|
||||
}
|
||||
}
|
||||
|
||||
//static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData,
|
||||
// int32_t colVer, int32_t tagVer, int8_t source, uint64_t suid){
|
||||
static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData,
|
||||
STableMeta *pTableMeta, ESchemaAction action){
|
||||
|
||||
SRequestObj* pRequest = NULL;
|
||||
SMCreateStbReq pReq = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SCmdMsgInfo pCmdMsg = {0};
|
||||
|
||||
code = buildRequest(info->taos->id, "", 0, NULL, false, &pRequest);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!pRequest->pDb) {
|
||||
code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (action == SCHEMA_ACTION_NULL){
|
||||
pReq.colVer = 1;
|
||||
pReq.tagVer = 1;
|
||||
pReq.suid = 0;
|
||||
pReq.source = TD_REQ_FROM_APP;
|
||||
} else if (action == SCHEMA_ACTION_TAG){
|
||||
pReq.colVer = pTableMeta->sversion;
|
||||
pReq.tagVer = pTableMeta->tversion + 1;
|
||||
pReq.suid = pTableMeta->uid;
|
||||
pReq.source = TD_REQ_FROM_TAOX;
|
||||
} else if (action == SCHEMA_ACTION_COLUMN){
|
||||
pReq.colVer = pTableMeta->sversion + 1;
|
||||
pReq.tagVer = pTableMeta->tversion;
|
||||
pReq.suid = pTableMeta->uid;
|
||||
pReq.source = TD_REQ_FROM_TAOX;
|
||||
}
|
||||
|
||||
pReq.commentLen = -1;
|
||||
pReq.igExists = true;
|
||||
tNameExtractFullName(pName, pReq.name);
|
||||
|
||||
if(action == SCHEMA_ACTION_NULL || action == SCHEMA_ACTION_COLUMN){
|
||||
pReq.numOfColumns = taosArrayGetSize(sTableData->cols);
|
||||
pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField));
|
||||
for (int i = 0; i < pReq.numOfColumns; i++) {
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->cols, i);
|
||||
SField field = {0};
|
||||
field.type = kv->type;
|
||||
field.bytes = getBytes(kv->type, kv->length);
|
||||
memcpy(field.name, kv->key, kv->keyLen);
|
||||
taosArrayPush(pReq.pColumns, &field);
|
||||
}
|
||||
}else if (action == SCHEMA_ACTION_TAG){
|
||||
pReq.numOfColumns = pTableMeta->tableInfo.numOfColumns;
|
||||
pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField));
|
||||
for (int i = 0; i < pReq.numOfColumns; i++) {
|
||||
SSchema *s = &pTableMeta->schema[i];
|
||||
SField field = {0};
|
||||
field.type = s->type;
|
||||
field.bytes = s->bytes;
|
||||
strcpy(field.name, s->name);
|
||||
taosArrayPush(pReq.pColumns, &field);
|
||||
}
|
||||
}
|
||||
|
||||
if(action == SCHEMA_ACTION_NULL || action == SCHEMA_ACTION_TAG){
|
||||
pReq.numOfTags = taosArrayGetSize(sTableData->tags);
|
||||
if (pReq.numOfTags == 0){
|
||||
pReq.numOfTags = 1;
|
||||
pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField));
|
||||
SField field = {0};
|
||||
field.type = TSDB_DATA_TYPE_NCHAR;
|
||||
field.bytes = 1;
|
||||
strcpy(field.name, tsSmlTagName);
|
||||
taosArrayPush(pReq.pTags, &field);
|
||||
}else{
|
||||
pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField));
|
||||
for (int i = 0; i < pReq.numOfTags; i++) {
|
||||
SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->tags, i);
|
||||
SField field = {0};
|
||||
field.type = kv->type;
|
||||
field.bytes = getBytes(kv->type, kv->length);
|
||||
memcpy(field.name, kv->key, kv->keyLen);
|
||||
taosArrayPush(pReq.pTags, &field);
|
||||
}
|
||||
}
|
||||
}else if (action == SCHEMA_ACTION_COLUMN){
|
||||
pReq.numOfTags = pTableMeta->tableInfo.numOfTags;
|
||||
pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField));
|
||||
for (int i = 0; i < pReq.numOfTags; i++) {
|
||||
SSchema *s = &pTableMeta->schema[i + pTableMeta->tableInfo.numOfColumns];
|
||||
SField field = {0};
|
||||
field.type = s->type;
|
||||
field.bytes = s->bytes;
|
||||
strcpy(field.name, s->name);
|
||||
taosArrayPush(pReq.pTags, &field);
|
||||
}
|
||||
}
|
||||
|
||||
pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp);
|
||||
pCmdMsg.msgType = TDMT_MND_CREATE_STB;
|
||||
pCmdMsg.msgLen = tSerializeSMCreateStbReq(NULL, 0, &pReq);
|
||||
pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen);
|
||||
if (NULL == pCmdMsg.pMsg) {
|
||||
tFreeSMCreateStbReq(&pReq);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq);
|
||||
|
||||
SQuery pQuery;
|
||||
pQuery.execMode = QUERY_EXEC_MODE_RPC;
|
||||
pQuery.pCmdMsg = &pCmdMsg;
|
||||
pQuery.msgType = pQuery.pCmdMsg->msgType;
|
||||
pQuery.stableQuery = true;
|
||||
|
||||
launchQueryImpl(pRequest, &pQuery, true, NULL);
|
||||
|
||||
if(pRequest->code == TSDB_CODE_SUCCESS){
|
||||
catalogRemoveTableMeta(info->pCatalog, pName);
|
||||
}
|
||||
code = pRequest->code;
|
||||
taosMemoryFree(pCmdMsg.pMsg);
|
||||
|
||||
end:
|
||||
destroyRequest(pRequest);
|
||||
tFreeSMCreateStbReq(&pReq);
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
||||
int32_t code = 0;
|
||||
SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}};
|
||||
|
@ -500,16 +465,9 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta);
|
||||
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) {
|
||||
SSchemaAction schemaAction;
|
||||
schemaAction.action = SCHEMA_ACTION_CREATE_STABLE;
|
||||
memset(&schemaAction.createSTable, 0, sizeof(SCreateSTableActionInfo));
|
||||
memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen);
|
||||
schemaAction.createSTable.tags = sTableData->tags;
|
||||
schemaAction.createSTable.fields = sTableData->cols;
|
||||
code = smlApplySchemaAction(info, &schemaAction);
|
||||
code = smlSendMetaMsg(info, &pName, sTableData, NULL, SCHEMA_ACTION_NULL);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " smlApplySchemaAction failed. can not create %s", info->id,
|
||||
schemaAction.createSTable.sTableName);
|
||||
uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable);
|
||||
goto end;
|
||||
}
|
||||
info->cost.numOfCreateSTables++;
|
||||
|
@ -521,24 +479,42 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
|||
taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES);
|
||||
}
|
||||
|
||||
SSchemaAction schemaAction;
|
||||
memset(&schemaAction, 0, sizeof(SSchemaAction));
|
||||
memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen);
|
||||
code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, &schemaAction, true);
|
||||
ESchemaAction action = SCHEMA_ACTION_NULL;
|
||||
code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, &action, true);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosHashCleanup(hashTmp);
|
||||
goto end;
|
||||
}
|
||||
if (action == SCHEMA_ACTION_TAG){
|
||||
code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta, action);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
taosHashClear(hashTmp);
|
||||
for (uint16_t i = 1; i < pTableMeta->tableInfo.numOfColumns; i++) {
|
||||
taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES);
|
||||
}
|
||||
code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, &schemaAction, false);
|
||||
action = SCHEMA_ACTION_NULL;
|
||||
code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, &action, false);
|
||||
taosHashCleanup(hashTmp);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
if (action == SCHEMA_ACTION_COLUMN){
|
||||
code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta, action);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -1504,12 +1480,14 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr
|
|||
}
|
||||
((SVnodeModifOpStmt *)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV;
|
||||
|
||||
if (pTscObj){
|
||||
info->taos = pTscObj;
|
||||
code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
info->precision = precision;
|
||||
info->protocol = protocol;
|
||||
|
@ -1518,9 +1496,12 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr
|
|||
} else {
|
||||
info->dataFormat = true;
|
||||
}
|
||||
|
||||
if(request){
|
||||
info->pRequest = request;
|
||||
info->msgBuf.buf = info->pRequest->msgBuf;
|
||||
info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE;
|
||||
}
|
||||
|
||||
info->exec = smlInitHandle(info->pQuery);
|
||||
info->childTables = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
|
|
|
@ -123,7 +123,7 @@ void createNewTable(TAOS* pConn, int32_t index) {
|
|||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
for(int32_t i = 0; i < 1000; i += 20) {
|
||||
for(int32_t i = 0; i < 100000; i += 20) {
|
||||
char sql[1024] = {0};
|
||||
sprintf(sql,
|
||||
"insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
|
||||
|
@ -154,7 +154,7 @@ TEST(testCase, driverInit_Test) {
|
|||
}
|
||||
|
||||
TEST(testCase, connect_Test) {
|
||||
// taos_options(TSDB_OPTION_CONFIGDIR, "/home/ubuntu/first/cfg");
|
||||
taos_options(TSDB_OPTION_CONFIGDIR, "/home/lisa/Documents/workspace/tdengine/sim/dnode1/cfg");
|
||||
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
if (pConn == NULL) {
|
||||
|
@ -501,7 +501,6 @@ TEST(testCase, show_vgroup_Test) {
|
|||
taos_close(pConn);
|
||||
}
|
||||
|
||||
|
||||
TEST(testCase, create_multiple_tables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
@ -665,6 +664,7 @@ TEST(testCase, insert_test) {
|
|||
taos_free_result(pRes);
|
||||
taos_close(pConn);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(testCase, projection_query_tables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
|
@ -697,7 +697,7 @@ TEST(testCase, projection_query_tables) {
|
|||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
for(int32_t i = 0; i < 100; ++i) {
|
||||
for(int32_t i = 0; i < 1; ++i) {
|
||||
printf("create table :%d\n", i);
|
||||
createNewTable(pConn, i);
|
||||
}
|
||||
|
@ -723,6 +723,7 @@ TEST(testCase, projection_query_tables) {
|
|||
taos_close(pConn);
|
||||
}
|
||||
|
||||
#if 0
|
||||
TEST(testCase, projection_query_stables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
@ -820,21 +821,8 @@ TEST(testCase, async_api_test) {
|
|||
getchar();
|
||||
taos_close(pConn);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
TEST(testCase, update_test) {
|
||||
|
||||
SInterval interval = {0};
|
||||
interval.offset = 8000;
|
||||
interval.interval = 10000;
|
||||
interval.sliding = 4000;
|
||||
interval.intervalUnit = 's';
|
||||
interval.offsetUnit = 's';
|
||||
interval.slidingUnit = 's';
|
||||
// STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1630000000000);
|
||||
STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1629999999999);
|
||||
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
||||
|
@ -869,4 +857,8 @@ TEST(testCase, update_test) {
|
|||
taos_free_result(pRes);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1713,8 +1713,9 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
|
|||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||
|
||||
int32_t rows = pDataBlock->info.rows;
|
||||
printf("%s |block type %d |child id %d|group id %" PRIu64 "\n", flag, (int32_t)pDataBlock->info.type,
|
||||
pDataBlock->info.childId, pDataBlock->info.groupId);
|
||||
printf("%s |block ver %" PRIi64 " |block type %d |child id %d|group id %" PRIu64 "\n", flag,
|
||||
pDataBlock->info.version, (int32_t)pDataBlock->info.type, pDataBlock->info.childId,
|
||||
pDataBlock->info.groupId);
|
||||
for (int32_t j = 0; j < rows; j++) {
|
||||
printf("%s |", flag);
|
||||
for (int32_t k = 0; k < numOfCols; k++) {
|
||||
|
|
|
@ -31,6 +31,7 @@ target_sources(
|
|||
"src/sma/smaOpen.c"
|
||||
"src/sma/smaCommit.c"
|
||||
"src/sma/smaRollup.c"
|
||||
"src/sma/smaSnapshot.c"
|
||||
"src/sma/smaTimeRange.c"
|
||||
|
||||
# tsdb
|
||||
|
|
|
@ -209,6 +209,9 @@ int32_t tdProcessTSmaGetDaysImpl(SVnodeCfg *pCfg, void *pCont, uint32_t contLen,
|
|||
|
||||
// smaFileUtil ================
|
||||
|
||||
typedef struct SQTaskFReader SQTaskFReader;
|
||||
typedef struct SQTaskFWriter SQTaskFWriter;
|
||||
|
||||
#define TD_FILE_HEAD_SIZE 512
|
||||
|
||||
typedef struct STFInfo STFInfo;
|
||||
|
|
|
@ -97,7 +97,6 @@ int32_t tRowMergerGetRow(SRowMerger *pMerger, STSRow **ppRow);
|
|||
// TABLEID
|
||||
int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
|
||||
// TSDBKEY
|
||||
int32_t tsdbKeyCmprFn(const void *p1, const void *p2);
|
||||
#define MIN_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) < 0) ? (KEY1) : (KEY2))
|
||||
#define MAX_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) > 0) ? (KEY1) : (KEY2))
|
||||
// SBlockCol
|
||||
|
@ -558,6 +557,26 @@ struct STsdbReadSnap {
|
|||
STsdbFS fs;
|
||||
};
|
||||
|
||||
// ========== inline functions ==========
|
||||
static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) {
|
||||
TSDBKEY *pKey1 = (TSDBKEY *)p1;
|
||||
TSDBKEY *pKey2 = (TSDBKEY *)p2;
|
||||
|
||||
if (pKey1->ts < pKey2->ts) {
|
||||
return -1;
|
||||
} else if (pKey1->ts > pKey2->ts) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pKey1->version < pKey2->version) {
|
||||
return -1;
|
||||
} else if (pKey1->version > pKey2->version) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,8 @@ typedef struct SMetaSnapReader SMetaSnapReader;
|
|||
typedef struct SMetaSnapWriter SMetaSnapWriter;
|
||||
typedef struct STsdbSnapReader STsdbSnapReader;
|
||||
typedef struct STsdbSnapWriter STsdbSnapWriter;
|
||||
typedef struct SRsmaSnapReader SRsmaSnapReader;
|
||||
typedef struct SRsmaSnapWriter SRsmaSnapWriter;
|
||||
typedef struct SSnapDataHdr SSnapDataHdr;
|
||||
|
||||
#define VNODE_META_DIR "meta"
|
||||
|
@ -196,13 +198,21 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr
|
|||
int32_t metaSnapWrite(SMetaSnapWriter* pWriter, uint8_t* pData, uint32_t nData);
|
||||
int32_t metaSnapWriterClose(SMetaSnapWriter** ppWriter, int8_t rollback);
|
||||
// STsdbSnapReader ========================================
|
||||
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapReader** ppReader);
|
||||
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type, STsdbSnapReader** ppReader);
|
||||
int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader);
|
||||
int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData);
|
||||
// STsdbSnapWriter ========================================
|
||||
int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWriter** ppWriter);
|
||||
int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData);
|
||||
int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback);
|
||||
// SRsmaSnapReader ========================================
|
||||
int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapReader** ppReader);
|
||||
int32_t rsmaSnapReaderClose(SRsmaSnapReader** ppReader);
|
||||
int32_t rsmaSnapRead(SRsmaSnapReader* pReader, uint8_t** ppData);
|
||||
// SRsmaSnapWriter ========================================
|
||||
int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapWriter** ppWriter);
|
||||
int32_t rsmaSnapWrite(SRsmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData);
|
||||
int32_t rsmaSnapWriterClose(SRsmaSnapWriter** ppWriter, int8_t rollback);
|
||||
|
||||
typedef struct {
|
||||
int8_t streamType; // sma or other
|
||||
|
@ -314,6 +324,15 @@ struct SSma {
|
|||
// sma
|
||||
void smaHandleRes(void* pVnode, int64_t smaId, const SArray* data);
|
||||
|
||||
enum {
|
||||
SNAP_DATA_META = 0,
|
||||
SNAP_DATA_TSDB = 1,
|
||||
SNAP_DATA_DEL = 2,
|
||||
SNAP_DATA_RSMA1 = 3,
|
||||
SNAP_DATA_RSMA2 = 4,
|
||||
SNAP_DATA_QTASK = 5,
|
||||
};
|
||||
|
||||
struct SSnapDataHdr {
|
||||
int8_t type;
|
||||
int64_t index;
|
||||
|
|
|
@ -183,11 +183,11 @@ int metaClose(SMeta *pMeta) {
|
|||
int32_t metaRLock(SMeta *pMeta) {
|
||||
int32_t ret = 0;
|
||||
|
||||
metaDebug("meta rlock %p B", &pMeta->lock);
|
||||
metaTrace("meta rlock %p B", &pMeta->lock);
|
||||
|
||||
ret = taosThreadRwlockRdlock(&pMeta->lock);
|
||||
|
||||
metaDebug("meta rlock %p E", &pMeta->lock);
|
||||
metaTrace("meta rlock %p E", &pMeta->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -195,11 +195,11 @@ int32_t metaRLock(SMeta *pMeta) {
|
|||
int32_t metaWLock(SMeta *pMeta) {
|
||||
int32_t ret = 0;
|
||||
|
||||
metaDebug("meta wlock %p B", &pMeta->lock);
|
||||
metaTrace("meta wlock %p B", &pMeta->lock);
|
||||
|
||||
ret = taosThreadRwlockWrlock(&pMeta->lock);
|
||||
|
||||
metaDebug("meta wlock %p E", &pMeta->lock);
|
||||
metaTrace("meta wlock %p E", &pMeta->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -207,11 +207,11 @@ int32_t metaWLock(SMeta *pMeta) {
|
|||
int32_t metaULock(SMeta *pMeta) {
|
||||
int32_t ret = 0;
|
||||
|
||||
metaDebug("meta ulock %p B", &pMeta->lock);
|
||||
metaTrace("meta ulock %p B", &pMeta->lock);
|
||||
|
||||
ret = taosThreadRwlockUnlock(&pMeta->lock);
|
||||
|
||||
metaDebug("meta ulock %p E", &pMeta->lock);
|
||||
metaTrace("meta ulock %p E", &pMeta->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
|||
}
|
||||
|
||||
SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
|
||||
pHdr->type = 0; // TODO: use macro
|
||||
pHdr->type = SNAP_DATA_META;
|
||||
pHdr->size = nData;
|
||||
memcpy(pHdr->data, pData, nData);
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapRead
|
|||
|
||||
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
|
||||
if (pSma->pRSmaTsdb[i]) {
|
||||
code = tsdbSnapReaderOpen(pSma->pRSmaTsdb[i], sver, ever, &pReader->pDataReader[i]);
|
||||
code = tsdbSnapReaderOpen(pSma->pRSmaTsdb[i], sver, ever, i == 0 ? SNAP_DATA_RSMA1 : SNAP_DATA_RSMA2,
|
||||
&pReader->pDataReader[i]);
|
||||
if (code < 0) {
|
||||
goto _err;
|
||||
}
|
||||
|
@ -221,10 +222,9 @@ int32_t rsmaSnapWriterClose(SRsmaSnapWriter** ppWriter, int8_t rollback) {
|
|||
}
|
||||
}
|
||||
|
||||
smaInfo("vgId:%d vnode snapshot rsma writer close succeed", SMA_VID(pWriter->pSma));
|
||||
taosMemoryFree(pWriter);
|
||||
*ppWriter = NULL;
|
||||
|
||||
smaInfo("vgId:%d vnode snapshot rsma writer close succeed", SMA_VID(pWriter->pSma));
|
||||
return code;
|
||||
|
||||
_err:
|
||||
|
@ -245,15 +245,17 @@ int32_t rsmaSnapWrite(SRsmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
|
|||
code = tsdbSnapWrite(pWriter->pDataWriter[1], pData, nData);
|
||||
} else if (pHdr->type == SNAP_DATA_QTASK) {
|
||||
code = rsmaSnapWriteQTaskInfo(pWriter, pData, nData);
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
if (code < 0) goto _err;
|
||||
|
||||
_exit:
|
||||
smaInfo("vgId:%d rsma snapshot write for data %" PRIi8 " succeed", SMA_VID(pWriter->pSma), pHdr->type);
|
||||
smaInfo("vgId:%d rsma snapshot write for data type %" PRIi8 " succeed", SMA_VID(pWriter->pSma), pHdr->type);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
smaError("vgId:%d rsma snapshot write for data %" PRIi8 " failed since %s", SMA_VID(pWriter->pSma), pHdr->type,
|
||||
smaError("vgId:%d rsma snapshot write for data type %" PRIi8 " failed since %s", SMA_VID(pWriter->pSma), pHdr->type,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -307,7 +307,11 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
|
|||
fLast = (SLastFile){.commitID = pCommitter->commitID, .size = 0};
|
||||
fSma = *pRSet->pSmaF;
|
||||
} else {
|
||||
wSet.diskId = (SDiskID){.level = 0, .id = 0};
|
||||
SDiskID did = {0};
|
||||
|
||||
tfsAllocDisk(pTsdb->pVnode->pTfs, 0, &did);
|
||||
|
||||
wSet.diskId = did;
|
||||
wSet.fid = pCommitter->commitFid;
|
||||
fHead = (SHeadFile){.commitID = pCommitter->commitID, .offset = 0, .size = 0};
|
||||
fData = (SDataFile){.commitID = pCommitter->commitID, .size = 0};
|
||||
|
|
|
@ -145,7 +145,8 @@ static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanI
|
|||
SRowMerger* pMerger);
|
||||
static int32_t doMergeRowsInBuf(SIterInfo* pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger,
|
||||
STsdbReader* pReader);
|
||||
static int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow);
|
||||
static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow);
|
||||
static int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData, int32_t rowIndex);
|
||||
static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
|
||||
static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader);
|
||||
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order);
|
||||
|
@ -691,16 +692,13 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
|||
SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter);
|
||||
SBlock* pBlock = getCurrentBlock(pBlockIter);
|
||||
SSDataBlock* pResBlock = pReader->pResBlock;
|
||||
int32_t numOfCols = blockDataGetNumOfCols(pResBlock);
|
||||
int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
|
||||
|
||||
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
SColVal cv = {0};
|
||||
int32_t colIndex = 0;
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
bool asc = ASCENDING_TRAVERSE(pReader->order);
|
||||
int32_t step = asc ? 1 : -1;
|
||||
|
||||
|
@ -724,7 +722,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
|||
i += 1;
|
||||
}
|
||||
|
||||
while (i < numOfCols && colIndex < taosArrayGetSize(pBlockData->aIdx)) {
|
||||
int32_t colIndex = 0;
|
||||
int32_t num = taosArrayGetSize(pBlockData->aIdx);
|
||||
while (i < numOfOutputCols && colIndex < num) {
|
||||
rowIndex = 0;
|
||||
pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
||||
|
||||
|
@ -744,7 +744,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
|
|||
i += 1;
|
||||
}
|
||||
|
||||
while (i < numOfCols) {
|
||||
while (i < numOfOutputCols) {
|
||||
pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
||||
colDataAppendNNULL(pColData, 0, remain);
|
||||
i += 1;
|
||||
|
@ -1256,7 +1256,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
tRowMergerClear(&merge);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
|
||||
taosMemoryFree(pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1300,7 +1300,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
tRowMergerGetRow(&merge, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else { // key > ik.ts || key > k.ts
|
||||
ASSERT(key != ik.ts);
|
||||
|
@ -1309,7 +1309,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
// [4] ik.ts < k.ts <= key
|
||||
if (ik.ts < k.ts) {
|
||||
doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
// [6] k.ts < ik.ts <= key
|
||||
if (k.ts < ik.ts) {
|
||||
doMergeMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, &pTSRow, pReader);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
ASSERT(key > ik.ts && key > k.ts);
|
||||
|
||||
doMergeMemIMemRows(pRow, piRow, pBlockScanInfo, pReader, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -1350,7 +1350,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
}
|
||||
|
||||
tRowMergerGetRow(&merge, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
ASSERT(ik.ts != k.ts); // this case has been included in the previous if branch
|
||||
|
@ -1359,7 +1359,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
// [4] ik.ts > key >= k.ts
|
||||
if (ik.ts > key) {
|
||||
doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1371,7 +1371,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
|
||||
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
|
||||
tRowMergerGetRow(&merge, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1383,7 +1383,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
|||
tRowMerge(&merge, &fRow);
|
||||
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
|
||||
tRowMergerGetRow(&merge, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -1438,6 +1438,21 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI
|
|||
}
|
||||
|
||||
// imem & mem are all empty, only file exist
|
||||
|
||||
// opt version
|
||||
// 1. it is not a border point
|
||||
// 2. the direct next point is not an duplicated timestamp
|
||||
if ((pDumpInfo->rowIndex < pDumpInfo->totalRows - 1 && pReader->order == TSDB_ORDER_ASC) ||
|
||||
(pDumpInfo->rowIndex > 0 && pReader->order == TSDB_ORDER_DESC)) {
|
||||
int32_t step = pReader->order == TSDB_ORDER_ASC? 1:-1;
|
||||
int64_t nextKey = pBlockData->aTSKEY[pDumpInfo->rowIndex + step];
|
||||
if (nextKey != key) { // merge is not needed
|
||||
doAppendRowFromBlock(pReader->pResBlock, pReader, pBlockData, pDumpInfo->rowIndex);
|
||||
pDumpInfo->rowIndex += step;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
|
||||
|
||||
STSRow* pTSRow = NULL;
|
||||
|
@ -1446,7 +1461,7 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI
|
|||
tRowMergerInit(&merge, &fRow, pReader->pSchema);
|
||||
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
|
||||
tRowMergerGetRow(&merge, &pTSRow);
|
||||
doAppendOneRow(pReader->pResBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow);
|
||||
|
||||
taosMemoryFree(pTSRow);
|
||||
tRowMergerClear(&merge);
|
||||
|
@ -2201,7 +2216,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
|
|||
int32_t step = asc ? 1 : -1;
|
||||
|
||||
pDumpInfo->rowIndex += step;
|
||||
if (pDumpInfo->rowIndex <= pBlockData->nRow - 1) {
|
||||
if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) ||(pDumpInfo->rowIndex >= 0 && !asc)) {
|
||||
pDumpInfo->rowIndex =
|
||||
doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step);
|
||||
}
|
||||
|
@ -2325,7 +2340,7 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow) {
|
||||
int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow) {
|
||||
int32_t numOfRows = pBlock->info.rows;
|
||||
int32_t numOfCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock);
|
||||
|
||||
|
@ -2369,6 +2384,47 @@ int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData, int32_t rowIndex) {
|
||||
int32_t i = 0, j = 0;
|
||||
int32_t outputRowIndex = pResBlock->info.rows;
|
||||
|
||||
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
|
||||
|
||||
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i);
|
||||
if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
colDataAppendInt64(pColData, outputRowIndex, &pBlockData->aTSKEY[rowIndex]);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
SColVal cv = {0};
|
||||
int32_t numOfInputCols = taosArrayGetSize(pBlockData->aIdx);
|
||||
int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
|
||||
|
||||
while(i < numOfOutputCols && j < numOfInputCols) {
|
||||
SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i);
|
||||
SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
|
||||
|
||||
if (pData->cid == pCol->info.colId) {
|
||||
tColDataGetValue(pData, rowIndex, &cv);
|
||||
doCopyColVal(pCol, outputRowIndex, i, &cv, pSupInfo);
|
||||
j += 1;
|
||||
} else { // the specified column does not exist in file block, fill with null data
|
||||
colDataAppendNULL(pCol, outputRowIndex);
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
while (i < numOfOutputCols) {
|
||||
SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i);
|
||||
colDataAppendNULL(pCol, outputRowIndex);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
pResBlock->info.rows += 1;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
|
||||
STsdbReader* pReader) {
|
||||
SSDataBlock* pBlock = pReader->pResBlock;
|
||||
|
@ -2380,7 +2436,7 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e
|
|||
break;
|
||||
}
|
||||
|
||||
doAppendOneRow(pBlock, pReader, pTSRow);
|
||||
doAppendRowFromTSRow(pBlock, pReader, pTSRow);
|
||||
taosMemoryFree(pTSRow);
|
||||
|
||||
// no data in buffer, return immediately
|
||||
|
|
|
@ -21,6 +21,7 @@ struct STsdbSnapReader {
|
|||
int64_t sver;
|
||||
int64_t ever;
|
||||
STsdbFS fs;
|
||||
int8_t type;
|
||||
// for data file
|
||||
int8_t dataDone;
|
||||
int32_t fid;
|
||||
|
@ -62,7 +63,8 @@ static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
pReader->iBlockIdx = 0;
|
||||
pReader->pBlockIdx = NULL;
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb open data file to read, fid:%d", TD_VID(pTsdb->pVnode), pReader->fid);
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb open data file to read for %s, fid:%d", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
pReader->fid);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -130,7 +132,7 @@ static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
}
|
||||
|
||||
SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
|
||||
pHdr->type = 1;
|
||||
pHdr->type = pReader->type;
|
||||
pHdr->size = size;
|
||||
|
||||
TABLEID* pId = (TABLEID*)(&pHdr[1]);
|
||||
|
@ -139,9 +141,9 @@ static int32_t tsdbSnapReadData(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
|
||||
tPutBlockData((uint8_t*)(&pId[1]), &pReader->nBlockData);
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot read data, fid:%d suid:%" PRId64 " uid:%" PRId64
|
||||
tsdbInfo("vgId:%d vnode snapshot read data for %s, fid:%d suid:%" PRId64 " uid:%" PRId64
|
||||
" iBlock:%d minVersion:%d maxVersion:%d nRow:%d out of %d size:%d",
|
||||
TD_VID(pTsdb->pVnode), pReader->fid, pReader->pBlockIdx->suid, pReader->pBlockIdx->uid,
|
||||
TD_VID(pTsdb->pVnode), pTsdb->path, pReader->fid, pReader->pBlockIdx->suid, pReader->pBlockIdx->uid,
|
||||
pReader->iBlock - 1, pBlock->minVersion, pBlock->maxVersion, pReader->nBlockData.nRow, pBlock->nRow,
|
||||
size);
|
||||
|
||||
|
@ -154,7 +156,8 @@ _exit:
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read data failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read data for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -212,7 +215,7 @@ static int32_t tsdbSnapReadDel(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
}
|
||||
|
||||
SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
|
||||
pHdr->type = 2;
|
||||
pHdr->type = SNAP_DATA_DEL;
|
||||
pHdr->size = size;
|
||||
|
||||
TABLEID* pId = (TABLEID*)(&pHdr[1]);
|
||||
|
@ -228,8 +231,8 @@ static int32_t tsdbSnapReadDel(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
n += tPutDelData((*ppData) + n, pDelData);
|
||||
}
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb read del data, suid:%" PRId64 " uid:%d" PRId64 " size:%d",
|
||||
TD_VID(pTsdb->pVnode), pDelIdx->suid, pDelIdx->uid, size);
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb read del data for %s, suid:%" PRId64 " uid:%d" PRId64 " size:%d",
|
||||
TD_VID(pTsdb->pVnode), pTsdb->path, pDelIdx->suid, pDelIdx->uid, size);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -238,11 +241,12 @@ _exit:
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read del failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read del for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->pVnode,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapReader** ppReader) {
|
||||
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, int8_t type, STsdbSnapReader** ppReader) {
|
||||
int32_t code = 0;
|
||||
STsdbSnapReader* pReader = NULL;
|
||||
|
||||
|
@ -255,6 +259,7 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapRe
|
|||
pReader->pTsdb = pTsdb;
|
||||
pReader->sver = sver;
|
||||
pReader->ever = ever;
|
||||
pReader->type = type;
|
||||
|
||||
code = taosThreadRwlockRdlock(&pTsdb->rwLock);
|
||||
if (code) {
|
||||
|
@ -297,12 +302,13 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapRe
|
|||
goto _err;
|
||||
}
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb reader opened", TD_VID(pTsdb->pVnode));
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb reader opened for %s", TD_VID(pTsdb->pVnode), pTsdb->path);
|
||||
*ppReader = pReader;
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb reader open failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb reader open for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
*ppReader = NULL;
|
||||
return code;
|
||||
}
|
||||
|
@ -327,7 +333,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
|
|||
|
||||
tsdbFSUnref(pReader->pTsdb, &pReader->fs);
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb reader closed", TD_VID(pReader->pTsdb->pVnode));
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb reader closed for %s", TD_VID(pReader->pTsdb->pVnode), pReader->pTsdb->path);
|
||||
|
||||
taosMemoryFree(pReader);
|
||||
*ppReader = NULL;
|
||||
|
@ -368,10 +374,12 @@ int32_t tsdbSnapRead(STsdbSnapReader* pReader, uint8_t** ppData) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
tsdbDebug("vgId:%d vnode snapshot tsdb read for %s", TD_VID(pReader->pTsdb->pVnode), pReader->pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read failed since %s", TD_VID(pReader->pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb read for %s failed since %s", TD_VID(pReader->pTsdb->pVnode),
|
||||
pReader->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -436,7 +444,8 @@ static int32_t tsdbSnapWriteAppendData(STsdbSnapWriter* pWriter, uint8_t* pData,
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d tsdb snapshot write append data failed since %s", TD_VID(pWriter->pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d tsdb snapshot write append data for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -522,9 +531,12 @@ static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWriter) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
tsdbInfo("vgId:%d tsdb snapshot write table data end for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d tsdb snapshot write table data end for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -570,6 +582,8 @@ _exit:
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d tsdb snapshot move write table data for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -708,8 +722,8 @@ static int32_t tsdbSnapWriteTableDataImpl(STsdbSnapWriter* pWriter) {
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write table data impl failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write table data impl for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -794,11 +808,12 @@ static int32_t tsdbSnapWriteTableData(STsdbSnapWriter* pWriter, TABLEID id) {
|
|||
if (code) goto _err;
|
||||
|
||||
_exit:
|
||||
tsdbDebug("vgId:%d vnode snapshot tsdb write data impl for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write data impl failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write data impl for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -833,11 +848,12 @@ static int32_t tsdbSnapWriteDataEnd(STsdbSnapWriter* pWriter) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb writer data end", TD_VID(pTsdb->pVnode));
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb writer data end for %s", TD_VID(pTsdb->pVnode), pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb writer data end failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb writer data end for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -920,12 +936,13 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3
|
|||
code = tsdbSnapWriteTableData(pWriter, id);
|
||||
if (code) goto _err;
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb write data, fid:%d suid:%" PRId64 " uid:%" PRId64 " nRow:%d",
|
||||
TD_VID(pTsdb->pVnode), fid, id.suid, id.suid, pBlockData->nRow);
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb write data for %s, fid:%d suid:%" PRId64 " uid:%" PRId64 " nRow:%d",
|
||||
TD_VID(pTsdb->pVnode), pTsdb->path, fid, id.suid, id.suid, pBlockData->nRow);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write data failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write data for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1015,7 +1032,8 @@ _exit:
|
|||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write del failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write del for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1056,11 +1074,12 @@ static int32_t tsdbSnapWriteDelEnd(STsdbSnapWriter* pWriter) {
|
|||
}
|
||||
|
||||
_exit:
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb write del end", TD_VID(pTsdb->pVnode));
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb write del for %s end", TD_VID(pTsdb->pVnode), pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write del end failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb write del end for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1127,10 +1146,12 @@ int32_t tsdbSnapWriterOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapWr
|
|||
}
|
||||
|
||||
*ppWriter = pWriter;
|
||||
return code;
|
||||
|
||||
tsdbInfo("vgId:%d tsdb snapshot writer open for %s succeed", TD_VID(pTsdb->pVnode), pTsdb->path);
|
||||
return code;
|
||||
_err:
|
||||
tsdbError("vgId:%d tsdb snapshot writer open failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d tsdb snapshot writer open for %s failed since %s", TD_VID(pTsdb->pVnode), pTsdb->path,
|
||||
tstrerror(code));
|
||||
*ppWriter = NULL;
|
||||
return code;
|
||||
}
|
||||
|
@ -1157,14 +1178,16 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
|
|||
if (code) goto _err;
|
||||
}
|
||||
|
||||
tsdbInfo("vgId:%d vnode snapshot tsdb writer close for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
|
||||
taosMemoryFree(pWriter);
|
||||
*ppWriter = NULL;
|
||||
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d vnode snapshot tsdb writer close failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
tstrerror(code));
|
||||
tsdbError("vgId:%d vnode snapshot tsdb writer close for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode),
|
||||
pWriter->pTsdb->path, tstrerror(code));
|
||||
taosMemoryFree(pWriter);
|
||||
*ppWriter = NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -1173,7 +1196,7 @@ int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
|
|||
SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
|
||||
|
||||
// ts data
|
||||
if (pHdr->type == 1) {
|
||||
if (pHdr->type == SNAP_DATA_TSDB) {
|
||||
code = tsdbSnapWriteData(pWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
|
||||
|
@ -1186,15 +1209,17 @@ int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
|
|||
}
|
||||
|
||||
// del data
|
||||
if (pHdr->type == 2) {
|
||||
if (pHdr->type == SNAP_DATA_DEL) {
|
||||
code = tsdbSnapWriteDel(pWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
_exit:
|
||||
tsdbDebug("vgId:%d tsdb snapshow write for %s succeed", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
tsdbError("vgId:%d tsdb snapshow write failed since %s", TD_VID(pWriter->pTsdb->pVnode), tstrerror(code));
|
||||
tsdbError("vgId:%d tsdb snapshow write for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -151,26 +151,6 @@ int32_t tTABLEIDCmprFn(const void *p1, const void *p2) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TSDBKEY =======================================================================
|
||||
int32_t tsdbKeyCmprFn(const void *p1, const void *p2) {
|
||||
TSDBKEY *pKey1 = (TSDBKEY *)p1;
|
||||
TSDBKEY *pKey2 = (TSDBKEY *)p2;
|
||||
|
||||
if (pKey1->ts < pKey2->ts) {
|
||||
return -1;
|
||||
} else if (pKey1->ts > pKey2->ts) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pKey1->version < pKey2->version) {
|
||||
return -1;
|
||||
} else if (pKey1->version > pKey2->version) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TSDBKEY ======================================================
|
||||
static FORCE_INLINE int32_t tPutTSDBKEY(uint8_t *p, TSDBKEY *pKey) {
|
||||
int32_t n = 0;
|
||||
|
|
|
@ -28,7 +28,8 @@ struct SVSnapReader {
|
|||
int8_t tsdbDone;
|
||||
STsdbSnapReader *pTsdbReader;
|
||||
// rsma
|
||||
int8_t rsmaDone[TSDB_RETENTION_L2];
|
||||
int8_t rsmaDone;
|
||||
SRsmaSnapReader *pRsmaReader;
|
||||
};
|
||||
|
||||
int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapReader **ppReader) {
|
||||
|
@ -57,6 +58,10 @@ _err:
|
|||
int32_t vnodeSnapReaderClose(SVSnapReader *pReader) {
|
||||
int32_t code = 0;
|
||||
|
||||
if (pReader->pRsmaReader) {
|
||||
rsmaSnapReaderClose(&pReader->pRsmaReader);
|
||||
}
|
||||
|
||||
if (pReader->pTsdbReader) {
|
||||
tsdbSnapReaderClose(&pReader->pTsdbReader);
|
||||
}
|
||||
|
@ -99,7 +104,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
if (!pReader->tsdbDone) {
|
||||
// open if not
|
||||
if (pReader->pTsdbReader == NULL) {
|
||||
code = tsdbSnapReaderOpen(pReader->pVnode->pTsdb, pReader->sver, pReader->ever, &pReader->pTsdbReader);
|
||||
code = tsdbSnapReaderOpen(pReader->pVnode->pTsdb, pReader->sver, pReader->ever, SNAP_DATA_TSDB, &pReader->pTsdbReader);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
|
@ -118,23 +123,14 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
}
|
||||
|
||||
// RSMA ==============
|
||||
#if 0
|
||||
if (VND_IS_RSMA(pReader->pVnode)) {
|
||||
// RSMA1/RSMA2
|
||||
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
|
||||
if (!pReader->rsmaDone[i]) {
|
||||
if (!pReader->pVnode->pSma->pRSmaTsdb[i]) {
|
||||
// no valid tsdb
|
||||
pReader->rsmaDone[i] = 1;
|
||||
continue;
|
||||
}
|
||||
if (pReader->pTsdbReader == NULL) {
|
||||
code = tsdbSnapReaderOpen(pReader->pVnode->pSma->pRSmaTsdb[i], pReader->sver, pReader->ever,
|
||||
&pReader->pTsdbReader);
|
||||
if (VND_IS_RSMA(pReader->pVnode) && !pReader->rsmaDone) {
|
||||
// open if not
|
||||
if (pReader->pRsmaReader == NULL) {
|
||||
code = rsmaSnapReaderOpen(pReader->pVnode->pSma, pReader->sver, pReader->ever, &pReader->pRsmaReader);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
code = tsdbSnapRead(pReader->pTsdbReader, ppData);
|
||||
code = rsmaSnapRead(pReader->pRsmaReader, ppData);
|
||||
if (code) {
|
||||
goto _err;
|
||||
} else {
|
||||
|
@ -142,16 +138,11 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
|||
goto _exit;
|
||||
} else {
|
||||
pReader->tsdbDone = 1;
|
||||
code = tsdbSnapReaderClose(&pReader->pTsdbReader);
|
||||
code = rsmaSnapReaderClose(&pReader->pRsmaReader);
|
||||
if (code) goto _err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// QTaskInfoFile
|
||||
// TODO ...
|
||||
}
|
||||
#endif
|
||||
|
||||
*ppData = NULL;
|
||||
*nData = 0;
|
||||
|
@ -186,6 +177,8 @@ struct SVSnapWriter {
|
|||
SMetaSnapWriter *pMetaSnapWriter;
|
||||
// tsdb
|
||||
STsdbSnapWriter *pTsdbSnapWriter;
|
||||
// rsma
|
||||
SRsmaSnapWriter *pRsmaSnapWriter;
|
||||
};
|
||||
|
||||
int32_t vnodeSnapWriterOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapWriter **ppWriter) {
|
||||
|
@ -235,6 +228,11 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot *
|
|||
if (code) goto _err;
|
||||
}
|
||||
|
||||
if (pWriter->pRsmaSnapWriter) {
|
||||
code = rsmaSnapWriterClose(&pWriter->pRsmaSnapWriter, rollback);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
if (!rollback) {
|
||||
SVnodeInfo info = {0};
|
||||
char dir[TSDB_FILENAME_LEN];
|
||||
|
@ -282,9 +280,9 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
|
|||
vInfo("vgId:%d vnode snapshot write data, index:%" PRId64 " type:%d nData:%d", TD_VID(pVnode), pHdr->index,
|
||||
pHdr->type, nData);
|
||||
|
||||
if (pHdr->type == 0) {
|
||||
switch (pHdr->type) {
|
||||
case SNAP_DATA_META: {
|
||||
// meta
|
||||
|
||||
if (pWriter->pMetaSnapWriter == NULL) {
|
||||
code = metaSnapWriterOpen(pVnode->pMeta, pWriter->sver, pWriter->ever, &pWriter->pMetaSnapWriter);
|
||||
if (code) goto _err;
|
||||
|
@ -292,9 +290,9 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
|
|||
|
||||
code = metaSnapWrite(pWriter->pMetaSnapWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
} else {
|
||||
} break;
|
||||
case SNAP_DATA_TSDB: {
|
||||
// tsdb
|
||||
|
||||
if (pWriter->pTsdbSnapWriter == NULL) {
|
||||
code = tsdbSnapWriterOpen(pVnode->pTsdb, pWriter->sver, pWriter->ever, &pWriter->pTsdbSnapWriter);
|
||||
if (code) goto _err;
|
||||
|
@ -302,8 +300,31 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
|
|||
|
||||
code = tsdbSnapWrite(pWriter->pTsdbSnapWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
} break;
|
||||
case SNAP_DATA_RSMA1:
|
||||
case SNAP_DATA_RSMA2: {
|
||||
// rsma1/rsma2
|
||||
if (pWriter->pRsmaSnapWriter == NULL) {
|
||||
code = rsmaSnapWriterOpen(pVnode->pSma, pWriter->sver, pWriter->ever, &pWriter->pRsmaSnapWriter);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
code = rsmaSnapWrite(pWriter->pRsmaSnapWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
} break;
|
||||
case SNAP_DATA_QTASK: {
|
||||
// qtask for rsma
|
||||
if (pWriter->pRsmaSnapWriter == NULL) {
|
||||
code = rsmaSnapWriterOpen(pVnode->pSma, pWriter->sver, pWriter->ever, &pWriter->pRsmaSnapWriter);
|
||||
if (code) goto _err;
|
||||
}
|
||||
|
||||
code = rsmaSnapWrite(pWriter->pRsmaSnapWriter, pData, nData);
|
||||
if (code) goto _err;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_exit:
|
||||
return code;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
|
|||
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo);
|
||||
|
||||
void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList);
|
||||
bool hasDataInGroupInfo(SGroupResInfo* pGroupResInfo);
|
||||
bool hasRemainResults(SGroupResInfo* pGroupResInfo);
|
||||
|
||||
int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo);
|
||||
|
||||
|
|
|
@ -297,6 +297,20 @@ enum {
|
|||
TABLE_SCAN__BLOCK_ORDER = 2,
|
||||
};
|
||||
|
||||
typedef struct SAggSupporter {
|
||||
SHashObj* pResultRowHashTable; // quick locate the window object for each result
|
||||
char* keyBuf; // window key buffer
|
||||
SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file
|
||||
int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
|
||||
} SAggSupporter;
|
||||
|
||||
typedef struct {
|
||||
// if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded.
|
||||
SInterval interval;
|
||||
SAggSupporter *pAggSup;
|
||||
SExprSupp *pExprSup; // expr supporter of aggregate operator
|
||||
} SAggOptrPushDownInfo;
|
||||
|
||||
typedef struct STableScanInfo {
|
||||
STsdbReader* dataReader;
|
||||
SReadHandle readHandle;
|
||||
|
@ -312,12 +326,13 @@ typedef struct STableScanInfo {
|
|||
SQueryTableDataCond cond;
|
||||
int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan
|
||||
int32_t dataBlockLoadFlag;
|
||||
SInterval interval; // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded.
|
||||
// SInterval interval; // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded.
|
||||
SSampleExecInfo sample; // sample execution info
|
||||
int32_t currentGroupId;
|
||||
int32_t currentTable;
|
||||
int8_t scanMode;
|
||||
int8_t noTable;
|
||||
SAggOptrPushDownInfo pdInfo;
|
||||
int8_t assignBlockUid;
|
||||
} STableScanInfo;
|
||||
|
||||
|
@ -505,13 +520,6 @@ typedef struct SOptrBasicInfo {
|
|||
SSDataBlock* pRes;
|
||||
} SOptrBasicInfo;
|
||||
|
||||
typedef struct SAggSupporter {
|
||||
SHashObj* pResultRowHashTable; // quick locate the window object for each result
|
||||
char* keyBuf; // window key buffer
|
||||
SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file
|
||||
int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row
|
||||
} SAggSupporter;
|
||||
|
||||
typedef struct SIntervalAggOperatorInfo {
|
||||
// SOptrBasicInfo should be first, SAggSupporter should be second for stream encode
|
||||
SOptrBasicInfo binfo; // basic info
|
||||
|
@ -1019,6 +1027,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
|
|||
|
||||
void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsColIndex);
|
||||
|
||||
bool groupbyTbname(SNodeList* pGroupList);
|
||||
int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* groupKey);
|
||||
SSDataBlock* createSpecialDataBlock(EStreamType type);
|
||||
void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput);
|
||||
|
|
|
@ -137,7 +137,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL
|
|||
ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo));
|
||||
}
|
||||
|
||||
bool hasDataInGroupInfo(SGroupResInfo* pGroupResInfo) {
|
||||
bool hasRemainResults(SGroupResInfo* pGroupResInfo) {
|
||||
if (pGroupResInfo->pRows == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -241,25 +241,17 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
|
|||
}
|
||||
|
||||
// todo refactor STableList
|
||||
bool assignUid = false;
|
||||
size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0;
|
||||
char* keyBuf = NULL;
|
||||
if (bufLen > 0) {
|
||||
assignUid = groupbyTbname(pScanInfo->pGroupTags);
|
||||
keyBuf = taosMemoryMalloc(bufLen);
|
||||
if (keyBuf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
bool assignUid = false;
|
||||
|
||||
if (LIST_LENGTH(pScanInfo->pGroupTags) > 0) {
|
||||
SNode* p = nodesListGetNode(pScanInfo->pGroupTags, 0);
|
||||
if (p->type == QUERY_NODE_FUNCTION) {
|
||||
// partition by tbname/group by tbname
|
||||
assignUid = (strcmp(((struct SFunctionNode*)p)->functionName, "tbname") == 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < taosArrayGetSize(qa); ++i) {
|
||||
uint64_t* uid = taosArrayGet(qa, i);
|
||||
STableKeyInfo keyInfo = {.uid = *uid, .groupId = 0};
|
||||
|
|
|
@ -141,8 +141,7 @@ static int32_t doCopyToSDataBlock(SExecTaskInfo* taskInfo, SSDataBlock* pBlock,
|
|||
SqlFunctionCtx* pCtx, int32_t numOfExprs);
|
||||
|
||||
static void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size);
|
||||
static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggInfo, int32_t numOfOutput,
|
||||
uint64_t groupId);
|
||||
static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
|
||||
|
||||
// setup the output buffer for each operator
|
||||
static bool hasNull(SColumn* pColumn, SColumnDataAgg* pStatis) {
|
||||
|
@ -1393,10 +1392,11 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
|
|||
}
|
||||
}
|
||||
|
||||
void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggInfo, int32_t numOfOutput,
|
||||
uint64_t groupId) {
|
||||
void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
|
||||
// for simple group by query without interval, all the tables belong to one group result.
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
SAggOperatorInfo* pAggInfo = pOperator->info;
|
||||
|
||||
SResultRowInfo* pResultRowInfo = &pAggInfo->binfo.resultRowInfo;
|
||||
SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx;
|
||||
int32_t* rowEntryInfoOffset = pOperator->exprSupp.rowEntryInfoOffset;
|
||||
|
@ -1420,14 +1420,13 @@ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggIn
|
|||
setResultRowInitCtx(pResultRow, pCtx, numOfOutput, rowEntryInfoOffset);
|
||||
}
|
||||
|
||||
void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId, SAggOperatorInfo* pAggInfo) {
|
||||
if (pAggInfo->groupId != INT32_MIN && pAggInfo->groupId == groupId) {
|
||||
static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
|
||||
SAggOperatorInfo* pAggInfo = pOperator->info;
|
||||
if (pAggInfo->groupId != UINT64_MAX && pAggInfo->groupId == groupId) {
|
||||
return;
|
||||
}
|
||||
#ifdef BUF_PAGE_DEBUG
|
||||
qDebug("page_setbuf, groupId:%" PRIu64, groupId);
|
||||
#endif
|
||||
doSetTableGroupOutputBuf(pOperator, pAggInfo, numOfOutput, groupId);
|
||||
|
||||
doSetTableGroupOutputBuf(pOperator, numOfOutput, groupId);
|
||||
|
||||
// record the current active group id
|
||||
pAggInfo->groupId = groupId;
|
||||
|
@ -1594,7 +1593,7 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
|
|||
pBlock->info.version = pTaskInfo->version;
|
||||
|
||||
blockDataCleanup(pBlock);
|
||||
if (!hasDataInGroupInfo(pGroupResInfo)) {
|
||||
if (!hasRemainResults(pGroupResInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2931,7 +2930,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
// the pDataBlock are always the same one, no need to call this again
|
||||
setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.groupId, pAggInfo);
|
||||
setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.groupId);
|
||||
setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, true);
|
||||
code = doAggregateImpl(pOperator, pSup->pCtx);
|
||||
if (code != 0) {
|
||||
|
@ -2966,7 +2965,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, pInfo, &pAggInfo->groupResInfo, pAggInfo->aggSup.pResultBuf);
|
||||
doFilter(pAggInfo->pCondition, pInfo->pRes, NULL);
|
||||
|
||||
if (!hasDataInGroupInfo(&pAggInfo->groupResInfo)) {
|
||||
if (!hasRemainResults(&pAggInfo->groupResInfo)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
|
@ -3501,7 +3500,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo*
|
|||
goto _error;
|
||||
}
|
||||
|
||||
pInfo->groupId = INT32_MIN;
|
||||
pInfo->groupId = UINT64_MAX;
|
||||
pInfo->pCondition = pCondition;
|
||||
pOperator->name = "TableAggregate";
|
||||
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_HASH_AGG;
|
||||
|
@ -3513,6 +3512,12 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo*
|
|||
pOperator->fpSet = createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, NULL, destroyAggOperatorInfo,
|
||||
aggEncodeResultRow, aggDecodeResultRow, NULL);
|
||||
|
||||
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||
STableScanInfo* pTableScanInfo = downstream->info;
|
||||
pTableScanInfo->pdInfo.pExprSup = &pOperator->exprSupp;
|
||||
pTableScanInfo->pdInfo.pAggSup = &pInfo->aggSup;
|
||||
}
|
||||
|
||||
code = appendDownstream(pOperator, &downstream, 1);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
|
@ -3825,6 +3830,19 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo, int32_t groupNum)
|
|||
return TDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
bool groupbyTbname(SNodeList* pGroupList) {
|
||||
bool bytbname = false;
|
||||
if (LIST_LENGTH(pGroupList) > 0) {
|
||||
SNode* p = nodesListGetNode(pGroupList, 0);
|
||||
if (p->type == QUERY_NODE_FUNCTION) {
|
||||
// partition by tbname/group by tbname
|
||||
bytbname = (strcmp(((struct SFunctionNode*)p)->functionName, "tbname") == 0);
|
||||
}
|
||||
}
|
||||
|
||||
return bytbname;
|
||||
}
|
||||
|
||||
int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group) {
|
||||
if (group == NULL) {
|
||||
return TDB_CODE_SUCCESS;
|
||||
|
@ -3851,13 +3869,22 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
|
|||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
bool assignUid = groupbyTbname(group);
|
||||
|
||||
int32_t groupNum = 0;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pTableListInfo->pTableList); i++) {
|
||||
size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
|
||||
|
||||
for (int32_t i = 0; i < numOfTables; i++) {
|
||||
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
|
||||
|
||||
if (assignUid) {
|
||||
info->groupId = info->uid;
|
||||
} else {
|
||||
int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &info->groupId, sizeof(uint64_t));
|
||||
groupNum++;
|
||||
|
|
|
@ -301,8 +301,7 @@ static SSDataBlock* buildGroupResultDataBlock(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
if (!hasRemainResults(&pInfo->groupResInfo)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -166,6 +166,67 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
|
|||
return false;
|
||||
}
|
||||
|
||||
// this function is for table scanner to extract temporary results of upstream aggregate results.
|
||||
static SResultRow* getTableGroupOutputBuf(SOperatorInfo* pOperator, uint64_t groupId, SFilePage** pPage) {
|
||||
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int64_t buf[2] = {0};
|
||||
SET_RES_WINDOW_KEY((char*)buf, &groupId, sizeof(groupId), groupId);
|
||||
|
||||
STableScanInfo* pTableScanInfo = pOperator->info;
|
||||
|
||||
SResultRowPosition* p1 =
|
||||
(SResultRowPosition*)taosHashGet(pTableScanInfo->pdInfo.pAggSup->pResultRowHashTable, buf, GET_RES_WINDOW_KEY_LEN(sizeof(groupId)));
|
||||
|
||||
if (p1 == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*pPage = getBufPage(pTableScanInfo->pdInfo.pAggSup->pResultBuf, p1->pageId);
|
||||
return (SResultRow*)((char*)(*pPage) + p1->offset);
|
||||
}
|
||||
|
||||
static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo* pBlockInfo, uint32_t* status) {
|
||||
STableScanInfo* pTableScanInfo = pOperator->info;
|
||||
|
||||
if (pTableScanInfo->pdInfo.pExprSup == NULL) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SExprSupp* pSup1 = pTableScanInfo->pdInfo.pExprSup;
|
||||
|
||||
SFilePage* pPage = NULL;
|
||||
SResultRow* pRow = getTableGroupOutputBuf(pOperator, pBlockInfo->groupId, &pPage);
|
||||
|
||||
if (pRow == NULL) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
bool notLoadBlock = true;
|
||||
for (int32_t i = 0; i < pSup1->numOfExprs; ++i) {
|
||||
int32_t functionId = pSup1->pCtx[i].functionId;
|
||||
|
||||
SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, pTableScanInfo->pdInfo.pExprSup->rowEntryInfoOffset);
|
||||
|
||||
int32_t reqStatus = fmFuncDynDataRequired(functionId, pEntry, &pBlockInfo->window);
|
||||
if (reqStatus != FUNC_DATA_REQUIRED_NOT_LOAD) {
|
||||
notLoadBlock = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// release buffer pages
|
||||
releaseBufPage(pTableScanInfo->pdInfo.pAggSup->pResultBuf, pPage);
|
||||
|
||||
if (notLoadBlock) {
|
||||
*status = FUNC_DATA_REQUIRED_NOT_LOAD;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
|
||||
uint32_t* status) {
|
||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||
|
@ -178,7 +239,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
|
|||
|
||||
*status = pInfo->dataBlockLoadFlag;
|
||||
if (pTableScanInfo->pFilterNode != NULL ||
|
||||
overlapWithTimeWindow(&pTableScanInfo->interval, &pBlock->info, pTableScanInfo->cond.order)) {
|
||||
overlapWithTimeWindow(&pTableScanInfo->pdInfo.interval, &pBlock->info, pTableScanInfo->cond.order)) {
|
||||
(*status) = FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||
}
|
||||
|
||||
|
@ -232,6 +293,16 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
|
|||
ASSERT(*status == FUNC_DATA_REQUIRED_DATA_LOAD);
|
||||
|
||||
// todo filter data block according to the block sma data firstly
|
||||
|
||||
doDynamicPruneDataBlock(pOperator, pBlockInfo, status);
|
||||
if (*status == FUNC_DATA_REQUIRED_NOT_LOAD) {
|
||||
qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
|
||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
pCost->skipBlocks += 1;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!doFilterByBlockStatistics(pBlock->pBlockStatis, pTableScanInfo->pCtx, pBlockInfo->rows)) {
|
||||
pCost->filterOutBlocks += 1;
|
||||
|
@ -263,18 +334,20 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
|
|||
}
|
||||
}
|
||||
|
||||
int64_t st = taosGetTimestampMs();
|
||||
if (pTableScanInfo->pFilterNode != NULL) {
|
||||
int64_t st = taosGetTimestampUs();
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo);
|
||||
|
||||
int64_t et = taosGetTimestampMs();
|
||||
pTableScanInfo->readRecorder.filterTime += (et - st);
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
pTableScanInfo->readRecorder.filterTime += el;
|
||||
|
||||
if (pBlock->info.rows == 0) {
|
||||
pCost->filterOutBlocks += 1;
|
||||
qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
|
||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d, elapsed time:%.2f ms",
|
||||
GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, el);
|
||||
} else {
|
||||
qDebug("%s data block filter out, elapsed time:%" PRId64, GET_TASKID(pTaskInfo), (et - st));
|
||||
qDebug("%s data block filter applied, elapsed time:%.2f ms", GET_TASKID(pTaskInfo), el);
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -604,9 +677,10 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
|
|||
|
||||
pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]};
|
||||
// pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose
|
||||
// pInfo->cond.order = TSDB_ORDER_DESC;
|
||||
|
||||
pInfo->pdInfo.interval = extractIntervalInfo(pTableScanNode);
|
||||
pInfo->readHandle = *readHandle;
|
||||
pInfo->interval = extractIntervalInfo(pTableScanNode);
|
||||
pInfo->sample.sampleRatio = pTableScanNode->ratio;
|
||||
pInfo->sample.seed = taosGetTimestampSec();
|
||||
|
||||
|
@ -1479,14 +1553,14 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
|
|||
pInfo->tqReader = pHandle->tqReader;
|
||||
}
|
||||
|
||||
if (pTSInfo->interval.interval > 0) {
|
||||
pInfo->pUpdateInfo = updateInfoInitP(&pTSInfo->interval, pInfo->twAggSup.waterMark);
|
||||
if (pTSInfo->pdInfo.interval.interval > 0) {
|
||||
pInfo->pUpdateInfo = updateInfoInitP(&pTSInfo->pdInfo.interval, pInfo->twAggSup.waterMark);
|
||||
} else {
|
||||
pInfo->pUpdateInfo = NULL;
|
||||
}
|
||||
|
||||
pInfo->pTableScanOp = pTableScanOp;
|
||||
pInfo->interval = pTSInfo->interval;
|
||||
pInfo->interval = pTSInfo->pdInfo.interval;
|
||||
|
||||
pInfo->readHandle = *pHandle;
|
||||
pInfo->tableUid = pScanPhyNode->uid;
|
||||
|
@ -2662,16 +2736,20 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
|
|||
}
|
||||
}
|
||||
|
||||
if (pTableScanInfo->pFilterNode != NULL) {
|
||||
int64_t st = taosGetTimestampMs();
|
||||
doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo);
|
||||
|
||||
int64_t et = taosGetTimestampMs();
|
||||
pTableScanInfo->readRecorder.filterTime += (et - st);
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
pTableScanInfo->readRecorder.filterTime += el;
|
||||
|
||||
if (pBlock->info.rows == 0) {
|
||||
pCost->filterOutBlocks += 1;
|
||||
qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
|
||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||
qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d, elapsed time:%.2f ms",
|
||||
GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, el);
|
||||
} else {
|
||||
qDebug("%s data block filter applied, elapsed time:%.2f ms", GET_TASKID(pTaskInfo), el);
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -1218,7 +1218,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
bool hasRemain = hasRemainResults(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
|
@ -1257,7 +1257,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
bool hasRemain = hasRemainResults(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
|
@ -1294,7 +1294,7 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBlock, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
bool hasRemain = hasRemainResults(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
|
@ -1563,7 +1563,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
if (pInfo->binfo.pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) {
|
||||
if (pInfo->binfo.pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) {
|
||||
pOperator->status = OP_EXEC_DONE;
|
||||
qDebug("===stream===single interval is done");
|
||||
freeAllPages(pInfo->pRecycledPages, pInfo->aggSup.pResultBuf);
|
||||
|
@ -1596,7 +1596,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pBlock->info.type == STREAM_NORMAL) {
|
||||
if (pBlock->info.type == STREAM_NORMAL && pBlock->info.version != 0) {
|
||||
// set input version
|
||||
pTaskInfo->version = pBlock->info.version;
|
||||
}
|
||||
|
@ -2010,7 +2010,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
bool hasRemain = hasRemainResults(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
|
@ -2053,7 +2053,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) {
|
|||
doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf);
|
||||
doFilter(pInfo->pCondition, pBInfo->pRes, NULL);
|
||||
|
||||
bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo);
|
||||
bool hasRemain = hasRemainResults(&pInfo->groupResInfo);
|
||||
if (!hasRemain) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
break;
|
||||
|
@ -2219,7 +2219,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
|
|||
|
||||
// if (pOperator->status == OP_RES_TO_RETURN) {
|
||||
// // doBuildResultDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
|
||||
// if (pResBlock->info.rows == 0 || !hasDataInGroupInfo(&pSliceInfo->groupResInfo)) {
|
||||
// if (pResBlock->info.rows == 0 || !hasRemainResults(&pSliceInfo->groupResInfo)) {
|
||||
// doSetOperatorCompleted(pOperator);
|
||||
// }
|
||||
//
|
||||
|
@ -3097,6 +3097,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
|
|||
pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
|
||||
pInfo->delIndex = 0;
|
||||
pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes));
|
||||
pInfo->pRecycledPages = taosArrayInit(4, sizeof(int32_t));
|
||||
|
||||
pOperator->operatorType = pPhyNode->type;
|
||||
pOperator->blocking = true;
|
||||
|
@ -3859,7 +3860,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
|
|||
return pInfo->pDelRes;
|
||||
}
|
||||
doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf);
|
||||
if (pBInfo->pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) {
|
||||
if (pBInfo->pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
}
|
||||
printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "final session" : "single session");
|
||||
|
@ -4419,7 +4420,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
|
|||
return pInfo->pDelRes;
|
||||
}
|
||||
doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf);
|
||||
if (pBInfo->pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) {
|
||||
if (pBInfo->pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) {
|
||||
doSetOperatorCompleted(pOperator);
|
||||
}
|
||||
printDataBlock(pBInfo->pRes, "single state");
|
||||
|
|
|
@ -26,6 +26,7 @@ typedef int32_t (*FTranslateFunc)(SFunctionNode* pFunc, char* pErrBuf, int32_t l
|
|||
typedef EFuncDataRequired (*FFuncDataRequired)(SFunctionNode* pFunc, STimeWindow* pTimeWindow);
|
||||
typedef int32_t (*FCreateMergeFuncParameters)(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters);
|
||||
typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, STimeWindow* pTimeWindow);
|
||||
typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc);
|
||||
|
||||
typedef struct SBuiltinFuncDefinition {
|
||||
const char* name;
|
||||
|
@ -44,6 +45,7 @@ typedef struct SBuiltinFuncDefinition {
|
|||
const char* pPartialFunc;
|
||||
const char* pMergeFunc;
|
||||
FCreateMergeFuncParameters createMergeParaFuc;
|
||||
FEstimateReturnRows estimateReturnRowsFunc;
|
||||
} SBuiltinFuncDefinition;
|
||||
|
||||
extern const SBuiltinFuncDefinition funcMgtBuiltins[];
|
||||
|
|
|
@ -118,6 +118,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
|
|||
int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx);
|
||||
int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx);
|
||||
int32_t getFirstLastInfoSize(int32_t resBytes);
|
||||
EFuncDataRequired lastDynDataReq(void* pRes, STimeWindow* pTimeWindow);
|
||||
|
||||
int32_t lastRowFunction(SqlFunctionCtx *pCtx);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ extern "C" {
|
|||
#define FUNC_MGT_CLIENT_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19)
|
||||
#define FUNC_MGT_MULTI_ROWS_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20)
|
||||
#define FUNC_MGT_KEEP_ORDER_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21)
|
||||
#define FUNC_MGT_CUMULATIVE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(22)
|
||||
|
||||
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
|
||||
|
||||
|
|
|
@ -1277,6 +1277,8 @@ static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static EFuncReturnRows csumEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; }
|
||||
|
||||
static int32_t translateMavg(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||
if (2 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||
|
@ -1416,6 +1418,11 @@ static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static EFuncReturnRows derivativeEstReturnRows(SFunctionNode* pFunc) {
|
||||
return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 2))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE
|
||||
: FUNC_RETURN_ROWS_N_MINUS_1;
|
||||
}
|
||||
|
||||
static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||
|
@ -1551,6 +1558,14 @@ static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static EFuncReturnRows diffEstReturnRows(SFunctionNode* pFunc) {
|
||||
if (1 == LIST_LENGTH(pFunc->pParameterList)) {
|
||||
return FUNC_RETURN_ROWS_N_MINUS_1;
|
||||
}
|
||||
return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE
|
||||
: FUNC_RETURN_ROWS_N_MINUS_1;
|
||||
}
|
||||
|
||||
static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||
|
@ -2231,13 +2246,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
|||
{
|
||||
.name = "derivative",
|
||||
.type = FUNCTION_TYPE_DERIVATIVE,
|
||||
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
|
||||
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
|
||||
.translateFunc = translateDerivative,
|
||||
.getEnvFunc = getDerivativeFuncEnv,
|
||||
.initFunc = derivativeFuncSetup,
|
||||
.processFunc = derivativeFunction,
|
||||
.sprocessFunc = derivativeScalarFunction,
|
||||
.finalizeFunc = functionFinalize
|
||||
.finalizeFunc = functionFinalize,
|
||||
.estimateReturnRowsFunc = derivativeEstReturnRows
|
||||
},
|
||||
{
|
||||
.name = "irate",
|
||||
|
@ -2312,6 +2328,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
|||
.type = FUNCTION_TYPE_LAST,
|
||||
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC,
|
||||
.translateFunc = translateFirstLast,
|
||||
.dynDataRequiredFunc = lastDynDataReq,
|
||||
.getEnvFunc = getFirstLastFuncEnv,
|
||||
.initFunc = functionSetup,
|
||||
.processFunc = lastFunction,
|
||||
|
@ -2469,13 +2486,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
|||
{
|
||||
.name = "csum",
|
||||
.type = FUNCTION_TYPE_CSUM,
|
||||
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
|
||||
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC,
|
||||
.translateFunc = translateCsum,
|
||||
.getEnvFunc = getCsumFuncEnv,
|
||||
.initFunc = functionSetup,
|
||||
.processFunc = csumFunction,
|
||||
.sprocessFunc = csumScalarFunction,
|
||||
.finalizeFunc = NULL
|
||||
.finalizeFunc = NULL,
|
||||
.estimateReturnRowsFunc = csumEstReturnRows,
|
||||
},
|
||||
{
|
||||
.name = "mavg",
|
||||
|
|
|
@ -2700,6 +2700,22 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx)
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
EFuncDataRequired lastDynDataReq(void* pRes, STimeWindow* pTimeWindow) {
|
||||
SResultRowEntryInfo* pEntry = (SResultRowEntryInfo*) pRes;
|
||||
|
||||
// not initialized yet, data is required
|
||||
if (pEntry == NULL) {
|
||||
return FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||
}
|
||||
|
||||
SFirstLastRes* pResult = GET_ROWCELL_INTERBUF(pEntry);
|
||||
if (pResult->hasResult && pResult->ts >= pTimeWindow->ekey) {
|
||||
return FUNC_DATA_REQUIRED_NOT_LOAD;
|
||||
} else {
|
||||
return FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t getFirstLastInfoSize(int32_t resBytes) { return sizeof(SFirstLastRes) + resBytes; }
|
||||
|
||||
bool getFirstLastFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) {
|
||||
|
|
|
@ -89,6 +89,14 @@ int32_t fmGetFuncInfo(SFunctionNode* pFunc, char* pMsg, int32_t msgLen) {
|
|||
return TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION;
|
||||
}
|
||||
|
||||
EFuncReturnRows fmGetFuncReturnRows(SFunctionNode* pFunc) {
|
||||
if (NULL != funcMgtBuiltins[pFunc->funcId].estimateReturnRowsFunc) {
|
||||
return funcMgtBuiltins[pFunc->funcId].estimateReturnRowsFunc(pFunc);
|
||||
}
|
||||
return (fmIsIndefiniteRowsFunc(pFunc->funcId) || fmIsMultiRowsFunc(pFunc->funcId)) ? FUNC_RETURN_ROWS_INDEFINITE
|
||||
: FUNC_RETURN_ROWS_NORMAL;
|
||||
}
|
||||
|
||||
bool fmIsBuiltinFunc(const char* pFunc) {
|
||||
return NULL != taosHashGet(gFunMgtService.pFuncNameHashTable, pFunc, strlen(pFunc));
|
||||
}
|
||||
|
@ -107,8 +115,13 @@ EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, STimeWindow*
|
|||
if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
if (funcMgtBuiltins[funcId].dynDataRequiredFunc == NULL) {
|
||||
return FUNC_DATA_REQUIRED_DATA_LOAD;
|
||||
} else {
|
||||
return funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pTimeWindow);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet) {
|
||||
if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||
|
@ -192,6 +205,8 @@ bool fmIsMultiRowsFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, F
|
|||
|
||||
bool fmIsKeepOrderFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_KEEP_ORDER_FUNC); }
|
||||
|
||||
bool fmIsCumulativeFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_CUMULATIVE_FUNC); }
|
||||
|
||||
bool fmIsInterpFunc(int32_t funcId) {
|
||||
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
|
||||
return false;
|
||||
|
|
|
@ -1112,12 +1112,16 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod
|
|||
if (!fmIsIndefiniteRowsFunc(pFunc->funcId)) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause ||
|
||||
((SSelectStmt*)pCxt->pCurrStmt)->hasIndefiniteRowsFunc || ((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs ||
|
||||
((SSelectStmt*)pCxt->pCurrStmt)->hasMultiRowsFunc) {
|
||||
if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
|
||||
}
|
||||
if (NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pWindow || NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pGroupByList) {
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
|
||||
if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc ||
|
||||
(pSelect->hasIndefiniteRowsFunc &&
|
||||
(FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc)))) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
|
||||
}
|
||||
if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
||||
"%s function is not supported in window query or group query", pFunc->functionName);
|
||||
}
|
||||
|
@ -1232,18 +1236,28 @@ static int32_t getMultiResFuncNum(SNodeList* pParameterList) {
|
|||
return LIST_LENGTH(pParameterList);
|
||||
}
|
||||
|
||||
static int32_t calcSelectFuncNum(SFunctionNode* pFunc, int32_t currSelectFuncNum) {
|
||||
if (fmIsCumulativeFunc(pFunc->funcId)) {
|
||||
return currSelectFuncNum > 0 ? currSelectFuncNum : 1;
|
||||
}
|
||||
return currSelectFuncNum + ((fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId))
|
||||
? getMultiResFuncNum(pFunc->pParameterList)
|
||||
: 1);
|
||||
}
|
||||
|
||||
static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
||||
if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) {
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt;
|
||||
pSelect->hasAggFuncs = pSelect->hasAggFuncs ? true : fmIsAggFunc(pFunc->funcId);
|
||||
pSelect->hasRepeatScanFuncs = pSelect->hasRepeatScanFuncs ? true : fmIsRepeatScanFunc(pFunc->funcId);
|
||||
pSelect->hasIndefiniteRowsFunc = pSelect->hasIndefiniteRowsFunc ? true : fmIsIndefiniteRowsFunc(pFunc->funcId);
|
||||
if (fmIsIndefiniteRowsFunc(pFunc->funcId)) {
|
||||
pSelect->hasIndefiniteRowsFunc = true;
|
||||
pSelect->returnRows = fmGetFuncReturnRows(pFunc);
|
||||
}
|
||||
pSelect->hasMultiRowsFunc = pSelect->hasMultiRowsFunc ? true : fmIsMultiRowsFunc(pFunc->funcId);
|
||||
if (fmIsSelectFunc(pFunc->funcId)) {
|
||||
pSelect->hasSelectFunc = true;
|
||||
pSelect->selectFuncNum += (fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId))
|
||||
? getMultiResFuncNum(pFunc->pParameterList)
|
||||
: 1;
|
||||
pSelect->selectFuncNum = calcSelectFuncNum(pFunc, pSelect->selectFuncNum);
|
||||
} else if (fmIsVectorFunc(pFunc->funcId)) {
|
||||
pSelect->hasOtherVectorFunc = true;
|
||||
}
|
||||
|
@ -2483,6 +2497,9 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
}
|
||||
|
||||
static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartitionByList) {
|
||||
if (NULL == pPartitionByList) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
|
||||
return translateExprList(pCxt, pPartitionByList);
|
||||
}
|
||||
|
|
|
@ -175,6 +175,16 @@ TEST_F(PlanBasicTest, pseudoColumn) {
|
|||
"WHERE ts BETWEEN '2017-7-14 18:00:00' AND '2017-7-14 19:00:00' INTERVAL(10S)");
|
||||
}
|
||||
|
||||
TEST_F(PlanBasicTest, indefiniteRowsFunc) {
|
||||
useDb("root", "test");
|
||||
|
||||
run("SELECT DIFF(c1) FROM t1");
|
||||
|
||||
run("SELECT DIFF(c1), c2 FROM t1");
|
||||
|
||||
run("SELECT DIFF(c1), DIFF(c3), ts FROM t1");
|
||||
}
|
||||
|
||||
TEST_F(PlanBasicTest, withoutFrom) {
|
||||
useDb("root", "test");
|
||||
|
||||
|
|
|
@ -790,65 +790,6 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs
|
|||
}
|
||||
} while (0);
|
||||
|
||||
#if 0
|
||||
// fake match
|
||||
//
|
||||
// condition1:
|
||||
// I have snapshot, no log, preIndex > myLastIndex
|
||||
//
|
||||
// condition2:
|
||||
// I have snapshot, have log, log <= snapshot, preIndex > myLastIndex
|
||||
//
|
||||
// condition3:
|
||||
// I have snapshot, preIndex < snapshot.lastApplyIndex
|
||||
//
|
||||
// condition4:
|
||||
// I have snapshot, preIndex == snapshot.lastApplyIndex, no data
|
||||
//
|
||||
// operation:
|
||||
// match snapshot.lastApplyIndex - 1;
|
||||
// no operation on log
|
||||
do {
|
||||
SyncIndex myLastIndex = syncNodeGetLastIndex(ths);
|
||||
SSnapshot snapshot;
|
||||
ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
|
||||
|
||||
bool condition0 = (pMsg->term == ths->pRaftStore->currentTerm) && (ths->state == TAOS_SYNC_STATE_FOLLOWER) &&
|
||||
syncNodeHasSnapshot(ths);
|
||||
bool condition1 =
|
||||
condition0 && (ths->pLogStore->syncLogEntryCount(ths->pLogStore) == 0) && (pMsg->prevLogIndex > myLastIndex); // donot use syncLogEntryCount!!! use isEmpty
|
||||
bool condition2 = condition0 && (ths->pLogStore->syncLogLastIndex(ths->pLogStore) <= snapshot.lastApplyIndex) &&
|
||||
(pMsg->prevLogIndex > myLastIndex);
|
||||
bool condition3 = condition0 && (pMsg->prevLogIndex < snapshot.lastApplyIndex);
|
||||
bool condition4 = condition0 && (pMsg->prevLogIndex == snapshot.lastApplyIndex) && (pMsg->dataLen == 0);
|
||||
bool condition = condition1 || condition2 || condition3 || condition4;
|
||||
|
||||
if (condition) {
|
||||
char logBuf[128];
|
||||
snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries, fake match, pre-index:%" PRId64 ", pre-term:%" PRIu64,
|
||||
pMsg->prevLogIndex, pMsg->prevLogTerm);
|
||||
syncNodeEventLog(ths, logBuf);
|
||||
|
||||
// prepare response msg
|
||||
SyncAppendEntriesReply* pReply = syncAppendEntriesReplyBuild(ths->vgId);
|
||||
pReply->srcId = ths->myRaftId;
|
||||
pReply->destId = pMsg->srcId;
|
||||
pReply->term = ths->pRaftStore->currentTerm;
|
||||
pReply->privateTerm = ths->pNewNodeReceiver->privateTerm;
|
||||
pReply->success = true;
|
||||
pReply->matchIndex = snapshot.lastApplyIndex;
|
||||
|
||||
// send response
|
||||
SRpcMsg rpcMsg;
|
||||
syncAppendEntriesReply2RpcMsg(pReply, &rpcMsg);
|
||||
syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg);
|
||||
syncAppendEntriesReplyDestroy(pReply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
// fake match
|
||||
//
|
||||
// condition1:
|
||||
|
|
|
@ -213,6 +213,11 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie
|
|||
if (nextIndex > SYNC_INDEX_BEGIN) {
|
||||
--nextIndex;
|
||||
|
||||
// speed up
|
||||
if (nextIndex > pMsg->matchIndex + 1) {
|
||||
nextIndex = pMsg->matchIndex + 1;
|
||||
}
|
||||
|
||||
bool needStartSnapshot = false;
|
||||
if (nextIndex >= SYNC_INDEX_BEGIN && !ths->pLogStore->syncLogExist(ths->pLogStore, nextIndex)) {
|
||||
needStartSnapshot = true;
|
||||
|
|
|
@ -2222,13 +2222,18 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
|
|||
SyncIndex preIndex = index - 1;
|
||||
SSyncRaftEntry* pPreEntry = NULL;
|
||||
int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry);
|
||||
|
||||
SSnapshot snapshot = {.data = NULL,
|
||||
.lastApplyIndex = SYNC_INDEX_INVALID,
|
||||
.lastApplyTerm = SYNC_TERM_INVALID,
|
||||
.lastConfigIndex = SYNC_INDEX_INVALID};
|
||||
|
||||
if (code == 0) {
|
||||
ASSERT(pPreEntry != NULL);
|
||||
preTerm = pPreEntry->term;
|
||||
taosMemoryFree(pPreEntry);
|
||||
return preTerm;
|
||||
} else {
|
||||
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1};
|
||||
if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) {
|
||||
pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
|
||||
if (snapshot.lastApplyIndex == preIndex) {
|
||||
|
@ -2239,7 +2244,8 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
|
|||
|
||||
do {
|
||||
char logBuf[128];
|
||||
snprintf(logBuf, sizeof(logBuf), "sync node get pre term error, index:%" PRId64, index);
|
||||
snprintf(logBuf, sizeof(logBuf), "sync node get pre term error, index:%ld, snap-index:%ld, snap-term:%lu", index,
|
||||
snapshot.lastApplyIndex, snapshot.lastApplyTerm);
|
||||
syncNodeErrorLog(pSyncNode, logBuf);
|
||||
} while (0);
|
||||
|
||||
|
|
|
@ -132,7 +132,8 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) {
|
|||
SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex);
|
||||
SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex);
|
||||
if (preLogTerm == SYNC_TERM_INVALID) {
|
||||
SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
|
||||
// SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
|
||||
SyncIndex newNextIndex = nextIndex + 1;
|
||||
syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex);
|
||||
syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID);
|
||||
sError("vgId:%d sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64
|
||||
|
@ -222,7 +223,8 @@ int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode) {
|
|||
SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex);
|
||||
SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex);
|
||||
if (preLogTerm == SYNC_TERM_INVALID) {
|
||||
SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
|
||||
// SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
|
||||
SyncIndex newNextIndex = nextIndex + 1;
|
||||
syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex);
|
||||
syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID);
|
||||
sError("vgId:%d sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# != 5 ] ; then
|
||||
echo "Uasge: $0 instances vgroups replica ctables rows"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
instances=$1
|
||||
vgroups=$2
|
||||
replica=$3
|
||||
ctables=$4
|
||||
rows=$5
|
||||
|
||||
echo "params: instances:${instances}, vgroups:${vgroups}, replica:${replica}, ctables:${ctables}, rows:${rows}"
|
||||
|
||||
dt=`date "+%Y-%m-%d-%H-%M-%S"`
|
||||
casedir=instances_${instances}_vgroups_${vgroups}_replica_${replica}_ctables_${ctables}_rows_${rows}_${dt}
|
||||
mkdir ${casedir}
|
||||
cp ./insert.tpl.json ${casedir}
|
||||
cd ${casedir}
|
||||
|
||||
for i in `seq 1 ${instances}`;do
|
||||
#echo ===$i===
|
||||
cfg_file=bench_${i}.json
|
||||
cp ./insert.tpl.json ${cfg_file}
|
||||
rstfile=result_${i}
|
||||
sed -i 's/tpl_vgroups_tpl/'${vgroups}'/g' ${cfg_file}
|
||||
sed -i 's/tpl_replica_tpl/'${replica}'/g' ${cfg_file}
|
||||
sed -i 's/tpl_ctables_tpl/'${ctables}'/g' ${cfg_file}
|
||||
sed -i 's/tpl_stid_tpl/'${i}'/g' ${cfg_file}
|
||||
sed -i 's/tpl_rows_tpl/'${rows}'/g' ${cfg_file}
|
||||
sed -i 's/tpl_insert_result_tpl/'${rstfile}'/g' ${cfg_file}
|
||||
done
|
||||
|
||||
for conf_file in `ls ./bench_*.json`;do
|
||||
echo "nohup taosBenchmark -f ${conf_file} &"
|
||||
nohup taosBenchmark -f ${conf_file} &
|
||||
done
|
||||
|
||||
cd -
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"filetype": "insert",
|
||||
"cfgdir": "/etc/taos/",
|
||||
"host": "v3cluster-0001",
|
||||
"port": 7100,
|
||||
"user": "root",
|
||||
"password": "taosdata",
|
||||
"thread_count": 8,
|
||||
"thread_count_create_tbl": 8,
|
||||
"result_file": "./tpl_insert_result_tpl",
|
||||
"confirm_parameter_prompt": "no",
|
||||
"insert_interval": 0,
|
||||
"interlace_rows": 0,
|
||||
"num_of_records_per_req": 100000,
|
||||
"databases": [
|
||||
{
|
||||
"dbinfo": {
|
||||
"name": "db1",
|
||||
"drop": "yes",
|
||||
"vgroups": tpl_vgroups_tpl,
|
||||
"replica": tpl_replica_tpl
|
||||
},
|
||||
"super_tables": [
|
||||
{
|
||||
"name": "stb_tpl_stid_tpl",
|
||||
"child_table_exists": "no",
|
||||
"childtable_count": tpl_ctables_tpl,
|
||||
"childtable_prefix": "stb_tpl_stid_tpl_",
|
||||
"auto_create_table": "no",
|
||||
"batch_create_tbl_num": 50000,
|
||||
"data_source": "rand",
|
||||
"insert_mode": "taosc",
|
||||
"insert_rows": tpl_rows_tpl,
|
||||
"interlace_rows": 0,
|
||||
"insert_interval": 0,
|
||||
"max_sql_len": 10000000,
|
||||
"disorder_ratio": 0,
|
||||
"disorder_range": 1000,
|
||||
"timestamp_step": 10,
|
||||
"sample_format": "csv",
|
||||
"use_sample_ts": "no",
|
||||
"tags_file": "",
|
||||
"columns": [
|
||||
{
|
||||
"type": "INT"
|
||||
},
|
||||
{
|
||||
"type": "DOUBLE",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"type": "BINARY",
|
||||
"len": 40,
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"type": "nchar",
|
||||
"len": 20,
|
||||
"count": 1
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"type": "TINYINT",
|
||||
"count": 1
|
||||
},
|
||||
{
|
||||
"type": "BINARY",
|
||||
"len": 16,
|
||||
"count": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -89,13 +89,20 @@
|
|||
./test.sh -f tsim/parser/alter_column.sim
|
||||
./test.sh -f tsim/parser/alter_stable.sim
|
||||
./test.sh -f tsim/parser/alter.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/alter1.sim
|
||||
# TD-17959 ./test.sh -f tsim/parser/alter1.sim
|
||||
./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim
|
||||
./test.sh -f tsim/parser/auto_create_tb.sim
|
||||
./test.sh -f tsim/parser/between_and.sim
|
||||
./test.sh -f tsim/parser/binary_escapeCharacter.sim
|
||||
# TD-17738 ./test.sh -f tsim/parser/col_arithmetic_operation.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/columnValue.sim
|
||||
./test.sh -f tsim/parser/col_arithmetic_operation.sim
|
||||
./test.sh -f tsim/parser/columnValue_bigint.sim
|
||||
./test.sh -f tsim/parser/columnValue_bool.sim
|
||||
./test.sh -f tsim/parser/columnValue_double.sim
|
||||
./test.sh -f tsim/parser/columnValue_float.sim
|
||||
./test.sh -f tsim/parser/columnValue_int.sim
|
||||
./test.sh -f tsim/parser/columnValue_smallint.sim
|
||||
./test.sh -f tsim/parser/columnValue_tinyint.sim
|
||||
./test.sh -f tsim/parser/columnValue_unsign.sim
|
||||
./test.sh -f tsim/parser/commit.sim
|
||||
./test.sh -f tsim/parser/condition.sim
|
||||
./test.sh -f tsim/parser/constCol.sim
|
||||
|
@ -145,7 +152,7 @@
|
|||
./test.sh -f tsim/parser/select_across_vnodes.sim
|
||||
./test.sh -f tsim/parser/select_distinct_tag.sim
|
||||
./test.sh -f tsim/parser/select_from_cache_disk.sim
|
||||
# TD-17832 ./test.sh -f tsim/parser/select_with_tags.sim
|
||||
./test.sh -f tsim/parser/select_with_tags.sim
|
||||
./test.sh -f tsim/parser/selectResNum.sim
|
||||
./test.sh -f tsim/parser/set_tag_vals.sim
|
||||
./test.sh -f tsim/parser/single_row_in_tb.sim
|
||||
|
@ -154,15 +161,15 @@
|
|||
./test.sh -f tsim/parser/slimit.sim
|
||||
./test.sh -f tsim/parser/slimit1.sim
|
||||
./test.sh -f tsim/parser/stableOp.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/tags_filter.sim
|
||||
./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
|
||||
./test.sh -f tsim/parser/tags_filter.sim
|
||||
./test.sh -f tsim/parser/tbnameIn.sim
|
||||
./test.sh -f tsim/parser/timestamp.sim
|
||||
./test.sh -f tsim/parser/top_groupby.sim
|
||||
./test.sh -f tsim/parser/topbot.sim
|
||||
./test.sh -f tsim/parser/union.sim
|
||||
# TD-17704 ./test.sh -f tsim/parser/union_sysinfo.sim
|
||||
# TD-17661 ./test.sh -f tsim/parser/where.sim
|
||||
./test.sh -f tsim/parser/union_sysinfo.sim
|
||||
./test.sh -f tsim/parser/where.sim
|
||||
|
||||
# ---- query ----
|
||||
./test.sh -f tsim/query/charScalarFunction.sim
|
||||
|
@ -422,18 +429,18 @@
|
|||
./test.sh -f tsim/tag/bool_binary.sim
|
||||
./test.sh -f tsim/tag/bool_int.sim
|
||||
./test.sh -f tsim/tag/bool.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/change.sim
|
||||
# TD-17407 ./test.sh -f tsim/tag/change.sim
|
||||
./test.sh -f tsim/tag/column.sim
|
||||
./test.sh -f tsim/tag/commit.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/create.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/delete.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/double.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/filter.sim
|
||||
# TD-17407 ./test.sh -f tsim/tag/create.sim
|
||||
# TD-17407 ./test.sh -f tsim/tag/delete.sim
|
||||
# TD-17407 ./test.sh -f tsim/tag/double.sim
|
||||
./test.sh -f tsim/tag/filter.sim
|
||||
# TD-17407 ./test.sh -f tsim/tag/float.sim
|
||||
./test.sh -f tsim/tag/int_binary.sim
|
||||
./test.sh -f tsim/tag/int_float.sim
|
||||
./test.sh -f tsim/tag/int.sim
|
||||
# TD-17661 ./test.sh -f tsim/tag/set.sim
|
||||
# TD-17959 ./test.sh -f tsim/tag/set.sim
|
||||
./test.sh -f tsim/tag/smallint.sim
|
||||
./test.sh -f tsim/tag/tinyint.sim
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ sql select diff(c7) from $tb
|
|||
sql_error select diff(c8) from $tb
|
||||
sql_error select diff(c9) from $tb
|
||||
sql_error select diff(ts) from $tb
|
||||
sql_error select diff(c1), diff(c2) from $tb
|
||||
sql select diff(c1), diff(c2) from $tb
|
||||
|
||||
sql select 2+diff(c1) from $tb
|
||||
sql select diff(c1+2) from $tb
|
||||
|
|
|
@ -55,6 +55,7 @@ if $rows != 4 then
|
|||
return -1
|
||||
endi
|
||||
if $data01 != 10 then
|
||||
print expect 10, actual: $data01
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 2.00000 then
|
||||
|
|
|
@ -103,7 +103,7 @@ endi
|
|||
|
||||
print ================== change a tag value
|
||||
sql alter table car1 set tag carid=10
|
||||
sql select carId, carmodel from car1
|
||||
sql select distinct carId, carmodel from car1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -131,20 +131,5 @@ sql_error select max(c1-c2) from $tb
|
|||
#========================================regression test cases====================================
|
||||
print =====================> td-1764
|
||||
sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y)
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != @18-01-01 00:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 2.250000000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 225000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -511,24 +511,21 @@ if $rows != 1 then
|
|||
endi
|
||||
|
||||
# slimit/soffset not support for normal table query. [d.11]===============================================================
|
||||
sql select sum(c1) from $stb slimit 1 soffset 19;
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql_error select sum(c1) from $stb slimit 1 soffset 19;
|
||||
|
||||
sql select sum(c1) from $stb interval(1s) group by tbname slimit 1 soffset 1
|
||||
sql select sum(c1) from ca_stb0 interval(1s) group by tbname slimit 2 soffset 4 limit 10 offset 1
|
||||
sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 1 soffset 1
|
||||
sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 2 soffset 4 limit 10 offset 1
|
||||
|
||||
# fill [d.12]===============================================================
|
||||
sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from $stb interval(1s) fill(prev);
|
||||
sql_error select first(c1) from $stb fill(value, 20);
|
||||
sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from ca_stb0 interval(1s) fill(prev);
|
||||
sql_error select first(c1) from ca_stb0 fill(value, 20);
|
||||
|
||||
# constant column. [d.13]===============================================================
|
||||
|
||||
# column value filter [d.14]===============================================================
|
||||
|
||||
# tag filter. [d.15]===============================================================
|
||||
sql select sum(c2)+99 from $stb where t1=12;
|
||||
sql select sum(c2)+99 from ca_stb0 where t1=12;
|
||||
|
||||
# multi-field output [d.16]===============================================================
|
||||
sql select count(*), sum(c1)*avg(c2), avg(c3)*count(c3), sum(c3), sum(c4), first(c7), last(c8), first(c9), first(c7), last(c8) from $tb
|
||||
|
@ -548,15 +545,12 @@ if $data90 != 9.500000000 then
|
|||
endi
|
||||
|
||||
# interval query [d.17]===============================================================
|
||||
sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from $stb interval(1s)
|
||||
sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from ca_stb0 interval(1s)
|
||||
if $rows != 10000 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @18-09-17 09:00:00.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error select first(c7)- last(c1) from $tb interval(2y)
|
||||
sql select first(c7)- last(c1) from $tb interval(2y)
|
||||
|
||||
# aggregation query [d.18]===============================================================
|
||||
# all cases in this part are aggregation query test.
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
run tsim/parser/columnValue_bool.sim
|
||||
run tsim/parser/columnValue_tinyint.sim
|
||||
run tsim/parser/columnValue_smallint.sim
|
||||
run tsim/parser/columnValue_int.sim
|
||||
run tsim/parser/columnValue_bigint.sim
|
||||
run tsim/parser/columnValue_float.sim
|
||||
run tsim/parser/columnValue_double.sim
|
||||
run tsim/parser/columnValue_unsign.sim
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
@ -1,5 +1,12 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create database if not exists db
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -10,78 +17,64 @@ sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_bigint_0 using mt_bigint tags (NULL)
|
||||
sql select tagname from st_bigint_0
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_1 using mt_bigint tags (NULL)
|
||||
sql select tagname from st_bigint_1
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_2 using mt_bigint tags ('NULL')
|
||||
sql select tagname from st_bigint_2
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_3 using mt_bigint tags ('NULL')
|
||||
sql select tagname from st_bigint_3
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_4 using mt_bigint tags ("NULL")
|
||||
sql select tagname from st_bigint_4
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_5 using mt_bigint tags ("NULL")
|
||||
sql select tagname from st_bigint_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_bigint_2 using mt_bigint tags ('NULL')
|
||||
sql_error create table st_bigint_3 using mt_bigint tags ('NULL')
|
||||
sql_error create table st_bigint_4 using mt_bigint tags ("NULL")
|
||||
sql_error create table st_bigint_5 using mt_bigint tags ("NULL")
|
||||
|
||||
sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807)
|
||||
sql select tagname from st_bigint_6
|
||||
if $data00 != -9223372036854775807 then
|
||||
sql show tags from st_bigint_6
|
||||
if $data05 != -9223372036854775807 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_7 using mt_bigint tags (9223372036854775807)
|
||||
sql select tagname from st_bigint_7
|
||||
if $data00 != 9223372036854775807 then
|
||||
sql show tags from st_bigint_7
|
||||
if $data05 != 9223372036854775807 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_8 using mt_bigint tags (37)
|
||||
sql select tagname from st_bigint_8
|
||||
if $data00 != 37 then
|
||||
sql show tags from st_bigint_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_9 using mt_bigint tags (-100)
|
||||
sql select tagname from st_bigint_9
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_bigint_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_10 using mt_bigint tags (+113)
|
||||
sql select tagname from st_bigint_10
|
||||
if $data00 != 113 then
|
||||
sql show tags from st_bigint_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_11 using mt_bigint tags ('-100')
|
||||
sql select tagname from st_bigint_11
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_bigint_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_12 using mt_bigint tags ("+78")
|
||||
sql select tagname from st_bigint_12
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_bigint_12
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_13 using mt_bigint tags (+0078)
|
||||
sql select tagname from st_bigint_13
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_bigint_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bigint_14 using mt_bigint tags (-00078)
|
||||
sql select tagname from st_bigint_14
|
||||
if $data00 != -78 then
|
||||
sql show tags from st_bigint_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -102,38 +95,7 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_2 values (now, 'NULL')
|
||||
sql select * from st_bigint_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_3 values (now, 'NULL')
|
||||
sql select * from st_bigint_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_4 values (now, "NULL")
|
||||
sql select * from st_bigint_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_5 values (now, "NULL")
|
||||
sql select * from st_bigint_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_bigint_6 values (now, 9223372036854775807)
|
||||
sql select * from st_bigint_6
|
||||
if $rows != 1 then
|
||||
|
@ -211,8 +173,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_bigint_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_16
|
||||
|
@ -221,8 +183,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_bigint_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_17
|
||||
|
@ -230,8 +192,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_bigint_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_18
|
||||
|
@ -239,8 +201,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_19 using mt_bigint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_bigint_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_19
|
||||
|
@ -248,8 +210,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_20 using mt_bigint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_bigint_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_20
|
||||
|
@ -257,8 +219,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_21 using mt_bigint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_bigint_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bigint_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_21
|
||||
|
@ -266,8 +228,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_22 using mt_bigint tags (9223372036854775807) values (now, 9223372036854775807)
|
||||
sql select tagname from st_bigint_22
|
||||
if $data00 != 9223372036854775807 then
|
||||
sql show tags from st_bigint_22
|
||||
if $data05 != 9223372036854775807 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_22
|
||||
|
@ -275,8 +237,8 @@ if $data01 != 9223372036854775807 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807)
|
||||
sql select tagname from st_bigint_23
|
||||
if $data00 != -9223372036854775807 then
|
||||
sql show tags from st_bigint_23
|
||||
if $data05 != -9223372036854775807 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_23
|
||||
|
@ -284,8 +246,8 @@ if $data01 != -9223372036854775807 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10)
|
||||
sql select tagname from st_bigint_24
|
||||
if $data00 != 10 then
|
||||
sql show tags from st_bigint_24
|
||||
if $data05 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_24
|
||||
|
@ -293,8 +255,8 @@ if $data01 != 10 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_bigint_25
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_bigint_25
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_25
|
||||
|
@ -302,8 +264,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123')
|
||||
sql select tagname from st_bigint_26
|
||||
if $data00 != 123 then
|
||||
sql show tags from st_bigint_26
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_26
|
||||
|
@ -311,8 +273,8 @@ if $data01 != 123 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056)
|
||||
sql select tagname from st_bigint_27
|
||||
if $data00 != 56 then
|
||||
sql show tags from st_bigint_27
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_27
|
||||
|
@ -320,8 +282,8 @@ if $data01 != 56 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056)
|
||||
sql select tagname from st_bigint_28
|
||||
if $data00 != -56 then
|
||||
sql show tags from st_bigint_28
|
||||
if $data05 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_bigint_28
|
||||
|
@ -331,50 +293,50 @@ endi
|
|||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_bigint_0 set tag tagname=9223372036854775807
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != 9223372036854775807 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != 9223372036854775807 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname=-9223372036854775807
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != -9223372036854775807 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != -9223372036854775807 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname=+100
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != 100 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname=-33
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != -33 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname='+98'
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != 98 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname='-076'
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != -76 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname=+0012
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != 12 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bigint_0 set tag tagname=-00063
|
||||
#sql select tagname from st_bigint_0
|
||||
#if $data00 != -63 then
|
||||
#sql show tags from st_bigint_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
## case 04: illegal input
|
||||
################## when overflow, auto set max
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags (9223372036854775808)
|
||||
sql_error create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808)
|
||||
sql create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808)
|
||||
sql_error create table st_bigint_e0_2 using mt_bigint tags (92233720368547758080)
|
||||
sql_error create table st_bigint_e0_3 using mt_bigint tags (-9223372036854775809)
|
||||
#sql_error create table st_bigint_e0 using mt_bigint tags (12.80) truncate integer part
|
||||
|
@ -384,7 +346,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc")
|
|||
sql_error create table st_bigint_e0 using mt_bigint tags (abc)
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags ("abc")
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags (" ")
|
||||
sql_error create table st_bigint_e0 using mt_bigint tags ('')
|
||||
sql create table st_bigint_e0_error using mt_bigint tags ('')
|
||||
|
||||
sql create table st_bigint_e0 using mt_bigint tags (123)
|
||||
sql create table st_bigint_e1 using mt_bigint tags (123)
|
||||
|
@ -401,9 +363,9 @@ sql create table st_bigint_e11 using mt_bigint tags (123)
|
|||
sql create table st_bigint_e12 using mt_bigint tags (123)
|
||||
|
||||
sql_error insert into st_bigint_e0 values (now, 9223372036854775808)
|
||||
sql_error insert into st_bigint_e1 values (now, -9223372036854775808)
|
||||
sql insert into st_bigint_e1 values (now, -9223372036854775808)
|
||||
sql_error insert into st_bigint_e2 values (now, 9223372036854775809)
|
||||
sql_error insert into st_bigint_e3 values (now, -9223372036854775808)
|
||||
sql insert into st_bigint_e3 values (now, -9223372036854775808)
|
||||
#sql_error insert into st_bigint_e4 values (now, 922337203.6854775808)
|
||||
#sql_error insert into st_bigint_e5 values (now, -922337203685477580.9)
|
||||
sql_error insert into st_bigint_e6 values (now, 123abc)
|
||||
|
@ -411,10 +373,10 @@ sql_error insert into st_bigint_e7 values (now, "123abc")
|
|||
sql_error insert into st_bigint_e9 values (now, abc)
|
||||
sql_error insert into st_bigint_e10 values (now, "abc")
|
||||
sql_error insert into st_bigint_e11 values (now, " ")
|
||||
sql_error insert into st_bigint_e12 values (now, '')
|
||||
sql insert into st_bigint_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_bigint_e13 using mt_bigint tags (033) values (now, 9223372036854775808)
|
||||
sql_error insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808)
|
||||
sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808)
|
||||
sql_error insert into st_bigint_e15 using mt_bigint tags (033) values (now, 9223372036854775818)
|
||||
sql_error insert into st_bigint_e16 using mt_bigint tags (033) values (now, -9923372036854775808)
|
||||
#sql_error insert into st_bigint_e17 using mt_bigint tags (033) values (now, 92233720368547758.08)
|
||||
|
@ -424,10 +386,10 @@ sql_error insert into st_bigint_e20 using mt_bigint tags (033) values (now, "123
|
|||
sql_error insert into st_bigint_e22 using mt_bigint tags (033) values (now, abc)
|
||||
sql_error insert into st_bigint_e23 using mt_bigint tags (033) values (now, "abc")
|
||||
sql_error insert into st_bigint_e24 using mt_bigint tags (033) values (now, " ")
|
||||
sql_error insert into st_bigint_e25 using mt_bigint tags (033) values (now, '')
|
||||
sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_bigint_e13_0 using mt_bigint tags (9223372036854775808) values (now, -033)
|
||||
sql_error insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033)
|
||||
sql insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033)
|
||||
sql_error insert into st_bigint_e15_0 using mt_bigint tags (9223372036854775809) values (now, -033)
|
||||
sql_error insert into st_bigint_e16_0 using mt_bigint tags (-9223372036854775898) values (now, -033)
|
||||
#sql_error insert into st_bigint_e17 using mt_bigint tags (12.80) values (now, -033)
|
||||
|
@ -437,7 +399,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now,
|
|||
sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033)
|
||||
sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033)
|
||||
sql_error insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
|
||||
sql insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062)
|
||||
sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062)
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create database if not exists db
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -10,110 +17,110 @@ sql create table mt_bool (ts timestamp, c bool) tags (tagname bool)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_bool_0 using mt_bool tags (NULL)
|
||||
sql select tagname from st_bool_0
|
||||
if $data00 != NULL then
|
||||
print ==1== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_0
|
||||
if $data05 != NULL then
|
||||
print ==1== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_1 using mt_bool tags (NULL)
|
||||
sql select tagname from st_bool_1
|
||||
if $data00 != NULL then
|
||||
print ==2== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_1
|
||||
if $data05 != NULL then
|
||||
print ==2== expect: NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_2 using mt_bool tags ('NULL')
|
||||
sql select tagname from st_bool_2
|
||||
if $data00 != NULL then
|
||||
print ==3== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_2
|
||||
if $data05 != false then
|
||||
print ==3== expect: false, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_3 using mt_bool tags ('NULL')
|
||||
sql select tagname from st_bool_3
|
||||
if $data00 != NULL then
|
||||
print ==4== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_3
|
||||
if $data05 != false then
|
||||
print ==4== expect: false, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_4 using mt_bool tags ("NULL")
|
||||
sql select tagname from st_bool_4
|
||||
if $data00 != NULL then
|
||||
print ==5== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_4
|
||||
if $data05 != false then
|
||||
print ==5== expect: false, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_5 using mt_bool tags ("NULL")
|
||||
sql select tagname from st_bool_5
|
||||
if $data00 != NULL then
|
||||
print ==6== expect: NULL, actually: $data00
|
||||
sql show tags from st_bool_5
|
||||
if $data05 != false then
|
||||
print ==6== expect: false, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_6 using mt_bool tags ("true")
|
||||
sql select tagname from st_bool_6
|
||||
if $data00 != 1 then
|
||||
print ==7== expect: 1, actually: $data00
|
||||
sql show tags from st_bool_6
|
||||
if $data05 != true then
|
||||
print ==7== expect: 1, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_7 using mt_bool tags ('true')
|
||||
sql select tagname from st_bool_7
|
||||
if $data00 != 1 then
|
||||
print ==8== expect: 1, actually: $data00
|
||||
sql show tags from st_bool_7
|
||||
if $data05 != true then
|
||||
print ==8== expect: 1, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_8 using mt_bool tags (true)
|
||||
sql select tagname from st_bool_8
|
||||
if $data00 != 1 then
|
||||
print ==9== expect: 1, actually: $data00
|
||||
sql show tags from st_bool_8
|
||||
if $data05 != true then
|
||||
print ==9== expect: 1, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_9 using mt_bool tags ("false")
|
||||
sql select tagname from st_bool_9
|
||||
if $data00 != 0 then
|
||||
print ==10== expect: 0, actually: $data00
|
||||
sql show tags from st_bool_9
|
||||
if $data05 != false then
|
||||
print ==10== expect: 0, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_10 using mt_bool tags ('false')
|
||||
sql select tagname from st_bool_10
|
||||
if $data00 != 0 then
|
||||
print ==11== expect: 0, actually: $data00
|
||||
sql show tags from st_bool_10
|
||||
if $data05 != false then
|
||||
print ==11== expect: 0, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_11 using mt_bool tags (false)
|
||||
sql select tagname from st_bool_11
|
||||
if $data00 != 0 then
|
||||
print ==12== expect: 0, actually: $data00
|
||||
sql show tags from st_bool_11
|
||||
if $data05 != false then
|
||||
print ==12== expect: 0, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_12 using mt_bool tags (0)
|
||||
sql select tagname from st_bool_12
|
||||
if $data00 != 0 then
|
||||
print ==13== expect: 0, actually: $data00
|
||||
sql show tags from st_bool_12
|
||||
if $data05 != false then
|
||||
print ==13== expect: 0, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_13 using mt_bool tags (1)
|
||||
sql select tagname from st_bool_13
|
||||
if $data00 != 1 then
|
||||
print ==14== expect: 1, actually: $data00
|
||||
sql show tags from st_bool_13
|
||||
if $data05 != true then
|
||||
print ==14== expect: 1, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_14 using mt_bool tags (6.9)
|
||||
sql select tagname from st_bool_14
|
||||
if $data00 != 1 then
|
||||
print ==15== expect: 1, actually: $data00
|
||||
sql show tags from st_bool_14
|
||||
if $data05 != true then
|
||||
print ==15== expect: 1, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_15 using mt_bool tags (-3)
|
||||
sql select tagname from st_bool_15
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_15
|
||||
if $data05 != true then
|
||||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_15_0 using mt_bool tags (+300)
|
||||
sql select tagname from st_bool_15_0
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_15_0
|
||||
if $data05 != true then
|
||||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
sql create table st_bool_15_1 using mt_bool tags (-8.03)
|
||||
sql select tagname from st_bool_15_1
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_15_1
|
||||
if $data05 != true then
|
||||
print ==16== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -284,8 +291,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_bool_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_16
|
||||
if $data05 != NULL then
|
||||
print ==33== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -296,8 +303,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_bool_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_17
|
||||
if $data05 != NULL then
|
||||
print ==35== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -307,8 +314,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_bool_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_18
|
||||
if $data05 != NULL then
|
||||
print ==37== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -318,8 +325,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_bool_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_19
|
||||
if $data05 != NULL then
|
||||
print ==39== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -329,8 +336,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_bool_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_20
|
||||
if $data05 != NULL then
|
||||
print ==41== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -340,8 +347,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_bool_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_bool_21
|
||||
if $data05 != NULL then
|
||||
print ==43== expect: NULL, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -351,8 +358,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true")
|
||||
sql select tagname from st_bool_22
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_22
|
||||
if $data05 != true then
|
||||
print ==45== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -362,8 +369,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true')
|
||||
sql select tagname from st_bool_23
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_23
|
||||
if $data05 != true then
|
||||
print ==47== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -373,8 +380,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_24 using mt_bool tags (true) values (now, true)
|
||||
sql select tagname from st_bool_24
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_24
|
||||
if $data05 != true then
|
||||
print ==49== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -384,8 +391,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false")
|
||||
sql select tagname from st_bool_25
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_bool_25
|
||||
if $data05 != false then
|
||||
print ==51== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -395,8 +402,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false')
|
||||
sql select tagname from st_bool_26
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_bool_26
|
||||
if $data05 != false then
|
||||
print ==53== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -406,8 +413,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_27 using mt_bool tags (false) values (now, false)
|
||||
sql select tagname from st_bool_27
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_bool_27
|
||||
if $data05 != false then
|
||||
print ==55== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -417,8 +424,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_28 using mt_bool tags (0) values (now, 0)
|
||||
sql select tagname from st_bool_28
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_bool_28
|
||||
if $data05 != false then
|
||||
print ==57== expect: 0, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -428,8 +435,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_29 using mt_bool tags (1) values (now, 1)
|
||||
sql select tagname from st_bool_29
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_29
|
||||
if $data05 != true then
|
||||
print ==59== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -439,8 +446,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9)
|
||||
sql select tagname from st_bool_30
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_30
|
||||
if $data05 != true then
|
||||
print ==61== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -450,8 +457,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3)
|
||||
sql select tagname from st_bool_31
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_31
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -461,8 +468,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300)
|
||||
sql select tagname from st_bool_32
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_32
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -472,8 +479,8 @@ if $data01 != 1 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890)
|
||||
sql select tagname from st_bool_33
|
||||
if $data00 != 1 then
|
||||
sql show tags from st_bool_33
|
||||
if $data05 != true then
|
||||
print ==63== expect: 1, actually: $data00
|
||||
return -1
|
||||
endi
|
||||
|
@ -490,140 +497,140 @@ endi
|
|||
|
||||
## case 03: alter tag values
|
||||
#sql alter table st_bool_0 set tag tagname=true
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=NULL
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=false
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=NULL
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='true'
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='NULL'
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='false'
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname='NULL'
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="true"
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="NULL"
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="false"
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname="NULL"
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != NULL then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=1
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=0
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != false then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=6.9
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_bool_0 set tag tagname=-3
|
||||
#sql select tagname from st_bool_0
|
||||
#sql show tags from st_bool_0
|
||||
#if $data00 != true then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
# case 04: illegal input
|
||||
sql_error create table st_bool_e0 using mt_bool tags (123abc)
|
||||
sql_error create table st_bool_e1 using mt_bool tags ("123abc")
|
||||
sql_error create table st_bool_e2 using mt_bool tags ("123")
|
||||
sql create table st_bool_e1 using mt_bool tags ("123abc")
|
||||
sql create table st_bool_e2 using mt_bool tags ("123")
|
||||
sql_error create table st_bool_e3 using mt_bool tags (abc)
|
||||
sql_error create table st_bool_e4 using mt_bool tags ("abc")
|
||||
sql_error create table st_bool_e5 using mt_bool tags (" ")
|
||||
sql_error create table st_bool_e6 using mt_bool tags ('')
|
||||
sql create table st_bool_e4 using mt_bool tags ("abc")
|
||||
sql create table st_bool_e5 using mt_bool tags (" ")
|
||||
sql create table st_bool_e6 using mt_bool tags ('')
|
||||
|
||||
sql create table st_bool_e0 using mt_bool tags (true)
|
||||
sql create table st_bool_e1 using mt_bool tags (true)
|
||||
sql create table st_bool_e2 using mt_bool tags (true)
|
||||
sql create table st_bool_e3 using mt_bool tags (true)
|
||||
sql create table st_bool_e4 using mt_bool tags (true)
|
||||
sql create table st_bool_e5 using mt_bool tags (true)
|
||||
sql create table st_bool_e6 using mt_bool tags (true)
|
||||
sql create table st_bool_f0 using mt_bool tags (true)
|
||||
sql create table st_bool_f1 using mt_bool tags (true)
|
||||
sql create table st_bool_f2 using mt_bool tags (true)
|
||||
sql create table st_bool_f3 using mt_bool tags (true)
|
||||
sql create table st_bool_f4 using mt_bool tags (true)
|
||||
sql create table st_bool_f5 using mt_bool tags (true)
|
||||
sql create table st_bool_f6 using mt_bool tags (true)
|
||||
|
||||
sql_error insert into st_bool_e0 values (now, 123abc)
|
||||
sql_error insert into st_bool_e1 values (now, "123abc")
|
||||
sql_error insert into st_bool_e2 values (now, "123")
|
||||
sql_error insert into st_bool_e3 values (now, abc)
|
||||
sql_error insert into st_bool_e4 values (now, "abc")
|
||||
sql_error insert into st_bool_e5 values (now, " ")
|
||||
sql_error insert into st_bool_e6 values (now, '')
|
||||
sql_error insert into st_bool_g0 values (now, 123abc)
|
||||
sql_error insert into st_bool_g1 values (now, "123abc")
|
||||
sql_error insert into st_bool_g2 values (now, "123")
|
||||
sql_error insert into st_bool_g3 values (now, abc)
|
||||
sql_error insert into st_bool_g4 values (now, "abc")
|
||||
sql_error insert into st_bool_g5 values (now, " ")
|
||||
sql_error insert into st_bool_g6 values (now, '')
|
||||
|
||||
sql_error insert into st_bool_e10 using mt_bool tags (123abc) values (now, 1)
|
||||
sql_error insert into st_bool_e11 using mt_bool tags ("123abc") values (now, 1)
|
||||
sql_error insert into st_bool_e12 using mt_bool tags ("123") values (now, 1)
|
||||
sql_error insert into st_bool_e13 using mt_bool tags (abc) values (now, 1)
|
||||
sql_error insert into st_bool_e14 using mt_bool tags ("abc") values (now, 1)
|
||||
sql_error insert into st_bool_e15 using mt_bool tags (" ") values (now, 1)
|
||||
sql_error insert into st_bool_e16 using mt_bool tags ('') values (now, 1)
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (123abc) values (now, 1)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags ("123abc") values (now, 1)
|
||||
sql_error insert into st_bool_h2 using mt_bool tags ("123") values (now, 1)
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (abc) values (now, 1)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags ("abc") values (now, 1)
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (" ") values (now, 1)
|
||||
sql_error insert into st_bool_h6 using mt_bool tags ('') values (now, 1)
|
||||
|
||||
sql_error insert into st_bool_e17 using mt_bool tags (1) values (now, 123abc)
|
||||
sql_error insert into st_bool_e18 using mt_bool tags (1) values (now, "123abc")
|
||||
sql_error insert into st_bool_e19 using mt_bool tags (1) values (now, "123")
|
||||
sql_error insert into st_bool_e20 using mt_bool tags (1) values (now, abc)
|
||||
sql_error insert into st_bool_e21 using mt_bool tags (1) values (now, "abc")
|
||||
sql_error insert into st_bool_e22 using mt_bool tags (1) values (now, " ")
|
||||
sql_error insert into st_bool_e23 using mt_bool tags (1) values (now, '')
|
||||
sql_error insert into st_bool_h0 using mt_bool tags (1) values (now, 123abc)
|
||||
sql_error insert into st_bool_h1 using mt_bool tags (1) values (now, "123abc")
|
||||
sql_error insert into st_bool_h2 using mt_bool tags (1) values (now, "123")
|
||||
sql_error insert into st_bool_h3 using mt_bool tags (1) values (now, abc)
|
||||
sql_error insert into st_bool_h4 using mt_bool tags (1) values (now, "abc")
|
||||
sql_error insert into st_bool_h5 using mt_bool tags (1) values (now, " ")
|
||||
sql_error insert into st_bool_h6 using mt_bool tags (1) values (now, '')
|
||||
|
||||
sql insert into st_bool_e10 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e11 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e12 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e13 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e14 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e15 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_e16 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i0 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i1 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i2 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i3 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i4 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i5 using mt_bool tags (1) values (now, 1)
|
||||
sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1)
|
||||
|
||||
sql_error alter table st_bool_e10 set tag tagname=123abc
|
||||
sql_error alter table st_bool_e11 set tag tagname="123abc"
|
||||
sql_error alter table st_bool_e12 set tag tagname="123"
|
||||
sql_error alter table st_bool_e13 set tag tagname=abc
|
||||
sql_error alter table st_bool_e14 set tag tagname="abc"
|
||||
sql_error alter table st_bool_e15 set tag tagname=" "
|
||||
sql_error alter table st_bool_e16 set tag tagname=''
|
||||
sql_error alter table st_bool_i0 set tag tagname=123abc
|
||||
sql alter table st_bool_i1 set tag tagname="123abc"
|
||||
sql alter table st_bool_i2 set tag tagname="123"
|
||||
sql_error alter table st_bool_i3 set tag tagname=abc
|
||||
sql alter table st_bool_i4 set tag tagname="abc"
|
||||
sql alter table st_bool_i5 set tag tagname=" "
|
||||
sql alter table st_bool_i6 set tag tagname=''
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create database if not exists db
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -10,135 +17,135 @@ sql create table mt_double (ts timestamp, c double) tags (tagname double)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_double_0 using mt_double tags (NULL )
|
||||
sql select tagname from st_double_0
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_1 using mt_double tags (NULL)
|
||||
sql select tagname from st_double_1
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_2 using mt_double tags ('NULL')
|
||||
sql select tagname from st_double_2
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_2
|
||||
if $data05 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_3 using mt_double tags ('NULL')
|
||||
sql select tagname from st_double_3
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_3
|
||||
if $data05 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_4 using mt_double tags ("NULL")
|
||||
sql select tagname from st_double_4
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_4
|
||||
if $data05 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_5 using mt_double tags ("NULL")
|
||||
sql select tagname from st_double_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_5
|
||||
if $data05 != 0.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_6 using mt_double tags (-123.321)
|
||||
sql select tagname from st_double_6
|
||||
if $data00 != -123.321000000 then
|
||||
print expect -123.321000000, actual: $data00
|
||||
sql show tags from st_double_6
|
||||
if $data05 != -123.321000000 then
|
||||
print expect -123.321000000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_7 using mt_double tags (+1.567)
|
||||
sql select tagname from st_double_7
|
||||
if $data00 != 1.567000000 then
|
||||
sql show tags from st_double_7
|
||||
if $data05 != 1.567000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_8 using mt_double tags (379.001)
|
||||
sql select tagname from st_double_8
|
||||
if $data00 != 379.001000000 then
|
||||
sql show tags from st_double_8
|
||||
if $data05 != 379.001000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_9 using mt_double tags (1.5e+3)
|
||||
sql select tagname from st_double_9
|
||||
if $data00 != 1500.000000000 then
|
||||
sql show tags from st_double_9
|
||||
if $data05 != 1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_10 using mt_double tags (-1.5e-3)
|
||||
sql select tagname from st_double_10
|
||||
if $data00 != -0.001500000 then
|
||||
sql show tags from st_double_10
|
||||
if $data05 != -0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_11 using mt_double tags (+1.5e+3)
|
||||
sql select tagname from st_double_11
|
||||
if $data00 != 1500.000000000 then
|
||||
sql show tags from st_double_11
|
||||
if $data05 != 1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_12 using mt_double tags (-1.5e+3)
|
||||
sql select tagname from st_double_12
|
||||
if $data00 != -1500.000000000 then
|
||||
sql show tags from st_double_12
|
||||
if $data05 != -1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_13 using mt_double tags (1.5e-3)
|
||||
sql select tagname from st_double_13
|
||||
if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_13
|
||||
if $data05 != 0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_14 using mt_double tags (1.5E-3)
|
||||
sql select tagname from st_double_14
|
||||
if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_14
|
||||
if $data05 != 0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_double_6_0 using mt_double tags ('-123.321')
|
||||
sql select tagname from st_double_6_0
|
||||
if $data00 != -123.321000000 then
|
||||
sql show tags from st_double_6_0
|
||||
if $data05 != -123.321000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_7_0 using mt_double tags ('+1.567')
|
||||
sql select tagname from st_double_7_0
|
||||
if $data00 != 1.567000000 then
|
||||
sql show tags from st_double_7_0
|
||||
if $data05 != 1.567000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_8_0 using mt_double tags ('379.001')
|
||||
sql select tagname from st_double_8_0
|
||||
if $data00 != 379.001000000 then
|
||||
sql show tags from st_double_8_0
|
||||
if $data05 != 379.001000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_9_0 using mt_double tags ('1.5e+3')
|
||||
sql select tagname from st_double_9_0
|
||||
if $data00 != 1500.000000000 then
|
||||
sql show tags from st_double_9_0
|
||||
if $data05 != 1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_10_0 using mt_double tags ('-1.5e-3')
|
||||
sql select tagname from st_double_10_0
|
||||
if $data00 != -0.001500000 then
|
||||
sql show tags from st_double_10_0
|
||||
if $data05 != -0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_11_0 using mt_double tags ('+1.5e+3')
|
||||
sql select tagname from st_double_11_0
|
||||
if $data00 != 1500.000000000 then
|
||||
sql show tags from st_double_11_0
|
||||
if $data05 != 1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_12_0 using mt_double tags ('-1.5e+3')
|
||||
sql select tagname from st_double_12_0
|
||||
if $data00 != -1500.000000000 then
|
||||
sql show tags from st_double_12_0
|
||||
if $data05 != -1500.000000000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_13_0 using mt_double tags ('1.5e-3')
|
||||
sql select tagname from st_double_13_0
|
||||
if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_13_0
|
||||
if $data05 != 0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_14_0 using mt_double tags ('1.5E-3')
|
||||
sql select tagname from st_double_14_0
|
||||
if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_14_0
|
||||
if $data05 != 0.001500000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_double_15_0 using mt_double tags (1.7976931348623157e+308)
|
||||
sql select tagname from st_double_15_0
|
||||
#if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_15_0
|
||||
#if $data05 != 0.001500000 then
|
||||
# return -1
|
||||
#endi
|
||||
sql create table st_double_16_0 using mt_double tags (-1.7976931348623157e+308)
|
||||
sql select tagname from st_double_16_0
|
||||
#if $data00 != 0.001500000 then
|
||||
sql show tags from st_double_16_0
|
||||
#if $data05 != 0.001500000 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
|
@ -270,8 +277,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL )
|
||||
sql select tagname from st_double_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_16
|
||||
|
@ -280,8 +287,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_double_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_17
|
||||
|
@ -289,8 +296,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_double_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_18
|
||||
|
@ -298,8 +305,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_double_19 using mt_double tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_double_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_19
|
||||
|
@ -307,8 +314,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_double_20 using mt_double tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_double_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_20
|
||||
|
@ -316,8 +323,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_double_21 using mt_double tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_double_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_double_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_double_21
|
||||
|
@ -325,8 +332,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_double_22 using mt_double tags (127) values (now, 1.7976931348623157e+308)
|
||||
sql select tagname from st_double_22
|
||||
#if $data00 != 127 then
|
||||
sql show tags from st_double_22
|
||||
#if $data05 != 127 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_22
|
||||
|
@ -334,8 +341,8 @@ sql select * from st_double_22
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308)
|
||||
sql select tagname from st_double_23
|
||||
#if $data00 != -127 then
|
||||
sql show tags from st_double_23
|
||||
#if $data05 != -127 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_23
|
||||
|
@ -343,8 +350,8 @@ sql select * from st_double_23
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_24 using mt_double tags (10) values (now, 10)
|
||||
sql select tagname from st_double_24
|
||||
#if $data00 != 10 then
|
||||
sql show tags from st_double_24
|
||||
#if $data05 != 10 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_24
|
||||
|
@ -352,8 +359,8 @@ sql select * from st_double_24
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_double_25
|
||||
#if $data00 != 0 then
|
||||
sql show tags from st_double_25
|
||||
#if $data05 != 0 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_25
|
||||
|
@ -361,8 +368,8 @@ sql select * from st_double_25
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3')
|
||||
sql select tagname from st_double_26
|
||||
#if $data00 != 123 then
|
||||
sql show tags from st_double_26
|
||||
#if $data05 != 123 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_26
|
||||
|
@ -370,8 +377,8 @@ sql select * from st_double_26
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6)
|
||||
sql select tagname from st_double_27
|
||||
#if $data00 != 56 then
|
||||
sql show tags from st_double_27
|
||||
#if $data05 != 56 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_27
|
||||
|
@ -379,8 +386,8 @@ sql select * from st_double_27
|
|||
# return -1
|
||||
#endi
|
||||
sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6)
|
||||
sql select tagname from st_double_28
|
||||
#if $data00 != -56 then
|
||||
sql show tags from st_double_28
|
||||
#if $data05 != -56 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from st_double_28
|
||||
|
@ -390,43 +397,43 @@ sql select * from st_double_28
|
|||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_double_0 set tag tagname=1.7976931348623157e+308
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != 127 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != 127 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != -127 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != -127 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname=+10.340
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != 100 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != 100 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname=-33.87
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != -33 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != -33 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname='+9.8'
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != 98 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != 98 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname='-07.6'
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != -76 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != -76 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname=+0012.871
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != 12 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != 12 then
|
||||
## return -1
|
||||
##endi
|
||||
#sql alter table st_double_0 set tag tagname=-00063.582
|
||||
#sql select tagname from st_double_0
|
||||
##if $data00 != -63 then
|
||||
#sql show tags from st_double_0
|
||||
##if $data05 != -63 then
|
||||
## return -1
|
||||
##endi
|
||||
|
||||
|
@ -438,11 +445,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+
|
|||
#sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part
|
||||
#sql_error create table st_double_e0 using mt_double tags (-11.80)
|
||||
sql_error create table st_double_e0 using mt_double tags (123abc)
|
||||
sql_error create table st_double_e0 using mt_double tags ("123abc")
|
||||
sql create table st_double_e0_1 using mt_double tags ("123abc")
|
||||
sql_error create table st_double_e0 using mt_double tags (abc)
|
||||
sql_error create table st_double_e0 using mt_double tags ("abc")
|
||||
sql_error create table st_double_e0 using mt_double tags (" ")
|
||||
sql_error create table st_double_e0 using mt_double tags ('')
|
||||
sql create table st_double_e0_2 using mt_double tags ("abc")
|
||||
sql create table st_double_e0_3 using mt_double tags (" ")
|
||||
sql create table st_double_e0_4 using mt_double tags ('')
|
||||
|
||||
sql create table st_double_e0 using mt_double tags (123)
|
||||
sql create table st_double_e1 using mt_double tags (123)
|
||||
|
@ -469,7 +476,7 @@ sql_error insert into st_double_e7 values (now, "123abc")
|
|||
sql_error insert into st_double_e9 values (now, abc)
|
||||
sql_error insert into st_double_e10 values (now, "abc")
|
||||
sql_error insert into st_double_e11 values (now, " ")
|
||||
sql_error insert into st_double_e12 values (now, '')
|
||||
sql insert into st_double_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_double_e13 using mt_double tags (033) values (now, 11.7976931348623157e+308)
|
||||
sql_error insert into st_double_e14 using mt_double tags (033) values (now, -11.7976931348623157e+308)
|
||||
|
@ -482,7 +489,7 @@ sql_error insert into st_double_e20 using mt_double tags (033) values (now, "123
|
|||
sql_error insert into st_double_e22 using mt_double tags (033) values (now, abc)
|
||||
sql_error insert into st_double_e23 using mt_double tags (033) values (now, "abc")
|
||||
sql_error insert into st_double_e24 using mt_double tags (033) values (now, " ")
|
||||
sql_error insert into st_double_e25 using mt_double tags (033) values (now, '')
|
||||
sql insert into st_double_e25_1 using mt_double tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_double_e13 using mt_double tags (31.7976931348623157e+308) values (now, -033)
|
||||
sql_error insert into st_double_e14 using mt_double tags (-31.7976931348623157e+308) values (now, -033)
|
||||
|
@ -495,7 +502,7 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now,
|
|||
sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033)
|
||||
sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033)
|
||||
sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033)
|
||||
sql_error insert into st_double_e25 using mt_double tags ('') values (now, -033)
|
||||
sql insert into st_double_e25 using mt_double tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_double_e13 using mt_double tags (033) values (now, 00062)
|
||||
sql insert into st_double_e14 using mt_double tags (033) values (now, 00062)
|
||||
|
@ -516,8 +523,8 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308
|
|||
sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308
|
||||
sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308
|
||||
sql_error alter table st_double_e19 set tag tagname=123abc
|
||||
sql_error alter table st_double_e20 set tag tagname="123abc"
|
||||
sql alter table st_double_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_double_e22 set tag tagname=abc
|
||||
sql_error alter table st_double_e23 set tag tagname="abc"
|
||||
sql_error alter table st_double_e24 set tag tagname=" "
|
||||
sql_error alter table st_double_e25 set tag tagname=''
|
||||
sql alter table st_double_e23 set tag tagname="abc"
|
||||
sql alter table st_double_e24 set tag tagname=" "
|
||||
sql alter table st_double_e25 set tag tagname=''
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create database if not exists db
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -10,152 +17,152 @@ sql create table mt_float (ts timestamp, c float) tags (tagname float)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_float_0 using mt_float tags (NULL)
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_1 using mt_float tags (NULL)
|
||||
sql select tagname from st_float_1
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_2 using mt_float tags ('NULL')
|
||||
sql select tagname from st_float_2
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_2
|
||||
if $data05 != 0.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_3 using mt_float tags ('NULL')
|
||||
sql select tagname from st_float_3
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_3
|
||||
if $data05 != 0.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_4 using mt_float tags ("NULL")
|
||||
sql select tagname from st_float_4
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_4
|
||||
if $data05 != 0.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_5 using mt_float tags ("NULL")
|
||||
sql select tagname from st_float_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_5
|
||||
if $data05 != 0.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_6 using mt_float tags (-123.321)
|
||||
sql select tagname from st_float_6
|
||||
if $data00 != -123.32100 then
|
||||
print expect -123.32100, actual: $data00
|
||||
sql show tags from st_float_6
|
||||
if $data05 != -123.32100 then
|
||||
print expect -123.32100, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_7 using mt_float tags (+1.567)
|
||||
sql select tagname from st_float_7
|
||||
if $data00 != 1.56700 then
|
||||
print expect 1.56700, actual: $data00
|
||||
sql show tags from st_float_7
|
||||
if $data05 != 1.56700 then
|
||||
print expect 1.56700, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_8 using mt_float tags (379.001)
|
||||
sql select tagname from st_float_8
|
||||
if $data00 != 379.00101 then
|
||||
print expect 379.00101, actual: $data00
|
||||
sql show tags from st_float_8
|
||||
if $data05 != 379.00101 then
|
||||
print expect 379.00101, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_9 using mt_float tags (1.5e+3)
|
||||
sql select tagname from st_float_9
|
||||
if $data00 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data00
|
||||
sql show tags from st_float_9
|
||||
if $data05 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_10 using mt_float tags (-1.5e-3)
|
||||
sql select tagname from st_float_10
|
||||
if $data00 != -0.00150 then
|
||||
print expect -0.00150, actual: $data00
|
||||
sql show tags from st_float_10
|
||||
if $data05 != -0.00150 then
|
||||
print expect -0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_11 using mt_float tags (+1.5e+3)
|
||||
sql select tagname from st_float_11
|
||||
if $data00 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data00
|
||||
sql show tags from st_float_11
|
||||
if $data05 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_12 using mt_float tags (-1.5e+3)
|
||||
sql select tagname from st_float_12
|
||||
if $data00 != -1500.00000 then
|
||||
print expect -1500.00000, actual: $data00
|
||||
sql show tags from st_float_12
|
||||
if $data05 != -1500.00000 then
|
||||
print expect -1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_13 using mt_float tags (1.5e-3)
|
||||
sql select tagname from st_float_13
|
||||
if $data00 != 0.00150 then
|
||||
print expect 0.00150, actual: $data00
|
||||
sql show tags from st_float_13
|
||||
if $data05 != 0.00150 then
|
||||
print expect 0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_14 using mt_float tags (1.5E-3)
|
||||
sql select tagname from st_float_14
|
||||
if $data00 != 0.00150 then
|
||||
print expect 0.00150, actual: $data00
|
||||
sql show tags from st_float_14
|
||||
if $data05 != 0.00150 then
|
||||
print expect 0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create table st_float_6_0 using mt_float tags ('-123.321')
|
||||
sql select tagname from st_float_6_0
|
||||
if $data00 != -123.32100 then
|
||||
print expect -123.32100, actual: $data00
|
||||
sql show tags from st_float_6_0
|
||||
if $data05 != -123.32100 then
|
||||
print expect -123.32100, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_7_0 using mt_float tags ('+1.567')
|
||||
sql select tagname from st_float_7_0
|
||||
if $data00 != 1.56700 then
|
||||
print expect 1.56700, actual: $data00
|
||||
sql show tags from st_float_7_0
|
||||
if $data05 != 1.56700 then
|
||||
print expect 1.56700, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_8_0 using mt_float tags ('379.001')
|
||||
sql select tagname from st_float_8_0
|
||||
if $data00 != 379.00101 then
|
||||
print expect 379.00101, actual: $data00
|
||||
sql show tags from st_float_8_0
|
||||
if $data05 != 379.00101 then
|
||||
print expect 379.00101, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_9_0 using mt_float tags ('1.5e+3')
|
||||
sql select tagname from st_float_9_0
|
||||
if $data00 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data00
|
||||
sql show tags from st_float_9_0
|
||||
if $data05 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_10_0 using mt_float tags ('-1.5e-3')
|
||||
sql select tagname from st_float_10_0
|
||||
if $data00 != -0.00150 then
|
||||
print expect -0.00150, actual: $data00
|
||||
sql show tags from st_float_10_0
|
||||
if $data05 != -0.00150 then
|
||||
print expect -0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_11_0 using mt_float tags ('+1.5e+3')
|
||||
sql select tagname from st_float_11_0
|
||||
if $data00 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data00
|
||||
sql show tags from st_float_11_0
|
||||
if $data05 != 1500.00000 then
|
||||
print expect 1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_12_0 using mt_float tags ('-1.5e+3')
|
||||
sql select tagname from st_float_12_0
|
||||
if $data00 != -1500.00000 then
|
||||
print expect -1500.00000, actual: $data00
|
||||
sql show tags from st_float_12_0
|
||||
if $data05 != -1500.00000 then
|
||||
print expect -1500.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_13_0 using mt_float tags ('1.5e-3')
|
||||
sql select tagname from st_float_13_0
|
||||
if $data00 != 0.00150 then
|
||||
print expect 0.00150, actual: $data00
|
||||
sql show tags from st_float_13_0
|
||||
if $data05 != 0.00150 then
|
||||
print expect 0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_float_14_0 using mt_float tags ('1.5E-3')
|
||||
sql select tagname from st_float_14_0
|
||||
if $data00 != 0.00150 then
|
||||
print expect 0.00150, actual: $data00
|
||||
sql show tags from st_float_14_0
|
||||
if $data05 != 0.00150 then
|
||||
print expect 0.00150, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
#sql create table st_float_15_0 using mt_float tags (3.40282347e+38)
|
||||
#sql select tagname from st_float_15_0
|
||||
#if $data00 != 0.001500 then
|
||||
#sql show tags from st_float_15_0
|
||||
#if $data05 != 0.001500 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql create table st_float_16_0 using mt_float tags (-3.40282347e+38)
|
||||
#sql select tagname from st_float_16_0
|
||||
#if $data00 != 0.001500 then
|
||||
#sql show tags from st_float_16_0
|
||||
#if $data05 != 0.001500 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
|
@ -292,8 +299,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_float_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_16
|
||||
|
@ -302,8 +309,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_float_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_17
|
||||
|
@ -311,8 +318,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_float_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_18
|
||||
|
@ -320,8 +327,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_19 using mt_float tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_float_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_19
|
||||
|
@ -329,8 +336,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_20 using mt_float tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_float_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_20
|
||||
|
@ -338,8 +345,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_21 using mt_float tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_float_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_float_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_21
|
||||
|
@ -350,9 +357,9 @@ endi
|
|||
sql_error insert into st_float_22 using mt_float tags (127) values (now, 3.40282347e+38)
|
||||
|
||||
sql insert into st_float_22 using mt_float tags (127) values (now, 340282346638528859811704183484516925440.00000)
|
||||
sql select tagname from st_float_22
|
||||
if $data00 != 127.00000 then
|
||||
print expect 127.00000, actual: $data00
|
||||
sql show tags from st_float_22
|
||||
if $data05 != 127.00000 then
|
||||
print expect 127.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -362,14 +369,14 @@ if $data01 != 127.00000 then
|
|||
endi
|
||||
|
||||
sql insert into st_float_23 using mt_float tags (-127) values (now, -340282346638528859811704183484516925440.00000)
|
||||
sql select tagname from st_float_23
|
||||
if $data00 != -127.00000 then
|
||||
sql show tags from st_float_23
|
||||
if $data05 != -127.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql insert into st_float_24 using mt_float tags (10) values (now, 10)
|
||||
sql select tagname from st_float_24
|
||||
if $data00 != 10.00000 then
|
||||
sql show tags from st_float_24
|
||||
if $data05 != 10.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_24
|
||||
|
@ -378,9 +385,9 @@ if $data01 != 10.00000 then
|
|||
endi
|
||||
|
||||
sql insert into st_float_25 using mt_float tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_float_25
|
||||
if $data00 != -0.00000 then
|
||||
print expect -0.00000, actual: $data00
|
||||
sql show tags from st_float_25
|
||||
if $data05 != -0.00000 then
|
||||
print expect -0.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_25
|
||||
|
@ -388,9 +395,9 @@ if $data01 != -0.00000 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_26 using mt_float tags ('123') values (now, '12.3')
|
||||
sql select tagname from st_float_26
|
||||
if $data00 != 123.00000 then
|
||||
print expect 123.00000, actual: $data00
|
||||
sql show tags from st_float_26
|
||||
if $data05 != 123.00000 then
|
||||
print expect 123.00000, actual: $data05
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_26
|
||||
|
@ -398,9 +405,9 @@ if $data01 != 12.30000 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_27 using mt_float tags (+056) values (now, +0005.6)
|
||||
sql select tagname from st_float_27
|
||||
if $data00 != 56.00000 then
|
||||
print expect 56.00000, actual:$data00
|
||||
sql show tags from st_float_27
|
||||
if $data05 != 56.00000 then
|
||||
print expect 56.00000, actual:$data05
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_27
|
||||
|
@ -408,8 +415,8 @@ if $data01 != 5.60000 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_float_28 using mt_float tags (-056) values (now, -005.6)
|
||||
sql select tagname from st_float_28
|
||||
if $data00 != -56.00000 then
|
||||
sql show tags from st_float_28
|
||||
if $data05 != -56.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_float_28
|
||||
|
@ -419,44 +426,44 @@ endi
|
|||
|
||||
### case 03: alter tag values
|
||||
sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != 340282346638528859811704183484516925440.00000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != 340282346638528859811704183484516925440.00000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql alter table st_float_0 set tag tagname=-340282346638528859811704183484516925440.00000
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != -340282346638528859811704183484516925440.00000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != -340282346638528859811704183484516925440.00000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname=+10.340
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != 10.34000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != 10.34000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname=-33.87
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != -33.87000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != -33.87000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname='+9.8'
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != 9.80000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != 9.80000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname='-07.6'
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != -7.60000 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != -7.60000 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname=+0012.871
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != 12.87100 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != 12.87100 then
|
||||
return -1
|
||||
endi
|
||||
sql alter table st_float_0 set tag tagname=-00063.582
|
||||
sql select tagname from st_float_0
|
||||
if $data00 != -63.58200 then
|
||||
sql show tags from st_float_0
|
||||
if $data05 != -63.58200 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -468,11 +475,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38)
|
|||
#sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part
|
||||
#sql_error create table st_float_e0 using mt_float tags (-11.80)
|
||||
sql_error create table st_float_e0 using mt_float tags (123abc)
|
||||
sql_error create table st_float_e0 using mt_float tags ("123abc")
|
||||
sql create table st_float_e0_1 using mt_float tags ("123abc")
|
||||
sql_error create table st_float_e0 using mt_float tags (abc)
|
||||
sql_error create table st_float_e0 using mt_float tags ("abc")
|
||||
sql_error create table st_float_e0 using mt_float tags (" ")
|
||||
sql_error create table st_float_e0 using mt_float tags ('')
|
||||
sql create table st_float_e0_2 using mt_float tags ("abc")
|
||||
sql create table st_float_e0_3 using mt_float tags (" ")
|
||||
sql create table st_float_e0_4 using mt_float tags ('')
|
||||
|
||||
sql create table st_float_e0 using mt_float tags (123)
|
||||
sql create table st_float_e1 using mt_float tags (123)
|
||||
|
@ -499,7 +506,7 @@ sql_error insert into st_float_e7 values (now, "123abc")
|
|||
sql_error insert into st_float_e9 values (now, abc)
|
||||
sql_error insert into st_float_e10 values (now, "abc")
|
||||
sql_error insert into st_float_e11 values (now, " ")
|
||||
sql_error insert into st_float_e12 values (now, '')
|
||||
sql insert into st_float_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_float_e13 using mt_float tags (033) values (now, 3.50282347e+38)
|
||||
sql_error insert into st_float_e14 using mt_float tags (033) values (now, -3.50282347e+38)
|
||||
|
@ -512,7 +519,7 @@ sql_error insert into st_float_e20 using mt_float tags (033) values (now, "123ab
|
|||
sql_error insert into st_float_e22 using mt_float tags (033) values (now, abc)
|
||||
sql_error insert into st_float_e23 using mt_float tags (033) values (now, "abc")
|
||||
sql_error insert into st_float_e24 using mt_float tags (033) values (now, " ")
|
||||
sql_error insert into st_float_e25 using mt_float tags (033) values (now, '')
|
||||
sql insert into st_float_e25_1 using mt_float tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_float_e13 using mt_float tags (3.50282347e+38) values (now, -033)
|
||||
sql_error insert into st_float_e14 using mt_float tags (-3.50282347e+38) values (now, -033)
|
||||
|
@ -525,7 +532,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, -
|
|||
sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033)
|
||||
sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033)
|
||||
sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033)
|
||||
sql_error insert into st_float_e25 using mt_float tags ('') values (now, -033)
|
||||
sql insert into st_float_e25_3 using mt_float tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_float_e13 using mt_float tags (033) values (now, 00062)
|
||||
sql insert into st_float_e14 using mt_float tags (033) values (now, 00062)
|
||||
|
@ -546,8 +553,8 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38
|
|||
sql_error alter table st_float_e15 set tag tagname=13.40282347e+38
|
||||
sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38
|
||||
sql_error alter table st_float_e19 set tag tagname=123abc
|
||||
sql_error alter table st_float_e20 set tag tagname="123abc"
|
||||
sql alter table st_float_e20 set tag tagname="123abc"
|
||||
sql_error alter table st_float_e22 set tag tagname=abc
|
||||
sql_error alter table st_float_e23 set tag tagname="abc"
|
||||
sql_error alter table st_float_e24 set tag tagname=" "
|
||||
sql_error alter table st_float_e25 set tag tagname=''
|
||||
sql alter table st_float_e23 set tag tagname="abc"
|
||||
sql alter table st_float_e24 set tag tagname=" "
|
||||
sql alter table st_float_e25 set tag tagname=''
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create database if not exists db
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -10,78 +17,64 @@ sql create table mt_int (ts timestamp, c int) tags (tagname int)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_int_0 using mt_int tags (NULL)
|
||||
sql select tagname from st_int_0
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_1 using mt_int tags (NULL)
|
||||
sql select tagname from st_int_1
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_2 using mt_int tags ('NULL')
|
||||
sql select tagname from st_int_2
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_3 using mt_int tags ('NULL')
|
||||
sql select tagname from st_int_3
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_4 using mt_int tags ("NULL")
|
||||
sql select tagname from st_int_4
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_5 using mt_int tags ("NULL")
|
||||
sql select tagname from st_int_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_int_2 using mt_int tags ('NULL')
|
||||
sql_error create table st_int_3 using mt_int tags ('NULL')
|
||||
sql_error create table st_int_4 using mt_int tags ("NULL")
|
||||
sql_error create table st_int_5 using mt_int tags ("NULL")
|
||||
|
||||
sql create table st_int_6 using mt_int tags (-2147483647)
|
||||
sql select tagname from st_int_6
|
||||
if $data00 != -2147483647 then
|
||||
sql show tags from st_int_6
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_7 using mt_int tags (2147483647)
|
||||
sql select tagname from st_int_7
|
||||
if $data00 != 2147483647 then
|
||||
sql show tags from st_int_7
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_8 using mt_int tags (37)
|
||||
sql select tagname from st_int_8
|
||||
if $data00 != 37 then
|
||||
sql show tags from st_int_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_9 using mt_int tags (-100)
|
||||
sql select tagname from st_int_9
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_int_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_10 using mt_int tags (+113)
|
||||
sql select tagname from st_int_10
|
||||
if $data00 != 113 then
|
||||
sql show tags from st_int_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_11 using mt_int tags ('-100')
|
||||
sql select tagname from st_int_11
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_int_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_12 using mt_int tags ("+78")
|
||||
sql select tagname from st_int_12
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_int_12
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_13 using mt_int tags (+0078)
|
||||
sql select tagname from st_int_13
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_int_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_int_14 using mt_int tags (-00078)
|
||||
sql select tagname from st_int_14
|
||||
if $data00 != -78 then
|
||||
sql show tags from st_int_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -102,38 +95,6 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_2 values (now, 'NULL')
|
||||
sql select * from st_int_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_3 values (now, 'NULL')
|
||||
sql select * from st_int_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_4 values (now, "NULL")
|
||||
sql select * from st_int_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_5 values (now, "NULL")
|
||||
sql select * from st_int_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_int_6 values (now, 2147483647)
|
||||
sql select * from st_int_6
|
||||
if $rows != 1 then
|
||||
|
@ -211,8 +172,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_int_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_16
|
||||
|
@ -221,8 +182,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_int_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_17
|
||||
|
@ -230,8 +191,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_int_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_18
|
||||
|
@ -239,8 +200,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_int_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_19
|
||||
|
@ -248,8 +209,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_int_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_20
|
||||
|
@ -257,8 +218,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_int_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_int_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_21
|
||||
|
@ -266,8 +227,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_22 using mt_int tags (2147483647) values (now, 2147483647)
|
||||
sql select tagname from st_int_22
|
||||
if $data00 != 2147483647 then
|
||||
sql show tags from st_int_22
|
||||
if $data05 != 2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_22
|
||||
|
@ -275,8 +236,8 @@ if $data01 != 2147483647 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647)
|
||||
sql select tagname from st_int_23
|
||||
if $data00 != -2147483647 then
|
||||
sql show tags from st_int_23
|
||||
if $data05 != -2147483647 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_23
|
||||
|
@ -284,8 +245,8 @@ if $data01 != -2147483647 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_24 using mt_int tags (10) values (now, 10)
|
||||
sql select tagname from st_int_24
|
||||
if $data00 != 10 then
|
||||
sql show tags from st_int_24
|
||||
if $data05 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_24
|
||||
|
@ -293,8 +254,8 @@ if $data01 != 10 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_int_25
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_int_25
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_25
|
||||
|
@ -302,8 +263,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_26 using mt_int tags ('123') values (now, '123')
|
||||
sql select tagname from st_int_26
|
||||
if $data00 != 123 then
|
||||
sql show tags from st_int_26
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_26
|
||||
|
@ -311,8 +272,8 @@ if $data01 != 123 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_27 using mt_int tags (+056) values (now, +00056)
|
||||
sql select tagname from st_int_27
|
||||
if $data00 != 56 then
|
||||
sql show tags from st_int_27
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_27
|
||||
|
@ -320,8 +281,8 @@ if $data01 != 56 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_int_28 using mt_int tags (-056) values (now, -0056)
|
||||
sql select tagname from st_int_28
|
||||
if $data00 != -56 then
|
||||
sql show tags from st_int_28
|
||||
if $data05 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_int_28
|
||||
|
@ -331,49 +292,49 @@ endi
|
|||
|
||||
### case 03: alter tag values
|
||||
#sql alter table st_int_0 set tag tagname=2147483647
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != 2147483647 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-2147483647
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != -2147483647 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -2147483647 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+100
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != 100 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-33
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != -33 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='+98'
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != 98 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname='-076'
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != -76 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=+0012
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != 12 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_int_0 set tag tagname=-00063
|
||||
#sql select tagname from st_int_0
|
||||
#if $data00 != -63 then
|
||||
#sql show tags from st_int_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_int_e0 using mt_int tags (2147483648)
|
||||
sql_error create table st_int_e0 using mt_int tags (-2147483648)
|
||||
sql create table st_int_e0_err1 using mt_int tags (-2147483648)
|
||||
sql_error create table st_int_e0 using mt_int tags (214748364800)
|
||||
sql_error create table st_int_e0 using mt_int tags (-214748364800)
|
||||
#sql_error create table st_int_e0 using mt_int tags (12.80) truncate integer part
|
||||
|
@ -383,7 +344,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc")
|
|||
sql_error create table st_int_e0 using mt_int tags (abc)
|
||||
sql_error create table st_int_e0 using mt_int tags ("abc")
|
||||
sql_error create table st_int_e0 using mt_int tags (" ")
|
||||
sql_error create table st_int_e0 using mt_int tags ('')
|
||||
sql create table st_int_e0_err2 using mt_int tags ('')
|
||||
|
||||
sql create table st_int_e0 using mt_int tags (123)
|
||||
sql create table st_int_e1 using mt_int tags (123)
|
||||
|
@ -400,7 +361,7 @@ sql create table st_int_e11 using mt_int tags (123)
|
|||
sql create table st_int_e12 using mt_int tags (123)
|
||||
|
||||
sql_error insert into st_int_e0 values (now, 2147483648)
|
||||
sql_error insert into st_int_e1 values (now, -2147483648)
|
||||
sql insert into st_int_e1 values (now, -2147483648)
|
||||
sql_error insert into st_int_e2 values (now, 3147483648)
|
||||
sql_error insert into st_int_e3 values (now, -21474836481)
|
||||
#sql_error insert into st_int_e4 values (now, 12.80)
|
||||
|
@ -410,10 +371,10 @@ sql_error insert into st_int_e7 values (now, "123abc")
|
|||
sql_error insert into st_int_e9 values (now, abc)
|
||||
sql_error insert into st_int_e10 values (now, "abc")
|
||||
sql_error insert into st_int_e11 values (now, " ")
|
||||
sql_error insert into st_int_e12 values (now, '')
|
||||
sql insert into st_int_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_int_e13 using mt_int tags (033) values (now, 2147483648)
|
||||
sql_error insert into st_int_e14 using mt_int tags (033) values (now, -2147483648)
|
||||
sql insert into st_int_e14 using mt_int tags (033) values (now, -2147483648)
|
||||
sql_error insert into st_int_e15 using mt_int tags (033) values (now, 5147483648)
|
||||
sql_error insert into st_int_e16 using mt_int tags (033) values (now, -21474836481)
|
||||
#sql_error insert into st_int_e17 using mt_int tags (033) values (now, 12.80)
|
||||
|
@ -423,10 +384,10 @@ sql_error insert into st_int_e20 using mt_int tags (033) values (now, "123abc")
|
|||
sql_error insert into st_int_e22 using mt_int tags (033) values (now, abc)
|
||||
sql_error insert into st_int_e23 using mt_int tags (033) values (now, "abc")
|
||||
sql_error insert into st_int_e24 using mt_int tags (033) values (now, " ")
|
||||
sql_error insert into st_int_e25 using mt_int tags (033) values (now, '')
|
||||
sql insert into st_int_e25 using mt_int tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_int_e13 using mt_int tags (2147483648) values (now, -033)
|
||||
sql_error insert into st_int_e14 using mt_int tags (-2147483648) values (now, -033)
|
||||
sql insert into st_int_e14_1 using mt_int tags (-2147483648) values (now, -033)
|
||||
sql_error insert into st_int_e15 using mt_int tags (21474836480) values (now, -033)
|
||||
sql_error insert into st_int_e16 using mt_int tags (-2147483649) values (now, -033)
|
||||
#sql_error insert into st_int_e17 using mt_int tags (12.80) values (now, -033)
|
||||
|
@ -436,7 +397,7 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033)
|
|||
sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033)
|
||||
sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033)
|
||||
sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033)
|
||||
sql_error insert into st_int_e25 using mt_int tags ('') values (now, -033)
|
||||
sql insert into st_int_e25_1 using mt_int tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_int_e13 using mt_int tags (033) values (now, 00062)
|
||||
sql insert into st_int_e14 using mt_int tags (033) values (now, 00062)
|
||||
|
@ -453,7 +414,7 @@ sql insert into st_int_e24 using mt_int tags (033) values (now, 00062)
|
|||
sql insert into st_int_e25 using mt_int tags (033) values (now, 00062)
|
||||
|
||||
sql_error alter table st_int_e13 set tag tagname=2147483648
|
||||
sql_error alter table st_int_e14 set tag tagname=-2147483648
|
||||
sql alter table st_int_e14 set tag tagname=-2147483648
|
||||
sql_error alter table st_int_e15 set tag tagname=12147483648
|
||||
sql_error alter table st_int_e16 set tag tagname=-3147483648
|
||||
sql_error alter table st_int_e19 set tag tagname=123abc
|
||||
|
@ -461,4 +422,4 @@ sql_error alter table st_int_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_int_e22 set tag tagname=abc
|
||||
sql_error alter table st_int_e23 set tag tagname="abc"
|
||||
sql_error alter table st_int_e24 set tag tagname=" "
|
||||
sql_error alter table st_int_e25 set tag tagname=''
|
||||
sql alter table st_int_e25 set tag tagname=''
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
sql create database if not exists db
|
||||
sql use db
|
||||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
||||
######## case 0: smallint
|
||||
|
@ -9,78 +20,64 @@ sql create table mt_smallint (ts timestamp, c smallint) tags (tagname smallint)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_smallint_0 using mt_smallint tags (NULL)
|
||||
sql select tagname from st_smallint_0
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_0
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_1 using mt_smallint tags (NULL)
|
||||
sql select tagname from st_smallint_1
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_2 using mt_smallint tags ('NULL')
|
||||
sql select tagname from st_smallint_2
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_3 using mt_smallint tags ('NULL')
|
||||
sql select tagname from st_smallint_3
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_4 using mt_smallint tags ("NULL")
|
||||
sql select tagname from st_smallint_4
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_5 using mt_smallint tags ("NULL")
|
||||
sql select tagname from st_smallint_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_smallint_2 using mt_smallint tags ('NULL')
|
||||
sql_error create table st_smallint_3 using mt_smallint tags ('NULL')
|
||||
sql_error create table st_smallint_4 using mt_smallint tags ("NULL")
|
||||
sql_error create table st_smallint_5 using mt_smallint tags ("NULL")
|
||||
|
||||
sql create table st_smallint_6 using mt_smallint tags (-32767)
|
||||
sql select tagname from st_smallint_6
|
||||
if $data00 != -32767 then
|
||||
sql show tags from st_smallint_6
|
||||
if $data05 != -32767 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_7 using mt_smallint tags (32767)
|
||||
sql select tagname from st_smallint_7
|
||||
if $data00 != 32767 then
|
||||
sql show tags from st_smallint_7
|
||||
if $data05 != 32767 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_8 using mt_smallint tags (37)
|
||||
sql select tagname from st_smallint_8
|
||||
if $data00 != 37 then
|
||||
sql show tags from st_smallint_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_9 using mt_smallint tags (-100)
|
||||
sql select tagname from st_smallint_9
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_smallint_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_10 using mt_smallint tags (+113)
|
||||
sql select tagname from st_smallint_10
|
||||
if $data00 != 113 then
|
||||
sql show tags from st_smallint_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_11 using mt_smallint tags ('-100')
|
||||
sql select tagname from st_smallint_11
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_smallint_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_12 using mt_smallint tags ("+78")
|
||||
sql select tagname from st_smallint_12
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_smallint_12
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_13 using mt_smallint tags (+0078)
|
||||
sql select tagname from st_smallint_13
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_smallint_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_smallint_14 using mt_smallint tags (-00078)
|
||||
sql select tagname from st_smallint_14
|
||||
if $data00 != -78 then
|
||||
sql show tags from st_smallint_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -101,38 +98,6 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_2 values (now, 'NULL')
|
||||
sql select * from st_smallint_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_3 values (now, 'NULL')
|
||||
sql select * from st_smallint_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_4 values (now, "NULL")
|
||||
sql select * from st_smallint_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_5 values (now, "NULL")
|
||||
sql select * from st_smallint_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_6 values (now, 32767)
|
||||
sql select * from st_smallint_6
|
||||
if $rows != 1 then
|
||||
|
@ -210,8 +175,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_smallint_16 using mt_smallint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_smallint_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_16
|
||||
|
@ -220,8 +185,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_smallint_17 using mt_smallint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_smallint_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_17
|
||||
|
@ -229,8 +194,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_18 using mt_smallint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_smallint_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_18
|
||||
|
@ -238,8 +203,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_19 using mt_smallint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_smallint_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_19
|
||||
|
@ -247,8 +212,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_20 using mt_smallint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_smallint_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_20
|
||||
|
@ -256,8 +221,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_21 using mt_smallint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_smallint_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_smallint_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_21
|
||||
|
@ -265,8 +230,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_22 using mt_smallint tags (32767) values (now, 32767)
|
||||
sql select tagname from st_smallint_22
|
||||
if $data00 != 32767 then
|
||||
sql show tags from st_smallint_22
|
||||
if $data05 != 32767 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_22
|
||||
|
@ -274,8 +239,8 @@ if $data01 != 32767 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_23 using mt_smallint tags (-32767) values (now, -32767)
|
||||
sql select tagname from st_smallint_23
|
||||
if $data00 != -32767 then
|
||||
sql show tags from st_smallint_23
|
||||
if $data05 != -32767 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_23
|
||||
|
@ -283,8 +248,8 @@ if $data01 != -32767 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_24 using mt_smallint tags (10) values (now, 10)
|
||||
sql select tagname from st_smallint_24
|
||||
if $data00 != 10 then
|
||||
sql show tags from st_smallint_24
|
||||
if $data05 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_24
|
||||
|
@ -292,8 +257,8 @@ if $data01 != 10 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_25 using mt_smallint tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_smallint_25
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_smallint_25
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_25
|
||||
|
@ -301,8 +266,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_26 using mt_smallint tags ('123') values (now, '123')
|
||||
sql select tagname from st_smallint_26
|
||||
if $data00 != 123 then
|
||||
sql show tags from st_smallint_26
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_26
|
||||
|
@ -310,8 +275,8 @@ if $data01 != 123 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_27 using mt_smallint tags (+056) values (now, +00056)
|
||||
sql select tagname from st_smallint_27
|
||||
if $data00 != 56 then
|
||||
sql show tags from st_smallint_27
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_27
|
||||
|
@ -319,8 +284,8 @@ if $data01 != 56 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_smallint_28 using mt_smallint tags (-056) values (now, -0056)
|
||||
sql select tagname from st_smallint_28
|
||||
if $data00 != -56 then
|
||||
sql show tags from st_smallint_28
|
||||
if $data05 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_smallint_28
|
||||
|
@ -330,49 +295,49 @@ endi
|
|||
|
||||
## case 03: alter tag values
|
||||
#sql alter table st_smallint_0 set tag tagname=32767
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != 32767 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != 32767 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname=-32767
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != -32767 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != -32767 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname=+100
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != 100 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname=-33
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != -33 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname='+98'
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != 98 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname='-076'
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != -76 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname=+0012
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != 12 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_smallint_0 set tag tagname=-00063
|
||||
#sql select tagname from st_smallint_0
|
||||
#if $data00 != -63 then
|
||||
#sql show tags from st_smallint_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (32768)
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (-32768)
|
||||
sql create table st_smallint_e0_0 using mt_smallint tags (-32768)
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (3276899)
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (-3276833)
|
||||
#sql_error create table st_smallint_e0 using mt_smallint tags (12.80) truncate integer part
|
||||
|
@ -382,7 +347,7 @@ sql_error create table st_smallint_e0 using mt_smallint tags ("123abc")
|
|||
sql_error create table st_smallint_e0 using mt_smallint tags (abc)
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags ("abc")
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags (" ")
|
||||
sql_error create table st_smallint_e0 using mt_smallint tags ('')
|
||||
sql create table st_smallint_e0_1 using mt_smallint tags ('')
|
||||
|
||||
sql create table st_smallint_e0 using mt_smallint tags (123)
|
||||
sql create table st_smallint_e1 using mt_smallint tags (123)
|
||||
|
@ -399,7 +364,7 @@ sql create table st_smallint_e11 using mt_smallint tags (123)
|
|||
sql create table st_smallint_e12 using mt_smallint tags (123)
|
||||
|
||||
sql_error insert into st_smallint_e0 values (now, 32768)
|
||||
sql_error insert into st_smallint_e1 values (now, -32768)
|
||||
sql insert into st_smallint_e1 values (now, -32768)
|
||||
sql_error insert into st_smallint_e2 values (now, 42768)
|
||||
sql_error insert into st_smallint_e3 values (now, -32769)
|
||||
#sql_error insert into st_smallint_e4 values (now, 12.80)
|
||||
|
@ -409,10 +374,10 @@ sql_error insert into st_smallint_e7 values (now, "123abc")
|
|||
sql_error insert into st_smallint_e9 values (now, abc)
|
||||
sql_error insert into st_smallint_e10 values (now, "abc")
|
||||
sql_error insert into st_smallint_e11 values (now, " ")
|
||||
sql_error insert into st_smallint_e12 values (now, '')
|
||||
sql insert into st_smallint_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_smallint_e13 using mt_smallint tags (033) values (now, 32768)
|
||||
sql_error insert into st_smallint_e14 using mt_smallint tags (033) values (now, -32768)
|
||||
sql insert into st_smallint_e14_1 using mt_smallint tags (033) values (now, -32768)
|
||||
sql_error insert into st_smallint_e15 using mt_smallint tags (033) values (now, 32968)
|
||||
sql_error insert into st_smallint_e16 using mt_smallint tags (033) values (now, -33768)
|
||||
#sql_error insert into st_smallint_e17 using mt_smallint tags (033) values (now, 12.80)
|
||||
|
@ -422,10 +387,10 @@ sql_error insert into st_smallint_e20 using mt_smallint tags (033) values (now,
|
|||
sql_error insert into st_smallint_e22 using mt_smallint tags (033) values (now, abc)
|
||||
sql_error insert into st_smallint_e23 using mt_smallint tags (033) values (now, "abc")
|
||||
sql_error insert into st_smallint_e24 using mt_smallint tags (033) values (now, " ")
|
||||
sql_error insert into st_smallint_e25 using mt_smallint tags (033) values (now, '')
|
||||
sql insert into st_smallint_e25_1 using mt_smallint tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_smallint_e13 using mt_smallint tags (32768) values (now, -033)
|
||||
sql_error insert into st_smallint_e14 using mt_smallint tags (-32768) values (now, -033)
|
||||
sql insert into st_smallint_e14 using mt_smallint tags (-32768) values (now, -033)
|
||||
sql_error insert into st_smallint_e15 using mt_smallint tags (72768) values (now, -033)
|
||||
sql_error insert into st_smallint_e16 using mt_smallint tags (-92768) values (now, -033)
|
||||
#sql_error insert into st_smallint_e17 using mt_smallint tags (12.80) values (now, -033)
|
||||
|
@ -435,7 +400,7 @@ sql_error insert into st_smallint_e20 using mt_smallint tags ("123abc") values (
|
|||
sql_error insert into st_smallint_e22 using mt_smallint tags (abc) values (now, -033)
|
||||
sql_error insert into st_smallint_e23 using mt_smallint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_smallint_e24 using mt_smallint tags (" ") values (now, -033)
|
||||
sql_error insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033)
|
||||
sql insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_smallint_e13 using mt_smallint tags (033) values (now, 00062)
|
||||
sql insert into st_smallint_e14 using mt_smallint tags (033) values (now, 00062)
|
||||
|
@ -452,7 +417,7 @@ sql insert into st_smallint_e24 using mt_smallint tags (033) values (now, 00062)
|
|||
sql insert into st_smallint_e25 using mt_smallint tags (033) values (now, 00062)
|
||||
|
||||
sql_error alter table st_smallint_e13 set tag tagname=32768
|
||||
sql_error alter table st_smallint_e14 set tag tagname=-32768
|
||||
sql alter table st_smallint_e14 set tag tagname=-32768
|
||||
sql_error alter table st_smallint_e15 set tag tagname=52768
|
||||
sql_error alter table st_smallint_e16 set tag tagname=-32778
|
||||
sql_error alter table st_smallint_e19 set tag tagname=123abc
|
||||
|
@ -460,4 +425,4 @@ sql_error alter table st_smallint_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_smallint_e22 set tag tagname=abc
|
||||
sql_error alter table st_smallint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_smallint_e24 set tag tagname=" "
|
||||
sql_error alter table st_smallint_e25 set tag tagname=''
|
||||
sql alter table st_smallint_e25 set tag tagname=''
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
sql create database if not exists db
|
||||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value
|
||||
|
@ -9,79 +17,65 @@ sql create table mt_tinyint (ts timestamp, c tinyint) tags (tagname tinyint)
|
|||
|
||||
## case 00: static create table for test tag values
|
||||
sql create table st_tinyint_0 using mt_tinyint tags (NULL)
|
||||
sql select tagname from st_tinyint_0
|
||||
if $data00 != NULL then
|
||||
print expect NULL, actually: $data00
|
||||
sql show tags from st_tinyint_0
|
||||
if $data05 != NULL then
|
||||
print expect NULL, actually: $data05
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_1 using mt_tinyint tags (NULL)
|
||||
sql select tagname from st_tinyint_1
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_2 using mt_tinyint tags ('NULL')
|
||||
sql select tagname from st_tinyint_2
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_3 using mt_tinyint tags ('NULL')
|
||||
sql select tagname from st_tinyint_3
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_4 using mt_tinyint tags ("NULL")
|
||||
sql select tagname from st_tinyint_4
|
||||
if $data00 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_5 using mt_tinyint tags ("NULL")
|
||||
sql select tagname from st_tinyint_5
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_1
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error create table st_tinyint_2 using mt_tinyint tags ('NULL')
|
||||
sql_error create table st_tinyint_3 using mt_tinyint tags ('NULL')
|
||||
sql_error create table st_tinyint_4 using mt_tinyint tags ("NULL")
|
||||
sql_error create table st_tinyint_5 using mt_tinyint tags ("NULL")
|
||||
|
||||
sql create table st_tinyint_6 using mt_tinyint tags (-127)
|
||||
sql select tagname from st_tinyint_6
|
||||
if $data00 != -127 then
|
||||
sql show tags from st_tinyint_6
|
||||
if $data05 != -127 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_7 using mt_tinyint tags (127)
|
||||
sql select tagname from st_tinyint_7
|
||||
if $data00 != 127 then
|
||||
sql show tags from st_tinyint_7
|
||||
if $data05 != 127 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_8 using mt_tinyint tags (37)
|
||||
sql select tagname from st_tinyint_8
|
||||
if $data00 != 37 then
|
||||
sql show tags from st_tinyint_8
|
||||
if $data05 != 37 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_9 using mt_tinyint tags (-100)
|
||||
sql select tagname from st_tinyint_9
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_tinyint_9
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_10 using mt_tinyint tags (+113)
|
||||
sql select tagname from st_tinyint_10
|
||||
if $data00 != 113 then
|
||||
sql show tags from st_tinyint_10
|
||||
if $data05 != 113 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_11 using mt_tinyint tags ('-100')
|
||||
sql select tagname from st_tinyint_11
|
||||
if $data00 != -100 then
|
||||
sql show tags from st_tinyint_11
|
||||
if $data05 != -100 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_12 using mt_tinyint tags ("+78")
|
||||
sql select tagname from st_tinyint_12
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_tinyint_12
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_13 using mt_tinyint tags (+0078)
|
||||
sql select tagname from st_tinyint_13
|
||||
if $data00 != 78 then
|
||||
sql show tags from st_tinyint_13
|
||||
if $data05 != 78 then
|
||||
return -1
|
||||
endi
|
||||
sql create table st_tinyint_14 using mt_tinyint tags (-00078)
|
||||
sql select tagname from st_tinyint_14
|
||||
if $data00 != -78 then
|
||||
sql show tags from st_tinyint_14
|
||||
if $data05 != -78 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -102,38 +96,6 @@ endi
|
|||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_2 values (now, 'NULL')
|
||||
sql select * from st_tinyint_2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_3 values (now, 'NULL')
|
||||
sql select * from st_tinyint_3
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_4 values (now, "NULL")
|
||||
sql select * from st_tinyint_4
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_5 values (now, "NULL")
|
||||
sql select * from st_tinyint_5
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_6 values (now, 127)
|
||||
sql select * from st_tinyint_6
|
||||
if $rows != 1 then
|
||||
|
@ -211,8 +173,8 @@ endi
|
|||
|
||||
## case 02: dynamic create table for test tag values
|
||||
sql insert into st_tinyint_16 using mt_tinyint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_tinyint_16
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_16
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_16
|
||||
|
@ -221,8 +183,8 @@ if $data01 != NULL then
|
|||
endi
|
||||
|
||||
sql insert into st_tinyint_17 using mt_tinyint tags (NULL) values (now, NULL)
|
||||
sql select tagname from st_tinyint_17
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_17
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_17
|
||||
|
@ -230,8 +192,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_18 using mt_tinyint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_tinyint_18
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_18
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_18
|
||||
|
@ -239,8 +201,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_19 using mt_tinyint tags ('NULL') values (now, 'NULL')
|
||||
sql select tagname from st_tinyint_19
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_19
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_19
|
||||
|
@ -248,8 +210,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_20 using mt_tinyint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_tinyint_20
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_20
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_20
|
||||
|
@ -257,8 +219,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_21 using mt_tinyint tags ("NULL") values (now, "NULL")
|
||||
sql select tagname from st_tinyint_21
|
||||
if $data00 != NULL then
|
||||
sql show tags from st_tinyint_21
|
||||
if $data05 != NULL then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_21
|
||||
|
@ -266,8 +228,8 @@ if $data01 != NULL then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_22 using mt_tinyint tags (127) values (now, 127)
|
||||
sql select tagname from st_tinyint_22
|
||||
if $data00 != 127 then
|
||||
sql show tags from st_tinyint_22
|
||||
if $data05 != 127 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_22
|
||||
|
@ -275,8 +237,8 @@ if $data01 != 127 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_23 using mt_tinyint tags (-127) values (now, -127)
|
||||
sql select tagname from st_tinyint_23
|
||||
if $data00 != -127 then
|
||||
sql show tags from st_tinyint_23
|
||||
if $data05 != -127 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_23
|
||||
|
@ -284,8 +246,8 @@ if $data01 != -127 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_24 using mt_tinyint tags (10) values (now, 10)
|
||||
sql select tagname from st_tinyint_24
|
||||
if $data00 != 10 then
|
||||
sql show tags from st_tinyint_24
|
||||
if $data05 != 10 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_24
|
||||
|
@ -293,8 +255,8 @@ if $data01 != 10 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_25 using mt_tinyint tags ("-0") values (now, "-0")
|
||||
sql select tagname from st_tinyint_25
|
||||
if $data00 != 0 then
|
||||
sql show tags from st_tinyint_25
|
||||
if $data05 != 0 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_25
|
||||
|
@ -302,8 +264,8 @@ if $data01 != 0 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_26 using mt_tinyint tags ('123') values (now, '123')
|
||||
sql select tagname from st_tinyint_26
|
||||
if $data00 != 123 then
|
||||
sql show tags from st_tinyint_26
|
||||
if $data05 != 123 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_26
|
||||
|
@ -311,8 +273,8 @@ if $data01 != 123 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_27 using mt_tinyint tags (+056) values (now, +00056)
|
||||
sql select tagname from st_tinyint_27
|
||||
if $data00 != 56 then
|
||||
sql show tags from st_tinyint_27
|
||||
if $data05 != 56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_27
|
||||
|
@ -320,8 +282,8 @@ if $data01 != 56 then
|
|||
return -1
|
||||
endi
|
||||
sql insert into st_tinyint_28 using mt_tinyint tags (-056) values (now, -0056)
|
||||
sql select tagname from st_tinyint_28
|
||||
if $data00 != -56 then
|
||||
sql show tags from st_tinyint_28
|
||||
if $data05 != -56 then
|
||||
return -1
|
||||
endi
|
||||
sql select * from st_tinyint_28
|
||||
|
@ -331,49 +293,49 @@ endi
|
|||
|
||||
## case 03: alter tag values
|
||||
#sql alter table st_tinyint_0 set tag tagname=127
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != 127 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != 127 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname=-127
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != -127 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != -127 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname=+100
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != 100 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != 100 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname=-33
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != -33 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != -33 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname='+98'
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != 98 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != 98 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname='-076'
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != -76 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != -76 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname=+0012
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != 12 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != 12 then
|
||||
# return -1
|
||||
#endi
|
||||
#sql alter table st_tinyint_0 set tag tagname=-00063
|
||||
#sql select tagname from st_tinyint_0
|
||||
#if $data00 != -63 then
|
||||
#sql show tags from st_tinyint_0
|
||||
#if $data05 != -63 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
## case 04: illegal input
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (128)
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (-128)
|
||||
sql create table st_tinyint_e0_1 using mt_tinyint tags (-128)
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (1280)
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (-1280)
|
||||
#sql_error create table st_tinyint_e0 using mt_tinyint tags (12.80) truncate integer part
|
||||
|
@ -383,7 +345,7 @@ sql_error create table st_tinyint_e0 using mt_tinyint tags ("123abc")
|
|||
sql_error create table st_tinyint_e0 using mt_tinyint tags (abc)
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags ("abc")
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags (" ")
|
||||
sql_error create table st_tinyint_e0 using mt_tinyint tags ('')
|
||||
sql create table st_tinyint_e0_2 using mt_tinyint tags ('')
|
||||
|
||||
sql create table st_tinyint_e0 using mt_tinyint tags (123)
|
||||
sql create table st_tinyint_e1 using mt_tinyint tags (123)
|
||||
|
@ -400,7 +362,7 @@ sql create table st_tinyint_e11 using mt_tinyint tags (123)
|
|||
sql create table st_tinyint_e12 using mt_tinyint tags (123)
|
||||
|
||||
sql_error insert into st_tinyint_e0 values (now, 128)
|
||||
sql_error insert into st_tinyint_e1 values (now, -128)
|
||||
sql insert into st_tinyint_e1 values (now, -128)
|
||||
sql_error insert into st_tinyint_e2 values (now, 1280)
|
||||
sql_error insert into st_tinyint_e3 values (now, -1280)
|
||||
#sql_error insert into st_tinyint_e4 values (now, 12.80)
|
||||
|
@ -410,10 +372,10 @@ sql_error insert into st_tinyint_e7 values (now, "123abc")
|
|||
sql_error insert into st_tinyint_e9 values (now, abc)
|
||||
sql_error insert into st_tinyint_e10 values (now, "abc")
|
||||
sql_error insert into st_tinyint_e11 values (now, " ")
|
||||
sql_error insert into st_tinyint_e12 values (now, '')
|
||||
sql insert into st_tinyint_e12 values (now, '')
|
||||
|
||||
sql_error insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 128)
|
||||
sql_error insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, -128)
|
||||
sql insert into st_tinyint_e14_1 using mt_tinyint tags (033) values (now, -128)
|
||||
sql_error insert into st_tinyint_e15 using mt_tinyint tags (033) values (now, 1280)
|
||||
sql_error insert into st_tinyint_e16 using mt_tinyint tags (033) values (now, -1280)
|
||||
#sql_error insert into st_tinyint_e17 using mt_tinyint tags (033) values (now, 12.80)
|
||||
|
@ -423,10 +385,10 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags (033) values (now, "1
|
|||
sql_error insert into st_tinyint_e22 using mt_tinyint tags (033) values (now, abc)
|
||||
sql_error insert into st_tinyint_e23 using mt_tinyint tags (033) values (now, "abc")
|
||||
sql_error insert into st_tinyint_e24 using mt_tinyint tags (033) values (now, " ")
|
||||
sql_error insert into st_tinyint_e25 using mt_tinyint tags (033) values (now, '')
|
||||
sql insert into st_tinyint_e25_2 using mt_tinyint tags (033) values (now, '')
|
||||
|
||||
sql_error insert into st_tinyint_e13 using mt_tinyint tags (128) values (now, -033)
|
||||
sql_error insert into st_tinyint_e14 using mt_tinyint tags (-128) values (now, -033)
|
||||
sql insert into st_tinyint_e14 using mt_tinyint tags (-128) values (now, -033)
|
||||
sql_error insert into st_tinyint_e15 using mt_tinyint tags (1280) values (now, -033)
|
||||
sql_error insert into st_tinyint_e16 using mt_tinyint tags (-1280) values (now, -033)
|
||||
#sql_error insert into st_tinyint_e17 using mt_tinyint tags (12.80) values (now, -033)
|
||||
|
@ -436,7 +398,7 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags ("123abc") values (no
|
|||
sql_error insert into st_tinyint_e22 using mt_tinyint tags (abc) values (now, -033)
|
||||
sql_error insert into st_tinyint_e23 using mt_tinyint tags ("abc") values (now, -033)
|
||||
sql_error insert into st_tinyint_e24 using mt_tinyint tags (" ") values (now, -033)
|
||||
sql_error insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033)
|
||||
sql insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033)
|
||||
|
||||
sql insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 00062)
|
||||
sql insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, 00062)
|
||||
|
@ -453,7 +415,7 @@ sql insert into st_tinyint_e24 using mt_tinyint tags (033) values (now, 00062)
|
|||
sql insert into st_tinyint_e25 using mt_tinyint tags (033) values (now, 00062)
|
||||
|
||||
sql_error alter table st_tinyint_e13 set tag tagname=128
|
||||
sql_error alter table st_tinyint_e14 set tag tagname=-128
|
||||
sql alter table st_tinyint_e14 set tag tagname=-128
|
||||
sql_error alter table st_tinyint_e15 set tag tagname=1280
|
||||
sql_error alter table st_tinyint_e16 set tag tagname=-1280
|
||||
sql_error alter table st_tinyint_e19 set tag tagname=123abc
|
||||
|
@ -461,4 +423,4 @@ sql_error alter table st_tinyint_e20 set tag tagname="123abc"
|
|||
sql_error alter table st_tinyint_e22 set tag tagname=abc
|
||||
sql_error alter table st_tinyint_e23 set tag tagname="abc"
|
||||
sql_error alter table st_tinyint_e24 set tag tagname=" "
|
||||
sql_error alter table st_tinyint_e25 set tag tagname=''
|
||||
sql alter table st_tinyint_e25 set tag tagname=''
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
sql create database if not exists db
|
||||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== columnValues.sim
|
||||
|
||||
sql drop database if exists db
|
||||
sql create database db
|
||||
sql use db
|
||||
|
||||
sql drop table if exists mt_unsigned;
|
||||
|
@ -10,26 +18,19 @@ sql alter table mt_unsigned_1 set tag t1=138;
|
|||
sql alter table mt_unsigned_1 set tag t2=32769;
|
||||
sql alter table mt_unsigned_1 set tag t3=294967295;
|
||||
sql alter table mt_unsigned_1 set tag t4=446744073709551615;
|
||||
sql insert into mt_unsigned_1 values (now, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
sql select t1,t2,t3,t4 from mt_unsigned_1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print $data00, $data01, $data02, $data03
|
||||
|
||||
if $data00 != 138 then
|
||||
print expect 138, actual: $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
print $data01, $data02, $data03
|
||||
if $data01 != 32769 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data02 != 294967295 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data03 != 446744073709551615 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -44,10 +45,10 @@ sql_error create table mt_unsigned_3 using mt_unsigned tags(0, -1, 0, 0, 0, 0, 0
|
|||
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, -1, 0, 0, 0, 0, 0);
|
||||
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, -1, 0, 0, 0, 0);
|
||||
|
||||
sql_error create table mt_unsigned_2 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0);
|
||||
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0);
|
||||
sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0);
|
||||
sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0);
|
||||
sql create table mt_unsigned_21 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0);
|
||||
sql create table mt_unsigned_31 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0);
|
||||
sql create table mt_unsigned_41 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0);
|
||||
sql create table mt_unsigned_51 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0);
|
||||
|
||||
sql_error create table mt_unsigned_2 using mt_unsigned tags(999, 0, 0, 0, 0, 0, 0, 0);
|
||||
sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 95535, 0, 0, 0, 0, 0, 0);
|
||||
|
@ -63,11 +64,6 @@ if $rows != 1 then
|
|||
return -1;
|
||||
endi
|
||||
|
||||
if $data00 != NULL then
|
||||
print expect NULL, actual: $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
@ -87,82 +83,44 @@ sql_error insert into mt_unsigned_1 values(now, -1, NULL, NULL, NULL, NULL, NULL
|
|||
sql_error insert into mt_unsigned_1 values(now, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL);
|
||||
sql insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
sql insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
sql select count(a),count(b),count(c),count(d), count(e) from mt_unsigned_1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select a+b+c from mt_unsigned_1 where a is null;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != NULL then
|
||||
print expect NULL, actual:$data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), a from mt_unsigned_1 group by a;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), b from mt_unsigned_1 group by b;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), c from mt_unsigned_1 group by c;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select a+b+c from mt_unsigned_1 where a is null;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), a from mt_unsigned_1 group by a;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select count(*), b from mt_unsigned_1 group by b;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select count(*), c from mt_unsigned_1 group by c;
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select count(*), d from mt_unsigned_1 group by d;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 4 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -283,12 +283,14 @@ print ================== server restart completed
|
|||
sql connect
|
||||
sql use first_db0;
|
||||
|
||||
sql select last(*), tbname from m1 group by tbname;
|
||||
sql select last(*), tbname from m1 group by tbname order by tbname;
|
||||
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data00 != @20-03-01 01:01:01.000@ then
|
||||
print data00 $data00 != 20-03-01 01:01:01.000@
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -500,11 +500,12 @@ if $rows != 2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select stddev(k), stddev(b), stddev(c),tbname, a from m1 group by tbname,a
|
||||
sql select stddev(k), stddev(b), stddev(c),tbname, a from m1 group by tbname,a order by a asc
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 1.414213562 then
|
||||
print expect 1.414213562, actual: $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 14.142135624 then
|
||||
|
@ -732,6 +733,7 @@ if $rows != 1 then
|
|||
return -1
|
||||
endi
|
||||
if $data00 != 0.005633334 then
|
||||
print expect 0.005633334, actual: $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -681,12 +681,13 @@ if $data14 != 1 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname, t1, t2 interval(1m) sliding(15s) order by tbname desc limit 1;
|
||||
sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname, t1, t2 interval(1m) sliding(15s) order by tbname desc,_wstart asc limit 1;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data01 != 1.000000000 then
|
||||
print expect 1.000000000, actual: $data01
|
||||
return -1
|
||||
endi
|
||||
if $data02 != t2 then
|
||||
|
|
|
@ -243,9 +243,6 @@ if $rows != $val then
|
|||
return -1
|
||||
endi
|
||||
|
||||
#TODO
|
||||
return
|
||||
|
||||
#===========================aggregation===================================
|
||||
#select + where condition
|
||||
sql select count(join_tb1.*), count(join_tb0.*) from $tb1 , $tb2 where $ts1 = $ts2 and join_tb1.ts >= 100000 and join_tb0.c7 = false;
|
||||
|
|
|
@ -360,6 +360,7 @@ endi
|
|||
#sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 > 0 and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0;
|
||||
sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 = true and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0;
|
||||
if $rows != 1 then
|
||||
print expect 1, actual: $rows
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 5 then
|
||||
|
|
|
@ -41,12 +41,10 @@ sql_error insert into tb17 (ts, c1, c3) using stb (t1, t3) tags ('tag5', 11.11,
|
|||
sql_error insert into tb18 (ts, c1, c3) using stb tags ('tag5', 16) values ( now + 5s, 'binary6', 6.6)
|
||||
sql_error insert into tb19 (ts, c1, c2, c3) using stb tags (19, 'tag5', 91.11) values ( now + 5s, 'binary7', 7, 7.7)
|
||||
|
||||
|
||||
|
||||
sql create table stbx (ts timestamp, c1 binary(10), c2 int, c3 float) tags (t1 binary(10), t2 int, t3 float)
|
||||
sql insert into tb100 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag100', 100, 100.123456) values ( now + 10s, 'binary100', 100, 100.9) tb101 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag101', 101, 101.9) values ( now + 10s, 'binary101', 101, 101.9) tb102 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag102', 102, 102.9) values ( now + 10s, 'binary102', 102, 102.9)
|
||||
|
||||
sql select * from stbx
|
||||
sql select * from stbx order by t1
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -100,7 +100,7 @@ endi
|
|||
|
||||
sql drop database $db
|
||||
sql show databases
|
||||
if $rows != 0 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -25,11 +25,5 @@ sql (select database()) union all (select database())
|
|||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @union_db0@ then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @union_db0@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -77,12 +77,12 @@ if $rows != $val then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select tbname from $mt
|
||||
sql select distinct tbname from $mt
|
||||
if $rows != $tbNum then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select tbname from $mt where t1 < 2
|
||||
sql select distinct tbname from $mt where t1 < 2
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
@ -249,14 +249,14 @@ sql_error insert into tb_where_NULL values(now, ?, '12')
|
|||
sql insert into tb_where_NULL values ('2019-01-01 09:00:00.000', 1, 'val1')
|
||||
sql insert into tb_where_NULL values ('2019-01-01 09:00:01.000', NULL, NULL)
|
||||
sql insert into tb_where_NULL values ('2019-01-01 09:00:02.000', 2, 'val2')
|
||||
sql_error select * from tb_where_NULL where c1 = NULL
|
||||
sql_error select * from tb_where_NULL where c1 <> NULL
|
||||
sql_error select * from tb_where_NULL where c1 < NULL
|
||||
sql_error select * from tb_where_NULL where c1 = "NULL"
|
||||
sql_error select * from tb_where_NULL where c1 <> "NULL"
|
||||
sql_error select * from tb_where_NULL where c1 <> "nulL"
|
||||
sql_error select * from tb_where_NULL where c1 > "NULL"
|
||||
sql_error select * from tb_where_NULL where c1 >= "NULL"
|
||||
sql select * from tb_where_NULL where c1 = NULL
|
||||
sql select * from tb_where_NULL where c1 <> NULL
|
||||
sql select * from tb_where_NULL where c1 < NULL
|
||||
sql select * from tb_where_NULL where c1 = "NULL"
|
||||
sql select * from tb_where_NULL where c1 <> "NULL"
|
||||
sql select * from tb_where_NULL where c1 <> "nulL"
|
||||
sql select * from tb_where_NULL where c1 > "NULL"
|
||||
sql select * from tb_where_NULL where c1 >= "NULL"
|
||||
sql select * from tb_where_NULL where c2 = "NULL"
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
|
@ -300,15 +300,17 @@ endw
|
|||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
sql_error select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter');
|
||||
sql select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter');
|
||||
|
||||
sql select * from wh_mt0 where c3 = '1' and tbname in ('test_null_filter');
|
||||
if $row != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from wh_mt0 where c3 = '1';
|
||||
if $row == 0 then
|
||||
sql select * from wh_mt0 where c3 = 1;
|
||||
print $rows -> 1000
|
||||
print $data00 $data01 $data02
|
||||
if $row != 1000 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -336,7 +338,7 @@ sql insert into where_ts values('2021-06-19 16:22:00', 1);
|
|||
sql insert into where_ts values('2021-06-19 16:23:00', 2);
|
||||
sql insert into where_ts values('2021-06-19 16:24:00', 3);
|
||||
sql insert into where_ts values('2021-06-19 16:25:00', 1);
|
||||
sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00'
|
||||
sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' order by ts;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -47,7 +47,7 @@ endi
|
|||
|
||||
$replica = 3
|
||||
$vgroups = 1
|
||||
$retentions = 5s:7d,15s:21d
|
||||
$retentions = 5s:7d,15s:21d,1m:365d
|
||||
|
||||
print ============= create database
|
||||
sql create database db replica $replica vgroups $vgroups retentions $retentions
|
||||
|
@ -114,7 +114,7 @@ endi
|
|||
|
||||
vg_ready:
|
||||
print ====> create stable/child table
|
||||
sql create table stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int) rollup(sum)
|
||||
sql create table stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int) rollup(sum) watermark 3s,3s max_delay 3s,3s
|
||||
|
||||
sql show stables
|
||||
if $rows != 1 then
|
||||
|
@ -129,20 +129,28 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|||
sleep 3000
|
||||
|
||||
|
||||
print ===> write 100 records
|
||||
$N = 100
|
||||
$count = 0
|
||||
while $count < $N
|
||||
$ms = 1659000000000 + $count
|
||||
sql insert into ct1 values( $ms , $count , 2.1, 3.1)
|
||||
$count = $count + 1
|
||||
print ===> write 0-50 records
|
||||
$ms = 0
|
||||
$cnt = 0
|
||||
while $cnt < 50
|
||||
$ms = $cnt . m
|
||||
sql insert into ct1 values (now + $ms , $cnt , 2.1, 3.1)
|
||||
$cnt = $cnt + 1
|
||||
endw
|
||||
print ===> flush database db
|
||||
sql flush database db;
|
||||
sleep 5000
|
||||
|
||||
print ===> write 51-100 records
|
||||
while $cnt < 100
|
||||
$ms = $cnt . m
|
||||
sql insert into ct1 values (now + $ms , $cnt , 2.1, 3.1)
|
||||
$cnt = $cnt + 1
|
||||
endw
|
||||
|
||||
|
||||
#sql flush database db;
|
||||
|
||||
|
||||
sleep 3000
|
||||
print ===> flush database db
|
||||
sql flush database db;
|
||||
sleep 5000
|
||||
|
||||
|
||||
print ===> stop dnode1 dnode2 dnode3
|
||||
|
@ -150,8 +158,6 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
|
||||
sleep 10000
|
||||
|
||||
########################################################
|
||||
print ===> start dnode1 dnode2 dnode3 dnode4
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
@ -164,7 +170,7 @@ sleep 3000
|
|||
print =============== query data
|
||||
sql connect
|
||||
sql use db
|
||||
sql select * from ct1
|
||||
sql select * from ct1 where ts > now - 1d
|
||||
print rows: $rows
|
||||
print $data00 $data01 $data02
|
||||
if $rows != 100 then
|
||||
|
|
|
@ -311,7 +311,7 @@ sql select * from $mt where tgcol2 = 1 -x step52
|
|||
return -1
|
||||
step52:
|
||||
|
||||
sql select * from $mt where tgcol3 = 1
|
||||
sql select * from $mt where tgcol3 < 2
|
||||
print $data01 $data02 $data03
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
|
|
|
@ -97,10 +97,10 @@ if $data23 != TAG then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql alter table $mt drop tag tgcol2
|
||||
sql alter table $mt drop tag tgcol1 -x step40
|
||||
return -1
|
||||
step40:
|
||||
sql alter table $mt drop tag tgcol2
|
||||
|
||||
print =============== step5
|
||||
$i = 5
|
||||
|
@ -123,10 +123,10 @@ if $data03 != 2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql alter table $mt drop tag tgcol2
|
||||
sql alter table $mt drop tag tgcol1 -x step50
|
||||
return -1
|
||||
step50:
|
||||
sql alter table $mt drop tag tgcol2
|
||||
|
||||
print =============== step6
|
||||
$i = 6
|
||||
|
@ -186,7 +186,7 @@ endi
|
|||
if $data31 != TINYINT then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != BINARY then
|
||||
if $data41 != VARCHAR then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != 2 then
|
||||
|
@ -405,8 +405,6 @@ sql alter table $mt drop tag tgcol3
|
|||
sql alter table $mt drop tag tgcol4
|
||||
sql alter table $mt drop tag tgcol6
|
||||
|
||||
sleep 3000
|
||||
|
||||
print =============== step2
|
||||
$i = 2
|
||||
$mt = $mtPrefix . $i
|
||||
|
|
|
@ -32,7 +32,7 @@ if $data(2)[4] != ready then
|
|||
endi
|
||||
|
||||
print =============== kill dnode2
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGKILL
|
||||
|
||||
print =============== create database
|
||||
sql show transactions
|
||||
|
@ -88,7 +88,7 @@ endi
|
|||
|
||||
sql show transactions
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
goto step2
|
||||
endi
|
||||
|
||||
sql_error create database d1 vgroups 2;
|
||||
|
|
|
@ -280,7 +280,7 @@ class TDTestCase:
|
|||
tdSql.error(self.diff_query_form(alias=", min(c1)")) # mix with select function 1
|
||||
tdSql.error(self.diff_query_form(alias=", top(c1, 5)")) # mix with select function 2
|
||||
tdSql.error(self.diff_query_form(alias=", spread(c1)")) # mix with calculation function 1
|
||||
tdSql.error(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2
|
||||
tdSql.query(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2
|
||||
# tdSql.error(self.diff_query_form(alias=" + 2")) # mix with arithmetic 1
|
||||
tdSql.error(self.diff_query_form(alias=" + avg(c1)")) # mix with arithmetic 2
|
||||
tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1
|
||||
|
|
|
@ -213,7 +213,7 @@ class TDTestCase:
|
|||
tdSql.error("select irate(c1), abs(c1) from ct4 ")
|
||||
|
||||
# agg functions mix with agg functions
|
||||
tdSql.query("select irate(c1), count(c5) from stb1 partition by tbname ")
|
||||
tdSql.query("select irate(c1), count(c5) from stb1 partition by tbname order by tbname")
|
||||
tdSql.checkData(0, 0, 0.000000000)
|
||||
tdSql.checkData(1, 0, 0.000000000)
|
||||
tdSql.checkData(0, 1, 13)
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
import taos
|
||||
import sys
|
||||
import time
|
||||
import socket
|
||||
import os
|
||||
import threading
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
from util.dnodes import *
|
||||
from util.common import *
|
||||
sys.path.append("./7-tmq")
|
||||
from tmqCommon import *
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor())
|
||||
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
|
||||
|
||||
def checkFileContent(self):
|
||||
buildPath = tdCom.getBuildPath()
|
||||
cmdStr = '%s/build/bin/sml_test'%(buildPath)
|
||||
tdLog.info(cmdStr)
|
||||
ret = os.system(cmdStr)
|
||||
if ret != 0:
|
||||
tdLog.exit("sml_test failed")
|
||||
|
||||
tdSql.execute('use sml_db')
|
||||
tdSql.query("select * from t_b7d815c9222ca64cdf2614c61de8f211")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
tdSql.checkData(0, 0, '2016-01-01 08:00:07.000')
|
||||
tdSql.checkData(0, 1, 2000)
|
||||
tdSql.checkData(0, 2, 200)
|
||||
tdSql.checkData(0, 3, 15)
|
||||
tdSql.checkData(0, 4, 24.5208)
|
||||
tdSql.checkData(0, 5, 28.09377)
|
||||
tdSql.checkData(0, 6, 428)
|
||||
tdSql.checkData(0, 7, 0)
|
||||
tdSql.checkData(0, 8, 304)
|
||||
tdSql.checkData(0, 9, 0)
|
||||
tdSql.checkData(0, 10, 25)
|
||||
|
||||
tdSql.query("select * from readings")
|
||||
tdSql.checkRows(9)
|
||||
|
||||
tdSql.query("select distinct tbname from readings")
|
||||
tdSql.checkRows(4)
|
||||
|
||||
tdSql.query("select * from t_0799064f5487946e5d22164a822acfc8 order by _ts")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 3, "kk")
|
||||
tdSql.checkData(1, 3, None)
|
||||
|
||||
|
||||
tdSql.query("select distinct tbname from `sys.if.bytes.out`")
|
||||
tdSql.checkRows(2)
|
||||
|
||||
tdSql.query("select * from t_fc70dec6677d4277c5d9799c4da806da order by _ts")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 1.300000000)
|
||||
tdSql.checkData(1, 1,13.000000000)
|
||||
|
||||
tdSql.query("select * from `sys.procs.running`")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 42.000000000)
|
||||
tdSql.checkData(0, 2, "web01")
|
||||
|
||||
tdSql.query("select distinct tbname from `sys.cpu.nice`")
|
||||
tdSql.checkRows(2)
|
||||
|
||||
tdSql.query("select * from `sys.cpu.nice` order by _ts")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 9.000000000)
|
||||
tdSql.checkData(0, 2, "lga")
|
||||
tdSql.checkData(0, 3, "web02")
|
||||
tdSql.checkData(0, 4, None)
|
||||
tdSql.checkData(1, 1, 18.000000000)
|
||||
tdSql.checkData(1, 2, "lga")
|
||||
tdSql.checkData(1, 3, "web01")
|
||||
tdSql.checkData(1, 4, "t1")
|
||||
|
||||
tdSql.query("select * from macylr")
|
||||
tdSql.checkRows(2)
|
||||
return
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
self.checkFileContent()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -457,15 +457,15 @@ class TDTestCase:
|
|||
)
|
||||
|
||||
tdSql.execute(
|
||||
f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
f"insert into sub1_bound values ( now()+1s, -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
)
|
||||
|
||||
tdSql.execute(
|
||||
f"insert into sub1_bound values ( now(), 2147483643, 9223372036854775803, 32763, 123, 3.39E+38, 1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
f"insert into sub1_bound values ( now()+2s, 2147483643, 9223372036854775803, 32763, 123, 3.39E+38, 1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
)
|
||||
|
||||
tdSql.execute(
|
||||
f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
f"insert into sub1_bound values ( now()+3s, -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
|
||||
)
|
||||
|
||||
tdSql.error(
|
||||
|
|
|
@ -63,12 +63,12 @@ class TDTestCase:
|
|||
tdSql.checkData(0, 3, "a")
|
||||
tdSql.checkData(1, 4, None)
|
||||
|
||||
tdSql.query("select * from n1 order by ts")
|
||||
tdSql.query("select * from n1 order by cc3 desc")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, "eeee")
|
||||
tdSql.checkData(1, 2, 940)
|
||||
|
||||
tdSql.query("select * from jt order by i desc;")
|
||||
tdSql.query("select * from jt order by i desc")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 11)
|
||||
tdSql.checkData(0, 2, None)
|
||||
|
@ -85,7 +85,5 @@ class TDTestCase:
|
|||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
event = threading.Event()
|
||||
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
|
|
|
@ -427,3 +427,4 @@ python3 ./test.py -f 2-query/count_partition.py -Q 3
|
|||
python3 ./test.py -f 2-query/max_partition.py -Q 3
|
||||
python3 ./test.py -f 2-query/last_row.py -Q 3
|
||||
python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
|
||||
python3 ./test.py -f 2-query/sml.py -Q 3
|
|
@ -2,6 +2,7 @@ add_executable(tmq_demo tmqDemo.c)
|
|||
add_executable(tmq_sim tmqSim.c)
|
||||
add_executable(create_table createTable.c)
|
||||
add_executable(tmq_taosx_ci tmq_taosx_ci.c)
|
||||
add_executable(sml_test sml_test.c)
|
||||
target_link_libraries(
|
||||
create_table
|
||||
PUBLIC taos_static
|
||||
|
@ -31,6 +32,14 @@ target_link_libraries(
|
|||
PUBLIC os
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
sml_test
|
||||
PUBLIC taos_static
|
||||
PUBLIC util
|
||||
PUBLIC common
|
||||
PUBLIC os
|
||||
)
|
||||
|
||||
add_executable(sdbDump sdbDump.c)
|
||||
target_link_libraries(
|
||||
sdbDump
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
|||
Subproject commit 817cb6ac431ed8ae4c843872cdfc8c201c1e1894
|
|
@ -1 +0,0 @@
|
|||
Subproject commit df8678f070e3f707faf59baebec90065f6e1268b
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 9de599dc5293e9c90bc00bc4a03f8b91ba756bc3
|
Loading…
Reference in New Issue