Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
3358f33f
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看板
提交
3358f33f
编写于
6月 17, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-4753]
上级
ed59bedf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
4 deletion
+27
-4
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+2
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+6
-4
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+16
-0
tests/script/general/parser/function.sim
tests/script/general/parser/function.sim
+3
-0
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
3358f33f
...
...
@@ -123,6 +123,8 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i
*/
bool
tscIsPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsTWAQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsIrateQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsSessionWindowQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsSecondStageQuery
(
SQueryInfo
*
pQueryInfo
);
bool
tsIsArithmeticQueryOnAggResult
(
SQueryInfo
*
pQueryInfo
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
3358f33f
...
...
@@ -2022,8 +2022,10 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
SSchema
colSchema
=
*
tGetTbnameColumnSchema
();
getColumnName
(
pItem
,
colSchema
.
name
,
colSchema
.
name
,
sizeof
(
colSchema
.
name
)
-
1
);
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
getColumnName
(
pItem
,
name
,
colSchema
.
name
,
sizeof
(
colSchema
.
name
)
-
1
);
tstrncpy
(
colSchema
.
name
,
name
,
TSDB_COL_NAME_LEN
);
/*SExprInfo* pExpr = */
tscAddFuncInSelectClause
(
pQueryInfo
,
startPos
,
TSDB_FUNC_TAGPRJ
,
&
index
,
&
colSchema
,
TSDB_COL_TAG
,
getNewResColId
(
pCmd
));
}
else
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
...
...
@@ -3062,8 +3064,8 @@ void tscRestoreFuncForSTableQuery(SQueryInfo* pQueryInfo) {
}
bool
hasUnsupportFunctionsForSTableQuery
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
)
{
const
char
*
msg1
=
"TWA/Diff not allowed to apply to super table directly"
;
const
char
*
msg2
=
"TWA/Diff only support group by tbname for super table query"
;
const
char
*
msg1
=
"TWA/Diff
/Derivative/Irate
not allowed to apply to super table directly"
;
const
char
*
msg2
=
"TWA/Diff
/Derivative/Irate
only support group by tbname for super table query"
;
const
char
*
msg3
=
"function not support for super table query"
;
// filter sql function not supported by metric query yet.
...
...
@@ -3076,7 +3078,7 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
}
}
if
(
tscIsTWAQuery
(
pQueryInfo
)
||
tscIsDiffDerivQuery
(
pQueryInfo
))
{
if
(
tscIsTWAQuery
(
pQueryInfo
)
||
tscIsDiffDerivQuery
(
pQueryInfo
)
||
tscIsIrateQuery
(
pQueryInfo
)
)
{
if
(
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
==
0
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
true
;
...
...
src/client/src/tscUtil.c
浏览文件 @
3358f33f
...
...
@@ -460,6 +460,22 @@ bool tscIsTWAQuery(SQueryInfo* pQueryInfo) {
return
false
;
}
bool
tscIsIrateQuery
(
SQueryInfo
*
pQueryInfo
)
{
size_t
numOfExprs
=
tscNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
i
);
if
(
pExpr
==
NULL
)
{
continue
;
}
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_IRATE
)
{
return
true
;
}
}
return
false
;
}
bool
tscIsSessionWindowQuery
(
SQueryInfo
*
pQueryInfo
)
{
return
pQueryInfo
->
sessionWindow
.
gap
>
0
;
}
...
...
tests/script/general/parser/function.sim
浏览文件 @
3358f33f
...
...
@@ -817,6 +817,9 @@ print ====================> TODO stddev + normal column filter
print ====================> irate
sql_error select irate(f1) from st1;
sql select irate(f1) from st1 group by tbname;
sql select irate(k) from t1
if $rows != 1 then
return -1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录