Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
31528bbe
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
31528bbe
编写于
4月 22, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
cefa203f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
94 addition
and
15 deletion
+94
-15
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+5
-5
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+3
-0
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+4
-2
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+47
-5
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+35
-3
未找到文件。
source/libs/parser/src/parInsert.c
浏览文件 @
31528bbe
...
...
@@ -1407,11 +1407,7 @@ int32_t qBindStmtSingleColValue(void *pBlock, TAOS_BIND_v2 *bind, char *msgBuf,
}
SSchema
*
pColSchema
=
&
pSchema
[
spd
->
boundColumns
[
colIdx
]
-
1
];
if
(
bind
->
buffer_type
!=
pColSchema
->
type
)
{
return
buildInvalidOperationMsg
(
&
pBuf
,
"column type mis-match with buffer type"
);
}
if
(
bind
->
num
!=
rowNum
)
{
return
buildInvalidOperationMsg
(
&
pBuf
,
"row number in each bind param should be the same"
);
}
...
...
@@ -1426,6 +1422,10 @@ int32_t qBindStmtSingleColValue(void *pBlock, TAOS_BIND_v2 *bind, char *msgBuf,
CHECK_CODE
(
MemRowAppend
(
&
pBuf
,
NULL
,
0
,
&
param
));
}
else
{
if
(
bind
->
buffer_type
!=
pColSchema
->
type
)
{
return
buildInvalidOperationMsg
(
&
pBuf
,
"column type mis-match with buffer type"
);
}
int32_t
colLen
=
pColSchema
->
bytes
;
if
(
IS_VAR_DATA_TYPE
(
pColSchema
->
type
))
{
colLen
=
bind
->
length
[
r
];
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
31528bbe
...
...
@@ -547,6 +547,9 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
}
if
(
OP_TYPE_IN
==
pOp
->
opType
||
OP_TYPE_NOT_IN
==
pOp
->
opType
)
{
((
SExprNode
*
)
pOp
->
pRight
)
->
resType
=
((
SExprNode
*
)
pOp
->
pLeft
)
->
resType
;
}
pOp
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BOOL
;
pOp
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BOOL
].
bytes
;
}
else
if
(
nodesIsJsonOp
(
pOp
)){
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
31528bbe
...
...
@@ -215,8 +215,10 @@ typedef struct SFilterPCtx {
}
SFilterPCtx
;
typedef
struct
SFltTreeStat
{
int32_t
code
;
bool
scalarMode
;
int32_t
code
;
int8_t
precision
;
bool
scalarMode
;
SFilterInfo
*
info
;
}
SFltTreeStat
;
typedef
struct
SFltScalarCtx
{
...
...
source/libs/scalar/src/filter.c
浏览文件 @
31528bbe
...
...
@@ -3364,6 +3364,12 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *
filterGetRangeRes
(
prev
,
&
tra
);
win
->
skey
=
tra
.
s
;
win
->
ekey
=
tra
.
e
;
if
(
FILTER_GET_FLAG
(
tra
.
sflag
,
RANGE_FLG_EXCLUDE
))
{
win
->
skey
++
;
}
if
(
FILTER_GET_FLAG
(
tra
.
eflag
,
RANGE_FLG_EXCLUDE
))
{
win
->
ekey
--
;
}
}
filterFreeRangeCtx
(
prev
);
...
...
@@ -3492,7 +3498,40 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
return
DEAL_RES_CONTINUE
;
}
if
(
QUERY_NODE_VALUE
==
nodeType
(
*
pNode
)
||
QUERY_NODE_NODE_LIST
==
nodeType
(
*
pNode
)
||
QUERY_NODE_COLUMN
==
nodeType
(
*
pNode
))
{
if
(
QUERY_NODE_VALUE
==
nodeType
(
*
pNode
))
{
if
(
!
FILTER_GET_FLAG
(
stat
->
info
->
options
,
FLT_OPTION_TIMESTAMP
))
{
return
DEAL_RES_CONTINUE
;
}
SValueNode
*
valueNode
=
(
SValueNode
*
)
*
pNode
;
if
(
TSDB_DATA_TYPE_BINARY
!=
valueNode
->
node
.
resType
.
type
)
{
return
DEAL_RES_CONTINUE
;
}
#if 0
if (stat->precision < 0) {
//TODO
return DEAL_RES_CONTINUE;
}
char *timeStr = valueNode->datum.p;
if (taosParseTime(valueNode->datum.p, &valueNode->datum.i, valueNode->node.resType.bytes, stat->precision, tsDaylight) !=
TSDB_CODE_SUCCESS) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
}
TODO
#else
return
DEAL_RES_CONTINUE
;
#endif
}
if
(
QUERY_NODE_COLUMN
==
nodeType
(
*
pNode
))
{
SColumnNode
*
colNode
=
(
SColumnNode
*
)
*
pNode
;
stat
->
precision
=
colNode
->
node
.
resType
.
precision
;
return
DEAL_RES_CONTINUE
;
}
if
(
QUERY_NODE_NODE_LIST
==
nodeType
(
*
pNode
))
{
return
DEAL_RES_CONTINUE
;
}
...
...
@@ -3656,16 +3695,19 @@ int32_t filterInitFromNode(SNode* pNode, SFilterInfo **pInfo, uint32_t options)
info
=
*
pInfo
;
info
->
options
=
options
;
SFltTreeStat
stat1
=
{
0
};
FLT_ERR_JRET
(
fltReviseNodes
(
info
,
&
pNode
,
&
stat1
));
SFltTreeStat
stat
=
{
0
};
stat
.
precision
=
-
1
;
stat
.
info
=
info
;
FLT_ERR_JRET
(
fltReviseNodes
(
info
,
&
pNode
,
&
stat
));
info
->
scalarMode
=
stat
1
.
scalarMode
;
info
->
scalarMode
=
stat
.
scalarMode
;
if
(
!
info
->
scalarMode
)
{
FLT_ERR_JRET
(
fltInitFromNode
(
pNode
,
info
,
options
));
}
else
{
info
->
sclCtx
.
node
=
pNode
;
FLT_ERR_JRET
(
fltOptimizeNodes
(
info
,
&
info
->
sclCtx
.
node
,
&
stat
1
));
FLT_ERR_JRET
(
fltOptimizeNodes
(
info
,
&
info
->
sclCtx
.
node
,
&
stat
));
}
return
code
;
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
31528bbe
...
...
@@ -242,7 +242,7 @@ TEST(timerangeTest, greater) {
int32_t
code
=
filterGetTimeRange
(
opNode1
,
&
win
,
&
isStrict
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
isStrict
,
true
);
ASSERT_EQ
(
win
.
skey
,
tsmall
);
ASSERT_EQ
(
win
.
skey
,
tsmall
+
1
);
ASSERT_EQ
(
win
.
ekey
,
INT64_MAX
);
//filterFreeInfo(filter);
nodesDestroyNode
(
opNode1
);
...
...
@@ -265,6 +265,37 @@ TEST(timerangeTest, greater_and_lower) {
flttMakeLogicNode
(
&
logicNode
,
LOGIC_COND_TYPE_AND
,
list
,
2
);
//SFilterInfo *filter = NULL;
//int32_t code = filterInitFromNode(logicNode, &filter, FLT_OPTION_NO_REWRITE|FLT_OPTION_TIMESTAMP);
//ASSERT_EQ(code, 0);
STimeWindow
win
=
{
0
};
bool
isStrict
=
false
;
int32_t
code
=
filterGetTimeRange
(
logicNode
,
&
win
,
&
isStrict
);
ASSERT_EQ
(
isStrict
,
true
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
win
.
skey
,
tsmall
+
1
);
ASSERT_EQ
(
win
.
ekey
,
tbig
-
1
);
//filterFreeInfo(filter);
nodesDestroyNode
(
logicNode
);
}
TEST
(
timerangeTest
,
greater_equal_and_lower_equal
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{
0
};
int64_t
tsmall
=
222
,
tbig
=
333
;
flttMakeColumnNode
(
&
pcol
,
NULL
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
0
,
NULL
);
flttMakeValueNode
(
&
pval
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
tsmall
);
flttMakeOpNode
(
&
opNode1
,
OP_TYPE_GREATER_EQUAL
,
TSDB_DATA_TYPE_BOOL
,
pcol
,
pval
);
flttMakeColumnNode
(
&
pcol
,
NULL
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
0
,
NULL
);
flttMakeValueNode
(
&
pval
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
tbig
);
flttMakeOpNode
(
&
opNode2
,
OP_TYPE_LOWER_EQUAL
,
TSDB_DATA_TYPE_BOOL
,
pcol
,
pval
);
SNode
*
list
[
2
]
=
{
0
};
list
[
0
]
=
opNode1
;
list
[
1
]
=
opNode2
;
flttMakeLogicNode
(
&
logicNode
,
LOGIC_COND_TYPE_AND
,
list
,
2
);
//SFilterInfo *filter = NULL;
//int32_t code = filterInitFromNode(logicNode, &filter, FLT_OPTION_NO_REWRITE|FLT_OPTION_TIMESTAMP);
//ASSERT_EQ(code, 0);
...
...
@@ -279,6 +310,7 @@ TEST(timerangeTest, greater_and_lower) {
nodesDestroyNode
(
logicNode
);
}
TEST
(
timerangeTest
,
greater_and_lower_not_strict
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode1
=
NULL
,
*
logicNode2
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
...
...
@@ -321,8 +353,8 @@ TEST(timerangeTest, greater_and_lower_not_strict) {
int32_t
code
=
filterGetTimeRange
(
logicNode1
,
&
win
,
&
isStrict
);
ASSERT_EQ
(
isStrict
,
false
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
win
.
skey
,
tsmall1
);
ASSERT_EQ
(
win
.
ekey
,
tbig2
);
ASSERT_EQ
(
win
.
skey
,
tsmall1
+
1
);
ASSERT_EQ
(
win
.
ekey
,
tbig2
-
1
);
//filterFreeInfo(filter);
nodesDestroyNode
(
logicNode1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录