Merge pull request #15075 from taosdata/fix/TD-17400
fix(query): fix function first/last do not support constant input
This commit is contained in:
commit
94596928e8
|
@ -1423,14 +1423,6 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
|
|
||||||
for (int32_t i = 0; i < numOfParams; ++i) {
|
|
||||||
SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i);
|
|
||||||
if (QUERY_NODE_VALUE == nodeType(pParamNode)) {
|
|
||||||
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType;
|
pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,21 +221,21 @@ class TDTestCase:
|
||||||
tdSql.execute("use testdb")
|
tdSql.execute("use testdb")
|
||||||
|
|
||||||
# bug need fix
|
# bug need fix
|
||||||
tdSql.error("select last_row(c1 ,NULL) from testdb.t1")
|
tdSql.query("select last_row(c1 ,NULL) from testdb.t1")
|
||||||
|
|
||||||
error_sql_lists = [
|
error_sql_lists = [
|
||||||
"select last_row from testdb.t1",
|
"select last_row from testdb.t1",
|
||||||
"select last_row(-+--+c1) from testdb.t1",
|
"select last_row(-+--+c1) from testdb.t1",
|
||||||
"select last_row(123--123)==1 from testdb.t1",
|
"select last_row(123--123)==1 from testdb.t1",
|
||||||
"select last_row(c1) as 'd1' from testdb.t1",
|
"select last_row(c1) as 'd1' from testdb.t1",
|
||||||
"select last_row(c1 ,NULL) from testdb.t1",
|
#"select last_row(c1 ,NULL) from testdb.t1",
|
||||||
"select last_row(,) from testdb.t1;",
|
"select last_row(,) from testdb.t1;",
|
||||||
"select last_row(abs(c1) ab from testdb.t1)",
|
"select last_row(abs(c1) ab from testdb.t1)",
|
||||||
"select last_row(c1) as int from testdb.t1",
|
"select last_row(c1) as int from testdb.t1",
|
||||||
"select last_row from testdb.stb1",
|
"select last_row from testdb.stb1",
|
||||||
"select last_row(123--123)==1 from testdb.stb1",
|
"select last_row(123--123)==1 from testdb.stb1",
|
||||||
"select last_row(c1) as 'd1' from testdb.stb1",
|
"select last_row(c1) as 'd1' from testdb.stb1",
|
||||||
"select last_row(c1 ,NULL) from testdb.stb1",
|
#"select last_row(c1 ,NULL) from testdb.stb1",
|
||||||
"select last_row(,) from testdb.stb1;",
|
"select last_row(,) from testdb.stb1;",
|
||||||
"select last_row(abs(c1) ab from testdb.stb1)",
|
"select last_row(abs(c1) ab from testdb.stb1)",
|
||||||
"select last_row(c1) as int from testdb.stb1"
|
"select last_row(c1) as int from testdb.stb1"
|
||||||
|
|
Loading…
Reference in New Issue