fix: create function error for json/decimal/blob/varbinary type
This commit is contained in:
parent
93e50588ce
commit
b9edd24d3f
|
@ -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
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue