[td-13039] refactor scalar function.
This commit is contained in:
parent
21a0ee9284
commit
400989c040
|
@ -93,6 +93,7 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock);
|
||||||
|
|
||||||
int32_t tEncodeDataBlocks(void** buf, const SArray* blocks);
|
int32_t tEncodeDataBlocks(void** buf, const SArray* blocks);
|
||||||
void* tDecodeDataBlocks(const void* buf, SArray* blocks);
|
void* tDecodeDataBlocks(const void* buf, SArray* blocks);
|
||||||
|
void colDataDestroy(SColumnInfoData* pColData) ;
|
||||||
|
|
||||||
static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) {
|
static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) {
|
||||||
// WARNING: do not use info.numOfCols,
|
// WARNING: do not use info.numOfCols,
|
||||||
|
@ -100,13 +101,7 @@ static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) {
|
||||||
int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock);
|
int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i);
|
||||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
colDataDestroy(pColInfoData);
|
||||||
tfree(pColInfoData->varmeta.offset);
|
|
||||||
} else {
|
|
||||||
tfree(pColInfoData->nullbitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
tfree(pColInfoData->pData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pBlock->pDataBlock);
|
taosArrayDestroy(pBlock->pDataBlock);
|
||||||
|
|
|
@ -251,16 +251,9 @@ typedef struct SAggFunctionInfo {
|
||||||
} SAggFunctionInfo;
|
} SAggFunctionInfo;
|
||||||
|
|
||||||
typedef struct SScalarParam {
|
typedef struct SScalarParam {
|
||||||
void *data;
|
SColumnInfoData *columnData;
|
||||||
union {
|
SHashObj *pHashFilter;
|
||||||
SColumnInfoData *columnData;
|
int32_t numOfRows;
|
||||||
void *data;
|
|
||||||
} orig;
|
|
||||||
char *bitmap;
|
|
||||||
bool dataInBlock;
|
|
||||||
int32_t num;
|
|
||||||
int32_t type;
|
|
||||||
int32_t bytes;
|
|
||||||
} SScalarParam;
|
} SScalarParam;
|
||||||
|
|
||||||
typedef struct SScalarFunctionInfo {
|
typedef struct SScalarFunctionInfo {
|
||||||
|
|
|
@ -1241,6 +1241,16 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) {
|
||||||
return pageSize / (blockDataGetSerialRowSize(pBlock) + blockDataGetSerialMetaSize(pBlock));
|
return pageSize / (blockDataGetSerialRowSize(pBlock) + blockDataGetSerialMetaSize(pBlock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void colDataDestroy(SColumnInfoData* pColData) {
|
||||||
|
if (IS_VAR_DATA_TYPE(pColData->info.type)) {
|
||||||
|
tfree(pColData->varmeta.offset);
|
||||||
|
} else {
|
||||||
|
tfree(pColData->nullbitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
tfree(pColData->pData);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock) {
|
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock) {
|
||||||
int64_t tbUid = pBlock->info.uid;
|
int64_t tbUid = pBlock->info.uid;
|
||||||
int16_t numOfCols = pBlock->info.numOfCols;
|
int16_t numOfCols = pBlock->info.numOfCols;
|
||||||
|
|
|
@ -3078,8 +3078,8 @@ static void arithmetic_function(SqlFunctionCtx *pCtx) {
|
||||||
GET_RES_INFO(pCtx)->numOfRes += pCtx->size;
|
GET_RES_INFO(pCtx)->numOfRes += pCtx->size;
|
||||||
//SScalarFunctionSupport *pSup = (SScalarFunctionSupport *)pCtx->param[1].pz;
|
//SScalarFunctionSupport *pSup = (SScalarFunctionSupport *)pCtx->param[1].pz;
|
||||||
|
|
||||||
SScalarParam output = {0};
|
// SScalarParam output = {0};
|
||||||
output.data = pCtx->pOutput;
|
// output.data = pCtx->pOutput;
|
||||||
|
|
||||||
//evaluateExprNodeTree(pSup->pExprInfo->pExpr, pCtx->size, &output, pSup, getArithColumnData);
|
//evaluateExprNodeTree(pSup->pExprInfo->pExpr, pCtx->size, &output, pSup, getArithColumnData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,12 @@ typedef struct SScalarCtx {
|
||||||
#define SCL_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
|
#define SCL_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
|
||||||
#define SCL_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
|
#define SCL_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
|
||||||
|
|
||||||
|
int32_t doConvertDataType(SScalarParam* in, SScalarParam* out, SValueNode* pValueNode);
|
||||||
|
SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows);
|
||||||
|
|
||||||
int32_t sclMoveParamListData(SScalarParam *params, int32_t listNum, int32_t idx);
|
//int32_t sclMoveParamListData(SScalarParam *params, int32_t listNum, int32_t idx);
|
||||||
bool sclIsNull(SScalarParam* param, int32_t idx);
|
//bool sclIsNull(SScalarParam* param, int32_t idx);
|
||||||
void sclSetNull(SScalarParam* param, int32_t idx);
|
//void sclSetNull(SScalarParam* param, int32_t idx);
|
||||||
void sclFreeParam(SScalarParam *param);
|
void sclFreeParam(SScalarParam *param);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1021,26 +1021,21 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) {
|
||||||
if (node->opType == OP_TYPE_IN && (!IS_VAR_DATA_TYPE(type))) {
|
if (node->opType == OP_TYPE_IN && (!IS_VAR_DATA_TYPE(type))) {
|
||||||
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
SNodeListNode *listNode = (SNodeListNode *)node->pRight;
|
||||||
SListCell *cell = listNode->pNodeList->pHead;
|
SListCell *cell = listNode->pNodeList->pHead;
|
||||||
SScalarParam in = {.num = 1}, out = {.num = 1, .type = type};
|
|
||||||
|
SScalarParam in = {.columnData = calloc(1, sizeof(SColumnInfoData))}, out = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
|
out.columnData->info.type = type;
|
||||||
|
|
||||||
for (int32_t i = 0; i < listNode->pNodeList->length; ++i) {
|
for (int32_t i = 0; i < listNode->pNodeList->length; ++i) {
|
||||||
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
||||||
in.type = valueNode->node.resType.type;
|
code = doConvertDataType(&in, &out, valueNode);
|
||||||
in.bytes = valueNode->node.resType.bytes;
|
|
||||||
in.data = nodesGetValueFromNode(valueNode);
|
|
||||||
out.data = malloc(sizeof(int64_t));
|
|
||||||
|
|
||||||
code = vectorConvertImpl(&in, &out);
|
|
||||||
if (code) {
|
if (code) {
|
||||||
fltError("convert from %d to %d failed", in.type, out.type);
|
// fltError("convert from %d to %d failed", in.type, out.type);
|
||||||
tfree(out.data);
|
|
||||||
FLT_ERR_RET(code);
|
FLT_ERR_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = tDataTypes[type].bytes;
|
len = tDataTypes[type].bytes;
|
||||||
|
|
||||||
filterAddField(info, NULL, &out.data, FLD_TYPE_VALUE, &right, len, true);
|
filterAddField(info, NULL, (void**) &out.columnData->pData, FLD_TYPE_VALUE, &right, len, true);
|
||||||
|
|
||||||
filterAddUnit(info, OP_TYPE_EQUAL, &left, &right, &uidx);
|
filterAddUnit(info, OP_TYPE_EQUAL, &left, &right, &uidx);
|
||||||
|
|
||||||
SFilterGroup fgroup = {0};
|
SFilterGroup fgroup = {0};
|
||||||
|
@ -1054,7 +1049,6 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) {
|
||||||
filterAddFieldFromNode(info, node->pRight, &right);
|
filterAddFieldFromNode(info, node->pRight, &right);
|
||||||
|
|
||||||
FLT_ERR_RET(filterAddUnit(info, node->opType, &left, &right, &uidx));
|
FLT_ERR_RET(filterAddUnit(info, node->opType, &left, &right, &uidx));
|
||||||
|
|
||||||
SFilterGroup fgroup = {0};
|
SFilterGroup fgroup = {0};
|
||||||
filterAddUnitToGroup(&fgroup, uidx);
|
filterAddUnitToGroup(&fgroup, uidx);
|
||||||
|
|
||||||
|
@ -1080,7 +1074,6 @@ int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u
|
||||||
filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, POINTER_BYTES, false); // POINTER_BYTES should be sizeof(SHashObj), but POINTER_BYTES is also right.
|
filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, POINTER_BYTES, false); // POINTER_BYTES should be sizeof(SHashObj), but POINTER_BYTES is also right.
|
||||||
|
|
||||||
t = FILTER_GET_FIELD(dst, right);
|
t = FILTER_GET_FIELD(dst, right);
|
||||||
|
|
||||||
FILTER_SET_FLAG(t->flag, FLD_DATA_IS_HASH);
|
FILTER_SET_FLAG(t->flag, FLD_DATA_IS_HASH);
|
||||||
} else {
|
} else {
|
||||||
filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, varDataTLen(data), false);
|
filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, varDataTLen(data), false);
|
||||||
|
@ -1101,14 +1094,12 @@ int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u
|
||||||
|
|
||||||
int32_t filterAddUnitRight(SFilterInfo *info, uint8_t optr, SFilterFieldId *right, uint32_t uidx) {
|
int32_t filterAddUnitRight(SFilterInfo *info, uint8_t optr, SFilterFieldId *right, uint32_t uidx) {
|
||||||
SFilterUnit *u = &info->units[uidx];
|
SFilterUnit *u = &info->units[uidx];
|
||||||
|
|
||||||
u->compare.optr2 = optr;
|
u->compare.optr2 = optr;
|
||||||
u->right2 = *right;
|
u->right2 = *right;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRangeCtx *ctx, uint32_t cidx, SFilterGroup *g, int32_t optr, SArray *res) {
|
int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRangeCtx *ctx, uint32_t cidx, SFilterGroup *g, int32_t optr, SArray *res) {
|
||||||
SFilterFieldId left, right, right2;
|
SFilterFieldId left, right, right2;
|
||||||
uint32_t uidx = 0;
|
uint32_t uidx = 0;
|
||||||
|
@ -1800,9 +1791,12 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
|
||||||
if (dType->type == type) {
|
if (dType->type == type) {
|
||||||
assignVal(fi->data, nodesGetValueFromNode(var), dType->bytes, type);
|
assignVal(fi->data, nodesGetValueFromNode(var), dType->bytes, type);
|
||||||
} else {
|
} else {
|
||||||
SScalarParam in = {.data = nodesGetValueFromNode(var), .num = 1, .type = dType->type, .bytes = dType->bytes};
|
SScalarParam in = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
SScalarParam out = {.data = fi->data, .num = 1, .type = type};
|
SScalarParam out = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
if (vectorConvertImpl(&in, &out)) {
|
out.columnData->info.type = type;
|
||||||
|
|
||||||
|
int32_t code = doConvertDataType(&in, &out, var);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("convert value to type[%d] failed", type);
|
qError("convert value to type[%d] failed", type);
|
||||||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||||
}
|
}
|
||||||
|
@ -3676,18 +3670,18 @@ bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t** p, SColumnData
|
||||||
FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output));
|
FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output));
|
||||||
|
|
||||||
taosArrayDestroy(pList);
|
taosArrayDestroy(pList);
|
||||||
|
// TODO Fix it
|
||||||
*p = output.orig.data;
|
// *p = output.orig.data;
|
||||||
output.orig.data = NULL;
|
// output.orig.data = NULL;
|
||||||
|
//
|
||||||
sclFreeParam(&output);
|
// sclFreeParam(&output);
|
||||||
|
//
|
||||||
int8_t *r = output.data;
|
// int8_t *r = output.data;
|
||||||
for (int32_t i = 0; i < output.num; ++i) {
|
// for (int32_t i = 0; i < output.num; ++i) {
|
||||||
if (0 == *(r+i)) {
|
// if (0 == *(r+i)) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,35 @@ int32_t scalarGetOperatorParamNum(EOperatorType type) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows) {
|
||||||
|
SColumnInfoData* pColumnData = calloc(1, sizeof(SColumnInfoData));
|
||||||
|
if (pColumnData == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pColumnData->info.type = pType->type;
|
||||||
|
pColumnData->info.bytes = pType->bytes;
|
||||||
|
pColumnData->info.scale = pType->scale;
|
||||||
|
pColumnData->info.precision = pType->precision;
|
||||||
|
|
||||||
|
int32_t code = blockDataEnsureColumnCapacity(pColumnData, numOfRows);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
tfree(pColumnData);
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return pColumnData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t doConvertDataType(SScalarParam* in, SScalarParam* out, SValueNode* pValueNode) {
|
||||||
|
in->columnData = createColumnInfoData(&pValueNode->node.resType, 1);
|
||||||
|
colDataAppend(in->columnData, 0, nodesGetValueFromNode(pValueNode), false);
|
||||||
|
|
||||||
|
return vectorConvertImpl(in, out);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
SHashObj *pObj = taosHashInit(256, taosGetDefaultHashFunction(type), true, false);
|
SHashObj *pObj = taosHashInit(256, taosGetDefaultHashFunction(type), true, false);
|
||||||
if (NULL == pObj) {
|
if (NULL == pObj) {
|
||||||
|
@ -28,10 +57,9 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SNodeListNode *nodeList = (SNodeListNode *)pNode;
|
SNodeListNode *nodeList = (SNodeListNode *)pNode;
|
||||||
SListCell *cell = nodeList->pNodeList->pHead;
|
SListCell *cell = nodeList->pNodeList->pHead;
|
||||||
SScalarParam in = {.num = 1}, out = {.num = 1, .type = type};
|
|
||||||
int8_t dummy = 0;
|
SScalarParam in = {.columnData = calloc(1, sizeof(SColumnInfoData))}, out = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
int32_t bufLen = 60;
|
|
||||||
out.data = malloc(bufLen);
|
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
|
||||||
|
@ -39,22 +67,18 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
||||||
|
|
||||||
if (valueNode->node.resType.type != type) {
|
if (valueNode->node.resType.type != type) {
|
||||||
in.type = valueNode->node.resType.type;
|
doConvertDataType(&in, &out, valueNode);
|
||||||
in.bytes = valueNode->node.resType.bytes;
|
|
||||||
in.data = nodesGetValueFromNode(valueNode);
|
|
||||||
|
|
||||||
code = vectorConvertImpl(&in, &out);
|
|
||||||
if (code) {
|
if (code) {
|
||||||
sclError("convert from %d to %d failed", in.type, out.type);
|
// sclError("convert data from %d to %d failed", in.type, out.type);
|
||||||
SCL_ERR_JRET(code);
|
SCL_ERR_JRET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
len = varDataLen(out.data);
|
len = varDataLen(out.columnData->pData);
|
||||||
buf = varDataVal(out.data);
|
buf = varDataVal(out.columnData->pData);
|
||||||
} else {
|
} else {
|
||||||
len = tDataTypes[type].bytes;
|
len = tDataTypes[type].bytes;
|
||||||
buf = out.data;
|
buf = out.columnData->pData;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buf = nodesGetValueFromNode(valueNode);
|
buf = nodesGetValueFromNode(valueNode);
|
||||||
|
@ -63,11 +87,10 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
buf = varDataVal(buf);
|
buf = varDataVal(buf);
|
||||||
} else {
|
} else {
|
||||||
len = valueNode->node.resType.bytes;
|
len = valueNode->node.resType.bytes;
|
||||||
buf = out.data;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosHashPut(pObj, buf, (size_t)len, &dummy, sizeof(dummy))) {
|
if (taosHashPut(pObj, buf, (size_t)len, NULL, 0)) {
|
||||||
sclError("taosHashPut failed");
|
sclError("taosHashPut failed");
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
@ -75,40 +98,14 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
cell = cell->pNext;
|
cell = cell->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(out.data);
|
|
||||||
*data = pObj;
|
*data = pObj;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
tfree(out.data);
|
|
||||||
taosHashCleanup(pObj);
|
taosHashCleanup(pObj);
|
||||||
|
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE bool sclIsNull(SScalarParam* param, int32_t idx) {
|
|
||||||
if (param->dataInBlock) {
|
|
||||||
return colDataIsNull(param->orig.columnData, 0, idx, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return param->bitmap ? colDataIsNull_f(param->bitmap, idx) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FORCE_INLINE void sclSetNull(SScalarParam* param, int32_t idx) {
|
|
||||||
if (NULL == param->bitmap) {
|
|
||||||
param->bitmap = calloc(BitmapLen(param->num), sizeof(char));
|
|
||||||
if (NULL == param->bitmap) {
|
|
||||||
sclError("calloc %d failed", param->num);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
colDataSetNull_f(param->bitmap, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void sclFreeRes(SHashObj *res) {
|
void sclFreeRes(SHashObj *res) {
|
||||||
SScalarParam *p = NULL;
|
SScalarParam *p = NULL;
|
||||||
void *pIter = taosHashIterate(res, NULL);
|
void *pIter = taosHashIterate(res, NULL);
|
||||||
|
@ -118,31 +115,26 @@ void sclFreeRes(SHashObj *res) {
|
||||||
if (p) {
|
if (p) {
|
||||||
sclFreeParam(p);
|
sclFreeParam(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
pIter = taosHashIterate(res, pIter);
|
pIter = taosHashIterate(res, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashCleanup(res);
|
taosHashCleanup(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sclFreeParamNoData(SScalarParam *param) {
|
void sclFreeParamNoData(SScalarParam *param) {
|
||||||
tfree(param->bitmap);
|
// tfree(param->bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sclFreeParam(SScalarParam *param) {
|
void sclFreeParam(SScalarParam *param) {
|
||||||
sclFreeParamNoData(param);
|
sclFreeParamNoData(param);
|
||||||
|
// if (!param->dataInBlock) {
|
||||||
if (!param->dataInBlock) {
|
// if (SCL_DATA_TYPE_DUMMY_HASH == param->type) {
|
||||||
if (SCL_DATA_TYPE_DUMMY_HASH == param->type) {
|
// taosHashCleanup((SHashObj *)param->orig.data);
|
||||||
taosHashCleanup((SHashObj *)param->orig.data);
|
// } else {
|
||||||
} else {
|
// tfree(param->orig.data);
|
||||||
tfree(param->orig.data);
|
// }
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t sclCopyValueNodeValue(SValueNode *pNode, void **res) {
|
int32_t sclCopyValueNodeValue(SValueNode *pNode, void **res) {
|
||||||
if (TSDB_DATA_TYPE_NULL == pNode->node.resType.type) {
|
if (TSDB_DATA_TYPE_NULL == pNode->node.resType.type) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -155,7 +147,6 @@ int32_t sclCopyValueNodeValue(SValueNode *pNode, void **res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(*res, nodesGetValueFromNode(pNode), pNode->node.resType.bytes);
|
memcpy(*res, nodesGetValueFromNode(pNode), pNode->node.resType.bytes);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,19 +154,17 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
switch (nodeType(node)) {
|
switch (nodeType(node)) {
|
||||||
case QUERY_NODE_VALUE: {
|
case QUERY_NODE_VALUE: {
|
||||||
SValueNode *valueNode = (SValueNode *)node;
|
SValueNode *valueNode = (SValueNode *)node;
|
||||||
//SCL_ERR_RET(sclCopyValueNodeValue(valueNode, ¶m->data));
|
|
||||||
param->data = nodesGetValueFromNode(valueNode);
|
param->numOfRows = 1;
|
||||||
param->orig.data = param->data;
|
param->columnData = createColumnInfoData(&valueNode->node.resType, 1);
|
||||||
param->num = 1;
|
if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type) {
|
||||||
param->type = valueNode->node.resType.type;
|
colDataAppend(param->columnData, 0, NULL, true);
|
||||||
param->bytes = valueNode->node.resType.bytes;
|
} else {
|
||||||
if (TSDB_DATA_TYPE_NULL == param->type) {
|
colDataAppend(param->columnData, 0, nodesGetValueFromNode(valueNode), false);
|
||||||
sclSetNull(param, 0);
|
|
||||||
}
|
}
|
||||||
param->dataInBlock = false;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QUERY_NODE_NODE_LIST: {
|
case QUERY_NODE_NODE_LIST: {
|
||||||
SNodeListNode *nodeList = (SNodeListNode *)node;
|
SNodeListNode *nodeList = (SNodeListNode *)node;
|
||||||
if (nodeList->pNodeList->length <= 0) {
|
if (nodeList->pNodeList->length <= 0) {
|
||||||
|
@ -183,15 +172,9 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
SCL_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
SCL_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCL_ERR_RET(scalarGenerateSetFromList(¶m->data, node, nodeList->dataType.type));
|
SCL_ERR_RET(scalarGenerateSetFromList((void**) ¶m->pHashFilter, node, nodeList->dataType.type));
|
||||||
param->orig.data = param->data;
|
|
||||||
param->num = 1;
|
|
||||||
param->type = SCL_DATA_TYPE_DUMMY_HASH;
|
|
||||||
param->dataInBlock = false;
|
|
||||||
|
|
||||||
if (taosHashPut(ctx->pRes, &node, POINTER_BYTES, param, sizeof(*param))) {
|
if (taosHashPut(ctx->pRes, &node, POINTER_BYTES, param, sizeof(*param))) {
|
||||||
taosHashCleanup(param->orig.data);
|
taosHashCleanup(param->pHashFilter);
|
||||||
param->orig.data = NULL;
|
|
||||||
sclError("taosHashPut nodeList failed, size:%d", (int32_t)sizeof(*param));
|
sclError("taosHashPut nodeList failed, size:%d", (int32_t)sizeof(*param));
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -210,21 +193,14 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock *block = *(SSDataBlock **)taosArrayGet(ctx->pBlockList, ref->dataBlockId);
|
SSDataBlock *block = *(SSDataBlock **)taosArrayGet(ctx->pBlockList, ref->dataBlockId);
|
||||||
|
|
||||||
if (NULL == block || ref->slotId >= taosArrayGetSize(block->pDataBlock)) {
|
if (NULL == block || ref->slotId >= taosArrayGetSize(block->pDataBlock)) {
|
||||||
sclError("column slotId is too big, slodId:%d, dataBlockSize:%d", ref->slotId, (int32_t)taosArrayGetSize(block->pDataBlock));
|
sclError("column slotId is too big, slodId:%d, dataBlockSize:%d", ref->slotId, (int32_t)taosArrayGetSize(block->pDataBlock));
|
||||||
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
SColumnInfoData *columnData = (SColumnInfoData *)taosArrayGet(block->pDataBlock, ref->slotId);
|
SColumnInfoData *columnData = (SColumnInfoData *)taosArrayGet(block->pDataBlock, ref->slotId);
|
||||||
param->data = NULL;
|
param->numOfRows = block->info.rows;
|
||||||
param->orig.columnData = columnData;
|
param->columnData = columnData;
|
||||||
param->dataInBlock = true;
|
|
||||||
|
|
||||||
param->num = block->info.rows;
|
|
||||||
param->type = columnData->info.type;
|
|
||||||
param->bytes = columnData->info.bytes;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QUERY_NODE_LOGIC_CONDITION:
|
case QUERY_NODE_LOGIC_CONDITION:
|
||||||
|
@ -234,9 +210,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
sclError("no result for node, type:%d, node:%p", nodeType(node), node);
|
sclError("no result for node, type:%d, node:%p", nodeType(node), node);
|
||||||
SCL_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
SCL_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
*param = *res;
|
*param = *res;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,39 +218,13 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->num > *rowNum) {
|
if (param->numOfRows > *rowNum) {
|
||||||
if ((1 != param->num) && (1 < *rowNum)) {
|
if ((1 != param->numOfRows) && (1 < *rowNum)) {
|
||||||
sclError("different row nums, rowNum:%d, newRowNum:%d", *rowNum, param->num);
|
sclError("different row nums, rowNum:%d, newRowNum:%d", *rowNum, param->numOfRows);
|
||||||
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
*rowNum = param->num;
|
*rowNum = param->numOfRows;
|
||||||
}
|
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t sclMoveParamListData(SScalarParam *params, int32_t listNum, int32_t idx) {
|
|
||||||
SScalarParam *param = NULL;
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < listNum; ++i) {
|
|
||||||
param = params + i;
|
|
||||||
|
|
||||||
if (1 == param->num) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param->dataInBlock) {
|
|
||||||
param->data = colDataGetData(param->orig.columnData, idx);
|
|
||||||
} else if (idx) {
|
|
||||||
if (IS_VAR_DATA_TYPE(param->type)) {
|
|
||||||
param->data = (char *)(param->data) + varDataTLen(param->data);
|
|
||||||
} else {
|
|
||||||
param->data = (char *)(param->data) + tDataTypes[param->type].bytes;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
param->data = param->orig.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -298,16 +246,13 @@ int32_t sclInitParamList(SScalarParam **pParams, SNodeList* pParamList, SScalarC
|
||||||
}
|
}
|
||||||
|
|
||||||
SCL_ERR_JRET(sclInitParam(cell->pNode, ¶mList[i], ctx, rowNum));
|
SCL_ERR_JRET(sclInitParam(cell->pNode, ¶mList[i], ctx, rowNum));
|
||||||
|
|
||||||
cell = cell->pNext;
|
cell = cell->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pParams = paramList;
|
*pParams = paramList;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
tfree(paramList);
|
tfree(paramList);
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
@ -332,16 +277,13 @@ int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScal
|
||||||
}
|
}
|
||||||
|
|
||||||
*pParams = paramList;
|
*pParams = paramList;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
tfree(paramList);
|
tfree(paramList);
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t sclExecFuncion(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *output) {
|
int32_t sclExecFuncion(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *output) {
|
||||||
if (NULL == node->pParameterList || node->pParameterList->length <= 0) {
|
if (NULL == node->pParameterList || node->pParameterList->length <= 0) {
|
||||||
sclError("invalid function parameter list, list:%p, paramNum:%d", node->pParameterList, node->pParameterList ? node->pParameterList->length : 0);
|
sclError("invalid function parameter list, list:%p, paramNum:%d", node->pParameterList, node->pParameterList ? node->pParameterList->length : 0);
|
||||||
|
@ -359,18 +301,16 @@ int32_t sclExecFuncion(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outpu
|
||||||
int32_t rowNum = 0;
|
int32_t rowNum = 0;
|
||||||
SCL_ERR_RET(sclInitParamList(¶ms, node->pParameterList, ctx, &rowNum));
|
SCL_ERR_RET(sclInitParamList(¶ms, node->pParameterList, ctx, &rowNum));
|
||||||
|
|
||||||
output->type = node->node.resType.type;
|
output->columnData->info.type = node->node.resType.type;
|
||||||
output->data = calloc(rowNum, sizeof(tDataTypes[output->type].bytes));
|
output->columnData->info.bytes = tDataTypes[node->node.resType.type].bytes;
|
||||||
if (NULL == output->data) {
|
|
||||||
sclError("calloc %d failed", (int32_t)(rowNum * sizeof(tDataTypes[output->type].bytes)));
|
code = blockDataEnsureColumnCapacity(output->columnData, rowNum);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
sclError("calloc %d failed", (int32_t)(rowNum * output->columnData->info.bytes));
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
output->orig.data = output->data;
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < rowNum; ++i) {
|
for (int32_t i = 0; i < rowNum; ++i) {
|
||||||
sclMoveParamListData(output, 1, i);
|
|
||||||
sclMoveParamListData(params, node->pParameterList->length, i);
|
|
||||||
|
|
||||||
code = (*ffpSet.process)(params, node->pParameterList->length, output);
|
code = (*ffpSet.process)(params, node->pParameterList->length, output);
|
||||||
if (code) {
|
if (code) {
|
||||||
sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code));
|
sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code));
|
||||||
|
@ -385,11 +325,9 @@ _return:
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(params);
|
tfree(params);
|
||||||
|
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *output) {
|
int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *output) {
|
||||||
if (NULL == node->pParameterList || node->pParameterList->length <= 0) {
|
if (NULL == node->pParameterList || node->pParameterList->length <= 0) {
|
||||||
sclError("invalid logic parameter list, list:%p, paramNum:%d", node->pParameterList, node->pParameterList ? node->pParameterList->length : 0);
|
sclError("invalid logic parameter list, list:%p, paramNum:%d", node->pParameterList, node->pParameterList ? node->pParameterList->length : 0);
|
||||||
|
@ -409,28 +347,24 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
|
||||||
SScalarParam *params = NULL;
|
SScalarParam *params = NULL;
|
||||||
int32_t rowNum = 0;
|
int32_t rowNum = 0;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
SCL_ERR_RET(sclInitParamList(¶ms, node->pParameterList, ctx, &rowNum));
|
SCL_ERR_RET(sclInitParamList(¶ms, node->pParameterList, ctx, &rowNum));
|
||||||
|
|
||||||
output->type = node->node.resType.type;
|
int32_t type = node->node.resType.type;
|
||||||
output->bytes = sizeof(bool);
|
output->numOfRows = rowNum;
|
||||||
output->num = rowNum;
|
|
||||||
output->data = calloc(rowNum, sizeof(bool));
|
SDataType t = {.type = type, .bytes = tDataTypes[type].bytes};
|
||||||
if (NULL == output->data) {
|
output->columnData = createColumnInfoData(&t, rowNum);
|
||||||
|
if (output->columnData == NULL) {
|
||||||
sclError("calloc %d failed", (int32_t)(rowNum * sizeof(bool)));
|
sclError("calloc %d failed", (int32_t)(rowNum * sizeof(bool)));
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
output->orig.data = output->data;
|
|
||||||
|
|
||||||
bool value = false;
|
bool value = false;
|
||||||
|
|
||||||
for (int32_t i = 0; i < rowNum; ++i) {
|
for (int32_t i = 0; i < rowNum; ++i) {
|
||||||
sclMoveParamListData(output, 1, i);
|
|
||||||
sclMoveParamListData(params, node->pParameterList->length, i);
|
|
||||||
|
|
||||||
for (int32_t m = 0; m < node->pParameterList->length; ++m) {
|
for (int32_t m = 0; m < node->pParameterList->length; ++m) {
|
||||||
GET_TYPED_DATA(value, bool, params[m].type, params[m].data);
|
char* p = colDataGetData(params[m].columnData, i);
|
||||||
|
GET_TYPED_DATA(value, bool, params[m].columnData->info.type, p);
|
||||||
|
|
||||||
if (LOGIC_COND_TYPE_AND == node->condType && (false == value)) {
|
if (LOGIC_COND_TYPE_AND == node->condType && (false == value)) {
|
||||||
break;
|
break;
|
||||||
} else if (LOGIC_COND_TYPE_OR == node->condType && value) {
|
} else if (LOGIC_COND_TYPE_OR == node->condType && value) {
|
||||||
|
@ -440,11 +374,10 @@ int32_t sclExecLogic(SLogicConditionNode *node, SScalarCtx *ctx, SScalarParam *o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*(bool *)output->data = value;
|
colDataAppend(output->columnData, i, (char*) &value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
for (int32_t i = 0; i < node->pParameterList->length; ++i) {
|
for (int32_t i = 0; i < node->pParameterList->length; ++i) {
|
||||||
sclFreeParamNoData(params + i);
|
sclFreeParamNoData(params + i);
|
||||||
}
|
}
|
||||||
|
@ -459,16 +392,11 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
SCL_ERR_RET(sclInitOperatorParams(¶ms, node, ctx, &rowNum));
|
SCL_ERR_RET(sclInitOperatorParams(¶ms, node, ctx, &rowNum));
|
||||||
|
output->columnData = createColumnInfoData(&node->node.resType, rowNum);
|
||||||
output->type = node->node.resType.type;
|
if (output->columnData == NULL) {
|
||||||
output->num = rowNum;
|
sclError("calloc failed, size:%d", (int32_t)rowNum * node->node.resType.bytes);
|
||||||
output->bytes = tDataTypes[output->type].bytes;
|
|
||||||
output->data = calloc(rowNum, tDataTypes[output->type].bytes);
|
|
||||||
if (NULL == output->data) {
|
|
||||||
sclError("calloc %d failed", (int32_t)rowNum * tDataTypes[output->type].bytes);
|
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
output->orig.data = output->data;
|
|
||||||
|
|
||||||
_bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(node->opType);
|
_bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(node->opType);
|
||||||
|
|
||||||
|
@ -479,18 +407,14 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp
|
||||||
OperatorFn(pLeft, pRight, output, TSDB_ORDER_ASC);
|
OperatorFn(pLeft, pRight, output, TSDB_ORDER_ASC);
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < paramNum; ++i) {
|
for (int32_t i = 0; i < paramNum; ++i) {
|
||||||
sclFreeParamNoData(params + i);
|
sclFreeParamNoData(params + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(params);
|
tfree(params);
|
||||||
|
|
||||||
SCL_RET(code);
|
SCL_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
|
EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
|
||||||
SFunctionNode *node = (SFunctionNode *)*pNode;
|
SFunctionNode *node = (SFunctionNode *)*pNode;
|
||||||
SScalarParam output = {0};
|
SScalarParam output = {0};
|
||||||
|
@ -510,11 +434,12 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
res->node.resType = node->node.resType;
|
res->node.resType = node->node.resType;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(output.type)) {
|
int32_t type = output.columnData->info.type;
|
||||||
res->datum.p = output.data;
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
output.data = NULL;
|
res->datum.p = output.columnData->pData;
|
||||||
|
output.columnData->pData = NULL;
|
||||||
} else {
|
} else {
|
||||||
memcpy(nodesGetValueFromNode(res), output.data, tDataTypes[output.type].bytes);
|
memcpy(nodesGetValueFromNode(res), output.columnData->pData, tDataTypes[type].bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesDestroyNode(*pNode);
|
nodesDestroyNode(*pNode);
|
||||||
|
@ -527,8 +452,8 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
EDealRes sclRewriteLogic(SNode** pNode, SScalarCtx *ctx) {
|
EDealRes sclRewriteLogic(SNode** pNode, SScalarCtx *ctx) {
|
||||||
SLogicConditionNode *node = (SLogicConditionNode *)*pNode;
|
SLogicConditionNode *node = (SLogicConditionNode *)*pNode;
|
||||||
SScalarParam output = {0};
|
|
||||||
|
|
||||||
|
SScalarParam output = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
ctx->code = sclExecLogic(node, ctx, &output);
|
ctx->code = sclExecLogic(node, ctx, &output);
|
||||||
if (ctx->code) {
|
if (ctx->code) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
|
@ -544,11 +469,12 @@ EDealRes sclRewriteLogic(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
res->node.resType = node->node.resType;
|
res->node.resType = node->node.resType;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(output.type)) {
|
int32_t type = output.columnData->info.type;
|
||||||
res->datum.p = output.data;
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
output.data = NULL;
|
res->datum.p = output.columnData->pData;
|
||||||
|
output.columnData->pData = NULL;
|
||||||
} else {
|
} else {
|
||||||
memcpy(nodesGetValueFromNode(res), output.data, tDataTypes[output.type].bytes);
|
memcpy(nodesGetValueFromNode(res), output.columnData->pData, tDataTypes[type].bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesDestroyNode(*pNode);
|
nodesDestroyNode(*pNode);
|
||||||
|
@ -561,8 +487,8 @@ EDealRes sclRewriteLogic(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
EDealRes sclRewriteOperator(SNode** pNode, SScalarCtx *ctx) {
|
EDealRes sclRewriteOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
SOperatorNode *node = (SOperatorNode *)*pNode;
|
SOperatorNode *node = (SOperatorNode *)*pNode;
|
||||||
SScalarParam output = {0};
|
|
||||||
|
|
||||||
|
SScalarParam output = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
ctx->code = sclExecOperator(node, ctx, &output);
|
ctx->code = sclExecOperator(node, ctx, &output);
|
||||||
if (ctx->code) {
|
if (ctx->code) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
|
@ -578,22 +504,21 @@ EDealRes sclRewriteOperator(SNode** pNode, SScalarCtx *ctx) {
|
||||||
|
|
||||||
res->node.resType = node->node.resType;
|
res->node.resType = node->node.resType;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(output.type)) {
|
int32_t type = output.columnData->info.type;
|
||||||
res->datum.p = output.data;
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
output.data = NULL;
|
res->datum.p = output.columnData->pData;
|
||||||
|
output.columnData->pData = NULL;
|
||||||
} else {
|
} else {
|
||||||
memcpy(nodesGetValueFromNode(res), output.data, tDataTypes[output.type].bytes);
|
memcpy(nodesGetValueFromNode(res), output.columnData->pData, tDataTypes[type].bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesDestroyNode(*pNode);
|
nodesDestroyNode(*pNode);
|
||||||
*pNode = (SNode*)res;
|
*pNode = (SNode*)res;
|
||||||
|
|
||||||
sclFreeParam(&output);
|
sclFreeParam(&output);
|
||||||
|
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclConstantsRewriter(SNode** pNode, void* pContext) {
|
EDealRes sclConstantsRewriter(SNode** pNode, void* pContext) {
|
||||||
if (QUERY_NODE_VALUE == nodeType(*pNode) || QUERY_NODE_NODE_LIST == nodeType(*pNode)) {
|
if (QUERY_NODE_VALUE == nodeType(*pNode) || QUERY_NODE_NODE_LIST == nodeType(*pNode)) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
|
@ -614,13 +539,10 @@ EDealRes sclConstantsRewriter(SNode** pNode, void* pContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sclError("invalid node type for calculating constants, type:%d", nodeType(*pNode));
|
sclError("invalid node type for calculating constants, type:%d", nodeType(*pNode));
|
||||||
|
|
||||||
ctx->code = TSDB_CODE_QRY_INVALID_INPUT;
|
ctx->code = TSDB_CODE_QRY_INVALID_INPUT;
|
||||||
|
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclWalkFunction(SNode* pNode, SScalarCtx *ctx) {
|
EDealRes sclWalkFunction(SNode* pNode, SScalarCtx *ctx) {
|
||||||
SFunctionNode *node = (SFunctionNode *)pNode;
|
SFunctionNode *node = (SFunctionNode *)pNode;
|
||||||
SScalarParam output = {0};
|
SScalarParam output = {0};
|
||||||
|
@ -638,7 +560,6 @@ EDealRes sclWalkFunction(SNode* pNode, SScalarCtx *ctx) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclWalkLogic(SNode* pNode, SScalarCtx *ctx) {
|
EDealRes sclWalkLogic(SNode* pNode, SScalarCtx *ctx) {
|
||||||
SLogicConditionNode *node = (SLogicConditionNode *)pNode;
|
SLogicConditionNode *node = (SLogicConditionNode *)pNode;
|
||||||
SScalarParam output = {0};
|
SScalarParam output = {0};
|
||||||
|
@ -656,7 +577,6 @@ EDealRes sclWalkLogic(SNode* pNode, SScalarCtx *ctx) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclWalkOperator(SNode* pNode, SScalarCtx *ctx) {
|
EDealRes sclWalkOperator(SNode* pNode, SScalarCtx *ctx) {
|
||||||
SOperatorNode *node = (SOperatorNode *)pNode;
|
SOperatorNode *node = (SOperatorNode *)pNode;
|
||||||
SScalarParam output = {0};
|
SScalarParam output = {0};
|
||||||
|
@ -699,27 +619,26 @@ EDealRes sclWalkTarget(SNode* pNode, SScalarCtx *ctx) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < res->num; ++i) {
|
for (int32_t i = 0; i < res->numOfRows; ++i) {
|
||||||
sclMoveParamListData(res, 1, i);
|
if (colDataIsNull(res->columnData, res->numOfRows, i, NULL)) {
|
||||||
|
colDataAppend(col, i, NULL, true);
|
||||||
colDataAppend(col, i, res->data, sclIsNull(res, i));
|
} else {
|
||||||
|
char *p = colDataGetData(res->columnData, i);
|
||||||
|
colDataAppend(col, i, p, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sclFreeParam(res);
|
sclFreeParam(res);
|
||||||
|
|
||||||
taosHashRemove(ctx->pRes, (void *)&target->pExpr, POINTER_BYTES);
|
taosHashRemove(ctx->pRes, (void *)&target->pExpr, POINTER_BYTES);
|
||||||
|
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDealRes sclCalcWalker(SNode* pNode, void* pContext) {
|
EDealRes sclCalcWalker(SNode* pNode, void* pContext) {
|
||||||
if (QUERY_NODE_VALUE == nodeType(pNode) || QUERY_NODE_NODE_LIST == nodeType(pNode) || QUERY_NODE_COLUMN == nodeType(pNode)) {
|
if (QUERY_NODE_VALUE == nodeType(pNode) || QUERY_NODE_NODE_LIST == nodeType(pNode) || QUERY_NODE_COLUMN == nodeType(pNode)) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SScalarCtx *ctx = (SScalarCtx *)pContext;
|
SScalarCtx *ctx = (SScalarCtx *)pContext;
|
||||||
|
|
||||||
if (QUERY_NODE_FUNCTION == nodeType(pNode)) {
|
if (QUERY_NODE_FUNCTION == nodeType(pNode)) {
|
||||||
return sclWalkFunction(pNode, ctx);
|
return sclWalkFunction(pNode, ctx);
|
||||||
}
|
}
|
||||||
|
@ -737,14 +656,10 @@ EDealRes sclCalcWalker(SNode* pNode, void* pContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sclError("invalid node type for scalar calculating, type:%d", nodeType(pNode));
|
sclError("invalid node type for scalar calculating, type:%d", nodeType(pNode));
|
||||||
|
|
||||||
ctx->code = TSDB_CODE_QRY_INVALID_INPUT;
|
ctx->code = TSDB_CODE_QRY_INVALID_INPUT;
|
||||||
|
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) {
|
int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) {
|
||||||
if (NULL == pNode) {
|
if (NULL == pNode) {
|
||||||
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
SCL_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||||
|
@ -759,15 +674,11 @@ int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesRewriteNodePostOrder(&pNode, sclConstantsRewriter, (void *)&ctx);
|
nodesRewriteNodePostOrder(&pNode, sclConstantsRewriter, (void *)&ctx);
|
||||||
|
|
||||||
SCL_ERR_JRET(ctx.code);
|
SCL_ERR_JRET(ctx.code);
|
||||||
|
|
||||||
*pRes = pNode;
|
*pRes = pNode;
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
sclFreeRes(ctx.pRes);
|
sclFreeRes(ctx.pRes);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,7 +697,6 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesWalkNodePostOrder(pNode, sclCalcWalker, (void *)&ctx);
|
nodesWalkNodePostOrder(pNode, sclCalcWalker, (void *)&ctx);
|
||||||
|
|
||||||
SCL_ERR_JRET(ctx.code);
|
SCL_ERR_JRET(ctx.code);
|
||||||
|
|
||||||
if (pDst) {
|
if (pDst) {
|
||||||
|
@ -796,18 +706,14 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
|
SCL_ERR_JRET(TSDB_CODE_QRY_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sclMoveParamListData(res, 1, 0);
|
// sclMoveParamListData(res, 1, 0);
|
||||||
|
|
||||||
*pDst = *res;
|
*pDst = *res;
|
||||||
|
|
||||||
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
//nodesDestroyNode(pNode);
|
//nodesDestroyNode(pNode);
|
||||||
sclFreeRes(ctx.pRes);
|
sclFreeRes(ctx.pRes);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
#include "sclvector.h"
|
#include "sclvector.h"
|
||||||
|
|
||||||
static void assignBasicParaInfo(struct SScalarParam* dst, const struct SScalarParam* src) {
|
static void assignBasicParaInfo(struct SScalarParam* dst, const struct SScalarParam* src) {
|
||||||
dst->type = src->type;
|
// dst->type = src->type;
|
||||||
dst->bytes = src->bytes;
|
// dst->bytes = src->bytes;
|
||||||
dst->num = src->num;
|
// dst->num = src->num;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tceil(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tceil(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assignBasicParaInfo(pOutput, pLeft);
|
assignBasicParaInfo(pOutput, pLeft);
|
||||||
assert(numOfInput == 1);
|
assert(numOfInput == 1);
|
||||||
|
#if 0
|
||||||
switch (pLeft->bytes) {
|
switch (pLeft->bytes) {
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
float* p = (float*) pLeft->data;
|
float* p = (float*) pLeft->data;
|
||||||
|
@ -31,12 +31,14 @@ static void tceil(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *
|
||||||
default:
|
default:
|
||||||
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tfloor(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tfloor(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assignBasicParaInfo(pOutput, pLeft);
|
assignBasicParaInfo(pOutput, pLeft);
|
||||||
assert(numOfInput == 1);
|
assert(numOfInput == 1);
|
||||||
|
#if 0
|
||||||
switch (pLeft->bytes) {
|
switch (pLeft->bytes) {
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
float* p = (float*) pLeft->data;
|
float* p = (float*) pLeft->data;
|
||||||
|
@ -59,12 +61,13 @@ static void tfloor(SScalarParam* pOutput, size_t numOfInput, const SScalarParam
|
||||||
default:
|
default:
|
||||||
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _tabs(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void _tabs(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assignBasicParaInfo(pOutput, pLeft);
|
assignBasicParaInfo(pOutput, pLeft);
|
||||||
assert(numOfInput == 1);
|
assert(numOfInput == 1);
|
||||||
|
#if 0
|
||||||
switch (pLeft->bytes) {
|
switch (pLeft->bytes) {
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
float* p = (float*) pLeft->data;
|
float* p = (float*) pLeft->data;
|
||||||
|
@ -117,12 +120,13 @@ static void _tabs(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *
|
||||||
default:
|
default:
|
||||||
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tround(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tround(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assignBasicParaInfo(pOutput, pLeft);
|
assignBasicParaInfo(pOutput, pLeft);
|
||||||
assert(numOfInput == 1);
|
assert(numOfInput == 1);
|
||||||
|
#if 0
|
||||||
switch (pLeft->bytes) {
|
switch (pLeft->bytes) {
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
float* p = (float*) pLeft->data;
|
float* p = (float*) pLeft->data;
|
||||||
|
@ -143,22 +147,24 @@ static void tround(SScalarParam* pOutput, size_t numOfInput, const SScalarParam
|
||||||
default:
|
default:
|
||||||
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
memcpy(pOutput->data, pLeft->data, pLeft->num* pLeft->bytes);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlength(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tlength(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assert(numOfInput == 1);
|
assert(numOfInput == 1);
|
||||||
|
#if 0
|
||||||
int64_t* out = (int64_t*) pOutput->data;
|
int64_t* out = (int64_t*) pOutput->data;
|
||||||
char* s = pLeft->data;
|
char* s = pLeft->data;
|
||||||
|
|
||||||
for(int32_t i = 0; i < pLeft->num; ++i) {
|
for(int32_t i = 0; i < pLeft->num; ++i) {
|
||||||
out[i] = varDataLen(POINTER_SHIFT(s, i * pLeft->bytes));
|
out[i] = varDataLen(POINTER_SHIFT(s, i * pLeft->bytes));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tconcat(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tconcat(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
assert(numOfInput > 0);
|
assert(numOfInput > 0);
|
||||||
|
#if 0
|
||||||
int32_t rowLen = 0;
|
int32_t rowLen = 0;
|
||||||
int32_t num = 1;
|
int32_t num = 1;
|
||||||
for(int32_t i = 0; i < numOfInput; ++i) {
|
for(int32_t i = 0; i < numOfInput; ++i) {
|
||||||
|
@ -186,6 +192,7 @@ static void tconcat(SScalarParam* pOutput, size_t numOfInput, const SScalarParam
|
||||||
|
|
||||||
rstart += rowLen;
|
rstart += rowLen;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tltrim(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
static void tltrim(SScalarParam* pOutput, size_t numOfInput, const SScalarParam *pLeft) {
|
||||||
|
@ -262,13 +269,12 @@ static void reverseCopy(char* dest, const char* src, int16_t type, int32_t numOf
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setScalarFuncParam(SScalarParam* param, int32_t type, int32_t bytes, void* pInput, int32_t numOfRows) {
|
static void setScalarFuncParam(SScalarParam* param, int32_t type, int32_t bytes, void* pInput, int32_t numOfRows) {
|
||||||
param->bytes = bytes;
|
// param->bytes = bytes;
|
||||||
param->type = type;
|
// param->type = type;
|
||||||
param->num = numOfRows;
|
// param->num = numOfRows;
|
||||||
param->data = pInput;
|
// param->data = pInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int32_t evaluateExprNodeTree(tExprNode* pExprs, int32_t numOfRows, SScalarFuncParam* pOutput, void* param,
|
int32_t evaluateExprNodeTree(tExprNode* pExprs, int32_t numOfRows, SScalarFuncParam* pOutput, void* param,
|
||||||
char* (*getSourceDataBlock)(void*, const char*, int32_t)) {
|
char* (*getSourceDataBlock)(void*, const char*, int32_t)) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -261,7 +261,7 @@ TEST(constantTest, bigint_add_bigint) {
|
||||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||||
SValueNode *v = (SValueNode *)res;
|
SValueNode *v = (SValueNode *)res;
|
||||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_DOUBLE);
|
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_DOUBLE);
|
||||||
ASSERT_EQ(v->datum.d, (scltLeftV + scltRightV));
|
ASSERT_FLOAT_EQ(v->datum.d, (scltLeftV + scltRightV));
|
||||||
nodesDestroyNode(res);
|
nodesDestroyNode(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ TEST(constantTest, double_sub_bigint) {
|
||||||
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
ASSERT_EQ(nodeType(res), QUERY_NODE_VALUE);
|
||||||
SValueNode *v = (SValueNode *)res;
|
SValueNode *v = (SValueNode *)res;
|
||||||
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_DOUBLE);
|
ASSERT_EQ(v->node.resType.type, TSDB_DATA_TYPE_DOUBLE);
|
||||||
ASSERT_EQ(v->datum.d, (scltLeftVd - scltRightV));
|
ASSERT_FLOAT_EQ(v->datum.d, (scltLeftVd - scltRightV));
|
||||||
nodesDestroyNode(res);
|
nodesDestroyNode(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,7 +959,6 @@ TEST(columnTest, bigint_column_multi_binary_column) {
|
||||||
scltMakeColumnNode(&pRight, &src, TSDB_DATA_TYPE_BINARY, 5, rowNum, rightv);
|
scltMakeColumnNode(&pRight, &src, TSDB_DATA_TYPE_BINARY, 5, rowNum, rightv);
|
||||||
scltMakeOpNode(&opNode, OP_TYPE_MULTI, TSDB_DATA_TYPE_DOUBLE, pLeft, pRight);
|
scltMakeOpNode(&opNode, OP_TYPE_MULTI, TSDB_DATA_TYPE_DOUBLE, pLeft, pRight);
|
||||||
|
|
||||||
|
|
||||||
SArray *blockList = taosArrayInit(1, POINTER_BYTES);
|
SArray *blockList = taosArrayInit(1, POINTER_BYTES);
|
||||||
taosArrayPush(blockList, &src);
|
taosArrayPush(blockList, &src);
|
||||||
SColumnInfo colInfo = createColumnInfo(1, TSDB_DATA_TYPE_DOUBLE, sizeof(double));
|
SColumnInfo colInfo = createColumnInfo(1, TSDB_DATA_TYPE_DOUBLE, sizeof(double));
|
||||||
|
|
Loading…
Reference in New Issue