Merge branch '3.0' of https://github.com/taosdata/TDengine into feature/vnode_refact1
This commit is contained in:
commit
a194f6458f
|
@ -46,7 +46,7 @@ ENDIF ()
|
||||||
|
|
||||||
IF (TD_WINDOWS)
|
IF (TD_WINDOWS)
|
||||||
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
||||||
SET(COMMON_FLAGS "/W3 /D_WIN32 /vmg")
|
SET(COMMON_FLAGS "/W3 /D_WIN32")
|
||||||
|
|
||||||
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
|
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
|
||||||
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
|
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
|
||||||
|
|
|
@ -195,7 +195,7 @@ DLL_EXPORT void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
|
||||||
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision, bool dataFormat);
|
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
|
||||||
|
|
||||||
/* --------------------------TMQ INTERFACE------------------------------- */
|
/* --------------------------TMQ INTERFACE------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -326,11 +326,11 @@ typedef struct {
|
||||||
int8_t alterType;
|
int8_t alterType;
|
||||||
int32_t numOfFields;
|
int32_t numOfFields;
|
||||||
SArray* pFields;
|
SArray* pFields;
|
||||||
} SMAltertbReq;
|
} SMAlterStbReq;
|
||||||
|
|
||||||
int32_t tSerializeSMAlterStbReq(void* buf, int32_t bufLen, SMAltertbReq* pReq);
|
int32_t tSerializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq);
|
||||||
int32_t tDeserializeSMAlterStbReq(void* buf, int32_t bufLen, SMAltertbReq* pReq);
|
int32_t tDeserializeSMAlterStbReq(void* buf, int32_t bufLen, SMAlterStbReq* pReq);
|
||||||
void tFreeSMAltertbReq(SMAltertbReq* pReq);
|
void tFreeSMAltertbReq(SMAlterStbReq* pReq);
|
||||||
|
|
||||||
typedef struct SEpSet {
|
typedef struct SEpSet {
|
||||||
int8_t inUse;
|
int8_t inUse;
|
||||||
|
|
|
@ -327,29 +327,32 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_TDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0601)
|
#define TSDB_CODE_TDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0601)
|
||||||
#define TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0602)
|
#define TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0602)
|
||||||
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
|
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
|
||||||
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
|
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0604)
|
||||||
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
|
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0605)
|
||||||
#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0606)
|
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0606)
|
||||||
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
|
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0607)
|
||||||
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0608)
|
||||||
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
|
#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0609)
|
||||||
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060A)
|
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x060A)
|
||||||
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060B)
|
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x060B)
|
||||||
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060C)
|
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x060C)
|
||||||
#define TSDB_CODE_TDB_INVALID_ACTION TAOS_DEF_ERROR_CODE(0, 0x060D)
|
#define TSDB_CODE_TDB_TAG_VER_OUT_OF_DATE TAOS_DEF_ERROR_CODE(0, 0x060D)
|
||||||
#define TSDB_CODE_TDB_INVALID_CREATE_TB_MSG TAOS_DEF_ERROR_CODE(0, 0x060E)
|
#define TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x060E)
|
||||||
#define TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM TAOS_DEF_ERROR_CODE(0, 0x060F)
|
#define TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP TAOS_DEF_ERROR_CODE(0, 0x060F)
|
||||||
#define TSDB_CODE_TDB_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0610)
|
#define TSDB_CODE_TDB_INVALID_ACTION TAOS_DEF_ERROR_CODE(0, 0x0600)
|
||||||
#define TSDB_CODE_TDB_TABLE_RECONFIGURE TAOS_DEF_ERROR_CODE(0, 0x0611)
|
#define TSDB_CODE_TDB_INVALID_CREATE_TB_MSG TAOS_DEF_ERROR_CODE(0, 0x0601)
|
||||||
#define TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO TAOS_DEF_ERROR_CODE(0, 0x0612)
|
#define TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM TAOS_DEF_ERROR_CODE(0, 0x0602)
|
||||||
#define TSDB_CODE_TDB_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0613)
|
#define TSDB_CODE_TDB_FILE_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0613)
|
||||||
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0614)
|
#define TSDB_CODE_TDB_TABLE_RECONFIGURE TAOS_DEF_ERROR_CODE(0, 0x0614)
|
||||||
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615)
|
#define TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO TAOS_DEF_ERROR_CODE(0, 0x0615)
|
||||||
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616)
|
#define TSDB_CODE_TDB_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0616)
|
||||||
#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x0617)
|
#define TSDB_CODE_TDB_MESSED_MSG TAOS_DEF_ERROR_CODE(0, 0x0617)
|
||||||
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0618)
|
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0618)
|
||||||
#define TSDB_CODE_TDB_NO_SMA_INDEX_IN_META TAOS_DEF_ERROR_CODE(0, 0x0619)
|
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0619)
|
||||||
#define TSDB_CODE_TDB_INVALID_SMA_STAT TAOS_DEF_ERROR_CODE(0, 0x0620)
|
#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x061A)
|
||||||
|
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061B)
|
||||||
|
#define TSDB_CODE_TDB_NO_SMA_INDEX_IN_META TAOS_DEF_ERROR_CODE(0, 0x061C)
|
||||||
|
#define TSDB_CODE_TDB_INVALID_SMA_STAT TAOS_DEF_ERROR_CODE(0, 0x062D)
|
||||||
|
|
||||||
// query
|
// query
|
||||||
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
|
||||||
|
|
|
@ -1724,13 +1724,13 @@ cleanup:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision, bool dataFormat) {
|
TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision) {
|
||||||
SRequestObj* request = createRequest(taos, NULL, NULL, TSDB_SQL_INSERT);
|
SRequestObj* request = createRequest(taos, NULL, NULL, TSDB_SQL_INSERT);
|
||||||
if(!request){
|
if(!request){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSmlHandle* info = smlBuildSmlInfo(taos, request, protocol, precision, dataFormat);
|
SSmlHandle* info = smlBuildSmlInfo(taos, request, protocol, precision, false);
|
||||||
if(!info){
|
if(!info){
|
||||||
return (TAOS_RES*)request;
|
return (TAOS_RES*)request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -594,7 +594,7 @@ int32_t tDeserializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq) {
|
int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) {
|
||||||
SCoder encoder = {0};
|
SCoder encoder = {0};
|
||||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq) {
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq) {
|
int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq) {
|
||||||
SCoder decoder = {0};
|
SCoder decoder = {0};
|
||||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tFreeSMAltertbReq(SMAltertbReq *pReq) {
|
void tFreeSMAltertbReq(SMAlterStbReq *pReq) {
|
||||||
taosArrayDestroy(pReq->pFields);
|
taosArrayDestroy(pReq->pFields);
|
||||||
pReq->pFields = NULL;
|
pReq->pFields = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ void qmInitMsgHandle(SMgmtWrapper *pWrapper) {
|
||||||
dmSetMsgHandle(pWrapper, TDMT_VND_QUERY_CONTINUE, qmProcessQueryMsg, QNODE_HANDLE);
|
dmSetMsgHandle(pWrapper, TDMT_VND_QUERY_CONTINUE, qmProcessQueryMsg, QNODE_HANDLE);
|
||||||
dmSetMsgHandle(pWrapper, TDMT_VND_FETCH, qmProcessFetchMsg, QNODE_HANDLE);
|
dmSetMsgHandle(pWrapper, TDMT_VND_FETCH, qmProcessFetchMsg, QNODE_HANDLE);
|
||||||
dmSetMsgHandle(pWrapper, TDMT_VND_FETCH_RSP, qmProcessFetchMsg, QNODE_HANDLE);
|
dmSetMsgHandle(pWrapper, TDMT_VND_FETCH_RSP, qmProcessFetchMsg, QNODE_HANDLE);
|
||||||
|
dmSetMsgHandle(pWrapper, TDMT_VND_QUERY_HEARTBEAT, qmProcessFetchMsg, QNODE_HANDLE);
|
||||||
|
|
||||||
dmSetMsgHandle(pWrapper, TDMT_VND_RES_READY, qmProcessFetchMsg, QNODE_HANDLE);
|
dmSetMsgHandle(pWrapper, TDMT_VND_RES_READY, qmProcessFetchMsg, QNODE_HANDLE);
|
||||||
dmSetMsgHandle(pWrapper, TDMT_VND_TASKS_STATUS, qmProcessFetchMsg, QNODE_HANDLE);
|
dmSetMsgHandle(pWrapper, TDMT_VND_TASKS_STATUS, qmProcessFetchMsg, QNODE_HANDLE);
|
||||||
|
|
|
@ -115,7 +115,10 @@ typedef enum {
|
||||||
TRN_TYPE_STB_SCOPE_END,
|
TRN_TYPE_STB_SCOPE_END,
|
||||||
} ETrnType;
|
} ETrnType;
|
||||||
|
|
||||||
typedef enum { TRN_POLICY_ROLLBACK = 0, TRN_POLICY_RETRY = 1 } ETrnPolicy;
|
typedef enum {
|
||||||
|
TRN_POLICY_ROLLBACK = 0,
|
||||||
|
TRN_POLICY_RETRY = 1,
|
||||||
|
} ETrnPolicy;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DND_REASON_ONLINE = 0,
|
DND_REASON_ONLINE = 0,
|
||||||
|
@ -131,6 +134,15 @@ typedef enum {
|
||||||
DND_REASON_OTHERS
|
DND_REASON_OTHERS
|
||||||
} EDndReason;
|
} EDndReason;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CONSUMER_UPDATE__TOUCH = 1,
|
||||||
|
CONSUMER_UPDATE__ADD,
|
||||||
|
CONSUMER_UPDATE__REMOVE,
|
||||||
|
CONSUMER_UPDATE__LOST,
|
||||||
|
CONSUMER_UPDATE__RECOVER,
|
||||||
|
CONSUMER_UPDATE__MODIFY,
|
||||||
|
} ECsmUpdateType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t id;
|
int32_t id;
|
||||||
ETrnStage stage;
|
ETrnStage stage;
|
||||||
|
@ -386,7 +398,6 @@ typedef struct {
|
||||||
int32_t codeSize;
|
int32_t codeSize;
|
||||||
char* pComment;
|
char* pComment;
|
||||||
char* pCode;
|
char* pCode;
|
||||||
char pData[];
|
|
||||||
} SFuncObj;
|
} SFuncObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -425,18 +436,8 @@ typedef struct {
|
||||||
int64_t offset;
|
int64_t offset;
|
||||||
} SMqOffsetObj;
|
} SMqOffsetObj;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqOffsetObj(void** buf, const SMqOffsetObj* pOffset) {
|
int32_t tEncodeSMqOffsetObj(void** buf, const SMqOffsetObj* pOffset);
|
||||||
int32_t tlen = 0;
|
void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset);
|
||||||
tlen += taosEncodeString(buf, pOffset->key);
|
|
||||||
tlen += taosEncodeFixedI64(buf, pOffset->offset);
|
|
||||||
return tlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset) {
|
|
||||||
buf = taosDecodeStringTo(buf, pOffset->key);
|
|
||||||
buf = taosDecodeFixedI64(buf, &pOffset->offset);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TOPIC_FNAME_LEN];
|
char name[TSDB_TOPIC_FNAME_LEN];
|
||||||
|
@ -459,15 +460,6 @@ typedef struct {
|
||||||
SSchemaWrapper schema;
|
SSchemaWrapper schema;
|
||||||
} SMqTopicObj;
|
} SMqTopicObj;
|
||||||
|
|
||||||
enum {
|
|
||||||
CONSUMER_UPDATE__TOUCH = 1,
|
|
||||||
CONSUMER_UPDATE__ADD,
|
|
||||||
CONSUMER_UPDATE__REMOVE,
|
|
||||||
CONSUMER_UPDATE__LOST,
|
|
||||||
CONSUMER_UPDATE__RECOVER,
|
|
||||||
CONSUMER_UPDATE__MODIFY,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t consumerId;
|
int64_t consumerId;
|
||||||
char cgroup[TSDB_CGROUP_LEN];
|
char cgroup[TSDB_CGROUP_LEN];
|
||||||
|
@ -475,10 +467,8 @@ typedef struct {
|
||||||
int8_t updateType; // used only for update
|
int8_t updateType; // used only for update
|
||||||
int32_t epoch;
|
int32_t epoch;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
// hbStatus is not applicable to serialization
|
int32_t hbStatus; // hbStatus is not applicable to serialization
|
||||||
int32_t hbStatus;
|
SRWLatch lock; // lock is used for topics update
|
||||||
// lock is used for topics update
|
|
||||||
SRWLatch lock;
|
|
||||||
SArray* currentTopics; // SArray<char*>
|
SArray* currentTopics; // SArray<char*>
|
||||||
SArray* rebNewTopics; // SArray<char*>
|
SArray* rebNewTopics; // SArray<char*>
|
||||||
SArray* rebRemovedTopics; // SArray<char*>
|
SArray* rebRemovedTopics; // SArray<char*>
|
||||||
|
@ -492,7 +482,6 @@ typedef struct {
|
||||||
int64_t upTime;
|
int64_t upTime;
|
||||||
int64_t subscribeTime;
|
int64_t subscribeTime;
|
||||||
int64_t rebalanceTime;
|
int64_t rebalanceTime;
|
||||||
|
|
||||||
} SMqConsumerObj;
|
} SMqConsumerObj;
|
||||||
|
|
||||||
SMqConsumerObj* tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]);
|
SMqConsumerObj* tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]);
|
||||||
|
@ -593,7 +582,6 @@ typedef struct {
|
||||||
int32_t vgNum;
|
int32_t vgNum;
|
||||||
SRWLatch lock;
|
SRWLatch lock;
|
||||||
int8_t status;
|
int8_t status;
|
||||||
// int32_t sqlLen;
|
|
||||||
int8_t createdBy; // STREAM_CREATED_BY__USER or SMA
|
int8_t createdBy; // STREAM_CREATED_BY__USER or SMA
|
||||||
int32_t fixedSinkVgId; // 0 for shuffle
|
int32_t fixedSinkVgId; // 0 for shuffle
|
||||||
int64_t smaId; // 0 for unused
|
int64_t smaId; // 0 for unused
|
||||||
|
|
|
@ -29,7 +29,8 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser);
|
||||||
|
|
||||||
// for trans test
|
// for trans test
|
||||||
SSdbRaw *mndUserActionEncode(SUserObj *pUser);
|
SSdbRaw *mndUserActionEncode(SUserObj *pUser);
|
||||||
int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp, int32_t *pRspLen);
|
int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp,
|
||||||
|
int32_t *pRspLen);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "mndCluster.h"
|
#include "mndCluster.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
|
|
||||||
#define TSDB_CLUSTER_VER_NUMBE 1
|
#define CLUSTER_VER_NUMBE 1
|
||||||
#define TSDB_CLUSTER_RESERVE_SIZE 64
|
#define CLUSTER_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster);
|
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster);
|
||||||
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw);
|
||||||
|
@ -30,14 +30,16 @@ static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock
|
||||||
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter);
|
||||||
|
|
||||||
int32_t mndInitCluster(SMnode *pMnode) {
|
int32_t mndInitCluster(SMnode *pMnode) {
|
||||||
SSdbTable table = {.sdbType = SDB_CLUSTER,
|
SSdbTable table = {
|
||||||
|
.sdbType = SDB_CLUSTER,
|
||||||
.keyType = SDB_KEY_INT64,
|
.keyType = SDB_KEY_INT64,
|
||||||
.deployFp = (SdbDeployFp)mndCreateDefaultCluster,
|
.deployFp = (SdbDeployFp)mndCreateDefaultCluster,
|
||||||
.encodeFp = (SdbEncodeFp)mndClusterActionEncode,
|
.encodeFp = (SdbEncodeFp)mndClusterActionEncode,
|
||||||
.decodeFp = (SdbDecodeFp)mndClusterActionDecode,
|
.decodeFp = (SdbDecodeFp)mndClusterActionDecode,
|
||||||
.insertFp = (SdbInsertFp)mndClusterActionInsert,
|
.insertFp = (SdbInsertFp)mndClusterActionInsert,
|
||||||
.updateFp = (SdbUpdateFp)mndClusterActionUpdate,
|
.updateFp = (SdbUpdateFp)mndClusterActionUpdate,
|
||||||
.deleteFp = (SdbDeleteFp)mndClusterActionDelete};
|
.deleteFp = (SdbDeleteFp)mndClusterActionDelete,
|
||||||
|
};
|
||||||
|
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters);
|
||||||
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster);
|
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster);
|
||||||
|
@ -79,19 +81,19 @@ int64_t mndGetClusterId(SMnode *pMnode) {
|
||||||
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_CLUSTER, TSDB_CLUSTER_VER_NUMBE, sizeof(SClusterObj) + TSDB_CLUSTER_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_CLUSTER, CLUSTER_VER_NUMBE, sizeof(SClusterObj) + CLUSTER_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto CLUSTER_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT64(pRaw, dataPos, pCluster->id, CLUSTER_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pCluster->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pCluster->createdTime, CLUSTER_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pCluster->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pCluster->updateTime, CLUSTER_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pCluster->updateTime, _OVER)
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, CLUSTER_ENCODE_OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_CLUSTER_RESERVE_SIZE, CLUSTER_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
CLUSTER_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("cluster:%" PRId64 ", failed to encode to raw:%p since %s", pCluster->id, pRaw, terrstr());
|
mError("cluster:%" PRId64 ", failed to encode to raw:%p since %s", pCluster->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -106,29 +108,29 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto CLUSTER_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_CLUSTER_VER_NUMBE) {
|
if (sver != CLUSTER_VER_NUMBE) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto CLUSTER_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SClusterObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SClusterObj));
|
||||||
if (pRow == NULL) goto CLUSTER_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SClusterObj *pCluster = sdbGetRowObj(pRow);
|
SClusterObj *pCluster = sdbGetRowObj(pRow);
|
||||||
if (pCluster == NULL) goto CLUSTER_DECODE_OVER;
|
if (pCluster == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pCluster->id, CLUSTER_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pCluster->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pCluster->createdTime, CLUSTER_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pCluster->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pCluster->updateTime, CLUSTER_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pCluster->updateTime, _OVER)
|
||||||
SDB_GET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, CLUSTER_DECODE_OVER)
|
SDB_GET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_CLUSTER_RESERVE_SIZE, CLUSTER_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
CLUSTER_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("cluster:%" PRId64 ", failed to decode from raw:%p since %s", pCluster->id, pRaw, terrstr());
|
mError("cluster:%" PRId64 ", failed to decode from raw:%p since %s", pCluster->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -161,7 +163,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
|
||||||
|
|
||||||
int32_t code = taosGetSystemUUID(clusterObj.name, TSDB_CLUSTER_ID_LEN);
|
int32_t code = taosGetSystemUUID(clusterObj.name, TSDB_CLUSTER_ID_LEN);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
strcpy(clusterObj.name, "tdengine2.0");
|
strcpy(clusterObj.name, "tdengine3.0");
|
||||||
mError("failed to get name from system, set to default val %s", clusterObj.name);
|
mError("failed to get name from system, set to default val %s", clusterObj.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,14 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndDef.h"
|
#include "mndDef.h"
|
||||||
#include "mndConsumer.h"
|
#include "mndConsumer.h"
|
||||||
|
|
||||||
SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]) {
|
SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]) {
|
||||||
SMqConsumerObj *pConsumer = taosMemoryCalloc(1, sizeof(SMqConsumerObj));
|
SMqConsumerObj *pConsumer = taosMemoryCalloc(1, sizeof(SMqConsumerObj));
|
||||||
if (pConsumer == NULL) {
|
if (pConsumer == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,3 +517,16 @@ int32_t tDecodeSStreamObj(SCoder *pDecoder, SStreamObj *pObj) {
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tEncodeSMqOffsetObj(void **buf, const SMqOffsetObj *pOffset) {
|
||||||
|
int32_t tlen = 0;
|
||||||
|
tlen += taosEncodeString(buf, pOffset->key);
|
||||||
|
tlen += taosEncodeFixedI64(buf, pOffset->offset);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tDecodeSMqOffsetObj(void *buf, SMqOffsetObj *pOffset) {
|
||||||
|
buf = taosDecodeStringTo(buf, pOffset->key);
|
||||||
|
buf = taosDecodeFixedI64(buf, &pOffset->offset);
|
||||||
|
return buf;
|
||||||
|
}
|
|
@ -28,8 +28,8 @@
|
||||||
#include "mndVgroup.h"
|
#include "mndVgroup.h"
|
||||||
#include "tname.h"
|
#include "tname.h"
|
||||||
|
|
||||||
#define TSDB_STB_VER_NUMBER 1
|
#define STB_VER_NUMBER 1
|
||||||
#define TSDB_STB_RESERVE_SIZE 64
|
#define STB_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb);
|
static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb);
|
||||||
|
@ -46,13 +46,15 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
static void mndCancelGetNextStb(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextStb(SMnode *pMnode, void *pIter);
|
||||||
|
|
||||||
int32_t mndInitStb(SMnode *pMnode) {
|
int32_t mndInitStb(SMnode *pMnode) {
|
||||||
SSdbTable table = {.sdbType = SDB_STB,
|
SSdbTable table = {
|
||||||
|
.sdbType = SDB_STB,
|
||||||
.keyType = SDB_KEY_BINARY,
|
.keyType = SDB_KEY_BINARY,
|
||||||
.encodeFp = (SdbEncodeFp)mndStbActionEncode,
|
.encodeFp = (SdbEncodeFp)mndStbActionEncode,
|
||||||
.decodeFp = (SdbDecodeFp)mndStbActionDecode,
|
.decodeFp = (SdbDecodeFp)mndStbActionDecode,
|
||||||
.insertFp = (SdbInsertFp)mndStbActionInsert,
|
.insertFp = (SdbInsertFp)mndStbActionInsert,
|
||||||
.updateFp = (SdbUpdateFp)mndStbActionUpdate,
|
.updateFp = (SdbUpdateFp)mndStbActionUpdate,
|
||||||
.deleteFp = (SdbDeleteFp)mndStbActionDelete};
|
.deleteFp = (SdbDeleteFp)mndStbActionDelete,
|
||||||
|
};
|
||||||
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_STB, mndProcessMCreateStbReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_STB, mndProcessMCreateStbReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_ALTER_STB, mndProcessMAlterStbReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_ALTER_STB, mndProcessMAlterStbReq);
|
||||||
|
@ -74,8 +76,8 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + +pStb->commentLen +
|
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + +pStb->commentLen +
|
||||||
pStb->ast1Len + pStb->ast2Len + TSDB_STB_RESERVE_SIZE;
|
pStb->ast1Len + pStb->ast2Len + STB_RESERVE_SIZE;
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_STB, TSDB_STB_VER_NUMBER, size);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_STB, STB_VER_NUMBER, size);
|
||||||
if (pRaw == NULL) goto _OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
|
@ -99,6 +101,7 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
||||||
SSchema *pSchema = &pStb->pColumns[i];
|
SSchema *pSchema = &pStb->pColumns[i];
|
||||||
SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER)
|
SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER)
|
||||||
|
SDB_SET_INT8(pRaw, dataPos, pSchema->flags, _OVER)
|
||||||
SDB_SET_INT16(pRaw, dataPos, pSchema->colId, _OVER)
|
SDB_SET_INT16(pRaw, dataPos, pSchema->colId, _OVER)
|
||||||
SDB_SET_INT32(pRaw, dataPos, pSchema->bytes, _OVER)
|
SDB_SET_INT32(pRaw, dataPos, pSchema->bytes, _OVER)
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||||
|
@ -107,6 +110,7 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
for (int32_t i = 0; i < pStb->numOfTags; ++i) {
|
for (int32_t i = 0; i < pStb->numOfTags; ++i) {
|
||||||
SSchema *pSchema = &pStb->pTags[i];
|
SSchema *pSchema = &pStb->pTags[i];
|
||||||
SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER)
|
SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER)
|
||||||
|
SDB_SET_INT8(pRaw, dataPos, pSchema->flags, _OVER)
|
||||||
SDB_SET_INT16(pRaw, dataPos, pSchema->colId, _OVER)
|
SDB_SET_INT16(pRaw, dataPos, pSchema->colId, _OVER)
|
||||||
SDB_SET_INT32(pRaw, dataPos, pSchema->bytes, _OVER)
|
SDB_SET_INT32(pRaw, dataPos, pSchema->bytes, _OVER)
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||||
|
@ -121,7 +125,7 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
if (pStb->ast2Len > 0) {
|
if (pStb->ast2Len > 0) {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER)
|
||||||
}
|
}
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, _OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, STB_RESERVE_SIZE, _OVER)
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
|
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
@ -143,7 +147,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_STB_VER_NUMBER) {
|
if (sver != STB_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +187,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
||||||
SSchema *pSchema = &pStb->pColumns[i];
|
SSchema *pSchema = &pStb->pColumns[i];
|
||||||
SDB_GET_INT8(pRaw, dataPos, &pSchema->type, _OVER)
|
SDB_GET_INT8(pRaw, dataPos, &pSchema->type, _OVER)
|
||||||
|
SDB_GET_INT8(pRaw, dataPos, &pSchema->flags, _OVER)
|
||||||
SDB_GET_INT16(pRaw, dataPos, &pSchema->colId, _OVER)
|
SDB_GET_INT16(pRaw, dataPos, &pSchema->colId, _OVER)
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pSchema->bytes, _OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pSchema->bytes, _OVER)
|
||||||
SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||||
|
@ -191,6 +196,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
for (int32_t i = 0; i < pStb->numOfTags; ++i) {
|
for (int32_t i = 0; i < pStb->numOfTags; ++i) {
|
||||||
SSchema *pSchema = &pStb->pTags[i];
|
SSchema *pSchema = &pStb->pTags[i];
|
||||||
SDB_GET_INT8(pRaw, dataPos, &pSchema->type, _OVER)
|
SDB_GET_INT8(pRaw, dataPos, &pSchema->type, _OVER)
|
||||||
|
SDB_GET_INT8(pRaw, dataPos, &pSchema->flags, _OVER)
|
||||||
SDB_GET_INT16(pRaw, dataPos, &pSchema->colId, _OVER)
|
SDB_GET_INT16(pRaw, dataPos, &pSchema->colId, _OVER)
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pSchema->bytes, _OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pSchema->bytes, _OVER)
|
||||||
SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||||
|
@ -211,7 +217,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
if (pStb->pAst2 == NULL) goto _OVER;
|
if (pStb->pAst2 == NULL) goto _OVER;
|
||||||
SDB_GET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER)
|
SDB_GET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER)
|
||||||
}
|
}
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, _OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, STB_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
|
@ -488,7 +494,7 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCreate->numOfColumns; ++i) {
|
for (int32_t i = 0; i < pCreate->numOfColumns; ++i) {
|
||||||
SField *pField1 = taosArrayGet(pCreate->pColumns, i);
|
SField *pField1 = taosArrayGet(pCreate->pColumns, i);
|
||||||
if (pField->type < 0) {
|
if (pField1->type < 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -574,6 +580,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_VND_CREATE_STB;
|
action.msgType = TDMT_VND_CREATE_STB;
|
||||||
|
action.acceptableCode = TSDB_CODE_TDB_STB_ALREADY_EXIST;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
@ -613,6 +620,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_VND_DROP_STB;
|
action.msgType = TDMT_VND_DROP_STB;
|
||||||
|
action.acceptableCode = TSDB_CODE_TDB_STB_NOT_EXIST;
|
||||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
sdbCancelFetch(pSdb, pIter);
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
@ -733,6 +741,7 @@ _OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||||
mndTransSetDbInfo(pTrans, pDb);
|
mndTransSetDbInfo(pTrans, pDb);
|
||||||
if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1;
|
if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1;
|
||||||
|
@ -792,7 +801,10 @@ static int32_t mndProcessMCreateStbReq(SNodeMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfStbs = -1;
|
int32_t numOfStbs = -1;
|
||||||
mndGetNumOfStbs(pMnode, pDb->name, &numOfStbs);
|
if (mndGetNumOfStbs(pMnode, pDb->name, &numOfStbs) != 0) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
|
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
|
||||||
terrno = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
|
terrno = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
@ -819,7 +831,7 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndCheckAlterStbReq(SMAltertbReq *pAlter) {
|
static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) {
|
||||||
if (pAlter->numOfFields < 1 || pAlter->numOfFields != (int32_t)taosArrayGetSize(pAlter->pFields)) {
|
if (pAlter->numOfFields < 1 || pAlter->numOfFields != (int32_t)taosArrayGetSize(pAlter->pFields)) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1170,7 +1182,7 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAltertbReq *pAlter, SDbObj *pDb, SStbObj *pOld) {
|
static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAlterStbReq *pAlter, SDbObj *pDb, SStbObj *pOld) {
|
||||||
SStbObj stbObj = {0};
|
SStbObj stbObj = {0};
|
||||||
taosRLockLatch(&pOld->lock);
|
taosRLockLatch(&pOld->lock);
|
||||||
memcpy(&stbObj, pOld, sizeof(SStbObj));
|
memcpy(&stbObj, pOld, sizeof(SStbObj));
|
||||||
|
@ -1239,7 +1251,7 @@ static int32_t mndProcessMAlterStbReq(SNodeMsg *pReq) {
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
SStbObj *pStb = NULL;
|
SStbObj *pStb = NULL;
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMAltertbReq alterReq = {0};
|
SMAlterStbReq alterReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMAlterStbReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &alterReq) != 0) {
|
if (tDeserializeSMAlterStbReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &alterReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
|
|
@ -345,7 +345,10 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfStbs = -1;
|
int32_t numOfStbs = -1;
|
||||||
mndGetNumOfStbs(pMnode, pDb->name, &numOfStbs);
|
if (mndGetNumOfStbs(pMnode, pDb->name, &numOfStbs) != 0) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
|
if (pDb->cfg.numOfStables == 1 && numOfStbs != 0) {
|
||||||
terrno = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
|
terrno = TSDB_CODE_MND_SINGLE_STB_MODE_DB;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
|
@ -137,7 +137,7 @@ void* MndTestStb::BuildCreateStbReq(const char* stbname, int32_t* pContLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbAddTagReq(const char* stbname, const char* tagname, int32_t* pContLen) {
|
void* MndTestStb::BuildAlterStbAddTagReq(const char* stbname, const char* tagname, int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
@ -158,7 +158,7 @@ void* MndTestStb::BuildAlterStbAddTagReq(const char* stbname, const char* tagnam
|
||||||
}
|
}
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbDropTagReq(const char* stbname, const char* tagname, int32_t* pContLen) {
|
void* MndTestStb::BuildAlterStbDropTagReq(const char* stbname, const char* tagname, int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
@ -180,7 +180,7 @@ void* MndTestStb::BuildAlterStbDropTagReq(const char* stbname, const char* tagna
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbUpdateTagNameReq(const char* stbname, const char* tagname, const char* newtagname,
|
void* MndTestStb::BuildAlterStbUpdateTagNameReq(const char* stbname, const char* tagname, const char* newtagname,
|
||||||
int32_t* pContLen) {
|
int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 2;
|
req.numOfFields = 2;
|
||||||
req.pFields = taosArrayInit(2, sizeof(SField));
|
req.pFields = taosArrayInit(2, sizeof(SField));
|
||||||
|
@ -208,7 +208,7 @@ void* MndTestStb::BuildAlterStbUpdateTagNameReq(const char* stbname, const char*
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbUpdateTagBytesReq(const char* stbname, const char* tagname, int32_t bytes,
|
void* MndTestStb::BuildAlterStbUpdateTagBytesReq(const char* stbname, const char* tagname, int32_t bytes,
|
||||||
int32_t* pContLen) {
|
int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
@ -229,7 +229,7 @@ void* MndTestStb::BuildAlterStbUpdateTagBytesReq(const char* stbname, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbAddColumnReq(const char* stbname, const char* colname, int32_t* pContLen) {
|
void* MndTestStb::BuildAlterStbAddColumnReq(const char* stbname, const char* colname, int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
@ -250,7 +250,7 @@ void* MndTestStb::BuildAlterStbAddColumnReq(const char* stbname, const char* col
|
||||||
}
|
}
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbDropColumnReq(const char* stbname, const char* colname, int32_t* pContLen) {
|
void* MndTestStb::BuildAlterStbDropColumnReq(const char* stbname, const char* colname, int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
@ -272,7 +272,7 @@ void* MndTestStb::BuildAlterStbDropColumnReq(const char* stbname, const char* co
|
||||||
|
|
||||||
void* MndTestStb::BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes,
|
void* MndTestStb::BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes,
|
||||||
int32_t* pContLen) {
|
int32_t* pContLen) {
|
||||||
SMAltertbReq req = {0};
|
SMAlterStbReq req = {0};
|
||||||
strcpy(req.name, stbname);
|
strcpy(req.name, stbname);
|
||||||
req.numOfFields = 1;
|
req.numOfFields = 1;
|
||||||
req.pFields = taosArrayInit(1, sizeof(SField));
|
req.pFields = taosArrayInit(1, sizeof(SField));
|
||||||
|
|
|
@ -84,6 +84,8 @@ int32_t qndProcessFetchMsg(SQnode *pQnode, SRpcMsg *pMsg) {
|
||||||
// return vnodeGetTableMeta(pQnode, pMsg);
|
// return vnodeGetTableMeta(pQnode, pMsg);
|
||||||
case TDMT_VND_CONSUME:
|
case TDMT_VND_CONSUME:
|
||||||
// return tqProcessConsumeReq(pQnode->pTq, pMsg);
|
// return tqProcessConsumeReq(pQnode->pTq, pMsg);
|
||||||
|
case TDMT_VND_QUERY_HEARTBEAT:
|
||||||
|
return qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg);
|
||||||
default:
|
default:
|
||||||
qError("unknown msg type:%d in fetch queue", pMsg->msgType);
|
qError("unknown msg type:%d in fetch queue", pMsg->msgType);
|
||||||
return TSDB_CODE_VND_APP_ERROR;
|
return TSDB_CODE_VND_APP_ERROR;
|
||||||
|
|
|
@ -325,10 +325,15 @@ typedef struct SExchangeInfo {
|
||||||
SLoadRemoteDataInfo loadInfo;
|
SLoadRemoteDataInfo loadInfo;
|
||||||
} SExchangeInfo;
|
} SExchangeInfo;
|
||||||
|
|
||||||
|
#define COL_MATCH_FROM_COL_ID 0x1
|
||||||
|
#define COL_MATCH_FROM_SLOT_ID 0x2
|
||||||
|
|
||||||
typedef struct SColMatchInfo {
|
typedef struct SColMatchInfo {
|
||||||
|
int32_t srcSlotId; // source slot id
|
||||||
int32_t colId;
|
int32_t colId;
|
||||||
int32_t targetSlotId;
|
int32_t targetSlotId;
|
||||||
bool output;
|
bool output;
|
||||||
|
int32_t matchType; // determinate the source according to col id or slot id
|
||||||
} SColMatchInfo;
|
} SColMatchInfo;
|
||||||
|
|
||||||
typedef struct SScanInfo {
|
typedef struct SScanInfo {
|
||||||
|
|
|
@ -60,4 +60,5 @@ void dsScheduleProcess(void* ahandle, void* pItem) {
|
||||||
void dsDestroyDataSinker(DataSinkHandle handle) {
|
void dsDestroyDataSinker(DataSinkHandle handle) {
|
||||||
SDataSinkHandle* pHandleImpl = (SDataSinkHandle*)handle;
|
SDataSinkHandle* pHandleImpl = (SDataSinkHandle*)handle;
|
||||||
pHandleImpl->fDestroy(pHandleImpl);
|
pHandleImpl->fDestroy(pHandleImpl);
|
||||||
|
taosMemoryFree(pHandleImpl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4687,7 +4687,7 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
|
||||||
|
|
||||||
char* p = taosMemoryCalloc(1, 128);
|
char* p = taosMemoryCalloc(1, 128);
|
||||||
snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
|
snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
|
||||||
pTaskInfo->id.str = strdup(p);
|
pTaskInfo->id.str = p;
|
||||||
|
|
||||||
return pTaskInfo;
|
return pTaskInfo;
|
||||||
}
|
}
|
||||||
|
@ -4699,10 +4699,9 @@ static int32_t doCreateTableGroup(void* metaHandle, int32_t tableType, uint64_t
|
||||||
uint64_t queryId, uint64_t taskId);
|
uint64_t queryId, uint64_t taskId);
|
||||||
static SArray* extractTableIdList(const STableGroupInfo* pTableGroupInfo);
|
static SArray* extractTableIdList(const STableGroupInfo* pTableGroupInfo);
|
||||||
static SArray* extractColumnInfo(SNodeList* pNodeList);
|
static SArray* extractColumnInfo(SNodeList* pNodeList);
|
||||||
static SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols);
|
static SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, int32_t type);
|
||||||
|
|
||||||
static SArray* createSortInfo(SNodeList* pNodeList);
|
static SArray* createSortInfo(SNodeList* pNodeList);
|
||||||
static SArray* createIndexMap(SNodeList* pNodeList);
|
|
||||||
static SArray* extractPartitionColInfo(SNodeList* pNodeList);
|
static SArray* extractPartitionColInfo(SNodeList* pNodeList);
|
||||||
static int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode);
|
static int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode);
|
||||||
static void setJoinColumnInfo(SColumnInfo* pInfo, const SColumnNode* pLeftNode);
|
static void setJoinColumnInfo(SColumnInfo* pInfo, const SColumnNode* pLeftNode);
|
||||||
|
@ -4734,9 +4733,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* pColList =
|
SDataBlockDescNode* pDescNode = pScanPhyNode->node.pOutputDataBlockDesc;
|
||||||
extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols);
|
|
||||||
SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc);
|
SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID);
|
||||||
|
SSDataBlock* pResBlock = createResDataBlock(pDescNode);
|
||||||
|
|
||||||
SQueryTableDataCond cond = {0};
|
SQueryTableDataCond cond = {0};
|
||||||
int32_t code = initQueryTableDataCond(&cond, pTableScanNode);
|
int32_t code = initQueryTableDataCond(&cond, pTableScanNode);
|
||||||
|
@ -4761,10 +4761,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
int32_t code = doCreateTableGroup(pHandle->meta, pScanPhyNode->tableType, pScanPhyNode->uid, pTableGroupInfo, queryId, taskId);
|
int32_t code = doCreateTableGroup(pHandle->meta, pScanPhyNode->tableType, pScanPhyNode->uid, pTableGroupInfo, queryId, taskId);
|
||||||
SArray* tableIdList = extractTableIdList(pTableGroupInfo);
|
SArray* tableIdList = extractTableIdList(pTableGroupInfo);
|
||||||
|
|
||||||
SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc);
|
SDataBlockDescNode* pDescNode = pScanPhyNode->node.pOutputDataBlockDesc;
|
||||||
|
SSDataBlock* pResBlock = createResDataBlock(pDescNode);
|
||||||
|
|
||||||
int32_t numOfCols = 0;
|
int32_t numOfCols = 0;
|
||||||
SArray* pCols = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols);
|
SArray* pCols = extractColMatchInfo(pScanPhyNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID);
|
||||||
SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pResBlock, pCols, tableIdList, pTaskInfo,
|
SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pResBlock, pCols, tableIdList, pTaskInfo,
|
||||||
pScanPhyNode->node.pConditions);
|
pScanPhyNode->node.pConditions);
|
||||||
taosArrayDestroy(tableIdList);
|
taosArrayDestroy(tableIdList);
|
||||||
|
@ -4773,18 +4774,22 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
SSystemTableScanPhysiNode* pSysScanPhyNode = (SSystemTableScanPhysiNode*)pPhyNode;
|
SSystemTableScanPhysiNode* pSysScanPhyNode = (SSystemTableScanPhysiNode*)pPhyNode;
|
||||||
SScanPhysiNode* pScanNode = &pSysScanPhyNode->scan;
|
SScanPhysiNode* pScanNode = &pSysScanPhyNode->scan;
|
||||||
|
|
||||||
SSDataBlock* pResBlock = createResDataBlock(pScanNode->node.pOutputDataBlockDesc);
|
SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc;
|
||||||
|
|
||||||
|
SSDataBlock* pResBlock = createResDataBlock(pDescNode);
|
||||||
|
|
||||||
int32_t numOfOutputCols = 0;
|
int32_t numOfOutputCols = 0;
|
||||||
SArray* colList =
|
SArray* colList = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfOutputCols, COL_MATCH_FROM_COL_ID);
|
||||||
extractColMatchInfo(pScanNode->pScanCols, pScanNode->node.pOutputDataBlockDesc, &numOfOutputCols);
|
|
||||||
SOperatorInfo* pOperator = createSysTableScanOperatorInfo(
|
SOperatorInfo* pOperator = createSysTableScanOperatorInfo(
|
||||||
pHandle, pResBlock, &pScanNode->tableName, pScanNode->node.pConditions, pSysScanPhyNode->mgmtEpSet, colList,
|
pHandle, pResBlock, &pScanNode->tableName, pScanNode->node.pConditions, pSysScanPhyNode->mgmtEpSet, colList,
|
||||||
pTaskInfo, pSysScanPhyNode->showRewrite, pSysScanPhyNode->accountId);
|
pTaskInfo, pSysScanPhyNode->showRewrite, pSysScanPhyNode->accountId);
|
||||||
return pOperator;
|
return pOperator;
|
||||||
} else if (QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN == type) {
|
} else if (QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN == type) {
|
||||||
STagScanPhysiNode* pScanPhyNode = (STagScanPhysiNode*) pPhyNode;
|
STagScanPhysiNode* pScanPhyNode = (STagScanPhysiNode*) pPhyNode;
|
||||||
SSDataBlock* pResBlock = createResDataBlock(pScanPhyNode->node.pOutputDataBlockDesc);
|
|
||||||
|
SDataBlockDescNode* pDescNode = pScanPhyNode->node.pOutputDataBlockDesc;
|
||||||
|
|
||||||
|
SSDataBlock* pResBlock = createResDataBlock(pDescNode);
|
||||||
|
|
||||||
int32_t code =
|
int32_t code =
|
||||||
doCreateTableGroup(pHandle->meta, pScanPhyNode->tableType, pScanPhyNode->uid, pTableGroupInfo, queryId, taskId);
|
doCreateTableGroup(pHandle->meta, pScanPhyNode->tableType, pScanPhyNode->uid, pTableGroupInfo, queryId, taskId);
|
||||||
|
@ -4796,8 +4801,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
SExprInfo* pExprInfo = createExprInfo(pScanPhyNode->pScanPseudoCols, NULL, &num);
|
SExprInfo* pExprInfo = createExprInfo(pScanPhyNode->pScanPseudoCols, NULL, &num);
|
||||||
|
|
||||||
int32_t numOfOutputCols = 0;
|
int32_t numOfOutputCols = 0;
|
||||||
SArray* colList =
|
SArray* colList = extractColMatchInfo(pScanPhyNode->pScanPseudoCols, pDescNode, &numOfOutputCols, COL_MATCH_FROM_COL_ID);
|
||||||
extractColMatchInfo(pScanPhyNode->pScanPseudoCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfOutputCols);
|
|
||||||
|
|
||||||
SOperatorInfo* pOperator = createTagScanOperatorInfo(pHandle, pExprInfo, num, pResBlock, colList, pTableGroupInfo, pTaskInfo);
|
SOperatorInfo* pOperator = createTagScanOperatorInfo(pHandle, pExprInfo, num, pResBlock, colList, pTableGroupInfo, pTaskInfo);
|
||||||
return pOperator;
|
return pOperator;
|
||||||
|
@ -4869,15 +4873,16 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
} else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) {
|
} else if (QUERY_NODE_PHYSICAL_PLAN_SORT == type) {
|
||||||
SSortPhysiNode* pSortPhyNode = (SSortPhysiNode*)pPhyNode;
|
SSortPhysiNode* pSortPhyNode = (SSortPhysiNode*)pPhyNode;
|
||||||
|
|
||||||
SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
|
SDataBlockDescNode* pDescNode = pPhyNode->pOutputDataBlockDesc;
|
||||||
|
|
||||||
|
SSDataBlock* pResBlock = createResDataBlock(pDescNode);
|
||||||
SArray* info = createSortInfo(pSortPhyNode->pSortKeys);
|
SArray* info = createSortInfo(pSortPhyNode->pSortKeys);
|
||||||
|
|
||||||
int32_t numOfCols = 0;
|
int32_t numOfCols = 0;
|
||||||
SExprInfo* pExprInfo = createExprInfo(pSortPhyNode->pExprs, NULL, &numOfCols);
|
SExprInfo* pExprInfo = createExprInfo(pSortPhyNode->pExprs, NULL, &numOfCols);
|
||||||
|
|
||||||
int32_t numOfOutputCols = 0;
|
int32_t numOfOutputCols = 0;
|
||||||
SArray* pColList =
|
SArray* pColList = extractColMatchInfo(pSortPhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID);
|
||||||
extractColMatchInfo(pSortPhyNode->pTargets, pSortPhyNode->node.pOutputDataBlockDesc, &numOfOutputCols);
|
|
||||||
|
|
||||||
pOptr = createSortOperatorInfo(ops[0], pResBlock, info, pExprInfo, numOfCols, pColList, pTaskInfo);
|
pOptr = createSortOperatorInfo(ops[0], pResBlock, info, pExprInfo, numOfCols, pColList, pTaskInfo);
|
||||||
} else if (QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW == type) {
|
} else if (QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW == type) {
|
||||||
|
@ -5059,25 +5064,7 @@ SArray* createSortInfo(SNodeList* pNodeList) {
|
||||||
return pList;
|
return pList;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* createIndexMap(SNodeList* pNodeList) {
|
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, int32_t type) {
|
||||||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
|
||||||
SArray* pList = taosArrayInit(numOfCols, sizeof(int32_t));
|
|
||||||
if (pList == NULL) {
|
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
return pList;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
|
||||||
STargetNode* pTarget = (STargetNode*)nodesListGetNode(pNodeList, i);
|
|
||||||
|
|
||||||
SColumnNode* pColNode = (SColumnNode*)pTarget->pExpr;
|
|
||||||
taosArrayPush(pList, &pColNode->slotId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pList;
|
|
||||||
}
|
|
||||||
|
|
||||||
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols) {
|
|
||||||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
size_t numOfCols = LIST_LENGTH(pNodeList);
|
||||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SColMatchInfo));
|
SArray* pList = taosArrayInit(numOfCols, sizeof(SColMatchInfo));
|
||||||
if (pList == NULL) {
|
if (pList == NULL) {
|
||||||
|
@ -5092,6 +5079,8 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
|
||||||
SColMatchInfo c = {0};
|
SColMatchInfo c = {0};
|
||||||
c.output = true;
|
c.output = true;
|
||||||
c.colId = pColNode->colId;
|
c.colId = pColNode->colId;
|
||||||
|
c.srcSlotId = pColNode->slotId;
|
||||||
|
c.matchType = type;
|
||||||
c.targetSlotId = pNode->slotId;
|
c.targetSlotId = pNode->slotId;
|
||||||
taosArrayPush(pList, &c);
|
taosArrayPush(pList, &c);
|
||||||
}
|
}
|
||||||
|
@ -5301,6 +5290,7 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) {
|
||||||
// taosArrayDestroy(pTaskInfo->summary.queryProfEvents);
|
// taosArrayDestroy(pTaskInfo->summary.queryProfEvents);
|
||||||
// taosHashCleanup(pTaskInfo->summary.operatorProfResults);
|
// taosHashCleanup(pTaskInfo->summary.operatorProfResults);
|
||||||
|
|
||||||
|
destroyOperatorInfo(pTaskInfo->pRoot);
|
||||||
taosMemoryFreeClear(pTaskInfo->sql);
|
taosMemoryFreeClear(pTaskInfo->sql);
|
||||||
taosMemoryFreeClear(pTaskInfo->id.str);
|
taosMemoryFreeClear(pTaskInfo->id.str);
|
||||||
taosMemoryFreeClear(pTaskInfo);
|
taosMemoryFreeClear(pTaskInfo);
|
||||||
|
|
|
@ -129,6 +129,7 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData
|
||||||
char* val = colDataGetData(pColInfoData, rowIndex);
|
char* val = colDataGetData(pColInfoData, rowIndex);
|
||||||
if (IS_VAR_DATA_TYPE(pkey->type)) {
|
if (IS_VAR_DATA_TYPE(pkey->type)) {
|
||||||
memcpy(pkey->pData, val, varDataTLen(val));
|
memcpy(pkey->pData, val, varDataTLen(val));
|
||||||
|
ASSERT(varDataTLen(val) <= pkey->bytes);
|
||||||
} else {
|
} else {
|
||||||
memcpy(pkey->pData, val, pkey->bytes);
|
memcpy(pkey->pData, val, pkey->bytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,15 +89,11 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
|
||||||
int32_t numOfCols = taosArrayGetSize(pColMatchInfo);
|
int32_t numOfCols = taosArrayGetSize(pColMatchInfo);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i);
|
SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i);
|
||||||
|
ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID);
|
||||||
|
|
||||||
for(int32_t j = 0; j < p->info.numOfCols; ++j) {
|
SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId);
|
||||||
SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, j);
|
|
||||||
if (pSrc->info.colId == pmInfo->colId) {
|
|
||||||
SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->targetSlotId);
|
SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->targetSlotId);
|
||||||
colDataAssign(pDst, pSrc, p->info.rows);
|
colDataAssign(pDst, pSrc, p->info.rows);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pDataBlock->info.rows = p->info.rows;
|
pDataBlock->info.rows = p->info.rows;
|
||||||
|
|
|
@ -241,7 +241,7 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE };
|
pFunc->node.resType = (SDataType) { .bytes = 512, .type = TSDB_DATA_TYPE_BINARY };
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "builtinsimpl.h"
|
#include "builtinsimpl.h"
|
||||||
|
#include "cJSON.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
#include "querynodes.h"
|
#include "querynodes.h"
|
||||||
#include "taggfunction.h"
|
#include "taggfunction.h"
|
||||||
|
@ -106,6 +107,13 @@ typedef struct SHistoFuncInfo {
|
||||||
SHistoFuncBin bins[];
|
SHistoFuncBin bins[];
|
||||||
} SHistoFuncInfo;
|
} SHistoFuncInfo;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
UNKNOWN_BIN = 0,
|
||||||
|
USER_INPUT_BIN,
|
||||||
|
LINEAR_BIN,
|
||||||
|
LOG_BIN
|
||||||
|
} EHistoBinType;
|
||||||
|
|
||||||
|
|
||||||
#define SET_VAL(_info, numOfElem, res) \
|
#define SET_VAL(_info, numOfElem, res) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -1801,28 +1809,225 @@ bool getHistogramFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int8_t getHistogramBinType(char *binTypeStr) {
|
||||||
|
int8_t binType;
|
||||||
|
if (strcasecmp(binTypeStr, "user_input") == 0) {
|
||||||
|
binType = USER_INPUT_BIN;
|
||||||
|
} else if (strcasecmp(binTypeStr, "linear_bin") == 0) {
|
||||||
|
binType = LINEAR_BIN;
|
||||||
|
} else if (strcasecmp(binTypeStr, "log_bin") == 0) {
|
||||||
|
binType = LOG_BIN;
|
||||||
|
} else {
|
||||||
|
binType = UNKNOWN_BIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return binType;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool getHistogramBinDesc(SHistoFuncInfo *pInfo, char *binDescStr, int8_t binType, bool normalized) {
|
||||||
|
cJSON* binDesc = cJSON_Parse(binDescStr);
|
||||||
|
int32_t numOfBins;
|
||||||
|
double* intervals;
|
||||||
|
if (cJSON_IsObject(binDesc)) { /* linaer/log bins */
|
||||||
|
int32_t numOfParams = cJSON_GetArraySize(binDesc);
|
||||||
|
int32_t startIndex;
|
||||||
|
if (numOfParams != 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON* start = cJSON_GetObjectItem(binDesc, "start");
|
||||||
|
cJSON* factor = cJSON_GetObjectItem(binDesc, "factor");
|
||||||
|
cJSON* width = cJSON_GetObjectItem(binDesc, "width");
|
||||||
|
cJSON* count = cJSON_GetObjectItem(binDesc, "count");
|
||||||
|
cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity");
|
||||||
|
|
||||||
|
if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) ||
|
||||||
|
(factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t counter = (int32_t)count->valueint;
|
||||||
|
if (infinity->valueint == false) {
|
||||||
|
startIndex = 0;
|
||||||
|
numOfBins = counter + 1;
|
||||||
|
} else {
|
||||||
|
startIndex = 1;
|
||||||
|
numOfBins = counter + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
intervals = taosMemoryCalloc(numOfBins, sizeof(double));
|
||||||
|
if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) {
|
||||||
|
// linear bin process
|
||||||
|
if (width->valuedouble == 0) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < counter + 1; ++i) {
|
||||||
|
intervals[startIndex] = start->valuedouble + i * width->valuedouble;
|
||||||
|
if (isinf(intervals[startIndex])) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
startIndex++;
|
||||||
|
}
|
||||||
|
} else if (cJSON_IsNumber(factor) && width == NULL && binType == LOG_BIN) {
|
||||||
|
// log bin process
|
||||||
|
if (start->valuedouble == 0) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < counter + 1; ++i) {
|
||||||
|
intervals[startIndex] = start->valuedouble * pow(factor->valuedouble, i * 1.0);
|
||||||
|
if (isinf(intervals[startIndex])) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
startIndex++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infinity->valueint == true) {
|
||||||
|
intervals[0] = -INFINITY;
|
||||||
|
intervals[numOfBins - 1] = INFINITY;
|
||||||
|
// in case of desc bin orders, -inf/inf should be swapped
|
||||||
|
ASSERT(numOfBins >= 4);
|
||||||
|
if (intervals[1] > intervals[numOfBins - 2]) {
|
||||||
|
TSWAP(intervals[0], intervals[numOfBins - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cJSON_IsArray(binDesc)) { /* user input bins */
|
||||||
|
if (binType != USER_INPUT_BIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
numOfBins = cJSON_GetArraySize(binDesc);
|
||||||
|
intervals = taosMemoryCalloc(numOfBins, sizeof(double));
|
||||||
|
cJSON* bin = binDesc->child;
|
||||||
|
if (bin == NULL) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
while (bin) {
|
||||||
|
intervals[i] = bin->valuedouble;
|
||||||
|
if (!cJSON_IsNumber(bin)) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (i != 0 && intervals[i] <= intervals[i - 1]) {
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bin = bin->next;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pInfo->numOfBins = numOfBins - 1;
|
||||||
|
pInfo->normalized = normalized;
|
||||||
|
for (int32_t i = 0; i < pInfo->numOfBins; ++i) {
|
||||||
|
pInfo->bins[i].lower = intervals[i] < intervals[i + 1] ? intervals[i] : intervals[i + 1];
|
||||||
|
pInfo->bins[i].upper = intervals[i + 1] > intervals[i] ? intervals[i + 1] : intervals[i];
|
||||||
|
pInfo->bins[i].count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFree(intervals);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool histogramFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) {
|
bool histogramFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) {
|
||||||
if (!functionSetup(pCtx, pResultInfo)) {
|
if (!functionSetup(pCtx, pResultInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHistoFuncInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
SHistoFuncInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo);
|
||||||
char* binType = pCtx->param[1].param.pz;
|
|
||||||
char* binDesc = pCtx->param[2].param.pz;
|
|
||||||
int64_t nornalized = pCtx->param[3].param.i;
|
|
||||||
|
|
||||||
|
int8_t binType = getHistogramBinType(varDataVal(pCtx->param[1].param.pz));
|
||||||
|
if (binType == UNKNOWN_BIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
char* binDesc = varDataVal(pCtx->param[2].param.pz);
|
||||||
|
int64_t normalized = pCtx->param[3].param.i;
|
||||||
|
if (!getHistogramBinDesc(pInfo, binDesc, binType, (bool)normalized)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t histogramFunction(SqlFunctionCtx *pCtx) {
|
int32_t histogramFunction(SqlFunctionCtx *pCtx) {
|
||||||
|
int32_t numOfElems = 0;
|
||||||
|
SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
|
||||||
|
|
||||||
|
SInputColumnInfoData* pInput = &pCtx->input;
|
||||||
|
SColumnInfoData* pCol = pInput->pData[0];
|
||||||
|
|
||||||
|
int32_t type = pInput->pData[0]->info.type;
|
||||||
|
|
||||||
|
int32_t start = pInput->startRowIndex;
|
||||||
|
int32_t numOfRows = pInput->numOfRows;
|
||||||
|
|
||||||
|
for (int32_t i = start; i < numOfRows + start; ++i) {
|
||||||
|
if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
numOfElems++;
|
||||||
|
|
||||||
|
char* data = colDataGetData(pCol, i);
|
||||||
|
double v;
|
||||||
|
GET_TYPED_DATA(v, double, type, data);
|
||||||
|
|
||||||
|
for (int32_t k = 0; k < pInfo->numOfBins; ++k) {
|
||||||
|
if (v > pInfo->bins[k].lower && v <= pInfo->bins[k].upper) {
|
||||||
|
pInfo->bins[k].count++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_VAL(GET_RES_INFO(pCtx), numOfElems, pInfo->numOfBins);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
|
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||||
SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
|
SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
|
||||||
//if (pInfo->hasResult == true) {
|
int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
|
||||||
// SET_DOUBLE_VAL(&pInfo->result, pInfo->max - pInfo->min);
|
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
||||||
//}
|
|
||||||
return functionFinalize(pCtx, pBlock);
|
int32_t currentRow = pBlock->info.rows;
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < pResInfo->numOfRes; ++i) {
|
||||||
|
int32_t len;
|
||||||
|
char buf[512] = {0};
|
||||||
|
if (!pInfo->normalized) {
|
||||||
|
len = sprintf(buf + VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%"PRId64"}",
|
||||||
|
pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].count);
|
||||||
|
} else {
|
||||||
|
len = sprintf(buf + VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}",
|
||||||
|
pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].percentage);
|
||||||
|
}
|
||||||
|
varDataSetLen(buf, len);
|
||||||
|
colDataAppend(pCol, currentRow, buf, false);
|
||||||
|
currentRow++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pResInfo->numOfRes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1337,7 +1337,9 @@ void valueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
|
||||||
case TSDB_DATA_TYPE_NCHAR:
|
case TSDB_DATA_TYPE_NCHAR:
|
||||||
case TSDB_DATA_TYPE_VARCHAR:
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
case TSDB_DATA_TYPE_VARBINARY:
|
case TSDB_DATA_TYPE_VARBINARY:
|
||||||
pVal->pz = pNode->datum.p;
|
pVal->pz = taosMemoryMalloc(pVal->nLen + VARSTR_HEADER_SIZE + 1);
|
||||||
|
memcpy(pVal->pz, pNode->datum.p, pVal->nLen + VARSTR_HEADER_SIZE);
|
||||||
|
pVal->pz[pVal->nLen + VARSTR_HEADER_SIZE] = 0;
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_JSON:
|
case TSDB_DATA_TYPE_JSON:
|
||||||
case TSDB_DATA_TYPE_DECIMAL:
|
case TSDB_DATA_TYPE_DECIMAL:
|
||||||
|
|
|
@ -2596,7 +2596,7 @@ static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableS
|
||||||
pStmt->ignoreNotExists);
|
pStmt->ignoreNotExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t setAlterTableField(SAlterTableStmt* pStmt, SMAltertbReq* pAlterReq) {
|
static int32_t setAlterTableField(SAlterTableStmt* pStmt, SMAlterStbReq* pAlterReq) {
|
||||||
pAlterReq->pFields = taosArrayInit(2, sizeof(TAOS_FIELD));
|
pAlterReq->pFields = taosArrayInit(2, sizeof(TAOS_FIELD));
|
||||||
if (NULL == pAlterReq->pFields) {
|
if (NULL == pAlterReq->pFields) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -2632,7 +2632,7 @@ static int32_t setAlterTableField(SAlterTableStmt* pStmt, SMAltertbReq* pAlterRe
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateAlterTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) {
|
static int32_t translateAlterTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) {
|
||||||
SMAltertbReq alterReq = {0};
|
SMAlterStbReq alterReq = {0};
|
||||||
SName tableName;
|
SName tableName;
|
||||||
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), alterReq.name);
|
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), alterReq.name);
|
||||||
alterReq.alterType = pStmt->alterType;
|
alterReq.alterType = pStmt->alterType;
|
||||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
||||||
#include "tlockfree.h"
|
#include "tlockfree.h"
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
#include "tref.h"
|
#include "tref.h"
|
||||||
|
#include "plannodes.h"
|
||||||
|
|
||||||
#define QW_DEFAULT_SCHEDULER_NUMBER 10000
|
#define QW_DEFAULT_SCHEDULER_NUMBER 10000
|
||||||
#define QW_DEFAULT_TASK_NUMBER 10000
|
#define QW_DEFAULT_TASK_NUMBER 10000
|
||||||
|
@ -133,6 +134,7 @@ typedef struct SQWTaskCtx {
|
||||||
|
|
||||||
void *taskHandle;
|
void *taskHandle;
|
||||||
void *sinkHandle;
|
void *sinkHandle;
|
||||||
|
SSubplan *plan;
|
||||||
} SQWTaskCtx;
|
} SQWTaskCtx;
|
||||||
|
|
||||||
typedef struct SQWSchStatus {
|
typedef struct SQWSchStatus {
|
||||||
|
|
|
@ -424,6 +424,11 @@ void qwFreeTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
|
||||||
dsDestroyDataSinker(ctx->sinkHandle);
|
dsDestroyDataSinker(ctx->sinkHandle);
|
||||||
ctx->sinkHandle = NULL;
|
ctx->sinkHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->plan) {
|
||||||
|
nodesDestroyNode(ctx->plan);
|
||||||
|
ctx->plan = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
|
int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
|
||||||
|
@ -440,6 +445,7 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
|
||||||
|
|
||||||
atomic_store_ptr(&ctx->taskHandle, NULL);
|
atomic_store_ptr(&ctx->taskHandle, NULL);
|
||||||
atomic_store_ptr(&ctx->sinkHandle, NULL);
|
atomic_store_ptr(&ctx->sinkHandle, NULL);
|
||||||
|
atomic_store_ptr(&ctx->plan, NULL);
|
||||||
|
|
||||||
QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_DROP);
|
QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_DROP);
|
||||||
|
|
||||||
|
@ -922,7 +928,7 @@ _return:
|
||||||
int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t explain) {
|
int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t explain) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
bool queryRsped = false;
|
bool queryRsped = false;
|
||||||
struct SSubplan *plan = NULL;
|
SSubplan* plan = NULL;
|
||||||
SQWPhaseInput input = {0};
|
SQWPhaseInput input = {0};
|
||||||
qTaskInfo_t pTaskInfo = NULL;
|
qTaskInfo_t pTaskInfo = NULL;
|
||||||
DataSinkHandle sinkHandle = NULL;
|
DataSinkHandle sinkHandle = NULL;
|
||||||
|
@ -950,6 +956,8 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex
|
||||||
QW_ERR_JRET(code);
|
QW_ERR_JRET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->plan = plan;
|
||||||
|
|
||||||
code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, OPTR_EXEC_MODEL_BATCH);
|
code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, OPTR_EXEC_MODEL_BATCH);
|
||||||
if (code) {
|
if (code) {
|
||||||
QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code));
|
QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code));
|
||||||
|
@ -1428,6 +1436,10 @@ void qwCloseRef(void) {
|
||||||
taosWUnLockLatch(&gQwMgmt.lock);
|
taosWUnLockLatch(&gQwMgmt.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qwDestroySchStatus(SQWSchStatus *pStatus) {
|
||||||
|
taosHashCleanup(pStatus->tasksHash);
|
||||||
|
}
|
||||||
|
|
||||||
void qwDestroyImpl(void *pMgmt) {
|
void qwDestroyImpl(void *pMgmt) {
|
||||||
SQWorker *mgmt = (SQWorker *)pMgmt;
|
SQWorker *mgmt = (SQWorker *)pMgmt;
|
||||||
|
|
||||||
|
@ -1439,6 +1451,13 @@ void qwDestroyImpl(void *pMgmt) {
|
||||||
// TODO FREE ALL
|
// TODO FREE ALL
|
||||||
|
|
||||||
taosHashCleanup(mgmt->ctxHash);
|
taosHashCleanup(mgmt->ctxHash);
|
||||||
|
|
||||||
|
void *pIter = taosHashIterate(mgmt->schHash, NULL);
|
||||||
|
while (pIter) {
|
||||||
|
SQWSchStatus *sch = (SQWSchStatus *)pIter;
|
||||||
|
qwDestroySchStatus(sch);
|
||||||
|
pIter = taosHashIterate(mgmt->schHash, pIter);
|
||||||
|
}
|
||||||
taosHashCleanup(mgmt->schHash);
|
taosHashCleanup(mgmt->schHash);
|
||||||
|
|
||||||
taosMemoryFree(mgmt);
|
taosMemoryFree(mgmt);
|
||||||
|
|
|
@ -791,6 +791,10 @@ static void uvDestroyConn(uv_handle_t* handle) {
|
||||||
}
|
}
|
||||||
QUEUE_REMOVE(&conn->queue);
|
QUEUE_REMOVE(&conn->queue);
|
||||||
taosMemoryFree(conn->pTcp);
|
taosMemoryFree(conn->pTcp);
|
||||||
|
if (conn->regArg.init == 1) {
|
||||||
|
transFreeMsg(conn->regArg.msg.pCont);
|
||||||
|
conn->regArg.init = 0;
|
||||||
|
}
|
||||||
taosMemoryFree(conn);
|
taosMemoryFree(conn);
|
||||||
|
|
||||||
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
|
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
|
||||||
|
|
|
@ -326,6 +326,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, "Invalid table ID")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_TYPE, "Invalid table type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_TYPE, "Invalid table type")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION, "Invalid table schema version")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION, "Invalid table schema version")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_ALREADY_EXIST, "Table already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_ALREADY_EXIST, "Table already exists")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_NOT_EXIST, "Table not exists")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_ALREADY_EXIST, "Stable already exists")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_CONFIG, "Invalid configuration")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_CONFIG, "Invalid configuration")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INIT_FAILED, "Tsdb init failed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INIT_FAILED, "Tsdb init failed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_DISKSPACE, "No diskspace for tsdb")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_DISKSPACE, "No diskspace for tsdb")
|
||||||
|
|
|
@ -398,7 +398,7 @@ void bpAppendOperatorParam(BindData *data, int32_t *len, int32_t dataType, int32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateQuerySQL(BindData *data, int32_t tblIdx) {
|
void generateQueryCondSQL(BindData *data, int32_t tblIdx) {
|
||||||
int32_t len = sprintf(data->sql, "select * from %s%d where ", bpTbPrefix, tblIdx);
|
int32_t len = sprintf(data->sql, "select * from %s%d where ", bpTbPrefix, tblIdx);
|
||||||
if (!gCurCase->fullCol) {
|
if (!gCurCase->fullCol) {
|
||||||
for (int c = 0; c < gCurCase->bindColNum; ++c) {
|
for (int c = 0; c < gCurCase->bindColNum; ++c) {
|
||||||
|
@ -462,6 +462,72 @@ void generateQuerySQL(BindData *data, int32_t tblIdx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void generateQueryMiscSQL(BindData *data, int32_t tblIdx) {
|
||||||
|
int32_t len = sprintf(data->sql, "select * from %s%d where ", bpTbPrefix, tblIdx);
|
||||||
|
if (!gCurCase->fullCol) {
|
||||||
|
for (int c = 0; c < gCurCase->bindColNum; ++c) {
|
||||||
|
if (c) {
|
||||||
|
len += sprintf(data->sql + len, " and ");
|
||||||
|
}
|
||||||
|
switch (data->pBind[c].buffer_type) {
|
||||||
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
|
len += sprintf(data->sql + len, "booldata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
|
len += sprintf(data->sql + len, "tinydata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_SMALLINT:
|
||||||
|
len += sprintf(data->sql + len, "smalldata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_INT:
|
||||||
|
len += sprintf(data->sql + len, "intdata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
|
len += sprintf(data->sql + len, "bigdata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
|
len += sprintf(data->sql + len, "floatdata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
|
len += sprintf(data->sql + len, "doubledata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_VARCHAR:
|
||||||
|
len += sprintf(data->sql + len, "binarydata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
|
len += sprintf(data->sql + len, "ts");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_NCHAR:
|
||||||
|
len += sprintf(data->sql + len, "nchardata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_UTINYINT:
|
||||||
|
len += sprintf(data->sql + len, "utinydata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_USMALLINT:
|
||||||
|
len += sprintf(data->sql + len, "usmalldata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_UINT:
|
||||||
|
len += sprintf(data->sql + len, "uintdata");
|
||||||
|
break;
|
||||||
|
case TSDB_DATA_TYPE_UBIGINT:
|
||||||
|
len += sprintf(data->sql + len, "ubigdata");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("!!!invalid col type:%d", data->pBind[c].buffer_type);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bpAppendOperatorParam(data, &len, data->pBind[c].buffer_type, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gCaseCtrl.printStmtSql) {
|
||||||
|
printf("\tSTMT SQL: %s\n", data->sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void generateErrorSQL(BindData *data, int32_t tblIdx) {
|
void generateErrorSQL(BindData *data, int32_t tblIdx) {
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
data->sql = taosMemoryCalloc(1, 1024);
|
data->sql = taosMemoryCalloc(1, 1024);
|
||||||
|
@ -677,7 +743,7 @@ int32_t prepareInsertData(BindData *data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t prepareQueryData(BindData *data, int32_t tblIdx) {
|
int32_t prepareQueryCondData(BindData *data, int32_t tblIdx) {
|
||||||
static int64_t tsData = 1591060628000;
|
static int64_t tsData = 1591060628000;
|
||||||
uint64_t bindNum = gCurCase->rowNum / gCurCase->bindRowNum;
|
uint64_t bindNum = gCurCase->rowNum / gCurCase->bindRowNum;
|
||||||
|
|
||||||
|
@ -735,6 +801,63 @@ int32_t prepareQueryData(BindData *data, int32_t tblIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
|
||||||
|
static int64_t tsData = 1591060628000;
|
||||||
|
uint64_t bindNum = gCurCase->rowNum / gCurCase->bindRowNum;
|
||||||
|
|
||||||
|
data->colNum = 0;
|
||||||
|
data->colTypes = taosMemoryCalloc(30, sizeof(int32_t));
|
||||||
|
data->sql = taosMemoryCalloc(1, 1024);
|
||||||
|
data->pBind = taosMemoryCalloc(bindNum*gCurCase->bindColNum, sizeof(TAOS_MULTI_BIND));
|
||||||
|
data->tsData = taosMemoryMalloc(bindNum * sizeof(int64_t));
|
||||||
|
data->boolData = taosMemoryMalloc(bindNum * sizeof(bool));
|
||||||
|
data->tinyData = taosMemoryMalloc(bindNum * sizeof(int8_t));
|
||||||
|
data->utinyData = taosMemoryMalloc(bindNum * sizeof(uint8_t));
|
||||||
|
data->smallData = taosMemoryMalloc(bindNum * sizeof(int16_t));
|
||||||
|
data->usmallData = taosMemoryMalloc(bindNum * sizeof(uint16_t));
|
||||||
|
data->intData = taosMemoryMalloc(bindNum * sizeof(int32_t));
|
||||||
|
data->uintData = taosMemoryMalloc(bindNum * sizeof(uint32_t));
|
||||||
|
data->bigData = taosMemoryMalloc(bindNum * sizeof(int64_t));
|
||||||
|
data->ubigData = taosMemoryMalloc(bindNum * sizeof(uint64_t));
|
||||||
|
data->floatData = taosMemoryMalloc(bindNum * sizeof(float));
|
||||||
|
data->doubleData = taosMemoryMalloc(bindNum * sizeof(double));
|
||||||
|
data->binaryData = taosMemoryMalloc(bindNum * gVarCharSize);
|
||||||
|
data->binaryLen = taosMemoryMalloc(bindNum * sizeof(int32_t));
|
||||||
|
if (gCurCase->bindNullNum) {
|
||||||
|
data->isNull = taosMemoryCalloc(bindNum, sizeof(char));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < bindNum; ++i) {
|
||||||
|
data->tsData[i] = tsData + tblIdx*gCurCase->rowNum + rand()%gCurCase->rowNum;
|
||||||
|
data->boolData[i] = (bool)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->tinyData[i] = (int8_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->utinyData[i] = (uint8_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->smallData[i] = (int16_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->usmallData[i] = (uint16_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->intData[i] = (int32_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->uintData[i] = (uint32_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->bigData[i] = (int64_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->ubigData[i] = (uint64_t)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->floatData[i] = (float)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
data->doubleData[i] = (double)(tblIdx*gCurCase->rowNum + rand() % gCurCase->rowNum);
|
||||||
|
memset(data->binaryData + gVarCharSize * i, 'a'+i%26, gVarCharLen);
|
||||||
|
if (gCurCase->bindNullNum) {
|
||||||
|
data->isNull[i] = i % 2;
|
||||||
|
}
|
||||||
|
data->binaryLen[i] = gVarCharLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int b = 0; b < bindNum; b++) {
|
||||||
|
for (int c = 0; c < gCurCase->bindColNum; ++c) {
|
||||||
|
prepareColData(data, b*gCurCase->bindColNum+c, b*gCurCase->bindRowNum, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
generateQueryMiscSQL(data, tblIdx);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void destroyData(BindData *data) {
|
void destroyData(BindData *data) {
|
||||||
|
@ -1385,7 +1508,7 @@ int querySUBTTest1(TAOS_STMT *stmt, TAOS *taos) {
|
||||||
|
|
||||||
for (int32_t t = 0; t< gCurCase->tblNum; ++t) {
|
for (int32_t t = 0; t< gCurCase->tblNum; ++t) {
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
prepareQueryData(&data, t);
|
prepareQueryCondData(&data, t);
|
||||||
|
|
||||||
int code = taos_stmt_prepare(stmt, data.sql, 0);
|
int code = taos_stmt_prepare(stmt, data.sql, 0);
|
||||||
if (code != 0){
|
if (code != 0){
|
||||||
|
@ -1431,7 +1554,7 @@ int querySUBTTest2(TAOS_STMT *stmt, TAOS *taos) {
|
||||||
|
|
||||||
for (int32_t t = 0; t< gCurCase->tblNum; ++t) {
|
for (int32_t t = 0; t< gCurCase->tblNum; ++t) {
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
prepareQueryData(&data, t);
|
prepareQueryMiscData(&data, t);
|
||||||
|
|
||||||
int code = taos_stmt_prepare(stmt, data.sql, 0);
|
int code = taos_stmt_prepare(stmt, data.sql, 0);
|
||||||
if (code != 0){
|
if (code != 0){
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
run general/stable/disk.sim
|
|
||||||
run general/stable/dnode3.sim
|
|
||||||
run general/stable/metrics.sim
|
|
||||||
run general/stable/values.sim
|
|
||||||
run general/stable/vnode3.sim
|
|
|
@ -0,0 +1,197 @@
|
||||||
|
import taos
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import socket
|
||||||
|
import pexpect
|
||||||
|
import os
|
||||||
|
import http.server
|
||||||
|
import gzip
|
||||||
|
import threading
|
||||||
|
import json
|
||||||
|
|
||||||
|
from util.log import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.dnodes import *
|
||||||
|
|
||||||
|
telemetryPort = '80'
|
||||||
|
|
||||||
|
#{
|
||||||
|
# "instanceId": "5cf4cd7a-acd4-43ba-8b0d-e84395b76a65",
|
||||||
|
# "reportVersion": 1,
|
||||||
|
# "os": "Ubuntu 20.04.3 LTS",
|
||||||
|
# "cpuModel": "Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz",
|
||||||
|
# "numOfCpu": 6,
|
||||||
|
# "memory": "65860292 kB",
|
||||||
|
# "version": "3.0.0.0",
|
||||||
|
# "buildInfo": "Built at 2022-05-07 14:09:02",
|
||||||
|
# "gitInfo": "2139ccceb0946cde86b6b553b11e338f1ba437e5",
|
||||||
|
# "email": "user@taosdata.com",
|
||||||
|
# "numOfDnode": 1,
|
||||||
|
# "numOfMnode": 1,
|
||||||
|
# "numOfVgroup": 32,
|
||||||
|
# "numOfDatabase": 2,
|
||||||
|
# "numOfSuperTable": 0,
|
||||||
|
# "numOfChildTable": 100,
|
||||||
|
# "numOfColumn": 200,
|
||||||
|
# "numOfPoint": 300,
|
||||||
|
# "totalStorage": 400,
|
||||||
|
# "compStorage": 500
|
||||||
|
#}
|
||||||
|
|
||||||
|
def telemetryInfoCheck(infoDict=''):
|
||||||
|
if "instanceId" not in infoDict or len(infoDict["instanceId"]) == 0:
|
||||||
|
tdLog.exit("instanceId is null!")
|
||||||
|
|
||||||
|
if "reportVersion" not in infoDict or infoDict["reportVersion"] != 1:
|
||||||
|
tdLog.exit("reportVersion is null!")
|
||||||
|
|
||||||
|
if "os" not in infoDict:
|
||||||
|
tdLog.exit("os is null!")
|
||||||
|
|
||||||
|
if "cpuModel" not in infoDict:
|
||||||
|
tdLog.exit("cpuModel is null!")
|
||||||
|
|
||||||
|
if "numOfCpu" not in infoDict or infoDict["numOfCpu"] == 0:
|
||||||
|
tdLog.exit("numOfCpu is null!")
|
||||||
|
|
||||||
|
if "memory" not in infoDict:
|
||||||
|
tdLog.exit("memory is null!")
|
||||||
|
|
||||||
|
if "version" not in infoDict:
|
||||||
|
tdLog.exit("version is null!")
|
||||||
|
|
||||||
|
if "buildInfo" not in infoDict:
|
||||||
|
tdLog.exit("buildInfo is null!")
|
||||||
|
|
||||||
|
if "gitInfo" not in infoDict:
|
||||||
|
tdLog.exit("gitInfo is null!")
|
||||||
|
|
||||||
|
if "email" not in infoDict:
|
||||||
|
tdLog.exit("email is not exists!")
|
||||||
|
|
||||||
|
if "numOfDnode" not in infoDict or infoDict["numOfDnode"] < 1:
|
||||||
|
tdLog.exit("numOfDnode is null!")
|
||||||
|
|
||||||
|
if "numOfMnode" not in infoDict or infoDict["numOfMnode"] < 1:
|
||||||
|
tdLog.exit("numOfMnode is null!")
|
||||||
|
|
||||||
|
if "numOfVgroup" not in infoDict or infoDict["numOfVgroup"] <= 0:
|
||||||
|
tdLog.exit("numOfVgroup is null!")
|
||||||
|
|
||||||
|
if "numOfDatabase" not in infoDict or infoDict["numOfDatabase"] <= 0:
|
||||||
|
tdLog.exit("numOfDatabase is null!")
|
||||||
|
|
||||||
|
if "numOfSuperTable" not in infoDict or infoDict["numOfSuperTable"] < 0:
|
||||||
|
tdLog.exit("numOfSuperTable is null!")
|
||||||
|
|
||||||
|
if "numOfChildTable" not in infoDict or infoDict["numOfChildTable"] < 0:
|
||||||
|
tdLog.exit("numOfChildTable is null!")
|
||||||
|
|
||||||
|
if "numOfColumn" not in infoDict or infoDict["numOfColumn"] < 0:
|
||||||
|
tdLog.exit("numOfColumn is null!")
|
||||||
|
|
||||||
|
if "numOfPoint" not in infoDict or infoDict["numOfPoint"] < 0:
|
||||||
|
tdLog.exit("numOfPoint is null!")
|
||||||
|
|
||||||
|
if "totalStorage" not in infoDict or infoDict["totalStorage"] < 0:
|
||||||
|
tdLog.exit("totalStorage is null!")
|
||||||
|
|
||||||
|
if "compStorage" not in infoDict or infoDict["compStorage"] < 0:
|
||||||
|
tdLog.exit("compStorage is null!")
|
||||||
|
|
||||||
|
|
||||||
|
class RequestHandlerImpl(http.server.BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
"""
|
||||||
|
process GET request
|
||||||
|
"""
|
||||||
|
|
||||||
|
def do_POST(self):
|
||||||
|
"""
|
||||||
|
process POST request
|
||||||
|
"""
|
||||||
|
contentEncoding = self.headers["Content-Encoding"]
|
||||||
|
|
||||||
|
if contentEncoding == 'gzip':
|
||||||
|
req_body = self.rfile.read(int(self.headers["Content-Length"]))
|
||||||
|
plainText = gzip.decompress(req_body).decode()
|
||||||
|
else:
|
||||||
|
plainText = self.rfile.read(int(self.headers["Content-Length"])).decode()
|
||||||
|
|
||||||
|
print("monitor info:\n%s"%plainText)
|
||||||
|
|
||||||
|
# 1. send response code and header
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||||
|
self.end_headers()
|
||||||
|
|
||||||
|
# 2. send response content
|
||||||
|
#self.wfile.write(("Hello World: " + req_body + "\n").encode("utf-8"))
|
||||||
|
|
||||||
|
# 3. check request body info
|
||||||
|
infoDict = json.loads(plainText)
|
||||||
|
#print("================")
|
||||||
|
#print(infoDict)
|
||||||
|
telemetryInfoCheck(infoDict)
|
||||||
|
|
||||||
|
# 4. shutdown the server and exit case
|
||||||
|
assassin = threading.Thread(target=httpServer.shutdown)
|
||||||
|
assassin.daemon = True
|
||||||
|
assassin.start()
|
||||||
|
print ("==== shutdown http server ====")
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
hostname = socket.gethostname()
|
||||||
|
serverPort = '7080'
|
||||||
|
rpcDebugFlagVal = '143'
|
||||||
|
clientCfgDict = {'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
|
||||||
|
clientCfgDict["serverPort"] = serverPort
|
||||||
|
clientCfgDict["firstEp"] = hostname + ':' + serverPort
|
||||||
|
clientCfgDict["secondEp"] = hostname + ':' + serverPort
|
||||||
|
clientCfgDict["rpcDebugFlag"] = rpcDebugFlagVal
|
||||||
|
clientCfgDict["fqdn"] = hostname
|
||||||
|
|
||||||
|
updatecfgDict = {'clientCfg': {}, 'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
|
||||||
|
updatecfgDict["clientCfg"] = clientCfgDict
|
||||||
|
updatecfgDict["serverPort"] = serverPort
|
||||||
|
updatecfgDict["firstEp"] = hostname + ':' + serverPort
|
||||||
|
updatecfgDict["secondEp"] = hostname + ':' + serverPort
|
||||||
|
updatecfgDict["fqdn"] = hostname
|
||||||
|
|
||||||
|
updatecfgDict["telemetryReporting"] = '1'
|
||||||
|
updatecfgDict["telemetryServer"] = hostname
|
||||||
|
updatecfgDict["telemetryPort"] = telemetryPort
|
||||||
|
updatecfgDict["telemetryInterval"] = "3"
|
||||||
|
|
||||||
|
print ("===================: ", updatecfgDict)
|
||||||
|
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||||
|
tdSql.prepare()
|
||||||
|
# time.sleep(2)
|
||||||
|
vgroups = "30"
|
||||||
|
sql = "create database db3 vgroups " + vgroups
|
||||||
|
tdSql.query(sql)
|
||||||
|
|
||||||
|
# loop to wait request
|
||||||
|
httpServer.serve_forever()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
# create http server: bing ip/port , and request processor
|
||||||
|
serverAddress = ("", int(telemetryPort))
|
||||||
|
httpServer = http.server.HTTPServer(serverAddress, RequestHandlerImpl)
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,12 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.error("select now()+1.5 from ntb")
|
tdSql.error("select now()+1.5 from ntb")
|
||||||
tdSql.error("select now()+1.5 from db.ntb")
|
tdSql.error("select now()+1.5 from db.ntb")
|
||||||
|
tdSql.error("select now()-1.5 from ntb")
|
||||||
|
tdSql.error("select now()-1.5 from db.ntb")
|
||||||
|
tdSql.error("select now()*1.5 from ntb")
|
||||||
|
tdSql.error("select now()*1.5 from db.ntb")
|
||||||
|
tdSql.error("select now()/1.5 from ntb")
|
||||||
|
tdSql.error("select now()/1.5 from db.ntb")
|
||||||
tdSql.error("select now()+'abc' from ntb")
|
tdSql.error("select now()+'abc' from ntb")
|
||||||
tdSql.error("select now()+'abc' from db.ntb")
|
tdSql.error("select now()+'abc' from db.ntb")
|
||||||
tdSql.error("select now()+abc from ntb")
|
tdSql.error("select now()+abc from ntb")
|
||||||
|
@ -262,7 +268,10 @@ class TDTestCase:
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.query("select now() +1 from db.stb")
|
tdSql.query("select now() +1 from db.stb")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
|
tdSql.error("select now() +1.5 from stb")
|
||||||
|
tdSql.error("select now() -1.5 from stb")
|
||||||
|
tdSql.error("select now() *1.5 from stb")
|
||||||
|
tdSql.error("select now() /1.5 from stb")
|
||||||
tdSql.error("select now() +'abc' from stb")
|
tdSql.error("select now() +'abc' from stb")
|
||||||
tdSql.error("select now() +'abc' from db.stb")
|
tdSql.error("select now() +'abc' from db.stb")
|
||||||
tdSql.error("select now() + ! from stb")
|
tdSql.error("select now() + ! from stb")
|
||||||
|
@ -272,6 +281,7 @@ class TDTestCase:
|
||||||
tdSql.error("select now() -today() from stb")
|
tdSql.error("select now() -today() from stb")
|
||||||
tdSql.error("select now() - today() from db.stb")
|
tdSql.error("select now() - today() from db.stb")
|
||||||
|
|
||||||
|
|
||||||
tdSql.query("select now()+null from stb")
|
tdSql.query("select now()+null from stb")
|
||||||
tdSql.checkData(0,0,None)
|
tdSql.checkData(0,0,None)
|
||||||
tdSql.query("select now()+null from db.stb")
|
tdSql.query("select now()+null from db.stb")
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
from util.log import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.cases import *
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def run(self): # sourcery skip: extract-duplicate-method
|
||||||
|
tdSql.prepare()
|
||||||
|
tdLog.printNoPrefix("==========step1:create tables==========")
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists ntb
|
||||||
|
(ts timestamp, c1 int, c2 float,c3 double,c4 timestamp)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists stb
|
||||||
|
(ts timestamp, c1 int, c2 float,c3 double,c4 timestamp) tags(t0 int)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists stb_1 using stb tags(100)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdLog.printNoPrefix("==========step2:insert data into ntb==========")
|
||||||
|
|
||||||
|
# RFC3339:2020-01-01T00:00:00+8:00
|
||||||
|
# ISO8601:2020-01-01T00:00:00.000+0800
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into ntb values(now,1,1.55,100.555555,today())("2020-1-1 00:00:00",10,11.11,99.999999,now())(today(),3,3.333,333.333333,now())')
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into stb_1 values(now,1,1.55,100.555555,today())("2020-1-1 00:00:00",10,11.11,99.999999,now())(today(),3,3.333,333.333333,now())')
|
||||||
|
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00') from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select timediff(1,0,1d) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1d) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1s) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
tdSql.query("select timediff(1,0,1s) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
tdSql.query("select timediff(1,0,1w) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1w) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1h) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1h) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1m) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1m) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff(1,0,1a) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1000)
|
||||||
|
tdSql.query("select timediff(1,0,1a) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1000)
|
||||||
|
tdSql.query("select timediff(1,0,1u) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1000000)
|
||||||
|
tdSql.query("select timediff(1,0,1u) from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1000000)
|
||||||
|
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00') from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00') from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1d) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1d) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1h) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,24)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1h) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,24)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1w) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1m) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1440)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1m) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,1440)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1s) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1s) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1a) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1a) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1u) from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400000000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-2 00:00:00',1u) from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,86400000000)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00') from stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00') from db.stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1w) from stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1w) from db.stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1d) from stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1d) from db.stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1h) from stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,12)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1h) from db.stb_1 ")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,12)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1m) from stb_1" )
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,720)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1m) from db.stb_1" )
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,720)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1s) from stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1s) from db.stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1a) from stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1a) from db.stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1u) from stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200000000)
|
||||||
|
tdSql.query("select timediff('2020-1-1 00:00:00','2020-1-1 12:00:00',1u) from db.stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,43200000000)
|
||||||
|
|
||||||
|
tdSql.query("select timediff('a','b') from stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.checkData(1,0,None)
|
||||||
|
tdSql.checkData(2,0,None)
|
||||||
|
tdSql.error("select timediff(1.5,1.5) from stb")
|
||||||
|
tdSql.error("select timediff(1) from stb")
|
||||||
|
tdSql.error("select timediff(10,1,1.5) from stb")
|
||||||
|
# tdSql.error("select timediff(10,1,2s) from stb")
|
||||||
|
# tdSql.error("select timedifff(10,1,c1) from stb")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -92,6 +92,21 @@ class TDTestCase:
|
||||||
tdSql.query("select to_iso8601(today()) /null from db.ntb")
|
tdSql.query("select to_iso8601(today()) /null from db.ntb")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,0,None)
|
tdSql.checkData(0,0,None)
|
||||||
|
# tdSql.query("select to_iso8601(-1) from ntb")
|
||||||
|
tdSql.query("select to_iso8601(9223372036854775807) from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
# tdSql.query("select to_iso8601(10000000000) from ntb")
|
||||||
|
# tdSql.checkData(0,0,None)
|
||||||
|
# tdSql.query("select to_iso8601(-1) from ntb")
|
||||||
|
# tdSql.checkRows(3)
|
||||||
|
# tdSql.query("select to_iso8601(-10000000000) from ntb")
|
||||||
|
# tdSql.checkData(0,0,None)
|
||||||
|
tdSql.error("select to_iso8601(1.5) from ntb")
|
||||||
|
tdSql.error("select to_iso8601(1.5) from db.ntb")
|
||||||
|
tdSql.error("select to_iso8601('a') from ntb")
|
||||||
|
tdSql.error("select to_iso8601(c2) from ntb")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,6 +152,8 @@ class TDTestCase:
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,0,None)
|
tdSql.checkData(0,0,None)
|
||||||
|
|
||||||
|
# tdSql.query("select to_iso8601(-1) from ntb")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
|
@ -0,0 +1,73 @@
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
from util.log import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.cases import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def run(self): # sourcery skip: extract-duplicate-method
|
||||||
|
tdSql.prepare()
|
||||||
|
tdLog.printNoPrefix("==========step1:create tables==========")
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists ntb
|
||||||
|
(ts timestamp, c1 int, c2 float,c3 double,c4 timestamp)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists stb
|
||||||
|
(ts timestamp, c1 int, c2 float,c3 double,c4 timestamp) tags(t0 int)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdSql.execute(
|
||||||
|
'''create table if not exists stb_1 using stb tags(100)
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
tdLog.printNoPrefix("==========step2:insert data into ntb==========")
|
||||||
|
|
||||||
|
# RFC3339:2020-01-01T00:00:00+8:00
|
||||||
|
# ISO8601:2020-01-01T00:00:00.000+0800
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into ntb values(now,1,1.55,100.555555,today())("2020-1-1 00:00:00",10,11.11,99.999999,now())(today(),3,3.333,333.333333,now())')
|
||||||
|
tdSql.execute(
|
||||||
|
'insert into stb_1 values(now,1,1.55,100.555555,today())("2020-1-1 00:00:00",10,11.11,99.999999,now())(today(),3,3.333,333.333333,now())')
|
||||||
|
tdSql.query("select to_unixtimestamp('1970-01-01T08:00:00+0800') from ntb")
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.checkData(1,0,0)
|
||||||
|
tdSql.checkData(2,0,0)
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select to_unixtimestamp('1970-01-01T08:00:00+08:00') from ntb")
|
||||||
|
tdSql.checkData(0,0,0)
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select to_unixtimestamp('1900-01-01T08:00:00+08:00') from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select to_unixtimestamp('2020-01-32T08:00:00') from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select to_unixtimestamp('2020-13-32T08:00:00') from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select to_unixtimestamp('acd') from ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.error("select to_unixtimestamp(1) from ntb")
|
||||||
|
tdSql.error("select to_unixtimestamp(1.5) from ntb")
|
||||||
|
tdSql.error("select to_unixtimestamp(ts) from ntb")
|
||||||
|
|
||||||
|
tdSql.query("select ts from ntb where to_unixtimestamp('1970-01-01T08:00:00+08:00')=0")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -134,6 +134,35 @@ class TDTestCase:
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0, 0, str(today_date))
|
tdSql.checkData(0, 0, str(today_date))
|
||||||
|
|
||||||
|
tdSql.error("select today()+1.5 from ntb")
|
||||||
|
tdSql.error("select today()-1.5 from ntb")
|
||||||
|
tdSql.error("select today()*1.5 from ntb")
|
||||||
|
tdSql.error("select today()/1.5 from ntb")
|
||||||
|
tdSql.error("select today()+1.5 from db.ntb")
|
||||||
|
tdSql.error("select today()-1.5 from db.ntb")
|
||||||
|
tdSql.error("select today()*1.5 from db.ntb")
|
||||||
|
tdSql.error("select today()/1.5 from db.ntb")
|
||||||
|
tdSql.query("select today()+null from ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()+null from db.ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from db.ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from db.ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from db.ntb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/0 from db.ntb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.checkData(1,0,None)
|
||||||
|
tdSql.checkData(2,0,None)
|
||||||
# stable
|
# stable
|
||||||
tdSql.query("select today() from stb")
|
tdSql.query("select today() from stb")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
|
@ -208,6 +237,26 @@ class TDTestCase:
|
||||||
tdSql.query("select ts from stb where ts<=today()")
|
tdSql.query("select ts from stb where ts<=today()")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
tdSql.error("select today()+1.5 from stb")
|
||||||
|
tdSql.error("select today()-1.5 from stb")
|
||||||
|
tdSql.error("select today()*1.5 from stb")
|
||||||
|
tdSql.error("select today()/1.5 from stb")
|
||||||
|
tdSql.query("select today()+null from stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()+null from db.stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from db.stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from db.stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from db.stb")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
#
|
#
|
||||||
# tdSql.query("select * from ntb where ts<today()")
|
# tdSql.query("select * from ntb where ts<today()")
|
||||||
# tdSql.checkRows(1)
|
# tdSql.checkRows(1)
|
||||||
|
@ -220,6 +269,11 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, str(today_date))
|
tdSql.checkData(0, 0, str(today_date))
|
||||||
tdSql.query("select today() from stb where ts<now()")
|
tdSql.query("select today() from stb where ts<now()")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select today()/0 from db.stb")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.checkData(1,0,None)
|
||||||
|
tdSql.checkData(2,0,None)
|
||||||
|
|
||||||
# table
|
# table
|
||||||
tdSql.query("select today() from stb_1")
|
tdSql.query("select today() from stb_1")
|
||||||
|
@ -309,7 +363,31 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query("select today() from stb_1 where ts<now()")
|
tdSql.query("select today() from stb_1 where ts<now()")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
|
tdSql.error("select today()+1.5 from stb_1")
|
||||||
|
tdSql.error("select today()-1.5 from stb_1")
|
||||||
|
tdSql.error("select today()*1.5 from stb_1")
|
||||||
|
tdSql.error("select today()/1.5 from stb_1")
|
||||||
|
tdSql.query("select today()+null from stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()+null from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()-null from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()*null from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/null from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.query("select today()/0 from db.stb_1")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.checkData(0,0,None)
|
||||||
|
tdSql.checkData(1,0,None)
|
||||||
|
tdSql.checkData(2,0,None)
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
from util.log import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.cases import *
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute("create table stb_1 using stb tags('beijing')")
|
||||||
|
tdSql.execute("create table stb_2 using stb tags('shanghai')")
|
||||||
|
|
||||||
|
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
|
||||||
|
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
tdSql.execute("insert into stb_2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
|
tdSql.query("select count(*) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(*) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(ts) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(ts) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col1) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col1) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col2) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col2) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col3) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col3) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col4) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col4) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col5) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col5) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col6) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col6) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col7) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col7) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col8) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col8) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col9) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col9) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col11) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col11) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col12) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col12) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col13) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col13) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col14) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col14) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("select count(ts) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(ts) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col1) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col1) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col2) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col2) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col3) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col3) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col4) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col4) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col5) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col5) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col6) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col6) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col7) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col7) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col8) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col8) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col9) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col9) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col11) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col11) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col12) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col12) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col13) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col13) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col14) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col14) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col1) from stb_1 group by col7")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
tdSql.execute("insert into stb_1 values(now,null,null,null,null,null,null,null,null,null,null,null,null,null)")
|
||||||
|
tdSql.query("select count(col1) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col1),count(ts) from stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.checkData(0,1,11)
|
||||||
|
|
||||||
|
tdSql.query("select count(col1) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.query("select count(col1),count(ts) from db.stb_1")
|
||||||
|
tdSql.checkData(0,0,10)
|
||||||
|
tdSql.checkData(0,1,11)
|
||||||
|
|
||||||
|
tdSql.query("select count(col1) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col1),count(ts) from stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.checkData(0,1,21)
|
||||||
|
|
||||||
|
tdSql.query("select count(col1) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.query("select count(col1),count(ts) from db.stb")
|
||||||
|
tdSql.checkData(0,0,20)
|
||||||
|
tdSql.checkData(0,1,21)
|
||||||
|
tdSql.query("select count(col1) from stb_1 group by col7")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query("select count(col1) from stb_2 group by col7")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.query("select count(col1) from stb group by col7")
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,331 @@
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute("create table stb_1 using stb tags('beijing')")
|
||||||
|
tdSql.execute("insert into stb_1(ts) values(%d)" % (self.ts - 1))
|
||||||
|
|
||||||
|
# last verifacation
|
||||||
|
# tdSql.query("select last(*) from stb_1")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, None)
|
||||||
|
# tdSql.query("select last(*) from db.stb_1")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, None)
|
||||||
|
tdSql.query("select last(col1) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col1) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col2) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col2) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col3) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col3) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col4) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col4) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col11) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col11) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col12) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col12) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col13) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col13) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col14) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col14) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col5) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col5) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col6) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col6) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col7) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col7) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col8) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col8) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col9) from stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col9) from db.stb_1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select count(col1) from stb_1 group by col7")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
|
# tdSql.query("select last(*) from stb_1")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, 10)
|
||||||
|
# tdSql.query("select last(*) from db.stb_1")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, 10)
|
||||||
|
tdSql.query("select last(col1) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col1) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col2) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col2) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col3) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col3) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col4) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col4) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col11) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col11) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col12) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col12) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col13) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col13) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col14) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col14) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col5) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col5) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col6) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col6) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col7) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
tdSql.query("select last(col7) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
tdSql.query("select last(col8) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'taosdata10')
|
||||||
|
tdSql.query("select last(col8) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'taosdata10')
|
||||||
|
tdSql.query("select last(col9) from stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, '涛思数据10')
|
||||||
|
tdSql.query("select last(col9) from db.stb_1")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, '涛思数据10')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
|
||||||
|
tdSql.execute("insert into ntb(ts) values(%d)" % (self.ts - 1))
|
||||||
|
# tdSql.query("select last(*) from ntb")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, None)
|
||||||
|
# tdSql.query("select last(*) from db.ntb")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 1, None)
|
||||||
|
tdSql.query("select last(col1) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col1) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col2) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col2) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col3) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col3) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col4) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col4) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col11) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col11) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col12) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col12) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col13) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col13) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col14) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col14) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col5) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col5) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col6) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col6) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col7) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col7) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col8) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col8) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col9) from ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
tdSql.query("select last(col9) from db.ntb")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
|
||||||
|
tdSql.query("select last(*) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 1, 10)
|
||||||
|
tdSql.query("select last(*) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 1, 10)
|
||||||
|
tdSql.query("select last(col1) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col1) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col2) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col2) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col3) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col3) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col4) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col4) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col11) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col11) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col12) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col12) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col13) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col13) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col14) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col14) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 10)
|
||||||
|
tdSql.query("select last(col5) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col5) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col6) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col6) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
tdSql.query("select last(col7) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
tdSql.query("select last(col7) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, True)
|
||||||
|
tdSql.query("select last(col8) from ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'taosdata10')
|
||||||
|
tdSql.query("select last(col8) from db.ntb")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'taosdata10')
|
||||||
|
# tdSql.query("select last(col9) from ntb")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 0, '涛思数据10')
|
||||||
|
# tdSql.query("select last(col9) from db.ntb")
|
||||||
|
# tdSql.checkRows(1)
|
||||||
|
# tdSql.checkData(0, 0, '涛思数据10')
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,205 @@
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def prepare_data(self):
|
||||||
|
|
||||||
|
pass
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
intData = []
|
||||||
|
floatData = []
|
||||||
|
|
||||||
|
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute("create table stb_1 using stb tags('beijing')")
|
||||||
|
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
# max verifacation
|
||||||
|
tdSql.error("select max(ts) from stb_1")
|
||||||
|
tdSql.error("select max(ts) from db.stb_1")
|
||||||
|
tdSql.error("select max(col7) from stb_1")
|
||||||
|
tdSql.error("select max(col7) from db.stb_1")
|
||||||
|
tdSql.error("select max(col8) from stb_1")
|
||||||
|
tdSql.error("select max(col8) from db.stb_1")
|
||||||
|
tdSql.error("select max(col9) from stb_1")
|
||||||
|
tdSql.error("select max(col9) from db.stb_1")
|
||||||
|
|
||||||
|
tdSql.query("select max(col1) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col1) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col5) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col5) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col1) from stb_1 where col2<=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.error("select max(ts) from stb")
|
||||||
|
tdSql.error("select max(ts) from db.stb")
|
||||||
|
tdSql.error("select max(col7) from stb")
|
||||||
|
tdSql.error("select max(col7) from db.stb")
|
||||||
|
tdSql.error("select max(col8) from stb")
|
||||||
|
tdSql.error("select max(col8) from db.stb")
|
||||||
|
tdSql.error("select max(col9) from stb")
|
||||||
|
tdSql.error("select max(col9) from db.stb")
|
||||||
|
|
||||||
|
tdSql.query("select max(col1) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col1) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col5) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col5) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col1) from stb where col2<=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.error("select max(ts) from ntb")
|
||||||
|
tdSql.error("select max(ts) from db.ntb")
|
||||||
|
tdSql.error("select max(col7) from ntb")
|
||||||
|
tdSql.error("select max(col7) from db.ntb")
|
||||||
|
tdSql.error("select max(col8) from ntb")
|
||||||
|
tdSql.error("select max(col8) from db.ntb")
|
||||||
|
tdSql.error("select max(col9) from ntb")
|
||||||
|
tdSql.error("select max(col9) from db.ntb")
|
||||||
|
|
||||||
|
tdSql.query("select max(col1) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col1) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col2) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col3) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col4) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col11) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col12) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col13) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col14) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(intData))
|
||||||
|
tdSql.query("select max(col5) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col5) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col6) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.max(floatData))
|
||||||
|
tdSql.query("select max(col1) from stb_1 where col2<=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,215 @@
|
||||||
|
from wsgiref.headers import tspecials
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
intData = []
|
||||||
|
floatData = []
|
||||||
|
|
||||||
|
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute("create table stb_1 using stb tags('beijing')")
|
||||||
|
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
# max verifacation
|
||||||
|
tdSql.error("select min(ts) from stb_1")
|
||||||
|
tdSql.error("select min(ts) from db.stb_1")
|
||||||
|
tdSql.error("select min(col7) from stb_1")
|
||||||
|
tdSql.error("select min(col7) from db.stb_1")
|
||||||
|
tdSql.error("select min(col8) from stb_1")
|
||||||
|
tdSql.error("select min(col8) from db.stb_1")
|
||||||
|
tdSql.error("select min(col9) from stb_1")
|
||||||
|
tdSql.error("select min(col9) from db.stb_1")
|
||||||
|
# tdSql.error("select min(a) from stb_1")
|
||||||
|
# tdSql.error("select min(1) from stb_1")
|
||||||
|
tdSql.error("select min(now()) from stb_1")
|
||||||
|
tdSql.error("select min(count(c1),count(c2)) from stb_1")
|
||||||
|
|
||||||
|
tdSql.query("select min(col1) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col1) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col5) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col5) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from db.stb_1")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col1) from stb_1 where col2>=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.error("select min(ts) from stb_1")
|
||||||
|
tdSql.error("select min(ts) from db.stb_1")
|
||||||
|
tdSql.error("select min(col7) from stb_1")
|
||||||
|
tdSql.error("select min(col7) from db.stb_1")
|
||||||
|
tdSql.error("select min(col8) from stb_1")
|
||||||
|
tdSql.error("select min(col8) from db.stb_1")
|
||||||
|
tdSql.error("select min(col9) from stb_1")
|
||||||
|
tdSql.error("select min(col9) from db.stb_1")
|
||||||
|
# tdSql.error("select min(a) from stb_1")
|
||||||
|
# tdSql.error("select min(1) from stb_1")
|
||||||
|
tdSql.error("select min(now()) from stb_1")
|
||||||
|
tdSql.error("select min(count(c1),count(c2)) from stb_1")
|
||||||
|
|
||||||
|
tdSql.query("select min(col1) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col1) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col5) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col5) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from db.stb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col1) from stb where col2>=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.error("select min(ts) from ntb")
|
||||||
|
tdSql.error("select min(ts) from db.ntb")
|
||||||
|
tdSql.error("select min(col7) from ntb")
|
||||||
|
tdSql.error("select min(col7) from db.ntb")
|
||||||
|
tdSql.error("select min(col8) from ntb")
|
||||||
|
tdSql.error("select min(col8) from db.ntb")
|
||||||
|
tdSql.error("select min(col9) from ntb")
|
||||||
|
tdSql.error("select min(col9) from db.ntb")
|
||||||
|
# tdSql.error("select min(a) from stb_1")
|
||||||
|
# tdSql.error("select min(1) from stb_1")
|
||||||
|
tdSql.error("select min(now()) from ntb")
|
||||||
|
tdSql.error("select min(count(c1),count(c2)) from ntb")
|
||||||
|
|
||||||
|
tdSql.query("select min(col1) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col1) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col2) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col3) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col4) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col11) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col12) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col13) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col14) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(intData))
|
||||||
|
tdSql.query("select min(col5) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col5) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col6) from db.ntb")
|
||||||
|
tdSql.checkData(0, 0, np.min(floatData))
|
||||||
|
tdSql.query("select min(col1) from ntb where col2>=5")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,220 @@
|
||||||
|
import taos
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.ts = 1537146000000 # 2018-9-17 09:00:00.000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
intData = []
|
||||||
|
floatData = []
|
||||||
|
|
||||||
|
tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute("create table stb_1 using stb tags('beijing')")
|
||||||
|
tdSql.execute('''create table ntb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into ntb values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
|
||||||
|
tdSql.query("select timetruncate(1,1d) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1u) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1a) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1m) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1h) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(ts,1d) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 08:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1h) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1m) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1s) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1a) from ntb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.checkData(1,0,"2018-09-17 09:00:00.001")
|
||||||
|
tdSql.checkData(2,0,"2018-09-17 09:00:00.002")
|
||||||
|
tdSql.checkData(3,0,"2018-09-17 09:00:00.003")
|
||||||
|
tdSql.checkData(4,0,"2018-09-17 09:00:00.004")
|
||||||
|
tdSql.checkData(5,0,"2018-09-17 09:00:00.005")
|
||||||
|
tdSql.checkData(6,0,"2018-09-17 09:00:00.006")
|
||||||
|
tdSql.checkData(7,0,"2018-09-17 09:00:00.007")
|
||||||
|
tdSql.checkData(8,0,"2018-09-17 09:00:00.008")
|
||||||
|
tdSql.checkData(9,0,"2018-09-17 09:00:00.009")
|
||||||
|
# tdSql.query("select timetruncate(ts,1u) from ntb")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000")
|
||||||
|
# tdSql.query("select timetruncate(ts,1b) from ntb")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000000")
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("select timetruncate(1,1d) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1u) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1a) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1m) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1h) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(ts,1d) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 08:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1h) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1m) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1s) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1a) from stb")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.checkData(1,0,"2018-09-17 09:00:00.001")
|
||||||
|
tdSql.checkData(2,0,"2018-09-17 09:00:00.002")
|
||||||
|
tdSql.checkData(3,0,"2018-09-17 09:00:00.003")
|
||||||
|
tdSql.checkData(4,0,"2018-09-17 09:00:00.004")
|
||||||
|
tdSql.checkData(5,0,"2018-09-17 09:00:00.005")
|
||||||
|
tdSql.checkData(6,0,"2018-09-17 09:00:00.006")
|
||||||
|
tdSql.checkData(7,0,"2018-09-17 09:00:00.007")
|
||||||
|
tdSql.checkData(8,0,"2018-09-17 09:00:00.008")
|
||||||
|
tdSql.checkData(9,0,"2018-09-17 09:00:00.009")
|
||||||
|
# tdSql.query("select timetruncate(ts,1u) from stb")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000")
|
||||||
|
# tdSql.query("select timetruncate(ts,1b) from stb")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000000")
|
||||||
|
|
||||||
|
tdSql.query("select timetruncate(1,1d) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1u) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1a) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1m) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(1,1h) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.query("select timetruncate(ts,1d) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 08:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1h) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1m) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1s) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.query("select timetruncate(ts,1a) from stb_1")
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
tdSql.checkData(0,0,"2018-09-17 09:00:00.000")
|
||||||
|
tdSql.checkData(1,0,"2018-09-17 09:00:00.001")
|
||||||
|
tdSql.checkData(2,0,"2018-09-17 09:00:00.002")
|
||||||
|
tdSql.checkData(3,0,"2018-09-17 09:00:00.003")
|
||||||
|
tdSql.checkData(4,0,"2018-09-17 09:00:00.004")
|
||||||
|
tdSql.checkData(5,0,"2018-09-17 09:00:00.005")
|
||||||
|
tdSql.checkData(6,0,"2018-09-17 09:00:00.006")
|
||||||
|
tdSql.checkData(7,0,"2018-09-17 09:00:00.007")
|
||||||
|
tdSql.checkData(8,0,"2018-09-17 09:00:00.008")
|
||||||
|
tdSql.checkData(9,0,"2018-09-17 09:00:00.009")
|
||||||
|
# tdSql.query("select timetruncate(ts,1u) from stb_1")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000")
|
||||||
|
# tdSql.query("select timetruncate(ts,1b) from stb_1")
|
||||||
|
# tdSql.checkRows(10)
|
||||||
|
# tdSql.checkData(0,0,"2018-09-17 09:00:00.000000000")
|
||||||
|
# tdSql.checkData(1,0,"2018-09-17 09:00:00.001000000")
|
||||||
|
# tdSql.checkData(2,0,"2018-09-17 09:00:00.002000000")
|
||||||
|
# tdSql.checkData(3,0,"2018-09-17 09:00:00.003000000")
|
||||||
|
# tdSql.checkData(4,0,"2018-09-17 09:00:00.004000000")
|
||||||
|
# tdSql.checkData(5,0,"2018-09-17 09:00:00.005000000")
|
||||||
|
# tdSql.checkData(6,0,"2018-09-17 09:00:00.006000000")
|
||||||
|
# tdSql.checkData(7,0,"2018-09-17 09:00:00.007000000")
|
||||||
|
# tdSql.checkData(8,0,"2018-09-17 09:00:00.008000000")
|
||||||
|
# tdSql.checkData(9,0,"2018-09-17 09:00:00.009000000")
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -5,16 +5,25 @@ set -x
|
||||||
python3 ./test.py -f 0-others/taosShell.py
|
python3 ./test.py -f 0-others/taosShell.py
|
||||||
python3 ./test.py -f 0-others/taosShellError.py
|
python3 ./test.py -f 0-others/taosShellError.py
|
||||||
python3 ./test.py -f 0-others/taosShellNetChk.py
|
python3 ./test.py -f 0-others/taosShellNetChk.py
|
||||||
|
python3 ./test.py -f 0-others/telemetry.py
|
||||||
|
|
||||||
|
|
||||||
#python3 ./test.py -f 2-query/between.py
|
#python3 ./test.py -f 2-query/between.py
|
||||||
python3 ./test.py -f 2-query/distinct.py
|
python3 ./test.py -f 2-query/distinct.py
|
||||||
python3 ./test.py -f 2-query/varchar.py
|
python3 ./test.py -f 2-query/varchar.py
|
||||||
|
|
||||||
#python3 ./test.py -f 2-query/timezone.py
|
python3 ./test.py -f 2-query/timezone.py
|
||||||
python3 ./test.py -f 2-query/Now.py
|
python3 ./test.py -f 2-query/Now.py
|
||||||
python3 ./test.py -f 2-query/Today.py
|
python3 ./test.py -f 2-query/Today.py
|
||||||
|
python3 ./test.py -f 2-query/max.py
|
||||||
|
python3 ./test.py -f 2-query/min.py
|
||||||
|
python3 ./test.py -f 2-query/count.py
|
||||||
|
python3 ./test.py -f 2-query/last.py
|
||||||
|
#python3 ./test.py -f 2-query/To_iso8601.py
|
||||||
|
python3 ./test.py -f 2-query/To_unixtimestamp.py
|
||||||
|
python3 ./test.py -f 2-query/timetruncate.py
|
||||||
|
|
||||||
|
# python3 ./test.py -f 2-query/Timediff.py
|
||||||
#python3 ./test.py -f 2-query/cast.py
|
#python3 ./test.py -f 2-query/cast.py
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue