未验证 提交 5b0aaaf4 编写于 作者: H Haojun Liao 提交者: GitHub

Merge pull request #10723 from taosdata/feature/TD-11216

[TD-11216]<feature>: Time window related keywords add  _qstart/_qstop/_qduration
...@@ -2408,7 +2408,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum ...@@ -2408,7 +2408,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExprItem* pItem, bool outerQuery, bool timeWindowQuery) { int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExprItem* pItem, bool outerQuery, bool timeWindowQuery) {
const char* msg1 = "tag for normal table query is not allowed"; const char* msg1 = "tag for normal table query is not allowed";
const char* msg2 = "invalid column name"; const char* msg2 = "invalid column name";
const char* msg3 = "tbname/_wstart/_wstop/_wduration in outer query does not match inner query result"; const char* msg3 = "tbname/_wstart/_wstop/_wduration/_qstart/_qstop/_qduration in outer query does not match inner query result";
const char* msg4 = "-> operate can only used in json type"; const char* msg4 = "-> operate can only used in json type";
const char* msg5 = "the right value of -> operation must be string"; const char* msg5 = "the right value of -> operation must be string";
const char* msg6 = "select name is too long than 64, please use alias name"; const char* msg6 = "select name is too long than 64, please use alias name";
...@@ -2494,7 +2494,13 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t ...@@ -2494,7 +2494,13 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
(strncasecmp(pSchema[i].name, TSQL_TSWIN_STOP, tListLen(pSchema[i].name)) == 0 && (strncasecmp(pSchema[i].name, TSQL_TSWIN_STOP, tListLen(pSchema[i].name)) == 0 &&
index.columnIndex == TSDB_TSWIN_STOP_COLUMN_INDEX) || index.columnIndex == TSDB_TSWIN_STOP_COLUMN_INDEX) ||
(strncasecmp(pSchema[i].name, TSQL_TSWIN_DURATION, tListLen(pSchema[i].name)) == 0 && (strncasecmp(pSchema[i].name, TSQL_TSWIN_DURATION, tListLen(pSchema[i].name)) == 0 &&
index.columnIndex == TSDB_TSWIN_DURATION_COLUMN_INDEX)) { index.columnIndex == TSDB_TSWIN_DURATION_COLUMN_INDEX) ||
(strncasecmp(pSchema[i].name, TSQL_QUERY_START, tListLen(pSchema[i].name)) == 0 &&
index.columnIndex == TSDB_QUERY_START_COLUMN_INDEX) ||
(strncasecmp(pSchema[i].name, TSQL_QUERY_STOP, tListLen(pSchema[i].name)) == 0 &&
index.columnIndex == TSDB_QUERY_STOP_COLUMN_INDEX) ||
(strncasecmp(pSchema[i].name, TSQL_QUERY_DURATION, tListLen(pSchema[i].name)) == 0 &&
index.columnIndex == TSDB_QUERY_DURATION_COLUMN_INDEX)) {
existed = true; existed = true;
index.columnIndex = i; index.columnIndex = i;
break; break;
...@@ -2520,7 +2526,9 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t ...@@ -2520,7 +2526,9 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
functionId = TSDB_FUNC_TAGPRJ; functionId = TSDB_FUNC_TAGPRJ;
colType = TSDB_COL_TAG; colType = TSDB_COL_TAG;
} else { } else {
if (!timeWindowQuery) { if (!timeWindowQuery && (index.columnIndex == TSDB_TSWIN_START_COLUMN_INDEX ||
index.columnIndex == TSDB_TSWIN_STOP_COLUMN_INDEX ||
index.columnIndex == TSDB_TSWIN_DURATION_COLUMN_INDEX)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
} }
colSchema = *tGetTimeWindowColumnSchema(index.columnIndex); colSchema = *tGetTimeWindowColumnSchema(index.columnIndex);
...@@ -3861,6 +3869,15 @@ static bool isTimeWindowToken(SStrToken* token, int16_t *columnIndex) { ...@@ -3861,6 +3869,15 @@ static bool isTimeWindowToken(SStrToken* token, int16_t *columnIndex) {
} else if (tmpToken.n == strlen(TSQL_TSWIN_DURATION) && strncasecmp(TSQL_TSWIN_DURATION, tmpToken.z, tmpToken.n) == 0) { } else if (tmpToken.n == strlen(TSQL_TSWIN_DURATION) && strncasecmp(TSQL_TSWIN_DURATION, tmpToken.z, tmpToken.n) == 0) {
*columnIndex = TSDB_TSWIN_DURATION_COLUMN_INDEX; *columnIndex = TSDB_TSWIN_DURATION_COLUMN_INDEX;
return true; return true;
} else if (tmpToken.n == strlen(TSQL_QUERY_START) && strncasecmp(TSQL_QUERY_START, tmpToken.z, tmpToken.n) == 0) {
*columnIndex = TSDB_QUERY_START_COLUMN_INDEX;
return true;
} else if (tmpToken.n == strlen(TSQL_QUERY_STOP) && strncasecmp(TSQL_QUERY_STOP, tmpToken.z, tmpToken.n) == 0) {
*columnIndex = TSDB_QUERY_STOP_COLUMN_INDEX;
return true;
} else if (tmpToken.n == strlen(TSQL_QUERY_DURATION) && strncasecmp(TSQL_QUERY_DURATION, tmpToken.z, tmpToken.n) == 0) {
*columnIndex = TSDB_QUERY_DURATION_COLUMN_INDEX;
return true;
} else { } else {
return false; return false;
} }
...@@ -4304,6 +4321,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool ...@@ -4304,6 +4321,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
int32_t scalarFuncNum = 0; int32_t scalarFuncNum = 0;
int32_t funcCompatFactor = INT_MAX; int32_t funcCompatFactor = INT_MAX;
int32_t countTbname = 0; int32_t countTbname = 0;
int32_t queryWinNum = 0;
size_t numOfExpr = tscNumOfExprs(pQueryInfo); size_t numOfExpr = tscNumOfExprs(pQueryInfo);
assert(numOfExpr > 0); assert(numOfExpr > 0);
...@@ -4313,7 +4331,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool ...@@ -4313,7 +4331,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
// diff function cannot be executed with other function // diff function cannot be executed with other function
// arithmetic function can be executed with other arithmetic functions // arithmetic function can be executed with other arithmetic functions
size_t size = tscNumOfExprs(pQueryInfo); size_t size = tscNumOfExprs(pQueryInfo);
for (int32_t i = startIdx; i < size; ++i) { for (int32_t i = startIdx; i < size; ++i) {
SExprInfo* pExpr1 = tscExprGet(pQueryInfo, i); SExprInfo* pExpr1 = tscExprGet(pQueryInfo, i);
...@@ -4343,6 +4361,10 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool ...@@ -4343,6 +4361,10 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
++scalarFuncNum; ++scalarFuncNum;
} }
if (functionId == TSDB_FUNC_QSTART || functionId == TSDB_FUNC_QSTOP || functionId == TSDB_FUNC_QDURATION) {
++queryWinNum;
}
if (functionId == TSDB_FUNC_PRJ && (pExpr1->base.colInfo.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX || TSDB_COL_IS_UD_COL(pExpr1->base.colInfo.flag))) { if (functionId == TSDB_FUNC_PRJ && (pExpr1->base.colInfo.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX || TSDB_COL_IS_UD_COL(pExpr1->base.colInfo.flag))) {
continue; continue;
} }
...@@ -4374,7 +4396,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool ...@@ -4374,7 +4396,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
} }
} }
aggNum = (int32_t)size - prjNum - scalarFuncNum - aggUdf - scalarUdf - countTbname; aggNum = (int32_t)size - prjNum - scalarFuncNum - aggUdf - scalarUdf - countTbname - queryWinNum;
assert(aggNum >= 0); assert(aggNum >= 0);
...@@ -8278,7 +8300,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) { ...@@ -8278,7 +8300,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) {
for (int32_t i = 0; i < numOfExprs; ++i) { for (int32_t i = 0; i < numOfExprs; ++i) {
SExprInfo* pExpr = taosArrayGetP(pQueryInfo->exprList, i); SExprInfo* pExpr = taosArrayGetP(pQueryInfo->exprList, i);
int16_t functionId = pExpr->base.functionId; int16_t functionId = pExpr->base.functionId;
if (functionId == TSDB_FUNC_TAGPRJ || functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TS || if (functionId == TSDB_FUNC_TAGPRJ || functionId == TSDB_FUNC_PRJ || functionId == TSDB_FUNC_TS ||
functionId == TSDB_FUNC_SCALAR_EXPR || functionId == TSDB_FUNC_TS_DUMMY || functionId == TSDB_FUNC_STATE_COUNT || functionId == TSDB_FUNC_SCALAR_EXPR || functionId == TSDB_FUNC_TS_DUMMY || functionId == TSDB_FUNC_STATE_COUNT ||
...@@ -8286,8 +8308,11 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) { ...@@ -8286,8 +8308,11 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) {
continue; continue;
} }
if (functionId == TSDB_FUNC_WSTART || functionId == TSDB_FUNC_WSTOP || functionId == TSDB_FUNC_WDURATION) { if (isTimeWindowFunction(functionId)) {
numOfTimeWindow++; numOfTimeWindow++;
if (functionId >= TSDB_FUNC_QSTART && functionId <= TSDB_FUNC_QDURATION) {
continue;
}
} }
if (functionId < 0) { if (functionId < 0) {
......
...@@ -244,10 +244,13 @@ static struct SSchema _s = { ...@@ -244,10 +244,13 @@ static struct SSchema _s = {
.name = TSQL_TBNAME_L, .name = TSQL_TBNAME_L,
}; };
static struct SSchema _tswin[3] = { static struct SSchema _tswin[6] = {
{TSDB_DATA_TYPE_TIMESTAMP, TSQL_TSWIN_START, TSDB_TSWIN_START_COLUMN_INDEX, LONG_BYTES}, {TSDB_DATA_TYPE_TIMESTAMP, TSQL_TSWIN_START, TSDB_TSWIN_START_COLUMN_INDEX, LONG_BYTES},
{TSDB_DATA_TYPE_TIMESTAMP, TSQL_TSWIN_STOP, TSDB_TSWIN_STOP_COLUMN_INDEX, LONG_BYTES}, {TSDB_DATA_TYPE_TIMESTAMP, TSQL_TSWIN_STOP, TSDB_TSWIN_STOP_COLUMN_INDEX, LONG_BYTES},
{TSDB_DATA_TYPE_BIGINT, TSQL_TSWIN_DURATION, TSDB_TSWIN_DURATION_COLUMN_INDEX, LONG_BYTES}, {TSDB_DATA_TYPE_BIGINT, TSQL_TSWIN_DURATION, TSDB_TSWIN_DURATION_COLUMN_INDEX, LONG_BYTES},
{TSDB_DATA_TYPE_TIMESTAMP, TSQL_QUERY_START, TSDB_QUERY_START_COLUMN_INDEX, LONG_BYTES},
{TSDB_DATA_TYPE_TIMESTAMP, TSQL_QUERY_STOP, TSDB_QUERY_STOP_COLUMN_INDEX, LONG_BYTES},
{TSDB_DATA_TYPE_BIGINT, TSQL_QUERY_DURATION, TSDB_QUERY_DURATION_COLUMN_INDEX, LONG_BYTES},
}; };
SSchema* tGetTimeWindowColumnSchema(int16_t columnIndex) { SSchema* tGetTimeWindowColumnSchema(int16_t columnIndex) {
...@@ -261,6 +264,15 @@ SSchema* tGetTimeWindowColumnSchema(int16_t columnIndex) { ...@@ -261,6 +264,15 @@ SSchema* tGetTimeWindowColumnSchema(int16_t columnIndex) {
case TSDB_TSWIN_DURATION_COLUMN_INDEX: { case TSDB_TSWIN_DURATION_COLUMN_INDEX: {
return &_tswin[2]; return &_tswin[2];
} }
case TSDB_QUERY_START_COLUMN_INDEX: {
return &_tswin[3];
}
case TSDB_QUERY_STOP_COLUMN_INDEX: {
return &_tswin[4];
}
case TSDB_QUERY_DURATION_COLUMN_INDEX: {
return &_tswin[5];
}
default: { default: {
return NULL; return NULL;
} }
......
...@@ -280,9 +280,12 @@ do { \ ...@@ -280,9 +280,12 @@ do { \
#define TSDB_TSWIN_START_COLUMN_INDEX (-2) #define TSDB_TSWIN_START_COLUMN_INDEX (-2)
#define TSDB_TSWIN_STOP_COLUMN_INDEX (-3) #define TSDB_TSWIN_STOP_COLUMN_INDEX (-3)
#define TSDB_TSWIN_DURATION_COLUMN_INDEX (-4) #define TSDB_TSWIN_DURATION_COLUMN_INDEX (-4)
#define TSDB_MIN_VALID_COLUMN_INDEX (-4) #define TSDB_QUERY_START_COLUMN_INDEX (-5)
#define TSDB_QUERY_STOP_COLUMN_INDEX (-6)
#define TSDB_QUERY_DURATION_COLUMN_INDEX (-7)
#define TSDB_MIN_VALID_COLUMN_INDEX (-7)
#define TSDB_COL_IS_TSWIN_COL(_i) ((_i) <= TSDB_TSWIN_START_COLUMN_INDEX && (_i) >= TSDB_TSWIN_DURATION_COLUMN_INDEX) #define TSDB_COL_IS_TSWIN_COL(_i) ((_i) <= TSDB_TSWIN_START_COLUMN_INDEX && (_i) >= TSDB_QUERY_DURATION_COLUMN_INDEX)
#define TSDB_UD_COLUMN_INDEX (-1000) #define TSDB_UD_COLUMN_INDEX (-1000)
#define TSDB_RES_COL_ID (-5000) #define TSDB_RES_COL_ID (-5000)
......
...@@ -86,9 +86,12 @@ extern "C" { ...@@ -86,9 +86,12 @@ extern "C" {
#define TSDB_FUNC_WSTART 44 #define TSDB_FUNC_WSTART 44
#define TSDB_FUNC_WSTOP 45 #define TSDB_FUNC_WSTOP 45
#define TSDB_FUNC_WDURATION 46 #define TSDB_FUNC_WDURATION 46
#define TSDB_FUNC_HYPERLOGLOG 47 #define TSDB_FUNC_QSTART 47
#define TSDB_FUNC_QSTOP 48
#define TSDB_FUNC_QDURATION 49
#define TSDB_FUNC_HYPERLOGLOG 50
#define TSDB_FUNC_MAX_NUM 48 #define TSDB_FUNC_MAX_NUM 51
#define TSDB_FUNCSTATE_SO 0x1u // single output #define TSDB_FUNCSTATE_SO 0x1u // single output
#define TSDB_FUNCSTATE_MO 0x2u // dynamic number of output, not multinumber of output e.g., TOP/BOTTOM #define TSDB_FUNCSTATE_MO 0x2u // dynamic number of output, not multinumber of output e.g., TOP/BOTTOM
...@@ -184,7 +187,7 @@ typedef struct SQLFunctionCtx { ...@@ -184,7 +187,7 @@ typedef struct SQLFunctionCtx {
uint32_t order; // asc|desc uint32_t order; // asc|desc
int16_t inputType; int16_t inputType;
int32_t inputBytes; int32_t inputBytes;
int16_t outputType; int16_t outputType;
int32_t outputBytes; // size of results, determined by function and input column data type int32_t outputBytes; // size of results, determined by function and input column data type
int32_t interBufBytes; // internal buffer size int32_t interBufBytes; // internal buffer size
...@@ -212,6 +215,8 @@ typedef struct SQLFunctionCtx { ...@@ -212,6 +215,8 @@ typedef struct SQLFunctionCtx {
SHashObj **pUniqueSet; // for unique function SHashObj **pUniqueSet; // for unique function
SHashObj **pModeSet; // for mode function SHashObj **pModeSet; // for mode function
STimeWindow qWindow; // for _qstart/_qstop/_qduration column
int32_t allocRows; // rows allocated for output buffer
} SQLFunctionCtx; } SQLFunctionCtx;
typedef struct SAggFunctionInfo { typedef struct SAggFunctionInfo {
...@@ -236,6 +241,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -236,6 +241,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
int32_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo); int32_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo);
int16_t getTimeWindowFunctionID(int16_t colIndex); int16_t getTimeWindowFunctionID(int16_t colIndex);
bool isTimeWindowFunction(int32_t functionId);
int32_t isValidFunction(const char* name, int32_t len); int32_t isValidFunction(const char* name, int32_t len);
bool isValidStateOper(char *oper, int32_t len); bool isValidStateOper(char *oper, int32_t len);
......
...@@ -769,6 +769,10 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -769,6 +769,10 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
bool isTimeWindowFunction(int32_t functionId) {
return ((functionId >= TSDB_FUNC_WSTART) && (functionId <= TSDB_FUNC_QDURATION));
}
// TODO use hash table // TODO use hash table
int32_t isValidFunction(const char* name, int32_t len) { int32_t isValidFunction(const char* name, int32_t len) {
...@@ -5936,28 +5940,87 @@ int16_t getTimeWindowFunctionID(int16_t colIndex) { ...@@ -5936,28 +5940,87 @@ int16_t getTimeWindowFunctionID(int16_t colIndex) {
case TSDB_TSWIN_DURATION_COLUMN_INDEX: { case TSDB_TSWIN_DURATION_COLUMN_INDEX: {
return TSDB_FUNC_WDURATION; return TSDB_FUNC_WDURATION;
} }
case TSDB_QUERY_START_COLUMN_INDEX: {
return TSDB_FUNC_QSTART;
}
case TSDB_QUERY_STOP_COLUMN_INDEX: {
return TSDB_FUNC_QSTOP;
}
case TSDB_QUERY_DURATION_COLUMN_INDEX: {
return TSDB_FUNC_QDURATION;
}
default: default:
return TSDB_FUNC_INVALID_ID; return TSDB_FUNC_INVALID_ID;
} }
} }
static void wstart_function(SQLFunctionCtx *pCtx) { static void window_start_function(SQLFunctionCtx *pCtx) {
SET_VAL(pCtx, pCtx->size, 1); if (pCtx->functionId == TSDB_FUNC_WSTART) {
*(int64_t *)(pCtx->pOutput) = pCtx->startTs; SET_VAL(pCtx, pCtx->size, 1);
*(int64_t *)(pCtx->pOutput) = pCtx->startTs;
} else { //TSDB_FUNC_QSTART
int32_t size = MIN(pCtx->size, pCtx->allocRows); //size cannot exceeds allocated rows
SET_VAL(pCtx, pCtx->size, size);
//INC_INIT_VAL(pCtx, size);
char *output = pCtx->pOutput;
for (int32_t i = 0; i < size; ++i) {
if (pCtx->qWindow.skey == INT64_MIN) {
*(TKEY *)output = TSDB_DATA_TIMESTAMP_NULL;
} else {
memcpy(output, &pCtx->qWindow.skey, pCtx->outputBytes);
}
output += pCtx->outputBytes;
}
}
} }
static void wstop_function(SQLFunctionCtx *pCtx) { static void window_stop_function(SQLFunctionCtx *pCtx) {
SET_VAL(pCtx, pCtx->size, 1); if (pCtx->functionId == TSDB_FUNC_WSTOP) {
*(int64_t *)(pCtx->pOutput) = pCtx->endTs; SET_VAL(pCtx, pCtx->size, 1);
*(int64_t *)(pCtx->pOutput) = pCtx->endTs;
} else { //TSDB_FUNC_QSTOP
int32_t size = MIN(pCtx->size, pCtx->allocRows); //size cannot exceeds allocated rows
SET_VAL(pCtx, pCtx->size, size);
//INC_INIT_VAL(pCtx, size);
char *output = pCtx->pOutput;
for (int32_t i = 0; i < size; ++i) {
if (pCtx->qWindow.ekey == INT64_MAX) {
*(TKEY *)output = TSDB_DATA_TIMESTAMP_NULL;
} else {
memcpy(output, &pCtx->qWindow.ekey, pCtx->outputBytes);
}
output += pCtx->outputBytes;
}
}
} }
static void wduration_function(SQLFunctionCtx *pCtx) { static void window_duration_function(SQLFunctionCtx *pCtx) {
SET_VAL(pCtx, pCtx->size, 1); int64_t duration;
int64_t duration = pCtx->endTs - pCtx->startTs; if (pCtx->functionId == TSDB_FUNC_WDURATION) {
if (duration < 0) { SET_VAL(pCtx, pCtx->size, 1);
duration = -duration; duration = pCtx->endTs - pCtx->startTs;
if (duration < 0) {
duration = -duration;
}
*(int64_t *)(pCtx->pOutput) = duration;
} else { //TSDB_FUNC_QDURATION
int32_t size = MIN(pCtx->size, pCtx->allocRows); //size cannot exceeds allocated rows
SET_VAL(pCtx, pCtx->size, size);
//INC_INIT_VAL(pCtx, size);
duration = pCtx->qWindow.ekey - pCtx->qWindow.skey;
if (duration < 0) {
duration = -duration;
}
char *output = pCtx->pOutput;
for (int32_t i = 0; i < size; ++i) {
if (pCtx->qWindow.skey == INT64_MIN || pCtx->qWindow.ekey == INT64_MAX) {
*(int64_t *)output = TSDB_DATA_BIGINT_NULL;
} else {
memcpy(output, &duration, pCtx->outputBytes);
}
output += pCtx->outputBytes;
}
} }
*(int64_t *)(pCtx->pOutput) = duration;
} }
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
...@@ -5972,16 +6035,16 @@ static void wduration_function(SQLFunctionCtx *pCtx) { ...@@ -5972,16 +6035,16 @@ static void wduration_function(SQLFunctionCtx *pCtx) {
* *
*/ */
int32_t functionCompatList[] = { int32_t functionCompatList[] = {
// count, sum, avg, min, max, stddev, percentile, apercentile, first, last // count, sum, avg, min, max, stddev, percentile, apercentile, first, last
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
// last_row, top, bottom, spread, twa, leastsqr, ts, ts_dummy, tag_dummy, ts_comp // last_row, top, bottom, spread, twa, leastsqr, ts, ts_dummy, tag_dummy, ts_comp
4, -1, -1, 1, 1, 1, 1, 1, 1, -1, 4, -1, -1, 1, 1, 1, 1, 1, 1, -1,
// tag, colprj, tagprj, arithm, diff, first_dist, last_dist, stddev_dst, interp rate, irate // tag, colprj, tagprj, arithm, diff, first_dist, last_dist, stddev_dst, interp rate, irate
1, 1, 1, 1, -1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 5, 1, 1,
// tid_tag, deriv, csum, mavg, sample, block_info, elapsed, histogram, unique, mode, tail // tid_tag, deriv, csum, mavg, sample, block_info, elapsed, histogram, unique, mode, tail
6, 8, -1, -1, -1, 7, 1, -1, -1, 1, -1, 6, 8, -1, -1, -1, 7, 1, -1, -1, 1, -1,
// stateCount, stateDuration, wstart, wstop, wduration, hyperloglog // stateCount, stateDuration, wstart, wstop, wduration, qstart, qstop, qduration, hyperloglog
1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };
SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{
...@@ -6522,7 +6585,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{ ...@@ -6522,7 +6585,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{
TSDB_FUNC_WSTART, TSDB_FUNC_WSTART,
TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY, TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup, function_setup,
wstart_function, window_start_function,
doFinalizer, doFinalizer,
copy_function, copy_function,
dataBlockRequired, dataBlockRequired,
...@@ -6534,7 +6597,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{ ...@@ -6534,7 +6597,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{
TSDB_FUNC_WSTOP, TSDB_FUNC_WSTOP,
TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY, TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup, function_setup,
wstop_function, window_stop_function,
doFinalizer, doFinalizer,
copy_function, copy_function,
dataBlockRequired, dataBlockRequired,
...@@ -6546,13 +6609,49 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{ ...@@ -6546,13 +6609,49 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{
TSDB_FUNC_WDURATION, TSDB_FUNC_WDURATION,
TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY, TSDB_BASE_FUNC_SO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup, function_setup,
wduration_function, window_duration_function,
doFinalizer, doFinalizer,
copy_function, copy_function,
dataBlockRequired, dataBlockRequired,
}, },
{ {
// 47 // 47
"_qstart",
TSDB_FUNC_QSTART,
TSDB_FUNC_QSTART,
TSDB_BASE_FUNC_MO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup,
window_start_function,
doFinalizer,
copy_function,
dataBlockRequired,
},
{
// 48
"_qstop",
TSDB_FUNC_QSTOP,
TSDB_FUNC_QSTOP,
TSDB_BASE_FUNC_MO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup,
window_stop_function,
doFinalizer,
copy_function,
dataBlockRequired,
},
{
// 49
"_qduration",
TSDB_FUNC_QDURATION,
TSDB_FUNC_QDURATION,
TSDB_BASE_FUNC_MO | TSDB_FUNCSTATE_SELECTIVITY,
function_setup,
window_duration_function,
doFinalizer,
copy_function,
dataBlockRequired,
},
{
// 50
"hyperloglog", "hyperloglog",
TSDB_FUNC_HYPERLOGLOG, TSDB_FUNC_HYPERLOGLOG,
TSDB_FUNC_HYPERLOGLOG, TSDB_FUNC_HYPERLOGLOG,
......
...@@ -382,7 +382,7 @@ int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int3 ...@@ -382,7 +382,7 @@ int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int3
* the number of output result is decided by main output * the number of output result is decided by main output
*/ */
if (hasMainFunction && (id == TSDB_FUNC_TS || id == TSDB_FUNC_TAG || id == TSDB_FUNC_TAGPRJ || if (hasMainFunction && (id == TSDB_FUNC_TS || id == TSDB_FUNC_TAG || id == TSDB_FUNC_TAGPRJ ||
id == TSDB_FUNC_TS_DUMMY || id == TSDB_FUNC_TAG_DUMMY)) { id == TSDB_FUNC_TS_DUMMY || id == TSDB_FUNC_TAG_DUMMY || isTimeWindowFunction(id))) {
continue; continue;
} }
...@@ -1905,7 +1905,7 @@ static int32_t setCtxTagColumnInfo(SQLFunctionCtx *pCtx, int32_t numOfOutput) { ...@@ -1905,7 +1905,7 @@ static int32_t setCtxTagColumnInfo(SQLFunctionCtx *pCtx, int32_t numOfOutput) {
} }
static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput, static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput,
int32_t** rowCellInfoOffset) { int32_t** rowCellInfoOffset, int32_t numOfRows) {
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
SQLFunctionCtx * pFuncCtx = (SQLFunctionCtx *)calloc(numOfOutput, sizeof(SQLFunctionCtx)); SQLFunctionCtx * pFuncCtx = (SQLFunctionCtx *)calloc(numOfOutput, sizeof(SQLFunctionCtx));
...@@ -1955,6 +1955,9 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr ...@@ -1955,6 +1955,9 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr
pCtx->end.key = INT64_MIN; pCtx->end.key = INT64_MIN;
pCtx->startTs = INT64_MIN; pCtx->startTs = INT64_MIN;
pCtx->qWindow = pQueryAttr->window;
pCtx->allocRows = numOfRows;
pCtx->numOfParams = pSqlExpr->numOfParams; pCtx->numOfParams = pSqlExpr->numOfParams;
for (int32_t j = 0; j < pCtx->numOfParams; ++j) { for (int32_t j = 0; j < pCtx->numOfParams; ++j) {
int16_t type = pSqlExpr->param[j].nType; int16_t type = pSqlExpr->param[j].nType;
...@@ -3922,7 +3925,8 @@ static bool hasMainOutput(SQueryAttr *pQueryAttr) { ...@@ -3922,7 +3925,8 @@ static bool hasMainOutput(SQueryAttr *pQueryAttr) {
for (int32_t i = 0; i < pQueryAttr->numOfOutput; ++i) { for (int32_t i = 0; i < pQueryAttr->numOfOutput; ++i) {
int32_t functionId = pQueryAttr->pExpr1[i].base.functionId; int32_t functionId = pQueryAttr->pExpr1[i].base.functionId;
if (functionId != TSDB_FUNC_TS && functionId != TSDB_FUNC_TAG && functionId != TSDB_FUNC_TAGPRJ) { if (functionId != TSDB_FUNC_TS && functionId != TSDB_FUNC_TAG &&
functionId != TSDB_FUNC_TAGPRJ && !isTimeWindowFunction(functionId)) {
return true; return true;
} }
} }
...@@ -5637,7 +5641,8 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, ...@@ -5637,7 +5641,8 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv,
pInfo->bufCapacity = 200; // TD-10899 pInfo->bufCapacity = 200; // TD-10899
pInfo->udfInfo = pUdfInfo; pInfo->udfInfo = pUdfInfo;
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity * pInfo->resultRowFactor); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity * pInfo->resultRowFactor);
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset,
pInfo->bufCapacity * pInfo->resultRowFactor);
pInfo->orderColumnList = getOrderCheckColumns(pRuntimeEnv->pQueryAttr); pInfo->orderColumnList = getOrderCheckColumns(pRuntimeEnv->pQueryAttr);
pInfo->groupColumnList = getResultGroupCheckColumns(pRuntimeEnv->pQueryAttr); pInfo->groupColumnList = getResultGroupCheckColumns(pRuntimeEnv->pQueryAttr);
...@@ -5956,7 +5961,7 @@ static SSDataBlock* doAggregate(void* param, bool* newgroup) { ...@@ -5956,7 +5961,7 @@ static SSDataBlock* doAggregate(void* param, bool* newgroup) {
doAggregateImpl(pOperator, pQueryAttr->window.skey, pInfo->pCtx, pBlock); doAggregateImpl(pOperator, pQueryAttr->window.skey, pInfo->pCtx, pBlock);
// if all pCtx is completed, then query should be over // if all pCtx is completed, then query should be over
if(allCtxCompleted(pOperator, pInfo->pCtx)) if(allCtxCompleted(pOperator, pInfo->pCtx))
break; break;
} }
doSetOperatorCompleted(pOperator); doSetOperatorCompleted(pOperator);
...@@ -7278,7 +7283,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera ...@@ -7278,7 +7283,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
int32_t numOfRows = (int32_t)(getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery)); int32_t numOfRows = (int32_t)(getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, numOfRows); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, numOfRows);
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset, numOfRows);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7450,7 +7455,7 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SO ...@@ -7450,7 +7455,7 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SO
size_t tableGroup = GET_NUM_OF_TABLEGROUP(pRuntimeEnv); size_t tableGroup = GET_NUM_OF_TABLEGROUP(pRuntimeEnv);
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, (int32_t) tableGroup); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, (int32_t) tableGroup);
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset, (int32_t) tableGroup);
initResultRowInfo(&pInfo->binfo.resultRowInfo, (int32_t)tableGroup, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, (int32_t)tableGroup, TSDB_DATA_TYPE_INT);
if (pInfo->binfo.pRes == NULL || pInfo->binfo.pCtx == NULL || pInfo->binfo.resultRowInfo.pResult == NULL) { if (pInfo->binfo.pRes == NULL || pInfo->binfo.pCtx == NULL || pInfo->binfo.resultRowInfo.pResult == NULL) {
...@@ -7495,7 +7500,7 @@ SOperatorInfo* createProjectOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato ...@@ -7495,7 +7500,7 @@ SOperatorInfo* createProjectOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
SOptrBasicInfo* pBInfo = &pInfo->binfo; SOptrBasicInfo* pBInfo = &pInfo->binfo;
pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity); pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity);
pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset); pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset, pInfo->bufCapacity);
initResultRowInfo(&pBInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pBInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7630,7 +7635,7 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp ...@@ -7630,7 +7635,7 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp
return NULL; return NULL;
} }
pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset, pRuntimeEnv->resultInfo.capacity);
pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7680,7 +7685,7 @@ SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera ...@@ -7680,7 +7685,7 @@ SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
SOptrBasicInfo* pBInfo = &pInfo->binfo; SOptrBasicInfo* pBInfo = &pInfo->binfo;
pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity); pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity);
pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset); pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset, pInfo->bufCapacity);
if (pQueryAttr->needReverseScan) { if (pQueryAttr->needReverseScan) {
pInfo->rangeStart = taosHashInit(256, taosGetDefaultHashFunction(TSDB_DATA_TYPE_TIMESTAMP), false, false); pInfo->rangeStart = taosHashInit(256, taosGetDefaultHashFunction(TSDB_DATA_TYPE_TIMESTAMP), false, false);
...@@ -7732,7 +7737,8 @@ SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpe ...@@ -7732,7 +7737,8 @@ SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpe
pInfo->colIndex = -1; pInfo->colIndex = -1;
pInfo->reptScan = false; pInfo->reptScan = false;
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset,
pRuntimeEnv->resultInfo.capacity);
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7772,7 +7778,8 @@ SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato ...@@ -7772,7 +7778,8 @@ SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
return NULL; return NULL;
} }
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset,
pRuntimeEnv->resultInfo.capacity);
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7814,7 +7821,7 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRunti ...@@ -7814,7 +7821,7 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRunti
return NULL; return NULL;
} }
pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset, pRuntimeEnv->resultInfo.capacity);
pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT);
...@@ -7857,7 +7864,8 @@ SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato ...@@ -7857,7 +7864,8 @@ SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
} }
pInfo->colIndex = -1; // group by column index pInfo->colIndex = -1; // group by column index
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset,
pRuntimeEnv->resultInfo.capacity);
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr; SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
...@@ -9168,7 +9176,7 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp ...@@ -9168,7 +9176,7 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp
type = s->type; type = s->type;
bytes = s->bytes; bytes = s->bytes;
} else if (TSDB_COL_IS_TSWIN_COL(pExprs[i].base.colInfo.colId) && } else if (TSDB_COL_IS_TSWIN_COL(pExprs[i].base.colInfo.colId) &&
(pExprs[i].base.functionId >= TSDB_FUNC_WSTART || pExprs[i].base.functionId <= TSDB_FUNC_WDURATION)) { isTimeWindowFunction(pExprs[i].base.functionId)) {
SSchema* s = tGetTimeWindowColumnSchema(pExprs[i].base.colInfo.colId); SSchema* s = tGetTimeWindowColumnSchema(pExprs[i].base.colInfo.colId);
type = s->type; type = s->type;
bytes = s->bytes; bytes = s->bytes;
...@@ -9219,19 +9227,15 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp ...@@ -9219,19 +9227,15 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp
int32_t param = (int32_t)pExprs[i].base.param[0].i64; int32_t param = (int32_t)pExprs[i].base.param[0].i64;
if (pExprs[i].base.functionId > 0 && if (pExprs[i].base.functionId > 0 &&
pExprs[i].base.functionId != TSDB_FUNC_SCALAR_EXPR && pExprs[i].base.functionId != TSDB_FUNC_SCALAR_EXPR &&
pExprs[i].base.functionId != TSDB_FUNC_WSTART && !isTimeWindowFunction(pExprs[i].base.functionId) &&
pExprs[i].base.functionId != TSDB_FUNC_WSTOP && (type != pExprs[i].base.colType || bytes != pExprs[i].base.colBytes)) {
pExprs[i].base.functionId != TSDB_FUNC_WDURATION &&
(type != pExprs[i].base.colType || bytes != pExprs[i].base.colBytes)) {
tfree(pExprs); tfree(pExprs);
return TSDB_CODE_QRY_INVALID_MSG; return TSDB_CODE_QRY_INVALID_MSG;
} }
// todo remove it // todo remove it
if (pExprs[i].base.functionId != TSDB_FUNC_SCALAR_EXPR && if (pExprs[i].base.functionId != TSDB_FUNC_SCALAR_EXPR &&
pExprs[i].base.functionId != TSDB_FUNC_WSTART && !isTimeWindowFunction(pExprs[i].base.functionId) &&
pExprs[i].base.functionId != TSDB_FUNC_WSTOP &&
pExprs[i].base.functionId != TSDB_FUNC_WDURATION &&
getResultDataInfo(type, bytes, pExprs[i].base.functionId, param, &pExprs[i].base.resType, &pExprs[i].base.resBytes, getResultDataInfo(type, bytes, pExprs[i].base.functionId, param, &pExprs[i].base.resType, &pExprs[i].base.resBytes,
&pExprs[i].base.interBytes, 0, isSuperTable, pUdfInfo) != TSDB_CODE_SUCCESS) { &pExprs[i].base.interBytes, 0, isSuperTable, pUdfInfo) != TSDB_CODE_SUCCESS) {
tfree(pExprs); tfree(pExprs);
...@@ -9447,9 +9451,7 @@ static void doUpdateExprColumnIndex(SQueryAttr *pQueryAttr) { ...@@ -9447,9 +9451,7 @@ static void doUpdateExprColumnIndex(SQueryAttr *pQueryAttr) {
for (int32_t k = 0; k < pQueryAttr->numOfOutput; ++k) { for (int32_t k = 0; k < pQueryAttr->numOfOutput; ++k) {
SSqlExpr *pSqlExprMsg = &pQueryAttr->pExpr1[k].base; SSqlExpr *pSqlExprMsg = &pQueryAttr->pExpr1[k].base;
if (pSqlExprMsg->functionId == TSDB_FUNC_SCALAR_EXPR || if (pSqlExprMsg->functionId == TSDB_FUNC_SCALAR_EXPR ||
pSqlExprMsg->functionId == TSDB_FUNC_WSTART || isTimeWindowFunction(pSqlExprMsg->functionId)) {
pSqlExprMsg->functionId == TSDB_FUNC_WSTOP ||
pSqlExprMsg->functionId == TSDB_FUNC_WDURATION) {
continue; continue;
} }
......
...@@ -31,6 +31,10 @@ extern "C" { ...@@ -31,6 +31,10 @@ extern "C" {
#define TSQL_TSWIN_STOP "_wstop" #define TSQL_TSWIN_STOP "_wstop"
#define TSQL_TSWIN_DURATION "_wduration" #define TSQL_TSWIN_DURATION "_wduration"
#define TSQL_QUERY_START "_qstart"
#define TSQL_QUERY_STOP "_qstop"
#define TSQL_QUERY_DURATION "_qduration"
#define TSQL_BLOCK_DIST "_BLOCK_DIST" #define TSQL_BLOCK_DIST "_BLOCK_DIST"
#define TSQL_BLOCK_DIST_L "_block_dist" #define TSQL_BLOCK_DIST_L "_block_dist"
......
###################################################################
# Copyright (c) 2021 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def caseDescription(self):
'''
case1<Ganlin Zhao>: [TD-11216]<feature>: Time window related keywords
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def checkTimestampEqual(self, elm, expect_elm):
caller = inspect.getframeinfo(inspect.stack()[1][0])
if len(elm) == len(expect_elm):
delta = abs(int(elm[-1]) - int(expect_elm[-1]))
if delta == 1: #ignore 1 second diff
new_elm = expect_elm[0:-1] + elm[-1]
else:
new_elm = expect_elm;
if elm == new_elm:
tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (tdSql.sql, elm, new_elm))
else:
args = (caller.filename, caller.lineno, tdSql.sql, elm, new_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
else:
args = (caller.filename, caller.lineno, tdSql.sql, elm, expect_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
def run(self):
print("running {}".format(__file__))
#Prepare data
#db precision "ms"
tdSql.execute("drop database if exists db_m")
tdSql.execute("create database if not exists db_m")
tdSql.execute('use db_m')
tdSql.execute("create stable stb (ts timestamp, c0 int) tags (t0 int);")
tdSql.execute("create table ctb1 using stb tags (1);")
tdSql.execute("create table ctb2 using stb tags (2);")
tdSql.execute("create table tb (ts timestamp, c0 int);")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:05', 5)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:00', 0)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:01', 1)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:02', 2)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:03', 3)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:04', 4)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:05', 5)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:05', 5)")
#db precision "us"
tdSql.execute("drop database if exists db_u")
tdSql.execute("create database if not exists db_u precision 'us'")
tdSql.execute('use db_u')
tdSql.execute("create stable stb (ts timestamp, c0 int) tags (t0 int);")
tdSql.execute("create table ctb1 using stb tags (1);")
tdSql.execute("create table ctb2 using stb tags (2);")
tdSql.execute("create table tb (ts timestamp, c0 int);")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:05', 5)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:00', 0)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:01', 1)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:02', 2)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:03', 3)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:04', 4)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:05', 5)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:05', 5)")
#db precision "ns"
tdSql.execute("drop database if exists db_n")
tdSql.execute("create database if not exists db_n precision 'ns'")
tdSql.execute('use db_n')
tdSql.execute("create stable stb (ts timestamp, c0 int) tags (t0 int);")
tdSql.execute("create table ctb1 using stb tags (1);")
tdSql.execute("create table ctb2 using stb tags (2);")
tdSql.execute("create table tb (ts timestamp, c0 int);")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into ctb1 values ('2022-02-02 02:00:05', 5)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:00', 0)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:01', 1)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:02', 2)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:03', 3)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:04', 4)")
tdSql.execute("insert into ctb2 values ('2022-02-02 03:00:05', 5)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:00', 0)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:01', 1)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:02', 2)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:03', 3)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:04', 4)")
tdSql.execute("insert into tb values ('2022-02-02 02:00:05', 5)")
#execute query
print("============== STEP 1: select _qsatrt,_qstop,_qduration in projection query ================== ")
# db precision "ms"
tdSql.execute('use db_m')
## _qstart
tdSql.query("select _qstart from tb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstart from ctb1;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstart from stb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(8, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(9, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(10, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(11, 0)
tdSql.query("select _qstart from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
#res = tdSql.getData(8, 0)
#tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart,ts from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,ts from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,ts from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,_c0 from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,_c0 from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,_c0 from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,tbname from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,tbname from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,tbname from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
##_qstop
tdSql.query("select _qstop from tb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstop from ctb1;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstop from stb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(8, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(9, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(10, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(11, 0)
tdSql.query("select _qstop from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.query("select _qstop from tb where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop from ctb1 where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop from stb where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop,ts from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,ts from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,ts from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,_c0 from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,_c0 from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,_c0 from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,tbname from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,tbname from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,tbname from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
##_qduration
tdSql.query("select _qduration from tb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from ctb1;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from stb;")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
tdSql.checkEqual(res, None)
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(8, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(9, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(10, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(11, 0)
tdSql.query("select _qduration from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(3, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(4, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(5, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(res, None)
#res = tdSql.getData(8, 0)
#tdSql.checkEqual(res, None)
tdSql.query("select _qduration from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(1, 0)
tdSql.checkEqual(res, None)
res = tdSql.getData(2, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration from tb where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration from ctb1 where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration from stb where ts >= '2022-02-02 02:00:02' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,ts from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,ts from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,ts from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,_c0 from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,_c0 from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,_c0 from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,tbname from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,tbname from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
tdSql.query("select _qduration,tbname from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 4000)
tdSql.checkData(1, 0, 4000)
tdSql.checkData(2, 0, 4000)
#_qstart,_qstop,_qduration together
tdSql.query("select _qstart,_qstop,_qduration,c0 from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(0, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(1, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(2, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
tdSql.checkData(0, 2, 4000)
tdSql.checkData(1, 2, 4000)
tdSql.checkData(2, 2, 4000)
tdSql.query("select _qstart,_qstop,_qduration,c0 from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(0, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(1, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(2, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
tdSql.checkData(0, 2, 4000)
tdSql.checkData(1, 2, 4000)
tdSql.checkData(2, 2, 4000)
tdSql.query("select _qstart,_qstop,_qduration,c0 from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:07';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(0, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(1, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
res = tdSql.getData(2, 1)
tdSql.checkEqual(str(res), "2022-02-02 02:00:07")
tdSql.checkData(0, 2, 4000)
tdSql.checkData(1, 2, 4000)
tdSql.checkData(2, 2, 4000)
# db precision "us"
tdSql.execute('use db_u')
##_qstart
tdSql.query("select _qstart from tb where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(2)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
tdSql.query("select _qstart from ctb1 where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(2)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
tdSql.query("select _qstart from stb where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(6)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
#res = tdSql.getData(6, 0)
#tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
#res = tdSql.getData(7, 0)
#tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
##_qstop
tdSql.query("select _qstop from tb where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
tdSql.query("select _qstop from ctb1 where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
tdSql.query("select _qstop from stb where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
##_qduration
tdSql.query("select _qduration from tb where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000001)
tdSql.checkData(1, 0, 3000001)
tdSql.checkData(2, 0, 3000001)
tdSql.query("select _qduration from ctb1 where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000001)
tdSql.checkData(1, 0, 3000001)
tdSql.checkData(2, 0, 3000001)
tdSql.query("select _qduration from stb where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000001)
tdSql.checkData(1, 0, 3000001)
tdSql.checkData(2, 0, 3000001)
print("============== STEP 2: select _qstart,_qstop,_qduration in aggregate/selective/scalar query ================== ")
# db precision "ms"
tdSql.execute('use db_m')
## _qstart
tdSql.query("select _qstart,avg(c0) from tb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstart,avg(c0) from ctb1;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstart,avg(c0) from stb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstart,avg(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,avg(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,avg(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart,avg(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstart,sum(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,sum(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,sum(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,count(*) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,count(*) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,count(*) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,min(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,min(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,min(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,first(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,first(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,first(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,ceil(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,ceil(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,ceil(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,round(1.5) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,round(1.5) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,round(1.5) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,abs(1.5) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,abs(1.5) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstart,abs(1.5) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(9)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
##_qstop
tdSql.query("select _qstop,avg(c0) from tb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstop,avg(c0) from ctb1;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstop,avg(c0) from stb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qstop,avg(c0) from tb where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstop,avg(c0) from ctb1 where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstop,avg(c0) from stb where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query("select _qstop,avg(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop,avg(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qstop,sum(c0) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,sum(c0) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,sum(c0) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,count(*) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,count(*) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,count(*) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,min(c0) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,min(c0) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,min(c0) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,first(c0) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,first(c0) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,first(c0) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,ceil(c0) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,ceil(c0) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,ceil(c0) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,round(1.5) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,round(1.5) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,round(1.5) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,abs(1.5) from tb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,abs(1.5) from ctb1 where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query("select _qstop,abs(1.5) from stb where ts <= '2022-02-02 02:00:02';")
tdSql.checkRows(3)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
##_qduration
tdSql.query("select _qduration,avg(c0) from tb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from ctb1;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from stb;")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from tb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from stb where ts >= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from tb where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from ctb1 where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from stb where ts <= '2022-02-02 02:00:03';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(res, None)
tdSql.query("select _qduration,avg(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration,avg(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:00';")
tdSql.checkRows(0)
tdSql.query("select _qduration,sum(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,sum(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,sum(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,count(*) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,count(*) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,count(*) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,min(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,min(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,min(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,first(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,first(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,first(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000)
tdSql.query("select _qduration,ceil(c0) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,ceil(c0) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,ceil(c0) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,round(1.5) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,round(1.5) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,round(1.5) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,abs(1.5) from tb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,abs(1.5) from ctb1 where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query("select _qduration,abs(1.5) from stb where ts >= '2022-02-02 02:00:03' and ts <= '2022-02-02 02:00:06';")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
# db precision "us"
tdSql.execute('use db_u')
##_qstart
tdSql.query("select _qstart,avg(c0) from tb where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
tdSql.query("select _qstart,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
tdSql.query("select _qstart,avg(c0) from stb where ts >= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03.123456")
##_qstop
tdSql.query("select _qstop,avg(c0) from tb where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
tdSql.query("select _qstop,avg(c0) from ctb1 where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
tdSql.query("select _qstop,avg(c0) from stb where ts <= '2022-02-02 02:00:02.123456';")
tdSql.checkRows(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02.123456")
##_qduration
tdSql.query("select _qduration,avg(c0) from tb where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000001)
tdSql.query("select _qduration,avg(c0) from ctb1 where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000001)
tdSql.query("select _qduration,avg(c0) from stb where ts >= '2022-02-02 02:00:00.123455' and ts <= '2022-02-02 02:00:03.123456';")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3000001)
print("============== STEP 3: select _qsatrt,_qstop,_qduration in nested outer query ================== ")
tdSql.execute('use db_m')
##_wstart
tdSql.query('select _qstart from (select _qstart,c0 from tb where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(3)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query('select _qstart from (select _qstart,c0 from ctb1 where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(3)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query('select _qstart from (select _qstart,c0 from stb where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(9)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(3, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(4, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(5, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(6, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(7, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
res = tdSql.getData(8, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query('select _qstart from (select _qstart,sum(c0) from tb where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query('select _qstart from (select _qstart,sum(c0) from ctb1 where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
tdSql.query('select _qstart from (select _qstart,sum(c0) from stb where ts >= "2022-02-02 02:00:03")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:03")
##_wstop
tdSql.query('select _qstop from (select _qstop,c0 from tb where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(3)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query('select _qstop from (select _qstop,c0 from ctb1 where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(3)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query('select _qstop from (select _qstop,c0 from stb where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(3)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(1, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
res = tdSql.getData(2, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query('select _qstop from (select _qstop,sum(c0) from tb where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query('select _qstop from (select _qstop,sum(c0) from ctb1 where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
tdSql.query('select _qstop from (select _qstop,sum(c0) from stb where ts <= "2022-02-02 02:00:02")')
tdSql.checkRows(1)
tdSql.checkCols(1)
res = tdSql.getData(0, 0)
tdSql.checkEqual(str(res), "2022-02-02 02:00:02")
##_wduration
tdSql.query('select _qduration from (select _qduration,c0 from tb where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(3)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query('select _qduration from (select _qduration,c0 from ctb1 where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(3)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query('select _qduration from (select _qduration,c0 from stb where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(3)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
tdSql.checkData(1, 0, 3000)
tdSql.checkData(2, 0, 3000)
tdSql.query('select _qduration from (select _qduration,sum(c0) from tb where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(1)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
tdSql.query('select _qduration from (select _qduration,sum(c0) from ctb1 where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(1)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
tdSql.query('select _qduration from (select _qduration,sum(c0) from stb where ts >= "2022-02-02 02:00:03" and ts <= "2022-02-02 02:00:06")')
tdSql.checkRows(1)
tdSql.checkCols(1)
tdSql.checkData(0, 0, 3000)
print("============== STEP 5: select _qstart/_qstop/_qduration other cases ================== ")
#distinct
tdSql.query("select distinct _qstart from tb")
tdSql.query("select distinct _qstart from ctb1")
tdSql.query("select distinct _qstart from stb")
tdSql.query("select distinct _qstop from tb")
tdSql.query("select distinct _qstop from ctb1")
tdSql.query("select distinct _qstop from stb")
tdSql.query("select distinct _qduration from tb")
tdSql.query("select distinct _qduration from ctb1")
tdSql.query("select distinct _qduration from stb")
#_qs,col
tdSql.query("select _qstart,ts from tb")
tdSql.query("select _qstart,ts from ctb1")
tdSql.query("select _qstart,ts from stb")
tdSql.query("select _qstart,c0 from tb")
tdSql.query("select _qstart,c0 from ctb1")
tdSql.query("select _qstart,c0 from stb")
tdSql.query("select _qstart,_qstart from tb")
tdSql.query("select _qstart,_qstart from ctb1")
tdSql.query("select _qstart,_qstart from stb")
tdSql.query("select _qstart,t0 from ctb1")
tdSql.query("select _qstart,t0 from stb")
tdSql.query("select _qstop,ts from tb")
tdSql.query("select _qstop,ts from ctb1")
tdSql.query("select _qstop,ts from stb")
tdSql.query("select _qstop,c0 from tb")
tdSql.query("select _qstop,c0 from ctb1")
tdSql.query("select _qstop,c0 from stb")
tdSql.query("select _qstop,_qstop from tb")
tdSql.query("select _qstop,_qstop from ctb1")
tdSql.query("select _qstop,_qstop from stb")
tdSql.query("select _qstop,t0 from ctb1")
tdSql.query("select _qstop,t0 from stb")
tdSql.query("select _qduration,ts from tb")
tdSql.query("select _qduration,ts from ctb1")
tdSql.query("select _qduration,ts from stb")
tdSql.query("select _qduration,c0 from tb")
tdSql.query("select _qduration,c0 from ctb1")
tdSql.query("select _qduration,c0 from stb")
tdSql.query("select _qduration,_qduration from tb")
tdSql.query("select _qduration,_qduration from ctb1")
tdSql.query("select _qduration,_qduration from stb")
tdSql.query("select _qduration,t0 from ctb1")
tdSql.query("select _qduration,t0 from stb")
#_qs,constant
tdSql.query("select _qstart,1 from tb")
tdSql.query("select _qstart,1 from ctb1")
tdSql.query("select _qstart,1 from stb")
tdSql.query("select _qstart,true from tb")
tdSql.query("select _qstart,true from ctb1")
tdSql.query("select _qstart,true from stb")
tdSql.query("select _qstart,'abc' from tb")
tdSql.query("select _qstart,'abc' from ctb1")
tdSql.query("select _qstart,'abc' from stb")
tdSql.query("select _qstop,1 from tb")
tdSql.query("select _qstop,1 from ctb1")
tdSql.query("select _qstop,1 from stb")
tdSql.query("select _qstop,true from tb")
tdSql.query("select _qstop,true from ctb1")
tdSql.query("select _qstop,true from stb")
tdSql.query("select _qstop,'abc' from tb")
tdSql.query("select _qstop,'abc' from ctb1")
tdSql.query("select _qstop,'abc' from stb")
tdSql.query("select _qduration,1 from tb")
tdSql.query("select _qduration,1 from ctb1")
tdSql.query("select _qduration,1 from stb")
tdSql.query("select _qduration,true from tb")
tdSql.query("select _qduration,true from ctb1")
tdSql.query("select _qduration,true from stb")
tdSql.query("select _qduration,'abc' from tb")
tdSql.query("select _qduration,'abc' from ctb1")
tdSql.query("select _qduration,'abc' from stb")
#interval/sliding
tdSql.query("select _qstart from tb interval (1s)")
tdSql.query("select _qstart from ctb1 interval (1s)")
tdSql.query("select _qstart from stb interval (1s)")
tdSql.query("select _qstop from tb interval (1s)")
tdSql.query("select _qstop from ctb1 interval (1s)")
tdSql.query("select _qstop from stb interval (1s)")
tdSql.query("select _qduration from tb interval (1s)")
tdSql.query("select _qduration from ctb1 interval (1s)")
tdSql.query("select _qduration from stb interval (1s)")
tdSql.query("select _qstart from tb interval (1s) sliding (1s)")
tdSql.query("select _qstart from ctb1 interval (1s) sliding (1s)")
tdSql.query("select _qstart from stb interval (1s) sliding (1s)")
tdSql.query("select _qstop from tb interval (1s) sliding (1s)")
tdSql.query("select _qstop from ctb1 interval (1s) sliding (1s)")
tdSql.query("select _qstop from stb interval (1s) sliding (1s)")
tdSql.query("select _qduration from tb interval (1s) sliding (1s)")
tdSql.query("select _qduration from ctb1 interval (1s) sliding (1s)")
tdSql.query("select _qduration from stb interval (1s) sliding (1s)")
#session_window
tdSql.query("select _qstart,avg(c0) from tb session(ts, 1s)")
tdSql.query("select _qstart,avg(c0) from ctb1 session(ts, 1s)")
tdSql.query("select _qstop,avg(c0) from tb session(ts, 1s)")
tdSql.query("select _qstop,avg(c0) from ctb1 session(ts, 1s)")
tdSql.query("select _qduration,avg(c0) from tb session(ts, 1s)")
tdSql.query("select _qduration,avg(c0) from ctb1 session(ts, 1s)")
#order by
tdSql.query("select _qstart from tb order by ts")
tdSql.query("select _qstart from ctb1 order by ts")
tdSql.query("select _qstart from stb order by ts")
#tdSql.query("select _qstart from tb order by ts desc")
#tdSql.query("select _qstart from ctb1 order by ts desc")
#tdSql.query("select _qstart from stb order by ts desc")
tdSql.query("select _qstop from tb order by ts")
tdSql.query("select _qstop from ctb1 order by ts")
tdSql.query("select _qstop from stb order by ts")
#tdSql.query("select _qstop from tb order by ts desc")
#tdSql.query("select _qstop from ctb1 order by ts desc")
#tdSql.query("select _qstop from stb order by ts desc")
tdSql.query("select _qduration from tb order by ts")
tdSql.query("select _qduration from ctb1 order by ts")
tdSql.query("select _qduration from stb order by ts")
#tdSql.query("select _qduration from tb order by ts desc")
#tdSql.query("select _qduration from ctb1 order by ts desc")
#tdSql.query("select _qduration from stb order by ts desc")
#limit
tdSql.query("select _qstart from tb limit 3")
tdSql.query("select _qstart from ctb1 limit 3")
tdSql.query("select _qstart from stb limit 3")
tdSql.query("select _qstop from tb limit 3")
tdSql.query("select _qstop from ctb1 limit 3")
tdSql.query("select _qstop from stb limit 3")
tdSql.query("select _qduration from tb limit 3")
tdSql.query("select _qduration from ctb1 limit 3")
tdSql.query("select _qduration from stb limit 3")
############# not supported ###############
tdSql.error("select _qstart + 1 from tb interval (1s)")
tdSql.error("select _qstart + 1 from ctb1 interval (1s)")
tdSql.error("select _qstart + 1 from stb interval (1s)")
tdSql.error("select _qstart + 1.0 from tb interval (1s)")
tdSql.error("select _qstart + 1.0 from ctb1 interval (1s)")
tdSql.error("select _qstart + 1.0 from stb interval (1s)")
tdSql.error("select _qstart + true from tb interval (1s)")
tdSql.error("select _qstart + true from ctb1 interval (1s)")
tdSql.error("select _qstart + true from stb interval (1s)")
tdSql.error("select _qstart + 'abc' from tb interval (1s)")
tdSql.error("select _qstart + 'abc' from ctb1 interval (1s)")
tdSql.error("select _qstart + 'abc' from stb interval (1s)")
tdSql.error("select _qstart + 1s from tb interval (1s)")
tdSql.error("select _qstart + 1s from ctb1 interval (1s)")
tdSql.error("select _qstart + 1s from stb interval (1s)")
tdSql.error("select _qstart + ts from tb interval (1s)")
tdSql.error("select _qstart + ts from ctb1 interval (1s)")
tdSql.error("select _qstart + ts from stb interval (1s)")
tdSql.error("select _qstart + c0 from tb interval (1s)")
tdSql.error("select _qstart + c0 from ctb1 interval (1s)")
tdSql.error("select _qstart + c0 from stb interval (1s)")
tdSql.error("select _qstart + _qstop from tb interval (1s)")
tdSql.error("select _qstart + _qstop from ctb1 interval (1s)")
tdSql.error("select _qstart + _qstop from stb interval (1s)")
tdSql.error("select _qstart + _qduration from tb interval (1s)")
tdSql.error("select _qstart + _qduration from ctb1 interval (1s)")
tdSql.error("select _qstart + _qduration from stb interval (1s)")
tdSql.error("select _qstop + 1 from tb interval (1s)")
tdSql.error("select _qstop + 1 from ctb1 interval (1s)")
tdSql.error("select _qstop + 1 from stb interval (1s)")
tdSql.error("select _qstop + 1.0 from tb interval (1s)")
tdSql.error("select _qstop + 1.0 from ctb1 interval (1s)")
tdSql.error("select _qstop + 1.0 from stb interval (1s)")
tdSql.error("select _qstop + true from tb interval (1s)")
tdSql.error("select _qstop + true from ctb1 interval (1s)")
tdSql.error("select _qstop + true from stb interval (1s)")
tdSql.error("select _qstop + 'abc' from tb interval (1s)")
tdSql.error("select _qstop + 'abc' from ctb1 interval (1s)")
tdSql.error("select _qstop + 'abc' from stb interval (1s)")
tdSql.error("select _qstop + 1s from tb interval (1s)")
tdSql.error("select _qstop + 1s from ctb1 interval (1s)")
tdSql.error("select _qstop + 1s from stb interval (1s)")
tdSql.error("select _qstop + ts from tb interval (1s)")
tdSql.error("select _qstop + ts from ctb1 interval (1s)")
tdSql.error("select _qstop + ts from stb interval (1s)")
tdSql.error("select _qstop + c0 from tb interval (1s)")
tdSql.error("select _qstop + c0 from ctb1 interval (1s)")
tdSql.error("select _qstop + c0 from stb interval (1s)")
tdSql.error("select _qstop + _qstart from tb interval (1s)")
tdSql.error("select _qstop + _qstart from ctb1 interval (1s)")
tdSql.error("select _qstop + _qstart from stb interval (1s)")
tdSql.error("select _qstop + _qduration from tb interval (1s)")
tdSql.error("select _qstop + _qduration from ctb1 interval (1s)")
tdSql.error("select _qstop + _qduration from stb interval (1s)")
tdSql.error("select _qduration + 1 from tb interval (1s)")
tdSql.error("select _qduration + 1 from ctb1 interval (1s)")
tdSql.error("select _qduration + 1 from stb interval (1s)")
tdSql.error("select _qduration + 1.0 from tb interval (1s)")
tdSql.error("select _qduration + 1.0 from ctb1 interval (1s)")
tdSql.error("select _qduration + 1.0 from stb interval (1s)")
tdSql.error("select _qduration + true from tb interval (1s)")
tdSql.error("select _qduration + true from ctb1 interval (1s)")
tdSql.error("select _qduration + true from stb interval (1s)")
tdSql.error("select _qduration + 'abc' from tb interval (1s)")
tdSql.error("select _qduration + 'abc' from ctb1 interval (1s)")
tdSql.error("select _qduration + 'abc' from stb interval (1s)")
tdSql.error("select _qduration + 1s from tb interval (1s)")
tdSql.error("select _qduration + 1s from ctb1 interval (1s)")
tdSql.error("select _qduration + 1s from stb interval (1s)")
tdSql.error("select _qduration + ts from tb interval (1s)")
tdSql.error("select _qduration + ts from ctb1 interval (1s)")
tdSql.error("select _qduration + ts from stb interval (1s)")
tdSql.error("select _qduration + c0 from tb interval (1s)")
tdSql.error("select _qduration + c0 from ctb1 interval (1s)")
tdSql.error("select _qduration + c0 from stb interval (1s)")
tdSql.error("select _qduration + _qstart from tb interval (1s)")
tdSql.error("select _qduration + _qstart from ctb1 interval (1s)")
tdSql.error("select _qduration + _qstart from stb interval (1s)")
tdSql.error("select _qduration + _qduration from tb interval (1s)")
tdSql.error("select _qduration + _qduration from ctb1 interval (1s)")
tdSql.error("select _qduration + _qduration from stb interval (1s)")
#state_window
tdSql.error("select _qstart,avg(c0) from tb state_window(c0)")
tdSql.error("select _qstart,avg(c0) from ctb1 state_window(c0)")
tdSql.error("select _qstop,avg(c0) from tb state_window(c0)")
tdSql.error("select _qstop,avg(c0) from ctb1 state_window(c0)")
tdSql.error("select _qduration,avg(c0) from tb state_window(c0)")
tdSql.error("select _qduration,avg(c0) from ctb1 state_window(c0)")
#group by
tdSql.error("select _qstart from stb group by tbname")
tdSql.error("select _qstop from stb group by tbname")
tdSql.error("select _qduration from stb group by tbname")
return
tdSql.execute('drop database db_m')
tdSql.execute('drop database db_u')
tdSql.execute('drop database db_n')
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -713,6 +713,7 @@ ...@@ -713,6 +713,7 @@
5,,develop-test,python3 ./test.py -f 2-query/function_to_iso8601.py 5,,develop-test,python3 ./test.py -f 2-query/function_to_iso8601.py
5,,develop-test,python3 ./test.py -f 2-query/function_to_unixtimestamp.py 5,,develop-test,python3 ./test.py -f 2-query/function_to_unixtimestamp.py
5,,develop-test,python3 ./test.py -f 2-query/time_window_keywords.py 5,,develop-test,python3 ./test.py -f 2-query/time_window_keywords.py
5,,develop-test,python3 ./test.py -f 2-query/query_window_keywords.py
4,,system-test,python3 test.py -f 4-taosAdapter/TD-12163.py 4,,system-test,python3 test.py -f 4-taosAdapter/TD-12163.py
4,,system-test,python3 ./test.py -f 3-connectors/restful/restful_binddbname.py 4,,system-test,python3 ./test.py -f 3-connectors/restful/restful_binddbname.py
4,,system-test,python3 ./test.py -f 2-query/TD-12614.py 4,,system-test,python3 ./test.py -f 2-query/TD-12614.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册