fix: add varchar/nchar udf support
This commit is contained in:
parent
fb95808065
commit
89d05296d8
|
@ -196,6 +196,7 @@ static FORCE_INLINE void udfColDataSetNull(SUdfColumn *pColumn, int32_t row) {
|
||||||
udfColDataSetNull_f(pColumn, row);
|
udfColDataSetNull_f(pColumn, row);
|
||||||
}
|
}
|
||||||
pColumn->hasNull = true;
|
pColumn->hasNull = true;
|
||||||
|
pColumn->colData.numOfRows = ((int32_t)(row + 1) > pColumn->colData.numOfRows) ? (int32_t)(row + 1) : pColumn->colData.numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentRow, const char *pData, bool isNull) {
|
static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentRow, const char *pData, bool isNull) {
|
||||||
|
|
|
@ -621,11 +621,7 @@ void udfdProcessSetupRequest(SUvUdfWork *uvUdf, SUdfRequest *request) {
|
||||||
rsp.code = code;
|
rsp.code = code;
|
||||||
rsp.setupRsp.udfHandle = (int64_t)(handle);
|
rsp.setupRsp.udfHandle = (int64_t)(handle);
|
||||||
rsp.setupRsp.outputType = udf->outputType;
|
rsp.setupRsp.outputType = udf->outputType;
|
||||||
if (!IS_VAR_DATA_TYPE(udf->outputType)) {
|
|
||||||
rsp.setupRsp.bytes = udf->outputLen;
|
rsp.setupRsp.bytes = udf->outputLen;
|
||||||
} else {
|
|
||||||
rsp.setupRsp.bytes = udf->outputLen + VARSTR_HEADER_SIZE;
|
|
||||||
}
|
|
||||||
rsp.setupRsp.bufSize = udf->bufSize;
|
rsp.setupRsp.bufSize = udf->bufSize;
|
||||||
|
|
||||||
int32_t len = encodeUdfResponse(NULL, &rsp);
|
int32_t len = encodeUdfResponse(NULL, &rsp);
|
||||||
|
@ -654,11 +650,7 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) {
|
||||||
switch (call->callType) {
|
switch (call->callType) {
|
||||||
case TSDB_UDF_CALL_SCALA_PROC: {
|
case TSDB_UDF_CALL_SCALA_PROC: {
|
||||||
SUdfColumn output = {0};
|
SUdfColumn output = {0};
|
||||||
if (IS_VAR_DATA_TYPE(udf->outputType)) {
|
|
||||||
output.colMeta.bytes = udf->outputLen + VARSTR_HEADER_SIZE;
|
|
||||||
} else {
|
|
||||||
output.colMeta.bytes = udf->outputLen;
|
output.colMeta.bytes = udf->outputLen;
|
||||||
}
|
|
||||||
output.colMeta.type = udf->outputType;
|
output.colMeta.type = udf->outputType;
|
||||||
output.colMeta.precision = 0;
|
output.colMeta.precision = 0;
|
||||||
output.colMeta.scale = 0;
|
output.colMeta.scale = 0;
|
||||||
|
|
|
@ -6395,6 +6395,7 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS
|
||||||
req.funcType = pStmt->isAgg ? TSDB_FUNC_TYPE_AGGREGATE : TSDB_FUNC_TYPE_SCALAR;
|
req.funcType = pStmt->isAgg ? TSDB_FUNC_TYPE_AGGREGATE : TSDB_FUNC_TYPE_SCALAR;
|
||||||
req.scriptType = pStmt->language;
|
req.scriptType = pStmt->language;
|
||||||
req.outputType = pStmt->outputDt.type;
|
req.outputType = pStmt->outputDt.type;
|
||||||
|
pStmt->outputDt.bytes = calcTypeBytes(pStmt->outputDt);
|
||||||
req.outputLen = pStmt->outputDt.bytes;
|
req.outputLen = pStmt->outputDt.bytes;
|
||||||
req.bufSize = pStmt->bufSize;
|
req.bufSize = pStmt->bufSize;
|
||||||
int32_t code = readFromFile(pStmt->libraryPath, &req.codeLen, &req.pCode);
|
int32_t code = readFromFile(pStmt->libraryPath, &req.codeLen, &req.pCode);
|
||||||
|
|
Loading…
Reference in New Issue