Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
383c828c
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
383c828c
编写于
5月 24, 2023
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: before review
上级
2e4c14c1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
58 addition
and
32 deletion
+58
-32
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+58
-32
未找到文件。
source/libs/scalar/src/filter.c
浏览文件 @
383c828c
...
@@ -3472,7 +3472,7 @@ int32_t fltSclCompareWithFloat64(SFltSclDatum *val1, SFltSclDatum *val2) {
...
@@ -3472,7 +3472,7 @@ int32_t fltSclCompareWithFloat64(SFltSclDatum *val1, SFltSclDatum *val2) {
}
}
// TODO: varchar, nchar
// TODO: varchar, nchar
default:
default:
qError
(
"not support
comparsion. %d,
%d"
,
val1
->
kind
,
val2
->
kind
);
qError
(
"not support
ed comparsion. kind1 %d, kind2
%d"
,
val1
->
kind
,
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
}
}
}
}
...
@@ -3489,7 +3489,7 @@ int32_t fltSclCompareWithInt64(SFltSclDatum *val1, SFltSclDatum *val2) {
...
@@ -3489,7 +3489,7 @@ int32_t fltSclCompareWithInt64(SFltSclDatum *val1, SFltSclDatum *val2) {
}
}
// TODO: varchar, nchar
// TODO: varchar, nchar
default:
default:
qError
(
"not support
comparsion. %d,
%d"
,
val1
->
kind
,
val2
->
kind
);
qError
(
"not support
ed comparsion. kind1 %d, kind2
%d"
,
val1
->
kind
,
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
}
}
}
}
...
@@ -3506,7 +3506,7 @@ int32_t fltSclCompareWithUInt64(SFltSclDatum *val1, SFltSclDatum *val2) {
...
@@ -3506,7 +3506,7 @@ int32_t fltSclCompareWithUInt64(SFltSclDatum *val1, SFltSclDatum *val2) {
}
}
// TODO: varchar, nchar
// TODO: varchar, nchar
default:
default:
qError
(
"not support
comparsion. %d,
%d"
,
val1
->
kind
,
val2
->
kind
);
qError
(
"not support
ed comparsion. kind1 %d, kind2
%d"
,
val1
->
kind
,
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
return
(
val1
->
kind
-
val2
->
kind
);
}
}
}
}
...
@@ -3529,7 +3529,7 @@ int32_t fltSclCompareDatum(SFltSclDatum *val1, SFltSclDatum *val2) {
...
@@ -3529,7 +3529,7 @@ int32_t fltSclCompareDatum(SFltSclDatum *val1, SFltSclDatum *val2) {
}
}
// TODO: varchar/nchar
// TODO: varchar/nchar
default:
default:
fltError
(
"not supported kind. just return 0"
);
qError
(
"not supported kind when compare datum. kind2 : %d"
,
val2
->
kind
);
return
0
;
return
0
;
break
;
break
;
}
}
...
@@ -3585,7 +3585,6 @@ int32_t fltSclMergeSort(SArray *pts1, SArray *pts2, SArray *result) {
...
@@ -3585,7 +3585,6 @@ int32_t fltSclMergeSort(SArray *pts1, SArray *pts2, SArray *result) {
return
0
;
return
0
;
}
}
// pts1 and pts2 must be ordered and de-duplicated and each range can not be a range of another range
int32_t
fltSclMerge
(
SArray
*
pts1
,
SArray
*
pts2
,
bool
isUnion
,
SArray
*
merged
)
{
int32_t
fltSclMerge
(
SArray
*
pts1
,
SArray
*
pts2
,
bool
isUnion
,
SArray
*
merged
)
{
size_t
len1
=
taosArrayGetSize
(
pts1
);
size_t
len1
=
taosArrayGetSize
(
pts1
);
size_t
len2
=
taosArrayGetSize
(
pts2
);
size_t
len2
=
taosArrayGetSize
(
pts2
);
...
@@ -3616,7 +3615,6 @@ int32_t fltSclIntersect(SArray *pts1, SArray *pts2, SArray *merged) { return flt
...
@@ -3616,7 +3615,6 @@ int32_t fltSclIntersect(SArray *pts1, SArray *pts2, SArray *merged) { return flt
int32_t
fltSclUnion
(
SArray
*
pts1
,
SArray
*
pts2
,
SArray
*
merged
)
{
return
fltSclMerge
(
pts1
,
pts2
,
true
,
merged
);
}
int32_t
fltSclUnion
(
SArray
*
pts1
,
SArray
*
pts2
,
SArray
*
merged
)
{
return
fltSclMerge
(
pts1
,
pts2
,
true
,
merged
);
}
// TODO: column, constant
typedef
struct
{
typedef
struct
{
SColumnNode
*
colNode
;
SColumnNode
*
colNode
;
SValueNode
*
valNode
;
SValueNode
*
valNode
;
...
@@ -3677,7 +3675,7 @@ int32_t fltSclBuildDatumFromValueNode(SFltSclDatum *datum, SValueNode *valNode)
...
@@ -3677,7 +3675,7 @@ int32_t fltSclBuildDatumFromValueNode(SFltSclDatum *datum, SValueNode *valNode)
}
}
// TODO:varchar/nchar/json
// TODO:varchar/nchar/json
default:
{
default:
{
qError
(
"not supported
"
);
qError
(
"not supported
type %d when build datum from value node"
,
valNode
->
node
.
resType
.
type
);
break
;
break
;
}
}
}
}
...
@@ -3714,7 +3712,7 @@ int32_t fltSclBuildDatumFromBlockSmaValue(SFltSclDatum *datum, uint8_t type, int
...
@@ -3714,7 +3712,7 @@ int32_t fltSclBuildDatumFromBlockSmaValue(SFltSclDatum *datum, uint8_t type, int
// TODO:varchar/nchar/json
// TODO:varchar/nchar/json
default:
{
default:
{
datum
->
kind
=
FLT_SCL_DATUM_KIND_NULL
;
datum
->
kind
=
FLT_SCL_DATUM_KIND_NULL
;
qError
(
"not supported type
when build datum from block sma value"
);
qError
(
"not supported type
%d when build datum from block sma value"
,
type
);
break
;
break
;
}
}
}
}
...
@@ -3732,6 +3730,13 @@ int32_t fltSclBuildRangeFromBlockSma(SFltSclColumnRange *colRange, SColumnDataAg
...
@@ -3732,6 +3730,13 @@ int32_t fltSclBuildRangeFromBlockSma(SFltSclColumnRange *colRange, SColumnDataAg
taosArrayPush
(
points
,
&
endPt
);
taosArrayPush
(
points
,
&
endPt
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
pAgg
->
numOfNull
>
0
)
{
SFltSclDatum
nullDatum
=
{.
kind
=
FLT_SCL_DATUM_KIND_NULL
};
SFltSclPoint
startPt
=
{.
start
=
true
,
.
excl
=
false
,
.
val
=
nullDatum
};
SFltSclPoint
endPt
=
{.
start
=
false
,
.
excl
=
false
,
.
val
=
nullDatum
};
taosArrayPush
(
points
,
&
startPt
);
taosArrayPush
(
points
,
&
endPt
);
}
SFltSclDatum
min
;
SFltSclDatum
min
;
fltSclBuildDatumFromBlockSmaValue
(
&
min
,
colRange
->
colNode
->
node
.
resType
.
type
,
pAgg
->
min
);
fltSclBuildDatumFromBlockSmaValue
(
&
min
,
colRange
->
colNode
->
node
.
resType
.
type
,
pAgg
->
min
);
SFltSclPoint
minPt
=
{.
excl
=
false
,
.
start
=
true
,
.
val
=
min
};
SFltSclPoint
minPt
=
{.
excl
=
false
,
.
start
=
true
,
.
val
=
min
};
...
@@ -4357,8 +4362,25 @@ int32_t fltSclBuildRangePoints(SFltSclOperator *oper, SArray *points) {
...
@@ -4357,8 +4362,25 @@ int32_t fltSclBuildRangePoints(SFltSclOperator *oper, SArray *points) {
}
}
break
;
break
;
}
}
case
OP_TYPE_IS_NULL
:
{
SFltSclDatum
nullDatum
=
{.
kind
=
FLT_SCL_DATUM_KIND_NULL
};
SFltSclPoint
startPt
=
{.
start
=
true
,
.
excl
=
false
,
.
val
=
nullDatum
};
SFltSclPoint
endPt
=
{.
start
=
false
,
.
excl
=
false
,
.
val
=
nullDatum
};
taosArrayPush
(
points
,
&
startPt
);
taosArrayPush
(
points
,
&
endPt
);
break
;
}
case
OP_TYPE_IS_NOT_NULL
:
{
SFltSclDatum
minDatum
=
{.
kind
=
FLT_SCL_DATUM_KIND_MIN
,
.
type
=
oper
->
colNode
->
node
.
resType
};
SFltSclPoint
startPt
=
{.
start
=
true
,
.
excl
=
false
,
.
val
=
minDatum
};
SFltSclDatum
maxDatum
=
{.
kind
=
FLT_SCL_DATUM_KIND_MAX
,
.
type
=
oper
->
colNode
->
node
.
resType
};
SFltSclPoint
endPt
=
{.
start
=
false
,
.
excl
=
false
,
.
val
=
maxDatum
};
taosArrayPush
(
points
,
&
startPt
);
taosArrayPush
(
points
,
&
endPt
);
break
;
}
default:
{
default:
{
qError
(
"not supported op
"
);
qError
(
"not supported op
erator type : %d when build range points"
,
oper
->
type
);
break
;
break
;
}
}
}
}
...
@@ -4391,26 +4413,30 @@ static int32_t fltSclCollectOperatorFromNode(SNode *pNode, SArray *sclOpList) {
...
@@ -4391,26 +4413,30 @@ static int32_t fltSclCollectOperatorFromNode(SNode *pNode, SArray *sclOpList) {
if
(
nodeType
(
pNode
)
!=
QUERY_NODE_OPERATOR
)
{
if
(
nodeType
(
pNode
)
!=
QUERY_NODE_OPERATOR
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
// TODO: left value node, right column node
// TODO: datatype
// TODO: operator
if
(
pOper
->
pLeft
==
NULL
||
pOper
->
pRight
==
NULL
)
{
if
(
pOper
->
pLeft
==
NULL
||
pOper
->
pRight
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
nodeType
(
pOper
->
pLeft
)
==
QUERY_NODE_COLUMN
&&
nodeType
(
pOper
->
pRight
)
==
QUERY_NODE_VALUE
&&
(
pOper
->
opType
==
OP_TYPE_GREATER_THAN
||
pOper
->
opType
==
OP_TYPE_GREATER_EQUAL
||
if
(
!
(
pOper
->
opType
==
OP_TYPE_GREATER_THAN
||
pOper
->
opType
==
OP_TYPE_GREATER_EQUAL
||
pOper
->
opType
==
OP_TYPE_LOWER_THAN
||
pOper
->
opType
==
OP_TYPE_LOWER_EQUAL
||
pOper
->
opType
==
OP_TYPE_LOWER_THAN
||
pOper
->
opType
==
OP_TYPE_LOWER_EQUAL
||
pOper
->
opType
==
OP_TYPE_NOT_EQUAL
||
pOper
->
opType
==
OP_TYPE_EQUAL
))
{
pOper
->
opType
==
OP_TYPE_NOT_EQUAL
||
pOper
->
opType
==
OP_TYPE_EQUAL
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
(
nodeType
(
pOper
->
pLeft
)
==
QUERY_NODE_COLUMN
&&
nodeType
(
pOper
->
pRight
)
==
QUERY_NODE_VALUE
))
{
return
TSDB_CODE_SUCCESS
;
}
SValueNode
*
valNode
=
(
SValueNode
*
)
pOper
->
pRight
;
SValueNode
*
valNode
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
IS_NUMERIC_TYPE
(
valNode
->
node
.
resType
.
type
)
||
valNode
->
node
.
resType
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
if
(
IS_NUMERIC_TYPE
(
valNode
->
node
.
resType
.
type
)
||
valNode
->
node
.
resType
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
SFltSclOperator
sclOp
=
{
SFltSclOperator
sclOp
=
{.
colNode
=
(
SColumnNode
*
)
nodesCloneNode
(
pOper
->
pLeft
),
.
colNode
=
(
SColumnNode
*
)
nodesCloneNode
(
pOper
->
pLeft
),
.
valNode
=
(
SValueNode
*
)
nodesCloneNode
(
pOper
->
pRight
),
.
valNode
=
(
SValueNode
*
)
nodesCloneNode
(
pOper
->
pRight
),
.
type
=
pOper
->
opType
};
.
type
=
pOper
->
opType
};
taosArrayPush
(
sclOpList
,
&
sclOp
);
taosArrayPush
(
sclOpList
,
&
sclOp
);
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -4446,8 +4472,8 @@ int32_t fltOptimizeNodes(SFilterInfo *pInfo, SNode **pNode, SFltTreeStat *pStat)
...
@@ -4446,8 +4472,8 @@ int32_t fltOptimizeNodes(SFilterInfo *pInfo, SNode **pNode, SFltTreeStat *pStat)
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
sclOpList
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
sclOpList
);
++
i
)
{
SFltSclOperator
*
sclOp
=
taosArrayGet
(
sclOpList
,
i
);
SFltSclOperator
*
sclOp
=
taosArrayGet
(
sclOpList
,
i
);
nodesDestroyNode
((
SNode
*
)
sclOp
->
colNode
);
nodesDestroyNode
((
SNode
*
)
sclOp
->
colNode
);
nodesDestroyNode
((
SNode
*
)
sclOp
->
valNode
);
nodesDestroyNode
((
SNode
*
)
sclOp
->
valNode
);
}
}
taosArrayDestroy
(
sclOpList
);
taosArrayDestroy
(
sclOpList
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录