fix:support length function for varbinary
This commit is contained in:
parent
69428fdd0b
commit
a0fadb07ea
|
@ -1839,10 +1839,6 @@ static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_DATA_TYPE_VARBINARY == ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type) {
|
|
||||||
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT};
|
pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT};
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,10 +157,6 @@ void varbinary_sql_test() {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
// string function test, not support
|
// string function test, not support
|
||||||
pRes = taos_query(taos, "select length(c2) from stb");
|
|
||||||
ASSERT(taos_errno(pRes) != 0);
|
|
||||||
taos_free_result(pRes);
|
|
||||||
|
|
||||||
pRes = taos_query(taos, "select ltrim(c2) from stb");
|
pRes = taos_query(taos, "select ltrim(c2) from stb");
|
||||||
ASSERT(taos_errno(pRes) != 0);
|
ASSERT(taos_errno(pRes) != 0);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
@ -190,7 +186,7 @@ void varbinary_sql_test() {
|
||||||
ASSERT(taos_errno(pRes) != 0);
|
ASSERT(taos_errno(pRes) != 0);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
// support first/last/last_row/count/hyperloglog/sample/tail/mode
|
// support first/last/last_row/count/hyperloglog/sample/tail/mode/length
|
||||||
pRes = taos_query(taos, "select first(c2) from stb");
|
pRes = taos_query(taos, "select first(c2) from stb");
|
||||||
ASSERT(taos_errno(pRes) == 0);
|
ASSERT(taos_errno(pRes) == 0);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
@ -207,6 +203,10 @@ void varbinary_sql_test() {
|
||||||
ASSERT(taos_errno(pRes) == 0);
|
ASSERT(taos_errno(pRes) == 0);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
pRes = taos_query(taos, "select length(c2) from stb where c2 = '\\x7F8290'");
|
||||||
|
ASSERT(taos_errno(pRes) == 0);
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(taos, "select cast(t2 as varbinary(16)) from stb order by ts");
|
pRes = taos_query(taos, "select cast(t2 as varbinary(16)) from stb order by ts");
|
||||||
while ((row = taos_fetch_row(pRes)) != NULL) {
|
while ((row = taos_fetch_row(pRes)) != NULL) {
|
||||||
int32_t* length = taos_fetch_lengths(pRes);
|
int32_t* length = taos_fetch_lengths(pRes);
|
||||||
|
|
Loading…
Reference in New Issue