Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-30837

This commit is contained in:
54liuyao 2024-10-23 09:32:52 +08:00
commit b025fd29b0
99 changed files with 17378 additions and 9230 deletions

View File

@ -222,7 +222,6 @@ ELSE ()
IF (COMPILER_SUPPORT_FMA)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma")
ENDIF()
MESSAGE(STATUS "FMA instructions is ACTIVATED")
ENDIF()
IF (COMPILER_SUPPORT_AVX)
@ -235,6 +234,7 @@ ELSE ()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
MESSAGE(STATUS "AVX2 instructions is ACTIVATED")
ENDIF()
ENDIF()
IF ("${SIMD_AVX512_SUPPORT}" MATCHES "true")
IF (COMPILER_SUPPORT_AVX512F AND COMPILER_SUPPORT_AVX512BMI)

View File

@ -71,6 +71,8 @@ extern int32_t tsTagFilterResCacheSize;
// queue & threads
extern int32_t tsNumOfRpcThreads;
extern int32_t tsNumOfRpcSessions;
extern int32_t tsShareConnLimit;
extern int32_t tsReadTimeout;
extern int32_t tsTimeToGetAvailableConn;
extern int32_t tsKeepAliveIdle;
extern int32_t tsNumOfCommitThreads;
@ -264,8 +266,8 @@ extern bool tsExperimental;
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs);
int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl,
SArray *pArgs);
int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs,
bool tsc);
void taosCleanupCfg();

View File

@ -985,6 +985,7 @@ typedef struct SEpSet {
SEp eps[TSDB_MAX_REPLICA];
} SEpSet;
int32_t tEncodeSEpSet(SEncoder* pEncoder, const SEpSet* pEp);
int32_t tDecodeSEpSet(SDecoder* pDecoder, SEpSet* pEp);
int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp);

View File

@ -329,6 +329,7 @@
TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_TASK_RELEASE, "task-release", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_SCH_MSG)

View File

@ -63,6 +63,10 @@ typedef struct SRpcHandleInfo {
int8_t forbiddenIp;
int8_t notFreeAhandle;
int8_t compressed;
int64_t seqNum; // msg seq
int64_t qId; // queryId Get from client, other req's qId = -1;
int32_t refIdMgt;
int32_t msgType;
} SRpcHandleInfo;
typedef struct SRpcMsg {
@ -124,8 +128,12 @@ typedef struct SRpcInit {
int32_t connLimitLock;
int32_t timeToGetConn;
int8_t supportBatch; // 0: no batch, 1. batch
int32_t batchSize;
int32_t shareConnLimit;
int8_t shareConn; // 0: no share, 1. share
int8_t notWaitAvaliableConn; // 1: wait to get, 0: no wait
int8_t startReadTimer;
int64_t readTimeout; // s
void *parent;
} SRpcInit;
@ -144,6 +152,7 @@ typedef struct {
SHashObj *args;
SRpcBrokenlinkVal brokenVal;
void (*freeFunc)(const void *arg);
int64_t st;
} SRpcCtx;
int32_t rpcInit();

View File

@ -130,12 +130,13 @@ int taosSetAutoDelFile(char *path);
bool lastErrorIsFileNotExist();
#ifdef BUILD_WITH_RAND_ERR
#define STUB_RAND_NETWORK_ERR(status) \
#define STUB_RAND_NETWORK_ERR(ret) \
do { \
if (tsEnableRandErr && (tsRandErrScope & RAND_ERR_NETWORK)) { \
uint32_t r = taosRand() % tsRandErrDivisor; \
if ((r + 1) <= tsRandErrChance) { \
status = TSDB_CODE_RPC_NETWORK_UNAVAIL; \
ret = TSDB_CODE_RPC_NETWORK_UNAVAIL; \
uError("random network error: %s, %s", tstrerror(ret), __func__); \
} \
} \
while (0)

View File

@ -137,6 +137,7 @@ int32_t taosShutDownSocketRDWR(TdSocketPtr pSocket);
int32_t taosShutDownSocketServerRDWR(TdSocketServerPtr pSocketServer);
int32_t taosSetNonblocking(TdSocketPtr pSocket, int32_t on);
int32_t taosSetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t optlen);
int32_t taosSetSockOpt2(int32_t fd);
int32_t taosGetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t *optlen);
int32_t taosWriteMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
int32_t taosReadMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);

View File

@ -94,9 +94,9 @@ int32_t taosGetErrSize();
#define TSDB_CODE_HTTP_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0025)
#define TSDB_CODE_RPC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0026)
#define TSDB_CODE_RPC_ASYNC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0027)
#define TSDB_CODE_RPC_ASYNC_IN_PROCESS TAOS_DEF_ERROR_CODE(0, 0x0028)
#define TSDB_CODE_RPC_NO_STATE TAOS_DEF_ERROR_CODE(0, 0x0029)
#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A)
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //

View File

@ -506,7 +506,7 @@ typedef enum ELogicConditionType {
#ifdef WINDOWS
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
#else
#define TSDB_MAX_RPC_THREADS 50
#define TSDB_MAX_RPC_THREADS 20
#endif
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type

View File

@ -370,7 +370,10 @@ int32_t openTransporter(const char *user, const char *auth, int32_t numOfThread,
connLimitNum = TMAX(connLimitNum, 10);
connLimitNum = TMIN(connLimitNum, 1000);
rpcInit.connLimitNum = connLimitNum;
rpcInit.shareConnLimit = tsShareConnLimit;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.startReadTimer = 1;
rpcInit.readTimeout = tsReadTimeout;
int32_t code = taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
if (TSDB_CODE_SUCCESS != code) {

View File

@ -410,7 +410,6 @@ int32_t asyncExecDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
SAppInstInfo* pAppInfo = getAppInfo(pRequest);
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
// int64_t transporterId = 0;
int32_t code = asyncSendMsgToServer(pAppInfo->pTransporter, &pMsgInfo->epSet, NULL, pSendMsg);
if (code) {
doRequestCallback(pRequest, code);
@ -2301,7 +2300,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
(void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%.9lf", jsonVd);
varDataSetLen(dst, strlen(varDataVal(dst)));
} else if (jsonInnerType == TSDB_DATA_TYPE_BOOL) {
(void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%s", (*((char*)jsonInnerData) == 1) ? "true" : "false");
(void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%s",
(*((char*)jsonInnerData) == 1) ? "true" : "false");
varDataSetLen(dst, strlen(varDataVal(dst)));
} else {
tscError("doConvertJson error: invalid type:%d", jsonInnerType);
@ -2570,6 +2570,7 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de
connLimitNum = TMIN(connLimitNum, 500);
rpcInit.connLimitNum = connLimitNum;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.readTimeout = tsReadTimeout;
if (TSDB_CODE_SUCCESS != taosVersionStrToInt(version, &(rpcInit.compatibilityVer))) {
tscError("faild to convert taos version from str to int, errcode:%s", terrstr());
goto _OVER;

View File

@ -56,6 +56,8 @@ int32_t tsShellActivityTimer = 3; // second
// queue & threads
int32_t tsNumOfRpcThreads = 1;
int32_t tsNumOfRpcSessions = 30000;
int32_t tsShareConnLimit = 8;
int32_t tsReadTimeout = 900;
int32_t tsTimeToGetAvailableConn = 500000;
int32_t tsKeepAliveIdle = 60;
@ -322,7 +324,6 @@ int32_t tsMaxTsmaNum = 3;
int32_t tsMaxTsmaCalcDelay = 600;
int64_t tsmaDataDeleteMark = 1000 * 60 * 60 * 24; // in ms, default to 1d
#define TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, pName) \
if ((pItem = cfgGetItem(pCfg, pName)) == NULL) { \
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND); \
@ -450,7 +451,9 @@ int32_t taosSetS3Cfg(SConfig *pCfg) {
TAOS_RETURN(TSDB_CODE_SUCCESS);
}
struct SConfig *taosGetCfg() { return tsCfg; }
struct SConfig *taosGetCfg() {
return tsCfg;
}
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
char *apolloUrl) {
@ -572,7 +575,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, CFG_SCOPE_CLIENT, CFG_DYN_ENT_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "queryTableNotExistAsEmpty", tsQueryTbNotExistAsEmpty, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(
cfgAddBool(pCfg, "queryTableNotExistAsEmpty", tsQueryTbNotExistAsEmpty, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableQueryHb", tsEnableQueryHb, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableScience", tsEnableScience, CFG_SCOPE_CLIENT, CFG_DYN_NONE));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
@ -600,16 +604,23 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "metaCacheMaxSize", tsMetaCacheMaxSize, -1, INT32_MAX, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "randErrorChance", tsRandErrChance, 0, 10000, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
TAOS_CHECK_RETURN(
cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorScope", tsRandErrScope, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
tsNumOfRpcThreads = tsNumOfCores / 2;
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, CFG_SCOPE_BOTH, CFG_DYN_NONE));
tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 100000);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
tsShareConnLimit = TRANGE(tsShareConnLimit, 1, 512);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "shareConnLimit", tsShareConnLimit, 1, 512, CFG_SCOPE_BOTH, CFG_DYN_NONE));
tsReadTimeout = TRANGE(tsReadTimeout, 64, 24 * 3600 * 7);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "readTimeout", tsReadTimeout, 64, 24 * 3600 * 7, CFG_SCOPE_BOTH, CFG_DYN_NONE));
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 10000000);
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "timeToGetAvailableConn", tsTimeToGetAvailableConn, 20, 1000000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
@ -865,8 +876,7 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem = cfgGetItem(pCfg, "numOfRpcThreads");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsNumOfRpcThreads = numOfCores / 2;
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS);
pItem->i32 = tsNumOfRpcThreads;
pItem->stype = stype;
}
@ -878,6 +888,20 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem->stype = stype;
}
pItem = cfgGetItem(pCfg, "shareConnLimit");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsShareConnLimit = TRANGE(tsShareConnLimit, 1, 512);
pItem->i32 = tsShareConnLimit;
pItem->stype = stype;
}
pItem = cfgGetItem(pCfg, "readTimeout");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsReadTimeout = TRANGE(tsReadTimeout, 64, 24 * 3600 * 7);
pItem->i32 = tsReadTimeout;
pItem->stype = stype;
}
pItem = cfgGetItem(pCfg, "timeToGetAvailableConn");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000);
@ -1252,6 +1276,12 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "numOfRpcSessions");
tsNumOfRpcSessions = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "shareConnLimit");
tsShareConnLimit = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "readTimeout");
tsReadTimeout = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "timeToGetAvailableConn");
tsTimeToGetAvailableConn = pItem->i32;
@ -1353,6 +1383,12 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "numOfRpcSessions");
tsNumOfRpcSessions = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "shareConnLimit");
tsShareConnLimit = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "readTimeout");
tsReadTimeout = pItem->i32;
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "timeToGetAvailableConn");
tsTimeToGetAvailableConn = pItem->i32;

View File

@ -74,7 +74,7 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_RETRIEVE_IP_WHITE,
.info.ahandle = (void *)0x9527,
.info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 0,
@ -249,7 +249,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_STATUS,
.info.ahandle = (void *)0x9527,
.info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 0,
@ -322,7 +322,7 @@ void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_NOTIFY,
.info.ahandle = (void *)0x9527,
.info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 1,

View File

@ -47,7 +47,6 @@ static void *dmStatusThreadFp(void *param) {
return NULL;
}
extern SMonVloadInfo tsVinfo;
static void *dmStatusInfoThreadFp(void *param) {
SDnodeMgmt *pMgmt = param;
int64_t lastTime = taosGetTimestampMs();
@ -73,19 +72,6 @@ static void *dmStatusInfoThreadFp(void *param) {
}
}
}
dDebug("begin to lock status info when thread exit");
if (taosThreadMutexLock(&pMgmt->pData->statusInfolock) != 0) {
dError("failed to lock status info lock");
return NULL;
}
if (tsVinfo.pVloads != NULL) {
taosArrayDestroy(tsVinfo.pVloads);
tsVinfo.pVloads = NULL;
}
if (taosThreadMutexUnlock(&pMgmt->pData->statusInfolock) != 0) {
dError("failed to unlock status info lock");
return NULL;
}
return NULL;
}

View File

@ -219,6 +219,7 @@ int32_t dmInitVars(SDnode *pDnode) {
return 0;
}
extern SMonVloadInfo tsVinfo;
void dmClearVars(SDnode *pDnode) {
for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) {
SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype];
@ -254,6 +255,25 @@ void dmClearVars(SDnode *pDnode) {
(void)taosThreadRwlockUnlock(&pData->lock);
(void)taosThreadRwlockDestroy(&pData->lock);
dDebug("begin to lock status info when thread exit");
if (taosThreadMutexLock(&pData->statusInfolock) != 0) {
dError("failed to lock status info lock");
return;
}
if (tsVinfo.pVloads != NULL) {
taosArrayDestroy(tsVinfo.pVloads);
tsVinfo.pVloads = NULL;
}
if (taosThreadMutexUnlock(&pData->statusInfolock) != 0) {
dError("failed to unlock status info lock");
return;
}
if (taosThreadMutexDestroy(&pData->statusInfolock) != 0) {
dError("failed to destroy status info lock");
}
memset(&pData->statusInfolock, 0, sizeof(pData->statusInfolock));
(void)taosThreadMutexDestroy(&pDnode->mutex);
memset(&pDnode->mutex, 0, sizeof(pDnode->mutex));
}

View File

@ -267,7 +267,7 @@ _OVER:
}
if (IsReq(pRpc)) {
SRpcMsg rsp = {.code = code, .info = pRpc->info};
SRpcMsg rsp = {.code = code, .info = pRpc->info, .msgType = pRpc->msgType + 1};
if (code == TSDB_CODE_MNODE_NOT_FOUND) {
dmBuildMnodeRedirectRsp(pDnode, &rsp);
}
@ -418,9 +418,12 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
rpcInit.batchSize = 8 * 1024;
rpcInit.shareConnLimit = tsShareConnLimit * 2;
rpcInit.shareConn = 1;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.notWaitAvaliableConn = 0;
rpcInit.startReadTimer = 1;
rpcInit.readTimeout = tsReadTimeout;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
@ -466,8 +469,10 @@ int32_t dmInitStatusClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
rpcInit.batchSize = 8 * 1024;
rpcInit.shareConnLimit = tsShareConnLimit * 2;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.startReadTimer = 0;
rpcInit.readTimeout = 0;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
@ -514,8 +519,11 @@ int32_t dmInitSyncClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
rpcInit.batchSize = 8 * 1024;
rpcInit.shareConnLimit = tsShareConnLimit * 8;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.startReadTimer = 1;
rpcInit.readTimeout = tsReadTimeout;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
}
@ -569,6 +577,7 @@ int32_t dmInitServer(SDnode *pDnode) {
rpcInit.idleTime = tsShellActivityTimer * 1000;
rpcInit.parent = pDnode;
rpcInit.compressSize = tsCompressMsgSize;
rpcInit.shareConnLimit = tsShareConnLimit * 16;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);

View File

@ -237,7 +237,7 @@ static void mndPullupGrant(SMnode *pMnode) {
.pCont = pReq,
.contLen = contLen,
.info.notFreeAhandle = 1,
.info.ahandle = (void *)0x9527};
.info.ahandle = 0};
// TODO check return value
if (tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg) < 0) {
mError("failed to put into write-queue since %s, line:%d", terrstr(), __LINE__);

View File

@ -67,7 +67,6 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg, SQueueInfo* pInfo) {
return code;
}
static FORCE_INLINE void mnodeFreeSBatchRspMsg(void *p) {
if (NULL == p) {
return;

View File

@ -226,7 +226,7 @@ static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) {
concurrentlyLoadRemoteDataImpl(pOperator, pExchangeInfo, pTaskInfo);
}
if (TSDB_CODE_SUCCESS != pOperator->pTaskInfo->code) {
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(pOperator->pTaskInfo->code));
T_LONG_JMP(pTaskInfo->env, pOperator->pTaskInfo->code);
}
if (taosArrayGetSize(pExchangeInfo->pResultBlockList) == 0) {
@ -530,6 +530,16 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
int32_t index = pWrapper->sourceIndex;
SSourceDataInfo* pSourceDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, index);
int64_t* pRpcHandle = taosArrayGet(pExchangeInfo->pFetchRpcHandles, index);
if (pRpcHandle != NULL) {
int32_t ret = asyncFreeConnById(pExchangeInfo->pTransporter, *pRpcHandle);
if (ret != 0) {
qDebug("failed to free rpc handle, code:%s, %p", tstrerror(ret), pExchangeInfo);
}
*pRpcHandle = -1;
}
if (!pSourceDataInfo) {
return terrno;
}

View File

@ -3296,8 +3296,44 @@ static int32_t rewriteIsTrue(SNode* pSrc, SNode** pIsTrue) {
return TSDB_CODE_SUCCESS;
}
extern int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX];
static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) {
if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX ||
newType->type < TSDB_DATA_TYPE_NULL || newType->type >= TSDB_DATA_TYPE_MAX) {
return TSDB_CODE_INVALID_PARA;
}
int8_t type1 = commonType->type;
int8_t type2 = newType->type;
int8_t resultType;
if (type1 < type2) {
resultType = gDisplyTypes[type1][type2];
} else {
resultType = gDisplyTypes[type2][type1];
}
if (resultType == -1) {
return TSDB_CODE_SCALAR_CONVERT_ERROR;
}
if (commonType->type == newType->type) {
commonType->bytes = TMAX(commonType->bytes, newType->bytes);
return TSDB_CODE_SUCCESS;
}
if (resultType == commonType->type){
return TSDB_CODE_SUCCESS;
}
if(resultType == newType->type) {
*commonType = *newType;
return TSDB_CODE_SUCCESS;
}
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
if(resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) {
commonType->bytes += TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE];
}
commonType->type = resultType;
return TSDB_CODE_SUCCESS;
}
static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) {
bool first = true;
bool allNullThen = true;
SNode* pNode = NULL;
FOREACH(pNode, pCaseWhen->pWhenThenList) {
@ -3316,10 +3352,18 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW
continue;
}
allNullThen = false;
if (first || dataTypeComp(&pCaseWhen->node.resType, &pThenExpr->resType) < 0) {
pCaseWhen->node.resType = pThenExpr->resType;
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pThenExpr->resType);
if(TSDB_CODE_SUCCESS != pCxt->errCode){
return DEAL_RES_ERROR;
}
}
SExprNode* pElseExpr = (SExprNode*)pCaseWhen->pElse;
if (NULL != pElseExpr) {
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pElseExpr->resType);
if(TSDB_CODE_SUCCESS != pCxt->errCode) {
return DEAL_RES_ERROR;
}
first = false;
}
if (allNullThen) {

View File

@ -1030,6 +1030,31 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = {
/*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1,
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0};
int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = {
/*NULL BOOL TINY SMAL INT BIGI FLOA DOUB VARC TIME NCHA UTINY USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/
/*NULL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, -1, 8,
/*BOOL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 5, 10, 11, 12, 13, 14, 8, -1, -1, -1, -1, 8,
/*TINY*/ 0, 0, 2, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, 8, -1, -1, -1, -1, 8,
/*SMAL*/ 0, 0, 0, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, 8, -1, -1, -1, -1, 8,
/*INT */ 0, 0, 0, 0, 4, 5, 8, 8, 8, 5, 10, 4, 4, 5, 8, 8, -1, -1, -1, -1, 8,
/*BIGI*/ 0, 0, 0, 0, 0, 5, 8, 8, 8, 5, 10, 5, 5, 5, 8, 8, -1, -1, -1, -1, 8,
/*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8,
/*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8,
/*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8,
/*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, 8, -1, -1, -1, -1, 8,
/*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, -1, -1, -1, -1, 10,
/*UTINY*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, 8, -1, -1, -1, -1, 8,
/*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 8, -1, -1, -1, -1, 8,
/*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 8, -1, -1, -1, -1, 8,
/*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 8, -1, -1, -1, -1, 8,
/*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -1, -1, -1, -1, 8,
/*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, -1, -1, -1, -1,
/*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1,
/*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1,
/*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20
};
int32_t vectorGetConvertType(int32_t type1, int32_t type2) {
if (type1 == type2) {
return 0;

View File

@ -504,6 +504,10 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) {
code);
// called if drop task rsp received code
(void)rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); // ignore error
if (pMsg->handle == NULL) {
qError("sch handle is NULL, may be already released and mem lea");
}
if (pMsg) {
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);

View File

@ -5150,8 +5150,8 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
}
char content[256] = {0};
nBytes = tsnprintf(content, sizeof(content), META_ON_S3_FORMATE, p->pCurrent, p->curChkpId, p->pManifest, p->curChkpId,
"processVer", processId);
nBytes = tsnprintf(content, sizeof(content), META_ON_S3_FORMATE, p->pCurrent, p->curChkpId, p->pManifest,
p->curChkpId, "processVer", processId);
if (nBytes <= 0 || nBytes >= sizeof(content)) {
code = TSDB_CODE_OUT_OF_RANGE;
stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir);

View File

@ -114,6 +114,7 @@ typedef struct SExHandle {
void* handle;
int64_t refId;
void* pThrd;
int8_t pThrdIdx;
queue q;
int8_t inited;
SRWLatch latch;
@ -135,57 +136,33 @@ typedef struct SCvtAddr {
bool cvt;
} SCvtAddr;
typedef struct {
SEpSet epSet; // ip list provided by app
SEpSet origEpSet;
void* ahandle; // handle provided by app
tmsg_t msgType; // message type
int8_t connType; // connection type cli/srv
STransCtx appCtx; //
STransMsg* pRsp; // for synchronous API
tsem_t* pSem; // for synchronous API
STransSyncMsg* pSyncMsg; // for syncchronous with timeout API
int64_t syncMsgRef;
SCvtAddr cvtAddr;
int32_t retryMinInterval;
int32_t retryMaxInterval;
int32_t retryStepFactor;
int64_t retryMaxTimeout;
int64_t retryInitTimestamp;
int64_t retryNextInterval;
bool retryInit;
int32_t retryStep;
int8_t epsetRetryCnt;
int32_t retryCode;
void* task;
int hThrdIdx;
} STransConnCtx;
#pragma pack(push, 1)
typedef struct {
int8_t inUse;
int8_t numOfEps;
SEp eps[];
} SReqEpSet;
#define TRANS_VER 2
typedef struct {
char version : 4; // RPC version
char comp : 2; // compression algorithm, 0:no compression 1:lz4
char noResp : 2; // noResp bits, 0: resp, 1: resp
char persist : 2; // persist handle,0: no persit, 1: persist handle
char release : 2;
char withUserInfo : 2; // 0: sent user info or not
char secured : 2;
char spi : 2;
char hasEpSet : 2; // contain epset or not, 0(default): no epset, 1: contain epset
uint64_t timestamp;
char user[TSDB_UNI_LEN];
int32_t compatibilityVer;
uint32_t magicNum;
STraceId traceId;
uint64_t ahandle; // ahandle assigned by client
int64_t qid;
uint32_t code; // del later
uint32_t msgType;
int32_t msgLen;
int64_t seqNum;
uint8_t content[0]; // message body starts from here
} STransMsgHead;
@ -206,6 +183,35 @@ typedef struct {
#pragma pack(pop)
int32_t transCreateReqEpsetFromUserEpset(const SEpSet* pEpset, SReqEpSet** pReqEpSet);
int32_t transCreateUserEpsetFromReqEpset(const SReqEpSet* pReqEpSet, SEpSet* pEpSet);
int32_t transValidReqEpset(SReqEpSet* pReqEpSet);
typedef struct {
SReqEpSet* epSet; // ip list provided by app
SReqEpSet* origEpSet;
void* ahandle; // handle provided by app
tmsg_t msgType; // message type
STransCtx userCtx; //
STransMsg* pRsp; // for synchronous API
tsem_t* pSem; // for synchronous API
STransSyncMsg* pSyncMsg; // for syncchronous with timeout API
int64_t syncMsgRef;
SCvtAddr* pCvtAddr;
int64_t retryInitTimestamp;
int64_t retryNextInterval;
int64_t retryMaxTimeout;
int32_t retryMinInterval;
int32_t retryMaxInterval;
int32_t retryStepFactor;
int32_t retryStep;
int32_t retryCode;
int8_t retryInit;
int8_t epsetRetryCnt;
} SReqCtx;
typedef enum { Normal, Quit, Release, Register, Update, FreeById } STransMsgType;
typedef enum { ConnNormal, ConnAcquire, ConnRelease, ConnBroken, ConnInPool } ConnStatus;
@ -272,24 +278,24 @@ bool transAsyncPoolIsEmpty(SAsyncPool* pool);
} \
} while (0)
#define ASYNC_CHECK_HANDLE(exh1, id) \
#define ASYNC_CHECK_HANDLE(idMgt, id, exh1) \
do { \
if (id > 0) { \
SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), id); \
if (exh2 == NULL || id != exh2->refId) { \
tDebug("ref:%" PRId64 " already released", id); \
code = terrno; \
SExHandle* exh2 = transAcquireExHandle(idMgt, id); \
if (exh2 == NULL || exh1 != exh2 || (exh2 != NULL && exh2->refId != id)) { \
tError("handle not match, exh1:%p, exh2:%p, refId:%"PRId64"", exh1, exh2, id); \
code = TSDB_CODE_INVALID_MSG; \
goto _return1; \
} \
} else { \
tDebug("invalid handle to release"); \
tError("invalid handle to release"); \
goto _return2; \
} \
} while (0)
int32_t transInitBuffer(SConnBuffer* buf);
int32_t transClearBuffer(SConnBuffer* buf);
int32_t transDestroyBuffer(SConnBuffer* buf);
void transDestroyBuffer(SConnBuffer* buf);
int32_t transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf);
bool transReadComplete(SConnBuffer* connBuf);
int32_t transResetBuffer(SConnBuffer* connBuf, int8_t resetBuf);
@ -301,29 +307,30 @@ void transRefSrvHandle(void* handle);
void transUnrefSrvHandle(void* handle);
void transRefCliHandle(void* handle);
void transUnrefCliHandle(void* handle);
int32_t transUnrefCliHandle(void* handle);
int32_t transGetRefCount(void* handle);
int32_t transReleaseCliHandle(void* handle);
int32_t transReleaseSrvHandle(void* handle);
int32_t transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STransCtx* pCtx);
int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STransMsg* pRsp);
int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pMsg, STransMsg* pRsp, int8_t* epUpdated,
int32_t transSendRequest(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* pCtx);
int32_t transSendRecv(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp);
int32_t transSendRecvWithTimeout(void* pInit, SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp, int8_t* epUpdated,
int32_t timeoutMs);
int32_t transSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId);
int32_t transFreeConnById(void* shandle, int64_t transpointId);
int32_t transSendRequestWithId(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId);
int32_t transFreeConnById(void* pInit, int64_t transpointId);
int32_t transSendResponse(const STransMsg* msg);
int32_t transRegisterMsg(const STransMsg* msg);
int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn);
int32_t transSetIpWhiteList(void* shandle, void* arg, FilteFunc* func);
int32_t transSetDefaultAddr(void* pInit, const char* ip, const char* fqdn);
int32_t transSetIpWhiteList(void* pInit, void* arg, FilteFunc* func);
int32_t transSockInfo2Str(struct sockaddr* sockname, char* dst);
void transSockInfo2Str(struct sockaddr* sockname, char* dst);
int32_t transAllocHandle(int64_t* refId);
void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void transCloseClient(void* arg);
void transCloseServer(void* arg);
@ -336,33 +343,29 @@ void* transCtxDumpVal(STransCtx* ctx, int32_t key);
void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType);
// request list
typedef struct STransReq {
queue q;
uv_write_t wreq;
} STransReq;
void transReqQueueInit(queue* q);
void* transReqQueuePush(queue* q);
void* transReqQueueRemove(void* arg);
void transReqQueueClear(queue* q);
typedef struct SWriteReq {
queue node; // req queue node
void* conn;
} SWriteReq;
// queue sending msgs
typedef struct {
SArray* q;
void (*freeFunc)(const void* arg);
queue node;
void (*freeFunc)(void* arg);
int32_t size;
} STransQueue;
/*
* init queue
* note: queue'size is small, default 1
*/
int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg));
int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(void* arg));
/*
* put arg into queue
* if queue'size > 1, return false; else return true
*/
bool transQueuePush(STransQueue* queue, void* arg);
void transQueuePush(STransQueue* queue, void* arg);
/*
* the size of queue
*/
@ -375,10 +378,25 @@ void* transQueuePop(STransQueue* queue);
* get ith from queue
*/
void* transQueueGet(STransQueue* queue, int i);
/*
* head elm from queue
*/
void* tranQueueHead(STransQueue* q);
/*
* remove all match elm from queue
*/
void transQueueRemoveByFilter(STransQueue* q, bool (*filter)(void* e, void* arg), void* arg, void* dst, int32_t size);
/*
* rm ith from queue
*/
void* transQueueRm(STransQueue* queue, int i);
/*
* remove el from queue
*/
void transQueueRemove(STransQueue* q, void* e);
/*
* queue empty or not
*/
@ -418,9 +436,9 @@ void transDQDestroy(SDelayQueue* queue, void (*freeFunc)(void* arg));
SDelayTask* transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_t timeoutMs);
void transDQCancel(SDelayQueue* queue, SDelayTask* task);
bool transEpSetIsEqual(SEpSet* a, SEpSet* b);
bool transReqEpsetIsEqual(SReqEpSet* a, SReqEpSet* b);
bool transEpSetIsEqual2(SEpSet* a, SEpSet* b);
bool transCompareReqAndUserEpset(SReqEpSet* a, SEpSet* b);
/*
* init global func
*/
@ -432,14 +450,14 @@ void transPrintEpSet(SEpSet* pEpSet);
void transFreeMsg(void* msg);
int32_t transCompressMsg(char* msg, int32_t len);
int32_t transDecompressMsg(char** msg, int32_t len);
int32_t transDecompressMsg(char** msg, int32_t* len);
int32_t transOpenRefMgt(int size, void (*func)(void*));
void transCloseRefMgt(int32_t refMgt);
int64_t transAddExHandle(int32_t refMgt, void* p);
int32_t transRemoveExHandle(int32_t refMgt, int64_t refId);
void transRemoveExHandle(int32_t refMgt, int64_t refId);
void* transAcquireExHandle(int32_t refMgt, int64_t refId);
int32_t transReleaseExHandle(int32_t refMgt, int64_t refId);
void transReleaseExHandle(int32_t refMgt, int64_t refId);
void transDestroyExHandle(void* handle);
int32_t transGetRefMgt();
@ -465,6 +483,33 @@ int32_t subnetDebugInfoToBuf(SubnetUtils* pUtils, char* buf);
int32_t transUtilSIpRangeToStr(SIpV4Range* pRange, char* buf);
int32_t transUtilSWhiteListToStr(SIpWhiteList* pWhiteList, char** ppBuf);
enum { REQ_STATUS_INIT = 0, REQ_STATUS_PROCESSING };
#if defined(WINDOWS) || defined(DARWIN)
#define BUFFER_LIMIT 1
#define STATE_BUFFER_LIMIT 1
#else
#define BUFFER_LIMIT 4
#define STATE_BUFFER_LIMIT 8
#endif
#define HEAP_MISS_HIT_LIMIT 100000
#define READ_TIMEOUT 100000
typedef struct {
queue node; // queue for write
queue q; // queue for reqs
uv_write_t wreq;
void* arg;
} SWReqsWrapper;
int32_t initWQ(queue* wq);
void destroyWQ(queue* wq);
uv_write_t* allocWReqFromWQ(queue* wq, void* arg);
void freeWReqToWQ(queue* wq, SWReqsWrapper* w);
int32_t transSetReadOption(uv_handle_t* handle);
#ifdef __cplusplus
}
#endif

View File

@ -32,8 +32,8 @@
extern "C" {
#endif
void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);
@ -70,12 +70,16 @@ typedef struct {
int32_t connLimitNum;
int8_t connLimitLock; // 0: no lock. 1. lock
int8_t supportBatch; // 0: no batch, 1: support batch
int32_t batchSize;
int32_t shareConnLimit;
int8_t optBatchFetch;
int32_t timeToGetConn;
int index;
void* parent;
void* tcphandle; // returned handle from TCP initialization
int64_t refId;
int8_t shareConn;
int8_t startReadTimer;
int64_t readTimeout;
TdThreadMutex mutex;
} SRpcInfo;

View File

@ -15,13 +15,13 @@
#include "transComm.h"
void* (*taosInitHandle[])(uint32_t ip, uint32_t port, char* label, int32_t numOfThreads, void* fp, void* shandle) = {
void* (*taosInitHandle[])(uint32_t ip, uint32_t port, char* label, int32_t numOfThreads, void* fp, void* pInit) = {
transInitServer, transInitClient};
void (*taosCloseHandle[])(void* arg) = {transCloseServer, transCloseClient};
void (*taosRefHandle[])(void* handle) = {transRefSrvHandle, transRefCliHandle};
void (*taosUnRefHandle[])(void* handle) = {transUnrefSrvHandle, transUnrefCliHandle};
void (*taosUnRefHandle[])(void* handle) = {transUnrefSrvHandle, NULL};
int (*transReleaseHandle[])(void* handle) = {transReleaseSrvHandle, transReleaseCliHandle};
@ -42,6 +42,8 @@ void* rpcOpen(const SRpcInit* pInit) {
if (pRpc == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _end);
}
pRpc->startReadTimer = pInit->startReadTimer;
if (pInit->label) {
int len = strlen(pInit->label) > sizeof(pRpc->label) ? sizeof(pRpc->label) : strlen(pInit->label);
memcpy(pRpc->label, pInit->label, len);
@ -77,7 +79,15 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc->connLimitLock = pInit->connLimitLock;
pRpc->supportBatch = pInit->supportBatch;
pRpc->batchSize = pInit->batchSize;
pRpc->shareConnLimit = pInit->shareConnLimit;
if (pRpc->shareConnLimit <= 0) {
pRpc->shareConnLimit = BUFFER_LIMIT;
}
pRpc->readTimeout = pInit->readTimeout;
if (pRpc->readTimeout < 0) {
pRpc->readTimeout = INT64_MAX;
}
pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads;
if (pRpc->numOfThreads <= 0) {
@ -115,6 +125,8 @@ void* rpcOpen(const SRpcInit* pInit) {
int64_t refId = transAddExHandle(transGetInstMgt(), pRpc);
void* tmp = transAcquireExHandle(transGetInstMgt(), refId);
pRpc->refId = refId;
pRpc->shareConn = pInit->shareConn;
return (void*)refId;
_end:
taosMemoryFree(pRpc);
@ -127,9 +139,8 @@ void rpcClose(void* arg) {
if (arg == NULL) {
return;
}
TAOS_UNUSED(transRemoveExHandle(transGetInstMgt(), (int64_t)arg));
TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)arg));
transRemoveExHandle(transGetInstMgt(), (int64_t)arg);
transReleaseExHandle(transGetInstMgt(), (int64_t)arg);
tInfo("end to close rpc");
return;
}
@ -175,29 +186,29 @@ void* rpcReallocCont(void* ptr, int64_t contLen) {
return st + TRANS_MSG_OVERHEAD;
}
int32_t rpcSendRequest(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid) {
return transSendRequest(shandle, pEpSet, pMsg, NULL);
int32_t rpcSendRequest(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid) {
return transSendRequest(pInit, pEpSet, pMsg, NULL);
}
int32_t rpcSendRequestWithCtx(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
int32_t rpcSendRequestWithCtx(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0 || pRid == NULL) {
return transSendRequest(shandle, pEpSet, pMsg, pCtx);
return transSendRequest(pInit, pEpSet, pMsg, pCtx);
} else {
return transSendRequestWithId(shandle, pEpSet, pMsg, pRid);
return transSendRequestWithId(pInit, pEpSet, pMsg, pRid);
}
}
int32_t rpcSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
return transSendRequestWithId(shandle, pEpSet, pReq, transpointId);
int32_t rpcSendRequestWithId(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
return transSendRequestWithId(pInit, pEpSet, pReq, transpointId);
}
int32_t rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) {
return transSendRecv(shandle, pEpSet, pMsg, pRsp);
int32_t rpcSendRecv(void* pInit, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) {
return transSendRecv(pInit, pEpSet, pMsg, pRsp);
}
int32_t rpcSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
int32_t rpcSendRecvWithTimeout(void* pInit, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
int32_t timeoutMs) {
return transSendRecvWithTimeout(shandle, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
return transSendRecvWithTimeout(pInit, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
}
int32_t rpcFreeConnById(void* shandle, int64_t connId) { return transFreeConnById(shandle, connId); }
int32_t rpcFreeConnById(void* pInit, int64_t connId) { return transFreeConnById(pInit, connId); }
int32_t rpcSendResponse(const SRpcMsg* pMsg) { return transSendResponse(pMsg); }

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
#include "transComm.h"
#define BUFFER_CAP 4096
#define BUFFER_CAP 8 * 1024
static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
@ -59,7 +59,7 @@ int32_t transCompressMsg(char* msg, int32_t len) {
taosMemoryFree(buf);
return ret;
}
int32_t transDecompressMsg(char** msg, int32_t len) {
int32_t transDecompressMsg(char** msg, int32_t* len) {
STransMsgHead* pHead = (STransMsgHead*)(*msg);
if (pHead->comp == 0) return 0;
@ -68,6 +68,7 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
STransCompMsg* pComp = (STransCompMsg*)pCont;
int32_t oriLen = htonl(pComp->contLen);
int32_t tlen = *len;
char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead));
if (buf == NULL) {
return terrno;
@ -75,9 +76,10 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
STransMsgHead* pNewHead = (STransMsgHead*)buf;
int32_t decompLen = LZ4_decompress_safe(pCont + sizeof(STransCompMsg), (char*)pNewHead->content,
len - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen);
tlen - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen);
memcpy((char*)pNewHead, (char*)pHead, sizeof(STransMsgHead));
*len = oriLen + sizeof(STransMsgHead);
pNewHead->msgLen = htonl(oriLen + sizeof(STransMsgHead));
taosMemoryFree(pHead);
@ -95,13 +97,12 @@ void transFreeMsg(void* msg) {
tTrace("rpc free cont:%p", (char*)msg - TRANS_MSG_OVERHEAD);
taosMemoryFree((char*)msg - sizeof(STransMsgHead));
}
int transSockInfo2Str(struct sockaddr* sockname, char* dst) {
void transSockInfo2Str(struct sockaddr* sockname, char* dst) {
struct sockaddr_in addr = *(struct sockaddr_in*)sockname;
char buf[20] = {0};
int r = uv_ip4_name(&addr, (char*)buf, sizeof(buf));
sprintf(dst, "%s:%d", buf, ntohs(addr.sin_port));
return r;
}
int32_t transInitBuffer(SConnBuffer* buf) {
buf->buf = taosMemoryCalloc(1, BUFFER_CAP);
@ -116,10 +117,9 @@ int32_t transInitBuffer(SConnBuffer* buf) {
buf->invalid = 0;
return 0;
}
int32_t transDestroyBuffer(SConnBuffer* p) {
void transDestroyBuffer(SConnBuffer* p) {
taosMemoryFree(p->buf);
p->buf = NULL;
return 0;
}
int32_t transClearBuffer(SConnBuffer* buf) {
@ -184,7 +184,7 @@ int32_t transResetBuffer(SConnBuffer* connBuf, int8_t resetBuf) {
}
}
} else {
tError("failed to reset buffer, total:%d, len:%d, reason:%s", p->total, p->len, tstrerror(TSDB_CODE_INVALID_MSG));
tError("failed to reset buffer, total:%d, len:%d since %s", p->total, p->len, tstrerror(TSDB_CODE_INVALID_MSG));
return TSDB_CODE_INVALID_MSG;
}
return 0;
@ -281,7 +281,7 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
async->data = item;
err = uv_async_init(loop, async, cb);
if (err != 0) {
tError("failed to init async, reason:%s", uv_err_name(err));
tError("failed to init async since %s", uv_err_name(err));
code = TSDB_CODE_THIRDPARTY_ERROR;
break;
}
@ -333,14 +333,16 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
SAsyncItem* item = async->data;
if (taosThreadMutexLock(&item->mtx) != 0) {
tError("failed to lock mutex");
tError("failed to lock mutex since %s", tstrerror(terrno));
return terrno;
}
QUEUE_PUSH(&item->qmsg, q);
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
int ret = uv_async_send(async);
if (ret != 0) {
tError("failed to send async,reason:%s", uv_err_name(ret));
tError("failed to send async since %s", uv_err_name(ret));
return TSDB_CODE_THIRDPARTY_ERROR;
}
return 0;
@ -348,15 +350,17 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
void transCtxInit(STransCtx* ctx) {
// init transCtx
ctx->args = taosHashInit(2, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UINT), true, HASH_NO_LOCK);
ctx->args = taosHashInit(2, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
}
void transCtxCleanup(STransCtx* ctx) {
if (ctx->args == NULL) {
if (ctx == NULL || ctx->args == NULL) {
return;
}
STransCtxVal* iter = taosHashIterate(ctx->args, NULL);
while (iter) {
int32_t* type = taosHashGetKey(iter, NULL);
tDebug("free msg type %s dump func", TMSG_INFO(*type));
ctx->freeFunc(iter->val);
iter = taosHashIterate(ctx->args, iter);
}
@ -385,7 +389,7 @@ void transCtxMerge(STransCtx* dst, STransCtx* src) {
int32_t code = taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal));
if (code != 0) {
tError("failed to put val to hash, reason:%s", tstrerror(code));
tError("failed to put val to hash since %s", tstrerror(code));
}
iter = taosHashIterate(src->args, iter);
}
@ -415,119 +419,92 @@ void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType) {
return ret;
}
void transReqQueueInit(queue* q) {
// init req queue
QUEUE_INIT(q);
int32_t transQueueInit(STransQueue* wq, void (*freeFunc)(void* arg)) {
QUEUE_INIT(&wq->node);
wq->freeFunc = (void (*)(void*))freeFunc;
wq->size = 0;
return 0;
}
void transQueuePush(STransQueue* q, void* arg) {
queue* node = arg;
QUEUE_PUSH(&q->node, node);
q->size++;
}
void* transQueuePop(STransQueue* q) {
if (q->size == 0) return NULL;
queue* head = QUEUE_HEAD(&q->node);
QUEUE_REMOVE(head);
q->size--;
return head;
}
int32_t transQueueSize(STransQueue* q) { return q->size; }
void* transQueueGet(STransQueue* q, int idx) {
if (q->size == 0) return NULL;
while (idx-- > 0) {
queue* node = QUEUE_NEXT(&q->node);
if (node == &q->node) return NULL;
}
void* transReqQueuePush(queue* q) {
STransReq* req = taosMemoryCalloc(1, sizeof(STransReq));
if (req == NULL) {
return NULL;
}
req->wreq.data = req;
QUEUE_PUSH(q, &req->q);
return &req->wreq;
void transQueueRemoveByFilter(STransQueue* q, bool (*filter)(void* e, void* arg), void* arg, void* dst, int32_t size) {
queue* d = dst;
queue* node = QUEUE_NEXT(&q->node);
while (node != &q->node) {
queue* next = QUEUE_NEXT(node);
if (filter && filter(node, arg)) {
QUEUE_REMOVE(node);
q->size--;
QUEUE_PUSH(d, node);
if (--size == 0) {
break;
}
void* transReqQueueRemove(void* arg) {
void* ret = NULL;
uv_write_t* wreq = arg;
STransReq* req = wreq ? wreq->data : NULL;
if (req == NULL) return NULL;
QUEUE_REMOVE(&req->q);
ret = wreq && wreq->handle ? wreq->handle->data : NULL;
taosMemoryFree(req);
return ret;
}
void transReqQueueClear(queue* q) {
while (!QUEUE_IS_EMPTY(q)) {
queue* h = QUEUE_HEAD(q);
node = next;
}
}
void* tranQueueHead(STransQueue* q) {
if (q->size == 0) return NULL;
queue* head = QUEUE_HEAD(&q->node);
return head;
}
void* transQueueRm(STransQueue* q, int i) {
// if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
// return NULL;
// }
// if (i >= taosArrayGetSize(queue->q)) {
// return NULL;
// }
// void* ptr = taosArrayGetP(queue->q, i);
// taosArrayRemove(queue->q, i);
// return ptr;
return NULL;
}
void transQueueRemove(STransQueue* q, void* e) {
if (q->size == 0) return;
queue* node = e;
QUEUE_REMOVE(node);
q->size--;
}
bool transQueueEmpty(STransQueue* q) { return q->size == 0 ? true : false; }
void transQueueClear(STransQueue* q) {
while (!QUEUE_IS_EMPTY(&q->node)) {
queue* h = QUEUE_HEAD(&q->node);
QUEUE_REMOVE(h);
STransReq* req = QUEUE_DATA(h, STransReq, q);
taosMemoryFree(req);
if (q->freeFunc != NULL) (q->freeFunc)(h);
q->size--;
}
}
int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) {
queue->q = taosArrayInit(2, sizeof(void*));
if (queue->q == NULL) {
return terrno;
}
queue->freeFunc = (void (*)(const void*))freeFunc;
return 0;
}
bool transQueuePush(STransQueue* queue, void* arg) {
if (queue->q == NULL) {
return true;
}
if (taosArrayPush(queue->q, &arg) == NULL) {
return false;
}
if (taosArrayGetSize(queue->q) > 1) {
return false;
}
return true;
}
void* transQueuePop(STransQueue* queue) {
if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
return NULL;
}
void* ptr = taosArrayGetP(queue->q, 0);
taosArrayRemove(queue->q, 0);
return ptr;
}
int32_t transQueueSize(STransQueue* queue) {
if (queue->q == NULL) {
return 0;
}
return taosArrayGetSize(queue->q);
}
void* transQueueGet(STransQueue* queue, int i) {
if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
return NULL;
}
if (i >= taosArrayGetSize(queue->q)) {
return NULL;
}
void* ptr = taosArrayGetP(queue->q, i);
return ptr;
}
void* transQueueRm(STransQueue* queue, int i) {
if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
return NULL;
}
if (i >= taosArrayGetSize(queue->q)) {
return NULL;
}
void* ptr = taosArrayGetP(queue->q, i);
taosArrayRemove(queue->q, i);
return ptr;
}
bool transQueueEmpty(STransQueue* queue) {
if (queue->q == NULL) {
return true;
}
return taosArrayGetSize(queue->q) == 0;
}
void transQueueClear(STransQueue* queue) {
if (queue->freeFunc != NULL) {
for (int i = 0; i < taosArrayGetSize(queue->q); i++) {
void* p = taosArrayGetP(queue->q, i);
queue->freeFunc(p);
}
}
taosArrayClear(queue->q);
}
void transQueueDestroy(STransQueue* queue) {
transQueueClear(queue);
taosArrayDestroy(queue->q);
}
void transQueueDestroy(STransQueue* q) { transQueueClear(q); }
static FORCE_INLINE int32_t timeCompare(const HeapNode* a, const HeapNode* b) {
SDelayTask* arg1 = container_of(a, SDelayTask, node);
@ -690,7 +667,13 @@ void transPrintEpSet(SEpSet* pEpSet) {
len += tsnprintf(buf + len, sizeof(buf) - len, "}");
tTrace("%s, inUse:%d", buf, pEpSet->inUse);
}
bool transEpSetIsEqual(SEpSet* a, SEpSet* b) {
bool transReqEpsetIsEqual(SReqEpSet* a, SReqEpSet* b) {
if (a == NULL && b == NULL) {
return true;
} else if (a == NULL || b == NULL) {
return false;
}
if (a->numOfEps != b->numOfEps || a->inUse != b->inUse) {
return false;
}
@ -701,7 +684,7 @@ bool transEpSetIsEqual(SEpSet* a, SEpSet* b) {
}
return true;
}
bool transEpSetIsEqual2(SEpSet* a, SEpSet* b) {
bool transCompareReqAndUserEpset(SReqEpSet* a, SEpSet* b) {
if (a->numOfEps != b->numOfEps) {
return false;
}
@ -757,28 +740,31 @@ int64_t transAddExHandle(int32_t refMgt, void* p) {
// acquire extern handle
return taosAddRef(refMgt, p);
}
int32_t transRemoveExHandle(int32_t refMgt, int64_t refId) {
void transRemoveExHandle(int32_t refMgt, int64_t refId) {
// acquire extern handle
return taosRemoveRef(refMgt, refId);
int32_t code = taosRemoveRef(refMgt, refId);
if (code != 0) {
tTrace("failed to remove %" PRId64 " from resetId:%d", refId, refMgt);
}
}
void* transAcquireExHandle(int32_t refMgt, int64_t refId) { // acquire extern handle
return (void*)taosAcquireRef(refMgt, refId);
}
int32_t transReleaseExHandle(int32_t refMgt, int64_t refId) {
void transReleaseExHandle(int32_t refMgt, int64_t refId) {
// release extern handle
return taosReleaseRef(refMgt, refId);
int32_t code = taosReleaseRef(refMgt, refId);
if (code != 0) {
tTrace("failed to release %" PRId64 " from resetId:%d", refId, refMgt);
}
}
void transDestroyExHandle(void* handle) {
if (handle == NULL) {
return;
}
SExHandle* eh = handle;
if (!QUEUE_IS_EMPTY(&eh->q)) {
tDebug("handle %p mem leak", handle);
}
tDebug("free exhandle %p", handle);
tDebug("trans destroy sid:%" PRId64 ", memory %p", eh->refId, handle);
taosMemoryFree(handle);
}
@ -841,7 +827,7 @@ int32_t transUtilSIpRangeToStr(SIpV4Range* pRange, char* buf) {
int32_t err = uv_inet_ntop(AF_INET, &addr, buf, 32);
if (err != 0) {
tError("failed to convert ip to string, reason:%s", uv_strerror(err));
tError("failed to convert ip to string since %s", uv_strerror(err));
return TSDB_CODE_THIRDPARTY_ERROR;
}
@ -890,3 +876,113 @@ int32_t transUtilSWhiteListToStr(SIpWhiteList* pList, char** ppBuf) {
// STUB_RAND_NETWORK_ERR(status)
// return status;
// }
int32_t initWQ(queue* wq) {
int32_t code = 0;
QUEUE_INIT(wq);
for (int i = 0; i < 4; i++) {
SWReqsWrapper* w = taosMemoryCalloc(1, sizeof(SWReqsWrapper));
if (w == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _exception);
}
w->wreq.data = w;
w->arg = NULL;
QUEUE_INIT(&w->node);
QUEUE_PUSH(wq, &w->q);
}
return 0;
_exception:
destroyWQ(wq);
return code;
}
void destroyWQ(queue* wq) {
while (!QUEUE_IS_EMPTY(wq)) {
queue* h = QUEUE_HEAD(wq);
QUEUE_REMOVE(h);
SWReqsWrapper* w = QUEUE_DATA(h, SWReqsWrapper, q);
taosMemoryFree(w);
}
}
uv_write_t* allocWReqFromWQ(queue* wq, void* arg) {
if (!QUEUE_IS_EMPTY(wq)) {
queue* node = QUEUE_HEAD(wq);
QUEUE_REMOVE(node);
SWReqsWrapper* w = QUEUE_DATA(node, SWReqsWrapper, q);
w->arg = arg;
QUEUE_INIT(&w->node);
return &w->wreq;
} else {
SWReqsWrapper* w = taosMemoryCalloc(1, sizeof(SWReqsWrapper));
if (w == NULL) {
return NULL;
}
w->wreq.data = w;
w->arg = arg;
QUEUE_INIT(&w->node);
return &w->wreq;
}
}
void freeWReqToWQ(queue* wq, SWReqsWrapper* w) {
QUEUE_INIT(&w->node);
QUEUE_PUSH(wq, &w->q);
}
int32_t transSetReadOption(uv_handle_t* handle) {
int32_t code = 0;
int32_t fd;
int ret = uv_fileno((uv_handle_t*)handle, &fd);
if (ret != 0) {
tWarn("failed to get fd since %s", uv_err_name(ret));
return TSDB_CODE_THIRDPARTY_ERROR;
}
code = taosSetSockOpt2(fd);
return code;
}
int32_t transCreateReqEpsetFromUserEpset(const SEpSet* pEpset, SReqEpSet** pReqEpSet) {
if (pEpset == NULL) {
return TSDB_CODE_INVALID_PARA;
}
if (pReqEpSet == NULL) {
return TSDB_CODE_INVALID_PARA;
}
int32_t size = sizeof(SReqEpSet) + sizeof(SEp) * pEpset->numOfEps;
SReqEpSet* pReq = (SReqEpSet*)taosMemoryCalloc(1, size);
if (pReq == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
memcpy((char*)pReq, (char*)pEpset, size);
// clear previous
taosMemoryFree(*pReqEpSet);
if (transValidReqEpset(pReq) != TSDB_CODE_SUCCESS) {
taosMemoryFree(pReq);
return TSDB_CODE_INVALID_PARA;
}
*pReqEpSet = pReq;
return TSDB_CODE_SUCCESS;
}
int32_t transCreateUserEpsetFromReqEpset(const SReqEpSet* pReqEpSet, SEpSet* pEpSet) {
if (pReqEpSet == NULL) {
return TSDB_CODE_INVALID_PARA;
}
memcpy((char*)pEpSet, (char*)pReqEpSet, sizeof(SReqEpSet) + sizeof(SEp) * pReqEpSet->numOfEps);
return TSDB_CODE_SUCCESS;
}
int32_t transValidReqEpset(SReqEpSet* pReqEpSet) {
if (pReqEpSet == NULL) {
return TSDB_CODE_INVALID_PARA;
}
if (pReqEpSet->numOfEps == 0 || pReqEpSet->numOfEps > TSDB_MAX_EP_NUM || pReqEpSet->inUse >= TSDB_MAX_EP_NUM) {
return TSDB_CODE_INVALID_PARA;
}
return TSDB_CODE_SUCCESS;
}

File diff suppressed because it is too large Load Diff

View File

@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.connLimitNum = 10;
rpcInit.connLimitLock = 1;
rpcInit.batchSize = 16 * 1024;
rpcInit.shareConnLimit = 16 * 1024;
rpcInit.supportBatch = 1;
rpcDebugFlag = 135;

View File

@ -398,7 +398,8 @@ HANDLE taosOpenFileNotStream(const char *path, int32_t tdFileOptions) {
DWORD dwError = GetLastError();
terrno = TAOS_SYSTEM_WINAPI_ERROR(dwError);
// LPVOID lpMsgBuf;
// FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPTSTR)&lpMsgBuf, 0,
// FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPTSTR)&lpMsgBuf,
// 0,
// NULL);
// printf("CreateFile failed with error %d: %s", dwError, (char *)lpMsgBuf);
// LocalFree(lpMsgBuf);

View File

@ -308,6 +308,7 @@ void *taosMemoryCalloc(int64_t num, int64_t size) {
uint32_t r = taosRand() % tsRandErrDivisor;
if ((r + 1) <= tsRandErrChance) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
uError("random memory error: %s, %s", tstrerror(terrno), __func__);
return NULL;
}
}

View File

@ -482,3 +482,18 @@ uint64_t taosNtoh64(uint64_t val) {
}
#endif
}
int32_t taosSetSockOpt2(int32_t fd) {
#if defined(WINDOWS) || defined(DARWIN)
return 0;
#else
int32_t ret = setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int));
if (ret < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return terrno;
} else {
return 0;
}
#endif
return 0;
}

View File

@ -59,6 +59,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy")
TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_MODULE_QUIT, "http-report already quit")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MODULE_QUIT, "rpc module already quit")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_MODULE_QUIT, "rpc async module already quit")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_IN_PROCESS, "rpc async in process")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NO_STATE, "rpc no state")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped")
//common & util
TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized")

View File

@ -225,6 +225,7 @@ void destroyPriorityQueue(PriorityQueue* pq) {
static size_t pqParent(size_t i) { return (--i) >> 1; /* (i - 1) / 2 */ }
static size_t pqLeft(size_t i) { return (i << 1) | 1; /* i * 2 + 1 */ }
static size_t pqRight(size_t i) { return (++i) << 1; /* (i + 1) * 2 */ }
static void pqSwapPQNode(PriorityQueueNode* a, PriorityQueueNode* b) {
void* tmp = a->data;
a->data = b->data;

View File

@ -19,7 +19,7 @@
#include "tlog.h"
#include "tutil.h"
#define TSDB_REF_OBJECTS 50
#define TSDB_REF_OBJECTS 100
#define TSDB_REF_STATE_EMPTY 0
#define TSDB_REF_STATE_ACTIVE 1
#define TSDB_REF_STATE_DELETED 2
@ -254,7 +254,9 @@ void *taosAcquireRef(int32_t rsetId, int64_t rid) {
}
int32_t taosReleaseRef(int32_t rsetId, int64_t rid) { return taosDecRefCount(rsetId, rid, 0, NULL); }
int32_t taosReleaseRefEx(int32_t rsetId, int64_t rid, int32_t* isReleased) { return taosDecRefCount(rsetId, rid, 0, isReleased); }
int32_t taosReleaseRefEx(int32_t rsetId, int64_t rid, int32_t *isReleased) {
return taosDecRefCount(rsetId, rid, 0, isReleased);
}
// if rid is 0, return the first p in hash list, otherwise, return the next after current rid
void *taosIterateRef(int32_t rsetId, int64_t rid) {

View File

@ -0,0 +1,55 @@
#include <gtest/gtest.h>
#include "taoserror.h"
#include "theap.h"
using namespace std;
typedef struct TNode {
int32_t data;
HeapNode node;
} TNodeMem;
#define container_of(ptr, type, member) ((type*)((char*)(ptr)-offsetof(type, member)))
int32_t heapCompare(const HeapNode* a, const HeapNode* b) {
TNodeMem *ta = container_of(a, TNodeMem, node);
TNodeMem *tb = container_of(b, TNodeMem, node);
if (ta->data > tb->data) {
return 0;
}
return 1;
}
TEST(TD_UTIL_HEAP_TEST, heapTest) {
Heap* heap = heapCreate(heapCompare);
ASSERT_TRUE(heap != NULL);
ASSERT_EQ(0, heapSize(heap));
int32_t limit = 10;
TNodeMem **pArr = (TNodeMem **)taosMemoryCalloc(100, sizeof(TNodeMem *));
for (int i = 0; i < 100; i++) {
TNodeMem *a = (TNodeMem *)taosMemoryCalloc(1, sizeof(TNodeMem));
a->data = i%limit;
heapInsert(heap, &a->node);
pArr[i] = a;
TNodeMem *b = (TNodeMem *)taosMemoryCalloc(1, sizeof(TNodeMem));
b->data = (limit - i)%limit;
heapInsert(heap, &b->node);
}
for (int i = 98; i < 100; i++) {
TNodeMem *p = pArr[i];
p->data = -100000;
}
HeapNode *node = heapMin(heap);
while (node != NULL) {
TNodeMem *data = container_of(node, TNodeMem, node);
heapRemove(heap, node);
printf("%d\t", data->data);
node = heapMin(heap);
}
heapDestroy(heap);
}

View File

@ -1,112 +1,302 @@
104
104
104
104
229
105.000000000000000
103.000000000000000
104
104
104
104
104
105.000000000000000
2.080000000000000e+02
110
228
117
112
110
110
112
110
112
228
110
228
117
112
110
110
228
117
112
110
12100.000000000000000
51984.000000000000000
13689.000000000000000
12544.000000000000000
12100.000000000000000
10.488088481701515
15.099668870541500
10.816653826391969
10.583005244258363
10.488088481701515
110
228
117
112
110
116
116
39
108
120
108
120
108
116
104
116
116
104
108
120
108
120
108
116
104
116
116
104
110
228
117
112
110
110
97
228
110
97
110
228
117
112
110
110
97
228
110
97
110
112
110
112
228
117
112
112
112
112
110
112
110
112
228
117
112
112
112
112
taos> select ASCII('hello')
ascii('hello') |
=================
104 |
taos> select ASCII('hello world')
ascii('hello world') |
=======================
104 |
taos> select ASCII('hello world!')
ascii('hello world!') |
========================
104 |
taos> select ASCII('hello,world.你好,世界。')
ascii('hello,world.你好,世界。') |
==========================================
104 |
taos> select ASCII('北京涛思数据科技有限公司')
ascii('北京涛思数据科技有限公司') |
================================================
229 |
taos> select ASCII('hello') + 1
ascii('hello') + 1 |
============================
105.000000000000000 |
taos> select ASCII('hello') - 1
ascii('hello') - 1 |
============================
103.000000000000000 |
taos> select ASCII('hello') from ts_4893.meters limit 5
ascii('hello') |
=================
104 |
104 |
104 |
104 |
104 |
taos> select ASCII('hello') + 1 from ts_4893.meters limit 1
ascii('hello') + 1 |
============================
105.000000000000000 |
taos> select ASCII('hello') + ASCII('hello') from ts_4893.meters limit 1
ascii('hello') + ascii('hello') |
==================================
2.080000000000000e+02 |
taos> select ASCII(nch1) from ts_4893.meters order by ts limit 5
ascii(nch1) |
==============
110 |
228 |
117 |
112 |
110 |
taos> select ASCII(var1) from ts_4893.meters order by ts limit 5
ascii(var1) |
==============
110 |
112 |
110 |
112 |
228 |
taos> select ASCII(concat(nch1,var1)) from ts_4893.meters order by ts limit 5
ascii(concat(nch1,var1)) |
===========================
110 |
228 |
117 |
112 |
110 |
taos> select ASCII(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5
ascii(cast(nch1 as varchar)) |
===============================
110 |
228 |
117 |
112 |
110 |
taos> select pow(ASCII(nch1), 2) from ts_4893.meters order by ts limit 5
pow(ascii(nch1), 2) |
============================
12100.000000000000000 |
51984.000000000000000 |
13689.000000000000000 |
12544.000000000000000 |
12100.000000000000000 |
taos> select sqrt(ASCII(nch1)) from ts_4893.meters order by ts limit 5
sqrt(ascii(nch1)) |
============================
10.488088481701515 |
15.099668870541500 |
10.816653826391969 |
10.583005244258363 |
10.488088481701515 |
taos> select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5
cast(ascii(nch1) as int) |
===========================
110 |
228 |
117 |
112 |
110 |
taos> select ascii('taos')
ascii('taos') |
================
116 |
taos> select ascii('t')
ascii('t') |
=============
116 |
taos> select ascii('\'')
ascii('\'') |
==============
39 |
taos> select ascii(name) from ts_4893.d0 order by ts limit 10
ascii(name) |
==============
108 |
120 |
108 |
120 |
108 |
116 |
104 |
116 |
116 |
104 |
taos> select ascii(name) from ts_4893.meters order by ts limit 10
ascii(name) |
==============
108 |
120 |
108 |
120 |
108 |
116 |
104 |
116 |
116 |
104 |
taos> select ascii(nch1) from ts_4893.d0 order by ts limit 10
ascii(nch1) |
==============
110 |
228 |
117 |
112 |
110 |
110 |
97 |
228 |
110 |
97 |
taos> select ascii(nch1) from ts_4893.meters order by ts limit 10
ascii(nch1) |
==============
110 |
228 |
117 |
112 |
110 |
110 |
97 |
228 |
110 |
97 |
taos> select ascii(var1) from ts_4893.d0 order by ts limit 10
ascii(var1) |
==============
110 |
112 |
110 |
112 |
228 |
117 |
112 |
112 |
112 |
112 |
taos> select ascii(var1) from ts_4893.meters order by ts limit 10
ascii(var1) |
==============
110 |
112 |
110 |
112 |
228 |
117 |
112 |
112 |
112 |
112 |
taos> select ascii(null)
ascii(null) |
==============
NULL |
taos> select ascii('0')
ascii('0') |
=============
48 |
taos> select ascii(' ')
ascii(' ') |
=============
32 |
taos> select ascii('~')
ascii('~') |
=============
126 |
taos> select ascii('中')
ascii('中') |
===============
228 |
taos> select ascii('é')
ascii('é') |
==============
195 |
taos> select ascii('!@#')
ascii('!@#') |
===============
33 |
taos> select ascii('Hello')
ascii('Hello') |
=================
72 |
taos> select ascii('123abc')
ascii('123abc') |
==================
49 |
taos> select ascii(concat('A', 'B'))
ascii(concat('A', 'B')) |
==========================
65 |
taos> select ascii(char(65))
ascii(char(65)) |
==================
65 |
taos> select ascii(upper('b'))
ascii(upper('b')) |
====================
66 |
taos> select ascii(trim(' A '))
ascii(trim(' A ')) |
=====================
65 |
taos> select name, ascii(name) from ts_4893.meters limit 1
name | ascii(name) |
===============================================
lili | 108 |
taos> select name, ascii(substring(name, 1, 1)) from ts_4893.meters limit 1
name | ascii(substring(name, 1, 1)) |
================================================================
lili | 108 |
taos> select nch1, ascii(nch1) from ts_4893.meters limit 1
nch1 | ascii(nch1) |
===============================================
novel | 110 |
taos> select var1, ascii(var1) from ts_4893.meters limit 1
var1 | ascii(var1) |
===============================================
novel | 110 |

Can't render this file because it has a wrong number of fields in line 17.

View File

@ -1,43 +1,129 @@
M
M
d
M
M
M
M
M
MNOPQ
MNOPQ
MNOPQ
MNOPQ
MNOPQ
MM
MM
MM
MM
MM
MN
MN
MN
MN
MN
1
M
N
O
P
Q
MMM
NNN
OOO
PPP
QQQ
MMMMM
NNNNN
OOOOO
PPPPP
QQQQQ
M
MM
{
M{
taos> select CHAR(77)
char(77) |
===========
M |
taos> select CHAR(77.5)
char(77.5) |
=============
M |
taos> select CHAR(100)
char(100) |
============
d |
taos> select CHAR(77) from ts_4893.meters limit 5
char(77) |
===========
M |
M |
M |
M |
M |
taos> select CHAR(77,78,79,80,81) from ts_4893.meters limit 5
char(77,78,79,80,81) |
=========================
MNOPQ |
MNOPQ |
MNOPQ |
MNOPQ |
MNOPQ |
taos> select CHAR(77*256+77) from ts_4893.meters limit 5
char(77*256+77) |
==================
MM |
MM |
MM |
MM |
MM |
taos> select concat(CHAR(77),CHAR(78)) from ts_4893.meters limit 5
concat(char(77),char(78)) |
============================
MN |
MN |
MN |
MN |
MN |
taos> select cast(CHAR(49) as int)
cast(char(49) as int) |
========================
1 |
taos> select CHAR(id + 77) from ts_4893.meters order by ts limit 5;
char(id + 77) |
================
M |
N |
O |
P |
Q |
taos> select CONCAT(CHAR(id + 77),CHAR(id + 77),CHAR(id + 77)) from ts_4893.meters limit 5
concat(char(id + 77),char(id + 77),char(id + 77)) |
====================================================
MMM |
NNN |
OOO |
PPP |
QQQ |
taos> select CHAR(id+77, id+77, id+77, id+77, id+77) from ts_4893.meters limit 5
char(id+77, id+77, id+77, id+77, id+77) |
==========================================
MMMMM |
NNNNN |
OOOOO |
PPPPP |
QQQQQ |
taos> select char(77)
char(77) |
===========
M |
taos> select char(77 * 256 + 77)
char(77 * 256 + 77) |
======================
MM |
taos> select char('123')
char('123') |
==============
{ |
taos> select char(77, NULL, '123')
char(77, null, '123') |
========================
M{ |
taos> select char(null)
char(null) |
=============
|
taos> select char('ustc')
char('ustc') |
===============
|
taos> select char(65.99)
char(65.99) |
==============
A |
taos> select char(65, 66, 67)
char(65, 66, 67) |
===================
ABC |
taos> select char(72, 101, 108, 108, 111)
char(72, 101, 108, 108, 111) |
===============================
Hello |

Can't render this file because it has a wrong number of fields in line 26.

View File

@ -1,93 +1,259 @@
5
11
12
18
12
6.000000000000000
4.000000000000000
5
5
5
5
5
6.000000000000000
1.000000000000000e+01
5
10
6
7
5
5
6
5
5
10
10
16
11
12
15
5
10
6
7
5
25.000000000000000
100.000000000000000
36.000000000000000
49.000000000000000
25.000000000000000
2.236067977499790
3.162277660168380
2.449489742783178
2.645751311064591
2.236067977499790
5
10
6
7
5
4
2
6
5
5
10
6
7
5
5
5
10
5
5
5
10
6
7
5
5
5
10
5
5
5
6
5
5
10
6
7
6
7
5
5
6
5
5
10
6
7
6
7
5
taos> select CHAR_LENGTH('hello')
char_length('hello') |
========================
5 |
taos> select CHAR_LENGTH('hello world')
char_length('hello world') |
=============================
11 |
taos> select CHAR_LENGTH('hello world!')
char_length('hello world!') |
==============================
12 |
taos> select CHAR_LENGTH('hello,world.你好,世界。')
char_length('hello,world.你好,世界。') |
================================================
18 |
taos> select CHAR_LENGTH('北京涛思数据科技有限公司')
char_length('北京涛思数据科技有限公司') |
======================================================
12 |
taos> select CHAR_LENGTH('hello') + 1
char_length('hello') + 1 |
============================
6.000000000000000 |
taos> select CHAR_LENGTH('hello') - 1
char_length('hello') - 1 |
============================
4.000000000000000 |
taos> select CHAR_LENGTH('hello') from ts_4893.meters limit 5
char_length('hello') |
========================
5 |
5 |
5 |
5 |
5 |
taos> select CHAR_LENGTH('hello') + 1 from ts_4893.meters limit 1
char_length('hello') + 1 |
============================
6.000000000000000 |
taos> select CHAR_LENGTH('hello') + CHAR_LENGTH('hello') from ts_4893.meters limit 1
char_length('hello') + char_length('hello') |
==============================================
1.000000000000000e+01 |
taos> select CHAR_LENGTH(nch1) from ts_4893.meters order by ts limit 5
char_length(nch1) |
========================
5 |
10 |
6 |
7 |
5 |
taos> select CHAR_LENGTH(var1) from ts_4893.meters order by ts limit 5
char_length(var1) |
========================
5 |
6 |
5 |
5 |
10 |
taos> select CHAR_LENGTH(concat(nch1,var1)) from ts_4893.meters order by ts limit 5
char_length(concat(nch1,var1)) |
=================================
10 |
16 |
11 |
12 |
15 |
taos> select CHAR_LENGTH(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5
char_length(cast(nch1 as varchar)) |
=====================================
5 |
10 |
6 |
7 |
5 |
taos> select pow(CHAR_LENGTH(nch1), 2) from ts_4893.meters order by ts limit 5
pow(char_length(nch1), 2) |
============================
25.000000000000000 |
100.000000000000000 |
36.000000000000000 |
49.000000000000000 |
25.000000000000000 |
taos> select sqrt(CHAR_LENGTH(nch1)) from ts_4893.meters order by ts limit 5
sqrt(char_length(nch1)) |
============================
2.236067977499790 |
3.162277660168380 |
2.449489742783178 |
2.645751311064591 |
2.236067977499790 |
taos> select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5
cast(char_length(nch1) as int) |
=================================
5 |
10 |
6 |
7 |
5 |
taos> select char_length('taos')
char_length('taos') |
========================
4 |
taos> select char_length('涛思')
char_length('涛思') |
========================
2 |
taos> select char_length('涛思taos')
char_length('涛思taos') |
============================
6 |
taos> select char_length('tao\'s')
char_length('tao\'s') |
========================
5 |
taos> select char_length(nch1) from ts_4893.d0 limit 10
char_length(nch1) |
========================
5 |
10 |
6 |
7 |
5 |
5 |
5 |
10 |
5 |
5 |
taos> select char_length(nch1) from ts_4893.meters limit 10
char_length(nch1) |
========================
5 |
10 |
6 |
7 |
5 |
5 |
5 |
10 |
5 |
5 |
taos> select char_length(var1) from ts_4893.d0 limit 10
char_length(var1) |
========================
5 |
6 |
5 |
5 |
10 |
6 |
7 |
6 |
7 |
5 |
taos> select char_length(var1) from ts_4893.meters limit 10
char_length(var1) |
========================
5 |
6 |
5 |
5 |
10 |
6 |
7 |
6 |
7 |
5 |
taos> select char_length(null)
char_length(null) |
========================
NULL |
taos> select char_length('')
char_length('') |
========================
0 |
taos> select char_length('あいうえお')
char_length('あいうえお') |
=================================
5 |
taos> select min(char_length(name)) from ts_4893.meters
min(char_length(name)) |
=========================
1 |
taos> select max(char_length(name)) from ts_4893.meters
max(char_length(name)) |
=========================
4 |
taos> select trim(name), char_length(trim(name)) from ts_4893.meters limit 1
trim(name) | char_length(trim(name)) |
===========================================================
lili | 4 |
taos> select upper(name), char_length(upper(name)) from ts_4893.meters limit 1
upper(name) | char_length(upper(name)) |
============================================================
LILI | 4 |
taos> select concat(name, ' - ', location), char_length(concat(name, ' - ', location)) from ts_4893.meters limit 1
concat(name, ' - ', location) | char_length(concat(name, ' - ', location)) |
==============================================================================
lili - beijing | 14 |
taos> select substring(name, 1, 5), char_length(substring(name, 1, 5)) from ts_4893.meters limit 1
substring(name, 1, 5) | char_length(substring(name, 1, 5)) |
======================================================================
lili | 4 |
taos> select name, char_length(name) from ts_4893.meters limit 1
name | char_length(name) |
=========================================================
lili | 4 |
taos> select nch1, char_length(nch1) from ts_4893.meters limit 1
nch1 | char_length(nch1) |
=========================================================
novel | 5 |
taos> select groupid, max(char_length(name)) from ts_4893.meters group by groupid order by ts
groupid | max(char_length(name)) |
===================================
1 | 4 |
taos> select location, avg(char_length(name)) from ts_4893.meters group by location order by location
location | avg(char_length(name)) |
=================================================
beijing | 3.244600000000000 |

Can't render this file because it has a wrong number of fields in line 17.

View File

@ -1,99 +1,262 @@
4
4
4
4
4
4
4
4
4
4
4
6
6
6
6
6
6
6
6
6
6
6
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
6
6
6
6
6
6
6
6
6
6
4
4
2
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
taos> select DAYOFWEEK('2020-01-01 00:00:00')
dayofweek('2020-01-01 00:00:00') |
===================================
4 |
taos> select DAYOFWEEK('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
dayofweek('2020-01-01 00:00:00') |
===================================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select DAYOFWEEK('2021-01-01 00:00:00')
dayofweek('2021-01-01 00:00:00') |
===================================
6 |
taos> select DAYOFWEEK('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
dayofweek('2021-01-01 00:00:00') |
===================================
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
taos> select DAYOFWEEK('1998-01-01 00:00:00')
dayofweek('1998-01-01 00:00:00') |
===================================
5 |
taos> select DAYOFWEEK('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
dayofweek('1998-01-01 00:00:00') |
===================================
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
taos> select DAYOFWEEK('1998-12-31 00:00:00')
dayofweek('1998-12-31 00:00:00') |
===================================
5 |
taos> select DAYOFWEEK('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
dayofweek('1998-12-31 00:00:00') |
===================================
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
taos> select DAYOFWEEK('2000-01-06 00:00:00')
dayofweek('2000-01-06 00:00:00') |
===================================
5 |
taos> select DAYOFWEEK('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
dayofweek('2000-01-06 00:00:00') |
===================================
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
taos> select DAYOFWEEK(1725095657)
dayofweek(1725095657) |
========================
4 |
taos> select DAYOFWEEK(1725095657) from ts_4893.meters order by ts limit 10
dayofweek(1725095657) |
========================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select DAYOFWEEK(ts) from ts_4893.meters order by ts limit 10
dayofweek(ts) |
========================
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
taos> select dayofweek(null)
dayofweek(null) |
========================
NULL |
taos> select dayofweek('1721020591')
dayofweek('1721020591') |
==========================
NULL |
taos> select dayofweek('1721020666229')
dayofweek('1721020666229') |
=============================
NULL |
taos> select dayofweek('abc')
dayofweek('abc') |
========================
NULL |
taos> select dayofweek('01/01/2020')
dayofweek('01/01/2020') |
==========================
NULL |
taos> select dayofweek('20200101')
dayofweek('20200101') |
========================
NULL |
taos> select dayofweek('20/01/01')
dayofweek('20/01/01') |
========================
NULL |
taos> select dayofweek('11/01/31')
dayofweek('11/01/31') |
========================
NULL |
taos> select dayofweek('01-JAN-20')
dayofweek('01-JAN-20') |
=========================
NULL |
taos> select dayofweek('2020-01-01')
dayofweek('2020-01-01') |
==========================
4 |
taos> select dayofweek(1721020666)
dayofweek(1721020666) |
========================
4 |
taos> select dayofweek(1721020666229)
dayofweek(1721020666229) |
===========================
2 |
taos> select dayofweek(ts) from ts_4893.d0 order by ts limit 10
dayofweek(ts) |
========================
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
taos> select dayofweek(ts) from ts_4893.meters order by ts limit 10
dayofweek(ts) |
========================
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
taos> select dayofweek('2024-02-29')
dayofweek('2024-02-29') |
==========================
5 |
taos> select dayofweek('2024-01-01')
dayofweek('2024-01-01') |
==========================
2 |
taos> select dayofweek('2024-12-31')
dayofweek('2024-12-31') |
==========================
3 |
taos> select dayofweek('9999-12-31')
dayofweek('9999-12-31') |
==========================
6 |
taos> select dayofweek(ts) from ts_4893.meters limit 1
dayofweek(ts) |
========================
6 |
taos> select dayofweek(name) from ts_4893.meters limit 1
dayofweek(name) |
========================
NULL |
taos> select dayofweek(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
dayofweek(timediff(ts, '2024-10-10 09:36:50.172')) |
=====================================================
6 |
taos> select id, dayofweek(ts) from ts_4893.meters where id = 1 limit 1
id | dayofweek(ts) |
======================================
1 | 6 |
taos> select groupid, sum(dayofweek(ts)) from ts_4893.meters group by groupid order by groupid
groupid | sum(dayofweek(ts)) |
==================================
1 | 400012 |

Can't render this file because it has a wrong number of fields in line 248.

View File

@ -1,66 +1,270 @@
0.000000000000000
57.295779513082323
85.943669269623484
5729.577951308232514
-57.295779513082323
-85.943669269623484
-5729.577951308232514
58.295779513082323
56.295779513082323
57.295779513082323
57.295779513082323
57.295779513082323
57.295779513082323
57.295779513082323
57.295779513082323
57.295779513082323
58.295779513082323
56.295779513082323
114.591559026164646
28.647889756541161
171.887338539246969
57.295779513082323
6565.612700023488287
2.000000000000000
57.295779513082323
58.295779513082323
59.295779513082323
60.295779513082323
61.295779513082323
0.000000000000000
58.295779513082323
116.591559026164646
174.887338539246969
233.183118052329291
572.957795130823229
180.000000000000000
572.957795130823229
328280.635001174407080
23.936536824085962
572
0.000000000000000
57.295779513082323
81.028468454139556
99.239201175922574
114.591559026164646
180
610.200029957721426
491.254034090376820
561.212164701962479
643.603479905018958
613.408634263739941
487.472513516777667
549.810284033650078
628.076328902558998
643.202411196955836
592.266466706882511
610.200029957721426
491.254034090376820
561.212164701962479
643.603479905018958
613.408634263739941
487.472513516777667
549.810284033650078
628.076328902558998
643.202411196955836
592.266466706882511
taos> select DEGREES(0)
degrees(0) |
============================
0.000000000000000 |
taos> select DEGREES(1)
degrees(1) |
============================
57.295779513082323 |
taos> select DEGREES(1.5)
degrees(1.5) |
============================
85.943669269623484 |
taos> select DEGREES(100)
degrees(100) |
============================
5729.577951308232514 |
taos> select DEGREES(-1)
degrees(-1) |
============================
-57.295779513082323 |
taos> select DEGREES(-1.5)
degrees(-1.5) |
============================
-85.943669269623484 |
taos> select DEGREES(-100)
degrees(-100) |
============================
-5729.577951308232514 |
taos> select DEGREES(1) + 1
degrees(1) + 1 |
============================
58.295779513082323 |
taos> select DEGREES(1) - 1
degrees(1) - 1 |
============================
56.295779513082323 |
taos> select DEGREES(1) * 1
degrees(1) * 1 |
============================
57.295779513082323 |
taos> select DEGREES(1) / 1
degrees(1) / 1 |
============================
57.295779513082323 |
taos> select DEGREES(1) from ts_4893.meters limit 5
degrees(1) |
============================
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
taos> select DEGREES(1) + 1 from ts_4893.meters limit 1
degrees(1) + 1 |
============================
58.295779513082323 |
taos> select DEGREES(1) - 1 from ts_4893.meters limit 1
degrees(1) - 1 |
============================
56.295779513082323 |
taos> select DEGREES(1) * 2 from ts_4893.meters limit 1
degrees(1) * 2 |
============================
114.591559026164646 |
taos> select DEGREES(1) / 2 from ts_4893.meters limit 1
degrees(1) / 2 |
============================
28.647889756541161 |
taos> select DEGREES(2) + DEGREES(1) from ts_4893.meters limit 1
degrees(2) + degrees(1) |
============================
171.887338539246969 |
taos> select DEGREES(2) - DEGREES(1) from ts_4893.meters limit 1
degrees(2) - degrees(1) |
============================
57.295779513082323 |
taos> select DEGREES(2) * DEGREES(1) from ts_4893.meters limit 1
degrees(2) * degrees(1) |
============================
6565.612700023488287 |
taos> select DEGREES(2) / DEGREES(1) from ts_4893.meters limit 1
degrees(2) / degrees(1) |
============================
2.000000000000000 |
taos> select DEGREES(1) + id from ts_4893.meters order by ts limit 5
degrees(1) + id |
============================
57.295779513082323 |
58.295779513082323 |
59.295779513082323 |
60.295779513082323 |
61.295779513082323 |
taos> select DEGREES(id) + id from ts_4893.meters order by ts limit 5
degrees(id) + id |
============================
0.000000000000000 |
58.295779513082323 |
116.591559026164646 |
174.887338539246969 |
233.183118052329291 |
taos> select DEGREES(abs(10))
degrees(abs(10)) |
============================
572.957795130823229 |
taos> select DEGREES(PI())
degrees(pi()) |
============================
180.000000000000000 |
taos> select abs(DEGREES(10))
abs(degrees(10)) |
============================
572.957795130823229 |
taos> select pow(DEGREES(10), 2)
pow(degrees(10), 2) |
============================
328280.635001174407080 |
taos> select sqrt(DEGREES(10))
sqrt(degrees(10)) |
============================
23.936536824085962 |
taos> select cast(DEGREES(10) as int)
cast(degrees(10) as int) |
===========================
572 |
taos> select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5
degrees(sqrt(id)) |
============================
0.000000000000000 |
57.295779513082323 |
81.028468454139556 |
99.239201175922574 |
114.591559026164646 |
taos> select degrees(pi())
degrees(pi()) |
============================
180.000000000000000 |
taos> select degrees(current) from ts_4893.d0 order by ts limit 10
degrees(current) |
============================
610.200029957721426 |
491.254034090376820 |
561.212164701962479 |
643.603479905018958 |
613.408634263739941 |
487.472513516777667 |
549.810284033650078 |
628.076328902558998 |
643.202411196955836 |
592.266466706882511 |
taos> select degrees(current) from ts_4893.meters order by ts limit 10
degrees(current) |
============================
610.200029957721426 |
491.254034090376820 |
561.212164701962479 |
643.603479905018958 |
613.408634263739941 |
487.472513516777667 |
549.810284033650078 |
628.076328902558998 |
643.202411196955836 |
592.266466706882511 |
taos> select degrees(null)
degrees(null) |
============================
NULL |
taos> select degrees(-5)
degrees(-5) |
============================
-286.478897565411614 |
taos> select degrees(3.14)
degrees(3.14) |
============================
179.908747671078515 |
taos> select degrees(2*pi())
degrees(2*pi()) |
============================
360.000000000000000 |
taos> select degrees(pi()/2)
degrees(pi()/2) |
============================
90.000000000000000 |
taos> select degrees(-pi()/2)
degrees(-pi()/2) |
============================
-90.000000000000000 |
taos> select degrees(1000000)
degrees(1000000) |
============================
57295779.513082325458527 |
taos> select degrees(sin(1))
degrees(sin(1)) |
============================
48.212736012209490 |
taos> select degrees(cos(1))
degrees(cos(1)) |
============================
30.957041787430903 |
taos> select degrees(tan(1))
degrees(tan(1)) |
============================
89.232889603798512 |
taos> select degrees(radians(90))
degrees(radians(90)) |
============================
90.000000000000000 |
taos> select degrees(atan(1))
degrees(atan(1)) |
============================
45.000000000000000 |
taos> select degrees(phase) from ts_4893.meters limit 1
degrees(phase) |
============================
29.157708736569255 |
taos> select degrees(current) from ts_4893.meters limit 1
degrees(current) |
============================
610.200029957721426 |
taos> select degrees(voltage) from ts_4893.meters limit 1
degrees(voltage) |
============================
12662.367272391193183 |

Can't render this file because it has a wrong number of fields in line 139.

326
tests/army/query/function/ans/exp.csv Executable file → Normal file
View File

@ -1,66 +1,260 @@
1.000000000000000
2.718281828459045
4.481689070338065
2.688117141816136e+43
0.367879441171442
0.223130160148430
0.000000000000000
3.718281828459045
1.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
2.718281828459045
3.718281828459045
1.718281828459045
5.436563656918090
1.359140914229523
10.107337927389695
4.670774270471606
20.085536923187668
2.718281828459046
2.718281828459045
3.718281828459045
4.718281828459045
5.718281828459045
6.718281828459045
1.000000000000000
3.718281828459045
9.389056098930650
23.085536923187668
58.598150033144236
22026.465794806717895
485165195.409790337085724
148.413159102576600
22026
1.000000000000000
2.718281828459045
4.113250378782928
5.652233674034091
7.389056098930650
3814279.104760214220732
7.38905609893065
1.6487212707001282
42192.578453635847836
5292.258432380726845
17943.802618770550907
75583.992598717435612
44622.804904812772293
4954.246535954979663
14705.836248958077704
57641.604897186582093
75056.754435561466380
30853.327779395312973
42192.578453635847836
5292.258432380726845
17943.802618770550907
75583.992598717435612
44622.804904812772293
4954.246535954979663
14705.836248958077704
57641.604897186582093
75056.754435561466380
30853.327779395312973
taos> select EXP(0)
exp(0) |
============================
1.000000000000000 |
taos> select EXP(1)
exp(1) |
============================
2.718281828459045 |
taos> select EXP(1.5)
exp(1.5) |
============================
4.481689070338065 |
taos> select EXP(100)
exp(100) |
============================
2.688117141816136e+43 |
taos> select EXP(-1)
exp(-1) |
============================
0.367879441171442 |
taos> select EXP(-1.5)
exp(-1.5) |
============================
0.223130160148430 |
taos> select EXP(-100)
exp(-100) |
============================
0.000000000000000 |
taos> select EXP(1) + 1
exp(1) + 1 |
============================
3.718281828459045 |
taos> select EXP(1) - 1
exp(1) - 1 |
============================
1.718281828459045 |
taos> select EXP(1) * 1
exp(1) * 1 |
============================
2.718281828459045 |
taos> select EXP(1) / 1
exp(1) / 1 |
============================
2.718281828459045 |
taos> select exp(1) from ts_4893.meters limit 5
exp(1) |
============================
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
taos> select exp(1) + 1 from ts_4893.meters limit 1
exp(1) + 1 |
============================
3.718281828459045 |
taos> select exp(1) - 1 from ts_4893.meters limit 1
exp(1) - 1 |
============================
1.718281828459045 |
taos> select exp(1) * 2 from ts_4893.meters limit 1
exp(1) * 2 |
============================
5.436563656918090 |
taos> select exp(1) / 2 from ts_4893.meters limit 1
exp(1) / 2 |
============================
1.359140914229523 |
taos> select exp(2) + exp(1) from ts_4893.meters limit 1
exp(2) + exp(1) |
============================
10.107337927389695 |
taos> select exp(2) - exp(1) from ts_4893.meters limit 1
exp(2) - exp(1) |
============================
4.670774270471606 |
taos> select exp(2) * exp(1) from ts_4893.meters limit 1
exp(2) * exp(1) |
============================
20.085536923187668 |
taos> select exp(2) / exp(1) from ts_4893.meters limit 1
exp(2) / exp(1) |
============================
2.718281828459046 |
taos> select exp(1) + id from ts_4893.meters order by ts limit 5
exp(1) + id |
============================
2.718281828459045 |
3.718281828459045 |
4.718281828459045 |
5.718281828459045 |
6.718281828459045 |
taos> select exp(id) + id from ts_4893.meters order by ts limit 5
exp(id) + id |
============================
1.000000000000000 |
3.718281828459045 |
9.389056098930650 |
23.085536923187668 |
58.598150033144236 |
taos> select abs(EXP(10))
abs(exp(10)) |
============================
22026.465794806717895 |
taos> select pow(EXP(10), 2)
pow(exp(10), 2) |
============================
485165195.409790337085724 |
taos> select sqrt(EXP(10))
sqrt(exp(10)) |
============================
148.413159102576600 |
taos> select cast(EXP(10) as int)
cast(exp(10) as int) |
=======================
22026 |
taos> select EXP(sqrt(id)) from ts_4893.meters order by ts limit 5
exp(sqrt(id)) |
============================
1.000000000000000 |
2.718281828459045 |
4.113250378782928 |
5.652233674034091 |
7.389056098930650 |
taos> select EXP(EXP(EXP(EXP(0))))
exp(exp(exp(exp(0)))) |
============================
3814279.104760214220732 |
taos> select exp(2)
exp(2) |
============================
7.389056098930650 |
taos> select exp(0.5)
exp(0.5) |
============================
1.648721270700128 |
taos> select exp(current) from ts_4893.d0 order by ts limit 10
exp(current) |
============================
42192.578453635847836 |
5292.258432380726845 |
17943.802618770550907 |
75583.992598717435612 |
44622.804904812772293 |
4954.246535954979663 |
14705.836248958077704 |
57641.604897186582093 |
75056.754435561466380 |
30853.327779395312973 |
taos> select exp(current) from ts_4893.meters order by ts limit 10
exp(current) |
============================
42192.578453635847836 |
5292.258432380726845 |
17943.802618770550907 |
75583.992598717435612 |
44622.804904812772293 |
4954.246535954979663 |
14705.836248958077704 |
57641.604897186582093 |
75056.754435561466380 |
30853.327779395312973 |
taos> select exp(null)
exp(null) |
============================
NULL |
taos> select exp(100000)
exp(100000) |
============================
NULL |
taos> select exp(-1000)
exp(-1000) |
============================
0.000000000000000 |
taos> select exp(-9999999999)
exp(-9999999999) |
============================
0.000000000000000 |
taos> select exp(0.0001)
exp(0.0001) |
============================
1.000100005000167 |
taos> select exp(pi())
exp(pi()) |
============================
23.140692632779267 |
taos> select exp(voltage) from ts_4893.meters limit 1
exp(voltage) |
============================
9.529727902367202e+95 |
taos> select exp(current) from ts_4893.meters limit 1
exp(current) |
============================
42192.578453635847836 |
taos> select exp(phase) from ts_4893.meters limit 1
exp(phase) |
============================
1.663457087766762 |
taos> select exp(voltage + current) from ts_4893.meters limit 1
exp(voltage + current) |
============================
4.020837921624308e+100 |
taos> select exp(abs(current)) from ts_4893.meters limit 1
exp(abs(current)) |
============================
42192.578453635847836 |
taos> select exp(log(voltage)) from ts_4893.meters limit 1
exp(log(voltage)) |
============================
220.999999999999915 |
taos> select round(exp(voltage), 2) from ts_4893.meters limit 1
round(exp(voltage), 2) |
============================
9.529727902367202e+95 |

Can't render this file because it has a wrong number of fields in line 129.

328
tests/army/query/function/ans/ln.csv Executable file → Normal file
View File

@ -1,63 +1,265 @@
4.605170185988092
0.405465108108164
4.605170185988092
5.605170185988092
3.605170185988092
4.605170185988092
4.605170185988092
4.605170185988092
4.605170185988092
4.605170185988092
4.605170185988092
4.605170185988092
5.605170185988092
3.605170185988092
9.210340371976184
2.302585092994046
5.298317366548037
-3.912023005428146
3.192060730416365
0.150514997831991
4.605170185988092
5.605170185988092
6.605170185988092
7.605170185988092
8.605170185988092
0.000000000000000
1.693147180559945
3.098612288668110
4.386294361119891
5.609437912434101
2.302585092994046
5.301898110478399
1.517427129385146
2
0.000000000000000
0.693147180559945
0.881373587019543
1.005052538742381
1.098612288668110
-0.226079864157595
2.000000000000000
2.302585092994046
1.144729885849400
2.365559856336680
2.148734409997751
2.281872059185575
2.418855857000369
2.370804362614190
2.141006941277850
2.261346315560232
2.394434736880126
2.418232501568406
2.335729681253415
2.365559856336680
2.148734409997751
2.281872059185575
2.418855857000369
2.370804362614190
2.141006941277850
2.261346315560232
2.394434736880126
2.418232501568406
2.335729681253415
taos> select LN(100)
ln(100) |
============================
4.605170185988092 |
taos> select LN(1.5)
ln(1.5) |
============================
0.405465108108164 |
taos> select LN(100)
ln(100) |
============================
4.605170185988092 |
taos> select LN(100) + 1
ln(100) + 1 |
============================
5.605170185988092 |
taos> select LN(100) - 1
ln(100) - 1 |
============================
3.605170185988092 |
taos> select LN(100) * 1
ln(100) * 1 |
============================
4.605170185988092 |
taos> select LN(100) / 1
ln(100) / 1 |
============================
4.605170185988092 |
taos> select LN(100) from ts_4893.meters limit 5
ln(100) |
============================
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
taos> select LN(100) + 1 from ts_4893.meters limit 1
ln(100) + 1 |
============================
5.605170185988092 |
taos> select LN(100) - 1 from ts_4893.meters limit 1
ln(100) - 1 |
============================
3.605170185988092 |
taos> select LN(100) * 2 from ts_4893.meters limit 1
ln(100) * 2 |
============================
9.210340371976184 |
taos> select LN(100) / 2 from ts_4893.meters limit 1
ln(100) / 2 |
============================
2.302585092994046 |
taos> select LN(2) + LN(100) from ts_4893.meters limit 1
ln(2) + ln(100) |
============================
5.298317366548037 |
taos> select LN(2) - LN(100) from ts_4893.meters limit 1
ln(2) - ln(100) |
============================
-3.912023005428146 |
taos> select LN(2) * LN(100) from ts_4893.meters limit 1
ln(2) * ln(100) |
============================
3.192060730416365 |
taos> select LN(2) / LN(100) from ts_4893.meters limit 1
ln(2) / ln(100) |
============================
0.150514997831991 |
taos> select LN(100) + id from ts_4893.meters order by ts limit 5
ln(100) + id |
============================
4.605170185988092 |
5.605170185988092 |
6.605170185988092 |
7.605170185988092 |
8.605170185988092 |
taos> select LN(id + 1) + id from ts_4893.meters order by ts limit 5
ln(id + 1) + id |
============================
0.000000000000000 |
1.693147180559945 |
3.098612288668110 |
4.386294361119891 |
5.609437912434101 |
taos> select ln(null)
ln(null) |
============================
NULL |
taos> select ln(0)
ln(0) |
============================
NULL |
taos> select ln(-5)
ln(-5) |
============================
NULL |
taos> select abs(LN(10))
abs(ln(10)) |
============================
2.302585092994046 |
taos> select pow(LN(10), 2)
pow(ln(10), 2) |
============================
5.301898110478399 |
taos> select sqrt(LN(10))
sqrt(ln(10)) |
============================
1.517427129385146 |
taos> select cast(LN(10) as int)
cast(ln(10) as int) |
======================
2 |
taos> select LN(sqrt(id) + 1) from ts_4893.meters order by ts limit 5
ln(sqrt(id) + 1) |
============================
0.000000000000000 |
0.693147180559945 |
0.881373587019543 |
1.005052538742381 |
1.098612288668110 |
taos> select LN(LN(LN(LN(10000))))
ln(ln(ln(ln(10000)))) |
============================
-0.226079864157595 |
taos> select LN(EXP(2))
ln(exp(2)) |
============================
2.000000000000000 |
taos> select ln(10)
ln(10) |
============================
2.302585092994046 |
taos> select ln(pi())
ln(pi()) |
============================
1.144729885849400 |
taos> select ln(current) from ts_4893.d0 order by ts limit 10
ln(current) |
============================
2.365559856336680 |
2.148734409997751 |
2.281872059185575 |
2.418855857000369 |
2.370804362614190 |
2.141006941277850 |
2.261346315560232 |
2.394434736880126 |
2.418232501568406 |
2.335729681253415 |
taos> select ln(current) from ts_4893.meters order by ts limit 10
ln(current) |
============================
2.365559856336680 |
2.148734409997751 |
2.281872059185575 |
2.418855857000369 |
2.370804362614190 |
2.141006941277850 |
2.261346315560232 |
2.394434736880126 |
2.418232501568406 |
2.335729681253415 |
taos> select ln(1)
ln(1) |
============================
0.000000000000000 |
taos> select ln(20)
ln(20) |
============================
2.995732273553991 |
taos> select ln(100)
ln(100) |
============================
4.605170185988092 |
taos> select ln(99999999999999)
ln(99999999999999) |
============================
32.236191301916627 |
taos> select ln(0.1)
ln(0.1) |
============================
-2.302585092994045 |
taos> select ln(2.718)
ln(2.718) |
============================
0.999896315728952 |
taos> select ln(exp(1))
ln(exp(1)) |
============================
1.000000000000000 |
taos> select ln(voltage) from ts_4893.meters where voltage > 0 limit 1
ln(voltage) |
============================
5.398162701517752 |
taos> select ln(current) from ts_4893.meters where current > 0 limit 1
ln(current) |
============================
2.365559856336680 |
taos> select ln(phase) from ts_4893.meters where phase > 0 limit 1
ln(phase) |
============================
-0.675507636551043 |
taos> select ln(exp(voltage)) from ts_4893.meters where voltage > 0 limit 1
ln(exp(voltage)) |
============================
221.000000000000000 |
taos> select ln(abs(current)) from ts_4893.meters where current != 0 limit 1
ln(abs(current)) |
============================
2.365559856336680 |
taos> select ln(sqrt(phase)) from ts_4893.meters where phase >= 0 limit 1
ln(sqrt(phase)) |
============================
-0.337753818275521 |
taos> select ln(log(current)) from ts_4893.meters where current > 1 limit 1
ln(log(current)) |
============================
0.861014719652538 |

Can't render this file because it has a wrong number of fields in line 124.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +1,235 @@
1.550000000000001
0.550000000000001
0.550000000000001
0.550000000000001
0.550000000000001
-0.550000000000001
0.000000000000000
1.550000000000001
1.234567890000022e-01
1.234567910432816e-01
1.234567910432816e-01
1.123456791043282e+00
1.234567910432816e-01
1.123456791043282e+00
1.123456791043282e+00
3.123456791043282e+00
6.123456791043282e+00
1.123456791043282e+00
1.234567910432816e-01
1.123456791043282e+00
0.649999618530273
0.574000358581543
0.795000076293945
3.232999801635742
0.706000328063965
2.508000373840332
2.595999717712402
2.961999893188477
2.225999832153320
0.336999893188477
0.649999618530273
0.574000358581543
0.795000076293945
0.232999801635742
0.706000328063965
0.508000373840332
0.595999717712402
0.961999893188477
0.225999832153320
0.336999893188477
2.634337159700784e-01
9.281394021770111e-01
1.296964830944782e-01
3.351566768190027e+00
3.272002495118848e+00
2.916847677517688e+00
3.097741066924800e+00
3.310891102586806e+00
3.350522322288470e+00
3.215120509901375e+00
1
1
0
1
2
0
1
2
0
1
2
0
0
1
2
0
1
2
0
1
2
0
taos> select MOD(10.55, 3)
mod(10.55, 3) |
============================
1.550000000000001 |
taos> select MOD(10.55, 2)
mod(10.55, 2) |
============================
0.550000000000001 |
taos> select MOD(10.55, 1)
mod(10.55, 1) |
============================
0.550000000000001 |
taos> select MOD(10.55, -1)
mod(10.55, -1) |
============================
0.550000000000001 |
taos> select MOD(10.55, -10)
mod(10.55, -10) |
============================
0.550000000000001 |
taos> select MOD(-10.55, 1)
mod(-10.55, 1) |
============================
-0.550000000000001 |
taos> select MOD(99, 1)
mod(99, 1) |
============================
0.000000000000000 |
taos> select MOD(10.55, 1) + 1
mod(10.55, 1) + 1 |
============================
1.550000000000001 |
taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3)
mod(mod(mod(mod(mod(mod(mod(123.123456789, 9), 8), 7), 6), 5), 4 |
===================================================================
1.234567890000022e-01 |
taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
mod(mod(mod(mod(mod(mod(mod(123456789.123456789, -1), -2), -3), |
===================================================================
1.234567910432816e-01 |
taos> select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10
mod(87654321.123456789, id + 1) |
==================================
1.234567910432816e-01 |
1.123456791043282e+00 |
1.234567910432816e-01 |
1.123456791043282e+00 |
1.123456791043282e+00 |
3.123456791043282e+00 |
6.123456791043282e+00 |
1.123456791043282e+00 |
1.234567910432816e-01 |
1.123456791043282e+00 |
taos> select MOD(current, id + 1) from ts_4893.meters order by ts limit 10
mod(current, id + 1) |
============================
0.649999618530273 |
0.574000358581543 |
0.795000076293945 |
3.232999801635742 |
0.706000328063965 |
2.508000373840332 |
2.595999717712402 |
2.961999893188477 |
2.225999832153320 |
0.336999893188477 |
taos> select MOD(current, 1) from ts_4893.meters order by ts limit 10
mod(current, 1) |
============================
0.649999618530273 |
0.574000358581543 |
0.795000076293945 |
0.232999801635742 |
0.706000328063965 |
0.508000373840332 |
0.595999717712402 |
0.961999893188477 |
0.225999832153320 |
0.336999893188477 |
taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
mod(sqrt(current), abs(id + 1)) |
==================================
2.634337159700784e-01 |
9.281394021770111e-01 |
1.296964830944782e-01 |
3.351566768190027e+00 |
3.272002495118848e+00 |
2.916847677517688e+00 |
3.097741066924800e+00 |
3.310891102586806e+00 |
3.350522322288470e+00 |
3.215120509901375e+00 |
taos> select mod(10, -3)
mod(10, -3) |
============================
1.000000000000000 |
taos> select mod(10, 3)
mod(10, 3) |
============================
1.000000000000000 |
taos> select mod(id, 3) from ts_4893.d0 order by ts limit 10
mod(id, 3) |
============================
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
taos> select mod(id, 3) from ts_4893.meters order by ts limit 10
mod(id, 3) |
============================
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
taos> select mod(null, 2)
mod(null, 2) |
============================
NULL |
taos> select mod(10, null)
mod(10, null) |
============================
NULL |
taos> select mod(10, 0)
mod(10, 0) |
============================
NULL |
taos> select mod(-10, 0)
mod(-10, 0) |
============================
NULL |
taos> select mod(5, 0)
mod(5, 0) |
============================
NULL |
taos> select mod(0, 1)
mod(0, 1) |
============================
0.000000000000000 |
taos> select mod(1, 1)
mod(1, 1) |
============================
0.000000000000000 |
taos> select mod(5, 2)
mod(5, 2) |
============================
1.000000000000000 |
taos> select mod(5, -3)
mod(5, -3) |
============================
2.000000000000000 |
taos> select mod(15, 4)
mod(15, 4) |
============================
3.000000000000000 |
taos> select mod(-5, 3)
mod(-5, 3) |
============================
-2.000000000000000 |
taos> select mod(voltage, 2) from ts_4893.meters limit 1
mod(voltage, 2) |
============================
1.000000000000000 |
taos> select mod(current, 10) from ts_4893.meters limit 1
mod(current, 10) |
============================
0.649999618530273 |
taos> select mod(current, log(100)) from ts_4893.meters limit 1
mod(current, log(100)) |
============================
1.439659246554090 |
taos> select mod(phase, 4) from ts_4893.meters limit 1
mod(phase, 4) |
============================
0.508898019790649 |
taos> select mod(abs(voltage), 3) from ts_4893.meters limit 1
mod(abs(voltage), 3) |
============================
2.000000000000000 |
taos> select mod(phase, sqrt(16)) from ts_4893.meters limit 1
mod(phase, sqrt(16)) |
============================
0.508898019790649 |
taos> select mod(round(voltage), 5) from ts_4893.meters limit 1
mod(round(voltage), 5) |
============================
1.000000000000000 |

1 1.550000000000001 taos> select MOD(10.55, 3)
2 0.550000000000001 mod(10.55, 3) |
3 0.550000000000001 ============================
4 0.550000000000001 1.550000000000001 |
5 0.550000000000001 taos> select MOD(10.55, 2)
6 -0.550000000000001 mod(10.55, 2) |
7 0.000000000000000 ============================
8 1.550000000000001 0.550000000000001 |
9 1.234567890000022e-01 taos> select MOD(10.55, 1)
10 1.234567910432816e-01 mod(10.55, 1) |
11 1.234567910432816e-01 ============================
12 1.123456791043282e+00 0.550000000000001 |
13 1.234567910432816e-01 taos> select MOD(10.55, -1)
14 1.123456791043282e+00 mod(10.55, -1) |
15 1.123456791043282e+00 ============================
16 3.123456791043282e+00 0.550000000000001 |
17 6.123456791043282e+00 taos> select MOD(10.55, -10)
18 1.123456791043282e+00 mod(10.55, -10) |
19 1.234567910432816e-01 ============================
20 1.123456791043282e+00 0.550000000000001 |
21 0.649999618530273 taos> select MOD(-10.55, 1)
22 0.574000358581543 mod(-10.55, 1) |
23 0.795000076293945 ============================
24 3.232999801635742 -0.550000000000001 |
25 0.706000328063965 taos> select MOD(99, 1)
26 2.508000373840332 mod(99, 1) |
27 2.595999717712402 ============================
28 2.961999893188477 0.000000000000000 |
29 2.225999832153320 taos> select MOD(10.55, 1) + 1
30 0.336999893188477 mod(10.55, 1) + 1 |
31 0.649999618530273 ============================
32 0.574000358581543 1.550000000000001 |
33 0.795000076293945 taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3)
34 0.232999801635742 mod(mod(mod(mod(mod(mod(mod(123.123456789, 9), 8), 7), 6), 5), 4 |
35 0.706000328063965 ===================================================================
36 0.508000373840332 1.234567890000022e-01 |
37 0.595999717712402 taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
38 0.961999893188477 mod(mod(mod(mod(mod(mod(mod(123456789.123456789, -1), -2), -3), |
39 0.225999832153320 ===================================================================
40 0.336999893188477 1.234567910432816e-01 |
41 2.634337159700784e-01 taos> select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10
42 9.281394021770111e-01 mod(87654321.123456789, id + 1) |
43 1.296964830944782e-01 ==================================
44 3.351566768190027e+00 1.234567910432816e-01 |
45 3.272002495118848e+00 1.123456791043282e+00 |
46 2.916847677517688e+00 1.234567910432816e-01 |
47 3.097741066924800e+00 1.123456791043282e+00 |
48 3.310891102586806e+00 1.123456791043282e+00 |
49 3.350522322288470e+00 3.123456791043282e+00 |
50 3.215120509901375e+00 6.123456791043282e+00 |
51 1 1.123456791043282e+00 |
52 1 1.234567910432816e-01 |
53 0 1.123456791043282e+00 |
54 1 taos> select MOD(current, id + 1) from ts_4893.meters order by ts limit 10
55 2 mod(current, id + 1) |
56 0 ============================
57 1 0.649999618530273 |
58 2 0.574000358581543 |
59 0 0.795000076293945 |
60 1 3.232999801635742 |
61 2 0.706000328063965 |
62 0 2.508000373840332 |
63 0 2.595999717712402 |
64 1 2.961999893188477 |
65 2 2.225999832153320 |
66 0 0.336999893188477 |
67 1 taos> select MOD(current, 1) from ts_4893.meters order by ts limit 10
68 2 mod(current, 1) |
69 0 ============================
70 1 0.649999618530273 |
71 2 0.574000358581543 |
72 0 0.795000076293945 |
73 0.232999801635742 |
74 0.706000328063965 |
75 0.508000373840332 |
76 0.595999717712402 |
77 0.961999893188477 |
78 0.225999832153320 |
79 0.336999893188477 |
80 taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
81 mod(sqrt(current), abs(id + 1)) |
82 ==================================
83 2.634337159700784e-01 |
84 9.281394021770111e-01 |
85 1.296964830944782e-01 |
86 3.351566768190027e+00 |
87 3.272002495118848e+00 |
88 2.916847677517688e+00 |
89 3.097741066924800e+00 |
90 3.310891102586806e+00 |
91 3.350522322288470e+00 |
92 3.215120509901375e+00 |
93 taos> select mod(10, -3)
94 mod(10, -3) |
95 ============================
96 1.000000000000000 |
97 taos> select mod(10, 3)
98 mod(10, 3) |
99 ============================
100 1.000000000000000 |
101 taos> select mod(id, 3) from ts_4893.d0 order by ts limit 10
102 mod(id, 3) |
103 ============================
104 0.000000000000000 |
105 1.000000000000000 |
106 2.000000000000000 |
107 0.000000000000000 |
108 1.000000000000000 |
109 2.000000000000000 |
110 0.000000000000000 |
111 1.000000000000000 |
112 2.000000000000000 |
113 0.000000000000000 |
114 taos> select mod(id, 3) from ts_4893.meters order by ts limit 10
115 mod(id, 3) |
116 ============================
117 0.000000000000000 |
118 1.000000000000000 |
119 2.000000000000000 |
120 0.000000000000000 |
121 1.000000000000000 |
122 2.000000000000000 |
123 0.000000000000000 |
124 1.000000000000000 |
125 2.000000000000000 |
126 0.000000000000000 |
127 taos> select mod(null, 2)
128 mod(null, 2) |
129 ============================
130 NULL |
131 taos> select mod(10, null)
132 mod(10, null) |
133 ============================
134 NULL |
135 taos> select mod(10, 0)
136 mod(10, 0) |
137 ============================
138 NULL |
139 taos> select mod(-10, 0)
140 mod(-10, 0) |
141 ============================
142 NULL |
143 taos> select mod(5, 0)
144 mod(5, 0) |
145 ============================
146 NULL |
147 taos> select mod(0, 1)
148 mod(0, 1) |
149 ============================
150 0.000000000000000 |
151 taos> select mod(1, 1)
152 mod(1, 1) |
153 ============================
154 0.000000000000000 |
155 taos> select mod(5, 2)
156 mod(5, 2) |
157 ============================
158 1.000000000000000 |
159 taos> select mod(5, -3)
160 mod(5, -3) |
161 ============================
162 2.000000000000000 |
163 taos> select mod(15, 4)
164 mod(15, 4) |
165 ============================
166 3.000000000000000 |
167 taos> select mod(-5, 3)
168 mod(-5, 3) |
169 ============================
170 -2.000000000000000 |
171 taos> select mod(voltage, 2) from ts_4893.meters limit 1
172 mod(voltage, 2) |
173 ============================
174 1.000000000000000 |
175 taos> select mod(current, 10) from ts_4893.meters limit 1
176 mod(current, 10) |
177 ============================
178 0.649999618530273 |
179 taos> select mod(current, log(100)) from ts_4893.meters limit 1
180 mod(current, log(100)) |
181 ============================
182 1.439659246554090 |
183 taos> select mod(phase, 4) from ts_4893.meters limit 1
184 mod(phase, 4) |
185 ============================
186 0.508898019790649 |
187 taos> select mod(abs(voltage), 3) from ts_4893.meters limit 1
188 mod(abs(voltage), 3) |
189 ============================
190 2.000000000000000 |
191 taos> select mod(phase, sqrt(16)) from ts_4893.meters limit 1
192 mod(phase, sqrt(16)) |
193 ============================
194 0.508898019790649 |
195 taos> select mod(round(voltage), 5) from ts_4893.meters limit 1
196 mod(round(voltage), 5) |
197 ============================
198 1.000000000000000 |
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

View File

@ -1,28 +1,194 @@
3.141592653589793
4.141592653589793
2.141592653589793
6.283185307179586
1.570796326794897
3.141592653589793
3.141592653589793
3.141592653589793
3.141592653589793
3.141592653589793
4.141592653589793
2.141592653589793
6.283185307179586
1.570796326794897
6.283185307179586
0.000000000000000
9.869604401089358
1.000000000000000
3.141592653589793
4.141592653589793
5.141592653589793
6.141592653589793
7.141592653589793
3.141592653589793
9.869604401089358
1.772453850905516
3
3.141592653589793
taos> select pi()
pi() |
============================
3.141592653589793 |
taos> select pi() + 1
pi() + 1 |
============================
4.141592653589793 |
taos> select pi() - 1
pi() - 1 |
============================
2.141592653589793 |
taos> select pi() * 2
pi() * 2 |
============================
6.283185307179586 |
taos> select pi() / 2
pi() / 2 |
============================
1.570796326794897 |
taos> select pi() from ts_4893.meters limit 5
pi() |
============================
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
taos> select pi() + 1 from ts_4893.meters limit 1
pi() + 1 |
============================
4.141592653589793 |
taos> select pi() - 1 from ts_4893.meters limit 1
pi() - 1 |
============================
2.141592653589793 |
taos> select pi() * 2 from ts_4893.meters limit 1
pi() * 2 |
============================
6.283185307179586 |
taos> select pi() / 2 from ts_4893.meters limit 1
pi() / 2 |
============================
1.570796326794897 |
taos> select pi() + pi() from ts_4893.meters limit 1
pi() + pi() |
============================
6.283185307179586 |
taos> select pi() - pi() from ts_4893.meters limit 1
pi() - pi() |
============================
0.000000000000000 |
taos> select pi() * pi() from ts_4893.meters limit 1
pi() * pi() |
============================
9.869604401089358 |
taos> select pi() / pi() from ts_4893.meters limit 1
pi() / pi() |
============================
1.000000000000000 |
taos> select pi() + id from ts_4893.meters order by ts limit 5
pi() + id |
============================
3.141592653589793 |
4.141592653589793 |
5.141592653589793 |
6.141592653589793 |
7.141592653589793 |
taos> select abs(pi())
abs(pi()) |
============================
3.141592653589793 |
taos> select pow(pi(), 2)
pow(pi(), 2) |
============================
9.869604401089358 |
taos> select sqrt(pi())
sqrt(pi()) |
============================
1.772453850905516 |
taos> select cast(pi() as int)
cast(pi() as int) |
====================
3 |
taos> select pi()
pi() |
============================
3.141592653589793 |
taos> select substring_index(null, '.', 2)
substring_index(null, '.', 2) |
================================
NULL |
taos> select pi() + null
pi() + null |
============================
NULL |
taos> select pi() * 0
pi() * 0 |
============================
0.000000000000000 |
taos> select pi() / 0
pi() / 0 |
============================
NULL |
taos> select pi() * 0.5
pi() * 0.5 |
============================
1.570796326794897 |
taos> select pi() * -1
pi() * -1 |
============================
-3.141592653589793 |
taos> select pi() * name from ts_4893.meters limit 1
pi() * name |
============================
0.000000000000000 |
taos> select pi() * voltage from ts_4893.meters limit 1
pi() * voltage |
============================
694.291976443344311 |
taos> select pi() * phase * 2 from ts_4893.meters limit 1
pi() * phase * 2 |
============================
3.197500560801395 |
taos> select round(pi(), 6)
round(pi(), 6) |
============================
3.141593000000000 |
taos> select round(pi() * phase, 2) from ts_4893.meters limit 1
round(pi() * phase, 2) |
============================
1.600000000000000 |
taos> select sqrt(pi() * voltage) from ts_4893.meters limit 1
sqrt(pi() * voltage) |
============================
26.349420799010826 |
taos> select sqrt(current / pi()) from ts_4893.meters limit 1
sqrt(current / pi()) |
============================
1.841195309148865 |
taos> select abs(pi() * phase) from ts_4893.meters limit 1
abs(pi() * phase) |
============================
1.598750280400697 |
taos> select log(pi() * voltage) from ts_4893.meters limit 1
log(pi() * voltage) |
============================
6.542892587367153 |
taos> select voltage / pi() from ts_4893.meters limit 1
voltage / pi() |
============================
70.346484846617741 |
taos> select id, case when voltage > 100 then pi() else pi() / 2 end from ts_4893.meters limit 1
id | case when voltage > 100 then pi() else pi() / 2 end |
====================================================================
0 | 3.141592653589793e+00 |

Can't render this file because it has a wrong number of fields in line 90.

View File

@ -1,114 +0,0 @@
taos> select pi()
pi() |
============================
3.141592653589793 |
taos> select pi() + 1
pi() + 1 |
============================
4.141592653589793 |
taos> select pi() - 1
pi() - 1 |
============================
2.141592653589793 |
taos> select pi() * 2
pi() * 2 |
============================
6.283185307179586 |
taos> select pi() / 2
pi() / 2 |
============================
1.570796326794897 |
taos> select pi() from ts_4893.meters limit 5
pi() |
============================
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
taos> select pi() + 1 from ts_4893.meters limit 1
pi() + 1 |
============================
4.141592653589793 |
taos> select pi() - 1 from ts_4893.meters limit 1
pi() - 1 |
============================
2.141592653589793 |
taos> select pi() * 2 from ts_4893.meters limit 1
pi() * 2 |
============================
6.283185307179586 |
taos> select pi() / 2 from ts_4893.meters limit 1
pi() / 2 |
============================
1.570796326794897 |
taos> select pi() + pi() from ts_4893.meters limit 1
pi() + pi() |
============================
6.283185307179586 |
taos> select pi() - pi() from ts_4893.meters limit 1
pi() - pi() |
============================
0.000000000000000 |
taos> select pi() * pi() from ts_4893.meters limit 1
pi() * pi() |
============================
9.869604401089358 |
taos> select pi() / pi() from ts_4893.meters limit 1
pi() / pi() |
============================
1.000000000000000 |
taos> select pi() + id from ts_4893.meters order by ts limit 5
pi() + id |
============================
3.141592653589793 |
4.141592653589793 |
5.141592653589793 |
6.141592653589793 |
7.141592653589793 |
taos> select abs(pi())
abs(pi()) |
============================
3.141592653589793 |
taos> select pow(pi(), 2)
pow(pi(), 2) |
============================
9.869604401089358 |
taos> select sqrt(pi())
sqrt(pi()) |
============================
1.772453850905516 |
taos> select cast(pi() as int)
cast(pi() as int) |
====================
3 |
taos> select pi()
pi() |
============================
3.141592653589793 |
taos> select substring_index(null, '.', 2)
substring_index(null, '.', 2) |
================================
NULL |
Can't render this file because it has a wrong number of fields in line 90.

View File

@ -1,176 +1,447 @@
1
3
1
0
14
0
7
1
1
0
4
2
5
4
2
0
0
0
0
4
4
5
4
1
3
4
0
0
5
0
4
4
1
1
3
4
0
0
0
0
3
2
1
4
3
0
0
0
0
0
4
1
1
3
1
3
4
3
4
4
1
1
4
1
1
1
1
4
1
1
6
3
5
5
4
5
5
2
7
2
4
1
1
4
1
4
1
4
4
1
1
1.000000000000000e+00
1
0
1
1
0
0
0
0
4
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
4
0
4
0
0
0
0
0
0
0
4
0
4
0
0
5
0
0
0
0
0
0
4
0
0
5
0
0
0
0
0
0
taos> select POSITION('北' IN '北京涛思')
position('北' in '北京涛思') |
====================================
1 |
taos> select POSITION('涛思' IN '北京涛思')
position('涛思' in '北京涛思') |
=======================================
3 |
taos> select POSITION('a' IN 'abcd')
position('a' in 'abcd') |
==========================
1 |
taos> select POSITION('e' IN 'abcd')
position('e' in 'abcd') |
==========================
0 |
taos> select POSITION('好,' IN 'hello,world.你好,世界。')
position('好,' in 'hello,world.你好,世界。') |
=========================================================
14 |
taos> select POSITION(',你' IN 'hello,world.你好,世界。')
position(',你' in 'hello,world.你好,世界。') |
=========================================================
0 |
taos> select POSITION('world' IN 'hello,world.你好,世界。')
position('world' in 'hello,world.你好,世界。') |
========================================================
7 |
taos> select POSITION('aaa' IN 'aaaaaaaaa')
position('aaa' in 'aaaaaaaaa') |
=================================
1 |
taos> select POSITION(CONCAT('a','b','c') IN CONCAT('abc','def','ghi'))
position(concat('a','b','c') in concat('abc','def','ghi')) |
=============================================================
1 |
taos> select POSITION(CONCAT('a','b','d') IN CONCAT('abc','def','ghi'))
position(concat('a','b','d') in concat('abc','def','ghi')) |
=============================================================
0 |
taos> select POSITION(nch2 IN nch1) from ts_4893.meters where POSITION(nch2 IN nch1) != 0 order by ts limit 5
position(nch2 in nch1) |
=========================
4 |
2 |
5 |
4 |
2 |
taos> select POSITION(nch2 IN nch1) from ts_4893.meters order by ts limit 5
position(nch2 in nch1) |
=========================
0 |
0 |
0 |
0 |
4 |
taos> select POSITION(var2 IN var1) from ts_4893.meters where POSITION(var2 IN var1) != 0 order by ts limit 5
position(var2 in var1) |
=========================
4 |
5 |
4 |
1 |
3 |
taos> select POSITION(var2 IN var1) from ts_4893.meters order by ts limit 5
position(var2 in var1) |
=========================
4 |
0 |
0 |
5 |
0 |
taos> select POSITION(var2 IN nch1) from ts_4893.meters where POSITION(var2 IN nch1) != 0 order by ts limit 5
position(var2 in nch1) |
=========================
4 |
4 |
1 |
1 |
3 |
taos> select POSITION(var2 IN nch1) from ts_4893.meters order by ts limit 5
position(var2 in nch1) |
=========================
4 |
0 |
0 |
0 |
0 |
taos> select POSITION(nch2 IN var1) from ts_4893.meters where POSITION(nch2 IN var1) != 0 order by ts limit 5
position(nch2 in var1) |
=========================
3 |
2 |
1 |
4 |
3 |
taos> select POSITION(nch2 IN var1) from ts_4893.meters order by ts limit 5
position(nch2 in var1) |
=========================
0 |
0 |
0 |
0 |
0 |
taos> select POSITION('a' IN nch1) from ts_4893.meters where POSITION('a' IN nch1) != 0 order by ts limit 5
position('a' in nch1) |
========================
4 |
1 |
1 |
3 |
1 |
taos> select POSITION('a' IN var1) from ts_4893.meters where POSITION('a' IN var1) != 0 order by ts limit 5
position('a' in var1) |
========================
3 |
4 |
3 |
4 |
4 |
taos> select POSITION('一' IN nch1) from ts_4893.meters where POSITION('一' IN nch1) != 0 order by ts limit 5
position('一' in nch1) |
==========================
1 |
1 |
4 |
1 |
1 |
taos> select POSITION('一' IN var1) from ts_4893.meters where POSITION('一' IN var1) != 0 order by ts limit 5
position('一' in var1) |
==========================
1 |
1 |
4 |
1 |
1 |
taos> select POSITION(nch2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(nch2 IN 'abcdefghijklmn') != 0 order by ts limit 5
position(nch2 in 'abcdefghijklmn') |
=====================================
6 |
3 |
5 |
5 |
4 |
taos> select POSITION(var2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(var2 IN 'abcdefghijklmn') != 0 order by ts limit 5
position(var2 in 'abcdefghijklmn') |
=====================================
5 |
5 |
2 |
7 |
2 |
taos> select POSITION(nch2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(nch2 IN '一二三四五六七八九十') != 0 order by ts limit 5
position(nch2 in '一二三四五六七八九十') |
=====================================================
4 |
1 |
1 |
4 |
1 |
taos> select POSITION(var2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(var2 IN '一二三四五六七八九十') != 0 order by ts limit 5
position(var2 in '一二三四五六七八九十') |
=====================================================
4 |
1 |
4 |
4 |
1 |
taos> select ABS(POSITION('aaa' IN 'aaaaaaaaa'))
abs(position('aaa' in 'aaaaaaaaa')) |
======================================
1 |
taos> select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2)
pow(position('aaa' in 'aaaaaaaaa'), 2) |
=========================================
1.000000000000000e+00 |
taos> select position('t' in 'taos')
position('t' in 'taos') |
==========================
1 |
taos> select position('ustc' in 'taos')
position('ustc' in 'taos') |
=============================
0 |
taos> select position('' in '')
position('' in '') |
========================
1 |
taos> select position('' in 'taos')
position('' in 'taos') |
=========================
1 |
taos> select position(nch2 in nch1) from ts_4893.d0 order by ts limit 10
position(nch2 in nch1) |
=========================
0 |
0 |
0 |
0 |
4 |
0 |
0 |
0 |
0 |
0 |
taos> select position(nch2 in nch1) from ts_4893.meters order by ts limit 10
position(nch2 in nch1) |
=========================
0 |
0 |
0 |
0 |
4 |
0 |
0 |
0 |
0 |
0 |
taos> select position(nch2 in var1) from ts_4893.d0 order by ts limit 10
position(nch2 in var1) |
=========================
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
taos> select position(nch2 in var1) from ts_4893.meters order by ts limit 10
position(nch2 in var1) |
=========================
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
taos> select position(var2 in nch1) from ts_4893.d0 order by ts limit 10
position(var2 in nch1) |
=========================
4 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
4 |
0 |
taos> select position(var2 in nch1) from ts_4893.meters order by ts limit 10
position(var2 in nch1) |
=========================
4 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
4 |
0 |
taos> select position(var2 in var1) from ts_4893.d0 order by ts limit 10
position(var2 in var1) |
=========================
4 |
0 |
0 |
5 |
0 |
0 |
0 |
0 |
0 |
0 |
taos> select position(var2 in var1) from ts_4893.meters order by ts limit 10
position(var2 in var1) |
=========================
4 |
0 |
0 |
5 |
0 |
0 |
0 |
0 |
0 |
0 |
taos> select position('t' in null)
position('t' in null) |
========================
NULL |
taos> select position(null in 'taos')
position(null in 'taos') |
===========================
NULL |
taos> select position('' in 'A')
position('' in 'A') |
========================
1 |
taos> select position('A' in 'A')
position('A' in 'A') |
========================
1 |
taos> select position('A' in '')
position('A' in '') |
========================
0 |
taos> select position('A' in null)
position('A' in null) |
========================
NULL |
taos> select position('Z' in 'ABC')
position('Z' in 'ABC') |
=========================
0 |
taos> select position('l' in 'Hello')
position('l' in 'Hello') |
===========================
3 |
taos> select position('s' in 'meters')
position('s' in 'meters') |
============================
6 |
taos> select position('中' in '中国')
position('中' in '中国') |
==============================
1 |
taos> select position('e' in 'é')
position('e' in 'é') |
========================
0 |
taos> select position('W' in 'Hello World')
position('W' in 'Hello World') |
=================================
7 |
taos> select position('@' in '!@#')
position('@' in '!@#') |
=========================
2 |
taos> select position('6' in '12345')
position('6' in '12345') |
===========================
0 |
taos> select position('A' in trim(' A '))
position('A' in trim(' A ')) |
===============================
1 |
taos> select position('A' in upper('abc'))
position('A' in upper('abc')) |
================================
1 |
taos> select position('B' in concat('A', 'B'))
position('B' in concat('A', 'B')) |
====================================
2 |
taos> select position('x' in replace('Hello', 'l', 'x'))
position('x' in replace('Hello', 'l', 'x')) |
==============================================
3 |
taos> select name, position('e' in name) from ts_4893.meters limit 1
name | position('e' in name) |
=========================================================
lili | 0 |
taos> select name, position('a' in substring(name, 2, 5)) from ts_4893.meters limit 1
name | position('a' in substring(name, 2, 5)) |
==========================================================================
lili | 0 |
taos> select nch1, position('n' in nch1) from ts_4893.meters limit 1
nch1 | position('n' in nch1) |
=========================================================
novel | 1 |
taos> select var1, position('1' in var1) from ts_4893.meters limit 1
var1 | position('1' in var1) |
=========================================================
novel | 0 |

Can't render this file because it has a wrong number of fields in line 22.

View File

@ -1,66 +1,275 @@
0.000000000000000
0.017453292519943
0.026179938779915
1.745329251994330
-0.017453292519943
-0.026179938779915
-1.745329251994330
1.017453292519943
-0.982546707480057
0.017453292519943
0.017453292519943
0.017453292519943
0.017453292519943
0.017453292519943
0.017453292519943
0.017453292519943
1.017453292519943
-0.982546707480057
0.034906585039887
0.008726646259972
0.052359877559830
0.017453292519943
0.000609234839573
2.000000000000000
0.017453292519943
1.017453292519943
2.017453292519943
3.017453292519943
4.017453292519943
0.000000000000000
1.017453292519943
2.034906585039887
3.052359877559830
4.069813170079773
0.174532925199433
3.141592653589793
0.174532925199433
0.030461741978671
0.417771379105167
0
0.000000000000000
0.017453292519943
0.024682682989769
0.030229989403904
0.034906585039887
3.141592653589793
0.185877558679493
0.149644536324422
0.170955001564425
0.196052831414414
0.186854955444309
0.148492619284422
0.167481790094528
0.191322990739406
0.195930658899406
0.180414682914441
0.185877558679493
0.149644536324422
0.170955001564425
0.196052831414414
0.186854955444309
0.148492619284422
0.167481790094528
0.191322990739406
0.195930658899406
0.180414682914441
taos> select RADIANS(0)
radians(0) |
============================
0.000000000000000 |
taos> select RADIANS(1)
radians(1) |
============================
0.017453292519943 |
taos> select RADIANS(1.5)
radians(1.5) |
============================
0.026179938779915 |
taos> select RADIANS(100)
radians(100) |
============================
1.745329251994330 |
taos> select RADIANS(-1)
radians(-1) |
============================
-0.017453292519943 |
taos> select RADIANS(-1.5)
radians(-1.5) |
============================
-0.026179938779915 |
taos> select RADIANS(-100)
radians(-100) |
============================
-1.745329251994330 |
taos> select RADIANS(1) + 1
radians(1) + 1 |
============================
1.017453292519943 |
taos> select RADIANS(1) - 1
radians(1) - 1 |
============================
-0.982546707480057 |
taos> select RADIANS(1) * 1
radians(1) * 1 |
============================
0.017453292519943 |
taos> select RADIANS(1) / 1
radians(1) / 1 |
============================
0.017453292519943 |
taos> select RADIANS(1) from ts_4893.meters limit 5
radians(1) |
============================
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
taos> select RADIANS(1) + 1 from ts_4893.meters limit 1
radians(1) + 1 |
============================
1.017453292519943 |
taos> select RADIANS(1) - 1 from ts_4893.meters limit 1
radians(1) - 1 |
============================
-0.982546707480057 |
taos> select RADIANS(1) * 2 from ts_4893.meters limit 1
radians(1) * 2 |
============================
0.034906585039887 |
taos> select RADIANS(1) / 2 from ts_4893.meters limit 1
radians(1) / 2 |
============================
0.008726646259972 |
taos> select RADIANS(2) + RADIANS(1) from ts_4893.meters limit 1
radians(2) + radians(1) |
============================
0.052359877559830 |
taos> select RADIANS(2) - RADIANS(1) from ts_4893.meters limit 1
radians(2) - radians(1) |
============================
0.017453292519943 |
taos> select RADIANS(2) * RADIANS(1) from ts_4893.meters limit 1
radians(2) * radians(1) |
============================
0.000609234839573 |
taos> select RADIANS(2) / RADIANS(1) from ts_4893.meters limit 1
radians(2) / radians(1) |
============================
2.000000000000000 |
taos> select RADIANS(1) + id from ts_4893.meters order by ts limit 5
radians(1) + id |
============================
0.017453292519943 |
1.017453292519943 |
2.017453292519943 |
3.017453292519943 |
4.017453292519943 |
taos> select RADIANS(id) + id from ts_4893.meters order by ts limit 5
radians(id) + id |
============================
0.000000000000000 |
1.017453292519943 |
2.034906585039887 |
3.052359877559830 |
4.069813170079773 |
taos> select RADIANS(abs(10))
radians(abs(10)) |
============================
0.174532925199433 |
taos> select RADIANS(DEGREES(PI()))
radians(degrees(pi())) |
============================
3.141592653589793 |
taos> select abs(RADIANS(10))
abs(radians(10)) |
============================
0.174532925199433 |
taos> select pow(RADIANS(10), 2)
pow(radians(10), 2) |
============================
0.030461741978671 |
taos> select sqrt(RADIANS(10))
sqrt(radians(10)) |
============================
0.417771379105167 |
taos> select cast(RADIANS(10) as int)
cast(radians(10) as int) |
===========================
0 |
taos> select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5
radians(sqrt(id)) |
============================
0.000000000000000 |
0.017453292519943 |
0.024682682989769 |
0.030229989403904 |
0.034906585039887 |
taos> select radians(180)
radians(180) |
============================
3.141592653589793 |
taos> select radians(current) from ts_4893.d0 order by ts limit 10
radians(current) |
============================
0.185877558679493 |
0.149644536324422 |
0.170955001564425 |
0.196052831414414 |
0.186854955444309 |
0.148492619284422 |
0.167481790094528 |
0.191322990739406 |
0.195930658899406 |
0.180414682914441 |
taos> select radians(current) from ts_4893.meters order by ts limit 10
radians(current) |
============================
0.185877558679493 |
0.149644536324422 |
0.170955001564425 |
0.196052831414414 |
0.186854955444309 |
0.148492619284422 |
0.167481790094528 |
0.191322990739406 |
0.195930658899406 |
0.180414682914441 |
taos> select radians(null)
radians(null) |
============================
NULL |
taos> select radians(0)
radians(0) |
============================
0.000000000000000 |
taos> select radians(45)
radians(45) |
============================
0.785398163397448 |
taos> select radians(-45)
radians(-45) |
============================
-0.785398163397448 |
taos> select radians(90)
radians(90) |
============================
1.570796326794897 |
taos> select radians(-90)
radians(-90) |
============================
-1.570796326794897 |
taos> select radians(360)
radians(360) |
============================
6.283185307179586 |
taos> select radians(1000000)
radians(1000000) |
============================
17453.292519943293883 |
taos> select radians(sin(1))
radians(sin(1)) |
============================
0.014686439244897 |
taos> select radians(cos(1))
radians(cos(1)) |
============================
0.009430054193517 |
taos> select radians(tan(1))
radians(tan(1)) |
============================
0.027181892591221 |
taos> select radians(degrees(90))
radians(degrees(90)) |
============================
89.999999999999986 |
taos> select radians(atan(1))
radians(atan(1)) |
============================
0.013707783890402 |
taos> select radians(current) from ts_4893.meters limit 1
radians(current) |
============================
0.185877558679493 |
taos> select radians(voltage) from ts_4893.meters limit 1
radians(voltage) |
============================
3.857177646907469 |
taos> select radians(phase) from ts_4893.meters limit 1
radians(phase) |
============================
0.008881946002226 |

Can't render this file because it has a wrong number of fields in line 139.

View File

@ -1,21 +1,173 @@
0.663936012733698
0.840187717154710
0.840187717154710
0.700976369297587
0.561380175203728
0.916457875592847
0.274745596235034
0.135438768721856
0.486904139391568
0.352760728612896
0.206965447965528
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
0.419929514834624
taos> select RAND(1245)
rand(1245) |
============================
0.663936012733698 |
taos> select RAND(id) from ts_4893.d0 limit 10
rand(id) |
============================
0.840187717154710 |
0.840187717154710 |
0.700976369297587 |
0.561380175203728 |
0.916457875592847 |
0.274745596235034 |
0.135438768721856 |
0.486904139391568 |
0.352760728612896 |
0.206965447965528 |
taos> select RAND(id) from ts_4893.d0 order by id desc limit 10
rand(id) |
============================
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
0.419929514834624 |
taos> select rand(0)
rand(0) |
============================
0.840187717154710 |
taos> select rand(1)
rand(1) |
============================
0.840187717154710 |
taos> select rand(-1)
rand(-1) |
============================
0.118708995691831 |
taos> select rand(12345678901234567890)
rand(12345678901234567890) |
=============================
2.008294813338805e-01 |
taos> select rand(-12345678901234567890)
rand(-12345678901234567890) |
==============================
8.401877171547095e-01 |
taos> select rand(12345), rand(12345)
rand(12345) | rand(12345) |
========================================================
0.178395304446293 | 0.178395304446293 |
taos> select rand(9999999999) where rand(9999999999) >= 0 and rand(9999999999) < 1
rand(9999999999) |
============================
0.321409397442550 |
taos> select rand(id) from ts_4893.meters limit 100
rand(id) |
============================
0.840187717154710 |
0.840187717154710 |
0.700976369297587 |
0.561380175203728 |
0.916457875592847 |
0.274745596235034 |
0.135438768721856 |
0.486904139391568 |
0.352760728612896 |
0.206965447965528 |
0.565810732341283 |
0.926345318521534 |
0.785600282617658 |
0.632643183056565 |
0.999498499557142 |
0.354973177125199 |
0.215437470104283 |
0.571794000254848 |
0.929072778173291 |
0.290233385418650 |
0.148812267532950 |
0.505899571117898 |
0.865026922367991 |
0.727581746283724 |
0.087714229285584 |
0.939356191986872 |
0.795545781867367 |
0.659832971943465 |
0.517155105023251 |
0.875989373715589 |
0.229967075041480 |
0.592119012303706 |
0.449675684072858 |
0.307948935454688 |
0.168970021497910 |
0.524489704763745 |
0.381259786142623 |
0.239412393066758 |
0.598226357529977 |
0.957148446215851 |
0.819422913165494 |
0.670246056127477 |
0.033469948001890 |
0.392149003405193 |
0.749737140606035 |
0.608923980318440 |
0.469695958061933 |
0.825680229266025 |
0.683865774275673 |
0.041811583583155 |
0.894321223206036 |
0.760580372885140 |
0.615916447069457 |
0.977703406930763 |
0.329537633959920 |
0.193522962831670 |
0.052021294390793 |
0.911150676622591 |
0.766549994129012 |
0.126697651635249 |
0.985316422761100 |
0.843173408342140 |
0.699550600116863 |
0.557263156192965 |
0.419794161068180 |
0.278590486048996 |
0.133239280028846 |
0.488706417143674 |
0.854142372894167 |
0.710721029765308 |
0.570226699379378 |
0.424855420563768 |
0.283543675338637 |
0.137892492179709 |
0.998458440880505 |
0.356983164025928 |
0.218767986269094 |
0.076468908263589 |
0.431104593179703 |
0.293163777931204 |
0.650123746902740 |
0.510736836358317 |
0.864335399057872 |
0.725284450559544 |
0.085677149279824 |
0.942077809917777 |
0.798407114482674 |
0.163865051774245 |
0.017995767769402 |
0.879516513030751 |
0.736922031145972 |
0.589669372695344 |
0.954449085497507 |
0.811225361568493 |
0.172090128609953 |
0.525153056031630 |
0.386470556904781 |
0.744990266275122 |
0.100015020510189 |
0.460091779222755 |

Can't render this file because it has a wrong number of fields in line 60.

View File

@ -1,161 +1,396 @@
hello
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
aa
g;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddh
gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc;ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddh
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc;ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgh
6400
50060
北京taos北京taos北京taos北京taos北京taos北京taos
novelnovelnovelnovelnovelnovel
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdateupdateupdateupdate
prisionprisionprisionprisionprisionprision
novelnovelnovelnovelnovelnovel
novelnovelnovelnovelnovelnovel
personpersonpersonpersonpersonperson
novelnovelnovelnovelnovelnovel
plateplateplateplateplateplate
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
一二三四五六七八九十
updateupdate
prisionprisionprision
novelnovelnovelnovel
novelnovelnovelnovelnovel
person
novelnovel
plateplateplate
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdateupdateupdate
nch1
nch1nch1
nch1nch1nch1
nch1nch1nch1nch1
nch1nch1nch1nch1nch1
var1
var1var1
var1var1var1
var1var1var1var1
var1var1var1var1var1
taos
taostaos
lililililili
xxx
lililililili
xxx
lililililili
taostaostaos
hahahahahaha
taostaostaos
taostaostaos
hahahahahaha
lililililili
xxx
lililililili
xxx
lililililili
taostaostaos
hahahahahaha
taostaostaos
taostaostaos
hahahahahaha
novelnovelnovel
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdate
prisionprisionprision
novelnovelnovel
novelnovelnovel
againagainagain
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
novelnovelnovel
againagainagain
novelnovelnovel
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdate
prisionprisionprision
novelnovelnovel
novelnovelnovel
againagainagain
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
novelnovelnovel
againagainagain
novelnovelnovel
personpersonperson
novelnovelnovel
plateplateplate
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdate
prisionprisionprision
personpersonperson
prisionprisionprision
plateplateplate
novelnovelnovel
personpersonperson
novelnovelnovel
plateplateplate
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
updateupdateupdate
prisionprisionprision
personpersonperson
prisionprisionprision
plateplateplate
lili
x
lili
x
lili
taos
haha
taos
taos
haha
lili
x
lili
x
lili
taos
haha
taos
taos
haha
novel
一二三四五六七八九十
update
prision
novel
novel
again
一二三四五六七八九十
novel
again
novel
一二三四五六七八九十
update
prision
novel
novel
again
一二三四五六七八九十
novel
again
taos> select repeat('hello', 1)
repeat('hello', 1) |
=====================
hello |
taos> select repeat('hello', 20)
repeat('hello', 20) |
=================================
hellohellohellohellohellohe... |
taos> SELECT REPEAT('a', 2)
repeat('a', 2) |
=================
aa |
taos> SELECT CONCAT('g',CONCAT(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
concat('g',concat(';',repeat('a',60), repeat('b',60), repeat('c' |
===================================================================
g;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
taos> SELECT CONCAT('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
concat('g',concat_ws(';',repeat('a',60), repeat('b',60), repeat( |
===================================================================
gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
taos> SELECT CONCAT_WS('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
concat_ws('g',concat_ws(';',repeat('a',60), repeat('b',60), repe |
===================================================================
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;... |
taos> select length(concat(repeat("a",3200),repeat("a",3200)))
length(concat(repeat("a",3200),repeat("a",3200))) |
====================================================
6400 |
taos> select length(replace("aaaaa","a",concat(repeat("a",10000),repeat("a",12))))
length(replace("aaaaa","a",concat(repeat("a",10000),repeat("a",1 |
===================================================================
50060 |
taos> select repeat('北京taos', 6)
repeat('北京taos', 6) |
=================================
北京taos北京taos北京taos北... |
taos> select repeat(nch1, 6) from ts_4893.meters order by ts limit 5
repeat(nch1, 6) |
=================================
novelnovelnovelnovelnovelnovel |
一二三四五六七八九十一二三... |
updateupdateupdateupdateupd... |
prisionprisionprisionprisio... |
novelnovelnovelnovelnovelnovel |
taos> select repeat(var1, 6) from ts_4893.meters order by ts limit 5
repeat(var1, 6) |
=================================
novelnovelnovelnovelnovelnovel |
personpersonpersonpersonper... |
novelnovelnovelnovelnovelnovel |
plateplateplateplateplateplate |
一二三四五六七八九十一二三... |
taos> select position(nch1 in repeat(nch1,6)) from ts_4893.meters order by ts limit 5
position(nch1 in repeat(nch1,6)) |
===================================
1 |
1 |
1 |
1 |
1 |
taos> select position(var1 in repeat(var1,6)) from ts_4893.meters order by ts limit 5
position(var1 in repeat(var1,6)) |
===================================
1 |
1 |
1 |
1 |
1 |
taos> select position(nch1 in repeat(var1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5
position(nch1 in repeat(var1,6)) |
===================================
1 |
1 |
1 |
1 |
1 |
taos> select position(var1 in repeat(nch1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5
position(var1 in repeat(nch1,6)) |
===================================
1 |
1 |
1 |
1 |
1 |
taos> select repeat(nch1, id) from ts_4893.meters where id > 0 order by ts limit 5
repeat(nch1, id) |
=================================
一二三四五六七八九十 |
updateupdate |
prisionprisionprision |
novelnovelnovelnovel |
novelnovelnovelnovelnovel |
taos> select repeat(var1, id) from ts_4893.meters where id > 0 order by ts limit 5
repeat(var1, id) |
===================
person |
novelnovel |
plateplateplate |
一二三四五六... |
updateupdateu... |
taos> select repeat('nch1', id) from ts_4893.meters where id > 0 order by ts limit 5
repeat('nch1', id) |
=================================
nch1 |
nch1nch1 |
nch1nch1nch1 |
nch1nch1nch1nch1 |
nch1nch1nch1nch1nch1 |
taos> select repeat('var1', id) from ts_4893.meters where id > 0 order by ts limit 5
repeat('var1', id) |
=================================
var1 |
var1var1 |
var1var1var1 |
var1var1var1var1 |
var1var1var1var1var1 |
taos> select repeat('taos', 1)
repeat('taos', 1) |
====================
taos |
taos> select repeat('taos', 2)
repeat('taos', 2) |
====================
taostaos |
taos> select repeat(name, 3) from ts_4893.d0 order by ts limit 10
repeat(name, 3) |
=================================
lililililili |
xxx |
lililililili |
xxx |
lililililili |
taostaostaos |
hahahahahaha |
taostaostaos |
taostaostaos |
hahahahahaha |
taos> select repeat(name, 3) from ts_4893.meters order by ts limit 10
repeat(name, 3) |
=================================
lililililili |
xxx |
lililililili |
xxx |
lililililili |
taostaostaos |
hahahahahaha |
taostaostaos |
taostaostaos |
hahahahahaha |
taos> select repeat(nch1, 3) from ts_4893.d0 order by ts limit 10
repeat(nch1, 3) |
=================================
novelnovelnovel |
一二三四五六七八九十一二三... |
updateupdateupdate |
prisionprisionprision |
novelnovelnovel |
novelnovelnovel |
againagainagain |
一二三四五六七八九十一二三... |
novelnovelnovel |
againagainagain |
taos> select repeat(nch1, 3) from ts_4893.meters order by ts limit 10
repeat(nch1, 3) |
=================================
novelnovelnovel |
一二三四五六七八九十一二三... |
updateupdateupdate |
prisionprisionprision |
novelnovelnovel |
novelnovelnovel |
againagainagain |
一二三四五六七八九十一二三... |
novelnovelnovel |
againagainagain |
taos> select repeat(var1, 3) from ts_4893.d0 order by ts limit 10
repeat(var1, 3) |
=================================
novelnovelnovel |
personpersonperson |
novelnovelnovel |
plateplateplate |
一二三四五六七八九十一二三... |
updateupdateupdate |
prisionprisionprision |
personpersonperson |
prisionprisionprision |
plateplateplate |
taos> select repeat(var1, 3) from ts_4893.meters order by ts limit 10
repeat(var1, 3) |
=================================
novelnovelnovel |
personpersonperson |
novelnovelnovel |
plateplateplate |
一二三四五六七八九十一二三... |
updateupdateupdate |
prisionprisionprision |
personpersonperson |
prisionprisionprision |
plateplateplate |
taos> select repeat(name, groupid) from ts_4893.d0 order by ts limit 10
repeat(name, groupid) |
========================
lili |
x |
lili |
x |
lili |
taos |
haha |
taos |
taos |
haha |
taos> select repeat(name, groupid) from ts_4893.meters order by ts limit 10
repeat(name, groupid) |
========================
lili |
x |
lili |
x |
lili |
taos |
haha |
taos |
taos |
haha |
taos> select repeat(nch1, groupid) from ts_4893.d0 order by ts limit 10
repeat(nch1, groupid) |
=================================
novel |
一二三四五六七八九十 |
update |
prision |
novel |
novel |
again |
一二三四五六七八九十 |
novel |
again |
taos> select repeat(nch1, groupid) from ts_4893.meters order by ts limit 10
repeat(nch1, groupid) |
=================================
novel |
一二三四五六七八九十 |
update |
prision |
novel |
novel |
again |
一二三四五六七八九十 |
novel |
again |
taos> select repeat(null, 3)
repeat(null, 3) |
==================
NULL |
taos> select repeat('taos', null)
repeat('taos', null) |
=======================
NULL |
taos> select repeat('taos', 0)
repeat('taos', 0) |
====================
|
taos> select repeat('', 5)
repeat('', 5) |
================
|
taos> select repeat('A', 0)
repeat('A', 0) |
=================
|
taos> select repeat('A', 10)
repeat('A', 10) |
=================================
AAAAAAAAAA |
taos> select repeat('A B', 5)
repeat('A B', 5) |
============================
A BA BA BA BA B |
taos> select repeat('ABC', 1)
repeat('ABC', 1) |
===================
ABC |
taos> select repeat('Hello', 2)
repeat('Hello', 2) |
=====================
HelloHello |
taos> select repeat('HelloWorld', 2)
repeat('HelloWorld', 2) |
===========================
HelloWorldHelloWorld |
taos> select repeat('123', 5)
repeat('123', 5) |
============================
123123123123123 |
taos> select repeat('12345', 3)
repeat('12345', 3) |
========================
123451234512345 |
taos> select repeat('!@#', 3)
repeat('!@#', 3) |
===================
!@#!@#!@# |
taos> select repeat('你好', 2)
repeat('你好', 2) |
======================
你好你好 |
taos> select repeat('abc', length('abc'))
repeat('abc', length('abc')) |
===============================
abcabcabc |
taos> select repeat(concat('A', 'B', 'C'), 3)
repeat(concat('A', 'B', 'C'), 3) |
===================================
ABCABCABC |
taos> select repeat(upper('abc'), 4)
repeat(upper('abc'), 4) |
==========================
ABCABCABCABC |
taos> select repeat(trim(' Hello '), 3)
repeat(trim(' Hello '), 3) |
=================================
HelloHelloHello |
taos> select name, repeat(name, 3) from ts_4893.meters limit 1
name | repeat(name, 3) |
==================================================================
lili | lililililili |
taos> select name, repeat(substring(name, 1, 5), 2) from ts_4893.meters limit 1
name | repeat(substring(name, 1, 5), 2) |
====================================================================
lili | lililili |
taos> select var1, repeat(var1, 2) from ts_4893.meters limit 1
var1 | repeat(var1, 2) |
==================================================================
novel | novelnovel |
taos> select nch1, repeat(nch1, 4) from ts_4893.meters limit 1
nch1 | repeat(nch1, 4) |
==================================================================
novel | novelnovelnovelnovel |

Can't render this file because it has a wrong number of fields in line 4.

File diff suppressed because it is too large Load Diff

View File

@ -1,94 +1,310 @@
10.550000000000001
10.550000000000001
10.600000000000000
11.000000000000000
11.000000000000000
10.000000000000000
0.000000000000000
-10.600000000000000
99
111.000000000000000
112.000000000000000
12.000000000000000
11.600000000000000
1.230000000000000e+02
1.230000000000000e+08
11.0000000
9.0000000
10.0000000
11.0000000
11.0000000
9.0000000
10.0000000
11.0000000
11.0000000
10.0000000
11.0000000
9.0000000
11.0000000
8.0000000
12.0000000
9.0000000
10.0000000
10.0000000
10.0000000
10.0000000
8.765432100000000e+07
8.765432109999999e+07
8.765432112000000e+07
8.765432112300000e+07
8.765432112350000e+07
8.765432112345999e+07
8.765432112345700e+07
8.765432112345681e+07
8.765432112345679e+07
8.765432112345679e+07
11.0000000
8.6000004
9.8000002
11.2329998
10.7060003
8.5080004
9.5959997
10.9619999
11.2259998
10.3369999
10.6999998
8.6000004
9.8000002
11.1999998
10.6999998
8.5000000
9.6000004
11.0000000
11.1999998
10.3000002
10.55
10.55
10.6
11
11
10
0
-10.6
99
11
9
10
11
11
9
10
11
11
10
11
9
10
11
11
9
10
11
11
10
taos> select ROUND(10.55, 3)
round(10.55, 3) |
============================
10.550000000000001 |
taos> select ROUND(10.55, 2)
round(10.55, 2) |
============================
10.550000000000001 |
taos> select ROUND(10.55, 1)
round(10.55, 1) |
============================
10.600000000000000 |
taos> select ROUND(10.55, 0)
round(10.55, 0) |
============================
11.000000000000000 |
taos> select ROUND(10.55)
round(10.55) |
============================
11.000000000000000 |
taos> select ROUND(10.55, -1)
round(10.55, -1) |
============================
10.000000000000000 |
taos> select ROUND(10.55, -10)
round(10.55, -10) |
============================
0.000000000000000 |
taos> select ROUND(-10.55, 1)
round(-10.55, 1) |
============================
-10.600000000000000 |
taos> select ROUND(99, 1)
round(99, 1) |
========================
99 |
taos> select ROUND(111.1111)
round(111.1111) |
============================
111.000000000000000 |
taos> select ROUND(111.5111)
round(111.5111) |
============================
112.000000000000000 |
taos> select ROUND(10.55) + 1
round(10.55) + 1 |
============================
12.000000000000000 |
taos> select ROUND(10.55, 1) + 1
round(10.55, 1) + 1 |
============================
11.600000000000000 |
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
round(round(round(round(round(round(round(123.123456789, 9), 8), |
===================================================================
1.230000000000000e+02 |
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
round(round(round(round(round(round(round(123456789.123456789, - |
===================================================================
1.230000000000000e+08 |
taos> select ROUND(current) from ts_4893.meters order by ts limit 20
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
11.0000000 |
9.0000000 |
11.0000000 |
8.0000000 |
12.0000000 |
9.0000000 |
10.0000000 |
10.0000000 |
10.0000000 |
10.0000000 |
taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
round(87654321.123456789, id) |
================================
8.765432100000000e+07 |
8.765432109999999e+07 |
8.765432112000000e+07 |
8.765432112300000e+07 |
8.765432112350000e+07 |
8.765432112345999e+07 |
8.765432112345700e+07 |
8.765432112345681e+07 |
8.765432112345679e+07 |
8.765432112345679e+07 |
taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
round(current, id) |
=======================
11.0000000 |
8.6000004 |
9.8000002 |
11.2329998 |
10.7060003 |
8.5080004 |
9.5959997 |
10.9619999 |
11.2259998 |
10.3369999 |
taos> select ROUND(current, 1) from ts_4893.meters order by ts limit 10
round(current, 1) |
=======================
10.6999998 |
8.6000004 |
9.8000002 |
11.1999998 |
10.6999998 |
8.5000000 |
9.6000004 |
11.0000000 |
11.1999998 |
10.3000002 |
taos> select round(10.55, 3)
round(10.55, 3) |
============================
10.550000000000001 |
taos> select round(10.55, 2)
round(10.55, 2) |
============================
10.550000000000001 |
taos> select round(10.55, 1)
round(10.55, 1) |
============================
10.600000000000000 |
taos> select round(10.55, 0)
round(10.55, 0) |
============================
11.000000000000000 |
taos> select round(10.55)
round(10.55) |
============================
11.000000000000000 |
taos> select round(10.55, -1)
round(10.55, -1) |
============================
10.000000000000000 |
taos> select round(10.55, -10)
round(10.55, -10) |
============================
0.000000000000000 |
taos> select round(-10.55, 1)
round(-10.55, 1) |
============================
-10.600000000000000 |
taos> select round(99, 1)
round(99, 1) |
========================
99 |
taos> select round(current) from ts_4893.d0 order by ts limit 10
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
taos> select round(current) from ts_4893.meters order by ts limit 10
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
taos> select round(10, null)
round(10, null) |
========================
NULL |
taos> select round(null, 2)
round(null, 2) |
========================
NULL |
taos> select round(123.456, null)
round(123.456, null) |
============================
NULL |
taos> select round(100)
round(100) |
========================
100 |
taos> select round(0.00123, -2)
round(0.00123, -2) |
============================
0.000000000000000 |
taos> select round(123.456, 0)
round(123.456, 0) |
============================
123.000000000000000 |
taos> select round(123.456, -5)
round(123.456, -5) |
============================
0.000000000000000 |
taos> select round(12345.6789, -2)
round(12345.6789, -2) |
============================
12300.000000000000000 |
taos> select round(-123.456, 2)
round(-123.456, 2) |
============================
-123.459999999999994 |
taos> select round(-1234.5678, 2)
round(-1234.5678, 2) |
============================
-1234.569999999999936 |
taos> select round(voltage, 0) from ts_4893.meters limit 1
round(voltage, 0) |
====================
221 |
taos> select round(current, 1) from ts_4893.meters limit 1
round(current, 1) |
=======================
10.6999998 |
taos> select round(phase, 3) from ts_4893.meters limit 1
round(phase, 3) |
=======================
0.5090000 |
taos> select round(voltage, -1) from ts_4893.meters limit 1
round(voltage, -1) |
=====================
220 |
taos> select round(current * voltage, 2) from ts_4893.meters limit 1
round(current * voltage, 2) |
==============================
2.353650000000000e+03 |
taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
round(abs(voltage), 2) |
=========================
221 |
taos> select round(pi() * phase, 3) from ts_4893.meters limit 1
round(pi() * phase, 3) |
============================
1.599000000000000 |
taos> select round(sqrt(voltage), 2) from ts_4893.meters limit 1
round(sqrt(voltage), 2) |
============================
14.869999999999999 |
taos> select round(log(current), 2) from ts_4893.meters limit 1
round(log(current), 2) |
============================
2.370000000000000 |

1 10.550000000000001 taos> select ROUND(10.55, 3)
2 10.550000000000001 round(10.55, 3) |
3 10.600000000000000 ============================
4 11.000000000000000 10.550000000000001 |
5 11.000000000000000 taos> select ROUND(10.55, 2)
6 10.000000000000000 round(10.55, 2) |
7 0.000000000000000 ============================
8 -10.600000000000000 10.550000000000001 |
9 99 taos> select ROUND(10.55, 1)
10 111.000000000000000 round(10.55, 1) |
11 112.000000000000000 ============================
12 12.000000000000000 10.600000000000000 |
13 11.600000000000000 taos> select ROUND(10.55, 0)
14 1.230000000000000e+02 round(10.55, 0) |
15 1.230000000000000e+08 ============================
16 11.0000000 11.000000000000000 |
17 9.0000000 taos> select ROUND(10.55)
18 10.0000000 round(10.55) |
19 11.0000000 ============================
20 11.0000000 11.000000000000000 |
21 9.0000000 taos> select ROUND(10.55, -1)
22 10.0000000 round(10.55, -1) |
23 11.0000000 ============================
24 11.0000000 10.000000000000000 |
25 10.0000000 taos> select ROUND(10.55, -10)
26 11.0000000 round(10.55, -10) |
27 9.0000000 ============================
28 11.0000000 0.000000000000000 |
29 8.0000000 taos> select ROUND(-10.55, 1)
30 12.0000000 round(-10.55, 1) |
31 9.0000000 ============================
32 10.0000000 -10.600000000000000 |
33 10.0000000 taos> select ROUND(99, 1)
34 10.0000000 round(99, 1) |
35 10.0000000 ========================
36 8.765432100000000e+07 99 |
37 8.765432109999999e+07 taos> select ROUND(111.1111)
38 8.765432112000000e+07 round(111.1111) |
39 8.765432112300000e+07 ============================
40 8.765432112350000e+07 111.000000000000000 |
41 8.765432112345999e+07 taos> select ROUND(111.5111)
42 8.765432112345700e+07 round(111.5111) |
43 8.765432112345681e+07 ============================
44 8.765432112345679e+07 112.000000000000000 |
45 8.765432112345679e+07 taos> select ROUND(10.55) + 1
46 11.0000000 round(10.55) + 1 |
47 8.6000004 ============================
48 9.8000002 12.000000000000000 |
49 11.2329998 taos> select ROUND(10.55, 1) + 1
50 10.7060003 round(10.55, 1) + 1 |
51 8.5080004 ============================
52 9.5959997 11.600000000000000 |
53 10.9619999 taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
54 11.2259998 round(round(round(round(round(round(round(123.123456789, 9), 8), |
55 10.3369999 ===================================================================
56 10.6999998 1.230000000000000e+02 |
57 8.6000004 taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
58 9.8000002 round(round(round(round(round(round(round(123456789.123456789, - |
59 11.1999998 ===================================================================
60 10.6999998 1.230000000000000e+08 |
61 8.5000000 taos> select ROUND(current) from ts_4893.meters order by ts limit 20
62 9.6000004 round(current) |
63 11.0000000 =======================
64 11.1999998 11.0000000 |
65 10.3000002 9.0000000 |
66 10.55 10.0000000 |
67 10.55 11.0000000 |
68 10.6 11.0000000 |
69 11 9.0000000 |
70 11 10.0000000 |
71 10 11.0000000 |
72 0 11.0000000 |
73 -10.6 10.0000000 |
74 99 11.0000000 |
75 11 9.0000000 |
76 9 11.0000000 |
77 10 8.0000000 |
78 11 12.0000000 |
79 11 9.0000000 |
80 9 10.0000000 |
81 10 10.0000000 |
82 11 10.0000000 |
83 11 10.0000000 |
84 10 taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
85 11 round(87654321.123456789, id) |
86 9 ================================
87 10 8.765432100000000e+07 |
88 11 8.765432109999999e+07 |
89 11 8.765432112000000e+07 |
90 9 8.765432112300000e+07 |
91 10 8.765432112350000e+07 |
92 11 8.765432112345999e+07 |
93 11 8.765432112345700e+07 |
94 10 8.765432112345681e+07 |
95 8.765432112345679e+07 |
96 8.765432112345679e+07 |
97 taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
98 round(current, id) |
99 =======================
100 11.0000000 |
101 8.6000004 |
102 9.8000002 |
103 11.2329998 |
104 10.7060003 |
105 8.5080004 |
106 9.5959997 |
107 10.9619999 |
108 11.2259998 |
109 10.3369999 |
110 taos> select ROUND(current, 1) from ts_4893.meters order by ts limit 10
111 round(current, 1) |
112 =======================
113 10.6999998 |
114 8.6000004 |
115 9.8000002 |
116 11.1999998 |
117 10.6999998 |
118 8.5000000 |
119 9.6000004 |
120 11.0000000 |
121 11.1999998 |
122 10.3000002 |
123 taos> select round(10.55, 3)
124 round(10.55, 3) |
125 ============================
126 10.550000000000001 |
127 taos> select round(10.55, 2)
128 round(10.55, 2) |
129 ============================
130 10.550000000000001 |
131 taos> select round(10.55, 1)
132 round(10.55, 1) |
133 ============================
134 10.600000000000000 |
135 taos> select round(10.55, 0)
136 round(10.55, 0) |
137 ============================
138 11.000000000000000 |
139 taos> select round(10.55)
140 round(10.55) |
141 ============================
142 11.000000000000000 |
143 taos> select round(10.55, -1)
144 round(10.55, -1) |
145 ============================
146 10.000000000000000 |
147 taos> select round(10.55, -10)
148 round(10.55, -10) |
149 ============================
150 0.000000000000000 |
151 taos> select round(-10.55, 1)
152 round(-10.55, 1) |
153 ============================
154 -10.600000000000000 |
155 taos> select round(99, 1)
156 round(99, 1) |
157 ========================
158 99 |
159 taos> select round(current) from ts_4893.d0 order by ts limit 10
160 round(current) |
161 =======================
162 11.0000000 |
163 9.0000000 |
164 10.0000000 |
165 11.0000000 |
166 11.0000000 |
167 9.0000000 |
168 10.0000000 |
169 11.0000000 |
170 11.0000000 |
171 10.0000000 |
172 taos> select round(current) from ts_4893.meters order by ts limit 10
173 round(current) |
174 =======================
175 11.0000000 |
176 9.0000000 |
177 10.0000000 |
178 11.0000000 |
179 11.0000000 |
180 9.0000000 |
181 10.0000000 |
182 11.0000000 |
183 11.0000000 |
184 10.0000000 |
185 taos> select round(10, null)
186 round(10, null) |
187 ========================
188 NULL |
189 taos> select round(null, 2)
190 round(null, 2) |
191 ========================
192 NULL |
193 taos> select round(123.456, null)
194 round(123.456, null) |
195 ============================
196 NULL |
197 taos> select round(100)
198 round(100) |
199 ========================
200 100 |
201 taos> select round(0.00123, -2)
202 round(0.00123, -2) |
203 ============================
204 0.000000000000000 |
205 taos> select round(123.456, 0)
206 round(123.456, 0) |
207 ============================
208 123.000000000000000 |
209 taos> select round(123.456, -5)
210 round(123.456, -5) |
211 ============================
212 0.000000000000000 |
213 taos> select round(12345.6789, -2)
214 round(12345.6789, -2) |
215 ============================
216 12300.000000000000000 |
217 taos> select round(-123.456, 2)
218 round(-123.456, 2) |
219 ============================
220 -123.459999999999994 |
221 taos> select round(-1234.5678, 2)
222 round(-1234.5678, 2) |
223 ============================
224 -1234.569999999999936 |
225 taos> select round(voltage, 0) from ts_4893.meters limit 1
226 round(voltage, 0) |
227 ====================
228 221 |
229 taos> select round(current, 1) from ts_4893.meters limit 1
230 round(current, 1) |
231 =======================
232 10.6999998 |
233 taos> select round(phase, 3) from ts_4893.meters limit 1
234 round(phase, 3) |
235 =======================
236 0.5090000 |
237 taos> select round(voltage, -1) from ts_4893.meters limit 1
238 round(voltage, -1) |
239 =====================
240 220 |
241 taos> select round(current * voltage, 2) from ts_4893.meters limit 1
242 round(current * voltage, 2) |
243 ==============================
244 2.353650000000000e+03 |
245 taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
246 round(abs(voltage), 2) |
247 =========================
248 221 |
249 taos> select round(pi() * phase, 3) from ts_4893.meters limit 1
250 round(pi() * phase, 3) |
251 ============================
252 1.599000000000000 |
253 taos> select round(sqrt(voltage), 2) from ts_4893.meters limit 1
254 round(sqrt(voltage), 2) |
255 ============================
256 14.869999999999999 |
257 taos> select round(log(current), 2) from ts_4893.meters limit 1
258 round(log(current), 2) |
259 ============================
260 2.370000000000000 |
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310

View File

@ -1,70 +1,275 @@
0
1
1.000000000000000
1
-1
-1.000000000000000
-1
2.000000000000000
0.000000000000000
1.000000000000000
1.000000000000000
1
1
1
1
1
2.000000000000000
0.000000000000000
2.000000000000000
0.500000000000000
2.000000000000000
0.000000000000000
1.000000000000000
1.000000000000000
1.000000000000000
2.000000000000000
3.000000000000000
4.000000000000000
5.000000000000000
0.000000000000000
2.000000000000000
3.000000000000000
4.000000000000000
5.000000000000000
1
1
1
1.000000000000000
1.000000000000000
1
0.000000000000000
1.000000000000000
1.000000000000000
1.000000000000000
1.000000000000000
0
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
taos> select SIGN(0)
sign(0) |
========================
0 |
taos> select SIGN(1)
sign(1) |
========================
1 |
taos> select SIGN(1.5)
sign(1.5) |
============================
1.000000000000000 |
taos> select SIGN(100)
sign(100) |
========================
1 |
taos> select SIGN(-1)
sign(-1) |
========================
-1 |
taos> select SIGN(-1.5)
sign(-1.5) |
============================
-1.000000000000000 |
taos> select SIGN(-100)
sign(-100) |
========================
-1 |
taos> select SIGN(1) + 1
sign(1) + 1 |
============================
2.000000000000000 |
taos> select SIGN(1) - 1
sign(1) - 1 |
============================
0.000000000000000 |
taos> select SIGN(1) * 1
sign(1) * 1 |
============================
1.000000000000000 |
taos> select SIGN(1) / 1
sign(1) / 1 |
============================
1.000000000000000 |
taos> select SIGN(1) from ts_4893.meters limit 5
sign(1) |
========================
1 |
1 |
1 |
1 |
1 |
taos> select SIGN(1) + 1 from ts_4893.meters limit 1
sign(1) + 1 |
============================
2.000000000000000 |
taos> select SIGN(1) - 1 from ts_4893.meters limit 1
sign(1) - 1 |
============================
0.000000000000000 |
taos> select SIGN(1) * 2 from ts_4893.meters limit 1
sign(1) * 2 |
============================
2.000000000000000 |
taos> select SIGN(1) / 2 from ts_4893.meters limit 1
sign(1) / 2 |
============================
0.500000000000000 |
taos> select SIGN(2) + SIGN(1) from ts_4893.meters limit 1
sign(2) + sign(1) |
============================
2.000000000000000 |
taos> select SIGN(2) - SIGN(1) from ts_4893.meters limit 1
sign(2) - sign(1) |
============================
0.000000000000000 |
taos> select SIGN(2) * SIGN(1) from ts_4893.meters limit 1
sign(2) * sign(1) |
============================
1.000000000000000 |
taos> select SIGN(2) / SIGN(1) from ts_4893.meters limit 1
sign(2) / sign(1) |
============================
1.000000000000000 |
taos> select SIGN(1) + id from ts_4893.meters order by ts limit 5
sign(1) + id |
============================
1.000000000000000 |
2.000000000000000 |
3.000000000000000 |
4.000000000000000 |
5.000000000000000 |
taos> select SIGN(id) + id from ts_4893.meters order by ts limit 5
sign(id) + id |
============================
0.000000000000000 |
2.000000000000000 |
3.000000000000000 |
4.000000000000000 |
5.000000000000000 |
taos> select SIGN(abs(10))
sign(abs(10)) |
========================
1 |
taos> select SIGN(abs(-10))
sign(abs(-10)) |
========================
1 |
taos> select abs(SIGN(10))
abs(sign(10)) |
========================
1 |
taos> select pow(SIGN(10), 2)
pow(sign(10), 2) |
============================
1.000000000000000 |
taos> select sqrt(SIGN(10))
sqrt(sign(10)) |
============================
1.000000000000000 |
taos> select cast(SIGN(10) as int)
cast(sign(10) as int) |
========================
1 |
taos> select SIGN(sqrt(id)) from ts_4893.meters order by ts limit 5
sign(sqrt(id)) |
============================
0.000000000000000 |
1.000000000000000 |
1.000000000000000 |
1.000000000000000 |
1.000000000000000 |
taos> select SIGN(SIGN(SIGN(SIGN(0))))
sign(sign(sign(sign(0)))) |
============================
0 |
taos> select sign(1)
sign(1) |
========================
1 |
taos> select sign(10)
sign(10) |
========================
1 |
taos> select sign(-1)
sign(-1) |
========================
-1 |
taos> select sign(-10)
sign(-10) |
========================
-1 |
taos> select sign(current) from ts_4893.d0 order by ts limit 10
sign(current) |
=======================
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
taos> select sign(current) from ts_4893.meters order by ts limit 10
sign(current) |
=======================
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
taos> select sign(null)
sign(null) |
========================
NULL |
taos> select sign(25)
sign(25) |
========================
1 |
taos> select sign(-10)
sign(-10) |
========================
-1 |
taos> select sign(0.1)
sign(0.1) |
============================
1.000000000000000 |
taos> select sign(-0.1)
sign(-0.1) |
============================
-1.000000000000000 |
taos> select sign(current) from ts_4893.meters limit 1
sign(current) |
=======================
1.0000000 |
taos> select sign(voltage) from ts_4893.meters limit 1
sign(voltage) |
================
1 |
taos> select sign(phase) from ts_4893.meters limit 1
sign(phase) |
=======================
1.0000000 |
taos> select sign(abs(voltage)) from ts_4893.meters limit 1
sign(abs(voltage)) |
=====================
1 |
taos> select sign(round(current)) from ts_4893.meters limit 1
sign(round(current)) |
=======================
1.0000000 |
taos> select sign(sqrt(voltage)) from ts_4893.meters limit 1
sign(sqrt(voltage)) |
============================
1.000000000000000 |
taos> select sign(log(current + 1)) from ts_4893.meters limit 1
sign(log(current + 1)) |
============================
1.000000000000000 |

Can't render this file because it has a wrong number of fields in line 139.

View File

@ -1,37 +1,138 @@
1.154339668872968
0.838273408289688
0.838639277789964
0.839707477142887
0.839707477142887
0.840565842326812
0.844574982206356
0.846680761198646
0.847012832740021
0.847182714923875
0.848223610563542
2886.751331514371941
4.609772228646444
8.366600265340756
8.366600265340756
8.366600265340756
8.366600265340756
8.077747210701755
8.366600265340756
8.366600265340756
8.366600265340756
8.366600265340756
2857.595142773027419
4.609772228646444
5.477225575051661
8.077747210701755
8.077747210701755
8.077747210701755
8.077747210701755
8.077747210701755
8.077747210701755
8.077747210701755
8.077747210701755
2886.751331514371941
2886.751331514371941
1.154339668872967
1.154339668872967
taos> select STDDEV(current) from ts_4893.meters
stddev(current) |
============================
1.154339668872967 |
taos> select STDDEV(current) from ts_4893.meters interval(1d) order by 1 limit 10
stddev(current) |
============================
0.838273408289689 |
0.838639277789961 |
0.839707477142884 |
0.839707477142884 |
0.840565842326814 |
0.844574982206356 |
0.846680761198646 |
0.847012832740024 |
0.847182714923872 |
0.848223610563545 |
taos> select STDDEV(id) from ts_4893.meters
stddev(id) |
============================
2886.751331514371941 |
taos> select STDDEV(id) from ts_4893.meters interval(1d) limit 10
stddev(id) |
============================
4.609772228646444 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.077747210701755 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
taos> select STDDEV(id) from ts_4893.meters where id > 100
stddev(id) |
============================
2857.595142773027419 |
taos> select STDDEV(id) from ts_4893.meters interval(1d) order by 1 limit 10
stddev(id) |
============================
4.609772228646444 |
5.477225575051661 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
taos> select stddev_pop(null) from ts_4893.meters
stddev_pop(null) |
============================
NULL |
taos> select stddev_pop(id) from ts_4893.d0
stddev_pop(id) |
============================
2886.751331514371941 |
taos> select stddev_pop(id) from ts_4893.meters
stddev_pop(id) |
============================
2886.751331514371941 |
taos> select stddev_pop(current) from ts_4893.d0
stddev_pop(current) |
============================
1.154339668872967 |
taos> select stddev_pop(current) from ts_4893.meters
stddev_pop(current) |
============================
1.154339668872967 |
taos> select stddev_pop(voltage) from ts_4893.meters
stddev_pop(voltage) |
============================
2.876459705957324 |
taos> select stddev_pop(voltage) from ts_4893.meters where voltage is not null
stddev_pop(voltage) |
============================
2.876459705957324 |
taos> select stddev_pop(phase) from ts_4893.meters
stddev_pop(phase) |
============================
0.288595458155823 |
taos> select stddev_pop(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
stddev_pop(phase) |
============================
0.288075357974611 |
taos> select stddev_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
stddev_pop(total_voltage) |
============================
0.000000000000000 |
taos> select round(stddev_pop(current), 2) from ts_4893.meters
round(stddev_pop(current), 2) |
================================
1.150000000000000e+00 |
taos> select pow(stddev_pop(current), 2) from ts_4893.meters
pow(stddev_pop(current), 2) |
==============================
1.332500071133751e+00 |
taos> select log(stddev_pop(voltage) + 1) from ts_4893.meters
log(stddev_pop(voltage) + 1) |
===============================
1.354922290183882e+00 |
taos> select groupid, stddev_pop(voltage) from ts_4893.meters group by groupid order by groupid
groupid | stddev_pop(voltage) |
======================================
1 | 2.876459705957324 |
taos> select location, stddev_pop(current) from ts_4893.meters group by location order by location
location | stddev_pop(current) |
=================================================
beijing | 1.154339668872967 |
taos> select location, stddev_pop(voltage) from ts_4893.meters group by location order by location
location | stddev_pop(voltage) |
=================================================
beijing | 2.876459705957324 |

Can't render this file because it has a wrong number of fields in line 109.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

472
tests/army/query/function/ans/trunc.csv Executable file → Normal file
View File

@ -1,129 +1,343 @@
10.550000000000001
10.550000000000001
10.500000000000000
10.000000000000000
10.000000000000000
0.000000000000000
-10.500000000000000
99
11.500000000000000
1.231230000000000e+02
1.200000000000000e+08
8.765432100000000e+07
8.765432109999999e+07
8.765432112000000e+07
8.765432112300000e+07
8.765432112340000e+07
8.765432112345000e+07
8.765432112345600e+07
8.765432112345670e+07
8.765432112345679e+07
8.765432112345679e+07
10.0000000
8.5000000
9.7900000
11.2329998
10.7060003
8.5080004
9.5959997
10.9619999
11.2259998
10.3369999
10.6000004
8.5000000
9.6999998
11.1999998
10.6999998
8.5000000
9.5000000
10.8999996
11.1999998
10.3000002
10.550000000000001
10.550000000000001
10.500000000000000
10.000000000000000
10.000000000000000
0.000000000000000
-10.500000000000000
99
11.500000000000000
1.231230000000000e+02
1.200000000000000e+08
8.765432100000000e+07
8.765432109999999e+07
8.765432112000000e+07
8.765432112300000e+07
8.765432112340000e+07
8.765432112345000e+07
8.765432112345600e+07
8.765432112345670e+07
8.765432112345679e+07
8.765432112345679e+07
10.0000000
8.5000000
9.7900000
11.2329998
10.7060003
8.5080004
9.5959997
10.9619999
11.2259998
10.3369999
10.6000004
8.5000000
9.6999998
11.1999998
10.6999998
8.5000000
9.5000000
10.8999996
11.1999998
10.3000002
99.99
99.99
99.9
99
90
0
99
10.6
8.5
9.7
11.2
10.7
8.5
9.5
10.9
11.2
10.3
10.6
8.5
9.7
11.2
10.7
8.5
9.5
10.9
11.2
10.3
10.6
8.5
9.7
11.2
10.7
8.5
9.5
10.9
11.2
10.3
10.6
8.5
9.7
11.2
10.7
8.5
9.5
10.9
11.2
10.3
taos> select TRUNCATE(10.55, 3)
truncate(10.55, 3) |
============================
10.550000000000001 |
taos> select TRUNCATE(10.55, 2)
truncate(10.55, 2) |
============================
10.550000000000001 |
taos> select TRUNCATE(10.55, 1)
truncate(10.55, 1) |
============================
10.500000000000000 |
taos> select TRUNCATE(10.55, 0)
truncate(10.55, 0) |
============================
10.000000000000000 |
taos> select TRUNCATE(10.55, -1)
truncate(10.55, -1) |
============================
10.000000000000000 |
taos> select TRUNCATE(10.55, -10)
truncate(10.55, -10) |
============================
0.000000000000000 |
taos> select TRUNCATE(-10.55, 1)
truncate(-10.55, 1) |
============================
-10.500000000000000 |
taos> select TRUNCATE(99, 1)
truncate(99, 1) |
========================
99 |
taos> select TRUNCATE(10.55, 1) + 1
truncate(10.55, 1) + 1 |
============================
11.500000000000000 |
taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3)
truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
===================================================================
1.231230000000000e+02 |
taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
===================================================================
1.200000000000000e+08 |
taos> select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10
truncate(87654321.123456789, id) |
===================================
8.765432100000000e+07 |
8.765432109999999e+07 |
8.765432112000000e+07 |
8.765432112300000e+07 |
8.765432112340000e+07 |
8.765432112345000e+07 |
8.765432112345600e+07 |
8.765432112345670e+07 |
8.765432112345679e+07 |
8.765432112345679e+07 |
taos> select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10
truncate(current, id) |
========================
1.0000000e+01 |
8.5000000e+00 |
9.7900000e+00 |
1.1233000e+01 |
1.0706000e+01 |
8.5080004e+00 |
9.5959997e+00 |
1.0962000e+01 |
1.1226000e+01 |
1.0337000e+01 |
taos> select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
taos> select TRUNC(10.55, 3)
trunc(10.55, 3) |
============================
10.550000000000001 |
taos> select TRUNC(10.55, 2)
trunc(10.55, 2) |
============================
10.550000000000001 |
taos> select TRUNC(10.55, 1)
trunc(10.55, 1) |
============================
10.500000000000000 |
taos> select TRUNC(10.55, 0)
trunc(10.55, 0) |
============================
10.000000000000000 |
taos> select TRUNC(10.55, -1)
trunc(10.55, -1) |
============================
10.000000000000000 |
taos> select TRUNC(10.55, -10)
trunc(10.55, -10) |
============================
0.000000000000000 |
taos> select TRUNC(-10.55, 1)
trunc(-10.55, 1) |
============================
-10.500000000000000 |
taos> select TRUNC(99, 1)
trunc(99, 1) |
========================
99 |
taos> select TRUNC(10.55, 1) + 1
trunc(10.55, 1) + 1 |
============================
11.500000000000000 |
taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3)
trunc(trunc(trunc(trunc(trunc(trunc(trunc(123.123456789, 9), 8), |
===================================================================
1.231230000000000e+02 |
taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
trunc(trunc(trunc(trunc(trunc(trunc(trunc(123456789.123456789, - |
===================================================================
1.200000000000000e+08 |
taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10
trunc(87654321.123456789, id) |
================================
8.765432100000000e+07 |
8.765432109999999e+07 |
8.765432112000000e+07 |
8.765432112300000e+07 |
8.765432112340000e+07 |
8.765432112345000e+07 |
8.765432112345600e+07 |
8.765432112345670e+07 |
8.765432112345679e+07 |
8.765432112345679e+07 |
taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10
trunc(current, id) |
=======================
10.0000000 |
8.5000000 |
9.7900000 |
11.2329998 |
10.7060003 |
8.5080004 |
9.5959997 |
10.9619999 |
11.2259998 |
10.3369999 |
taos> select TRUNC(current, 1) from ts_4893.meters order by ts limit 10
trunc(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
taos> select truncate(99.99, 3)
truncate(99.99, 3) |
============================
99.989999999999995 |
taos> select truncate(99.99, 2)
truncate(99.99, 2) |
============================
99.989999999999995 |
taos> select truncate(99.99, 1)
truncate(99.99, 1) |
============================
99.900000000000006 |
taos> select truncate(99.99, 0)
truncate(99.99, 0) |
============================
99.000000000000000 |
taos> select truncate(99.99, -1)
truncate(99.99, -1) |
============================
90.000000000000000 |
taos> select truncate(99.99, -10)
truncate(99.99, -10) |
============================
0.000000000000000 |
taos> select truncate(99, 1)
truncate(99, 1) |
========================
99 |
taos> select truncate(current, 1) from ts_4893.d0 order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
taos> select truncate(current, 1) from ts_4893.meters order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
taos> select truncate(99.99, null)
truncate(99.99, null) |
============================
NULL |
taos> select truncate(null, 3)
truncate(null, 3) |
====================
NULL |
taos> select truncate(1.0001, 3)
truncate(1.0001, 3) |
============================
1.000000000000000 |
taos> select truncate(2.71828, 4)
truncate(2.71828, 4) |
============================
2.718200000000000 |
taos> select truncate(3.14159, 2)
truncate(3.14159, 2) |
============================
3.140000000000000 |
taos> select truncate(100.9876, 2)
truncate(100.9876, 2) |
============================
100.980000000000004 |
taos> select truncate(99999999999999.9999, 2)
truncate(99999999999999.9999, 2) |
===================================
1.000000000000000e+14 |
taos> select truncate(-5.678, 2)
truncate(-5.678, 2) |
============================
-5.670000000000000 |
taos> select truncate(voltage, 2) from ts_4893.meters limit 1
truncate(voltage, 2) |
=======================
221 |
taos> select truncate(current, 1) from ts_4893.meters limit 1
truncate(current, 1) |
=======================
10.6000004 |
taos> select truncate(phase, 3) from ts_4893.meters limit 1
truncate(phase, 3) |
=======================
0.5080000 |
taos> select truncate(voltage + current, 2) from ts_4893.meters limit 1
truncate(voltage + current, 2) |
=================================
2.316400000000000e+02 |
taos> select truncate(voltage, -1) from ts_4893.meters limit 1
truncate(voltage, -1) |
========================
220 |
taos> select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1
round(truncate(voltage, 1), 2) |
=================================
221 |
taos> select truncate(abs(current), 1) from ts_4893.meters limit 1
truncate(abs(current), 1) |
============================
1.0600000e+01 |
taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1
truncate(exp(phase), 2) |
============================
1.660000000000000 |
taos> select truncate(log(current), 1) from ts_4893.meters limit 1
truncate(log(current), 1) |
============================
2.300000000000000 |

1 10.550000000000001 taos> select TRUNCATE(10.55, 3)
2 10.550000000000001 truncate(10.55, 3) |
3 10.500000000000000 ============================
4 10.000000000000000 10.550000000000001 |
5 10.000000000000000 taos> select TRUNCATE(10.55, 2)
6 0.000000000000000 truncate(10.55, 2) |
7 -10.500000000000000 ============================
8 99 10.550000000000001 |
9 11.500000000000000 taos> select TRUNCATE(10.55, 1)
10 1.231230000000000e+02 truncate(10.55, 1) |
11 1.200000000000000e+08 ============================
12 8.765432100000000e+07 10.500000000000000 |
13 8.765432109999999e+07 taos> select TRUNCATE(10.55, 0)
14 8.765432112000000e+07 truncate(10.55, 0) |
15 8.765432112300000e+07 ============================
16 8.765432112340000e+07 10.000000000000000 |
17 8.765432112345000e+07 taos> select TRUNCATE(10.55, -1)
18 8.765432112345600e+07 truncate(10.55, -1) |
19 8.765432112345670e+07 ============================
20 8.765432112345679e+07 10.000000000000000 |
21 8.765432112345679e+07 taos> select TRUNCATE(10.55, -10)
22 10.0000000 truncate(10.55, -10) |
23 8.5000000 ============================
24 9.7900000 0.000000000000000 |
25 11.2329998 taos> select TRUNCATE(-10.55, 1)
26 10.7060003 truncate(-10.55, 1) |
27 8.5080004 ============================
28 9.5959997 -10.500000000000000 |
29 10.9619999 taos> select TRUNCATE(99, 1)
30 11.2259998 truncate(99, 1) |
31 10.3369999 ========================
32 10.6000004 99 |
33 8.5000000 taos> select TRUNCATE(10.55, 1) + 1
34 9.6999998 truncate(10.55, 1) + 1 |
35 11.1999998 ============================
36 10.6999998 11.500000000000000 |
37 8.5000000 taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3)
38 9.5000000 truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
39 10.8999996 ===================================================================
40 11.1999998 1.231230000000000e+02 |
41 10.3000002 taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
42 10.550000000000001 truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
43 10.550000000000001 ===================================================================
44 10.500000000000000 1.200000000000000e+08 |
45 10.000000000000000 taos> select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10
46 10.000000000000000 truncate(87654321.123456789, id) |
47 0.000000000000000 ===================================
48 -10.500000000000000 8.765432100000000e+07 |
49 99 8.765432109999999e+07 |
50 11.500000000000000 8.765432112000000e+07 |
51 1.231230000000000e+02 8.765432112300000e+07 |
52 1.200000000000000e+08 8.765432112340000e+07 |
53 8.765432100000000e+07 8.765432112345000e+07 |
54 8.765432109999999e+07 8.765432112345600e+07 |
55 8.765432112000000e+07 8.765432112345670e+07 |
56 8.765432112300000e+07 8.765432112345679e+07 |
57 8.765432112340000e+07 8.765432112345679e+07 |
58 8.765432112345000e+07 taos> select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10
59 8.765432112345600e+07 truncate(current, id) |
60 8.765432112345670e+07 ========================
61 8.765432112345679e+07 1.0000000e+01 |
62 8.765432112345679e+07 8.5000000e+00 |
63 10.0000000 9.7900000e+00 |
64 8.5000000 1.1233000e+01 |
65 9.7900000 1.0706000e+01 |
66 11.2329998 8.5080004e+00 |
67 10.7060003 9.5959997e+00 |
68 8.5080004 1.0962000e+01 |
69 9.5959997 1.1226000e+01 |
70 10.9619999 1.0337000e+01 |
71 11.2259998 taos> select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10
72 10.3369999 truncate(current, 1) |
73 10.6000004 =======================
74 8.5000000 10.6000004 |
75 9.6999998 8.5000000 |
76 11.1999998 9.6999998 |
77 10.6999998 11.1999998 |
78 8.5000000 10.6999998 |
79 9.5000000 8.5000000 |
80 10.8999996 9.5000000 |
81 11.1999998 10.8999996 |
82 10.3000002 11.1999998 |
83 99.99 10.3000002 |
84 99.99 taos> select TRUNC(10.55, 3)
85 99.9 trunc(10.55, 3) |
86 99 ============================
87 90 10.550000000000001 |
88 0 taos> select TRUNC(10.55, 2)
89 99 trunc(10.55, 2) |
90 10.6 ============================
91 8.5 10.550000000000001 |
92 9.7 taos> select TRUNC(10.55, 1)
93 11.2 trunc(10.55, 1) |
94 10.7 ============================
95 8.5 10.500000000000000 |
96 9.5 taos> select TRUNC(10.55, 0)
97 10.9 trunc(10.55, 0) |
98 11.2 ============================
99 10.3 10.000000000000000 |
100 10.6 taos> select TRUNC(10.55, -1)
101 8.5 trunc(10.55, -1) |
102 9.7 ============================
103 11.2 10.000000000000000 |
104 10.7 taos> select TRUNC(10.55, -10)
105 8.5 trunc(10.55, -10) |
106 9.5 ============================
107 10.9 0.000000000000000 |
108 11.2 taos> select TRUNC(-10.55, 1)
109 10.3 trunc(-10.55, 1) |
110 10.6 ============================
111 8.5 -10.500000000000000 |
112 9.7 taos> select TRUNC(99, 1)
113 11.2 trunc(99, 1) |
114 10.7 ========================
115 8.5 99 |
116 9.5 taos> select TRUNC(10.55, 1) + 1
117 10.9 trunc(10.55, 1) + 1 |
118 11.2 ============================
119 10.3 11.500000000000000 |
120 10.6 taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3)
121 8.5 trunc(trunc(trunc(trunc(trunc(trunc(trunc(123.123456789, 9), 8), |
122 9.7 ===================================================================
123 11.2 1.231230000000000e+02 |
124 10.7 taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
125 8.5 trunc(trunc(trunc(trunc(trunc(trunc(trunc(123456789.123456789, - |
126 9.5 ===================================================================
127 10.9 1.200000000000000e+08 |
128 11.2 taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10
129 10.3 trunc(87654321.123456789, id) |
130 ================================
131 8.765432100000000e+07 |
132 8.765432109999999e+07 |
133 8.765432112000000e+07 |
134 8.765432112300000e+07 |
135 8.765432112340000e+07 |
136 8.765432112345000e+07 |
137 8.765432112345600e+07 |
138 8.765432112345670e+07 |
139 8.765432112345679e+07 |
140 8.765432112345679e+07 |
141 taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10
142 trunc(current, id) |
143 =======================
144 10.0000000 |
145 8.5000000 |
146 9.7900000 |
147 11.2329998 |
148 10.7060003 |
149 8.5080004 |
150 9.5959997 |
151 10.9619999 |
152 11.2259998 |
153 10.3369999 |
154 taos> select TRUNC(current, 1) from ts_4893.meters order by ts limit 10
155 trunc(current, 1) |
156 =======================
157 10.6000004 |
158 8.5000000 |
159 9.6999998 |
160 11.1999998 |
161 10.6999998 |
162 8.5000000 |
163 9.5000000 |
164 10.8999996 |
165 11.1999998 |
166 10.3000002 |
167 taos> select truncate(99.99, 3)
168 truncate(99.99, 3) |
169 ============================
170 99.989999999999995 |
171 taos> select truncate(99.99, 2)
172 truncate(99.99, 2) |
173 ============================
174 99.989999999999995 |
175 taos> select truncate(99.99, 1)
176 truncate(99.99, 1) |
177 ============================
178 99.900000000000006 |
179 taos> select truncate(99.99, 0)
180 truncate(99.99, 0) |
181 ============================
182 99.000000000000000 |
183 taos> select truncate(99.99, -1)
184 truncate(99.99, -1) |
185 ============================
186 90.000000000000000 |
187 taos> select truncate(99.99, -10)
188 truncate(99.99, -10) |
189 ============================
190 0.000000000000000 |
191 taos> select truncate(99, 1)
192 truncate(99, 1) |
193 ========================
194 99 |
195 taos> select truncate(current, 1) from ts_4893.d0 order by ts limit 10
196 truncate(current, 1) |
197 =======================
198 10.6000004 |
199 8.5000000 |
200 9.6999998 |
201 11.1999998 |
202 10.6999998 |
203 8.5000000 |
204 9.5000000 |
205 10.8999996 |
206 11.1999998 |
207 10.3000002 |
208 taos> select truncate(current, 1) from ts_4893.meters order by ts limit 10
209 truncate(current, 1) |
210 =======================
211 10.6000004 |
212 8.5000000 |
213 9.6999998 |
214 11.1999998 |
215 10.6999998 |
216 8.5000000 |
217 9.5000000 |
218 10.8999996 |
219 11.1999998 |
220 10.3000002 |
221 taos> select truncate(99.99, null)
222 truncate(99.99, null) |
223 ============================
224 NULL |
225 taos> select truncate(null, 3)
226 truncate(null, 3) |
227 ====================
228 NULL |
229 taos> select truncate(1.0001, 3)
230 truncate(1.0001, 3) |
231 ============================
232 1.000000000000000 |
233 taos> select truncate(2.71828, 4)
234 truncate(2.71828, 4) |
235 ============================
236 2.718200000000000 |
237 taos> select truncate(3.14159, 2)
238 truncate(3.14159, 2) |
239 ============================
240 3.140000000000000 |
241 taos> select truncate(100.9876, 2)
242 truncate(100.9876, 2) |
243 ============================
244 100.980000000000004 |
245 taos> select truncate(99999999999999.9999, 2)
246 truncate(99999999999999.9999, 2) |
247 ===================================
248 1.000000000000000e+14 |
249 taos> select truncate(-5.678, 2)
250 truncate(-5.678, 2) |
251 ============================
252 -5.670000000000000 |
253 taos> select truncate(voltage, 2) from ts_4893.meters limit 1
254 truncate(voltage, 2) |
255 =======================
256 221 |
257 taos> select truncate(current, 1) from ts_4893.meters limit 1
258 truncate(current, 1) |
259 =======================
260 10.6000004 |
261 taos> select truncate(phase, 3) from ts_4893.meters limit 1
262 truncate(phase, 3) |
263 =======================
264 0.5080000 |
265 taos> select truncate(voltage + current, 2) from ts_4893.meters limit 1
266 truncate(voltage + current, 2) |
267 =================================
268 2.316400000000000e+02 |
269 taos> select truncate(voltage, -1) from ts_4893.meters limit 1
270 truncate(voltage, -1) |
271 ========================
272 220 |
273 taos> select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1
274 round(truncate(voltage, 1), 2) |
275 =================================
276 221 |
277 taos> select truncate(abs(current), 1) from ts_4893.meters limit 1
278 truncate(abs(current), 1) |
279 ============================
280 1.0600000e+01 |
281 taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1
282 truncate(exp(phase), 2) |
283 ============================
284 1.660000000000000 |
285 taos> select truncate(log(current), 1) from ts_4893.meters limit 1
286 truncate(log(current), 1) |
287 ============================
288 2.300000000000000 |
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343

View File

@ -1,37 +1,128 @@
1.332500071133753
0.702702307045610
0.703315838252072
0.705108647169672
0.705108647169672
0.706550935286583
0.713306900568867
0.716868311383919
0.717430738826275
0.717718552465788
0.719483293517451
8333333.250000000000000
21.250000000000000
70.000000000000000
70.000000000000000
70.000000000000000
70.000000000000000
65.250000000000000
70.000000000000000
70.000000000000000
70.000000000000000
70.000000000000000
8165850.000000000000000
21.250000000000000
30.000000000000000
65.250000000000000
65.250000000000000
65.250000000000000
65.250000000000000
65.250000000000000
65.250000000000000
65.250000000000000
65.250000000000000
8333333.250000000000000
8333333.250000000000000
1.332500071133751
1.332500071133751
taos> select VAR_POP(current) from ts_4893.meters
var_pop(current) |
============================
1.332500071133751 |
taos> select VAR_POP(current) from ts_4893.meters interval(1d) order by 1 limit 10
var_pop(current) |
============================
0.702702307045612 |
0.703315838252067 |
0.705108647169666 |
0.705108647169666 |
0.706550935286586 |
0.713306900568867 |
0.716868311383919 |
0.717430738826280 |
0.717718552465783 |
0.719483293517456 |
taos> select VAR_POP(id) from ts_4893.meters
var_pop(id) |
============================
8333333.250000000000000 |
taos> select VAR_POP(id) from ts_4893.meters interval(1d) limit 10
var_pop(id) |
============================
21.250000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
65.250000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
taos> select VAR_POP(id) from ts_4893.meters where id > 100
var_pop(id) |
============================
8165850.000000000000000 |
taos> select VAR_POP(id) from ts_4893.meters interval(1d) order by 1 limit 10
var_pop(id) |
============================
21.250000000000000 |
30.000000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
taos> select var_pop(null) from ts_4893.meters
var_pop(null) |
============================
NULL |
taos> select var_pop(id) from ts_4893.d0
var_pop(id) |
============================
8333333.250000000000000 |
taos> select var_pop(current) from ts_4893.d0
var_pop(current) |
============================
1.332500071133751 |
taos> select var_pop(voltage) from ts_4893.meters
var_pop(voltage) |
============================
8.274020439996093 |
taos> select var_pop(voltage) from ts_4893.meters where voltage is not null
var_pop(voltage) |
============================
8.274020439996093 |
taos> select var_pop(phase) from ts_4893.meters
var_pop(phase) |
============================
0.083287338468169 |
taos> select var_pop(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
var_pop(phase) |
============================
0.082987411872200 |
taos> select var_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
var_pop(total_voltage) |
============================
0.000000000000000 |
taos> select round(var_pop(current), 2) from ts_4893.meters
round(var_pop(current), 2) |
=============================
1.330000000000000e+00 |
taos> select pow(var_pop(current), 2) from ts_4893.meters
pow(var_pop(current), 2) |
============================
1.775556439571451 |
taos> select log(var_pop(voltage) + 1) from ts_4893.meters
log(var_pop(voltage) + 1) |
============================
2.227216989977633 |
taos> select groupid, var_pop(voltage) from ts_4893.meters group by groupid order by groupid
groupid | var_pop(voltage) |
======================================
1 | 8.274020439996093 |
taos> select location, var_pop(current) from ts_4893.meters group by location order by location
location | var_pop(current) |
=================================================
beijing | 1.332500071133751 |
taos> select location, var_pop(voltage) from ts_4893.meters group by location order by location
location | var_pop(voltage) |
=================================================
beijing | 8.274020439996093 |

Can't render this file because it has a wrong number of fields in line 99.

View File

@ -1,174 +1,565 @@
0
0
1
52
1
1
0
1
52
0
0
0
52
53
0
0
53
52
0
0
1
52
1
0
0
53
52
52
52
53
52
53
52
52
52
52
1
1
1
1
1
1
1
1
1
3
3
4
3
4
3
3
3
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
0
0
0
52
52
0
0
52
52
3
52
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
taos> select WEEK('2020-01-01 00:00:00')
week('2020-01-01 00:00:00') |
==============================
0 |
taos> select WEEK('2020-01-01 00:00:00', 0)
week('2020-01-01 00:00:00', 0) |
=================================
0 |
taos> select WEEK('2020-01-01 00:00:00', 1)
week('2020-01-01 00:00:00', 1) |
=================================
1 |
taos> select WEEK('2020-01-01 00:00:00', 2)
week('2020-01-01 00:00:00', 2) |
=================================
52 |
taos> select WEEK('2020-01-01 00:00:00', 3)
week('2020-01-01 00:00:00', 3) |
=================================
1 |
taos> select WEEK('2020-01-01 00:00:00', 4)
week('2020-01-01 00:00:00', 4) |
=================================
1 |
taos> select WEEK('2020-01-01 00:00:00', 5)
week('2020-01-01 00:00:00', 5) |
=================================
0 |
taos> select WEEK('2020-01-01 00:00:00', 6)
week('2020-01-01 00:00:00', 6) |
=================================
1 |
taos> select WEEK('2020-01-01 00:00:00', 7)
week('2020-01-01 00:00:00', 7) |
=================================
52 |
taos> select WEEK('2021-01-01 00:00:00')
week('2021-01-01 00:00:00') |
==============================
0 |
taos> select WEEK('2021-01-01 00:00:00', 0)
week('2021-01-01 00:00:00', 0) |
=================================
0 |
taos> select WEEK('2021-01-01 00:00:00', 1)
week('2021-01-01 00:00:00', 1) |
=================================
0 |
taos> select WEEK('2021-01-01 00:00:00', 2)
week('2021-01-01 00:00:00', 2) |
=================================
52 |
taos> select WEEK('2021-01-01 00:00:00', 3)
week('2021-01-01 00:00:00', 3) |
=================================
53 |
taos> select WEEK('2021-01-01 00:00:00', 4)
week('2021-01-01 00:00:00', 4) |
=================================
0 |
taos> select WEEK('2021-01-01 00:00:00', 5)
week('2021-01-01 00:00:00', 5) |
=================================
0 |
taos> select WEEK('2021-01-01 00:00:00', 6)
week('2021-01-01 00:00:00', 6) |
=================================
53 |
taos> select WEEK('2021-01-01 00:00:00', 7)
week('2021-01-01 00:00:00', 7) |
=================================
52 |
taos> select WEEK('1998-01-01 00:00:00')
week('1998-01-01 00:00:00') |
==============================
0 |
taos> select WEEK('1998-01-01 00:00:00', 0)
week('1998-01-01 00:00:00', 0) |
=================================
0 |
taos> select WEEK('1998-01-01 00:00:00', 1)
week('1998-01-01 00:00:00', 1) |
=================================
1 |
taos> select WEEK('1998-01-01 00:00:00', 2)
week('1998-01-01 00:00:00', 2) |
=================================
52 |
taos> select WEEK('1998-01-01 00:00:00', 3)
week('1998-01-01 00:00:00', 3) |
=================================
1 |
taos> select WEEK('1998-01-01 00:00:00', 4)
week('1998-01-01 00:00:00', 4) |
=================================
0 |
taos> select WEEK('1998-01-01 00:00:00', 5)
week('1998-01-01 00:00:00', 5) |
=================================
0 |
taos> select WEEK('1998-01-01 00:00:00', 6)
week('1998-01-01 00:00:00', 6) |
=================================
53 |
taos> select WEEK('1998-01-01 00:00:00', 7)
week('1998-01-01 00:00:00', 7) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00')
week('1998-12-31 00:00:00') |
==============================
52 |
taos> select WEEK('1998-12-31 00:00:00', 0)
week('1998-12-31 00:00:00', 0) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00', 1)
week('1998-12-31 00:00:00', 1) |
=================================
53 |
taos> select WEEK('1998-12-31 00:00:00', 2)
week('1998-12-31 00:00:00', 2) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00', 3)
week('1998-12-31 00:00:00', 3) |
=================================
53 |
taos> select WEEK('1998-12-31 00:00:00', 4)
week('1998-12-31 00:00:00', 4) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00', 5)
week('1998-12-31 00:00:00', 5) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00', 6)
week('1998-12-31 00:00:00', 6) |
=================================
52 |
taos> select WEEK('1998-12-31 00:00:00', 7)
week('1998-12-31 00:00:00', 7) |
=================================
52 |
taos> select WEEK('2000-01-06 00:00:00')
week('2000-01-06 00:00:00') |
==============================
1 |
taos> select WEEK('2000-01-06 00:00:00', 0)
week('2000-01-06 00:00:00', 0) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 1)
week('2000-01-06 00:00:00', 1) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 2)
week('2000-01-06 00:00:00', 2) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 3)
week('2000-01-06 00:00:00', 3) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 4)
week('2000-01-06 00:00:00', 4) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 5)
week('2000-01-06 00:00:00', 5) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 6)
week('2000-01-06 00:00:00', 6) |
=================================
1 |
taos> select WEEK('2000-01-06 00:00:00', 7)
week('2000-01-06 00:00:00', 7) |
=================================
1 |
taos> select WEEK(1725095657)
week(1725095657) |
========================
3 |
taos> select WEEK(1725095657, 0)
week(1725095657, 0) |
========================
3 |
taos> select WEEK(1725095657, 1)
week(1725095657, 1) |
========================
4 |
taos> select WEEK(1725095657, 2)
week(1725095657, 2) |
========================
3 |
taos> select WEEK(1725095657, 3)
week(1725095657, 3) |
========================
4 |
taos> select WEEK(1725095657, 4)
week(1725095657, 4) |
========================
3 |
taos> select WEEK(1725095657, 5)
week(1725095657, 5) |
========================
3 |
taos> select WEEK(1725095657, 6)
week(1725095657, 6) |
========================
3 |
taos> select WEEK(ts) from ts_4893.meters order by ts limit 10
week(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 0) from ts_4893.meters order by ts limit 10
week(ts, 0) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 1) from ts_4893.meters order by ts limit 10
week(ts, 1) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 2) from ts_4893.meters order by ts limit 10
week(ts, 2) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 3) from ts_4893.meters order by ts limit 10
week(ts, 3) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 4) from ts_4893.meters order by ts limit 10
week(ts, 4) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 5) from ts_4893.meters order by ts limit 10
week(ts, 5) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 6) from ts_4893.meters order by ts limit 10
week(ts, 6) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select WEEK(ts, 7) from ts_4893.meters order by ts limit 10
week(ts, 7) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select week(123)
week(123) |
========================
0 |
taos> select week('2000-01-01',0)
week('2000-01-01',0) |
========================
0 |
taos> select week('2000-01-01',1)
week('2000-01-01',1) |
========================
0 |
taos> select week('2000-01-01',2)
week('2000-01-01',2) |
========================
52 |
taos> select week('2000-01-01',3)
week('2000-01-01',3) |
========================
52 |
taos> select week('2000-01-01',4)
week('2000-01-01',4) |
========================
0 |
taos> select week('2000-01-01',5)
week('2000-01-01',5) |
========================
0 |
taos> select week('2000-01-01',6)
week('2000-01-01',6) |
========================
52 |
taos> select week('2000-01-01',7)
week('2000-01-01',7) |
========================
52 |
taos> select week(1721020591,0)
week(1721020591,0) |
========================
3 |
taos> select week('2020-01-01 00:00:00', 2)
week('2020-01-01 00:00:00', 2) |
=================================
52 |
taos> select week(ts) from ts_4893.d0 order by ts limit 10
week(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select week(ts) from ts_4893.meters order by ts limit 10
week(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select week(null, 0)
week(null, 0) |
========================
NULL |
taos> select week('abc')
week('abc') |
========================
NULL |
taos> select week('1721020591', 0)
week('1721020591', 0) |
========================
NULL |
taos> select week('1721020666229', 0)
week('1721020666229', 0) |
===========================
NULL |
taos> select week('20200101', 2)
week('20200101', 2) |
========================
NULL |
taos> select week('11/01/31', 2)
week('11/01/31', 2) |
========================
NULL |
taos> select week('20/01/01', 2)
week('20/01/01', 2) |
========================
NULL |
taos> select week('01/01/2020', 2)
week('01/01/2020', 2) |
========================
NULL |
taos> select week('01-JAN-20', 2)
week('01-JAN-20', 2) |
========================
NULL |
taos> select week('2023-09-25')
week('2023-09-25') |
========================
39 |
taos> select week('9999-12-31')
week('9999-12-31') |
========================
52 |
taos> select week('2024-02-29 00:00:00')
week('2024-02-29 00:00:00') |
==============================
8 |
taos> select week(ts) from ts_4893.meters limit 1
week(ts) |
========================
28 |
taos> select week(name) from ts_4893.meters limit 1
week(name) |
========================
NULL |
taos> select week(ts), dayofweek(ts) from ts_4893.meters limit 1
week(ts) | dayofweek(ts) |
================================================
28 | 6 |
taos> select week(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
week(timediff(ts, '2024-10-10 09:36:50.172')) |
================================================
39 |
taos> select id, week(ts) from ts_4893.meters where id = 1 limit 1
id | week(ts) |
======================================
1 | 28 |
taos> select groupid, sum(week(ts)) from ts_4893.meters group by groupid order by groupid
groupid | sum(week(ts)) |
==================================
1 | 2669490 |

1 0 taos> select WEEK('2020-01-01 00:00:00')
2 0 week('2020-01-01 00:00:00') |
3 1 ==============================
4 52 0 |
5 1 taos> select WEEK('2020-01-01 00:00:00', 0)
6 1 week('2020-01-01 00:00:00', 0) |
7 0 =================================
8 1 0 |
9 52 taos> select WEEK('2020-01-01 00:00:00', 1)
10 0 week('2020-01-01 00:00:00', 1) |
11 0 =================================
12 0 1 |
13 52 taos> select WEEK('2020-01-01 00:00:00', 2)
14 53 week('2020-01-01 00:00:00', 2) |
15 0 =================================
16 0 52 |
17 53 taos> select WEEK('2020-01-01 00:00:00', 3)
18 52 week('2020-01-01 00:00:00', 3) |
19 0 =================================
20 0 1 |
21 1 taos> select WEEK('2020-01-01 00:00:00', 4)
22 52 week('2020-01-01 00:00:00', 4) |
23 1 =================================
24 0 1 |
25 0 taos> select WEEK('2020-01-01 00:00:00', 5)
26 53 week('2020-01-01 00:00:00', 5) |
27 52 =================================
28 52 0 |
29 52 taos> select WEEK('2020-01-01 00:00:00', 6)
30 53 week('2020-01-01 00:00:00', 6) |
31 52 =================================
32 53 1 |
33 52 taos> select WEEK('2020-01-01 00:00:00', 7)
34 52 week('2020-01-01 00:00:00', 7) |
35 52 =================================
36 52 52 |
37 1 taos> select WEEK('2021-01-01 00:00:00')
38 1 week('2021-01-01 00:00:00') |
39 1 ==============================
40 1 0 |
41 1 taos> select WEEK('2021-01-01 00:00:00', 0)
42 1 week('2021-01-01 00:00:00', 0) |
43 1 =================================
44 1 0 |
45 1 taos> select WEEK('2021-01-01 00:00:00', 1)
46 3 week('2021-01-01 00:00:00', 1) |
47 3 =================================
48 4 0 |
49 3 taos> select WEEK('2021-01-01 00:00:00', 2)
50 4 week('2021-01-01 00:00:00', 2) |
51 3 =================================
52 3 52 |
53 3 taos> select WEEK('2021-01-01 00:00:00', 3)
54 28 week('2021-01-01 00:00:00', 3) |
55 28 =================================
56 28 53 |
57 28 taos> select WEEK('2021-01-01 00:00:00', 4)
58 28 week('2021-01-01 00:00:00', 4) |
59 28 =================================
60 28 0 |
61 28 taos> select WEEK('2021-01-01 00:00:00', 5)
62 28 week('2021-01-01 00:00:00', 5) |
63 28 =================================
64 28 0 |
65 28 taos> select WEEK('2021-01-01 00:00:00', 6)
66 28 week('2021-01-01 00:00:00', 6) |
67 28 =================================
68 28 53 |
69 28 taos> select WEEK('2021-01-01 00:00:00', 7)
70 28 week('2021-01-01 00:00:00', 7) |
71 28 =================================
72 28 52 |
73 28 taos> select WEEK('1998-01-01 00:00:00')
74 28 week('1998-01-01 00:00:00') |
75 28 ==============================
76 28 0 |
77 28 taos> select WEEK('1998-01-01 00:00:00', 0)
78 28 week('1998-01-01 00:00:00', 0) |
79 28 =================================
80 28 0 |
81 28 taos> select WEEK('1998-01-01 00:00:00', 1)
82 28 week('1998-01-01 00:00:00', 1) |
83 28 =================================
84 28 1 |
85 28 taos> select WEEK('1998-01-01 00:00:00', 2)
86 28 week('1998-01-01 00:00:00', 2) |
87 28 =================================
88 28 52 |
89 28 taos> select WEEK('1998-01-01 00:00:00', 3)
90 28 week('1998-01-01 00:00:00', 3) |
91 28 =================================
92 28 1 |
93 28 taos> select WEEK('1998-01-01 00:00:00', 4)
94 28 week('1998-01-01 00:00:00', 4) |
95 28 =================================
96 28 0 |
97 28 taos> select WEEK('1998-01-01 00:00:00', 5)
98 28 week('1998-01-01 00:00:00', 5) |
99 28 =================================
100 28 0 |
101 28 taos> select WEEK('1998-01-01 00:00:00', 6)
102 28 week('1998-01-01 00:00:00', 6) |
103 28 =================================
104 28 53 |
105 28 taos> select WEEK('1998-01-01 00:00:00', 7)
106 28 week('1998-01-01 00:00:00', 7) |
107 28 =================================
108 28 52 |
109 28 taos> select WEEK('1998-12-31 00:00:00')
110 28 week('1998-12-31 00:00:00') |
111 28 ==============================
112 28 52 |
113 28 taos> select WEEK('1998-12-31 00:00:00', 0)
114 28 week('1998-12-31 00:00:00', 0) |
115 28 =================================
116 28 52 |
117 28 taos> select WEEK('1998-12-31 00:00:00', 1)
118 28 week('1998-12-31 00:00:00', 1) |
119 28 =================================
120 28 53 |
121 28 taos> select WEEK('1998-12-31 00:00:00', 2)
122 28 week('1998-12-31 00:00:00', 2) |
123 28 =================================
124 28 52 |
125 28 taos> select WEEK('1998-12-31 00:00:00', 3)
126 28 week('1998-12-31 00:00:00', 3) |
127 28 =================================
128 28 53 |
129 28 taos> select WEEK('1998-12-31 00:00:00', 4)
130 28 week('1998-12-31 00:00:00', 4) |
131 28 =================================
132 28 52 |
133 28 taos> select WEEK('1998-12-31 00:00:00', 5)
134 28 week('1998-12-31 00:00:00', 5) |
135 28 =================================
136 28 52 |
137 28 taos> select WEEK('1998-12-31 00:00:00', 6)
138 28 week('1998-12-31 00:00:00', 6) |
139 28 =================================
140 28 52 |
141 28 taos> select WEEK('1998-12-31 00:00:00', 7)
142 28 week('1998-12-31 00:00:00', 7) |
143 28 =================================
144 0 52 |
145 0 taos> select WEEK('2000-01-06 00:00:00')
146 0 week('2000-01-06 00:00:00') |
147 52 ==============================
148 52 1 |
149 0 taos> select WEEK('2000-01-06 00:00:00', 0)
150 0 week('2000-01-06 00:00:00', 0) |
151 52 =================================
152 52 1 |
153 3 taos> select WEEK('2000-01-06 00:00:00', 1)
154 52 week('2000-01-06 00:00:00', 1) |
155 28 =================================
156 28 1 |
157 28 taos> select WEEK('2000-01-06 00:00:00', 2)
158 28 week('2000-01-06 00:00:00', 2) |
159 28 =================================
160 28 1 |
161 28 taos> select WEEK('2000-01-06 00:00:00', 3)
162 28 week('2000-01-06 00:00:00', 3) |
163 28 =================================
164 28 1 |
165 28 taos> select WEEK('2000-01-06 00:00:00', 4)
166 28 week('2000-01-06 00:00:00', 4) |
167 28 =================================
168 28 1 |
169 28 taos> select WEEK('2000-01-06 00:00:00', 5)
170 28 week('2000-01-06 00:00:00', 5) |
171 28 =================================
172 28 1 |
173 28 taos> select WEEK('2000-01-06 00:00:00', 6)
174 28 week('2000-01-06 00:00:00', 6) |
175 =================================
176 1 |
177 taos> select WEEK('2000-01-06 00:00:00', 7)
178 week('2000-01-06 00:00:00', 7) |
179 =================================
180 1 |
181 taos> select WEEK(1725095657)
182 week(1725095657) |
183 ========================
184 3 |
185 taos> select WEEK(1725095657, 0)
186 week(1725095657, 0) |
187 ========================
188 3 |
189 taos> select WEEK(1725095657, 1)
190 week(1725095657, 1) |
191 ========================
192 4 |
193 taos> select WEEK(1725095657, 2)
194 week(1725095657, 2) |
195 ========================
196 3 |
197 taos> select WEEK(1725095657, 3)
198 week(1725095657, 3) |
199 ========================
200 4 |
201 taos> select WEEK(1725095657, 4)
202 week(1725095657, 4) |
203 ========================
204 3 |
205 taos> select WEEK(1725095657, 5)
206 week(1725095657, 5) |
207 ========================
208 3 |
209 taos> select WEEK(1725095657, 6)
210 week(1725095657, 6) |
211 ========================
212 3 |
213 taos> select WEEK(ts) from ts_4893.meters order by ts limit 10
214 week(ts) |
215 ========================
216 28 |
217 28 |
218 28 |
219 28 |
220 28 |
221 28 |
222 28 |
223 28 |
224 28 |
225 28 |
226 taos> select WEEK(ts, 0) from ts_4893.meters order by ts limit 10
227 week(ts, 0) |
228 ========================
229 28 |
230 28 |
231 28 |
232 28 |
233 28 |
234 28 |
235 28 |
236 28 |
237 28 |
238 28 |
239 taos> select WEEK(ts, 1) from ts_4893.meters order by ts limit 10
240 week(ts, 1) |
241 ========================
242 28 |
243 28 |
244 28 |
245 28 |
246 28 |
247 28 |
248 28 |
249 28 |
250 28 |
251 28 |
252 taos> select WEEK(ts, 2) from ts_4893.meters order by ts limit 10
253 week(ts, 2) |
254 ========================
255 28 |
256 28 |
257 28 |
258 28 |
259 28 |
260 28 |
261 28 |
262 28 |
263 28 |
264 28 |
265 taos> select WEEK(ts, 3) from ts_4893.meters order by ts limit 10
266 week(ts, 3) |
267 ========================
268 28 |
269 28 |
270 28 |
271 28 |
272 28 |
273 28 |
274 28 |
275 28 |
276 28 |
277 28 |
278 taos> select WEEK(ts, 4) from ts_4893.meters order by ts limit 10
279 week(ts, 4) |
280 ========================
281 28 |
282 28 |
283 28 |
284 28 |
285 28 |
286 28 |
287 28 |
288 28 |
289 28 |
290 28 |
291 taos> select WEEK(ts, 5) from ts_4893.meters order by ts limit 10
292 week(ts, 5) |
293 ========================
294 28 |
295 28 |
296 28 |
297 28 |
298 28 |
299 28 |
300 28 |
301 28 |
302 28 |
303 28 |
304 taos> select WEEK(ts, 6) from ts_4893.meters order by ts limit 10
305 week(ts, 6) |
306 ========================
307 28 |
308 28 |
309 28 |
310 28 |
311 28 |
312 28 |
313 28 |
314 28 |
315 28 |
316 28 |
317 taos> select WEEK(ts, 7) from ts_4893.meters order by ts limit 10
318 week(ts, 7) |
319 ========================
320 28 |
321 28 |
322 28 |
323 28 |
324 28 |
325 28 |
326 28 |
327 28 |
328 28 |
329 28 |
330 taos> select week(123)
331 week(123) |
332 ========================
333 0 |
334 taos> select week('2000-01-01',0)
335 week('2000-01-01',0) |
336 ========================
337 0 |
338 taos> select week('2000-01-01',1)
339 week('2000-01-01',1) |
340 ========================
341 0 |
342 taos> select week('2000-01-01',2)
343 week('2000-01-01',2) |
344 ========================
345 52 |
346 taos> select week('2000-01-01',3)
347 week('2000-01-01',3) |
348 ========================
349 52 |
350 taos> select week('2000-01-01',4)
351 week('2000-01-01',4) |
352 ========================
353 0 |
354 taos> select week('2000-01-01',5)
355 week('2000-01-01',5) |
356 ========================
357 0 |
358 taos> select week('2000-01-01',6)
359 week('2000-01-01',6) |
360 ========================
361 52 |
362 taos> select week('2000-01-01',7)
363 week('2000-01-01',7) |
364 ========================
365 52 |
366 taos> select week(1721020591,0)
367 week(1721020591,0) |
368 ========================
369 3 |
370 taos> select week('2020-01-01 00:00:00', 2)
371 week('2020-01-01 00:00:00', 2) |
372 =================================
373 52 |
374 taos> select week(ts) from ts_4893.d0 order by ts limit 10
375 week(ts) |
376 ========================
377 28 |
378 28 |
379 28 |
380 28 |
381 28 |
382 28 |
383 28 |
384 28 |
385 28 |
386 28 |
387 taos> select week(ts) from ts_4893.meters order by ts limit 10
388 week(ts) |
389 ========================
390 28 |
391 28 |
392 28 |
393 28 |
394 28 |
395 28 |
396 28 |
397 28 |
398 28 |
399 28 |
400 taos> select week(null, 0)
401 week(null, 0) |
402 ========================
403 NULL |
404 taos> select week('abc')
405 week('abc') |
406 ========================
407 NULL |
408 taos> select week('1721020591', 0)
409 week('1721020591', 0) |
410 ========================
411 NULL |
412 taos> select week('1721020666229', 0)
413 week('1721020666229', 0) |
414 ===========================
415 NULL |
416 taos> select week('20200101', 2)
417 week('20200101', 2) |
418 ========================
419 NULL |
420 taos> select week('11/01/31', 2)
421 week('11/01/31', 2) |
422 ========================
423 NULL |
424 taos> select week('20/01/01', 2)
425 week('20/01/01', 2) |
426 ========================
427 NULL |
428 taos> select week('01/01/2020', 2)
429 week('01/01/2020', 2) |
430 ========================
431 NULL |
432 taos> select week('01-JAN-20', 2)
433 week('01-JAN-20', 2) |
434 ========================
435 NULL |
436 taos> select week('2023-09-25')
437 week('2023-09-25') |
438 ========================
439 39 |
440 taos> select week('9999-12-31')
441 week('9999-12-31') |
442 ========================
443 52 |
444 taos> select week('2024-02-29 00:00:00')
445 week('2024-02-29 00:00:00') |
446 ==============================
447 8 |
448 taos> select week(ts) from ts_4893.meters limit 1
449 week(ts) |
450 ========================
451 28 |
452 taos> select week(name) from ts_4893.meters limit 1
453 week(name) |
454 ========================
455 NULL |
456 taos> select week(ts), dayofweek(ts) from ts_4893.meters limit 1
457 week(ts) | dayofweek(ts) |
458 ================================================
459 28 | 6 |
460 taos> select week(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
461 week(timediff(ts, '2024-10-10 09:36:50.172')) |
462 ================================================
463 39 |
464 taos> select id, week(ts) from ts_4893.meters where id = 1 limit 1
465 id | week(ts) |
466 ======================================
467 1 | 28 |
468 taos> select groupid, sum(week(ts)) from ts_4893.meters group by groupid order by groupid
469 groupid | sum(week(ts)) |
470 ==================================
471 1 | 2669490 |
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565

View File

@ -1,100 +1,272 @@
2
2
2
2
2
2
2
2
2
2
2
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
4
4
4
4
4
4
4
4
4
4
2
2
0
2
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
taos> select WEEKDAY('2020-01-01 00:00:00')
weekday('2020-01-01 00:00:00') |
=================================
2 |
taos> select WEEKDAY('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekday('2020-01-01 00:00:00') |
=================================
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
taos> select WEEKDAY('2021-01-01 00:00:00')
weekday('2021-01-01 00:00:00') |
=================================
4 |
taos> select WEEKDAY('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekday('2021-01-01 00:00:00') |
=================================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select WEEKDAY('1998-01-01 00:00:00')
weekday('1998-01-01 00:00:00') |
=================================
3 |
taos> select WEEKDAY('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekday('1998-01-01 00:00:00') |
=================================
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
taos> select WEEKDAY('1998-12-31 00:00:00')
weekday('1998-12-31 00:00:00') |
=================================
3 |
taos> select WEEKDAY('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
weekday('1998-12-31 00:00:00') |
=================================
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
taos> select WEEKDAY('2000-01-06 00:00:00')
weekday('2000-01-06 00:00:00') |
=================================
3 |
taos> select WEEKDAY('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
weekday('2000-01-06 00:00:00') |
=================================
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
taos> select WEEKDAY(1725095657)
weekday(1725095657) |
========================
2 |
taos> select WEEKDAY(1725095657) from ts_4893.meters order by ts limit 10
weekday(1725095657) |
========================
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
taos> select WEEKDAY(ts) from ts_4893.meters order by ts limit 10
weekday(ts) |
========================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select weekday('2020-01-01')
weekday('2020-01-01') |
========================
2 |
taos> select weekday(1721020591)
weekday(1721020591) |
========================
2 |
taos> select weekday(1721020666229)
weekday(1721020666229) |
=========================
0 |
taos> select weekday('2020-01-01 00:00:00')
weekday('2020-01-01 00:00:00') |
=================================
2 |
taos> select weekday(ts) from ts_4893.d0 order by ts limit 10
weekday(ts) |
========================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select weekday(ts) from ts_4893.meters order by ts limit 10
weekday(ts) |
========================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select weekday(null)
weekday(null) |
========================
NULL |
taos> select weekday('abc')
weekday('abc') |
========================
NULL |
taos> select weekday('1721020591')
weekday('1721020591') |
========================
NULL |
taos> select weekday('1721020666229')
weekday('1721020666229') |
===========================
NULL |
taos> select weekday('01/01/2020')
weekday('01/01/2020') |
========================
NULL |
taos> select weekday('20200101')
weekday('20200101') |
========================
NULL |
taos> select weekday('20/01/01')
weekday('20/01/01') |
========================
NULL |
taos> select weekday('11/01/32')
weekday('11/01/32') |
========================
NULL |
taos> select weekday('01-JAN-20')
weekday('01-JAN-20') |
========================
NULL |
taos> select weekday('2024-02-29')
weekday('2024-02-29') |
========================
3 |
taos> select weekday('2023-09-24')
weekday('2023-09-24') |
========================
6 |
taos> select weekday('2023-09-25')
weekday('2023-09-25') |
========================
0 |
taos> select weekday('9999-12-31')
weekday('9999-12-31') |
========================
4 |
taos> select weekday(name) from ts_4893.meters limit 1
weekday(name) |
========================
NULL |
taos> select weekday(ts), dayofweek(ts) from ts_4893.meters limit 1
weekday(ts) | dayofweek(ts) |
================================================
4 | 6 |
taos> select weekday(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
weekday(timediff(ts, '2024-10-10 09:36:50.172')) |
===================================================
4 |
taos> select weekday(ts) from ts_4893.meters limit 1
weekday(ts) |
========================
4 |
taos> select id, weekday(ts) from ts_4893.meters where id = 1 limit 1
id | weekday(ts) |
======================================
1 | 4 |
taos> select groupid, sum(weekday(ts)) from ts_4893.meters group by groupid order by groupid
groupid | sum(weekday(ts)) |
==================================
1 | 300007 |

Can't render this file because it has a wrong number of fields in line 248.

View File

@ -1,99 +1,267 @@
1
1
1
1
1
1
1
1
1
1
1
53
53
53
53
53
53
53
53
53
53
53
1
1
1
1
1
1
1
1
1
1
1
53
53
53
53
53
53
53
53
53
53
53
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
4
4
4
4
4
4
4
28
28
28
28
28
28
28
28
28
28
1
4
29
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
28
taos> select WEEKOFYEAR('2020-01-01 00:00:00')
weekofyear('2020-01-01 00:00:00') |
====================================
1 |
taos> select WEEKOFYEAR('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekofyear('2020-01-01 00:00:00') |
====================================
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
taos> select WEEKOFYEAR('2021-01-01 00:00:00')
weekofyear('2021-01-01 00:00:00') |
====================================
53 |
taos> select WEEKOFYEAR('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekofyear('2021-01-01 00:00:00') |
====================================
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
taos> select WEEKOFYEAR('1998-01-01 00:00:00')
weekofyear('1998-01-01 00:00:00') |
====================================
1 |
taos> select WEEKOFYEAR('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
weekofyear('1998-01-01 00:00:00') |
====================================
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
taos> select WEEKOFYEAR('1998-12-31 00:00:00')
weekofyear('1998-12-31 00:00:00') |
====================================
53 |
taos> select WEEKOFYEAR('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
weekofyear('1998-12-31 00:00:00') |
====================================
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
53 |
taos> select WEEKOFYEAR('2000-01-06 00:00:00')
weekofyear('2000-01-06 00:00:00') |
====================================
1 |
taos> select WEEKOFYEAR('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
weekofyear('2000-01-06 00:00:00') |
====================================
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
taos> select WEEKOFYEAR(1725095657)
weekofyear(1725095657) |
=========================
4 |
taos> select WEEKOFYEAR(1725095657) from ts_4893.meters order by ts limit 10
weekofyear(1725095657) |
=========================
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
taos> select WEEKOFYEAR(ts) from ts_4893.meters order by ts limit 10
weekofyear(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select weekofyear('2020-01-01')
weekofyear('2020-01-01') |
===========================
1 |
taos> select weekofyear(1721020666)
weekofyear(1721020666) |
=========================
4 |
taos> select weekofyear(1721020666229)
weekofyear(1721020666229) |
============================
29 |
taos> select weekofyear(ts) from ts_4893.d0 order by ts limit 10
weekofyear(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select weekofyear(ts) from ts_4893.meters order by ts limit 10
weekofyear(ts) |
========================
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
28 |
taos> select weekofyear(null)
weekofyear(null) |
========================
NULL |
taos> select weekofyear('1721020591')
weekofyear('1721020591') |
===========================
NULL |
taos> select weekofyear('1721020666229')
weekofyear('1721020666229') |
==============================
NULL |
taos> select weekofyear('abc')
weekofyear('abc') |
========================
NULL |
taos> select weekofyear('01/01/2020')
weekofyear('01/01/2020') |
===========================
NULL |
taos> select weekofyear('20200101')
weekofyear('20200101') |
=========================
NULL |
taos> select weekofyear('20/01/01')
weekofyear('20/01/01') |
=========================
NULL |
taos> select weekofyear('11/01/31')
weekofyear('11/01/31') |
=========================
NULL |
taos> select weekofyear('01-JAN-20')
weekofyear('01-JAN-20') |
==========================
NULL |
taos> select weekofyear('2024-02-29')
weekofyear('2024-02-29') |
===========================
9 |
taos> select weekofyear('2024-01-01')
weekofyear('2024-01-01') |
===========================
1 |
taos> select weekofyear('2024-12-31')
weekofyear('2024-12-31') |
===========================
1 |
taos> select weekofyear('9999-12-31')
weekofyear('9999-12-31') |
===========================
52 |
taos> select weekofyear(name) from ts_4893.meters limit 1
weekofyear(name) |
========================
NULL |
taos> select weekofyear(ts) from ts_4893.meters limit 1
weekofyear(ts) |
========================
28 |
taos> select weekofyear(ts), dayofweek(ts) from ts_4893.meters limit 1
weekofyear(ts) | dayofweek(ts) |
================================================
28 | 6 |
taos> select weekofyear(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
weekofyear(timediff(ts, '2024-10-10 09:36:50.172')) |
======================================================
40 |
taos> select id, weekofyear(ts) from ts_4893.meters where id = 1 limit 1
id | weekofyear(ts) |
======================================
1 | 28 |
taos> select groupid, sum(weekofyear(ts)) from ts_4893.meters group by groupid order by groupid
groupid | sum(weekofyear(ts)) |
==================================
1 | 2720120 |

Can't render this file because it has a wrong number of fields in line 248.

View File

@ -1,26 +1,43 @@
select ASCII('hello');
select ASCII('hello world');
select ASCII('hello world!');
select ASCII('hello,world.你好,世界。');
select ASCII('北京涛思数据科技有限公司');
select ASCII('hello') + 1;
select ASCII('hello') - 1;
select ASCII('hello') from ts_4893.meters limit 5;
select ASCII('hello') + 1 from ts_4893.meters limit 1;
select ASCII('hello') + ASCII('hello') from ts_4893.meters limit 1;
select ASCII(nch1) from ts_4893.meters order by ts limit 5;
select ASCII(var1) from ts_4893.meters order by ts limit 5;
select ASCII(concat(nch1,var1)) from ts_4893.meters order by ts limit 5;
select ASCII(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5;
select pow(ASCII(nch1), 2) from ts_4893.meters order by ts limit 5;
select sqrt(ASCII(nch1)) from ts_4893.meters order by ts limit 5;
select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5;
select ascii('taos');
select ascii('t');
select ascii('\'');
select ascii(name) from ts_4893.d0 order by ts limit 10;
select ascii(name) from ts_4893.meters order by ts limit 10;
select ascii(nch1) from ts_4893.d0 order by ts limit 10;
select ascii(nch1) from ts_4893.meters order by ts limit 10;
select ascii(var1) from ts_4893.d0 order by ts limit 10;
select ascii(var1) from ts_4893.meters order by ts limit 10;
select ASCII('hello')
select ASCII('hello world')
select ASCII('hello world!')
select ASCII('hello,world.你好,世界。')
select ASCII('北京涛思数据科技有限公司')
select ASCII('hello') + 1
select ASCII('hello') - 1
select ASCII('hello') from ts_4893.meters limit 5
select ASCII('hello') + 1 from ts_4893.meters limit 1
select ASCII('hello') + ASCII('hello') from ts_4893.meters limit 1
select ASCII(nch1) from ts_4893.meters order by ts limit 5
select ASCII(var1) from ts_4893.meters order by ts limit 5
select ASCII(concat(nch1,var1)) from ts_4893.meters order by ts limit 5
select ASCII(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5
select pow(ASCII(nch1), 2) from ts_4893.meters order by ts limit 5
select sqrt(ASCII(nch1)) from ts_4893.meters order by ts limit 5
select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5
select ascii('taos')
select ascii('t')
select ascii('\'')
select ascii(name) from ts_4893.d0 order by ts limit 10
select ascii(name) from ts_4893.meters order by ts limit 10
select ascii(nch1) from ts_4893.d0 order by ts limit 10
select ascii(nch1) from ts_4893.meters order by ts limit 10
select ascii(var1) from ts_4893.d0 order by ts limit 10
select ascii(var1) from ts_4893.meters order by ts limit 10
select ascii(null)
select ascii('0')
select ascii(' ')
select ascii('~')
select ascii('中')
select ascii('é')
select ascii('!@#')
select ascii('Hello')
select ascii('123abc')
select ascii(concat('A', 'B'))
select ascii(char(65))
select ascii(upper('b'))
select ascii(trim(' A '))
select name, ascii(name) from ts_4893.meters limit 1
select name, ascii(substring(name, 1, 1)) from ts_4893.meters limit 1
select nch1, ascii(nch1) from ts_4893.meters limit 1
select var1, ascii(var1) from ts_4893.meters limit 1

View File

@ -1,15 +1,20 @@
select CHAR(77);
select CHAR(77.5);
select CHAR(100);
select CHAR(77) from ts_4893.meters limit 5;
select CHAR(77,78,79,80,81) from ts_4893.meters limit 5;
select CHAR(77*256+77) from ts_4893.meters limit 5;
select concat(CHAR(77),CHAR(78)) from ts_4893.meters limit 5;
select cast(CHAR(49) as int);
select CHAR(id + 77) from ts_4893.meters order by ts limit 5;;
select CONCAT(CHAR(id + 77),CHAR(id + 77),CHAR(id + 77)) from ts_4893.meters limit 5;
select CHAR(id+77, id+77, id+77, id+77, id+77) from ts_4893.meters limit 5;
select char(77);
select char(77 * 256 + 77);
select char('123');
select char(77, NULL, '123');
select CHAR(77)
select CHAR(77.5)
select CHAR(100)
select CHAR(77) from ts_4893.meters limit 5
select CHAR(77,78,79,80,81) from ts_4893.meters limit 5
select CHAR(77*256+77) from ts_4893.meters limit 5
select concat(CHAR(77),CHAR(78)) from ts_4893.meters limit 5
select cast(CHAR(49) as int)
select CHAR(id + 77) from ts_4893.meters order by ts limit 5;
select CONCAT(CHAR(id + 77),CHAR(id + 77),CHAR(id + 77)) from ts_4893.meters limit 5
select CHAR(id+77, id+77, id+77, id+77, id+77) from ts_4893.meters limit 5
select char(77)
select char(77 * 256 + 77)
select char('123')
select char(77, NULL, '123')
select char(null)
select char('ustc')
select char(65.99)
select char(65, 66, 67)
select char(72, 101, 108, 108, 111)

View File

@ -1,25 +1,38 @@
select CHAR_LENGTH('hello');
select CHAR_LENGTH('hello world');
select CHAR_LENGTH('hello world!');
select CHAR_LENGTH('hello,world.你好,世界。');
select CHAR_LENGTH('北京涛思数据科技有限公司');
select CHAR_LENGTH('hello') + 1;
select CHAR_LENGTH('hello') - 1;
select CHAR_LENGTH('hello') from ts_4893.meters limit 5;
select CHAR_LENGTH('hello') + 1 from ts_4893.meters limit 1;
select CHAR_LENGTH('hello') + CHAR_LENGTH('hello') from ts_4893.meters limit 1;
select CHAR_LENGTH(nch1) from ts_4893.meters order by ts limit 5;
select CHAR_LENGTH(var1) from ts_4893.meters order by ts limit 5;
select CHAR_LENGTH(concat(nch1,var1)) from ts_4893.meters order by ts limit 5;
select CHAR_LENGTH(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5;
select pow(CHAR_LENGTH(nch1), 2) from ts_4893.meters order by ts limit 5;
select sqrt(CHAR_LENGTH(nch1)) from ts_4893.meters order by ts limit 5;
select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5;
select char_length('taos');
select char_length('涛思');
select char_length('涛思taos');
select char_length('tao\'s');
select char_length(nch1) from ts_4893.d0 limit 10;
select char_length(nch1) from ts_4893.meters limit 10;
select char_length(var1) from ts_4893.d0 limit 10;
select char_length(var1) from ts_4893.meters limit 10;
select CHAR_LENGTH('hello')
select CHAR_LENGTH('hello world')
select CHAR_LENGTH('hello world!')
select CHAR_LENGTH('hello,world.你好,世界。')
select CHAR_LENGTH('北京涛思数据科技有限公司')
select CHAR_LENGTH('hello') + 1
select CHAR_LENGTH('hello') - 1
select CHAR_LENGTH('hello') from ts_4893.meters limit 5
select CHAR_LENGTH('hello') + 1 from ts_4893.meters limit 1
select CHAR_LENGTH('hello') + CHAR_LENGTH('hello') from ts_4893.meters limit 1
select CHAR_LENGTH(nch1) from ts_4893.meters order by ts limit 5
select CHAR_LENGTH(var1) from ts_4893.meters order by ts limit 5
select CHAR_LENGTH(concat(nch1,var1)) from ts_4893.meters order by ts limit 5
select CHAR_LENGTH(cast(nch1 as varchar)) from ts_4893.meters order by ts limit 5
select pow(CHAR_LENGTH(nch1), 2) from ts_4893.meters order by ts limit 5
select sqrt(CHAR_LENGTH(nch1)) from ts_4893.meters order by ts limit 5
select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5
select char_length('taos')
select char_length('涛思')
select char_length('涛思taos')
select char_length('tao\'s')
select char_length(nch1) from ts_4893.d0 limit 10
select char_length(nch1) from ts_4893.meters limit 10
select char_length(var1) from ts_4893.d0 limit 10
select char_length(var1) from ts_4893.meters limit 10
select char_length(null)
select char_length('')
select char_length('あいうえお')
select min(char_length(name)) from ts_4893.meters
select max(char_length(name)) from ts_4893.meters
select trim(name), char_length(trim(name)) from ts_4893.meters limit 1
select upper(name), char_length(upper(name)) from ts_4893.meters limit 1
select concat(name, ' - ', location), char_length(concat(name, ' - ', location)) from ts_4893.meters limit 1
select substring(name, 1, 5), char_length(substring(name, 1, 5)) from ts_4893.meters limit 1
select name, char_length(name) from ts_4893.meters limit 1
select nch1, char_length(nch1) from ts_4893.meters limit 1
select groupid, max(char_length(name)) from ts_4893.meters group by groupid order by ts
select location, avg(char_length(name)) from ts_4893.meters group by location order by location

View File

@ -1,18 +1,36 @@
select DAYOFWEEK('2020-01-01 00:00:00');
select DAYOFWEEK('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select DAYOFWEEK('2021-01-01 00:00:00');
select DAYOFWEEK('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select DAYOFWEEK('1998-01-01 00:00:00');
select DAYOFWEEK('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select DAYOFWEEK('1998-12-31 00:00:00');
select DAYOFWEEK('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10;
select DAYOFWEEK('2000-01-06 00:00:00');
select DAYOFWEEK('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10;
select DAYOFWEEK(1725095657);
select DAYOFWEEK(1725095657) from ts_4893.meters order by ts limit 10;
select DAYOFWEEK(ts) from ts_4893.meters order by ts limit 10;
select dayofweek('2020-01-01');
select dayofweek(1721020666);
select dayofweek(1721020666229);
select dayofweek(ts) from ts_4893.d0 order by ts limit 10;
select dayofweek(ts) from ts_4893.meters order by ts limit 10;
select DAYOFWEEK('2020-01-01 00:00:00')
select DAYOFWEEK('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select DAYOFWEEK('2021-01-01 00:00:00')
select DAYOFWEEK('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select DAYOFWEEK('1998-01-01 00:00:00')
select DAYOFWEEK('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select DAYOFWEEK('1998-12-31 00:00:00')
select DAYOFWEEK('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
select DAYOFWEEK('2000-01-06 00:00:00')
select DAYOFWEEK('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
select DAYOFWEEK(1725095657)
select DAYOFWEEK(1725095657) from ts_4893.meters order by ts limit 10
select DAYOFWEEK(ts) from ts_4893.meters order by ts limit 10
select dayofweek(null)
select dayofweek('1721020591')
select dayofweek('1721020666229')
select dayofweek('abc')
select dayofweek('01/01/2020')
select dayofweek('20200101')
select dayofweek('20/01/01')
select dayofweek('11/01/31')
select dayofweek('01-JAN-20')
select dayofweek('2020-01-01')
select dayofweek(1721020666)
select dayofweek(1721020666229)
select dayofweek(ts) from ts_4893.d0 order by ts limit 10
select dayofweek(ts) from ts_4893.meters order by ts limit 10
select dayofweek('2024-02-29')
select dayofweek('2024-01-01')
select dayofweek('2024-12-31')
select dayofweek('9999-12-31')
select dayofweek(ts) from ts_4893.meters limit 1
select dayofweek(name) from ts_4893.meters limit 1
select dayofweek(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
select id, dayofweek(ts) from ts_4893.meters where id = 1 limit 1
select groupid, sum(dayofweek(ts)) from ts_4893.meters group by groupid order by groupid

View File

@ -1,32 +1,47 @@
select DEGREES(0);
select DEGREES(1);
select DEGREES(1.5);
select DEGREES(100);
select DEGREES(-1);
select DEGREES(-1.5);
select DEGREES(-100);
select DEGREES(1) + 1;
select DEGREES(1) - 1;
select DEGREES(1) * 1;
select DEGREES(1) / 1;
select DEGREES(1) from ts_4893.meters limit 5;
select DEGREES(1) + 1 from ts_4893.meters limit 1;
select DEGREES(1) - 1 from ts_4893.meters limit 1;
select DEGREES(1) * 2 from ts_4893.meters limit 1;
select DEGREES(1) / 2 from ts_4893.meters limit 1;
select DEGREES(2) + DEGREES(1) from ts_4893.meters limit 1;
select DEGREES(2) - DEGREES(1) from ts_4893.meters limit 1;
select DEGREES(2) * DEGREES(1) from ts_4893.meters limit 1;
select DEGREES(2) / DEGREES(1) from ts_4893.meters limit 1;
select DEGREES(1) + id from ts_4893.meters order by ts limit 5;
select DEGREES(id) + id from ts_4893.meters order by ts limit 5;
select DEGREES(abs(10));
select DEGREES(PI());
select abs(DEGREES(10));
select pow(DEGREES(10), 2);
select sqrt(DEGREES(10));
select cast(DEGREES(10) as int);
select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5;
select degrees(pi());
select degrees(current) from ts_4893.d0 order by ts limit 10;
select degrees(current) from ts_4893.meters order by ts limit 10;
select DEGREES(0)
select DEGREES(1)
select DEGREES(1.5)
select DEGREES(100)
select DEGREES(-1)
select DEGREES(-1.5)
select DEGREES(-100)
select DEGREES(1) + 1
select DEGREES(1) - 1
select DEGREES(1) * 1
select DEGREES(1) / 1
select DEGREES(1) from ts_4893.meters limit 5
select DEGREES(1) + 1 from ts_4893.meters limit 1
select DEGREES(1) - 1 from ts_4893.meters limit 1
select DEGREES(1) * 2 from ts_4893.meters limit 1
select DEGREES(1) / 2 from ts_4893.meters limit 1
select DEGREES(2) + DEGREES(1) from ts_4893.meters limit 1
select DEGREES(2) - DEGREES(1) from ts_4893.meters limit 1
select DEGREES(2) * DEGREES(1) from ts_4893.meters limit 1
select DEGREES(2) / DEGREES(1) from ts_4893.meters limit 1
select DEGREES(1) + id from ts_4893.meters order by ts limit 5
select DEGREES(id) + id from ts_4893.meters order by ts limit 5
select DEGREES(abs(10))
select DEGREES(PI())
select abs(DEGREES(10))
select pow(DEGREES(10), 2)
select sqrt(DEGREES(10))
select cast(DEGREES(10) as int)
select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5
select degrees(pi())
select degrees(current) from ts_4893.d0 order by ts limit 10
select degrees(current) from ts_4893.meters order by ts limit 10
select degrees(null)
select degrees(-5)
select degrees(3.14)
select degrees(2*pi())
select degrees(pi()/2)
select degrees(-pi()/2)
select degrees(1000000)
select degrees(sin(1))
select degrees(cos(1))
select degrees(tan(1))
select degrees(radians(90))
select degrees(atan(1))
select degrees(phase) from ts_4893.meters limit 1
select degrees(current) from ts_4893.meters limit 1
select degrees(voltage) from ts_4893.meters limit 1

View File

@ -1,32 +1,45 @@
select EXP(0);
select EXP(1);
select EXP(1.5);
select EXP(100);
select EXP(-1);
select EXP(-1.5);
select EXP(-100);
select EXP(1) + 1;
select EXP(1) - 1;
select EXP(1) * 1;
select EXP(1) / 1;
select exp(1) from ts_4893.meters limit 5;
select exp(1) + 1 from ts_4893.meters limit 1;
select exp(1) - 1 from ts_4893.meters limit 1;
select exp(1) * 2 from ts_4893.meters limit 1;
select exp(1) / 2 from ts_4893.meters limit 1;
select exp(2) + exp(1) from ts_4893.meters limit 1;
select exp(2) - exp(1) from ts_4893.meters limit 1;
select exp(2) * exp(1) from ts_4893.meters limit 1;
select exp(2) / exp(1) from ts_4893.meters limit 1;
select exp(1) + id from ts_4893.meters order by ts limit 5;
select exp(id) + id from ts_4893.meters order by ts limit 5;
select abs(EXP(10));
select pow(EXP(10), 2);
select sqrt(EXP(10));
select cast(EXP(10) as int);
select EXP(sqrt(id)) from ts_4893.meters order by ts limit 5;
select EXP(EXP(EXP(EXP(0))));
select exp(2);
select exp(0.5);
select exp(current) from ts_4893.d0 order by ts limit 10;
select exp(current) from ts_4893.meters order by ts limit 10;
select EXP(0)
select EXP(1)
select EXP(1.5)
select EXP(100)
select EXP(-1)
select EXP(-1.5)
select EXP(-100)
select EXP(1) + 1
select EXP(1) - 1
select EXP(1) * 1
select EXP(1) / 1
select exp(1) from ts_4893.meters limit 5
select exp(1) + 1 from ts_4893.meters limit 1
select exp(1) - 1 from ts_4893.meters limit 1
select exp(1) * 2 from ts_4893.meters limit 1
select exp(1) / 2 from ts_4893.meters limit 1
select exp(2) + exp(1) from ts_4893.meters limit 1
select exp(2) - exp(1) from ts_4893.meters limit 1
select exp(2) * exp(1) from ts_4893.meters limit 1
select exp(2) / exp(1) from ts_4893.meters limit 1
select exp(1) + id from ts_4893.meters order by ts limit 5
select exp(id) + id from ts_4893.meters order by ts limit 5
select abs(EXP(10))
select pow(EXP(10), 2)
select sqrt(EXP(10))
select cast(EXP(10) as int)
select EXP(sqrt(id)) from ts_4893.meters order by ts limit 5
select EXP(EXP(EXP(EXP(0))))
select exp(2)
select exp(0.5)
select exp(current) from ts_4893.d0 order by ts limit 10
select exp(current) from ts_4893.meters order by ts limit 10
select exp(null)
select exp(100000)
select exp(-1000)
select exp(-9999999999)
select exp(0.0001)
select exp(pi())
select exp(voltage) from ts_4893.meters limit 1
select exp(current) from ts_4893.meters limit 1
select exp(phase) from ts_4893.meters limit 1
select exp(voltage + current) from ts_4893.meters limit 1
select exp(abs(current)) from ts_4893.meters limit 1
select exp(log(voltage)) from ts_4893.meters limit 1
select round(exp(voltage), 2) from ts_4893.meters limit 1

View File

@ -1,29 +1,46 @@
select LN(100);
select LN(1.5);
select LN(100);
select LN(100) + 1;
select LN(100) - 1;
select LN(100) * 1;
select LN(100) / 1;
select LN(100) from ts_4893.meters limit 5;
select LN(100) + 1 from ts_4893.meters limit 1;
select LN(100) - 1 from ts_4893.meters limit 1;
select LN(100) * 2 from ts_4893.meters limit 1;
select LN(100) / 2 from ts_4893.meters limit 1;
select LN(2) + LN(100) from ts_4893.meters limit 1;
select LN(2) - LN(100) from ts_4893.meters limit 1;
select LN(2) * LN(100) from ts_4893.meters limit 1;
select LN(2) / LN(100) from ts_4893.meters limit 1;
select LN(100) + id from ts_4893.meters order by ts limit 5;
select LN(id + 1) + id from ts_4893.meters order by ts limit 5;
select abs(LN(10));
select pow(LN(10), 2);
select sqrt(LN(10));
select cast(LN(10) as int);
select LN(sqrt(id) + 1) from ts_4893.meters order by ts limit 5;
select LN(LN(LN(LN(10000))));
select LN(EXP(2));
select ln(10);
select ln(pi());
select ln(current) from ts_4893.d0 order by ts limit 10;
select ln(current) from ts_4893.meters order by ts limit 10;
select LN(100)
select LN(1.5)
select LN(100)
select LN(100) + 1
select LN(100) - 1
select LN(100) * 1
select LN(100) / 1
select LN(100) from ts_4893.meters limit 5
select LN(100) + 1 from ts_4893.meters limit 1
select LN(100) - 1 from ts_4893.meters limit 1
select LN(100) * 2 from ts_4893.meters limit 1
select LN(100) / 2 from ts_4893.meters limit 1
select LN(2) + LN(100) from ts_4893.meters limit 1
select LN(2) - LN(100) from ts_4893.meters limit 1
select LN(2) * LN(100) from ts_4893.meters limit 1
select LN(2) / LN(100) from ts_4893.meters limit 1
select LN(100) + id from ts_4893.meters order by ts limit 5
select LN(id + 1) + id from ts_4893.meters order by ts limit 5
select ln(null)
select ln(0)
select ln(-5)
select abs(LN(10))
select pow(LN(10), 2)
select sqrt(LN(10))
select cast(LN(10) as int)
select LN(sqrt(id) + 1) from ts_4893.meters order by ts limit 5
select LN(LN(LN(LN(10000))))
select LN(EXP(2))
select ln(10)
select ln(pi())
select ln(current) from ts_4893.d0 order by ts limit 10
select ln(current) from ts_4893.meters order by ts limit 10
select ln(1)
select ln(20)
select ln(100)
select ln(99999999999999)
select ln(0.1)
select ln(2.718)
select ln(exp(1))
select ln(voltage) from ts_4893.meters where voltage > 0 limit 1
select ln(current) from ts_4893.meters where current > 0 limit 1
select ln(phase) from ts_4893.meters where phase > 0 limit 1
select ln(exp(voltage)) from ts_4893.meters where voltage > 0 limit 1
select ln(abs(current)) from ts_4893.meters where current != 0 limit 1
select ln(sqrt(phase)) from ts_4893.meters where phase >= 0 limit 1
select ln(log(current)) from ts_4893.meters where current > 1 limit 1

View File

@ -1,16 +1,28 @@
select MAX(id) from ts_4893.meters;
select MAX(current) from ts_4893.meters;
select MAX(voltage) from ts_4893.meters;
select MAX(name) from ts_4893.meters;
select MAX(nch1) from ts_4893.meters;
select MAX(nch2) from ts_4893.meters;
select MAX(var1) from ts_4893.meters;
select MAX(var2) from ts_4893.meters;
select MAX(id) from ts_4893.meters interval(60d);
select MAX(current) from ts_4893.meters interval(60d);
select MAX(voltage) from ts_4893.meters interval(60d);
select MAX(name) from ts_4893.meters interval(60d);
select MAX(nch1) from ts_4893.meters interval(60d);
select MAX(nch2) from ts_4893.meters interval(60d);
select MAX(var1) from ts_4893.meters interval(60d);
select MAX(var2) from ts_4893.meters interval(60d);
select MAX(current) from ts_4893.meters
select MAX(voltage) from ts_4893.meters
select MAX(name) from ts_4893.meters
select MAX(nch1) from ts_4893.meters
select MAX(nch2) from ts_4893.meters
select MAX(var1) from ts_4893.meters
select MAX(var2) from ts_4893.meters
select MAX(id) from ts_4893.meters interval(60d)
select MAX(current) from ts_4893.meters interval(60d)
select MAX(voltage) from ts_4893.meters interval(60d)
select MAX(name) from ts_4893.meters interval(60d)
select MAX(nch1) from ts_4893.meters interval(60d)
select MAX(nch2) from ts_4893.meters interval(60d)
select MAX(var1) from ts_4893.meters interval(60d)
select MAX(var2) from ts_4893.meters interval(60d)
select max(null) from ts_4893.meters
select max(id) from ts_4893.meters
select max(id) from ts_4893.meters where id > 0
select max(id) from ts_4893.meters where id <= 0
select max(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
select max(voltage) from ts_4893.meters where voltage is not null
select max(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
select round(max(current), 2) from ts_4893.meters
select pow(max(current), 2) from ts_4893.meters
select log(max(voltage) + 1) from ts_4893.meters
select groupid, max(voltage) from ts_4893.meters group by groupid order by groupid
select location, max(id) from ts_4893.meters group by location order by location
select location, max(current) from ts_4893.meters group by location order by location

View File

@ -1,16 +1,28 @@
select MIN(id) from ts_4893.meters;
select MIN(current) from ts_4893.meters;
select MIN(voltage) from ts_4893.meters;
select MIN(name) from ts_4893.meters;
select MIN(nch1) from ts_4893.meters;
select MIN(nch2) from ts_4893.meters;
select MIN(var1) from ts_4893.meters;
select MIN(var2) from ts_4893.meters;
select MIN(id) from ts_4893.meters interval(60d);
select MIN(current) from ts_4893.meters interval(60d);
select MIN(voltage) from ts_4893.meters interval(60d);
select MIN(name) from ts_4893.meters interval(60d);
select MIN(nch1) from ts_4893.meters interval(60d);
select MIN(nch2) from ts_4893.meters interval(60d);
select MIN(var1) from ts_4893.meters interval(60d);
select MIN(var2) from ts_4893.meters interval(60d);
select MIN(id) from ts_4893.meters
select MIN(current) from ts_4893.meters
select MIN(voltage) from ts_4893.meters
select MIN(name) from ts_4893.meters
select MIN(nch1) from ts_4893.meters
select MIN(nch2) from ts_4893.meters
select MIN(var1) from ts_4893.meters
select MIN(var2) from ts_4893.meters
select MIN(id) from ts_4893.meters interval(60d)
select MIN(current) from ts_4893.meters interval(60d)
select MIN(voltage) from ts_4893.meters interval(60d)
select MIN(name) from ts_4893.meters interval(60d)
select MIN(nch1) from ts_4893.meters interval(60d)
select MIN(nch2) from ts_4893.meters interval(60d)
select MIN(var1) from ts_4893.meters interval(60d)
select MIN(var2) from ts_4893.meters interval(60d)
select min(null) from ts_4893.meters
select min(id) from ts_4893.meters where id > 0
select min(id) from ts_4893.meters where id <= 0
select min(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
select min(voltage) from ts_4893.meters where voltage is not null
select min(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
select round(min(current), 2) from ts_4893.meters
select pow(min(current), 2) from ts_4893.meters
select log(min(voltage) + 1) from ts_4893.meters
select groupid, min(voltage) from ts_4893.meters group by groupid order by groupid
select location, min(current) from ts_4893.meters group by location order by location
select location, min(id) from ts_4893.meters group by location order by location

View File

@ -1,18 +1,36 @@
select MOD(10.55, 3);
select MOD(10.55, 2);
select MOD(10.55, 1);
select MOD(10.55, -1);
select MOD(10.55, -10);
select MOD(-10.55, 1);
select MOD(99, 1);
select MOD(10.55, 1) + 1;
select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3);
select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7);
select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10;
select MOD(current, id + 1) from ts_4893.meters order by ts limit 10;
select MOD(current, 1) from ts_4893.meters order by ts limit 10;
select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10;
select mod(10, -3);
select mod(10, 3);
select mod(id, 3) from ts_4893.d0 order by ts limit 10;
select mod(id, 3) from ts_4893.meters order by ts limit 10;
select MOD(10.55, 3)
select MOD(10.55, 2)
select MOD(10.55, 1)
select MOD(10.55, -1)
select MOD(10.55, -10)
select MOD(-10.55, 1)
select MOD(99, 1)
select MOD(10.55, 1) + 1
select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3)
select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10
select MOD(current, id + 1) from ts_4893.meters order by ts limit 10
select MOD(current, 1) from ts_4893.meters order by ts limit 10
select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
select mod(10, -3)
select mod(10, 3)
select mod(id, 3) from ts_4893.d0 order by ts limit 10
select mod(id, 3) from ts_4893.meters order by ts limit 10
select mod(null, 2)
select mod(10, null)
select mod(10, 0)
select mod(-10, 0)
select mod(5, 0)
select mod(0, 1)
select mod(1, 1)
select mod(5, 2)
select mod(5, -3)
select mod(15, 4)
select mod(-5, 3)
select mod(voltage, 2) from ts_4893.meters limit 1
select mod(current, 10) from ts_4893.meters limit 1
select mod(current, log(100)) from ts_4893.meters limit 1
select mod(phase, 4) from ts_4893.meters limit 1
select mod(abs(voltage), 3) from ts_4893.meters limit 1
select mod(phase, sqrt(16)) from ts_4893.meters limit 1
select mod(round(voltage), 5) from ts_4893.meters limit 1

View File

@ -19,3 +19,19 @@ select sqrt(pi())
select cast(pi() as int)
select pi()
select substring_index(null, '.', 2)
select pi() + null
select pi() * 0
select pi() / 0
select pi() * 0.5
select pi() * -1
select pi() * name from ts_4893.meters limit 1
select pi() * voltage from ts_4893.meters limit 1
select pi() * phase * 2 from ts_4893.meters limit 1
select round(pi(), 6)
select round(pi() * phase, 2) from ts_4893.meters limit 1
select sqrt(pi() * voltage) from ts_4893.meters limit 1
select sqrt(current / pi()) from ts_4893.meters limit 1
select abs(pi() * phase) from ts_4893.meters limit 1
select log(pi() * voltage) from ts_4893.meters limit 1
select voltage / pi() from ts_4893.meters limit 1
select id, case when voltage > 100 then pi() else pi() / 2 end from ts_4893.meters limit 1

View File

@ -1,40 +1,62 @@
select POSITION('北' IN '北京涛思');
select POSITION('涛思' IN '北京涛思');
select POSITION('a' IN 'abcd');
select POSITION('e' IN 'abcd');
select POSITION('好,' IN 'hello,world.你好,世界。');
select POSITION(',你' IN 'hello,world.你好,世界。');
select POSITION('world' IN 'hello,world.你好,世界。');
select POSITION('aaa' IN 'aaaaaaaaa');
select POSITION(CONCAT('a','b','c') IN CONCAT('abc','def','ghi'));
select POSITION(CONCAT('a','b','d') IN CONCAT('abc','def','ghi'));
select POSITION(nch2 IN nch1) from ts_4893.meters where POSITION(nch2 IN nch1) != 0 order by ts limit 5;
select POSITION(nch2 IN nch1) from ts_4893.meters order by ts limit 5;
select POSITION(var2 IN var1) from ts_4893.meters where POSITION(var2 IN var1) != 0 order by ts limit 5;
select POSITION(var2 IN var1) from ts_4893.meters order by ts limit 5;
select POSITION(var2 IN nch1) from ts_4893.meters where POSITION(var2 IN nch1) != 0 order by ts limit 5;
select POSITION(var2 IN nch1) from ts_4893.meters order by ts limit 5;
select POSITION(nch2 IN var1) from ts_4893.meters where POSITION(nch2 IN var1) != 0 order by ts limit 5;
select POSITION(nch2 IN var1) from ts_4893.meters order by ts limit 5;
select POSITION('a' IN nch1) from ts_4893.meters where POSITION('a' IN nch1) != 0 order by ts limit 5;
select POSITION('a' IN var1) from ts_4893.meters where POSITION('a' IN var1) != 0 order by ts limit 5;
select POSITION('一' IN nch1) from ts_4893.meters where POSITION('一' IN nch1) != 0 order by ts limit 5;
select POSITION('一' IN var1) from ts_4893.meters where POSITION('一' IN var1) != 0 order by ts limit 5;
select POSITION(nch2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(nch2 IN 'abcdefghijklmn') != 0 order by ts limit 5;
select POSITION(var2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(var2 IN 'abcdefghijklmn') != 0 order by ts limit 5;
select POSITION(nch2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(nch2 IN '一二三四五六七八九十') != 0 order by ts limit 5;
select POSITION(var2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(var2 IN '一二三四五六七八九十') != 0 order by ts limit 5;
select ABS(POSITION('aaa' IN 'aaaaaaaaa'));
select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2);
select position('t' in 'taos');
select position('ustc' in 'taos');
select position('' in '');
select position('' in 'taos');
select position(nch2 in nch1) from ts_4893.d0 order by ts limit 10;
select position(nch2 in nch1) from ts_4893.meters order by ts limit 10;
select position(nch2 in var1) from ts_4893.d0 order by ts limit 10;
select position(nch2 in var1) from ts_4893.meters order by ts limit 10;
select position(var2 in nch1) from ts_4893.d0 order by ts limit 10;
select position(var2 in nch1) from ts_4893.meters order by ts limit 10;
select position(var2 in var1) from ts_4893.d0 order by ts limit 10;
select position(var2 in var1) from ts_4893.meters order by ts limit 10;
select POSITION('北' IN '北京涛思')
select POSITION('涛思' IN '北京涛思')
select POSITION('a' IN 'abcd')
select POSITION('e' IN 'abcd')
select POSITION('好,' IN 'hello,world.你好,世界。')
select POSITION(',你' IN 'hello,world.你好,世界。')
select POSITION('world' IN 'hello,world.你好,世界。')
select POSITION('aaa' IN 'aaaaaaaaa')
select POSITION(CONCAT('a','b','c') IN CONCAT('abc','def','ghi'))
select POSITION(CONCAT('a','b','d') IN CONCAT('abc','def','ghi'))
select POSITION(nch2 IN nch1) from ts_4893.meters where POSITION(nch2 IN nch1) != 0 order by ts limit 5
select POSITION(nch2 IN nch1) from ts_4893.meters order by ts limit 5
select POSITION(var2 IN var1) from ts_4893.meters where POSITION(var2 IN var1) != 0 order by ts limit 5
select POSITION(var2 IN var1) from ts_4893.meters order by ts limit 5
select POSITION(var2 IN nch1) from ts_4893.meters where POSITION(var2 IN nch1) != 0 order by ts limit 5
select POSITION(var2 IN nch1) from ts_4893.meters order by ts limit 5
select POSITION(nch2 IN var1) from ts_4893.meters where POSITION(nch2 IN var1) != 0 order by ts limit 5
select POSITION(nch2 IN var1) from ts_4893.meters order by ts limit 5
select POSITION('a' IN nch1) from ts_4893.meters where POSITION('a' IN nch1) != 0 order by ts limit 5
select POSITION('a' IN var1) from ts_4893.meters where POSITION('a' IN var1) != 0 order by ts limit 5
select POSITION('一' IN nch1) from ts_4893.meters where POSITION('一' IN nch1) != 0 order by ts limit 5
select POSITION('一' IN var1) from ts_4893.meters where POSITION('一' IN var1) != 0 order by ts limit 5
select POSITION(nch2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(nch2 IN 'abcdefghijklmn') != 0 order by ts limit 5
select POSITION(var2 IN 'abcdefghijklmn') from ts_4893.meters where POSITION(var2 IN 'abcdefghijklmn') != 0 order by ts limit 5
select POSITION(nch2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(nch2 IN '一二三四五六七八九十') != 0 order by ts limit 5
select POSITION(var2 IN '一二三四五六七八九十') from ts_4893.meters where POSITION(var2 IN '一二三四五六七八九十') != 0 order by ts limit 5
select ABS(POSITION('aaa' IN 'aaaaaaaaa'))
select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2)
select position('t' in 'taos')
select position('ustc' in 'taos')
select position('' in '')
select position('' in 'taos')
select position(nch2 in nch1) from ts_4893.d0 order by ts limit 10
select position(nch2 in nch1) from ts_4893.meters order by ts limit 10
select position(nch2 in var1) from ts_4893.d0 order by ts limit 10
select position(nch2 in var1) from ts_4893.meters order by ts limit 10
select position(var2 in nch1) from ts_4893.d0 order by ts limit 10
select position(var2 in nch1) from ts_4893.meters order by ts limit 10
select position(var2 in var1) from ts_4893.d0 order by ts limit 10
select position(var2 in var1) from ts_4893.meters order by ts limit 10
select position('t' in null)
select position(null in 'taos')
select position('' in 'A')
select position('A' in 'A')
select position('A' in '')
select position('A' in null)
select position('Z' in 'ABC')
select position('l' in 'Hello')
select position('s' in 'meters')
select position('中' in '中国')
select position('e' in 'é')
select position('W' in 'Hello World')
select position('@' in '!@#')
select position('6' in '12345')
select position('A' in trim(' A '))
select position('A' in upper('abc'))
select position('B' in concat('A', 'B'))
select position('x' in replace('Hello', 'l', 'x'))
select name, position('e' in name) from ts_4893.meters limit 1
select name, position('a' in substring(name, 2, 5)) from ts_4893.meters limit 1
select nch1, position('n' in nch1) from ts_4893.meters limit 1
select var1, position('1' in var1) from ts_4893.meters limit 1

View File

@ -1,32 +1,48 @@
select RADIANS(0);
select RADIANS(1);
select RADIANS(1.5);
select RADIANS(100);
select RADIANS(-1);
select RADIANS(-1.5);
select RADIANS(-100);
select RADIANS(1) + 1;
select RADIANS(1) - 1;
select RADIANS(1) * 1;
select RADIANS(1) / 1;
select RADIANS(1) from ts_4893.meters limit 5;
select RADIANS(1) + 1 from ts_4893.meters limit 1;
select RADIANS(1) - 1 from ts_4893.meters limit 1;
select RADIANS(1) * 2 from ts_4893.meters limit 1;
select RADIANS(1) / 2 from ts_4893.meters limit 1;
select RADIANS(2) + RADIANS(1) from ts_4893.meters limit 1;
select RADIANS(2) - RADIANS(1) from ts_4893.meters limit 1;
select RADIANS(2) * RADIANS(1) from ts_4893.meters limit 1;
select RADIANS(2) / RADIANS(1) from ts_4893.meters limit 1;
select RADIANS(1) + id from ts_4893.meters order by ts limit 5;
select RADIANS(id) + id from ts_4893.meters order by ts limit 5;
select RADIANS(abs(10));
select RADIANS(DEGREES(PI()));
select abs(RADIANS(10));
select pow(RADIANS(10), 2);
select sqrt(RADIANS(10));
select cast(RADIANS(10) as int);
select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5;
select radians(180);
select radians(current) from ts_4893.d0 order by ts limit 10;
select radians(current) from ts_4893.meters order by ts limit 10;
select RADIANS(0)
select RADIANS(1)
select RADIANS(1.5)
select RADIANS(100)
select RADIANS(-1)
select RADIANS(-1.5)
select RADIANS(-100)
select RADIANS(1) + 1
select RADIANS(1) - 1
select RADIANS(1) * 1
select RADIANS(1) / 1
select RADIANS(1) from ts_4893.meters limit 5
select RADIANS(1) + 1 from ts_4893.meters limit 1
select RADIANS(1) - 1 from ts_4893.meters limit 1
select RADIANS(1) * 2 from ts_4893.meters limit 1
select RADIANS(1) / 2 from ts_4893.meters limit 1
select RADIANS(2) + RADIANS(1) from ts_4893.meters limit 1
select RADIANS(2) - RADIANS(1) from ts_4893.meters limit 1
select RADIANS(2) * RADIANS(1) from ts_4893.meters limit 1
select RADIANS(2) / RADIANS(1) from ts_4893.meters limit 1
select RADIANS(1) + id from ts_4893.meters order by ts limit 5
select RADIANS(id) + id from ts_4893.meters order by ts limit 5
select RADIANS(abs(10))
select RADIANS(DEGREES(PI()))
select abs(RADIANS(10))
select pow(RADIANS(10), 2)
select sqrt(RADIANS(10))
select cast(RADIANS(10) as int)
select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5
select radians(180)
select radians(current) from ts_4893.d0 order by ts limit 10
select radians(current) from ts_4893.meters order by ts limit 10
select radians(null)
select radians(0)
select radians(45)
select radians(-45)
select radians(90)
select radians(-90)
select radians(360)
select radians(1000000)
select radians(sin(1))
select radians(cos(1))
select radians(tan(1))
select radians(degrees(90))
select radians(atan(1))
select radians(current) from ts_4893.meters limit 1
select radians(voltage) from ts_4893.meters limit 1
select radians(phase) from ts_4893.meters limit 1

View File

@ -1,3 +1,11 @@
select RAND(1245);
select RAND(id) from ts_4893.d0 limit 10;
select RAND(id) from ts_4893.d0 order by id desc limit 10;
select RAND(1245)
select RAND(id) from ts_4893.d0 limit 10
select RAND(id) from ts_4893.d0 order by id desc limit 10
select rand(0)
select rand(1)
select rand(-1)
select rand(12345678901234567890)
select rand(-12345678901234567890)
select rand(12345), rand(12345)
select rand(9999999999) where rand(9999999999) >= 0 and rand(9999999999) < 1
select rand(id) from ts_4893.meters limit 100

View File

@ -1,31 +1,53 @@
select repeat('hello', 1);
select repeat('hello', 20);
SELECT REPEAT('a', 2);
SELECT CONCAT('g',CONCAT(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h');
SELECT CONCAT('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h');
SELECT CONCAT_WS('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h');
select length(concat(repeat("a",3200),repeat("a",3200)));
select length(replace("aaaaa","a",concat(repeat("a",10000),repeat("a",12))));
select repeat('北京taos', 6);
select repeat(nch1, 6) from ts_4893.meters order by ts limit 5;
select repeat(var1, 6) from ts_4893.meters order by ts limit 5;
select position(nch1 in repeat(nch1,6)) from ts_4893.meters order by ts limit 5;
select position(var1 in repeat(var1,6)) from ts_4893.meters order by ts limit 5;
select position(nch1 in repeat(var1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5;
select position(var1 in repeat(nch1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5;
select repeat(nch1, id) from ts_4893.meters where id > 0 order by ts limit 5;
select repeat(var1, id) from ts_4893.meters where id > 0 order by ts limit 5;
select repeat('nch1', id) from ts_4893.meters where id > 0 order by ts limit 5;
select repeat('var1', id) from ts_4893.meters where id > 0 order by ts limit 5;
select repeat('taos', 1);
select repeat('taos', 2);
select repeat(name, 3) from ts_4893.d0 order by ts limit 10;
select repeat(name, 3) from ts_4893.meters order by ts limit 10;
select repeat(nch1, 3) from ts_4893.d0 order by ts limit 10;
select repeat(nch1, 3) from ts_4893.meters order by ts limit 10;
select repeat(var1, 3) from ts_4893.d0 order by ts limit 10;
select repeat(var1, 3) from ts_4893.meters order by ts limit 10;
select repeat(name, groupid) from ts_4893.d0 order by ts limit 10;
select repeat(name, groupid) from ts_4893.meters order by ts limit 10;
select repeat(nch1, groupid) from ts_4893.d0 order by ts limit 10;
select repeat(nch1, groupid) from ts_4893.meters order by ts limit 10;
select repeat('hello', 1)
select repeat('hello', 20)
SELECT REPEAT('a', 2)
SELECT CONCAT('g',CONCAT(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
SELECT CONCAT('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
SELECT CONCAT_WS('g',CONCAT_WS(';',repeat('a',60), repeat('b',60), repeat('c',60), repeat ('d',100)),'h')
select length(concat(repeat("a",3200),repeat("a",3200)))
select length(replace("aaaaa","a",concat(repeat("a",10000),repeat("a",12))))
select repeat('北京taos', 6)
select repeat(nch1, 6) from ts_4893.meters order by ts limit 5
select repeat(var1, 6) from ts_4893.meters order by ts limit 5
select position(nch1 in repeat(nch1,6)) from ts_4893.meters order by ts limit 5
select position(var1 in repeat(var1,6)) from ts_4893.meters order by ts limit 5
select position(nch1 in repeat(var1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5
select position(var1 in repeat(nch1,6)) from ts_4893.meters where nch1 = var1 order by ts limit 5
select repeat(nch1, id) from ts_4893.meters where id > 0 order by ts limit 5
select repeat(var1, id) from ts_4893.meters where id > 0 order by ts limit 5
select repeat('nch1', id) from ts_4893.meters where id > 0 order by ts limit 5
select repeat('var1', id) from ts_4893.meters where id > 0 order by ts limit 5
select repeat('taos', 1)
select repeat('taos', 2)
select repeat(name, 3) from ts_4893.d0 order by ts limit 10
select repeat(name, 3) from ts_4893.meters order by ts limit 10
select repeat(nch1, 3) from ts_4893.d0 order by ts limit 10
select repeat(nch1, 3) from ts_4893.meters order by ts limit 10
select repeat(var1, 3) from ts_4893.d0 order by ts limit 10
select repeat(var1, 3) from ts_4893.meters order by ts limit 10
select repeat(name, groupid) from ts_4893.d0 order by ts limit 10
select repeat(name, groupid) from ts_4893.meters order by ts limit 10
select repeat(nch1, groupid) from ts_4893.d0 order by ts limit 10
select repeat(nch1, groupid) from ts_4893.meters order by ts limit 10
select repeat(null, 3)
select repeat('taos', null)
select repeat('taos', 0)
select repeat('', 5)
select repeat('A', 0)
select repeat('A', 10)
select repeat('A B', 5)
select repeat('ABC', 1)
select repeat('Hello', 2)
select repeat('HelloWorld', 2)
select repeat('123', 5)
select repeat('12345', 3)
select repeat('!@#', 3)
select repeat('你好', 2)
select repeat('abc', length('abc'))
select repeat(concat('A', 'B', 'C'), 3)
select repeat(upper('abc'), 4)
select repeat(trim(' Hello '), 3)
select name, repeat(name, 3) from ts_4893.meters limit 1
select name, repeat(substring(name, 1, 5), 2) from ts_4893.meters limit 1
select var1, repeat(var1, 2) from ts_4893.meters limit 1
select nch1, repeat(nch1, 4) from ts_4893.meters limit 1

View File

@ -1,98 +1,120 @@
select replace('aaaa','a','b');
select replace('aaaa','aa','b');
select replace('aaaa','a','bb');
select replace('aaaa','','b');
select replace('bbbb','a','c');
select replace(concat(lower(concat('THIS',' ','IS',' ','A',' ')),upper('false'),' ','test'),'FALSE','REAL') ;
select replace('北京涛思','北京', '');
select replace('北京涛思','涛思', '');
select replace('北京涛思.com','思.', '北京');
select replace('北京涛思.com','北com', '北京涛');
select replace('北京涛思', char(ascii('北')), 'wrongans');
select replace(nch1, 'a', 'b') from ts_4893.meters order by ts limit 5;
select replace(nch1, 'a', 'b') from ts_4893.meters where position('a' IN nch1) != 0 order by ts limit 5;
select replace(nch1, 'a', 'b') from ts_4893.meters where position('a' IN nch1) = 0 order by ts limit 5;
select replace(nch1, 'a', '啊') from ts_4893.meters order by ts limit 5;
select replace(nch1, 'a', '啊') from ts_4893.meters where position('a' IN nch1) != 0 order by ts limit 5;
select replace(nch1, 'a', '啊') from ts_4893.meters where position('a' IN nch1) = 0 order by ts limit 5;
select replace(nch1, '一', '壹') from ts_4893.meters order by ts limit 5;
select replace(nch1, '一', '壹') from ts_4893.meters where position('一' IN nch1) != 0 order by ts limit 5;
select replace(nch1, '一', '壹') from ts_4893.meters where position('一' IN nch1) = 0 order by ts limit 5;
select replace(nch1, '一', '1') from ts_4893.meters order by ts limit 5;
select replace(nch1, '一', '1') from ts_4893.meters where position('一' IN nch1) != 0 order by ts limit 5;
select replace(nch1, '一', '1') from ts_4893.meters where position('一' IN nch1) = 0 order by ts limit 5;
select replace(nch1, nch2, 'nch2') from ts_4893.meters order by ts limit 5;
select replace(nch1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN nch1) != 0 order by ts limit 5;
select replace(nch1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN nch1) = 0 order by ts limit 5;
select replace(nch1, var2, 'var2') from ts_4893.meters order by ts limit 5;
select replace(nch1, var2, 'var2') from ts_4893.meters where position(var2 IN nch1) != 0 order by ts limit 5;
select replace(nch1, var2, 'var2') from ts_4893.meters where position(var2 IN nch1) = 0 order by ts limit 5;
select replace(nch1, '三', nch2) from ts_4893.meters order by ts limit 5;
select replace(nch1, '三', nch2) from ts_4893.meters where position('三' IN nch1) != 0 order by ts limit 5;
select replace(nch1, '三', nch2) from ts_4893.meters where position('三' IN nch1) = 0 order by ts limit 5;
select replace(nch1, '三', var2) from ts_4893.meters order by ts limit 5;
select replace(nch1, '三', var2) from ts_4893.meters where position('三' IN nch1) != 0 order by ts limit 5;
select replace(nch1, '三', var2) from ts_4893.meters where position('三' IN nch1) = 0 order by ts limit 5;
select replace(nch1, nch2, var2) from ts_4893.meters order by ts limit 5;
select replace(nch1, nch2, var2) from ts_4893.meters where position(nch2 IN nch1) != 0 order by ts limit 5;
select replace(nch1, nch2, var2) from ts_4893.meters where position(nch2 IN nch1) = 0 order by ts limit 5;
select replace(nch1, var2, nch2) from ts_4893.meters order by ts limit 5;
select replace(nch1, var2, nch2) from ts_4893.meters where position(var2 IN nch1) != 0 order by ts limit 5;
select replace(nch1, var2, nch2) from ts_4893.meters where position(var2 IN nch1) = 0 order by ts limit 5;
select replace(var1, 'a', 'b') from ts_4893.meters order by ts limit 5;
select replace(var1, 'a', 'b') from ts_4893.meters where position('a' IN var1) != 0 order by ts limit 5;
select replace(var1, 'a', 'b') from ts_4893.meters where position('a' IN var1) = 0 order by ts limit 5;
select replace(var1, 'a', '啊') from ts_4893.meters order by ts limit 5;
select replace(var1, 'a', '啊') from ts_4893.meters where position('a' IN var1) != 0 order by ts limit 5;
select replace(var1, 'a', '啊') from ts_4893.meters where position('a' IN var1) = 0 order by ts limit 5;
select replace(var1, '一', '壹') from ts_4893.meters order by ts limit 5;
select replace(var1, '一', '壹') from ts_4893.meters where position('一' IN var1) != 0 order by ts limit 5;
select replace(var1, '一', '壹') from ts_4893.meters where position('一' IN var1) = 0 order by ts limit 5;
select replace(var1, '一', '1') from ts_4893.meters order by ts limit 5;
select replace(var1, '一', '1') from ts_4893.meters where position('一' IN var1) != 0 order by ts limit 5;
select replace(var1, '一', '1') from ts_4893.meters where position('一' IN var1) = 0 order by ts limit 5;
select replace(var1, nch2, 'nch2') from ts_4893.meters order by ts limit 5;
select replace(var1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN var1) != 0 order by ts limit 5;
select replace(var1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN var1) = 0 order by ts limit 5;
select replace(var1, var2, 'var2') from ts_4893.meters order by ts limit 5;
select replace(var1, var2, 'var2') from ts_4893.meters where position(var2 IN var1) != 0 order by ts limit 5;
select replace(var1, var2, 'var2') from ts_4893.meters where position(var2 IN var1) = 0 order by ts limit 5;
select replace(var1, '三', nch2) from ts_4893.meters order by ts limit 5;
select replace(var1, '三', nch2) from ts_4893.meters where position('三' IN var1) != 0 order by ts limit 5;
select replace(var1, '三', nch2) from ts_4893.meters where position('三' IN var1) = 0 order by ts limit 5;
select replace(var1, '三', var2) from ts_4893.meters order by ts limit 5;
select replace(var1, '三', var2) from ts_4893.meters where position('三' IN var1) != 0 order by ts limit 5;
select replace(var1, '三', var2) from ts_4893.meters where position('三' IN var1) = 0 order by ts limit 5;
select replace(var1, nch2, var2) from ts_4893.meters order by ts limit 5;
select replace(var1, nch2, var2) from ts_4893.meters where position(nch2 IN var1) != 0 order by ts limit 5;
select replace(var1, nch2, var2) from ts_4893.meters where position(nch2 IN var1) = 0 order by ts limit 5;
select replace(var1, var2, nch2) from ts_4893.meters order by ts limit 5;
select replace(var1, var2, nch2) from ts_4893.meters where position(var2 IN var1) != 0 order by ts limit 5;
select replace(var1, var2, nch2) from ts_4893.meters where position(var2 IN var1) = 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5;
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5;
select replace('aabbccdd','aa', 'ee');
select replace('aabbccdd','AA', 'ee');
select replace('北京','北' , '南');
select replace('北京','京' , '南');
select replace('北京taos','北' , '南');
select replace(nch1, nch2, 't') from ts_4893.d0 order by ts limit 10;
select replace(nch1, nch2, 't') from ts_4893.meters order by ts limit 10;
select replace(nch1, var2, 't') from ts_4893.d0 order by ts limit 10;
select replace(nch1, var2, 't') from ts_4893.meters order by ts limit 10;
select replace(var1, nch2, 't') from ts_4893.d0 order by ts limit 10;
select replace(var1, nch2, 't') from ts_4893.meters order by ts limit 10;
select replace(var1, var2, 't') from ts_4893.d0 order by ts limit 10;
select replace(var1, var2, 't') from ts_4893.meters order by ts limit 10;
select replace(nch1, nch2, var1) from ts_4893.d0 order by ts limit 10;
select replace(nch1, nch2, var1) from ts_4893.meters order by ts limit 10;
select replace('aaaa','a','b')
select replace('aaaa','aa','b')
select replace('aaaa','a','bb')
select replace('aaaa','','b')
select replace('bbbb','a','c')
select replace(concat(lower(concat('THIS',' ','IS',' ','A',' ')),upper('false'),' ','test'),'FALSE','REAL')
select replace('北京涛思','北京', '')
select replace('北京涛思','涛思', '')
select replace('北京涛思.com','思.', '北京')
select replace('北京涛思.com','北com', '北京涛')
select replace('北京涛思', char(ascii('北')), 'wrongans')
select replace(nch1, 'a', 'b') from ts_4893.meters order by ts limit 5
select replace(nch1, 'a', 'b') from ts_4893.meters where position('a' IN nch1) != 0 order by ts limit 5
select replace(nch1, 'a', 'b') from ts_4893.meters where position('a' IN nch1) = 0 order by ts limit 5
select replace(nch1, 'a', '啊') from ts_4893.meters order by ts limit 5
select replace(nch1, 'a', '啊') from ts_4893.meters where position('a' IN nch1) != 0 order by ts limit 5
select replace(nch1, 'a', '啊') from ts_4893.meters where position('a' IN nch1) = 0 order by ts limit 5
select replace(nch1, '一', '壹') from ts_4893.meters order by ts limit 5
select replace(nch1, '一', '壹') from ts_4893.meters where position('一' IN nch1) != 0 order by ts limit 5
select replace(nch1, '一', '壹') from ts_4893.meters where position('一' IN nch1) = 0 order by ts limit 5
select replace(nch1, '一', '1') from ts_4893.meters order by ts limit 5
select replace(nch1, '一', '1') from ts_4893.meters where position('一' IN nch1) != 0 order by ts limit 5
select replace(nch1, '一', '1') from ts_4893.meters where position('一' IN nch1) = 0 order by ts limit 5
select replace(nch1, nch2, 'nch2') from ts_4893.meters order by ts limit 5
select replace(nch1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN nch1) != 0 order by ts limit 5
select replace(nch1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN nch1) = 0 order by ts limit 5
select replace(nch1, var2, 'var2') from ts_4893.meters order by ts limit 5
select replace(nch1, var2, 'var2') from ts_4893.meters where position(var2 IN nch1) != 0 order by ts limit 5
select replace(nch1, var2, 'var2') from ts_4893.meters where position(var2 IN nch1) = 0 order by ts limit 5
select replace(nch1, '三', nch2) from ts_4893.meters order by ts limit 5
select replace(nch1, '三', nch2) from ts_4893.meters where position('三' IN nch1) != 0 order by ts limit 5
select replace(nch1, '三', nch2) from ts_4893.meters where position('三' IN nch1) = 0 order by ts limit 5
select replace(nch1, '三', var2) from ts_4893.meters order by ts limit 5
select replace(nch1, '三', var2) from ts_4893.meters where position('三' IN nch1) != 0 order by ts limit 5
select replace(nch1, '三', var2) from ts_4893.meters where position('三' IN nch1) = 0 order by ts limit 5
select replace(nch1, nch2, var2) from ts_4893.meters order by ts limit 5
select replace(nch1, nch2, var2) from ts_4893.meters where position(nch2 IN nch1) != 0 order by ts limit 5
select replace(nch1, nch2, var2) from ts_4893.meters where position(nch2 IN nch1) = 0 order by ts limit 5
select replace(nch1, var2, nch2) from ts_4893.meters order by ts limit 5
select replace(nch1, var2, nch2) from ts_4893.meters where position(var2 IN nch1) != 0 order by ts limit 5
select replace(nch1, var2, nch2) from ts_4893.meters where position(var2 IN nch1) = 0 order by ts limit 5
select replace(var1, 'a', 'b') from ts_4893.meters order by ts limit 5
select replace(var1, 'a', 'b') from ts_4893.meters where position('a' IN var1) != 0 order by ts limit 5
select replace(var1, 'a', 'b') from ts_4893.meters where position('a' IN var1) = 0 order by ts limit 5
select replace(var1, 'a', '啊') from ts_4893.meters order by ts limit 5
select replace(var1, 'a', '啊') from ts_4893.meters where position('a' IN var1) != 0 order by ts limit 5
select replace(var1, 'a', '啊') from ts_4893.meters where position('a' IN var1) = 0 order by ts limit 5
select replace(var1, '一', '壹') from ts_4893.meters order by ts limit 5
select replace(var1, '一', '壹') from ts_4893.meters where position('一' IN var1) != 0 order by ts limit 5
select replace(var1, '一', '壹') from ts_4893.meters where position('一' IN var1) = 0 order by ts limit 5
select replace(var1, '一', '1') from ts_4893.meters order by ts limit 5
select replace(var1, '一', '1') from ts_4893.meters where position('一' IN var1) != 0 order by ts limit 5
select replace(var1, '一', '1') from ts_4893.meters where position('一' IN var1) = 0 order by ts limit 5
select replace(var1, nch2, 'nch2') from ts_4893.meters order by ts limit 5
select replace(var1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN var1) != 0 order by ts limit 5
select replace(var1, nch2, 'nch2') from ts_4893.meters where position(nch2 IN var1) = 0 order by ts limit 5
select replace(var1, var2, 'var2') from ts_4893.meters order by ts limit 5
select replace(var1, var2, 'var2') from ts_4893.meters where position(var2 IN var1) != 0 order by ts limit 5
select replace(var1, var2, 'var2') from ts_4893.meters where position(var2 IN var1) = 0 order by ts limit 5
select replace(var1, '三', nch2) from ts_4893.meters order by ts limit 5
select replace(var1, '三', nch2) from ts_4893.meters where position('三' IN var1) != 0 order by ts limit 5
select replace(var1, '三', nch2) from ts_4893.meters where position('三' IN var1) = 0 order by ts limit 5
select replace(var1, '三', var2) from ts_4893.meters order by ts limit 5
select replace(var1, '三', var2) from ts_4893.meters where position('三' IN var1) != 0 order by ts limit 5
select replace(var1, '三', var2) from ts_4893.meters where position('三' IN var1) = 0 order by ts limit 5
select replace(var1, nch2, var2) from ts_4893.meters order by ts limit 5
select replace(var1, nch2, var2) from ts_4893.meters where position(nch2 IN var1) != 0 order by ts limit 5
select replace(var1, nch2, var2) from ts_4893.meters where position(nch2 IN var1) = 0 order by ts limit 5
select replace(var1, var2, nch2) from ts_4893.meters order by ts limit 5
select replace(var1, var2, nch2) from ts_4893.meters where position(var2 IN var1) != 0 order by ts limit 5
select replace(var1, var2, nch2) from ts_4893.meters where position(var2 IN var1) = 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, 'nch2') from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', nch2, var2) from ts_4893.meters where position(nch2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, 'var2') from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') != 0 order by ts limit 5
select replace('一二三四五六七abcdefghijk213124123', var2, nch2) from ts_4893.meters where position(var2 IN '一二三四五六七abcdefghijk213124123') = 0 order by ts limit 5
select replace('aabbccdd','aa', 'ee')
select replace('aabbccdd','AA', 'ee')
select replace('北京','北' , '南')
select replace('北京','京' , '南')
select replace('北京taos','北' , '南')
select replace(nch1, nch2, 't') from ts_4893.d0 order by ts limit 10
select replace(nch1, nch2, 't') from ts_4893.meters order by ts limit 10
select replace(nch1, var2, 't') from ts_4893.d0 order by ts limit 10
select replace(nch1, var2, 't') from ts_4893.meters order by ts limit 10
select replace(var1, nch2, 't') from ts_4893.d0 order by ts limit 10
select replace(var1, nch2, 't') from ts_4893.meters order by ts limit 10
select replace(var1, var2, 't') from ts_4893.d0 order by ts limit 10
select replace(var1, var2, 't') from ts_4893.meters order by ts limit 10
select replace(nch1, nch2, var1) from ts_4893.d0 order by ts limit 10
select replace(nch1, nch2, var1) from ts_4893.meters order by ts limit 10
select replace(null, 'aa', 'ee')
select replace(null, 'A', 'B')
select replace('', '', 'B')
select replace('', 'A', 'B')
select replace('A', 'A', '')
select replace('aabbccdd', null, 'ee')
select replace('Hello', 'Z', 'X')
select replace('Hello World', ' ', '_')
select replace('Hello World', 'World', 'MySQL')
select replace('12345', '5', 'five')
select replace('中国', '中', '国')
select replace('é', 'e', 'a')
select replace('!@#', '@', '#')
select replace('123456', '7', 'eight')
select replace(concat('A', 'B', 'C'), 'B', 'Z')
select replace(upper('abc'), 'A', 'X')
select replace(trim(' Hello '), 'l', 'L')
select replace(lower('HELLO'), 'h', 'H')
select name, replace(substring(name, 1, 5), 'e', 'o') from ts_4893.meters limit 1
select name, replace(name, 'a', 'o') from ts_4893.meters limit 1
select var1, replace(var1, '1', 'one') from ts_4893.meters limit 1
select nch1, replace(nch1, 'n', 'm') from ts_4893.meters limit 1

View File

@ -1,30 +1,49 @@
select ROUND(10.55, 3);
select ROUND(10.55, 2);
select ROUND(10.55, 1);
select ROUND(10.55, 0);
select ROUND(10.55);
select ROUND(10.55, -1);
select ROUND(10.55, -10);
select ROUND(-10.55, 1);
select ROUND(99, 1);
select ROUND(111.1111);
select ROUND(111.5111);
select ROUND(10.55) + 1;
select ROUND(10.55, 1) + 1;
select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4));
select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6));
select ROUND(current) from ts_4893.meters order by ts limit 20;
select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10;
select ROUND(current, id) from ts_4893.meters order by ts limit 10;
select ROUND(current, 1) from ts_4893.meters order by ts limit 10;
select round(10.55, 3);
select round(10.55, 2);
select round(10.55, 1);
select round(10.55, 0);
select round(10.55);
select round(10.55, -1);
select round(10.55, -10);
select round(-10.55, 1);
select round(99, 1);
select round(current) from ts_4893.d0 order by ts limit 10;
select round(current) from ts_4893.meters order by ts limit 10;
select ROUND(10.55, 3)
select ROUND(10.55, 2)
select ROUND(10.55, 1)
select ROUND(10.55, 0)
select ROUND(10.55)
select ROUND(10.55, -1)
select ROUND(10.55, -10)
select ROUND(-10.55, 1)
select ROUND(99, 1)
select ROUND(111.1111)
select ROUND(111.5111)
select ROUND(10.55) + 1
select ROUND(10.55, 1) + 1
select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
select ROUND(current) from ts_4893.meters order by ts limit 20
select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
select ROUND(current, id) from ts_4893.meters order by ts limit 10
select ROUND(current, 1) from ts_4893.meters order by ts limit 10
select round(10.55, 3)
select round(10.55, 2)
select round(10.55, 1)
select round(10.55, 0)
select round(10.55)
select round(10.55, -1)
select round(10.55, -10)
select round(-10.55, 1)
select round(99, 1)
select round(current) from ts_4893.d0 order by ts limit 10
select round(current) from ts_4893.meters order by ts limit 10
select round(10, null)
select round(null, 2)
select round(123.456, null)
select round(100)
select round(0.00123, -2)
select round(123.456, 0)
select round(123.456, -5)
select round(12345.6789, -2)
select round(-123.456, 2)
select round(-1234.5678, 2)
select round(voltage, 0) from ts_4893.meters limit 1
select round(current, 1) from ts_4893.meters limit 1
select round(phase, 3) from ts_4893.meters limit 1
select round(voltage, -1) from ts_4893.meters limit 1
select round(current * voltage, 2) from ts_4893.meters limit 1
select round(abs(voltage), 2) from ts_4893.meters limit 1
select round(pi() * phase, 3) from ts_4893.meters limit 1
select round(sqrt(voltage), 2) from ts_4893.meters limit 1
select round(log(current), 2) from ts_4893.meters limit 1

View File

@ -1,36 +1,48 @@
select SIGN(0);
select SIGN(1);
select SIGN(1.5);
select SIGN(100);
select SIGN(-1);
select SIGN(-1.5);
select SIGN(-100);
select SIGN(1) + 1;
select SIGN(1) - 1;
select SIGN(1) * 1;
select SIGN(1) / 1;
select SIGN(1) from ts_4893.meters limit 5;
select SIGN(1) + 1 from ts_4893.meters limit 1;
select SIGN(1) - 1 from ts_4893.meters limit 1;
select SIGN(1) * 2 from ts_4893.meters limit 1;
select SIGN(1) / 2 from ts_4893.meters limit 1;
select SIGN(2) + SIGN(1) from ts_4893.meters limit 1;
select SIGN(2) - SIGN(1) from ts_4893.meters limit 1;
select SIGN(2) * SIGN(1) from ts_4893.meters limit 1;
select SIGN(2) / SIGN(1) from ts_4893.meters limit 1;
select SIGN(1) + id from ts_4893.meters order by ts limit 5;
select SIGN(id) + id from ts_4893.meters order by ts limit 5;
select SIGN(abs(10));
select SIGN(abs(-10));
select abs(SIGN(10));
select pow(SIGN(10), 2);
select sqrt(SIGN(10));
select cast(SIGN(10) as int);
select SIGN(sqrt(id)) from ts_4893.meters order by ts limit 5;
select SIGN(SIGN(SIGN(SIGN(0))));
select sign(1);
select sign(10);
select sign(-1);
select sign(-10);
select sign(current) from ts_4893.d0 order by ts limit 10;
select sign(current) from ts_4893.meters order by ts limit 10;
select SIGN(0)
select SIGN(1)
select SIGN(1.5)
select SIGN(100)
select SIGN(-1)
select SIGN(-1.5)
select SIGN(-100)
select SIGN(1) + 1
select SIGN(1) - 1
select SIGN(1) * 1
select SIGN(1) / 1
select SIGN(1) from ts_4893.meters limit 5
select SIGN(1) + 1 from ts_4893.meters limit 1
select SIGN(1) - 1 from ts_4893.meters limit 1
select SIGN(1) * 2 from ts_4893.meters limit 1
select SIGN(1) / 2 from ts_4893.meters limit 1
select SIGN(2) + SIGN(1) from ts_4893.meters limit 1
select SIGN(2) - SIGN(1) from ts_4893.meters limit 1
select SIGN(2) * SIGN(1) from ts_4893.meters limit 1
select SIGN(2) / SIGN(1) from ts_4893.meters limit 1
select SIGN(1) + id from ts_4893.meters order by ts limit 5
select SIGN(id) + id from ts_4893.meters order by ts limit 5
select SIGN(abs(10))
select SIGN(abs(-10))
select abs(SIGN(10))
select pow(SIGN(10), 2)
select sqrt(SIGN(10))
select cast(SIGN(10) as int)
select SIGN(sqrt(id)) from ts_4893.meters order by ts limit 5
select SIGN(SIGN(SIGN(SIGN(0))))
select sign(1)
select sign(10)
select sign(-1)
select sign(-10)
select sign(current) from ts_4893.d0 order by ts limit 10
select sign(current) from ts_4893.meters order by ts limit 10
select sign(null)
select sign(25)
select sign(-10)
select sign(0.1)
select sign(-0.1)
select sign(current) from ts_4893.meters limit 1
select sign(voltage) from ts_4893.meters limit 1
select sign(phase) from ts_4893.meters limit 1
select sign(abs(voltage)) from ts_4893.meters limit 1
select sign(round(current)) from ts_4893.meters limit 1
select sign(sqrt(voltage)) from ts_4893.meters limit 1
select sign(log(current + 1)) from ts_4893.meters limit 1

View File

@ -1,10 +1,22 @@
select STDDEV(current) from ts_4893.meters;
select STDDEV(current) from ts_4893.meters interval(1d) order by 1 limit 10;
select STDDEV(id) from ts_4893.meters;
select STDDEV(id) from ts_4893.meters interval(1d) limit 10;
select STDDEV(id) from ts_4893.meters where id > 100;
select STDDEV(id) from ts_4893.meters interval(1d) order by 1 limit 10;
select stddev_pop(id) from ts_4893.d0;
select stddev_pop(id) from ts_4893.meters;
select stddev_pop(current) from ts_4893.d0;
select stddev_pop(current) from ts_4893.meters;
select STDDEV(current) from ts_4893.meters
select STDDEV(current) from ts_4893.meters interval(1d) order by 1 limit 10
select STDDEV(id) from ts_4893.meters
select STDDEV(id) from ts_4893.meters interval(1d) limit 10
select STDDEV(id) from ts_4893.meters where id > 100
select STDDEV(id) from ts_4893.meters interval(1d) order by 1 limit 10
select stddev_pop(null) from ts_4893.meters
select stddev_pop(id) from ts_4893.d0
select stddev_pop(id) from ts_4893.meters
select stddev_pop(current) from ts_4893.d0
select stddev_pop(current) from ts_4893.meters
select stddev_pop(voltage) from ts_4893.meters
select stddev_pop(voltage) from ts_4893.meters where voltage is not null
select stddev_pop(phase) from ts_4893.meters
select stddev_pop(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
select stddev_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
select round(stddev_pop(current), 2) from ts_4893.meters
select pow(stddev_pop(current), 2) from ts_4893.meters
select log(stddev_pop(voltage) + 1) from ts_4893.meters
select groupid, stddev_pop(voltage) from ts_4893.meters group by groupid order by groupid
select location, stddev_pop(current) from ts_4893.meters group by location order by location
select location, stddev_pop(voltage) from ts_4893.meters group by location order by location

View File

@ -1,139 +1,165 @@
select SUBSTRING('Hello.World!', 1);
select SUBSTRING('Hello.World!', 1, 5);
select SUBSTRING('Hello.World!', 1, 20);
select SUBSTRING('Hello.World!' FROM 1);
select SUBSTRING('Hello.World!' FROM 1 FOR 5);
select SUBSTRING('Hello.World!' FROM 1 FOR 20);
select SUBSTRING('Hello.World!', -6);
select SUBSTRING('Hello.World!', -6, 5);
select SUBSTRING('Hello.World!', -6, 20);
select SUBSTRING('Hello.World!' FROM -6);
select SUBSTRING('Hello.World!' FROM -6 FOR 5);
select SUBSTRING('Hello.World!' FROM -6 FOR 20);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1, 5);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1, 20);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 5);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 20);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6, 5);
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6, 20);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 5);
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 20);
select SUBSTRING(nch1, 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, 1, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, 1, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM 1 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM 1 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, -6, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, -6, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM -6 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM -6 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(var1, 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, 1, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, 1, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM 1 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM 1 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, -6, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, -6, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM -6 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM -6 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(nch1, sign(id), 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, sign(id), 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1, sign(id), 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM sign(id)) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(var1, sign(id), 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, sign(id), 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1, sign(id), 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM sign(id)) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(nch1, 2, id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(nch1 FROM 2 FOR id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTRING(var1, 2, id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTRING(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR('Hello.World!', 1);
select SUBSTR('Hello.World!', 1, 5);
select SUBSTR('Hello.World!', 1, 20);
select SUBSTR('Hello.World!' FROM 1);
select SUBSTR('Hello.World!' FROM 1 FOR 5);
select SUBSTR('Hello.World!' FROM 1 FOR 20);
select SUBSTR('Hello.World!', -6);
select SUBSTR('Hello.World!', -6, 5);
select SUBSTR('Hello.World!', -6, 20);
select SUBSTR('Hello.World!' FROM -6);
select SUBSTR('Hello.World!' FROM -6 FOR 5);
select SUBSTR('Hello.World!' FROM -6 FOR 20);
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1);
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1, 5);
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1, 20);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 5);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 20);
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6);
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6, 5);
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6, 20);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 5);
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 20);
select SUBSTR(nch1, 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, 1, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, 1, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM 1 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM 1 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, -6, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, -6, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM -6 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM -6 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(var1, 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, 1, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, 1, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM 1 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM 1 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, -6, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, -6, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM -6 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM -6 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(nch1, sign(id), 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, sign(id), 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1, sign(id), 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM sign(id)) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(var1, sign(id), 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, sign(id), 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1, sign(id), 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM sign(id)) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(nch1, 2, id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(nch1 FROM 2 FOR id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5;
select SUBSTR(var1, 2, id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select SUBSTR(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5;
select substring('tdengine', 2);
select substring('tdengine', 8);
select substring('tdengine', 1, 3);
select substring('tdengine', 2, 99);
select substring('tdengine', -1, 10);
select substring('中国', 1, 3);
select substring('中国tdengine', 1, 3);
select substring(var1, 1, 5) from ts_4893.d0 order by ts limit 10;
select substring(var1, 1, 5) from ts_4893.meters order by ts limit 10;
select substring(nch1, 1, 5) from ts_4893.d0 order by ts limit 10;
select substring(nch1, 1, 5) from ts_4893.meters order by ts limit 10;
select SUBSTRING('Hello.World!', 1)
select SUBSTRING('Hello.World!', 1, 5)
select SUBSTRING('Hello.World!', 1, 20)
select SUBSTRING('Hello.World!' FROM 1)
select SUBSTRING('Hello.World!' FROM 1 FOR 5)
select SUBSTRING('Hello.World!' FROM 1 FOR 20)
select SUBSTRING('Hello.World!', -6)
select SUBSTRING('Hello.World!', -6, 5)
select SUBSTRING('Hello.World!', -6, 20)
select SUBSTRING('Hello.World!' FROM -6)
select SUBSTRING('Hello.World!' FROM -6 FOR 5)
select SUBSTRING('Hello.World!' FROM -6 FOR 20)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1, 5)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', 1, 20)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 5)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 20)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6, 5)
select SUBSTRING('北京涛思数据科技有限公司tdengine.', -6, 20)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 5)
select SUBSTRING('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 20)
select SUBSTRING(nch1, 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, 1, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, 1, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM 1 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM 1 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, -6, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, -6, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM -6 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM -6 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(var1, 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, 1, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, 1, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM 1 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM 1 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, -6, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, -6, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM -6 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM -6 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(nch1, sign(id), 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, sign(id), 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1, sign(id), 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM sign(id)) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(var1, sign(id), 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, sign(id), 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1, sign(id), 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM sign(id)) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(nch1, 2, id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(nch1 FROM 2 FOR id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTRING(var1, 2, id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTRING(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR('Hello.World!', 1)
select SUBSTR('Hello.World!', 1, 5)
select SUBSTR('Hello.World!', 1, 20)
select SUBSTR('Hello.World!' FROM 1)
select SUBSTR('Hello.World!' FROM 1 FOR 5)
select SUBSTR('Hello.World!' FROM 1 FOR 20)
select SUBSTR('Hello.World!', -6)
select SUBSTR('Hello.World!', -6, 5)
select SUBSTR('Hello.World!', -6, 20)
select SUBSTR('Hello.World!' FROM -6)
select SUBSTR('Hello.World!' FROM -6 FOR 5)
select SUBSTR('Hello.World!' FROM -6 FOR 20)
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1)
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1, 5)
select SUBSTR('北京涛思数据科技有限公司tdengine.', 1, 20)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 5)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM 1 FOR 20)
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6)
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6, 5)
select SUBSTR('北京涛思数据科技有限公司tdengine.', -6, 20)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 5)
select SUBSTR('北京涛思数据科技有限公司tdengine.' FROM -6 FOR 20)
select SUBSTR(nch1, 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, 1, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, 1, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM 1 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM 1 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, -6, 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, -6, 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM -6) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM -6 FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM -6 FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(var1, 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, 1, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, 1, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM 1 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM 1 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, -6, 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, -6, 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM -6) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM -6 FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM -6 FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(nch1, sign(id), 1) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, sign(id), 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1, sign(id), 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM sign(id)) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(var1, sign(id), 1) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, sign(id), 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1, sign(id), 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM sign(id)) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM sign(id) FOR 5) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM sign(id) FOR 20) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(nch1, 2, id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(nch1 FROM 2 FOR id) from ts_4893.meters where char_length(nch1) > 6 order by ts limit 5
select SUBSTR(var1, 2, id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select SUBSTR(var1 FROM 2 FOR id) from ts_4893.meters where char_length(var1) > 6 order by ts limit 5
select substring('tdengine', 2)
select substring('tdengine', 8)
select substring('tdengine', 1, 3)
select substring('tdengine', 2, 99)
select substring('tdengine', -1, 10)
select substring('中国', 1, 3)
select substring('中国tdengine', 1, 3)
select substring(var1, 1, 5) from ts_4893.d0 order by ts limit 10
select substring(var1, 1, 5) from ts_4893.meters order by ts limit 10
select substring(nch1, 1, 5) from ts_4893.d0 order by ts limit 10
select substring(nch1, 1, 5) from ts_4893.meters order by ts limit 10
select substring(null, 1, 3)
select substring('tdengine', null, 3)
select substring('tdengine', 0)
select substring('tdengine', 10)
select substring('tdengine', 1, null)
select substring('tdengine', 1, 0)
select substring('tdengine', 1, -1)
select substr(null, 1, 3)
select substr('Hello', 1, 3)
select substr('', 1, 5)
select substr('ABCDE', 0, 3)
select substr('ABCDEFG', -3, 2)
select substr('HelloWorld', 2, 5)
select substr('1234567890', -5, 5)
select substr('!@#$%^&*()', 2, 4)
select substr('你好世界', 3, 2)
select substr('ABCDEFG', 10, 5)
select substr('ABCDEFG', -1, 3)
select substr('1234567890', -15, 5)
select substr(concat('Hello', 'World'), 1, 5)
select substr('HelloWorld', 1, length('Hello'))
select substr(upper('helloworld'), 2, 4)
select substr(trim(' HelloWorld '), 1, 5)
select name, substr(name, 1, 3) from ts_4893.meters limit 1
select var1, substr(var1, 1, 6) from ts_4893.meters limit 1
select nch1, substr(nch1, 2, 4) from ts_4893.meters limit 1

View File

@ -1,93 +1,119 @@
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
select substring_index('www.taosdata.com','taos',1);
select substring_index('www.taosdata.com','taos',-1);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 1);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -1);
select substring_index('www.taosdata.com','.',-2);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 100);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -100);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483647);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483647);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483648);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483648);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483649);
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483649);
select substring_index('.taosdata.com','.',-2);
select substring_index('.taosdata.com','.tcx',-1);
select substring_index('aaaaaaaaa1','aa',2);
select substring_index('aaaaaaaaa1','aa',3);
select substring_index('aaaaaaaaa1','aa',4);
select substring_index('aaaaaaaaa1','aa',5);
select substring_index('aaaaaaaaa1','aaa',2);
select substring_index('aaaaaaaaa1','aaa',3);
select substring_index('aaaaaaaaa1','aaa',4);
select substring_index('aaaaaaaaa1','aaaa',2);
select substring_index('aaaaaaaaa1','1',1);
select substring_index('aaaaaaaaa1','a',-1);
select substring_index('aaaaaaaaa1','aa',-1);
select substring_index('aaaaaaaaa1','aa',-2);
select substring_index('aaaaaaaaa1','aa',-3);
select substring_index('aaaaaaaaa1','aa',-4);
select substring_index('aaaaaaaaa1','aa',-5);
select substring_index('aaaaaaaaa1','aaa',-1);
select substring_index('aaaaaaaaa1','aaa',-2);
select substring_index('aaaaaaaaa1','aaa',-3);
select substring_index('aaaaaaaaa1','aaa',-4);
select substring_index('the king of thethe hill','the',-2);
select substring_index('the king of the the hill','the',-2);
select substring_index('the king of the the hill','the',-2);
select substring_index('the king of the the hill',' the ',-1);
select substring_index('the king of the the hill',' the ',-2);
select substring_index('the king of the the hill',' ',-1);
select substring_index('the king of the the hill',' ',-2);
select substring_index('the king of the the hill',' ',-3);
select substring_index('the king of the the hill',' ',-4);
select substring_index('the king of the the hill',' ',-5);
select substring_index('the king of the.the hill','the',-2);
select substring_index('the king of thethethe.the hill','the',-3);
select substring_index('the king of thethethe.the hill','the',-1);
select substring_index('the king of the the hill','the',2);
select substring_index('the king of the the hill','the',3);
select substring_index(nch1, nch2, 1) from ts_4893.meters where position(nch2 in nch1) > 1 order by ts limit 5;
select substring_index(nch1, nch2, 1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select substring_index(nch1, nch2, -2) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5;
select substring_index(nch1, nch2, -2) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select substring_index(var1, var2, 1) from ts_4893.meters where position(var2 in var1) > 1 order by ts limit 5;
select substring_index(var1, var2, 1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select substring_index(var1, var2, -2) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5;
select substring_index(var1, var2, -2) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select substring_index(nch1, var2, 1) from ts_4893.meters where position(var2 in nch1) > 1 order by ts limit 5;
select substring_index(nch1, var2, 1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select substring_index(nch1, var2, -2) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5;
select substring_index(nch1, var2, -2) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select substring_index(var1, nch2, 1) from ts_4893.meters where position(nch2 in var1) > 1 order by ts limit 5;
select substring_index(var1, nch2, 1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select substring_index(var1, nch2, -2) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5;
select substring_index(var1, nch2, -2) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', nch2, 1) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', nch2, -1) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', nch2, cast(id + 1 as int)) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') = 0 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', var2, 1) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', var2, -1) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5;
select substring_index('a一二三a一二三bbcfp', var2, cast(id + 1 as int)) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') = 0 order by ts limit 5;
select substring_index(nch1, '123', 1) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5;
select substring_index(nch1, '123', -1) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5;
select substring_index(nch1, '123', id) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5;
select substring_index(var1, '123', 1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5;
select substring_index(var1, '123', -1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5;
select substring_index(var1, '123', id) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5;
select substring_index('www.taosdata.com', '.', 2);
select substring_index('www.taosdata.com', '.', -2);
select substring_index('中国.科学.www.taosdata.com', '.', 2);
select substring_index('北京。涛思。数据。科技', '。', 2);
select substring_index(nch1, 'a', 2) from ts_4893.d0 order by ts limit 10;
select substring_index(nch1, 'a', 2) from ts_4893.meters order by ts limit 10;
select substring_index(nch1, nch2, 2) from ts_4893.d0 order by ts limit 10;
select substring_index(nch1, nch2, 2) from ts_4893.meters order by ts limit 10;
select substring_index(nch1, var2, 2) from ts_4893.d0 order by ts limit 10;
select substring_index(nch1, var2, 2) from ts_4893.meters order by ts limit 10;
select substring_index(var1, nch2, 2) from ts_4893.d0 order by ts limit 10;
select substring_index(var1, nch2, 2) from ts_4893.meters order by ts limit 10;
select substring_index(var1, var2, 2) from ts_4893.d0 order by ts limit 10;
select substring_index(var1, var2, 2) from ts_4893.meters order by ts limit 10;
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
select substring_index('www.taosdata.com','taos',1)
select substring_index('www.taosdata.com','taos',-1)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 1)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -1)
select substring_index('www.taosdata.com','.',-2)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 100)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -100)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483647)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483647)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483648)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483648)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', 2147483649)
SELECT SUBSTRING_INDEX('www.taosdata.com', '.', -2147483649)
select substring_index('.taosdata.com','.',-2)
select substring_index('.taosdata.com','.tcx',-1)
select substring_index('aaaaaaaaa1','aa',2)
select substring_index('aaaaaaaaa1','aa',3)
select substring_index('aaaaaaaaa1','aa',4)
select substring_index('aaaaaaaaa1','aa',5)
select substring_index('aaaaaaaaa1','aaa',2)
select substring_index('aaaaaaaaa1','aaa',3)
select substring_index('aaaaaaaaa1','aaa',4)
select substring_index('aaaaaaaaa1','aaaa',2)
select substring_index('aaaaaaaaa1','1',1)
select substring_index('aaaaaaaaa1','a',-1)
select substring_index('aaaaaaaaa1','aa',-1)
select substring_index('aaaaaaaaa1','aa',-2)
select substring_index('aaaaaaaaa1','aa',-3)
select substring_index('aaaaaaaaa1','aa',-4)
select substring_index('aaaaaaaaa1','aa',-5)
select substring_index('aaaaaaaaa1','aaa',-1)
select substring_index('aaaaaaaaa1','aaa',-2)
select substring_index('aaaaaaaaa1','aaa',-3)
select substring_index('aaaaaaaaa1','aaa',-4)
select substring_index('the king of thethe hill','the',-2)
select substring_index('the king of the the hill','the',-2)
select substring_index('the king of the the hill','the',-2)
select substring_index('the king of the the hill',' the ',-1)
select substring_index('the king of the the hill',' the ',-2)
select substring_index('the king of the the hill',' ',-1)
select substring_index('the king of the the hill',' ',-2)
select substring_index('the king of the the hill',' ',-3)
select substring_index('the king of the the hill',' ',-4)
select substring_index('the king of the the hill',' ',-5)
select substring_index('the king of the.the hill','the',-2)
select substring_index('the king of thethethe.the hill','the',-3)
select substring_index('the king of thethethe.the hill','the',-1)
select substring_index('the king of the the hill','the',2)
select substring_index('the king of the the hill','the',3)
select substring_index(nch1, nch2, 1) from ts_4893.meters where position(nch2 in nch1) > 1 order by ts limit 5
select substring_index(nch1, nch2, 1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select substring_index(nch1, nch2, -2) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
select substring_index(nch1, nch2, -2) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select substring_index(var1, var2, 1) from ts_4893.meters where position(var2 in var1) > 1 order by ts limit 5
select substring_index(var1, var2, 1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select substring_index(var1, var2, -2) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5
select substring_index(var1, var2, -2) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select substring_index(nch1, var2, 1) from ts_4893.meters where position(var2 in nch1) > 1 order by ts limit 5
select substring_index(nch1, var2, 1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select substring_index(nch1, var2, -2) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5
select substring_index(nch1, var2, -2) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select substring_index(var1, nch2, 1) from ts_4893.meters where position(nch2 in var1) > 1 order by ts limit 5
select substring_index(var1, nch2, 1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select substring_index(var1, nch2, -2) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5
select substring_index(var1, nch2, -2) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', nch2, 1) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', nch2, -1) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', nch2, cast(id + 1 as int)) from ts_4893.meters where position(nch2 in 'a一二三a一二三bbcfp') = 0 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', var2, 1) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', var2, -1) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') > 1 order by ts limit 5
select substring_index('a一二三a一二三bbcfp', var2, cast(id + 1 as int)) from ts_4893.meters where position(var2 in 'a一二三a一二三bbcfp') = 0 order by ts limit 5
select substring_index(nch1, '123', 1) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5
select substring_index(nch1, '123', -1) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5
select substring_index(nch1, '123', id) from ts_4893.meters where position('123' in nch1) > 1 order by ts limit 5
select substring_index(var1, '123', 1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5
select substring_index(var1, '123', -1) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5
select substring_index(var1, '123', id) from ts_4893.meters where position('123' in var1) > 1 order by ts limit 5
select substring_index('www.taosdata.com', '.', 2)
select substring_index('www.taosdata.com', '.', -2)
select substring_index('中国.科学.www.taosdata.com', '.', 2)
select substring_index('北京。涛思。数据。科技', '。', 2)
select substring_index(nch1, 'a', 2) from ts_4893.d0 order by ts limit 10
select substring_index(nch1, 'a', 2) from ts_4893.meters order by ts limit 10
select substring_index(nch1, nch2, 2) from ts_4893.d0 order by ts limit 10
select substring_index(nch1, nch2, 2) from ts_4893.meters order by ts limit 10
select substring_index(nch1, var2, 2) from ts_4893.d0 order by ts limit 10
select substring_index(nch1, var2, 2) from ts_4893.meters order by ts limit 10
select substring_index(var1, nch2, 2) from ts_4893.d0 order by ts limit 10
select substring_index(var1, nch2, 2) from ts_4893.meters order by ts limit 10
select substring_index(var1, var2, 2) from ts_4893.d0 order by ts limit 10
select substring_index(var1, var2, 2) from ts_4893.meters order by ts limit 10
select substring_index(null, '.', 2)
select substring_index('www.taosdata.com', null, 2)
select substring_index('www.taosdata.com', '.', 0)
select substring_index('www.taosdata.com', '.', null)
select substring_index('a.b.c', '.', 1)
select substring_index('a.b.c', '.', 2)
select substring_index('a.b.c', '.', -1)
select substring_index('', '.', 1)
select substring_index('apple.orange.banana', '.', 2)
select substring_index('192.168.1.1', '.', 3)
select substring_index('abc@xyz.com', '.', 5)
select substring_index('123456789', '.', 1)
select substring_index('abcdef', ' ', 2)
select substring_index('ABCDEFG', '-', -1)
select substring_index('apple', '.', -3)
select substring_index(concat('apple', '.', 'orange', '.', 'banana'), '.', 2)
select substring_index('apple.orange.banana', '.', length('apple'))
select substring_index(upper('apple.orange.banana'), '.', 2)
select substring_index(trim(' apple.orange.banana '), '.', 2)
select substring_index(concat('apple', '.', 'orange', '.', 'banana'), '.', 2)
select substring_index('apple.orange.banana', '.', length('apple'))
select substring_index(upper('apple.orange.banana'), '.', 2)
select substring_index(trim(' apple.orange.banana '), '.', 2)
select name, substring_index(name, ' ', 1) from ts_4893.meters limit 1
select var1, substring_index(var1, '-', -1) from ts_4893.meters limit 1
select nch1, substring_index(nch1, ',', 3) from ts_4893.meters limit 1

View File

@ -1,91 +1,108 @@
select TIMEDIFF(1,2);
select TIMEDIFF(2,1);
select TIMEDIFF(1,2,1s);
select TIMEDIFF(2,1,1s);
select TIMEDIFF(1,10000000,1m);
select TIMEDIFF(10000000,1,1m);
select TIMEDIFF(1,10000000,1h);
select TIMEDIFF(10000000,1,1h);
select TIMEDIFF(1,10000000,1d);
select TIMEDIFF(10000000,1,1d);
select TIMEDIFF(1,10000000,1w);
select TIMEDIFF(10000000,1,1w);
select TIMEDIFF(1724404450,1725095657);
select TIMEDIFF(1725095657,1724404450);
select TIMEDIFF(1724404450,1725095657,1s);
select TIMEDIFF(1725095657,1724404450,1s);
select TIMEDIFF(1724404450,1725095657,1m);
select TIMEDIFF(1725095657,1724404450,1m);
select TIMEDIFF(1724404450,1725095657,1h);
select TIMEDIFF(1725095657,1724404450,1h);
select TIMEDIFF(1724404450,1725095657,1d);
select TIMEDIFF(1725095657,1724404450,1d);
select TIMEDIFF(1724404450,1725095657,1w);
select TIMEDIFF(1725095657,1724404450,1w);
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17');
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17');
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1s);
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1s);
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1m);
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1m);
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1h);
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1h);
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1d);
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1d);
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1w);
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1w);
select TIMEDIFF('2024-08-23 17:14:17', 1725095657);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17');
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1s);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1s);
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1m);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1m);
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1h);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1h);
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1d);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1d);
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1w);
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1w);
select TIMEDIFF(ts, ts) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17') from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1s) from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts, 1s) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1m) from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts, 1m) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1h) from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts, 1h) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1d) from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts, 1d) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1w) from ts_4893.meters order by ts limit 10;
select TIMEDIFF('2024-08-31 17:14:17', ts, 1w) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657, 1s) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts, 1s) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657, 1m) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts, 1m) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657, 1h) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts, 1h) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657, 1d) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts, 1d) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(ts, 1725095657, 1w) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1725095657, ts, 1w) from ts_4893.meters order by ts limit 10;
select timediff('2022-01-01 08:00:00', '2022-01-01 08:00:10',1s);
select timediff('2023-01-01 08:00:00', '2022-01-01 08:00:00',1s);
select timediff('2022-01-01 08:00:03', '2022-01-01 08:00:00',1a);
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1m);
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1h);
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1d);
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1w);
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00');
select timediff('2022-01-31 08:00:0', '2022-01-01 08:00:00',1s);
select timediff('2022-01-31', '2022-01-01',1s);
select timediff(1720769589, 1720769529, 1s);
select timediff(1720769589123, 1720769529123, 1s);
select timediff(1720769589, '2022-01-01 08:00:00', 1s);
select timediff('2022-01-01 08:00:00', 1720769589, 1s);
select timediff(1720769589231, '2022-01-01 08:00:00', 1s);
select timediff('2022-01-01 08:00:00', 1720769589123, 1s);
select timediff(ts, 1720769589123, 1a) from ts_4893.d0 order by ts limit 10;
select timediff(ts, 1720769589123, 1a) from ts_4893.meters order by ts limit 10;
select TIMEDIFF(1,2)
select TIMEDIFF(2,1)
select TIMEDIFF(1,2,1s)
select TIMEDIFF(2,1,1s)
select TIMEDIFF(1,10000000,1m)
select TIMEDIFF(10000000,1,1m)
select TIMEDIFF(1,10000000,1h)
select TIMEDIFF(10000000,1,1h)
select TIMEDIFF(1,10000000,1d)
select TIMEDIFF(10000000,1,1d)
select TIMEDIFF(1,10000000,1w)
select TIMEDIFF(10000000,1,1w)
select TIMEDIFF(1724404450,1725095657)
select TIMEDIFF(1725095657,1724404450)
select TIMEDIFF(1724404450,1725095657,1s)
select TIMEDIFF(1725095657,1724404450,1s)
select TIMEDIFF(1724404450,1725095657,1m)
select TIMEDIFF(1725095657,1724404450,1m)
select TIMEDIFF(1724404450,1725095657,1h)
select TIMEDIFF(1725095657,1724404450,1h)
select TIMEDIFF(1724404450,1725095657,1d)
select TIMEDIFF(1725095657,1724404450,1d)
select TIMEDIFF(1724404450,1725095657,1w)
select TIMEDIFF(1725095657,1724404450,1w)
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17')
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17')
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1s)
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1s)
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1m)
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1m)
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1h)
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1h)
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1d)
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1d)
select TIMEDIFF('2024-08-23 17:14:17', '2024-08-31 17:14:17', 1w)
select TIMEDIFF('2024-08-31 17:14:17', '2024-08-23 17:14:17', 1w)
select TIMEDIFF('2024-08-23 17:14:17', 1725095657)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17')
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1s)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1s)
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1m)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1m)
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1h)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1h)
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1d)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1d)
select TIMEDIFF('2024-08-23 17:14:17', 1725095657, 1w)
select TIMEDIFF(1725095657, '2024-08-23 17:14:17', 1w)
select TIMEDIFF(ts, ts) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17') from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1s) from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts, 1s) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1m) from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts, 1m) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1h) from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts, 1h) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1d) from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts, 1d) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, '2024-08-31 17:14:17', 1w) from ts_4893.meters order by ts limit 10
select TIMEDIFF('2024-08-31 17:14:17', ts, 1w) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657, 1s) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts, 1s) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657, 1m) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts, 1m) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657, 1h) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts, 1h) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657, 1d) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts, 1d) from ts_4893.meters order by ts limit 10
select TIMEDIFF(ts, 1725095657, 1w) from ts_4893.meters order by ts limit 10
select TIMEDIFF(1725095657, ts, 1w) from ts_4893.meters order by ts limit 10
select timediff('2022-01-01 08:00:00', '2022-01-01 08:00:10',1s)
select timediff('2023-01-01 08:00:00', '2022-01-01 08:00:00',1s)
select timediff('2022-01-01 08:00:03', '2022-01-01 08:00:00',1a)
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1m)
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1h)
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1d)
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00',1w)
select timediff('2022-01-31 08:00:00', '2022-01-01 08:00:00')
select timediff('2022-01-31 08:00:0', '2022-01-01 08:00:00',1s)
select timediff('2022-01-31', '2022-01-01',1s)
select timediff(1720769589, 1720769529, 1s)
select timediff(1720769589, '2022-01-01 08:00:00', 1s)
select timediff(1720769589123, 1720769529123, 1s)
select timediff(1720769589231, '2022-01-01 08:00:00', 1s)
select timediff('2022-01-01 08:00:00', 1720769589, 1s)
select timediff('2022-01-01 08:00:00', 1720769589123, 1s)
select timediff(ts, 1720769589123, 1a) from ts_4893.d0 order by ts limit 10
select timediff(ts, 1720769589123, 1a) from ts_4893.meters order by ts limit 10
select timediff(null, '2022-01-01 08:00:01', 1s)
select timediff('20220131', '20220101', 1s)
select timediff('01/31/22', '01/01/22', 1s)
select timediff('22/01/31', '22/01/01')
select timediff('22/01/31', '22/01/01', 1s)
select timediff('31-JAN-22', '01-JAN-22', 1s)
select timediff('2022/01/31', '2022/01/01', 1s)
select timediff('2022-01-01 08:00:00', null, 1s)
select timediff('www', 'ttt')
select timediff(ts, ts) from ts_4893.meters limit 1
select timediff(ts, ts - 1d) from ts_4893.meters limit 1
select timediff(ts, '00:00:00') from ts_4893.meters limit 1
select timediff(ts, null) from ts_4893.meters limit 1
select timediff('25:61:61', ts) from ts_4893.meters limit 1
select timediff('invalid_format', ts) from ts_4893.meters limit 1
select timediff(name, ts) from ts_4893.meters limit 2
select timediff('string_value', 'another_string') from ts_4893.meters limit 1

View File

@ -1,125 +1,144 @@
select trim('foo');
select trim('foo' from 'foobarfoo');
select trim(trailing 'foo' from 'foobarfoo');
select trim(leading 'foo' from 'foobarfoo');
select trim(both 'foo' from 'foobarfoo');
select trim(' blank ');
select trim(both ' ' from ' bla nk ');
select trim(leading ' ' from ' bla nk');
select trim(trailing ' ' from ' bla nk ');
select trim(' ' from ' blank ');
select TRIM(BOTH 'å' FROM 'aæaå');
select trim(' 中文测试 ');
select trim(both ' ' from ' 中文测试 ');
select trim(leading ' ' from ' 中文测试');
select trim(trailing ' ' from ' 中文测试 ');
select trim(' ' from ' 中文测试 ');
select trim('一' from '一二中文测试一');
select trim(both '一' from '一二中文测试一');
select trim(leading '一' from '一二中文测试一');
select trim(trailing '一' from '一二中文测试一');
select trim(' 中文andEnglish测试Test ');
select trim(both ' ' from ' 中文andEnglish测试Test ');
select trim(leading ' ' from ' 中文andEnglish测试Test');
select trim(trailing ' ' from ' 中文andEnglish测试Test ');
select trim('空格' from '空格中文andEngTes空格空格');
select trim(both '空格' from '空格中文andEngTes空格空格');
select trim(leading '空格' from '空格中文andEngTes空格空格');
select trim(trailing '空格' from '空格中文andEngTes空格空格');
select trim('blank' from 'blankblank中文andEnglish测试Tesblankblankblank');
select trim(both 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank');
select trim(leading 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank');
select trim(trailing 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank');
select trim('空格blank' from '空格blank空格中Tes空格blank空');
select trim(both '空格blank' from '空格blank空格中Tes空格blank空');
select trim(leading '空格blank' from '空格blank空格中Tes空格blank空');
select trim(trailing '空格blank' from '空格blank空格中Tes空格blank空');
select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5;
select trim(both nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5;
select trim(leading nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5;
select trim(trailing nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5;
select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select trim(both nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select trim(leading nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select trim(trailing nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5;
select trim(var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5;
select trim(both var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5;
select trim(leading var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5;
select trim(trailing var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5;
select trim(var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select trim(both var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select trim(leading var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select trim(trailing var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5;
select trim(nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5;
select trim(both nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5;
select trim(leading nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5;
select trim(trailing nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5;
select trim(nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select trim(both nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select trim(leading nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select trim(trailing nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5;
select trim(var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5;
select trim(both var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5;
select trim(leading var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5;
select trim(trailing var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5;
select trim(var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select trim(both var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select trim(leading var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select trim(trailing var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5;
select trim('一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5;
select trim(both '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5;
select trim(leading '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5;
select trim(trailing '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5;
select trim('一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5;
select trim(both '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5;
select trim(leading '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5;
select trim(trailing '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5;
select trim('一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5;
select trim(both '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5;
select trim(leading '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5;
select trim(trailing '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5;
select trim('一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5;
select trim(both '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5;
select trim(leading '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5;
select trim(trailing '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5;
select trim(nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(both nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(leading nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(trailing nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(both nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(leading nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(trailing nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(both var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(leading var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(trailing var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5;
select trim(var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(both var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(leading var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(trailing var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5;
select trim(' A ');
select trim(' 涛思 ');
select trim('a' FROM 'aaab bbba');
select trim(LEADING FROM ' aaa ');
select trim(LEADING 'a' FROM ' aaa abab aaaa ');
select trim(LEADING 'a' FROM 'aaa abab aaaa ');
select trim(LEADING '北' FROM '北京涛思数据科技有限公司北');
select trim(LEADING '北' FROM '北bei京涛思数据科技有限公司北');
select trim(TRAILING FROM ' aaa abab aaaa ');
select trim(TRAILING 'a' FROM 'aaa abab aaaa');
select trim(TRAILING 'a' FROM ' aaa abab aaaa');
select trim(TRAILING '北' FROM '北京涛思数据科技有限公司北') as sub;
select trim(TRAILING '北' FROM '北京涛思数据科技有限公司bei北');
select trim(BOTH FROM ' aaa abab aaaa ');
select trim(BOTH 'a' FROM ' aaa abab aaaa ');
select trim(BOTH 'a' FROM 'aaa abab aaaa');
select trim(BOTH '北' FROM '北京涛思数据科技有限公司北');
select trim(nch2 from nch1) from ts_4893.d0 order by ts limit 10;
select trim(nch2 from nch1) from ts_4893.meters order by ts limit 10;
select trim(nch2 from var1) from ts_4893.d0 order by ts limit 10;
select trim(nch2 from var1) from ts_4893.meters order by ts limit 10;
select trim(var2 from nch1) from ts_4893.d0 order by ts limit 10;
select trim(var2 from nch1) from ts_4893.meters order by ts limit 10;
select trim(var2 from var1) from ts_4893.d0 order by ts limit 10;
select trim(var2 from var1) from ts_4893.meters order by ts limit 10;
select trim('foo')
select trim('foo' from 'foobarfoo')
select trim(trailing 'foo' from 'foobarfoo')
select trim(leading 'foo' from 'foobarfoo')
select trim(both 'foo' from 'foobarfoo')
select trim(' blank ')
select trim(both ' ' from ' bla nk ')
select trim(leading ' ' from ' bla nk')
select trim(trailing ' ' from ' bla nk ')
select trim(' ' from ' blank ')
select TRIM(BOTH 'å' FROM 'aæaå')
select trim(' 中文测试 ')
select trim(both ' ' from ' 中文测试 ')
select trim(leading ' ' from ' 中文测试')
select trim(trailing ' ' from ' 中文测试 ')
select trim(' ' from ' 中文测试 ')
select trim('一' from '一二中文测试一')
select trim(both '一' from '一二中文测试一')
select trim(leading '一' from '一二中文测试一')
select trim(trailing '一' from '一二中文测试一')
select trim(' 中文andEnglish测试Test ')
select trim(both ' ' from ' 中文andEnglish测试Test ')
select trim(leading ' ' from ' 中文andEnglish测试Test')
select trim(trailing ' ' from ' 中文andEnglish测试Test ')
select trim('空格' from '空格中文andEngTes空格空格')
select trim(both '空格' from '空格中文andEngTes空格空格')
select trim(leading '空格' from '空格中文andEngTes空格空格')
select trim(trailing '空格' from '空格中文andEngTes空格空格')
select trim('blank' from 'blankblank中文andEnglish测试Tesblankblankblank')
select trim(both 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank')
select trim(leading 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank')
select trim(trailing 'blank' from 'blankblank中文andEnglish测试Tesblankblankblank')
select trim('空格blank' from '空格blank空格中Tes空格blank空')
select trim(both '空格blank' from '空格blank空格中Tes空格blank空')
select trim(leading '空格blank' from '空格blank空格中Tes空格blank空')
select trim(trailing '空格blank' from '空格blank空格中Tes空格blank空')
select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
select trim(both nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
select trim(leading nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
select trim(trailing nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) != 0 order by ts limit 5
select trim(nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select trim(both nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select trim(leading nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select trim(trailing nch2 from nch1) from ts_4893.meters where position(nch2 in nch1) = 0 order by ts limit 5
select trim(var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5
select trim(both var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5
select trim(leading var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5
select trim(trailing var2 from nch1) from ts_4893.meters where position(var2 in nch1) != 0 order by ts limit 5
select trim(var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select trim(both var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select trim(leading var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select trim(trailing var2 from nch1) from ts_4893.meters where position(var2 in nch1) = 0 order by ts limit 5
select trim(nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5
select trim(both nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5
select trim(leading nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5
select trim(trailing nch2 from var1) from ts_4893.meters where position(nch2 in var1) != 0 order by ts limit 5
select trim(nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select trim(both nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select trim(leading nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select trim(trailing nch2 from var1) from ts_4893.meters where position(nch2 in var1) = 0 order by ts limit 5
select trim(var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5
select trim(both var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5
select trim(leading var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5
select trim(trailing var2 from var1) from ts_4893.meters where position(var2 in var1) != 0 order by ts limit 5
select trim(var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select trim(both var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select trim(leading var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select trim(trailing var2 from var1) from ts_4893.meters where position(var2 in var1) = 0 order by ts limit 5
select trim('一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5
select trim(both '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5
select trim(leading '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5
select trim(trailing '一' from nch1) from ts_4893.meters where position('一' in nch1) != 0 order by ts limit 5
select trim('一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5
select trim(both '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5
select trim(leading '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5
select trim(trailing '一' from nch1) from ts_4893.meters where position('一' in nch1) = 0 order by ts limit 5
select trim('一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5
select trim(both '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5
select trim(leading '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5
select trim(trailing '一' from var1) from ts_4893.meters where position('一' in var1) != 0 order by ts limit 5
select trim('一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5
select trim(both '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5
select trim(leading '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5
select trim(trailing '一' from var1) from ts_4893.meters where position('一' in var1) = 0 order by ts limit 5
select trim(nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(both nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(leading nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(trailing nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(both nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(leading nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(trailing nch2 from '三abbcfp三a') from ts_4893.meters where position(nch2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(both var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(leading var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(trailing var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') != 0 order by ts limit 5
select trim(var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(both var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(leading var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(trailing var2 from '三abbcfp三a') from ts_4893.meters where position(var2 in '三abbcfp三a') = 0 order by ts limit 5
select trim(' A ')
select trim(' 涛思 ')
select trim('a' FROM 'aaab bbba')
select trim(LEADING FROM ' aaa ')
select trim(LEADING 'a' FROM ' aaa abab aaaa ')
select trim(LEADING 'a' FROM 'aaa abab aaaa ')
select trim(LEADING '北' FROM '北京涛思数据科技有限公司北')
select trim(LEADING '北' FROM '北bei京涛思数据科技有限公司北')
select trim(TRAILING FROM ' aaa abab aaaa ')
select trim(TRAILING 'a' FROM 'aaa abab aaaa')
select trim(TRAILING 'a' FROM ' aaa abab aaaa')
select trim(TRAILING '北' FROM '北京涛思数据科技有限公司北') as sub
select trim(TRAILING '北' FROM '北京涛思数据科技有限公司bei北')
select trim(BOTH FROM ' aaa abab aaaa ')
select trim(BOTH 'a' FROM ' aaa abab aaaa ')
select trim(BOTH 'a' FROM 'aaa abab aaaa')
select trim(BOTH '北' FROM '北京涛思数据科技有限公司北')
select trim(nch2 from nch1) from ts_4893.d0 order by ts limit 10
select trim(nch2 from nch1) from ts_4893.meters order by ts limit 10
select trim(nch2 from var1) from ts_4893.d0 order by ts limit 10
select trim(nch2 from var1) from ts_4893.meters order by ts limit 10
select trim(var2 from nch1) from ts_4893.d0 order by ts limit 10
select trim(var2 from nch1) from ts_4893.meters order by ts limit 10
select trim(var2 from var1) from ts_4893.d0 order by ts limit 10
select trim(var2 from var1) from ts_4893.meters order by ts limit 10
select trim(null)
select trim('')
select trim(leading ' ' from ' hello')
select trim(trailing ' ' from 'hello ')
select trim('0' from '000123000')
select trim(' hello ')
select trim(' apple banana ')
select var2, trim('*' from var2) from ts_4893.meters limit 1
select trim('x' from 'hello')
select trim('longer' from 'short')
select trim('hello')
select trim(' 12345 ')
select trim(concat(' hello', ' world '))
select trim(upper(' hello world '))
select trim(substring(' hello world ', 4))
select trim(replace(' hello world ', ' ', '-'))
select name, trim(name) from ts_4893.meters limit 1
select var1, trim(trailing '!' from var1) from ts_4893.meters limit 1
select nch1, trim(leading '-' from nch1) from ts_4893.meters limit 1

View File

@ -1,37 +1,54 @@
select TRUNCATE(10.55, 3);
select TRUNCATE(10.55, 2);
select TRUNCATE(10.55, 1);
select TRUNCATE(10.55, 0);
select TRUNCATE(10.55, -1);
select TRUNCATE(10.55, -10);
select TRUNCATE(-10.55, 1);
select TRUNCATE(99, 1);
select TRUNCATE(10.55, 1) + 1;
select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3);
select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7);
select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10;
select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10;
select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10;
select TRUNC(10.55, 3);
select TRUNC(10.55, 2);
select TRUNC(10.55, 1);
select TRUNC(10.55, 0);
select TRUNC(10.55, -1);
select TRUNC(10.55, -10);
select TRUNC(-10.55, 1);
select TRUNC(99, 1);
select TRUNC(10.55, 1) + 1;
select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3);
select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7);
select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10;
select TRUNC(current, id) from ts_4893.meters order by ts limit 10;
select TRUNC(current, 1) from ts_4893.meters order by ts limit 10;
select truncate(99.99, 3);
select truncate(99.99, 2);
select truncate(99.99, 1);
select truncate(99.99, 0);
select truncate(99.99, -1);
select truncate(99.99, -10);
select truncate(99, 1);
select truncate(current, 1) from ts_4893.d0 order by ts limit 10;
select truncate(current, 1) from ts_4893.meters order by ts limit 10;
select TRUNCATE(10.55, 3)
select TRUNCATE(10.55, 2)
select TRUNCATE(10.55, 1)
select TRUNCATE(10.55, 0)
select TRUNCATE(10.55, -1)
select TRUNCATE(10.55, -10)
select TRUNCATE(-10.55, 1)
select TRUNCATE(99, 1)
select TRUNCATE(10.55, 1) + 1
select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3)
select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10
select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10
select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10
select TRUNC(10.55, 3)
select TRUNC(10.55, 2)
select TRUNC(10.55, 1)
select TRUNC(10.55, 0)
select TRUNC(10.55, -1)
select TRUNC(10.55, -10)
select TRUNC(-10.55, 1)
select TRUNC(99, 1)
select TRUNC(10.55, 1) + 1
select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3)
select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10
select TRUNC(current, id) from ts_4893.meters order by ts limit 10
select TRUNC(current, 1) from ts_4893.meters order by ts limit 10
select truncate(99.99, 3)
select truncate(99.99, 2)
select truncate(99.99, 1)
select truncate(99.99, 0)
select truncate(99.99, -1)
select truncate(99.99, -10)
select truncate(99, 1)
select truncate(current, 1) from ts_4893.d0 order by ts limit 10
select truncate(current, 1) from ts_4893.meters order by ts limit 10
select truncate(99.99, null)
select truncate(null, 3)
select truncate(1.0001, 3)
select truncate(2.71828, 4)
select truncate(3.14159, 2)
select truncate(100.9876, 2)
select truncate(99999999999999.9999, 2)
select truncate(-5.678, 2)
select truncate(voltage, 2) from ts_4893.meters limit 1
select truncate(current, 1) from ts_4893.meters limit 1
select truncate(phase, 3) from ts_4893.meters limit 1
select truncate(voltage + current, 2) from ts_4893.meters limit 1
select truncate(voltage, -1) from ts_4893.meters limit 1
select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1
select truncate(abs(current), 1) from ts_4893.meters limit 1
select truncate(exp(phase), 2) from ts_4893.meters limit 1
select truncate(log(current), 1) from ts_4893.meters limit 1

View File

@ -1,10 +1,20 @@
select VAR_POP(current) from ts_4893.meters;
select VAR_POP(current) from ts_4893.meters interval(1d) order by 1 limit 10;
select VAR_POP(id) from ts_4893.meters;
select VAR_POP(id) from ts_4893.meters interval(1d) limit 10;
select VAR_POP(id) from ts_4893.meters where id > 100;
select VAR_POP(id) from ts_4893.meters interval(1d) order by 1 limit 10;
select var_pop(id) from ts_4893.d0;
select var_pop(id) from ts_4893.meters;
select var_pop(current) from ts_4893.d0;
select var_pop(current) from ts_4893.meters;
select VAR_POP(current) from ts_4893.meters
select VAR_POP(current) from ts_4893.meters interval(1d) order by 1 limit 10
select VAR_POP(id) from ts_4893.meters
select VAR_POP(id) from ts_4893.meters interval(1d) limit 10
select VAR_POP(id) from ts_4893.meters where id > 100
select VAR_POP(id) from ts_4893.meters interval(1d) order by 1 limit 10
select var_pop(null) from ts_4893.meters
select var_pop(id) from ts_4893.d0
select var_pop(current) from ts_4893.d0
select var_pop(voltage) from ts_4893.meters
select var_pop(voltage) from ts_4893.meters where voltage is not null
select var_pop(phase) from ts_4893.meters
select var_pop(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
select var_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
select round(var_pop(current), 2) from ts_4893.meters
select pow(var_pop(current), 2) from ts_4893.meters
select log(var_pop(voltage) + 1) from ts_4893.meters
select groupid, var_pop(voltage) from ts_4893.meters group by groupid order by groupid
select location, var_pop(current) from ts_4893.meters group by location order by location
select location, var_pop(voltage) from ts_4893.meters group by location order by location

View File

@ -1,75 +1,93 @@
select WEEK('2020-01-01 00:00:00');
select WEEK('2020-01-01 00:00:00', 0);
select WEEK('2020-01-01 00:00:00', 1);
select WEEK('2020-01-01 00:00:00', 2);
select WEEK('2020-01-01 00:00:00', 3);
select WEEK('2020-01-01 00:00:00', 4);
select WEEK('2020-01-01 00:00:00', 5);
select WEEK('2020-01-01 00:00:00', 6);
select WEEK('2020-01-01 00:00:00', 7);
select WEEK('2021-01-01 00:00:00');
select WEEK('2021-01-01 00:00:00', 0);
select WEEK('2021-01-01 00:00:00', 1);
select WEEK('2021-01-01 00:00:00', 2);
select WEEK('2021-01-01 00:00:00', 3);
select WEEK('2021-01-01 00:00:00', 4);
select WEEK('2021-01-01 00:00:00', 5);
select WEEK('2021-01-01 00:00:00', 6);
select WEEK('2021-01-01 00:00:00', 7);
select WEEK('1998-01-01 00:00:00');
select WEEK('1998-01-01 00:00:00', 0);
select WEEK('1998-01-01 00:00:00', 1);
select WEEK('1998-01-01 00:00:00', 2);
select WEEK('1998-01-01 00:00:00', 3);
select WEEK('1998-01-01 00:00:00', 4);
select WEEK('1998-01-01 00:00:00', 5);
select WEEK('1998-01-01 00:00:00', 6);
select WEEK('1998-01-01 00:00:00', 7);
select WEEK('1998-12-31 00:00:00');
select WEEK('1998-12-31 00:00:00', 0);
select WEEK('1998-12-31 00:00:00', 1);
select WEEK('1998-12-31 00:00:00', 2);
select WEEK('1998-12-31 00:00:00', 3);
select WEEK('1998-12-31 00:00:00', 4);
select WEEK('1998-12-31 00:00:00', 5);
select WEEK('1998-12-31 00:00:00', 6);
select WEEK('1998-12-31 00:00:00', 7);
select WEEK('2000-01-06 00:00:00');
select WEEK('2000-01-06 00:00:00', 0);
select WEEK('2000-01-06 00:00:00', 1);
select WEEK('2000-01-06 00:00:00', 2);
select WEEK('2000-01-06 00:00:00', 3);
select WEEK('2000-01-06 00:00:00', 4);
select WEEK('2000-01-06 00:00:00', 5);
select WEEK('2000-01-06 00:00:00', 6);
select WEEK('2000-01-06 00:00:00', 7);
select WEEK(1725095657);
select WEEK(1725095657, 0);
select WEEK(1725095657, 1);
select WEEK(1725095657, 2);
select WEEK(1725095657, 3);
select WEEK(1725095657, 4);
select WEEK(1725095657, 5);
select WEEK(1725095657, 6);
select WEEK(ts) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 0) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 1) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 2) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 3) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 4) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 5) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 6) from ts_4893.meters order by ts limit 10;
select WEEK(ts, 7) from ts_4893.meters order by ts limit 10;
select week(123);
select week('2000-01-01',0);
select week('2000-01-01',1);
select week('2000-01-01',2);
select week('2000-01-01',3);
select week('2000-01-01',4);
select week('2000-01-01',5);
select week('2000-01-01',6);
select week('2000-01-01',7);
select week(1721020591,0);
select week('2020-01-01 00:00:00', 2);
select week(ts) from ts_4893.d0 order by ts limit 10;
select week(ts) from ts_4893.meters order by ts limit 10;
select WEEK('2020-01-01 00:00:00')
select WEEK('2020-01-01 00:00:00', 0)
select WEEK('2020-01-01 00:00:00', 1)
select WEEK('2020-01-01 00:00:00', 2)
select WEEK('2020-01-01 00:00:00', 3)
select WEEK('2020-01-01 00:00:00', 4)
select WEEK('2020-01-01 00:00:00', 5)
select WEEK('2020-01-01 00:00:00', 6)
select WEEK('2020-01-01 00:00:00', 7)
select WEEK('2021-01-01 00:00:00')
select WEEK('2021-01-01 00:00:00', 0)
select WEEK('2021-01-01 00:00:00', 1)
select WEEK('2021-01-01 00:00:00', 2)
select WEEK('2021-01-01 00:00:00', 3)
select WEEK('2021-01-01 00:00:00', 4)
select WEEK('2021-01-01 00:00:00', 5)
select WEEK('2021-01-01 00:00:00', 6)
select WEEK('2021-01-01 00:00:00', 7)
select WEEK('1998-01-01 00:00:00')
select WEEK('1998-01-01 00:00:00', 0)
select WEEK('1998-01-01 00:00:00', 1)
select WEEK('1998-01-01 00:00:00', 2)
select WEEK('1998-01-01 00:00:00', 3)
select WEEK('1998-01-01 00:00:00', 4)
select WEEK('1998-01-01 00:00:00', 5)
select WEEK('1998-01-01 00:00:00', 6)
select WEEK('1998-01-01 00:00:00', 7)
select WEEK('1998-12-31 00:00:00')
select WEEK('1998-12-31 00:00:00', 0)
select WEEK('1998-12-31 00:00:00', 1)
select WEEK('1998-12-31 00:00:00', 2)
select WEEK('1998-12-31 00:00:00', 3)
select WEEK('1998-12-31 00:00:00', 4)
select WEEK('1998-12-31 00:00:00', 5)
select WEEK('1998-12-31 00:00:00', 6)
select WEEK('1998-12-31 00:00:00', 7)
select WEEK('2000-01-06 00:00:00')
select WEEK('2000-01-06 00:00:00', 0)
select WEEK('2000-01-06 00:00:00', 1)
select WEEK('2000-01-06 00:00:00', 2)
select WEEK('2000-01-06 00:00:00', 3)
select WEEK('2000-01-06 00:00:00', 4)
select WEEK('2000-01-06 00:00:00', 5)
select WEEK('2000-01-06 00:00:00', 6)
select WEEK('2000-01-06 00:00:00', 7)
select WEEK(1725095657)
select WEEK(1725095657, 0)
select WEEK(1725095657, 1)
select WEEK(1725095657, 2)
select WEEK(1725095657, 3)
select WEEK(1725095657, 4)
select WEEK(1725095657, 5)
select WEEK(1725095657, 6)
select WEEK(ts) from ts_4893.meters order by ts limit 10
select WEEK(ts, 0) from ts_4893.meters order by ts limit 10
select WEEK(ts, 1) from ts_4893.meters order by ts limit 10
select WEEK(ts, 2) from ts_4893.meters order by ts limit 10
select WEEK(ts, 3) from ts_4893.meters order by ts limit 10
select WEEK(ts, 4) from ts_4893.meters order by ts limit 10
select WEEK(ts, 5) from ts_4893.meters order by ts limit 10
select WEEK(ts, 6) from ts_4893.meters order by ts limit 10
select WEEK(ts, 7) from ts_4893.meters order by ts limit 10
select week(123)
select week('2000-01-01',0)
select week('2000-01-01',1)
select week('2000-01-01',2)
select week('2000-01-01',3)
select week('2000-01-01',4)
select week('2000-01-01',5)
select week('2000-01-01',6)
select week('2000-01-01',7)
select week(1721020591,0)
select week('2020-01-01 00:00:00', 2)
select week(ts) from ts_4893.d0 order by ts limit 10
select week(ts) from ts_4893.meters order by ts limit 10
select week(null, 0)
select week('abc')
select week('1721020591', 0)
select week('1721020666229', 0)
select week('20200101', 2)
select week('11/01/31', 2)
select week('20/01/01', 2)
select week('01/01/2020', 2)
select week('01-JAN-20', 2)
select week('2023-09-25')
select week('9999-12-31')
select week('2024-02-29 00:00:00')
select week(ts) from ts_4893.meters limit 1
select week(name) from ts_4893.meters limit 1
select week(ts), dayofweek(ts) from ts_4893.meters limit 1
select week(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
select id, week(ts) from ts_4893.meters where id = 1 limit 1
select groupid, sum(week(ts)) from ts_4893.meters group by groupid order by groupid

View File

@ -1,19 +1,38 @@
select WEEKDAY('2020-01-01 00:00:00');
select WEEKDAY('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKDAY('2021-01-01 00:00:00');
select WEEKDAY('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKDAY('1998-01-01 00:00:00');
select WEEKDAY('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKDAY('1998-12-31 00:00:00');
select WEEKDAY('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKDAY('2000-01-06 00:00:00');
select WEEKDAY('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKDAY(1725095657);
select WEEKDAY(1725095657) from ts_4893.meters order by ts limit 10;
select WEEKDAY(ts) from ts_4893.meters order by ts limit 10;
select weekday('2020-01-01');
select weekday(1721020591);
select weekday(1721020666229);
select weekday('2020-01-01 00:00:00');
select weekday(ts) from ts_4893.d0 order by ts limit 10;
select weekday(ts) from ts_4893.meters order by ts limit 10;
select WEEKDAY('2020-01-01 00:00:00')
select WEEKDAY('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKDAY('2021-01-01 00:00:00')
select WEEKDAY('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKDAY('1998-01-01 00:00:00')
select WEEKDAY('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKDAY('1998-12-31 00:00:00')
select WEEKDAY('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKDAY('2000-01-06 00:00:00')
select WEEKDAY('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKDAY(1725095657)
select WEEKDAY(1725095657) from ts_4893.meters order by ts limit 10
select WEEKDAY(ts) from ts_4893.meters order by ts limit 10
select weekday('2020-01-01')
select weekday(1721020591)
select weekday(1721020666229)
select weekday('2020-01-01 00:00:00')
select weekday(ts) from ts_4893.d0 order by ts limit 10
select weekday(ts) from ts_4893.meters order by ts limit 10
select weekday(null)
select weekday('abc')
select weekday('1721020591')
select weekday('1721020666229')
select weekday('01/01/2020')
select weekday('20200101')
select weekday('20/01/01')
select weekday('11/01/32')
select weekday('01-JAN-20')
select weekday('2024-02-29')
select weekday('2023-09-24')
select weekday('2023-09-25')
select weekday('9999-12-31')
select weekday(name) from ts_4893.meters limit 1
select weekday(ts), dayofweek(ts) from ts_4893.meters limit 1
select weekday(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
select weekday(ts) from ts_4893.meters limit 1
select id, weekday(ts) from ts_4893.meters where id = 1 limit 1
select groupid, sum(weekday(ts)) from ts_4893.meters group by groupid order by groupid

View File

@ -1,18 +1,37 @@
select WEEKOFYEAR('2020-01-01 00:00:00');
select WEEKOFYEAR('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR('2021-01-01 00:00:00');
select WEEKOFYEAR('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR('1998-01-01 00:00:00');
select WEEKOFYEAR('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR('1998-12-31 00:00:00');
select WEEKOFYEAR('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR('2000-01-06 00:00:00');
select WEEKOFYEAR('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR(1725095657);
select WEEKOFYEAR(1725095657) from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR(ts) from ts_4893.meters order by ts limit 10;
select weekofyear('2020-01-01');
select weekofyear(1721020666);
select weekofyear(1721020666229);
select weekofyear(ts) from ts_4893.d0 order by ts limit 10;
select weekofyear(ts) from ts_4893.meters order by ts limit 10;
select WEEKOFYEAR('2020-01-01 00:00:00')
select WEEKOFYEAR('2020-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKOFYEAR('2021-01-01 00:00:00')
select WEEKOFYEAR('2021-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKOFYEAR('1998-01-01 00:00:00')
select WEEKOFYEAR('1998-01-01 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKOFYEAR('1998-12-31 00:00:00')
select WEEKOFYEAR('1998-12-31 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKOFYEAR('2000-01-06 00:00:00')
select WEEKOFYEAR('2000-01-06 00:00:00') from ts_4893.meters order by ts limit 10
select WEEKOFYEAR(1725095657)
select WEEKOFYEAR(1725095657) from ts_4893.meters order by ts limit 10
select WEEKOFYEAR(ts) from ts_4893.meters order by ts limit 10
select weekofyear('2020-01-01')
select weekofyear(1721020666)
select weekofyear(1721020666229)
select weekofyear(ts) from ts_4893.d0 order by ts limit 10
select weekofyear(ts) from ts_4893.meters order by ts limit 10
select weekofyear(null)
select weekofyear('1721020591')
select weekofyear('1721020666229')
select weekofyear('abc')
select weekofyear('01/01/2020')
select weekofyear('20200101')
select weekofyear('20/01/01')
select weekofyear('11/01/31')
select weekofyear('01-JAN-20')
select weekofyear('2024-02-29')
select weekofyear('2024-01-01')
select weekofyear('2024-12-31')
select weekofyear('9999-12-31')
select weekofyear(name) from ts_4893.meters limit 1
select weekofyear(ts) from ts_4893.meters limit 1
select weekofyear(ts), dayofweek(ts) from ts_4893.meters limit 1
select weekofyear(timediff(ts, '2024-10-10 09:36:50.172')) from ts_4893.meters limit 1
select id, weekofyear(ts) from ts_4893.meters where id = 1 limit 1
select groupid, sum(weekofyear(ts)) from ts_4893.meters group by groupid order by groupid

View File

@ -11,20 +11,12 @@
# -*- coding: utf-8 -*-
import sys
import time
import random
import taos
import frame
from frame import etool
from frame.etool import *
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.caseBase import *
from frame import etool
from frame.common import *
class TDTestCase(TBase):
@ -36,13 +28,12 @@ class TDTestCase(TBase):
"queryBufferSize": 10240
}
def insertData(self):
def insert_data(self):
tdLog.info(f"insert data.")
# taosBenchmark run
datafile = etool.curFile(__file__, "data/d1001.data")
tdSql.execute("create database ts_4893;")
tdSql.execute(f"use ts_4893;")
tdSql.execute("use ts_4893;")
tdSql.execute("select database();")
tdSql.execute("CREATE STABLE `meters` (`ts` TIMESTAMP, `current` FLOAT, `voltage` INT, `phase` FLOAT, "
"`id` INT, `name` VARCHAR(64), `nch1` NCHAR(50), `nch2` NCHAR(50), `var1` VARCHAR(50), "
@ -63,12 +54,9 @@ class TDTestCase(TBase):
continue
sql_statement += line.strip()
if sql_statement.endswith(';'):
# 去掉末尾的分号
sql_statement = sql_statement.rstrip(';')
tdSql.checkDataCsvByLine(sql_statement, ansFile)
# 清空 sql_statement 以便处理下一条语句
sql_statement = ''
err_file_path = etool.curFile(__file__, f"in/{testCase}.err")
if not os.path.isfile(err_file_path):
@ -80,16 +68,15 @@ class TDTestCase(TBase):
continue
err_statement += line.strip()
if err_statement.endswith(';'):
tdSql.error(err_statement)
err_statement = ''
def test_normal_query_new(self, testCase):
# read sql from .sql file and execute
tdLog.info(f"test normal query.")
tdLog.info("test normal query.")
self.sqlFile = etool.curFile(__file__, f"in/{testCase}.in")
self.ansFile = etool.curFile(__file__, f"ans/{testCase}_1.csv")
self.ansFile = etool.curFile(__file__, f"ans/{testCase}.csv")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
@ -97,531 +84,230 @@ class TDTestCase(TBase):
self.test_normal_query_new("pi")
def test_round(self):
self.test_normal_query("round")
self.test_normal_query_new("round")
tdSql.query("select round(10, null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select round(null, 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select round(name, 2) from ts_4893.meters limit 1;")
def test_exp(self):
self.test_normal_query("exp")
self.test_normal_query_new("exp")
tdSql.query("select exp(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
def test_truncate(self):
self.test_normal_query_new("trunc")
def test_trunc(self):
self.test_normal_query("trunc")
tdSql.query("select truncate(99.99, null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select truncate(null, 3);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select truncate(0.999);")
tdSql.error("select truncate(-1.999);")
tdSql.error("select truncate(null);")
tdSql.error("select truncate(name, 1) from ts_4893.meters limit 1;")
def test_ln(self):
self.test_normal_query("ln")
self.test_normal_query_new("ln")
tdSql.query("select ln(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select ln(name) from ts_4893.meters limit 1;")
def test_mod(self):
self.test_normal_query("mod")
self.test_normal_query_new("mod")
tdSql.query("select mod(null, 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select mod(10, null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select mod(10, 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select mod(name, 2) from ts_4893.meters limit 1;")
def test_sign(self):
self.test_normal_query("sign")
self.test_normal_query_new("sign")
tdSql.query("select sign(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select sign('');")
tdSql.error("select sign('abc');")
tdSql.error("select sign('123');")
tdSql.error("select sign('-456');")
def test_degrees(self):
self.test_normal_query("degrees")
self.test_normal_query_new("degrees")
tdSql.query("select degrees(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select degrees('');")
tdSql.error("select degrees('abc');")
tdSql.error("select degrees('1.57');")
def test_radians(self):
self.test_normal_query("radians")
self.test_normal_query_new("radians")
tdSql.query("select radians(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select radians('');")
tdSql.error("select radians('abc');")
tdSql.error("select radians('45');")
def test_char_length(self):
self.test_normal_query("char_length")
self.test_normal_query_new("char_length")
tdSql.query("select char_length(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select char_length(12345);")
tdSql.error("select char_length(true);")
tdSql.error("select char_length(repeat('a', 1000000));")
tdSql.error("select char_length(id) from ts_4893.meters;")
def test_char(self):
self.test_normal_query("char")
self.test_normal_query_new("char")
tdSql.query("select char(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
res = [[chr(0)], [chr(1)], [chr(2)], [chr(3)], [chr(4)], [chr(5)], [chr(6)], [chr(7)], [chr(8)], [chr(9)]]
tdSql.checkDataMem("select char(id) from ts_4893.d0 limit 10;", res)
tdSql.checkDataMem("select char(id) from ts_4893.meters limit 10;", res)
tdSql.query("select char('ustc');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, chr(0))
result1 = [[chr(0)], [chr(1)], [chr(2)], [chr(3)], [chr(4)], [chr(5)], [chr(6)], [chr(7)], [chr(8)], [chr(9)]]
tdSql.checkDataMem("select char(id) from ts_4893.d0 limit 10;", result1)
tdSql.checkDataMem("select char(id) from ts_4893.meters limit 10;", result1)
result2 = [[chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)]]
tdSql.checkDataMem("select char(nch1) from ts_4893.d0 limit 10;", result2)
tdSql.checkDataMem("select char(nch1) from ts_4893.meters limit 10;", result2)
tdSql.checkDataMem("select char(var1) from ts_4893.d0 limit 10;", result2)
tdSql.checkDataMem("select char(var1) from ts_4893.meters limit 10;", result2)
res = [[chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)], [chr(0)]]
tdSql.checkDataMem("select char(nch1) from ts_4893.d0 limit 10;", res)
tdSql.checkDataMem("select char(nch1) from ts_4893.meters limit 10;", res)
tdSql.checkDataMem("select char(var1) from ts_4893.d0 limit 10;", res)
tdSql.checkDataMem("select char(var1) from ts_4893.meters limit 10;", res)
def test_ascii(self):
self.test_normal_query("ascii")
self.test_normal_query_new("ascii")
tdSql.query("select ascii(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select ascii(123);")
def test_position(self):
self.test_normal_query("position")
tdSql.query("select position('t' in null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select position(null in 'taos');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
self.test_normal_query_new("position")
def test_replace(self):
self.test_normal_query("replace")
tdSql.query("select replace(null, 'aa', 'ee');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select replace('aabbccdd', null, 'ee');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
self.test_normal_query_new("replace")
def test_repeat(self):
self.test_normal_query("repeat")
tdSql.query("select repeat('taos', null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select repeat(null, 3);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select repeat('taos', 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
self.test_normal_query_new("repeat")
def test_substr(self):
self.test_normal_query("substr")
tdSql.query("select substring('tdengine', null, 3);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring(null, 1, 3);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring('tdengine', 1, null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring('tdengine', 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
tdSql.query("select substring('tdengine', 10);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
tdSql.query("select substring('tdengine', 1, 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
tdSql.query("select substring('tdengine', 1, -1);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
self.test_normal_query_new("substr")
def test_substr_idx(self):
self.test_normal_query("substr_idx")
tdSql.query("select substring_index(null, '.', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring_index('www.taosdata.com', null, 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring_index('www.taosdata.com', '.', null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select substring_index('www.taosdata.com', '.', 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, '')
self.test_normal_query_new("substr_idx")
def test_trim(self):
self.test_normal_query("trim")
tdSql.query("select trim(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
self.test_normal_query_new("trim")
def test_timediff(self):
self.test_normal_query("timediff")
self.test_normal_query_new("timediff")
tdSql.query("select timediff(null, '2022-01-01 08:00:01',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('2022-01-01 08:00:00', null,1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('2022/01/31', '2022/01/01',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('20220131', '20220101',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('22/01/31', '22/01/01',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('01/31/22', '01/01/22',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('31-JAN-22', '01-JAN-22',1s);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('22/01/31', '22/01/01');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select timediff('www', 'ttt');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select timediff(min(ts), '2023-01-01 00:00:00') from ts_4893.meters limit 1;")
tdSql.error("select timediff(max(ts), '2023-12-31 23:59:59') from ts_4893.meters limit 1;")
tdSql.error("select (select timediff(ts, (select max(ts) from ts_4893.meters)) from ts_4893.meters where id = m.id) from ts_4893.meters m;")
def test_week(self):
self.test_normal_query("week")
tdSql.query("select week(null, 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('abc');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('1721020591', 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('1721020666229', 0);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('01/01/2020', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('20200101', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('20/01/01', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('11/01/31', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select week('01-JAN-20', 2);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
self.test_normal_query_new("week")
def test_weekday(self):
self.test_normal_query("weekday")
self.test_normal_query_new("weekday")
tdSql.query("select weekday(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('1721020591');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('1721020666229');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('abc');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('01/01/2020');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('20200101');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('20/01/01');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('11/01/32');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekday('01-JAN-20');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select weekday(hello) from ts_4893.meters limit 1;")
def test_weekofyear(self):
self.test_normal_query("weekofyear")
tdSql.query("select weekofyear(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('1721020591');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('1721020666229');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('abc');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('01/01/2020');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('20200101');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('20/01/01');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('11/01/31');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select weekofyear('01-JAN-20');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
self.test_normal_query_new("weekofyear")
def test_dayofweek(self):
self.test_normal_query("dayofweek")
self.test_normal_query_new("dayofweek")
tdSql.query("select dayofweek(null);")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
def test_stddev_pop(self):
self.test_normal_query_new("stddev")
tdSql.query("select dayofweek('1721020591');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('1721020666229');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('abc');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('01/01/2020');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('20200101');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('20/01/01');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('11/01/31');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select dayofweek('01-JAN-20');")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
def test_stddev(self):
self.test_normal_query("stddev")
tdSql.query("select stddev_pop(null) from ts_4893.d0;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select stddev_pop(null) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.error("select stddev_pop(var1) from ts_4893.meters;")
tdSql.error("select stddev_pop(current) from empty_ts_4893.meters;")
tdSql.error("select stddev_pop(name) from ts_4893.meters;")
tdSql.error("select stddev_pop(nonexistent_column) from ts_4893.meters;")
def test_varpop(self):
self.test_normal_query("varpop")
self.test_normal_query_new("varpop")
tdSql.query("select var_pop(null) from ts_4893.d0;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select var_pop(null) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
def test_error(self):
tdSql.error(
"select * from (select to_iso8601(ts, timezone()), timezone() from meters order by ts desc) limit 1000;",
expectErrInfo="Not supported timzone format") # TS-5340
tdSql.error("select var_pop(var1) from ts_4893.meters;")
tdSql.error("select var_pop(current) from empty_ts_4893.meters;")
tdSql.error("select var_pop(name) from ts_4893.meters;")
tdSql.error("select var_pop(nonexistent_column) from ts_4893.meters;")
def test_rand(self):
self.test_normal_query("rand")
self.test_normal_query_new("rand")
tdSql.query("select rand();")
tdSql.checkRows(1)
tdSql.checkCols(1)
self.check_result_in_range(0, 0)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand(null);")
tdSql.checkRows(1)
tdSql.checkCols(1)
self.check_result_in_range(0, 0)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand() where rand() >= 0;")
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand() where rand() < 1;")
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand() where rand() >= 0 and rand() < 1;")
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand() from (select 1) t limit 1;")
tdSql.checkRows(1)
tdSql.checkCols(1)
self.check_result_in_range(0, 0)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand(id) from ts_4893.d0 limit 100;")
tdSql.checkRows(100)
tdSql.query("select round(rand(), 3)")
tdSql.checkRows(1)
tdSql.checkCols(1)
for i in range(len(tdSql.res)):
self.check_result_in_range(i, 0)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand(id) from ts_4893.meters limit 100;")
tdSql.checkRows(100)
tdSql.query("select pow(rand(), 2)")
tdSql.checkRows(1)
tdSql.checkCols(1)
for i in range(len(tdSql.res)):
self.check_result_in_range(i, 0)
res = tdSql.getData(0, 0)
self.check_rand_data_range(res, 0)
tdSql.query("select rand(123), rand(123);")
tdSql.query("select rand(12345), rand(12345);")
tdSql.checkRows(1)
tdSql.checkCols(2)
if tdSql.res[0][0] != tdSql.res[0][1]:
res0 = tdSql.getData(0, 0)
res1 = tdSql.getData(0, 1)
if res0 != res1:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, tdSql.sql, tdSql.res[0][0], tdSql.res[0][1])
tdLog.exit("%s(%d) failed: sql:%s data1:%s ne data2:%s" % args)
args = (caller.filename, caller.lineno, self.sql, 1, self.queryRows)
tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args)
def check_result_in_range(self, row, col):
res = tdSql.res[row][col]
if res < 0 or res >= 1:
tdSql.error("select rand(3.14);")
tdSql.error("select rand(-3.14);")
tdSql.error("select rand('');")
tdSql.error("select rand('hello');")
def check_rand_data_range(self, data, row):
if data < 0 or data >= 1:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, tdSql.sql, row, col, res)
tdLog.exit("%s(%d) failed: sql:%s row:%s col:%s data:%s lt 0 or ge 1" % args)
args = (caller.filename, caller.lineno, self.sql, row+1, self.queryRows)
tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args)
def test_max(self):
self.test_normal_query("max")
self.test_normal_query_new("max")
tdSql.query("select max(null) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 'None')
tdSql.query("select max(id) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select max(name) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select max(current) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select max(nch1) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select max(var1) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.error("select max(nonexistent_column) from ts_4893.meters;")
def test_min(self):
self.test_normal_query("min")
self.test_normal_query_new("min")
tdSql.query("select min(null) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 'None')
tdSql.error("select min(nonexistent_column) from ts_4893.meters;")
tdSql.query("select min(id) from ts_4893.meters;")
tdSql.checkRows(1)
def test_error(self):
tdSql.error("select * from (select to_iso8601(ts, timezone()), timezone() from ts_4893.meters \
order by ts desc) limit 1000;", expectErrInfo="Not supported timzone format") # TS-5340
tdSql.query("select min(name) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select min(current) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select min(nch1) from ts_4893.meters;")
tdSql.checkRows(1)
tdSql.query("select min(var1) from ts_4893.meters;")
tdSql.checkRows(1)
# run
def run(self):
tdLog.debug(f"start to excute {__file__}")
# insert data
self.insertData()
self.insert_data()
# math function
self.test_pi()
self.test_round()
self.test_exp()
self.test_trunc()
self.test_truncate()
self.test_ln()
self.test_mod()
self.test_sign()
@ -648,7 +334,7 @@ class TDTestCase(TBase):
self.test_dayofweek()
# agg function
self.test_stddev()
self.test_stddev_pop()
self.test_varpop()
# select function

View File

@ -397,7 +397,7 @@ sql select case when f1 then f1 when f1 + 1 then f1 + 1 else f1 is null end from
if $rows != 4 then
return -1
endi
if $data00 != 1 then
if $data00 != 1.000000 then
return -1
endi
if $data10 != 1 then
@ -406,7 +406,7 @@ endi
if $data20 != 5 then
return -1
endi
if $data30 != 1 then
if $data30 != true then
return -1
endi
@ -601,7 +601,6 @@ endi
if $data30 != 1.000000000 then
return -1
endi
sql select sum(case f1 when f1 then f1 + 1 else f1 is null end + 1) from tba1;
if $rows != 1 then
return -1
@ -660,10 +659,10 @@ endi
if $data00 != 0 then
return -1
endi
if $data10 != 10 then
if $data10 != 10.000000 then
return -1
endi
if $data20 != 50 then
if $data20 != 50.000000 then
return -1
endi
if $data30 != -1 then
@ -890,19 +889,19 @@ endi
if $data10 != 0 then
return -1
endi
if $data11 != -99.000000000 then
if $data11 != -99.000000 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data21 != 100.000000000 then
if $data21 != 100.000000 then
return -1
endi
if $data30 != 5 then
return -1
endi
if $data31 != -94.000000000 then
if $data31 != -94.000000 then
return -1
endi
@ -1029,13 +1028,13 @@ endi
if $data00 != NULL then
return -1
endi
if $data10 != -99.000000000 then
if $data10 != -99.000000 then
return -1
endi
if $data20 != 1.000000000 then
if $data20 != 1 then
return -1
endi
if $data30 != 5.000000000 then
if $data30 != 5 then
return -1
endi
@ -1052,13 +1051,117 @@ endi
if $data21 != NULL then
return -1
endi
if $data31 != 101 then
if $data31 != 101.000000 then
return -1
endi
if $data41 != 103 then
if $data41 != 103.000000 then
return -1
endi
sql_error select case when sum(f1) then sum(f1)-abs(f1) end from tba1;
sql drop database if exists test_db;
sql create database test_db vgroups 5;
sql use test_db;
sql create stable test_stable (ts TIMESTAMP,c_int INT,c_uint INT UNSIGNED, c_bigint BIGINT, c_ubigint BIGINT UNSIGNED, c_float FLOAT, c_double DOUBLE, c_binary BINARY(20), c_smallint SMALLINT, c_usmallint SMALLINT UNSIGNED, c_tinyint TINYINT,c_utinyint TINYINT UNSIGNED,c_bool BOOL,c_nchar NCHAR(20), c_varchar VARCHAR(20), c_varbinary VARBINARY(20), c_geometry GEOMETRY(50)) tags(tag_id JSON);
sql create table t_test using test_stable tags('{\"tag1\":5}');
sql insert into t_test values ('2022-09-30 15:15:01',123,456,1234567890,9876543210,123.45,678.90,'binary_val',32767,65535,127,255,true,'涛思数据','varchar_val', '1101', 'point(10 10)');
sql select case when c_int > 100 then c_float else c_int end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 123.449997 then
return -1
endi
sql select case when c_bigint > 100000 then c_double else c_bigint end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 678.900000 then
return -1
endi
sql select case when c_bool then c_bool else c_utinyint end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql select case when c_smallint > 30000 then c_usmallint else c_smallint end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 65535 then
return -1
endi
sql select case when c_binary = 'binary_val' then c_nchar else c_binary end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 涛思数据 then
return -1
endi
sql select case when c_bool then c_int else c_bool end as result from t_test;
if $rows != 1 then
return -1
endi
if $data00 != 123 then
return -1
endi
sql select case when ts > '2022-01-01 00:00:00' then c_bool else ts end as result from t_test;
if $data00 != 1 then
return -1
endi
sql select case when c_double > 100 then c_nchar else c_double end as result from t_test;
if $data00 != 涛思数据 then
return -1
endi
sql select case when c_double > 100 then c_varchar else c_double end as result from t_test;
if $data00 != varchar_val then
return -1
endi
sql select case when ts > '2022-01-01 00:00:00' then c_varchar else c_geometry end as result from t_test;
if $data00 != varchar_val then
return -1
endi
sql select case when ts > '2022-01-01 00:00:00' then c_bool else c_geometry end as result from t_test;
if $data00 != true then
return -1
endi
sql select case when 0 then tag_id else c_geometry end as result from t_test;
if $data00 != 16842773 then
return -1
endi
sql select case when 0 then tag_id else c_nchar end as result from t_test;
if $data00 != 涛思数据 then
return -1
endi
sql select case when 0 then tag_id else c_int end as result from t_test;
if $data00 != 123 then
return -1
endi
sql select case when 0 then tag_id else c_float end as result from t_test;
if $data00 != 123.449997 then
return -1
endi
sql_error select case when c_double > 100 then c_varbinary else c_geometry end as result from t_test;
sql_error select case when c_bool then c_double else c_varbinary end as result from t_test;
sql_error select case when c_bool then c_varbinary else c_varchar end as result from t_test;
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -96,6 +96,7 @@ while $i < 5
sql drop index $sma
endw
#sleep 5000
sql drop stable $mtPrefix
sql select * from information_schema.ins_indexes
if $rows != 0 then

View File

@ -231,12 +231,12 @@ class TDTestCase:
'first case when \'%d\' then \'b\' when null then %d end last' %(a1,a2) , #'first case when \'2\' then \'b\' when null then 0 end last' ,
'first case when \'%d\' then \'b\' else null end last' %(a1), #'first case when \'0\' then \'b\' else null end last',
'first case when \'%d\' then \'b\' else %d end last' %(a1,a2), #'first case when \'0\' then \'b\' else 2 end last',
'first case when q_int then q_int when q_int + (%d) then q_int + (%d) else q_int is null end last' %(a1,a2) , #'first case when q_int then q_int when q_int + 1 then q_int + 1 else q_int is null end last' ,
'first case when q_int then %d when ts then ts end last' %(a1), #'first case when q_int then 3 when ts then ts end last' ,
'first case when q_int then q_int when q_int + (%d) then cast(q_int + (%d) as int) else q_int is null end last' %(a1,a2) , #'first case when q_int then q_int when q_int + 1 then q_int + 1 else q_int is null end last' ,
'first case when q_int then %d when ts then cast(ts as int) end last' %(a1), #'first case when q_int then 3 when ts then ts end last' ,
'first case when %d then q_int end last' %(a1), #'first case when 3 then q_int end last' ,
'first case when q_int then %d when %d then %d end last' %(a1,a1,a3), #'first case when q_int then 3 when 1 then 2 end last' ,
'first case when q_int < %d then %d when q_int >= %d then %d else %d end last' %(a1,a2,a1,a2,a3), #'first case when q_int < 3 then 1 when q_int >= 3 then 2 else 3 end last' ,
'first case when q_int is not null then case when q_int <= %d then q_int else q_int * (%d) end else -(%d) end last' %(a1,a1,a3), #'first case when q_int is not null then case when q_int <= 0 then q_int else q_int * 10 end else -1 end last' ,
'first case when q_int is not null then case when q_int <= %d then q_int else cast(q_int * (%d) as int) end else -(%d) end last' %(a1,a1,a3), #'first case when q_int is not null then case when q_int <= 0 then q_int else q_int * 10 end else -1 end last' ,
'first case %d when %d then %d end last' %(a1,a2,a3), # 'first case 3 when 3 then 4 end last' ,
'first case %d when %d then %d end last' %(a1,a2,a3), # 'first case 3 when 1 then 4 end last' ,
'first case %d when %d then %d else %d end last' %(a1,a1,a2,a3), # 'first case 3 when 1 then 4 else 2 end last' ,
@ -250,15 +250,15 @@ class TDTestCase:
'first case when \'a\' then \'b\' when null then %d end last' %(a1), # 'first case when \'a\' then \'b\' when null then 0 end last' ,
'first case when \'%d\' then \'b\' when null then %d end last' %(a1,a2), # 'first case when \'2\' then \'b\' when null then 0 end last' ,
'first case when %d then \'b\' else null end last' %(a1), # 'first case when 0 then \'b\' else null end last' ,
'first case when %d then \'b\' else %d+abs(%d) end last' %(a1,a2,a3), # 'first case when 0 then \'b\' else 2+abs(-2) end last' ,
'first case when %d then \'b\' else cast(%d+abs(%d) as int) end last' %(a1,a2,a3), # 'first case when 0 then \'b\' else 2+abs(-2) end last' ,
'first case when %d then %d end last' %(a1,a2), # 'first case when 3 then 4 end last' ,
'first case when %d then %d end last' %(a1,a2), # 'first case when 0 then 4 end last' ,
'first case when null then %d end last' %(a1), # 'first case when null then 4 end last' ,
#'first case when %d then %d+(%d) end last' %(a1,a2,a3), # 'first case when 1 then 4+1 end last' ,
'first case when %d then cast(%d+(%d) as int) end last' %(a1,a2,a3), # 'first case when 1 then 4+1 end last' ,
'first case when %d-(%d) then %d end last' %(a1,a2,a3), # 'first case when 1-1 then 0 end last' ,
'first case when %d+(%d) then %d end last' %(a1,a2,a3), # 'first case when 1+1 then 0 end last' ,
'first case when abs(%d) then abs(%d) end last' %(a1,a2), # 'first case when abs(3) then abs(-1) end last' ,
#'first case when abs(%d+(%d)) then abs(%d)+abs(%d) end last' %(a1,a2,a3,a1), # 'first case when abs(1+1) then abs(-1)+abs(3) end last' ,
'first case when abs(%d+(%d)) then cast(abs(%d)+abs(%d) as int) end last' %(a1,a2,a3,a1), # 'first case when abs(1+1) then abs(-1)+abs(3) end last' ,
'first case when %d then %d else %d end last' %(a1,a2,a3), # 'first case when 0 then 1 else 3 end last' ,
'first case when %d then %d when %d then %d else %d end last' %(a1,a2,a3,a1,a2), # 'first case when 0 then 1 when 1 then 0 else 3 end last' ,
'first case when %d then %d when %d then %d when %d then %d end last' %(a1,a2,a3,a1,a2,a3), # 'first case when 0 then 1 when 1 then 0 when 2 then 3 end last' ,