Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1b7ad36e
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看板
未验证
提交
1b7ad36e
编写于
4月 13, 2023
作者:
D
dapan1121
提交者:
GitHub
4月 13, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20915 from taosdata/fix/TD-23593
fix: fix illegal usage of _isfilled/_irowts
上级
717145bd
be3082c8
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
2 deletion
+32
-2
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+23
-1
tests/system-test/2-query/interp.py
tests/system-test/2-query/interp.py
+8
-0
未找到文件。
source/libs/function/src/builtins.c
浏览文件 @
1b7ad36e
...
@@ -3279,7 +3279,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -3279,7 +3279,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"_irowts"
,
.
name
=
"_irowts"
,
.
type
=
FUNCTION_TYPE_IROWTS
,
.
type
=
FUNCTION_TYPE_IROWTS
,
.
classification
=
FUNC_MGT_PSEUDO_COLUMN_FUNC
|
FUNC_MGT_INTERP_PC_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
classification
=
FUNC_MGT_PSEUDO_COLUMN_FUNC
|
FUNC_MGT_INTERP_PC_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
translateFunc
=
translateTimePseudoColumn
,
.
translateFunc
=
translateTimePseudoColumn
,
.
getEnvFunc
=
getTimePseudoFuncEnv
,
.
getEnvFunc
=
getTimePseudoFuncEnv
,
.
initFunc
=
NULL
,
.
initFunc
=
NULL
,
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
1b7ad36e
...
@@ -688,6 +688,10 @@ static bool isWindowPseudoColumnFunc(const SNode* pNode) {
...
@@ -688,6 +688,10 @@ static bool isWindowPseudoColumnFunc(const SNode* pNode) {
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsWindowPseudoColumnFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsWindowPseudoColumnFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
}
}
static
bool
isInterpPseudoColumnFunc
(
const
SNode
*
pNode
)
{
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsInterpPseudoColumnFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
}
static
bool
isTimelineFunc
(
const
SNode
*
pNode
)
{
static
bool
isTimelineFunc
(
const
SNode
*
pNode
)
{
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsTimelineFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsTimelineFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
}
}
...
@@ -1295,7 +1299,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
...
@@ -1295,7 +1299,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
}
}
static
EDealRes
haveVectorFunction
(
SNode
*
pNode
,
void
*
pContext
)
{
static
EDealRes
haveVectorFunction
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
isAggFunc
(
pNode
)
||
isIndefiniteRowsFunc
(
pNode
)
||
isWindowPseudoColumnFunc
(
pNode
))
{
if
(
isAggFunc
(
pNode
)
||
isIndefiniteRowsFunc
(
pNode
)
||
isWindowPseudoColumnFunc
(
pNode
)
||
isInterpPseudoColumnFunc
(
pNode
)
)
{
*
((
bool
*
)
pContext
)
=
true
;
*
((
bool
*
)
pContext
)
=
true
;
return
DEAL_RES_END
;
return
DEAL_RES_END
;
}
}
...
@@ -1522,6 +1526,21 @@ static int32_t translateInterpFunc(STranslateContext* pCxt, SFunctionNode* pFunc
...
@@ -1522,6 +1526,21 @@ static int32_t translateInterpFunc(STranslateContext* pCxt, SFunctionNode* pFunc
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateInterpPseudoColumnFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsInterpPseudoColumnFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isSelectStmt
(
pCxt
->
pCurrStmt
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
"%s must be used in select statements"
,
pFunc
->
functionName
);
}
if
(
pCxt
->
currClause
==
SQL_CLAUSE_WHERE
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_INTERP_CLAUSE
,
"%s is not allowed in where clause"
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateTimelineFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
static
int32_t
translateTimelineFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsTimelineFunc
(
pFunc
->
funcId
))
{
if
(
!
fmIsTimelineFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1819,6 +1838,9 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* p
...
@@ -1819,6 +1838,9 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* p
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateInterpFunc
(
pCxt
,
pFunc
);
code
=
translateInterpFunc
(
pCxt
,
pFunc
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateInterpPseudoColumnFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateTimelineFunc
(
pCxt
,
pFunc
);
code
=
translateTimelineFunc
(
pCxt
,
pFunc
);
}
}
...
...
tests/system-test/2-query/interp.py
浏览文件 @
1b7ad36e
...
@@ -2382,6 +2382,14 @@ class TDTestCase:
...
@@ -2382,6 +2382,14 @@ class TDTestCase:
tdSql
.
error
(
f
"select interp('abcd') from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp('abcd') from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp('中文字符') from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp('中文字符') from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
# invalid pseudo column usage
tdSql
.
error
(
f
"select interp(_irowts) from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp(_isfilled) from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
where _isfilled = true range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdSql
.
error
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
where _irowts > 0 range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdLog
.
printNoPrefix
(
"==========step13:stable cases"
)
tdLog
.
printNoPrefix
(
"==========step13:stable cases"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录