Merge pull request #13586 from taosdata/feature/qnode
fix: fix in compare issue
This commit is contained in:
commit
9193eaf891
|
@ -2500,6 +2500,7 @@ typedef struct {
|
|||
int64_t sliding;
|
||||
int64_t dstTbUid;
|
||||
int32_t dstVgId; // for stream
|
||||
SEpSet epSet;
|
||||
char* expr;
|
||||
} STableIndexInfo;
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ typedef struct SAggFunctionInfo {
|
|||
struct SScalarParam {
|
||||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
int32_t hashValueType;
|
||||
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
|
||||
int32_t numOfRows;
|
||||
};
|
||||
|
|
|
@ -2427,6 +2427,7 @@ int32_t tSerializeSTableIndexInfo(SEncoder *pEncoder, STableIndexInfo* pInfo) {
|
|||
if (tEncodeI64(pEncoder, pInfo->sliding) < 0) return -1;
|
||||
if (tEncodeI64(pEncoder, pInfo->dstTbUid) < 0) return -1;
|
||||
if (tEncodeI32(pEncoder, pInfo->dstVgId) < 0) return -1;
|
||||
if (tEncodeSEpSet(pEncoder, &pInfo->epSet) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, pInfo->expr) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2459,6 +2460,7 @@ int32_t tDeserializeSTableIndexInfo(SDecoder *pDecoder, STableIndexInfo *pInfo)
|
|||
if (tDecodeI64(pDecoder, &pInfo->sliding) < 0) return -1;
|
||||
if (tDecodeI64(pDecoder, &pInfo->dstTbUid) < 0) return -1;
|
||||
if (tDecodeI32(pDecoder, &pInfo->dstVgId) < 0) return -1;
|
||||
if (tDecodeSEpSet(pDecoder, &pInfo->epSet) < 0) return -1;
|
||||
if (tDecodeCStrAlloc(pDecoder, &pInfo->expr) < 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -894,6 +894,15 @@ static int32_t mndGetTableSma(SMnode *pMnode, STableIndexReq *indexReq, STableIn
|
|||
info.sliding = pSma->sliding;
|
||||
info.dstTbUid = pSma->dstTbUid;
|
||||
info.dstVgId = pSma->dstVgId;
|
||||
|
||||
SVgObj* pVg = mndAcquireVgroup(pMnode, pSma->dstVgId);
|
||||
if (pVg == NULL) {
|
||||
code = -1;
|
||||
sdbRelease(pSdb, pSma);
|
||||
return code;
|
||||
}
|
||||
info.epSet = mndGetVgroupEpset(pMnode, pVg);
|
||||
|
||||
info.expr = taosMemoryMalloc(pSma->exprLen + 1);
|
||||
if (info.expr == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
|
|
@ -115,9 +115,9 @@ typedef struct SExplainCtx {
|
|||
#define EXPLAIN_ROW_NEW(level, ...) \
|
||||
do { \
|
||||
if (isVerboseLine) { \
|
||||
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 2 + 3, ""); \
|
||||
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 3 + 3, ""); \
|
||||
} else { \
|
||||
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 2, "", "-> "); \
|
||||
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 3, "", "-> "); \
|
||||
} \
|
||||
tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
|
|
@ -658,7 +658,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
|||
|
||||
if (EXPLAIN_MODE_ANALYZE == ctx->mode) {
|
||||
// sort key
|
||||
EXPLAIN_ROW_NEW(level, "Sort Key: ");
|
||||
EXPLAIN_ROW_NEW(level + 1, "Sort Key: ");
|
||||
if (pResNode->pExecInfo) {
|
||||
for (int32_t i = 0; i < LIST_LENGTH(pSortNode->pSortKeys); ++i) {
|
||||
SOrderByExprNode *ptn = nodesListGetNode(pSortNode->pSortKeys, i);
|
||||
|
@ -670,7 +670,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
|||
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
|
||||
|
||||
// sort method
|
||||
EXPLAIN_ROW_NEW(level, "Sort Method: ");
|
||||
EXPLAIN_ROW_NEW(level + 1, "Sort Method: ");
|
||||
|
||||
int32_t nodeNum = taosArrayGetSize(pResNode->pExecInfo);
|
||||
SExplainExecInfo *execInfo = taosArrayGet(pResNode->pExecInfo, 0);
|
||||
|
|
|
@ -2043,6 +2043,10 @@ int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TA
|
|||
return TSDB_CODE_QRY_APP_ERROR;
|
||||
}
|
||||
|
||||
if (pDataBlock->pTableMeta->tableType != TSDB_SUPER_TABLE && pDataBlock->pTableMeta->tableType != TSDB_CHILD_TABLE) {
|
||||
return TSDB_CODE_TSC_STMT_API_ERROR;
|
||||
}
|
||||
|
||||
SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta);
|
||||
if (tags->numOfBound <= 0) {
|
||||
*fieldNum = 0;
|
||||
|
|
|
@ -812,6 +812,10 @@ static EDealRes translateArithmeticOperator(STranslateContext* pCxt, SOperatorNo
|
|||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
static bool dataTypeEqual(const SDataType* l, const SDataType* r) {
|
||||
return (l->type == r->type && l->bytes == r->bytes && l->precision == r->precision && l->scale == r->scale);
|
||||
}
|
||||
|
||||
static EDealRes translateComparisonOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
|
||||
SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType;
|
||||
SDataType rdt = ((SExprNode*)(pOp->pRight))->resType;
|
||||
|
@ -819,7 +823,24 @@ static EDealRes translateComparisonOperator(STranslateContext* pCxt, SOperatorNo
|
|||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName);
|
||||
}
|
||||
if (OP_TYPE_IN == pOp->opType || OP_TYPE_NOT_IN == pOp->opType) {
|
||||
((SExprNode*)pOp->pRight)->resType = ((SExprNode*)pOp->pLeft)->resType;
|
||||
SNodeListNode* pRight = (SNodeListNode*)pOp->pRight;
|
||||
bool first = true;
|
||||
SDataType targetDt = {0};
|
||||
SNode* pNode = NULL;
|
||||
FOREACH(pNode, pRight->pNodeList) {
|
||||
SDataType dt = ((SExprNode*)pNode)->resType;
|
||||
if (first) {
|
||||
targetDt = dt;
|
||||
if (targetDt.type != TSDB_DATA_TYPE_NULL) {
|
||||
first = false;
|
||||
}
|
||||
} else if (dt.type != targetDt.type && dt.type != TSDB_DATA_TYPE_NULL) {
|
||||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName);
|
||||
} else if (dt.bytes > targetDt.bytes) {
|
||||
targetDt.bytes = dt.bytes;
|
||||
}
|
||||
}
|
||||
pRight->dataType = targetDt;
|
||||
}
|
||||
if (nodesIsRegularOp(pOp)) {
|
||||
if (!IS_VAR_DATA_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) {
|
||||
|
@ -2010,10 +2031,6 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) {
|
|||
return (SNode*)pCol;
|
||||
}
|
||||
|
||||
static bool dataTypeEqual(const SDataType* l, const SDataType* r) {
|
||||
return (l->type == r->type && l->bytes == r->bytes && l->precision == r->precision && l->scale == r->scale);
|
||||
}
|
||||
|
||||
static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) {
|
||||
SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||
if (NULL == pFunc) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "tmsg.h"
|
||||
#include "tname.h"
|
||||
|
||||
SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = true};
|
||||
SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false};
|
||||
|
||||
int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore) {
|
||||
if (!gQWDebug.statusEnable) {
|
||||
|
@ -97,7 +97,11 @@ _return:
|
|||
QW_RET(code);
|
||||
}
|
||||
|
||||
void qwDbgDumpSchInfo(SQWSchStatus *sch, int32_t i) {}
|
||||
void qwDbgDumpSchInfo(SQWorker *mgmt, SQWSchStatus *sch, int32_t i) {
|
||||
QW_LOCK(QW_READ, &sch->tasksLock);
|
||||
QW_DLOG("the %dth scheduler status, hbBrokenTs:%" PRId64 ",taskNum:%d", i, sch->hbBrokenTs, taosHashGetSize(sch->tasksHash));
|
||||
QW_UNLOCK(QW_READ, &sch->tasksLock);
|
||||
}
|
||||
|
||||
void qwDbgDumpMgmtInfo(SQWorker *mgmt) {
|
||||
if (!gQWDebug.dumpEnable) {
|
||||
|
@ -106,7 +110,7 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) {
|
|||
|
||||
QW_LOCK(QW_READ, &mgmt->schLock);
|
||||
|
||||
/*QW_DUMP("total remain schduler num:%d", taosHashGetSize(mgmt->schHash));*/
|
||||
QW_DUMP("total remain scheduler num %d", taosHashGetSize(mgmt->schHash));
|
||||
|
||||
void *key = NULL;
|
||||
size_t keyLen = 0;
|
||||
|
@ -116,14 +120,14 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) {
|
|||
void *pIter = taosHashIterate(mgmt->schHash, NULL);
|
||||
while (pIter) {
|
||||
sch = (SQWSchStatus *)pIter;
|
||||
qwDbgDumpSchInfo(sch, i);
|
||||
qwDbgDumpSchInfo(mgmt, sch, i);
|
||||
++i;
|
||||
pIter = taosHashIterate(mgmt->schHash, pIter);
|
||||
}
|
||||
|
||||
QW_UNLOCK(QW_READ, &mgmt->schLock);
|
||||
|
||||
/*QW_DUMP("total remain ctx num:%d", taosHashGetSize(mgmt->ctxHash));*/
|
||||
QW_DUMP("total remain ctx num %d", taosHashGetSize(mgmt->ctxHash));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,11 +22,18 @@ extern "C" {
|
|||
#include "thash.h"
|
||||
#include "query.h"
|
||||
|
||||
typedef struct SOperatorValueType {
|
||||
int32_t opResType;
|
||||
int32_t selfType;
|
||||
int32_t peerType;
|
||||
} SOperatorValueType;
|
||||
|
||||
typedef struct SScalarCtx {
|
||||
int32_t code;
|
||||
SArray *pBlockList; /* element is SSDataBlock* */
|
||||
SHashObj *pRes; /* element is SScalarParam */
|
||||
void *param; // additional parameter (meta actually) for acquire value such as tbname/tags values
|
||||
SOperatorValueType type;
|
||||
} SScalarCtx;
|
||||
|
||||
|
||||
|
@ -53,7 +60,7 @@ int32_t doConvertDataType(SValueNode* pValueNode, SScalarParam* out);
|
|||
SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows);
|
||||
int32_t sclConvertToTsValueNode(int8_t precision, SValueNode* valueNode);
|
||||
|
||||
#define GET_PARAM_TYPE(_c) ((_c)->columnData->info.type)
|
||||
#define GET_PARAM_TYPE(_c) ((_c)->columnData ? (_c)->columnData->info.type : (_c)->hashValueType)
|
||||
#define GET_PARAM_BYTES(_c) ((_c)->columnData->info.bytes)
|
||||
#define GET_PARAM_PRECISON(_c) ((_c)->columnData->info.precision)
|
||||
|
||||
|
|
|
@ -3669,6 +3669,14 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
|
|||
stat->scalarMode = true;
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
} else {
|
||||
SColumnNode *refNode = (SColumnNode *)node->pLeft;
|
||||
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
||||
int32_t type = vectorGetConvertType(refNode->node.resType.type, listNode->dataType.type);
|
||||
if (0 != type && type != refNode->node.resType.type) {
|
||||
stat->scalarMode = true;
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,13 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
|||
SCL_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||
}
|
||||
|
||||
SCL_ERR_RET(scalarGenerateSetFromList((void **)¶m->pHashFilter, node, nodeList->dataType.type));
|
||||
int32_t type = vectorGetConvertType(ctx->type.selfType, ctx->type.peerType);
|
||||
if (type == 0) {
|
||||
type = nodeList->dataType.type;
|
||||
}
|
||||
|
||||
SCL_ERR_RET(scalarGenerateSetFromList((void **)¶m->pHashFilter, node, type));
|
||||
param->hashValueType = type;
|
||||
if (taosHashPut(ctx->pRes, &node, POINTER_BYTES, param, sizeof(*param))) {
|
||||
taosHashCleanup(param->pHashFilter);
|
||||
sclError("taosHashPut nodeList failed, size:%d", (int32_t)sizeof(*param));
|
||||
|
@ -334,6 +340,46 @@ _return:
|
|||
SCL_RET(code);
|
||||
}
|
||||
|
||||
int32_t sclGetNodeType(SNode *pNode, SScalarCtx *ctx) {
|
||||
if (NULL == pNode) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (nodeType(pNode)) {
|
||||
case QUERY_NODE_VALUE: {
|
||||
SValueNode *valueNode = (SValueNode *)pNode;
|
||||
return valueNode->node.resType.type;
|
||||
}
|
||||
case QUERY_NODE_NODE_LIST: {
|
||||
SNodeListNode *nodeList = (SNodeListNode *)pNode;
|
||||
return nodeList->dataType.type;
|
||||
}
|
||||
case QUERY_NODE_COLUMN: {
|
||||
SColumnNode *colNode = (SColumnNode *)pNode;
|
||||
return colNode->node.resType.type;
|
||||
}
|
||||
case QUERY_NODE_FUNCTION:
|
||||
case QUERY_NODE_OPERATOR:
|
||||
case QUERY_NODE_LOGIC_CONDITION: {
|
||||
SScalarParam *res = (SScalarParam *)taosHashGet(ctx->pRes, &pNode, POINTER_BYTES);
|
||||
if (NULL == res) {
|
||||
sclError("no result for node, type:%d, node:%p", nodeType(pNode), pNode);
|
||||
return -1;
|
||||
}
|
||||
return res->columnData->info.type;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void sclSetOperatorValueType(SOperatorNode *node, SScalarCtx *ctx) {
|
||||
ctx->type.opResType = node->node.resType.type;
|
||||
ctx->type.selfType = sclGetNodeType(node->pLeft, ctx);
|
||||
ctx->type.peerType = sclGetNodeType(node->pRight, ctx);
|
||||
}
|
||||
|
||||
int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScalarCtx *ctx, int32_t *rowNum) {
|
||||
int32_t code = 0;
|
||||
int32_t paramNum = scalarGetOperatorParamNum(node->opType);
|
||||
|
@ -348,8 +394,11 @@ int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScal
|
|||
SCL_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
sclSetOperatorValueType(node, ctx);
|
||||
|
||||
SCL_ERR_JRET(sclInitParam(node->pLeft, ¶mList[0], ctx, rowNum));
|
||||
if (paramNum > 1) {
|
||||
TSWAP(ctx->type.selfType, ctx->type.peerType);
|
||||
SCL_ERR_JRET(sclInitParam(node->pRight, ¶mList[1], ctx, rowNum));
|
||||
}
|
||||
|
||||
|
|
|
@ -627,6 +627,11 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
|
|||
SColumnInfoData* pInputCol = pIn->columnData;
|
||||
SColumnInfoData* pOutputCol = pOut->columnData;
|
||||
|
||||
if (NULL == pInputCol) {
|
||||
sclError("input column is NULL, hashFilter %p", pIn->pHashFilter);
|
||||
return TSDB_CODE_APP_ERROR;
|
||||
}
|
||||
|
||||
int16_t inType = pInputCol->info.type;
|
||||
int16_t outType = pOutputCol->info.type;
|
||||
|
||||
|
@ -827,11 +832,26 @@ int32_t vectorGetConvertType(int32_t type1, int32_t type2) {
|
|||
return gConvertTypes[type2][type1];
|
||||
}
|
||||
|
||||
int32_t vectorConvert(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam* pLeftOut, SScalarParam* pRightOut) {
|
||||
if (pLeft->pHashFilter != NULL || pRight->pHashFilter != NULL) {
|
||||
int32_t vectorConvertScalarParam(SScalarParam *input, SScalarParam *output, int32_t type) {
|
||||
int32_t code = 0;
|
||||
SDataType t = {.type = type, .bytes = tDataTypes[type].bytes};
|
||||
output->numOfRows = input->numOfRows;
|
||||
|
||||
output->columnData = createColumnInfoData(&t, input->numOfRows);
|
||||
if (output->columnData == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
code = vectorConvertImpl(input, output);
|
||||
if (code) {
|
||||
// taosMemoryFreeClear(paramOut1->data);
|
||||
return code;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t vectorConvert(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam* pLeftOut, SScalarParam* pRightOut) {
|
||||
int32_t leftType = GET_PARAM_TYPE(pLeft);
|
||||
int32_t rightType = GET_PARAM_TYPE(pRight);
|
||||
if (leftType == rightType) {
|
||||
|
@ -860,31 +880,14 @@ int32_t vectorConvert(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam* p
|
|||
}
|
||||
|
||||
if (type != GET_PARAM_TYPE(param1)) {
|
||||
SDataType t = {.type = type, .bytes = tDataTypes[type].bytes};
|
||||
paramOut1->numOfRows = param1->numOfRows;
|
||||
|
||||
paramOut1->columnData = createColumnInfoData(&t, param1->numOfRows);
|
||||
if (paramOut1->columnData == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = vectorConvertImpl(param1, paramOut1);
|
||||
code = vectorConvertScalarParam(param1, paramOut1, type);
|
||||
if (code) {
|
||||
// taosMemoryFreeClear(paramOut1->data);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
if (type != GET_PARAM_TYPE(param2)) {
|
||||
SDataType t = {.type = type, .bytes = tDataTypes[type].bytes};
|
||||
paramOut2->numOfRows = param2->numOfRows;
|
||||
|
||||
paramOut2->columnData = createColumnInfoData(&t, param2->numOfRows);
|
||||
if (paramOut2->columnData == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = vectorConvertImpl(param2, paramOut2);
|
||||
code = vectorConvertScalarParam(param2, paramOut2, type);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -1066,9 +1066,7 @@ class TDTestCase:
|
|||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
# in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c5 in (1, 6.6)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# not in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c5 not in (2, 3)'
|
||||
tdSql.query(query_sql)
|
||||
|
@ -1076,14 +1074,10 @@ class TDTestCase:
|
|||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
# and
|
||||
query_sql = f'select {select_elm} from {tb_name} where c5 > 0 and c5 >= 1 and c5 < 7 and c5 <= 6.6 and c5 != 2 and c5 <> 2 and c5 = 6.6 and c5 is not null and c5 between 2 and 6.6 and c5 not between 1 and 2 and c5 in (2,6.6) and c5 not in (1,2)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c5 > 6 or c5 >= 6.6 or c5 < 1 or c5 <= 0 or c5 != 1.1 or c5 <> 1.1 or c5 = 5 or c5 is null or c5 between 4 and 5 or c5 not between 1 and 3 or c5 in (4,5) or c5 not in (1.1,3)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# and or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c5 > 0 and c5 >= 1 or c5 < 5 and c5 <= 6.6 and c5 != 2 and c5 <> 2 and c5 = 4 or c5 is not null and c5 between 2 and 4 and c5 not between 1 and 2 and c5 in (2,4) and c5 not in (1,2)'
|
||||
tdSql.query(query_sql)
|
||||
|
@ -1151,9 +1145,7 @@ class TDTestCase:
|
|||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
# in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c6 in (1, 7.7)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# not in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c6 not in (2, 3)'
|
||||
tdSql.query(query_sql)
|
||||
|
@ -1161,14 +1153,10 @@ class TDTestCase:
|
|||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
# and
|
||||
query_sql = f'select {select_elm} from {tb_name} where c6 > 0 and c6 >= 1 and c6 < 8 and c6 <= 7.7 and c6 != 2 and c6 <> 2 and c6 = 7.7 and c6 is not null and c6 between 2 and 7.7 and c6 not between 1 and 2 and c6 in (2,7.7) and c6 not in (1,2)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c6 > 7 or c6 >= 7.7 or c6 < 1 or c6 <= 0 or c6 != 1.1 or c6 <> 1.1 or c6 = 5 or c6 is null or c6 between 4 and 5 or c6 not between 1 and 3 or c6 in (4,5) or c6 not in (1.1,3)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# and or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c6 > 0 and c6 >= 1 or c6 < 5 and c6 <= 7.7 and c6 != 2 and c6 <> 2 and c6 = 4 or c6 is not null and c6 between 2 and 4 and c6 not between 1 and 2 and c6 in (2,4) and c6 not in (1,2)'
|
||||
tdSql.query(query_sql)
|
||||
|
@ -1410,9 +1398,7 @@ class TDTestCase:
|
|||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
# in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c9 in ("binar", false)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# # not in
|
||||
query_sql = f'select {select_elm} from {tb_name} where c9 not in (true)'
|
||||
tdSql.query(query_sql)
|
||||
|
@ -1421,19 +1407,13 @@ class TDTestCase:
|
|||
|
||||
# # and
|
||||
query_sql = f'select {select_elm} from {tb_name} where c9 = true and c9 != "false" and c9 <> "binary" and c9 is not null and c9 in ("binary", true) and c9 not in ("binary")'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(9)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 9) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# # or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c9 = true or c9 != "false" or c9 <> "binary" or c9 = "true" or c9 is not null or c9 in ("binary", true) or c9 not in ("binary")'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(11)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
# # and or
|
||||
query_sql = f'select {select_elm} from {tb_name} where c9 = true and c9 != "false" or c9 <> "binary" or c9 = "true" and c9 is not null or c9 in ("binary", true) or c9 not in ("binary")'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(11)
|
||||
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
|
||||
tdSql.error(query_sql)
|
||||
query_sql = f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c9 > "binary" and c9 >= "binary8" or c9 < "binary9" and c9 <= "binary" and c9 != 2 and c9 <> 2 and c9 = 4 or c9 is not null and c9 between 2 and 4 and c9 not between 1 and 2 and c9 in (2,4) and c9 not in (1,2)'
|
||||
tdSql.query(query_sql)
|
||||
tdSql.checkRows(9)
|
||||
|
|
Loading…
Reference in New Issue