Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
10cfc735
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
10cfc735
编写于
5月 27, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2570]<feature> fix bug
上级
bcf7be50
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
9 deletion
+23
-9
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-7
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+8
-2
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
10cfc735
...
...
@@ -127,6 +127,7 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i
*/
bool
tscIsPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTWAQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsSessionWindowQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsSecondStageQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscGroupbyColumn
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTopBotQuery
(
SQueryInfo
*
pQueryInfo
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
10cfc735
...
...
@@ -832,8 +832,8 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
static
int32_t
validateStateWindowNode
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
,
bool
isStable
)
{
const
char
*
msg1
=
"invalid column name"
;
const
char
*
msg3
=
"not support state
window on super table/tag column
"
;
const
char
*
msg4
=
"
not support state_window with group by
"
;
const
char
*
msg3
=
"not support state
_window with group by
"
;
const
char
*
msg4
=
"
function not support for super table query
"
;
SStrToken
*
col
=
&
(
pSqlNode
->
windowstateVal
.
col
)
;
if
(
col
->
z
==
NULL
||
col
->
n
<=
0
)
{
...
...
@@ -844,13 +844,13 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
pQueryInfo
->
colList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
}
if
(
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
>
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
4
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
3
);
}
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
=
1
;
//TODO(dengyihao): check tag column
if
(
isStable
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
3
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
4
);
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
...
...
@@ -2938,6 +2938,9 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
return
true
;
}
}
}
else
if
(
tscIsSessionWindowQuery
(
pQueryInfo
))
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
true
;
}
return
false
;
...
...
@@ -7373,6 +7376,10 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, int32_t index) {
* transfer sql functions that need secondary merge into another format
* in dealing with super table queries such as: count/first/last
*/
if
(
validateSessionNode
(
pCmd
,
pQueryInfo
,
pSqlNode
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
if
(
isSTable
)
{
tscTansformFuncForSTableQuery
(
pQueryInfo
);
...
...
@@ -7381,9 +7388,6 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, int32_t index) {
}
}
if
(
validateSessionNode
(
pCmd
,
pQueryInfo
,
pSqlNode
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
// no result due to invalid query time range
if
(
pQueryInfo
->
window
.
skey
>
pQueryInfo
->
window
.
ekey
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
10cfc735
...
...
@@ -356,6 +356,9 @@ bool tscIsTWAQuery(SQueryInfo* pQueryInfo) {
return
false
;
}
bool
tscIsSessionWindowQuery
(
SQueryInfo
*
pQueryInfo
)
{
return
pQueryInfo
->
sessionWindow
.
gap
>
0
;
}
bool
tscNeedReverseScan
(
SQueryInfo
*
pQueryInfo
)
{
size_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
...
...
src/query/src/qExecutor.c
浏览文件 @
10cfc735
...
...
@@ -1333,7 +1333,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
pInfo
->
start
=
j
;
}
else
if
(
tsList
[
j
]
-
pInfo
->
prevTs
<=
gap
)
{
pInfo
->
curWindow
.
ekey
=
tsList
[
j
];
pInfo
->
prevTs
=
tsList
[
j
];
//
pInfo->prevTs = tsList[j];
pInfo
->
numOfRows
+=
1
;
if
(
j
==
0
&&
pInfo
->
start
!=
0
)
{
pInfo
->
numOfRows
=
1
;
...
...
@@ -1342,6 +1342,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
}
else
{
// start a new session window
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
);
...
...
@@ -1362,6 +1363,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
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
);
...
...
@@ -2063,6 +2065,8 @@ static bool onlyFirstQuery(SQueryAttr *pQueryAttr) { return onlyOneQueryType(pQu
static
bool
onlyLastQuery
(
SQueryAttr
*
pQueryAttr
)
{
return
onlyOneQueryType
(
pQueryAttr
,
TSDB_FUNC_LAST
,
TSDB_FUNC_LAST_DST
);
}
static
bool
notContainSessionOrStateWindow
(
SQueryAttr
*
pQueryAttr
)
{
return
!
(
pQueryAttr
->
sw
.
gap
>
0
||
pQueryAttr
->
stateWindow
);
}
static
int32_t
updateBlockLoadStatus
(
SQueryAttr
*
pQuery
,
int32_t
status
)
{
bool
hasFirstLastFunc
=
false
;
bool
hasOtherFunc
=
false
;
...
...
@@ -2166,7 +2170,7 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bo
}
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
}
else
if
(
onlyLastQuery
(
pQueryAttr
))
{
}
else
if
(
onlyLastQuery
(
pQueryAttr
)
&&
notContainSessionOrStateWindow
(
pQueryAttr
)
)
{
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
qDebug
(
msg
,
pQInfo
,
"only-last"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_DESC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
...
...
@@ -5194,6 +5198,7 @@ static SSDataBlock* doSessionWindowAgg(void* param, bool* newgroup) {
SSWindowOperatorInfo
*
pWindowInfo
=
pOperator
->
info
;
SOptrBasicInfo
*
pBInfo
=
&
pWindowInfo
->
binfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
pOperator
->
pRuntimeEnv
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
toSSDataBlock
(
&
pRuntimeEnv
->
groupResInfo
,
pRuntimeEnv
,
pBInfo
->
pRes
);
...
...
@@ -5206,6 +5211,7 @@ static SSDataBlock* doSessionWindowAgg(void* param, bool* newgroup) {
}
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
//pQueryAttr->order.order = TSDB_ORDER_ASC;
int32_t
order
=
pQueryAttr
->
order
.
order
;
STimeWindow
win
=
pQueryAttr
->
window
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录