Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
413e0930
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看板
提交
413e0930
编写于
5月 29, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3178]<feature> fix some bug
上级
24751e99
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
7 deletion
+31
-7
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+24
-6
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
413e0930
...
...
@@ -916,6 +916,9 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS
if
(
pQueryInfo
->
sessionWindow
.
gap
!=
0
&&
pQueryInfo
->
interval
.
interval
!=
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
if
(
pQueryInfo
->
sessionWindow
.
gap
==
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
col
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -6196,7 +6199,7 @@ static int32_t doTagFunctionCheck(SQueryInfo* pQueryInfo) {
int32_t
doFunctionsCompatibleCheck
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
)
{
const
char
*
msg1
=
"functions/columns not allowed in group by query"
;
const
char
*
msg2
=
"projection query on columns not allowed"
;
const
char
*
msg3
=
"group by not allowed on projection query"
;
const
char
*
msg3
=
"group by
/session/state_window
not allowed on projection query"
;
const
char
*
msg4
=
"retrieve tags not compatible with group by or interval query"
;
const
char
*
msg5
=
"functions can not be mixed up"
;
...
...
@@ -6212,6 +6215,9 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
return
TSDB_CODE_SUCCESS
;
}
}
if
(
tscIsProjectionQuery
(
pQueryInfo
)
&&
pQueryInfo
->
sessionWindow
.
gap
>
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
>
0
)
{
// check if all the tags prj columns belongs to the group by columns
...
...
src/query/src/qExecutor.c
浏览文件 @
413e0930
...
...
@@ -185,8 +185,12 @@ static void destroySFillOperatorInfo(void* param, int32_t numOfOutput);
static
void
destroyGroupbyOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyArithOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroySWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyStateWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
static
int32_t
doCopyToSDataBlock
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
int32_t
orderType
,
SSDataBlock
*
pBlock
);
static
int32_t
getGroupbyColumnIndex
(
SSqlGroupbyExpr
*
pGroupbyExpr
,
SSDataBlock
*
pDataBlock
);
...
...
@@ -4541,7 +4545,6 @@ static void destroyGlobalAggOperatorInfo(void* param, int32_t numOfOutput) {
tfree
(
pInfo
->
prevRow
);
tfree
(
pInfo
->
currentGroupColData
);
}
static
void
destroySlimitOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SSLimitOperatorInfo
*
pInfo
=
(
SSLimitOperatorInfo
*
)
param
;
taosArrayDestroy
(
pInfo
->
orderColumnList
);
...
...
@@ -5099,13 +5102,14 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
}
else
if
(
memcmp
(
pInfo
->
prevData
,
val
,
bytes
)
==
0
)
{
pInfo
->
curWindow
.
ekey
=
tsList
[
j
];
pInfo
->
numOfRows
+=
1
;
pInfo
->
start
=
j
;
//
pInfo->start = j;
if
(
j
==
0
&&
pInfo
->
start
!=
0
)
{
pInfo
->
numOfRows
=
1
;
pInfo
->
start
=
0
;
}
}
else
{
SResultRow
*
pResult
=
NULL
;
pInfo
->
curWindow
.
ekey
=
pInfo
->
curWindow
.
skey
;
int32_t
ret
=
setWindowOutputBufByKey
(
pRuntimeEnv
,
&
pBInfo
->
resultRowInfo
,
&
pInfo
->
curWindow
,
masterScan
,
&
pResult
,
item
->
groupIndex
,
pBInfo
->
pCtx
,
pOperator
->
numOfOutput
,
pBInfo
->
rowCellInfoOffset
);
...
...
@@ -5125,6 +5129,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
}
SResultRow
*
pResult
=
NULL
;
pInfo
->
curWindow
.
ekey
=
pInfo
->
curWindow
.
skey
;
int32_t
ret
=
setWindowOutputBufByKey
(
pRuntimeEnv
,
&
pBInfo
->
resultRowInfo
,
&
pInfo
->
curWindow
,
masterScan
,
&
pResult
,
item
->
groupIndex
,
pBInfo
->
pCtx
,
pOperator
->
numOfOutput
,
pBInfo
->
rowCellInfoOffset
);
...
...
@@ -5442,7 +5447,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
exec
=
doAggregate
;
pOperator
->
cleanup
=
destroy
Basic
OperatorInfo
;
pOperator
->
cleanup
=
destroy
Agg
OperatorInfo
;
return
pOperator
;
}
...
...
@@ -5460,6 +5465,19 @@ static void destroyBasicOperatorInfo(void* param, int32_t numOfOutput) {
SOptrBasicInfo
*
pInfo
=
(
SOptrBasicInfo
*
)
param
;
doDestroyBasicInfo
(
pInfo
,
numOfOutput
);
}
static
void
destroyStateWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SStateWindowOperatorInfo
*
pInfo
=
(
SStateWindowOperatorInfo
*
)
param
;
doDestroyBasicInfo
(
&
pInfo
->
binfo
,
numOfOutput
);
tfree
(
pInfo
->
prevData
);
}
static
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SAggOperatorInfo
*
pInfo
=
(
SAggOperatorInfo
*
)
param
;
doDestroyBasicInfo
(
&
pInfo
->
binfo
,
numOfOutput
);
}
static
void
destroySWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SSWindowOperatorInfo
*
pInfo
=
(
SSWindowOperatorInfo
*
)
param
;
doDestroyBasicInfo
(
&
pInfo
->
binfo
,
numOfOutput
);
}
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SFillOperatorInfo
*
pInfo
=
(
SFillOperatorInfo
*
)
param
;
...
...
@@ -5515,7 +5533,7 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SO
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
exec
=
doSTableAggregate
;
pOperator
->
cleanup
=
destroy
Basic
OperatorInfo
;
pOperator
->
cleanup
=
destroy
Agg
OperatorInfo
;
return
pOperator
;
}
...
...
@@ -5659,7 +5677,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpe
pOperator
->
info
=
pInfo
;
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
exec
=
doStateWindowAgg
;
pOperator
->
cleanup
=
destroy
Basic
OperatorInfo
;
pOperator
->
cleanup
=
destroy
StateWindow
OperatorInfo
;
return
pOperator
;
}
...
...
@@ -5683,7 +5701,7 @@ SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
pOperator
->
info
=
pInfo
;
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
exec
=
doSessionWindowAgg
;
pOperator
->
cleanup
=
destroy
Basic
OperatorInfo
;
pOperator
->
cleanup
=
destroy
SWindow
OperatorInfo
;
return
pOperator
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录