Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
25e7ff1e
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看板
未验证
提交
25e7ff1e
编写于
3月 12, 2021
作者:
H
haojun Liao
提交者:
GitHub
3月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5409 from taosdata/hotfix/TD-3231
[TD-3231]last_row should not work with group by column
上级
26fe683f
88b0262e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
5 deletion
+25
-5
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+20
-3
tests/pytest/crash_gen/crash_gen_main.py
tests/pytest/crash_gen/crash_gen_main.py
+1
-1
tests/script/general/parser/lastrow_query.sim
tests/script/general/parser/lastrow_query.sim
+4
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
25e7ff1e
...
...
@@ -1540,7 +1540,7 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
int32_t
parseSelectClause
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
tSQLExprList
*
pSelection
,
bool
isSTable
,
bool
joinQuery
,
bool
intervalQuery
)
{
assert
(
pSelection
!=
NULL
&&
pCmd
!=
NULL
);
const
char
*
msg2
=
"functions can not be mixed up"
;
const
char
*
msg2
=
"functions
or others
can not be mixed up"
;
const
char
*
msg3
=
"not support query expression"
;
const
char
*
msg5
=
"invalid function name"
;
const
char
*
msg6
=
"only support distinct one tag"
;
...
...
@@ -2828,6 +2828,23 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
return
false
;
}
static
bool
groupbyTagsOrNull
(
SQueryInfo
*
pQueryInfo
)
{
if
(
pQueryInfo
->
groupbyExpr
.
columnInfo
==
NULL
||
taosArrayGetSize
(
pQueryInfo
->
groupbyExpr
.
columnInfo
)
==
0
)
{
return
true
;
}
size_t
s
=
taosArrayGetSize
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
for
(
int32_t
i
=
0
;
i
<
s
;
i
++
)
{
SColIndex
*
colIndex
=
taosArrayGet
(
pQueryInfo
->
groupbyExpr
.
columnInfo
,
i
);
if
(
colIndex
->
flag
!=
TSDB_COL_TAG
)
{
return
false
;
}
}
return
true
;
}
static
bool
functionCompatibleCheck
(
SQueryInfo
*
pQueryInfo
,
bool
joinQuery
,
bool
intervalQuery
)
{
int32_t
startIdx
=
0
;
...
...
@@ -2844,7 +2861,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
int32_t
factor
=
functionCompatList
[
tscSqlExprGet
(
pQueryInfo
,
startIdx
)
->
functionId
];
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
))
{
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
||
!
groupbyTagsOrNull
(
pQueryInfo
)
))
{
return
false
;
}
...
...
@@ -2872,7 +2889,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
}
}
if
(
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
))
{
if
(
functionId
==
TSDB_FUNC_LAST_ROW
&&
(
joinQuery
||
intervalQuery
||
!
groupbyTagsOrNull
(
pQueryInfo
)
))
{
return
false
;
}
}
...
...
tests/pytest/crash_gen/crash_gen_main.py
浏览文件 @
25e7ff1e
...
...
@@ -1785,7 +1785,7 @@ class TdSuperTable:
'top(speed, 50)'
,
# TODO: not supported?
'bottom(speed, 50)'
,
# TODO: not supported?
'apercentile(speed, 10)'
,
# TODO: TD-1316
'last_row(speed)'
,
# 'last_row(speed)', # TODO: commented out per TD-3231, we should re-create
# Transformation Functions
# 'diff(speed)', # TODO: no supported?!
'spread(speed)'
...
...
tests/script/general/parser/lastrow_query.sim
浏览文件 @
25e7ff1e
...
...
@@ -16,6 +16,9 @@ $stb = $stbPrefix . $i
sql use $db
print ========>TD-3231 last_row with group by column error
sql_error select last_row(c1) from $stb group by c1;
##### select lastrow from STable with two vnodes, timestamp decreases from tables in vnode0 to tables in vnode1
sql select last_row(*) from $stb
if $rows != 1 then
...
...
@@ -224,4 +227,4 @@ sql create table tu(ts timestamp, k int)
sql select last_row(*) from tu
if $row != 0 then
return -1
endi
\ No newline at end of file
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录