fix(query): fix state operator check
This commit is contained in:
parent
3bcd669fcd
commit
810be53374
|
@ -1132,9 +1132,9 @@ static bool validateStateOper(const SValueNode* pVal) {
|
|||
if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) {
|
||||
return false;
|
||||
}
|
||||
return (0 == strcasecmp(varDataVal(pVal->datum.p), "GT") || 0 == strcasecmp(varDataVal(pVal->datum.p), "GE") ||
|
||||
0 == strcasecmp(varDataVal(pVal->datum.p), "LT") || 0 == strcasecmp(varDataVal(pVal->datum.p), "LE") ||
|
||||
0 == strcasecmp(varDataVal(pVal->datum.p), "EQ") || 0 == strcasecmp(varDataVal(pVal->datum.p), "NE"));
|
||||
return (0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) ||
|
||||
0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) ||
|
||||
0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2));
|
||||
}
|
||||
|
||||
static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||
|
|
|
@ -4416,17 +4416,17 @@ bool getStateFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
|
|||
|
||||
static int8_t getStateOpType(char* opStr) {
|
||||
int8_t opType;
|
||||
if (strcasecmp(opStr, "LT") == 0) {
|
||||
if (strncasecmp(opStr, "LT", 2) == 0) {
|
||||
opType = STATE_OPER_LT;
|
||||
} else if (strcasecmp(opStr, "GT") == 0) {
|
||||
} else if (strncasecmp(opStr, "GT", 2) == 0) {
|
||||
opType = STATE_OPER_GT;
|
||||
} else if (strcasecmp(opStr, "LE") == 0) {
|
||||
} else if (strncasecmp(opStr, "LE", 2) == 0) {
|
||||
opType = STATE_OPER_LE;
|
||||
} else if (strcasecmp(opStr, "GE") == 0) {
|
||||
} else if (strncasecmp(opStr, "GE", 2) == 0) {
|
||||
opType = STATE_OPER_GE;
|
||||
} else if (strcasecmp(opStr, "NE") == 0) {
|
||||
} else if (strncasecmp(opStr, "NE", 2) == 0) {
|
||||
opType = STATE_OPER_NE;
|
||||
} else if (strcasecmp(opStr, "EQ") == 0) {
|
||||
} else if (strncasecmp(opStr, "EQ", 2) == 0) {
|
||||
opType = STATE_OPER_EQ;
|
||||
} else {
|
||||
opType = STATE_OPER_INVALID;
|
||||
|
|
|
@ -2470,17 +2470,17 @@ typedef enum {
|
|||
|
||||
static int8_t getStateOpType(char* opStr) {
|
||||
int8_t opType;
|
||||
if (strcasecmp(opStr, "LT") == 0) {
|
||||
if (strncasecmp(opStr, "LT", 2) == 0) {
|
||||
opType = STATE_OPER_LT;
|
||||
} else if (strcasecmp(opStr, "GT") == 0) {
|
||||
} else if (strncasecmp(opStr, "GT", 2) == 0) {
|
||||
opType = STATE_OPER_GT;
|
||||
} else if (strcasecmp(opStr, "LE") == 0) {
|
||||
} else if (strncasecmp(opStr, "LE", 2) == 0) {
|
||||
opType = STATE_OPER_LE;
|
||||
} else if (strcasecmp(opStr, "GE") == 0) {
|
||||
} else if (strncasecmp(opStr, "GE", 2) == 0) {
|
||||
opType = STATE_OPER_GE;
|
||||
} else if (strcasecmp(opStr, "NE") == 0) {
|
||||
} else if (strncasecmp(opStr, "NE", 2) == 0) {
|
||||
opType = STATE_OPER_NE;
|
||||
} else if (strcasecmp(opStr, "EQ") == 0) {
|
||||
} else if (strncasecmp(opStr, "EQ", 2) == 0) {
|
||||
opType = STATE_OPER_EQ;
|
||||
} else {
|
||||
opType = STATE_OPER_INVALID;
|
||||
|
|
Loading…
Reference in New Issue