Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a0ba1eb1
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a0ba1eb1
编写于
3月 28, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/3.0_liaohj' of github.com:taosdata/TDengine into feature/3.0_liaohj
上级
b6015420
bee71f5f
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
390 addition
and
324 deletion
+390
-324
include/libs/scalar/scalar.h
include/libs/scalar/scalar.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+29
-15
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+1
-1
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+87
-52
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+272
-255
未找到文件。
include/libs/scalar/scalar.h
浏览文件 @
a0ba1eb1
...
...
@@ -40,7 +40,7 @@ int32_t scalarGetOperatorParamNum(EOperatorType type);
int32_t
scalarGenerateSetFromList
(
void
**
data
,
void
*
pNode
,
uint32_t
type
);
int32_t
vectorGetConvertType
(
int32_t
type1
,
int32_t
type2
);
int32_t
vectorConvertImpl
(
SScalarParam
*
pIn
,
SScalarParam
*
pOut
);
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
);
int32_t
absFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
logFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
...
...
source/client/src/clientImpl.c
浏览文件 @
a0ba1eb1
...
...
@@ -558,15 +558,6 @@ static void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
pResultInfo
->
length
[
i
]
=
varDataLen
(
pStart
);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pStart
);
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
pResultInfo
->
convertBuf
[
i
]));
ASSERT
(
len
<=
bytes
);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pResultInfo
->
convertBuf
[
i
]);
varDataSetLen
(
pResultInfo
->
convertBuf
[
i
],
len
);
pResultInfo
->
length
[
i
]
=
len
;
}
}
else
{
pResultInfo
->
row
[
i
]
=
NULL
;
}
...
...
@@ -689,12 +680,6 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) {
if
(
pResInfo
->
row
==
NULL
||
pResInfo
->
pCol
==
NULL
||
pResInfo
->
length
==
NULL
||
pResInfo
->
convertBuf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
if
(
pResInfo
->
fields
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
)
{
pResInfo
->
convertBuf
[
i
]
=
taosMemoryCalloc
(
1
,
NCHAR_WIDTH_TO_BYTES
(
pResInfo
->
fields
[
i
].
bytes
));
}
}
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -731,6 +716,35 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
pStart
+=
colLength
[
i
];
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
type
=
pResultInfo
->
fields
[
i
].
type
;
int32_t
bytes
=
pResultInfo
->
fields
[
i
].
bytes
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
colLength
[
i
]);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pResultInfo
->
convertBuf
[
i
]
=
p
;
SResultColumn
*
pCol
=
&
pResultInfo
->
pCol
[
i
];
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
)
{
if
(
pCol
->
offset
[
j
]
!=
-
1
)
{
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
}
}
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
}
}
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
a0ba1eb1
...
...
@@ -64,7 +64,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
int32_t
code
=
0
;
SNodeListNode
*
nodeList
=
(
SNodeListNode
*
)
pNode
;
SListCell
*
cell
=
nodeList
->
pNodeList
->
pHead
;
SScalarParam
out
=
{.
columnData
=
taosMemory
Malloc
(
sizeof
(
SColumnInfoData
))};
SScalarParam
out
=
{.
columnData
=
taosMemory
Calloc
(
1
,
sizeof
(
SColumnInfoData
))};
int32_t
len
=
0
;
void
*
buf
=
NULL
;
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
a0ba1eb1
...
...
@@ -177,7 +177,7 @@ static FORCE_INLINE void varToBool(char *buf, SScalarParam* pOut, int32_t rowInd
colDataAppend
(
pOut
->
columnData
,
rowIndex
,
(
char
*
)
&
v
,
false
);
}
int32_t
vectorConvertFromVarData
(
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
inType
,
int32_t
outType
)
{
int32_t
vectorConvertFromVarData
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
inType
,
int32_t
outType
)
{
int32_t
bufSize
=
pIn
->
columnData
->
info
.
bytes
;
char
*
tmp
=
taosMemoryMalloc
(
bufSize
);
...
...
@@ -227,7 +227,7 @@ int32_t vectorConvertFromVarData(SScalarParam* pIn, SScalarParam* pOut, int32_t
}
// TODO opt performance
int32_t
vectorConvertImpl
(
SScalarParam
*
pIn
,
SScalarParam
*
pOut
)
{
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
)
{
SColumnInfoData
*
pInputCol
=
pIn
->
columnData
;
SColumnInfoData
*
pOutputCol
=
pOut
->
columnData
;
...
...
@@ -406,27 +406,32 @@ int32_t vectorConvert(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam* p
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
doConvertHelper
(
SScalarParam
*
pParam
,
int32_t
type
)
{
SScalarParam
param
=
{
0
};
enum
{
VECTOR_DO_CONVERT
=
0x1
,
VECTOR_UN_CONVERT
=
0x2
,
};
static
int32_t
doConvertHelper
(
SScalarParam
*
pDest
,
int32_t
*
convert
,
const
SScalarParam
*
pParam
,
int32_t
type
)
{
SColumnInfoData
*
pCol
=
pParam
->
columnData
;
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
p
aram
.
numOfRows
=
pParam
->
numOfRows
;
p
Dest
->
numOfRows
=
pParam
->
numOfRows
;
SDataType
t
=
{.
type
=
type
,
.
bytes
=
tDataTypes
[
type
].
bytes
};
p
aram
.
columnData
=
createColumnInfoData
(
&
t
,
pParam
->
numOfRows
);
if
(
p
aram
.
columnData
==
NULL
)
{
p
Dest
->
columnData
=
createColumnInfoData
(
&
t
,
pParam
->
numOfRows
);
if
(
p
Dest
->
columnData
==
NULL
)
{
sclError
(
"malloc %d failed"
,
(
int32_t
)(
pParam
->
numOfRows
*
sizeof
(
double
)));
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
vectorConvertImpl
(
pParam
,
&
param
);
int32_t
code
=
vectorConvertImpl
(
pParam
,
pDest
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
colDataDestroy
(
pParam
->
columnData
);
pParam
->
columnData
=
param
.
columnData
;
*
convert
=
VECTOR_DO_CONVERT
;
}
else
{
*
convert
=
VECTOR_UN_CONVERT
;
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -452,6 +457,29 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
}
}
static
SColumnInfoData
*
doVectorConvert
(
SScalarParam
*
pInput
,
int32_t
*
doConvert
)
{
SScalarParam
convertParam
=
{
0
};
int32_t
code
=
doConvertHelper
(
&
convertParam
,
doConvert
,
pInput
,
TSDB_DATA_TYPE_DOUBLE
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
NULL
;
}
if
(
*
doConvert
==
VECTOR_DO_CONVERT
)
{
return
convertParam
.
columnData
;
}
else
{
return
pInput
->
columnData
;
}
}
static
void
doReleaseVec
(
SColumnInfoData
*
pCol
,
int32_t
type
)
{
if
(
type
==
VECTOR_DO_CONVERT
)
{
colDataDestroy
(
pCol
);
taosMemoryFree
(
pCol
);
}
}
void
vectorMathAdd
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
SColumnInfoData
*
pOutputCol
=
pOut
->
columnData
;
...
...
@@ -460,11 +488,9 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
pOut
->
numOfRows
=
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
);
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_DOUBLE
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_DOUBLE
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getDoubleValue_fn_t
getVectorDoubleValueFnLeft
=
getVectorDoubleValueFn
(
pLeftCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
...
...
@@ -488,6 +514,9 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
}
else
if
(
pRight
->
numOfRows
==
1
)
{
vectorMathAddHelper
(
pLeftCol
,
pRightCol
,
pOutputCol
,
pLeft
->
numOfRows
,
step
,
i
);
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
// TODO not correct for descending order scan
...
...
@@ -518,11 +547,9 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_DOUBLE
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_DOUBLE
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getDoubleValue_fn_t
getVectorDoubleValueFnLeft
=
getVectorDoubleValueFn
(
pLeftCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
...
...
@@ -546,6 +573,9 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
}
else
if
(
pRight
->
numOfRows
==
1
)
{
vectorMathSubHelper
(
pLeftCol
,
pRightCol
,
pOutputCol
,
pLeft
->
numOfRows
,
step
,
1
,
i
);
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
// TODO not correct for descending order scan
...
...
@@ -575,11 +605,9 @@ void vectorMathMultiply(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_DOUBLE
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_DOUBLE
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getDoubleValue_fn_t
getVectorDoubleValueFnLeft
=
getVectorDoubleValueFn
(
pLeftCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
...
...
@@ -603,6 +631,9 @@ void vectorMathMultiply(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
}
else
if
(
pRight
->
numOfRows
==
1
)
{
vectorMathMultiplyHelper
(
pLeftCol
,
pRightCol
,
pOutputCol
,
pLeft
->
numOfRows
,
step
,
i
);
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
void
vectorMathDivide
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
...
...
@@ -612,11 +643,9 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_DOUBLE
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_DOUBLE
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getDoubleValue_fn_t
getVectorDoubleValueFnLeft
=
getVectorDoubleValueFn
(
pLeftCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
...
...
@@ -660,6 +689,9 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
}
}
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
void
vectorMathRemainder
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
...
...
@@ -669,11 +701,9 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_DOUBLE
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_DOUBLE
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getDoubleValue_fn_t
getVectorDoubleValueFnLeft
=
getVectorDoubleValueFn
(
pLeftCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
...
...
@@ -738,6 +768,9 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
}
}
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
void
vectorConcat
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
...
...
@@ -753,7 +786,7 @@ void vectorConcat(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t
char* left = POINTER_SHIFT(pLeft->data, pLeft->bytes * i);
char* right = POINTER_SHIFT(pRight->data, pRight->bytes * i);
if (isNull(left,
GET_PARAM_TYPE(pLeft)) || isNull(right, GET_PARAM_TYPE(pRight)
)) {
if (isNull(left,
pLeftCol->info.type) || isNull(right, pRight->info.type
)) {
setVardataNull(output, TSDB_DATA_TYPE_BINARY);
continue;
}
...
...
@@ -766,7 +799,7 @@ void vectorConcat(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t
} else if (pLeft->numOfRows == 1) {
for (; i >= 0 && i < pRight->numOfRows; i += step, output += len) {
char *right = POINTER_SHIFT(pRight->data, pRight->bytes * i);
if (isNull(pLeft->data,
GET_PARAM_TYPE(pLeft)) || isNull(right, GET_PARAM_TYPE(pRight)
)) {
if (isNull(pLeft->data,
pLeftCol->info.type) || isNull(right, pRight->info.type
)) {
setVardataNull(output, TSDB_DATA_TYPE_BINARY);
continue;
}
...
...
@@ -778,7 +811,7 @@ void vectorConcat(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t
} else if (pRight->numOfRows == 1) {
for (; i >= 0 && i < pLeft->numOfRows; i += step, output += len) {
char* left = POINTER_SHIFT(pLeft->data, pLeft->bytes * i);
if (isNull(left,
GET_PARAM_TYPE(pLeft)) || isNull(pRight->data, GET_PARAM_TYPE(pRight)
)) {
if (isNull(left,
pLeftCol->info.type) || isNull(pRight->data, pRight->info.type
)) {
SET_DOUBLE_NULL(output);
continue;
}
...
...
@@ -817,14 +850,12 @@ void vectorBitAnd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_BIGINT
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_BIGINT
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
GET_PARAM_TYPE
(
pLeft
)
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
GET_PARAM_TYPE
(
pRight
)
);
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
pLeftCol
->
info
.
type
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
pRightCol
->
info
.
type
);
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
...
...
@@ -845,6 +876,9 @@ void vectorBitAnd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
}
else
if
(
pRight
->
numOfRows
==
1
)
{
vectorBitAndHelper
(
pLeftCol
,
pRightCol
,
pOutputCol
,
pLeft
->
numOfRows
,
step
,
i
);
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
static
void
vectorBitOrHelper
(
SColumnInfoData
*
pLeftCol
,
SColumnInfoData
*
pRightCol
,
SColumnInfoData
*
pOutputCol
,
int32_t
numOfRows
,
int32_t
step
,
int32_t
i
)
{
...
...
@@ -874,14 +908,12 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
doConvertHelper
(
pLeft
,
TSDB_DATA_TYPE_BIGINT
);
doConvertHelper
(
pRight
,
TSDB_DATA_TYPE_BIGINT
);
SColumnInfoData
*
pLeftCol
=
pLeft
->
columnData
;
SColumnInfoData
*
pRightCol
=
pRight
->
columnData
;
int32_t
leftConvert
=
0
,
rightConvert
=
0
;
SColumnInfoData
*
pLeftCol
=
doVectorConvert
(
pLeft
,
&
leftConvert
);
SColumnInfoData
*
pRightCol
=
doVectorConvert
(
pRight
,
&
rightConvert
);
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
GET_PARAM_TYPE
(
pLeft
)
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
GET_PARAM_TYPE
(
pRight
)
);
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
pLeftCol
->
info
.
type
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
pRightCol
->
info
.
type
);
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
...
...
@@ -901,6 +933,9 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
}
else
if
(
pRight
->
numOfRows
==
1
)
{
vectorBitOrHelper
(
pLeftCol
,
pRightCol
,
pOutputCol
,
pLeft
->
numOfRows
,
step
,
i
);
}
doReleaseVec
(
pLeftCol
,
leftConvert
);
doReleaseVec
(
pRightCol
,
rightConvert
);
}
void
vectorCompareImpl
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
,
int32_t
optr
)
{
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
a0ba1eb1
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录