Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93baf85a
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看板
提交
93baf85a
编写于
2月 22, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
8f7b375b
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1102 addition
and
35 deletion
+1102
-35
include/common/ttypes.h
include/common/ttypes.h
+2
-0
include/libs/function/function.h
include/libs/function/function.h
+1
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+6
-0
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+27
-22
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+332
-8
source/libs/scalar/test/scalarTests.cpp
source/libs/scalar/test/scalarTests.cpp
+730
-4
未找到文件。
include/common/ttypes.h
浏览文件 @
93baf85a
...
...
@@ -91,6 +91,8 @@ typedef struct {
do { \
switch (_type) { \
case TSDB_DATA_TYPE_BOOL: \
*(bool *)(_v) = (bool)(_data); \
break; \
case TSDB_DATA_TYPE_TINYINT: \
*(int8_t *)(_v) = (int8_t)(_data); \
break; \
...
...
include/libs/function/function.h
浏览文件 @
93baf85a
...
...
@@ -228,6 +228,7 @@ typedef struct SAggFunctionInfo {
typedef
struct
SScalarParam
{
void
*
data
;
bool
colData
;
int32_t
num
;
int32_t
type
;
int32_t
bytes
;
...
...
include/libs/nodes/querynodes.h
浏览文件 @
93baf85a
...
...
@@ -141,6 +141,7 @@ typedef struct SLogicConditionNode {
typedef
struct
SNodeListNode
{
ENodeType
type
;
// QUERY_NODE_NODE_LIST
SDataType
dataType
;
SNodeList
*
pNodeList
;
}
SNodeListNode
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
93baf85a
...
...
@@ -546,7 +546,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
if
(
tbMeta
->
tableType
!=
TSDB_CHILD_TABLE
)
{
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got
tbl
from cache, type:%d, dbFName:%s, tbName:%s"
,
tbMeta
->
tableType
,
dbFName
,
pTableName
->
tname
);
ctgDebug
(
"Got
meta
from cache, type:%d, dbFName:%s, tbName:%s"
,
tbMeta
->
tableType
,
dbFName
,
pTableName
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
93baf85a
...
...
@@ -63,6 +63,8 @@ SNode* nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SNodeListNode
));
case
QUERY_NODE_FILL
:
return
makeNode
(
type
,
sizeof
(
SFillNode
));
case
QUERY_NODE_COLUMN_REF
:
return
makeNode
(
type
,
sizeof
(
SColumnRefNode
));
case
QUERY_NODE_RAW_EXPR
:
return
makeNode
(
type
,
sizeof
(
SRawExprNode
));
case
QUERY_NODE_SET_OPERATOR
:
...
...
source/libs/scalar/src/filter.c
浏览文件 @
93baf85a
...
...
@@ -1820,6 +1820,9 @@ bool filterDoCompare(__compar_fn_t func, uint8_t optr, void *left, void *right)
case
TSDB_RELATION_LIKE
:
{
return
ret
==
0
;
}
case
TSDB_RELATION_NOT_LIKE
:
{
return
ret
==
0
;
}
case
TSDB_RELATION_MATCH
:
{
return
ret
==
0
;
}
...
...
@@ -1829,6 +1832,9 @@ bool filterDoCompare(__compar_fn_t func, uint8_t optr, void *left, void *right)
case
TSDB_RELATION_IN
:
{
return
ret
==
1
;
}
case
TSDB_RELATION_NOT_IN
:
{
return
ret
==
1
;
}
default:
assert
(
false
);
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
93baf85a
...
...
@@ -50,20 +50,28 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
if
(
IS_VAR_DATA_TYPE
(
type
))
{
len
=
varDataLen
(
out
.
data
);
buf
=
varDataVal
(
out
.
data
);
}
else
{
len
=
tDataTypes
[
type
].
bytes
;
buf
=
out
.
data
;
}
buf
=
out
.
data
;
}
else
{
buf
=
nodesGetValueFromNode
(
valueNode
);
len
=
valueNode
->
node
.
resType
.
bytes
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
len
=
varDataLen
(
buf
);
buf
=
varDataVal
(
buf
);
}
else
{
len
=
valueNode
->
node
.
resType
.
bytes
;
buf
=
out
.
data
;
}
}
if
(
taosHashPut
(
pObj
,
buf
,
(
size_t
)
len
,
&
dummy
,
sizeof
(
dummy
)))
{
sclError
(
"taosHashPut failed"
);
SCL_ERR_JRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
cell
=
cell
->
pNext
;
}
tfree
(
out
.
data
);
...
...
@@ -108,6 +116,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
param
->
num
=
1
;
param
->
type
=
valueNode
->
node
.
resType
.
type
;
param
->
bytes
=
valueNode
->
node
.
resType
.
bytes
;
param
->
colData
=
false
;
break
;
}
...
...
@@ -121,6 +130,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
SCL_ERR_RET
(
scalarGenerateSetFromList
(
&
param
->
data
,
node
,
nodeList
->
dataType
.
type
));
param
->
num
=
1
;
param
->
type
=
SCL_DATA_TYPE_DUMMY_HASH
;
param
->
colData
=
false
;
break
;
}
...
...
@@ -137,7 +147,14 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
}
SColumnInfoData
*
columnData
=
(
SColumnInfoData
*
)
taosArrayGet
(
ctx
->
pSrc
->
pDataBlock
,
ref
->
slotId
);
param
->
data
=
columnData
->
pData
;
if
(
IS_VAR_DATA_TYPE
(
columnData
->
info
.
type
))
{
param
->
data
=
columnData
;
param
->
colData
=
true
;
}
else
{
param
->
data
=
columnData
->
pData
;
param
->
colData
=
false
;
}
param
->
num
=
ctx
->
pSrc
->
info
.
rows
;
param
->
type
=
columnData
->
info
.
type
;
param
->
bytes
=
columnData
->
info
.
bytes
;
...
...
@@ -366,6 +383,7 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp
output
->
type
=
node
->
node
.
resType
.
type
;
output
->
num
=
rowNum
;
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
);
...
...
@@ -377,21 +395,8 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp
int32_t
paramNum
=
scalarGetOperatorParamNum
(
node
->
opType
);
SScalarParam
*
pLeft
=
&
params
[
0
];
SScalarParam
*
pRight
=
paramNum
>
1
?
&
params
[
1
]
:
NULL
;
void
*
data
=
output
->
data
;
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
OperatorFn
(
pLeft
,
pRight
,
output
->
data
,
TSDB_ORDER_ASC
);
sclParamMoveNext
(
output
,
1
);
sclParamMoveNext
(
pLeft
,
1
);
if
(
pRight
)
{
sclParamMoveNext
(
pRight
,
1
);
}
}
output
->
data
=
data
;
OperatorFn
(
pLeft
,
pRight
,
output
->
data
,
TSDB_ORDER_ASC
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -506,7 +511,7 @@ EDealRes sclRewriteOperator(SNode** pNode, void* pContext) {
EDealRes
sclConstantsRewriter
(
SNode
**
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_VALUE
==
nodeType
(
*
pNode
))
{
if
(
QUERY_NODE_VALUE
==
nodeType
(
*
pNode
)
||
QUERY_NODE_NODE_LIST
==
nodeType
(
*
pNode
)
)
{
return
DEAL_RES_CONTINUE
;
}
...
...
@@ -588,10 +593,10 @@ EDealRes sclWalkOperator(SNode* pNode, void* pContext) {
EDealRes
sclCalcWalker
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_VALUE
==
nodeType
(
pNode
))
{
if
(
QUERY_NODE_VALUE
==
nodeType
(
pNode
)
||
QUERY_NODE_NODE_LIST
==
nodeType
(
pNode
)
||
QUERY_NODE_COLUMN_REF
==
nodeType
(
pNode
)
)
{
return
DEAL_RES_CONTINUE
;
}
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
))
{
return
sclWalkFunction
(
pNode
,
pContext
);
}
...
...
@@ -604,7 +609,7 @@ EDealRes sclCalcWalker(SNode* pNode, void* pContext) {
return
sclWalkOperator
(
pNode
,
pContext
);
}
sclError
(
"invalid node type for
calculating constants
, type:%d"
,
nodeType
(
pNode
));
sclError
(
"invalid node type for
scalar calculating
, type:%d"
,
nodeType
(
pNode
));
SScalarCtx
*
ctx
=
(
SScalarCtx
*
)
pContext
;
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
93baf85a
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalarTests.cpp
浏览文件 @
93baf85a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录