Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
028ded93
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
028ded93
编写于
1月 03, 2023
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix assert in filter.c
上级
0ddb9be3
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
40 addition
and
37 deletion
+40
-37
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+40
-37
未找到文件。
source/libs/scalar/src/filter.c
浏览文件 @
028ded93
...
...
@@ -90,7 +90,7 @@ rangeCompFunc gRangeCompare[] = {filterRangeCompee, filterRangeCompei, filterRan
int8_t
filterGetRangeCompFuncFromOptrs
(
uint8_t
optr
,
uint8_t
optr2
)
{
if
(
optr2
)
{
assert
(
optr2
==
OP_TYPE_LOWER_THAN
||
optr2
==
OP_TYPE_LOWER_EQUAL
);
ASSERT
(
optr2
==
OP_TYPE_LOWER_THAN
||
optr2
==
OP_TYPE_LOWER_EQUAL
);
if
(
optr
==
OP_TYPE_GREATER_THAN
)
{
if
(
optr2
==
OP_TYPE_LOWER_THAN
)
{
...
...
@@ -721,7 +721,7 @@ int32_t filterAddRangeCtx(void *dst, void *src, int32_t optr) {
SFilterRangeCtx
*
dctx
=
(
SFilterRangeCtx
*
)
dst
;
SFilterRangeCtx
*
sctx
=
(
SFilterRangeCtx
*
)
src
;
assert
(
optr
==
LOGIC_COND_TYPE_OR
);
ASSERT
(
optr
==
LOGIC_COND_TYPE_OR
);
if
(
sctx
->
rs
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1120,7 +1120,7 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
if
(
u
->
right
.
type
==
FLD_TYPE_VALUE
)
{
SFilterField
*
val
=
FILTER_UNIT_RIGHT_FIELD
(
info
,
u
);
assert
(
FILTER_GET_FLAG
(
val
->
flag
,
FLD_TYPE_VALUE
));
ASSERT
(
FILTER_GET_FLAG
(
val
->
flag
,
FLD_TYPE_VALUE
));
}
else
{
int32_t
paramNum
=
scalarGetOperatorParamNum
(
optr
);
if
(
1
!=
paramNum
)
{
...
...
@@ -1130,7 +1130,7 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
}
SFilterField
*
col
=
FILTER_UNIT_LEFT_FIELD
(
info
,
u
);
assert
(
FILTER_GET_FLAG
(
col
->
flag
,
FLD_TYPE_COLUMN
));
ASSERT
(
FILTER_GET_FLAG
(
col
->
flag
,
FLD_TYPE_COLUMN
));
info
->
units
[
info
->
unitNum
].
compare
.
type
=
FILTER_GET_COL_FIELD_TYPE
(
col
);
info
->
units
[
info
->
unitNum
].
compare
.
precision
=
FILTER_GET_COL_FIELD_PRECISION
(
col
);
...
...
@@ -1290,29 +1290,29 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
if
(
optr
==
LOGIC_COND_TYPE_AND
)
{
if
(
ctx
->
isnull
)
{
assert
(
ctx
->
notnull
==
false
&&
ctx
->
isrange
==
false
);
ASSERT
(
ctx
->
notnull
==
false
&&
ctx
->
isrange
==
false
);
filterAddUnit
(
dst
,
OP_TYPE_IS_NULL
,
&
left
,
NULL
,
&
uidx
);
filterAddUnitToGroup
(
g
,
uidx
);
return
TSDB_CODE_SUCCESS
;
}
if
(
ctx
->
notnull
)
{
assert
(
ctx
->
isnull
==
false
&&
ctx
->
isrange
==
false
);
ASSERT
(
ctx
->
isnull
==
false
&&
ctx
->
isrange
==
false
);
filterAddUnit
(
dst
,
OP_TYPE_IS_NOT_NULL
,
&
left
,
NULL
,
&
uidx
);
filterAddUnitToGroup
(
g
,
uidx
);
return
TSDB_CODE_SUCCESS
;
}
if
(
!
ctx
->
isrange
)
{
assert
(
ctx
->
isnull
||
ctx
->
notnull
);
ASSERT
(
ctx
->
isnull
||
ctx
->
notnull
);
return
TSDB_CODE_SUCCESS
;
}
assert
(
ctx
->
rs
&&
ctx
->
rs
->
next
==
NULL
);
ASSERT
(
ctx
->
rs
&&
ctx
->
rs
->
next
==
NULL
);
SFilterRange
*
ra
=
&
ctx
->
rs
->
ra
;
assert
(
!
((
FILTER_GET_FLAG
(
ra
->
sflag
,
RANGE_FLG_NULL
))
&&
(
FILTER_GET_FLAG
(
ra
->
eflag
,
RANGE_FLG_NULL
))));
ASSERT
(
!
((
FILTER_GET_FLAG
(
ra
->
sflag
,
RANGE_FLG_NULL
))
&&
(
FILTER_GET_FLAG
(
ra
->
eflag
,
RANGE_FLG_NULL
))));
if
((
!
FILTER_GET_FLAG
(
ra
->
sflag
,
RANGE_FLG_NULL
))
&&
(
!
FILTER_GET_FLAG
(
ra
->
eflag
,
RANGE_FLG_NULL
)))
{
__compar_fn_t
func
=
getComparFunc
(
type
,
0
);
...
...
@@ -1366,7 +1366,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
SFilterGroup
ng
=
{
0
};
g
=
&
ng
;
assert
(
ctx
->
isnull
||
ctx
->
notnull
||
ctx
->
isrange
);
ASSERT
(
ctx
->
isnull
||
ctx
->
notnull
||
ctx
->
isrange
);
if
(
ctx
->
isnull
)
{
filterAddUnit
(
dst
,
OP_TYPE_IS_NULL
,
&
left
,
NULL
,
&
uidx
);
...
...
@@ -1375,7 +1375,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
}
if
(
ctx
->
notnull
)
{
assert
(
!
ctx
->
isrange
);
ASSERT
(
!
ctx
->
isrange
);
memset
(
g
,
0
,
sizeof
(
*
g
));
filterAddUnit
(
dst
,
OP_TYPE_IS_NOT_NULL
,
&
left
,
NULL
,
&
uidx
);
...
...
@@ -1384,7 +1384,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
}
if
(
!
ctx
->
isrange
)
{
assert
(
ctx
->
isnull
||
ctx
->
notnull
);
ASSERT
(
ctx
->
isnull
||
ctx
->
notnull
);
g
->
unitNum
=
0
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1442,7 +1442,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan
filterAddUnitToGroup
(
g
,
uidx
);
}
assert
(
g
->
unitNum
>
0
);
ASSERT
(
g
->
unitNum
>
0
);
taosArrayPush
(
res
,
g
);
...
...
@@ -1898,7 +1898,7 @@ void filterFreeInfo(SFilterInfo *info) {
}
int32_t
filterHandleValueExtInfo
(
SFilterUnit
*
unit
,
char
extInfo
)
{
assert
(
extInfo
>
0
||
extInfo
<
0
);
ASSERT
(
extInfo
>
0
||
extInfo
<
0
);
uint8_t
optr
=
FILTER_UNIT_OPTR
(
unit
);
switch
(
optr
)
{
...
...
@@ -1914,7 +1914,8 @@ int32_t filterHandleValueExtInfo(SFilterUnit *unit, char extInfo) {
unit
->
compare
.
optr
=
FILTER_DUMMY_EMPTY_OPTR
;
break
;
default:
assert
(
0
);
fltError
(
"unsupported operator type"
);
return
TSDB_CODE_APP_ERROR
;
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1924,13 +1925,13 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
for
(
uint32_t
i
=
0
;
i
<
info
->
unitNum
;
++
i
)
{
SFilterUnit
*
unit
=
&
info
->
units
[
i
];
if
(
unit
->
right
.
type
!=
FLD_TYPE_VALUE
)
{
assert
(
unit
->
compare
.
optr
==
FILTER_DUMMY_EMPTY_OPTR
||
scalarGetOperatorParamNum
(
unit
->
compare
.
optr
)
==
1
);
ASSERT
(
unit
->
compare
.
optr
==
FILTER_DUMMY_EMPTY_OPTR
||
scalarGetOperatorParamNum
(
unit
->
compare
.
optr
)
==
1
);
continue
;
}
SFilterField
*
right
=
FILTER_UNIT_RIGHT_FIELD
(
info
,
unit
);
assert
(
FILTER_GET_FLAG
(
right
->
flag
,
FLD_TYPE_VALUE
));
ASSERT
(
FILTER_GET_FLAG
(
right
->
flag
,
FLD_TYPE_VALUE
));
uint32_t
type
=
FILTER_UNIT_DATA_TYPE
(
unit
);
int8_t
precision
=
FILTER_UNIT_DATA_PRECISION
(
unit
);
...
...
@@ -1938,7 +1939,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
SValueNode
*
var
=
(
SValueNode
*
)
fi
->
desc
;
if
(
var
==
NULL
)
{
assert
(
fi
->
data
!=
NULL
);
ASSERT
(
fi
->
data
!=
NULL
);
continue
;
}
...
...
@@ -2066,7 +2067,8 @@ bool filterDoCompare(__compar_fn_t func, uint8_t optr, void *left, void *right)
}
default:
assert
(
false
);
fltError
(
"unsupported operator type"
);
return
false
;
}
return
true
;
...
...
@@ -2099,7 +2101,7 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit *u, SFilterRangeCtx *c
FILTER_SET_FLAG
(
ra
.
sflag
,
RANGE_FLG_NULL
);
break
;
case
OP_TYPE_NOT_EQUAL
:
assert
(
type
==
TSDB_DATA_TYPE_BOOL
);
ASSERT
(
type
==
TSDB_DATA_TYPE_BOOL
);
if
(
GET_INT8_VAL
(
val
))
{
SIMPLE_COPY_VALUES
(
&
ra
.
s
,
&
tmp
);
SIMPLE_COPY_VALUES
(
&
ra
.
e
,
&
tmp
);
...
...
@@ -2114,7 +2116,8 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit *u, SFilterRangeCtx *c
SIMPLE_COPY_VALUES
(
&
ra
.
e
,
val
);
break
;
default:
assert
(
0
);
fltError
(
"unsupported operator type"
);
return
TSDB_CODE_APP_ERROR
;
}
filterAddRange
(
ctx
,
&
ra
,
optr
);
...
...
@@ -2366,8 +2369,8 @@ int32_t filterMergeTwoGroupsImpl(SFilterInfo *info, SFilterRangeCtx **ctx, int32
filterReuseRangeCtx
(
*
ctx
,
type
,
0
);
}
assert
(
gRes2
->
colInfo
[
cidx
].
type
==
RANGE_TYPE_MR_CTX
);
assert
(
gRes1
->
colInfo
[
cidx
].
type
==
RANGE_TYPE_MR_CTX
);
ASSERT
(
gRes2
->
colInfo
[
cidx
].
type
==
RANGE_TYPE_MR_CTX
);
ASSERT
(
gRes1
->
colInfo
[
cidx
].
type
==
RANGE_TYPE_MR_CTX
);
filterCopyRangeCtx
(
*
ctx
,
gRes2
->
colInfo
[
cidx
].
info
);
filterSourceRangeFromCtx
(
*
ctx
,
gRes1
->
colInfo
[
cidx
].
info
,
optr
,
empty
,
all
);
...
...
@@ -2403,7 +2406,7 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx **gRes1, SFilter
continue
;
}
assert
(
idx1
==
idx2
);
ASSERT
(
idx1
==
idx2
);
++
merNum
;
...
...
@@ -2453,15 +2456,15 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx **gRes1, SFilter
}
}
assert
(
merNum
>
0
);
ASSERT
(
merNum
>
0
);
SFilterColInfo
*
colInfo
=
NULL
;
assert
(
merNum
==
equal1
||
merNum
==
equal2
);
ASSERT
(
merNum
==
equal1
||
merNum
==
equal2
);
filterFreeGroupCtx
(
*
gRes2
);
*
gRes2
=
NULL
;
assert
(
colCtxs
&&
taosArrayGetSize
(
colCtxs
)
>
0
);
ASSERT
(
colCtxs
&&
taosArrayGetSize
(
colCtxs
)
>
0
);
int32_t
ctxSize
=
(
int32_t
)
taosArrayGetSize
(
colCtxs
);
SFilterColCtx
*
pctx
=
NULL
;
...
...
@@ -2518,7 +2521,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t *gR
if
(
pColNum
>
0
)
{
for
(
int32_t
m
=
0
;
m
<=
pEnd
;
++
m
)
{
for
(
int32_t
n
=
cStart
;
n
<=
cEnd
;
++
n
)
{
assert
(
m
<
n
);
ASSERT
(
m
<
n
);
filterMergeTwoGroups
(
info
,
&
gRes
[
m
],
&
gRes
[
n
],
&
all
);
FLT_CHK_JMP
(
all
);
...
...
@@ -2539,7 +2542,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t *gR
for
(
int32_t
m
=
cStart
;
m
<
cEnd
;
++
m
)
{
for
(
int32_t
n
=
m
+
1
;
n
<=
cEnd
;
++
n
)
{
assert
(
m
<
n
);
ASSERT
(
m
<
n
);
filterMergeTwoGroups
(
info
,
&
gRes
[
m
],
&
gRes
[
n
],
&
all
);
FLT_CHK_JMP
(
all
);
...
...
@@ -2634,7 +2637,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t gResNum
for
(
uint32_t
m
=
0
;
m
<
res
->
colNum
;
++
m
)
{
colInfo
=
&
res
->
colInfo
[
res
->
colIdx
[
m
]];
if
(
FILTER_NO_MERGE_DATA_TYPE
(
colInfo
->
dataType
))
{
assert
(
colInfo
->
type
==
RANGE_TYPE_UNIT
);
ASSERT
(
colInfo
->
type
==
RANGE_TYPE_UNIT
);
int32_t
usize
=
(
int32_t
)
taosArrayGetSize
((
SArray
*
)
colInfo
->
info
);
for
(
int32_t
n
=
0
;
n
<
usize
;
++
n
)
{
...
...
@@ -2647,7 +2650,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t gResNum
continue
;
}
assert
(
colInfo
->
type
==
RANGE_TYPE_MR_CTX
);
ASSERT
(
colInfo
->
type
==
RANGE_TYPE_MR_CTX
);
filterAddGroupUnitFromCtx
(
info
,
&
oinfo
,
colInfo
->
info
,
res
->
colIdx
[
m
],
&
ng
,
optr
,
group
);
}
...
...
@@ -2688,7 +2691,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
continue
;
}
assert
(
idxNum
[
i
]
==
gResNum
);
ASSERT
(
idxNum
[
i
]
==
gResNum
);
if
(
idxs
==
NULL
)
{
idxs
=
taosMemoryCalloc
(
info
->
fields
[
FLD_TYPE_COLUMN
].
num
,
sizeof
(
*
idxs
));
...
...
@@ -2712,7 +2715,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
continue
;
}
assert
(
res
->
colIdx
[
n
]
==
idxs
[
m
]);
ASSERT
(
res
->
colIdx
[
n
]
==
idxs
[
m
]);
SFilterColInfo
*
colInfo
=
&
res
->
colInfo
[
res
->
colIdx
[
n
]];
if
(
info
->
colRange
[
m
]
==
NULL
)
{
...
...
@@ -2721,7 +2724,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
info
->
colRange
[
m
]
->
colId
=
FILTER_GET_COL_FIELD_ID
(
fi
);
}
assert
(
colInfo
->
type
==
RANGE_TYPE_MR_CTX
);
ASSERT
(
colInfo
->
type
==
RANGE_TYPE_MR_CTX
);
bool
all
=
false
;
filterSourceRangeFromCtx
(
info
->
colRange
[
m
],
colInfo
->
info
,
LOGIC_COND_TYPE_OR
,
NULL
,
&
all
);
...
...
@@ -2969,7 +2972,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3
unitIdx
=
pGroupIdx
;
--
info
->
blkGroupNum
;
assert
(
empty
||
all
);
ASSERT
(
empty
||
all
);
if
(
empty
)
{
FILTER_SET_FLAG
(
info
->
blkFlag
,
FI_STATUS_BLK_EMPTY
);
...
...
@@ -3075,7 +3078,7 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, SColumn
goto
_return
;
}
assert
(
info
->
unitNum
>
1
);
ASSERT
(
info
->
unitNum
>
1
);
*
all
=
filterExecuteBasedOnStatisImpl
(
info
,
numOfRows
,
p
,
statis
,
numOfCols
);
goto
_return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录