Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bf124afb
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看板
未验证
提交
bf124afb
编写于
3月 25, 2022
作者:
H
Haojun Liao
提交者:
GitHub
3月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10990 from taosdata/feature/3.0_liaohj
[td-13039]add api for stream computing.
上级
4c19e2f2
b5d01190
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
41 deletion
+26
-41
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-0
source/dnode/mnode/impl/CMakeLists.txt
source/dnode/mnode/impl/CMakeLists.txt
+1
-1
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+7
-26
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+1
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+14
-11
未找到文件。
include/libs/parser/parser.h
浏览文件 @
bf124afb
...
...
@@ -60,6 +60,8 @@ int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery);
void
qDestroyQuery
(
SQuery
*
pQueryNode
);
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mnode/impl/CMakeLists.txt
浏览文件 @
bf124afb
...
...
@@ -6,7 +6,7 @@ target_include_directories(
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
mnode scheduler sdb wal transport cjson sync monitor
mnode scheduler sdb wal transport cjson sync monitor
parser
)
if
(
${
BUILD_TEST
}
)
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
bf124afb
...
...
@@ -14,6 +14,7 @@
*/
#include "mndStream.h"
#include "parser.h"
#include "mndAuth.h"
#include "mndDb.h"
#include "mndDnode.h"
...
...
@@ -218,28 +219,6 @@ static int32_t mndCheckCreateStreamReq(SCMCreateStreamReq *pCreate) {
return
0
;
}
static
SArray
*
mndExtractNamesFromAst
(
const
SNode
*
pAst
)
{
if
(
pAst
->
type
!=
QUERY_NODE_SELECT_STMT
)
return
NULL
;
SArray
*
names
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
if
(
names
==
NULL
)
{
return
NULL
;
}
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pAst
;
SNodeList
*
pNodes
=
pSelect
->
pProjectionList
;
SListCell
*
pCell
=
pNodes
->
pHead
;
while
(
pCell
!=
NULL
)
{
if
(
pCell
->
pNode
->
type
!=
QUERY_NODE_FUNCTION
)
{
continue
;
}
SFunctionNode
*
pFunction
=
(
SFunctionNode
*
)
pCell
->
pNode
;
char
*
name
=
strdup
(
pFunction
->
node
.
aliasName
);
taosArrayPush
(
names
,
&
name
);
pCell
=
pCell
->
pNext
;
}
return
names
;
}
static
int32_t
mndStreamGetPlanString
(
const
char
*
ast
,
char
**
pStr
)
{
if
(
NULL
==
ast
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -276,14 +255,16 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
return
-
1
;
}
#if 1
SArray
*
names
=
mndExtractNamesFromAst
(
pAst
);
SSchemaWrapper
sw
=
{
0
};
qExtractResultSchema
(
pAst
,
(
int32_t
*
)
&
sw
.
nCols
,
&
sw
.
pSchema
);
printf
(
"|"
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
names
)
;
i
++
)
{
printf
(
" %15s |"
,
(
char
*
)
taosArrayGetP
(
names
,
i
)
);
for
(
int
i
=
0
;
i
<
sw
.
nCols
;
i
++
)
{
printf
(
" %15s |"
,
(
char
*
)
sw
.
pSchema
[
i
].
name
);
}
printf
(
"
\n
=======================================================
\n
"
);
pStream
->
ColAlias
=
names
;
pStream
->
ColAlias
=
NULL
;
#endif
if
(
TSDB_CODE_SUCCESS
!=
mndStreamGetPlanString
(
ast
,
&
pStream
->
physicalPlan
))
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
bf124afb
...
...
@@ -2208,7 +2208,7 @@ static SqlFunctionCtx* createSqlFunctionCtx_rv(SExprInfo* pExprInfo, int32_t num
}
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
(
*
rowCellInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowCellInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowEntryInfo
)
+
pFuncCtx
[
i
].
resDataInfo
.
interBufSize
);
(
*
rowCellInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowCellInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowEntryInfo
)
+
pFuncCtx
[
i
-
1
].
resDataInfo
.
interBufSize
);
}
setCtxTagColumnInfo
(
pFuncCtx
,
numOfOutput
);
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
bf124afb
...
...
@@ -528,11 +528,10 @@ void firstFunction(SqlFunctionCtx *pCtx) {
char
*
buf
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SColumnInfoData
*
pInputCol
=
pInput
->
pData
[
0
];
// All null data column, return directly.
if
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
{
if
(
pInput
->
colDataAggIsSet
&&
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
)
{
ASSERT
(
pInputCol
->
hasNull
==
true
);
return
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
bf124afb
...
...
@@ -1771,24 +1771,27 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
return
code
;
}
static
int32_t
setReslutSchema
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
p
Query
->
p
Root
))
{
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pQuery
->
pRoot
;
pQuery
->
numOfRes
Cols
=
LIST_LENGTH
(
pSelect
->
pProjectionList
);
pQuery
->
pResSchema
=
calloc
(
pQuery
->
numOfResCols
,
sizeof
(
SSchema
));
if
(
NULL
==
pQuery
->
pResSchema
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_OUT_OF_MEMORY
)
;
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pRoot
))
{
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pRoot
;
*
numOf
Cols
=
LIST_LENGTH
(
pSelect
->
pProjectionList
);
*
pSchema
=
calloc
((
*
numOfCols
)
,
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
)
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SNode
*
pNode
;
int32_t
index
=
0
;
FOREACH
(
pNode
,
pSelect
->
pProjectionList
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
pQuery
->
pResSchema
[
index
].
type
=
pExpr
->
resType
.
type
;
pQuery
->
pResSchema
[
index
].
bytes
=
pExpr
->
resType
.
bytes
;
strcpy
(
pQuery
->
pResSchema
[
index
].
name
,
pExpr
->
aliasName
);
(
*
pSchema
)[
index
].
type
=
pExpr
->
resType
.
type
;
(
*
pSchema
)[
index
].
bytes
=
pExpr
->
resType
.
bytes
;
(
*
pSchema
)[
index
].
colId
=
index
+
1
;
strcpy
((
*
pSchema
)[
index
].
name
,
pExpr
->
aliasName
);
index
+=
1
;
}
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2372,7 +2375,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
pQuery
->
haveResultSet
=
true
;
pQuery
->
directRpc
=
false
;
pQuery
->
msgType
=
TDMT_VND_QUERY
;
code
=
setReslutSchema
(
pCxt
,
pQuery
);
code
=
qExtractResultSchema
(
pQuery
->
pRoot
,
&
pQuery
->
numOfResCols
,
&
pQuery
->
pResSchema
);
break
;
case
QUERY_NODE_VNODE_MODIF_STMT
:
pQuery
->
haveResultSet
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录