提交 b9edd24d 编写于 作者: S slzhou

fix: create function error for json/decimal/blob/varbinary type

上级 93e50588
...@@ -6393,6 +6393,15 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS ...@@ -6393,6 +6393,15 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS
if (fmIsBuiltinFunc(pStmt->funcName)) { if (fmIsBuiltinFunc(pStmt->funcName)) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FUNCTION_NAME); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FUNCTION_NAME);
} }
if (TSDB_DATA_TYPE_JSON == pStmt->outputDt.type ||
TSDB_DATA_TYPE_VARBINARY == pStmt->outputDt.type ||
TSDB_DATA_TYPE_DECIMAL == pStmt->outputDt.type ||
TSDB_DATA_TYPE_BLOB == pStmt->outputDt.type ||
TSDB_DATA_TYPE_MEDIUMBLOB == pStmt->outputDt.type) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Unsupported output type for UDF");
}
SCreateFuncReq req = {0}; SCreateFuncReq req = {0};
strcpy(req.name, pStmt->funcName); strcpy(req.name, pStmt->funcName);
req.igExists = pStmt->ignoreExists; req.igExists = pStmt->ignoreExists;
......
...@@ -29,6 +29,9 @@ else ...@@ -29,6 +29,9 @@ else
sql create function bit_and as '/tmp/udf/libbitand.so' outputtype int bufSize 8; sql create function bit_and as '/tmp/udf/libbitand.so' outputtype int bufSize 8;
sql create aggregate function l2norm as '/tmp/udf/libl2norm.so' outputtype double bufSize 8; sql create aggregate function l2norm as '/tmp/udf/libl2norm.so' outputtype double bufSize 8;
endi endi
sql_error create function bit_and as '/tmp/udf/libbitand.so' oputtype json;
sql show functions; sql show functions;
if $rows != 2 then if $rows != 2 then
return -1 return -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册