fix: statecount function checkou arg full equal

This commit is contained in:
factosea 2024-01-25 10:19:51 +08:00
parent 75946f8bd1
commit 2513531eee
2 changed files with 11 additions and 4 deletions

View File

@ -1305,10 +1305,13 @@ static bool validateStateOper(const SValueNode* pVal) {
if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) {
return false;
}
if (strlen(varDataVal(pVal->datum.p)) == 2) {
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));
}
return false;
}
static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {

View File

@ -103,6 +103,10 @@ class TDTestCase:
f"select statecount(c1 ,'GT',1) , min(c1) from {dbname}.t1",
f"select statecount(c1 ,'GT',1) , spread(c1) from {dbname}.t1",
f"select statecount(c1 ,'GT',1) , diff(c1) from {dbname}.t1",
f"select statecount(c1 ,'GTA',1) , diff(c1) from {dbname}.t1",
f"select statecount(c1 ,'EQA',1) , diff(c1) from {dbname}.t1",
f"select statecount(c1 ,'',1) , diff(c1) from {dbname}.t1",
f"select statecount(c1 ,'E',1) , diff(c1) from {dbname}.t1",
]
for error_sql in error_sql_lists:
tdSql.error(error_sql)