Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3fa1f535
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看板
未验证
提交
3fa1f535
编写于
10月 26, 2022
作者:
D
dapan1121
提交者:
GitHub
10月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17609 from taosdata/fix/interpStable
fix: remove interp stable limitation and add test case
上级
4b15cd5e
c0106e9a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
48 addition
and
28 deletion
+48
-28
source/libs/function/inc/functionMgtInt.h
source/libs/function/inc/functionMgtInt.h
+1
-2
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+0
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+0
-22
tests/system-test/2-query/interp.py
tests/system-test/2-query/interp.py
+46
-1
未找到文件。
source/libs/function/inc/functionMgtInt.h
浏览文件 @
3fa1f535
...
...
@@ -49,8 +49,7 @@ extern "C" {
#define FUNC_MGT_MULTI_ROWS_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20)
#define FUNC_MGT_KEEP_ORDER_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21)
#define FUNC_MGT_CUMULATIVE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(22)
#define FUNC_MGT_FORBID_STABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23)
#define FUNC_MGT_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(24)
#define FUNC_MGT_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
...
...
source/libs/function/src/builtins.c
浏览文件 @
3fa1f535
...
...
@@ -2381,7 +2381,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"interp"
,
.
type
=
FUNCTION_TYPE_INTERP
,
.
classification
=
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_STABLE_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateInterp
,
.
getEnvFunc
=
getSelectivityFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
3fa1f535
...
...
@@ -216,8 +216,6 @@ bool fmIsKeepOrderFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, F
bool
fmIsCumulativeFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_CUMULATIVE_FUNC
);
}
bool
fmIsForbidSuperTableFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_STABLE_FUNC
);
}
bool
fmIsInterpFunc
(
int32_t
funcId
)
{
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
return
false
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
3fa1f535
...
...
@@ -1537,25 +1537,6 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateForbidSuperTableFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsForbidSuperTableFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isSelectStmt
(
pCxt
->
pCurrStmt
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE
,
"%s is only supported in single table query"
,
pFunc
->
functionName
);
}
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCxt
->
pCurrStmt
;
SNode
*
pTable
=
pSelect
->
pFromTable
;
if
((
NULL
!=
pTable
&&
(
QUERY_NODE_REAL_TABLE
!=
nodeType
(
pTable
)
||
(
TSDB_CHILD_TABLE
!=
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
&&
TSDB_NORMAL_TABLE
!=
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
))))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE
,
"%s is only supported in single table query"
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
static
bool
isStar
(
SNode
*
pNode
)
{
return
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
&&
(
'\0'
==
((
SColumnNode
*
)
pNode
)
->
tableAlias
[
0
])
&&
(
0
==
strcmp
(((
SColumnNode
*
)
pNode
)
->
colName
,
"*"
));
...
...
@@ -1717,9 +1698,6 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) {
static
int32_t
translateNoramlFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
int32_t
code
=
translateAggFunc
(
pCxt
,
pFunc
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidSuperTableFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateScanPseudoColumnFunc
(
pCxt
,
pFunc
);
}
...
...
tests/system-test/2-query/interp.py
浏览文件 @
3fa1f535
...
...
@@ -11,11 +11,15 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
#tdSql.init(conn.cursor())
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
# output sql.txt file
def
run
(
self
):
dbname
=
"db"
tbname
=
"tb"
stbname
=
"stb"
ctbname1
=
"ctb1"
ctbname2
=
"ctb2"
tdSql
.
prepare
()
...
...
@@ -621,6 +625,32 @@ class TDTestCase:
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
tbname
}
values ('2020-02-01 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
tbname
}
values ('2020-02-11 00:00:05', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
'''create stable if not exists
{
dbname
}
.
{
stbname
}
(ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 double, c5 float, c6 bool, c7 varchar(10), c8 nchar(10)) tags(t1 int)
'''
)
tdSql
.
execute
(
f
'''create table if not exists
{
dbname
}
.
{
ctbname1
}
using
{
dbname
}
.
{
stbname
}
tags(1)
'''
)
tdSql
.
execute
(
f
'''create table if not exists
{
dbname
}
.
{
ctbname2
}
using
{
dbname
}
.
{
stbname
}
tags(1)
'''
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname1
}
values ('2020-02-01 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname1
}
values ('2020-02-01 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname1
}
values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname2
}
values ('2020-02-02 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname2
}
values ('2020-02-02 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
ctbname2
}
values ('2020-02-02 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"flush database
{
dbname
}
"
);
# test fill null
...
...
@@ -877,6 +907,21 @@ 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('中文字符') from
{
dbname
}
.
{
tbname
}
range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)"
)
tdLog
.
printNoPrefix
(
"==========step12:stable cases"
)
#tdSql.query(f"select interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
#tdSql.query(f"select interp(c0) from {dbname}.{ctbname1} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
#tdSql.query(f"select interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
#tdSql.query(f"select _irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
#tdSql.query(f"select tbname,_irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录