Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
575c4821
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看板
未验证
提交
575c4821
编写于
6月 15, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21721 from taosdata/fix/TD-24707
fix: forbid system table functions
上级
9e78a4c5
c520a104
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
129 addition
and
28 deletion
+129
-28
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/libs/function/inc/functionMgtInt.h
source/libs/function/inc/functionMgtInt.h
+1
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+41
-25
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+18
-1
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
source/util/src/terror.c
source/util/src/terror.c
+2
-1
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/system-test/2-query/systable_func.py
tests/system-test/2-query/systable_func.py
+60
-0
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
575c4821
...
...
@@ -216,7 +216,7 @@ bool fmIsUserDefinedFunc(int32_t funcId);
bool
fmIsDistExecFunc
(
int32_t
funcId
);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmIsForbidS
uper
TableFunc
(
int32_t
funcId
);
bool
fmIsForbidS
ys
TableFunc
(
int32_t
funcId
);
bool
fmIsIntervalInterpoFunc
(
int32_t
funcId
);
bool
fmIsInterpFunc
(
int32_t
funcId
);
bool
fmIsLastRowFunc
(
int32_t
funcId
);
...
...
include/util/taoserror.h
浏览文件 @
575c4821
...
...
@@ -704,6 +704,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_TAGS_PC TAOS_DEF_ERROR_CODE(0, 0x2665)
#define TSDB_CODE_PAR_INVALID_TIMELINE_QUERY TAOS_DEF_ERROR_CODE(0, 0x2666)
#define TSDB_CODE_PAR_INVALID_OPTR_USAGE TAOS_DEF_ERROR_CODE(0, 0x2667)
#define TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2668)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
...
...
source/libs/function/inc/functionMgtInt.h
浏览文件 @
575c4821
...
...
@@ -51,6 +51,7 @@ extern "C" {
#define FUNC_MGT_CUMULATIVE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(22)
#define FUNC_MGT_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23)
#define FUNC_MGT_GEOMETRY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(24)
#define FUNC_MGT_FORBID_SYSTABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(25)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
...
...
source/libs/function/src/builtins.c
浏览文件 @
575c4821
...
...
@@ -2348,7 +2348,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"leastsquares"
,
.
type
=
FUNCTION_TYPE_LEASTSQUARES
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateLeastSQR
,
.
getEnvFunc
=
getLeastSQRFuncEnv
,
.
initFunc
=
leastSQRFunctionSetup
,
...
...
@@ -2456,7 +2456,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"top"
,
.
type
=
FUNCTION_TYPE_TOP
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
...
...
@@ -2471,7 +2472,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"bottom"
,
.
type
=
FUNCTION_TYPE_BOTTOM
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
...
...
@@ -2528,7 +2530,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"elapsed"
,
.
type
=
FUNCTION_TYPE_ELAPSED
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
dataRequiredFunc
=
statisDataRequired
,
.
translateFunc
=
translateElapsed
,
.
getEnvFunc
=
getElapsedFuncEnv
,
...
...
@@ -2568,7 +2571,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_KEEP_ORDER_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
translateFunc
=
translateInterp
,
.
getEnvFunc
=
getSelectivityFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2580,7 +2583,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"derivative"
,
.
type
=
FUNCTION_TYPE_DERIVATIVE
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateDerivative
,
.
getEnvFunc
=
getDerivativeFuncEnv
,
.
initFunc
=
derivativeFuncSetup
,
...
...
@@ -2592,7 +2595,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"irate"
,
.
type
=
FUNCTION_TYPE_IRATE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateIrate
,
.
getEnvFunc
=
getIrateFuncEnv
,
.
initFunc
=
irateFuncSetup
,
...
...
@@ -2603,7 +2607,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"last_row"
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
dynDataRequiredFunc
=
lastDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2618,7 +2623,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_cache_last_row"
,
.
type
=
FUNCTION_TYPE_CACHE_LAST_ROW
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2628,7 +2634,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_cache_last"
,
.
type
=
FUNCTION_TYPE_CACHE_LAST
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2638,7 +2644,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_last_row_partial"
,
.
type
=
FUNCTION_TYPE_LAST_PARTIAL
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastPartial
,
.
dynDataRequiredFunc
=
lastDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2649,7 +2656,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_last_row_merge"
,
.
type
=
FUNCTION_TYPE_LAST_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastMerge
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2659,7 +2667,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"first"
,
.
type
=
FUNCTION_TYPE_FIRST
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
dynDataRequiredFunc
=
firstDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2674,7 +2683,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_first_partial"
,
.
type
=
FUNCTION_TYPE_FIRST_PARTIAL
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastPartial
,
.
dynDataRequiredFunc
=
firstDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2686,7 +2696,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_first_merge"
,
.
type
=
FUNCTION_TYPE_FIRST_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastMerge
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2697,7 +2708,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"last"
,
.
type
=
FUNCTION_TYPE_LAST
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
dynDataRequiredFunc
=
lastDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2712,7 +2724,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_last_partial"
,
.
type
=
FUNCTION_TYPE_LAST_PARTIAL
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastPartial
,
.
dynDataRequiredFunc
=
lastDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2724,7 +2737,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_last_merge"
,
.
type
=
FUNCTION_TYPE_LAST_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateFirstLastMerge
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2735,7 +2749,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"twa"
,
.
type
=
FUNCTION_TYPE_TWA
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateInNumOutDou
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getTwaFuncEnv
,
...
...
@@ -2826,7 +2841,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"diff"
,
.
type
=
FUNCTION_TYPE_DIFF
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
,
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateDiff
,
.
getEnvFunc
=
getDiffFuncEnv
,
.
initFunc
=
diffFunctionSetup
,
...
...
@@ -2839,7 +2854,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"statecount"
,
.
type
=
FUNCTION_TYPE_STATE_COUNT
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateStateCount
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2851,7 +2866,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"stateduration"
,
.
type
=
FUNCTION_TYPE_STATE_DURATION
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateStateDuration
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2863,7 +2878,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"csum"
,
.
type
=
FUNCTION_TYPE_CSUM
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_CUMULATIVE_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateCsum
,
.
getEnvFunc
=
getCsumFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2876,7 +2891,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"mavg"
,
.
type
=
FUNCTION_TYPE_MAVG
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_SYSTABLE_FUNC
,
.
translateFunc
=
translateMavg
,
.
getEnvFunc
=
getMavgFuncEnv
,
.
initFunc
=
mavgFunctionSetup
,
...
...
@@ -2887,7 +2902,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"sample"
,
.
type
=
FUNCTION_TYPE_SAMPLE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_ROWS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
translateFunc
=
translateSample
,
.
getEnvFunc
=
getSampleFuncEnv
,
.
initFunc
=
sampleFunctionSetup
,
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
575c4821
...
...
@@ -219,6 +219,8 @@ bool fmIsKeepOrderFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, F
bool
fmIsCumulativeFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_CUMULATIVE_FUNC
);
}
bool
fmIsForbidSysTableFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_SYSTABLE_FUNC
);
}
bool
fmIsInterpFunc
(
int32_t
funcId
)
{
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
return
false
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
575c4821
...
...
@@ -1660,6 +1660,20 @@ static int32_t translateForbidStreamFunc(STranslateContext* pCxt, SFunctionNode*
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateForbidSysTableFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsForbidSysTableFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pCxt
->
pCurrStmt
;
SNode
*
pTable
=
pSelect
->
pFromTable
;
if
(
NULL
!=
pTable
&&
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
)
&&
TSDB_SYSTEM_TABLE
==
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
tableType
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateRepeatScanFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsRepeatScanFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1891,6 +1905,9 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* p
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidStreamFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidSysTableFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateRepeatScanFunc
(
pCxt
,
pFunc
);
}
...
...
@@ -2648,7 +2665,7 @@ static int32_t replaceTbName(STranslateContext* pCxt, SSelectStmt* pSelect) {
SNode
**
pNode
=
NULL
;
SRewriteTbNameContext
pRewriteCxt
=
{
0
};
pRewriteCxt
.
pTbName
=
pTable
->
table
.
tableName
;
nodesRewriteExprPostOrder
(
&
pSelect
->
pWhere
,
doTranslateTbName
,
&
pRewriteCxt
);
return
pRewriteCxt
.
errCode
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
575c4821
...
...
@@ -170,6 +170,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"%s function is not supported in stream query"
;
case
TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC
:
return
"%s function is not supported in group query"
;
case
TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC
:
return
"%s function is not supported in system table query"
;
case
TSDB_CODE_PAR_INVALID_INTERP_CLAUSE
:
return
"Invalid usage of RANGE clause, EVERY clause or FILL clause"
;
case
TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN
:
...
...
source/util/src/terror.c
浏览文件 @
575c4821
...
...
@@ -554,7 +554,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be jso
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_VALUE_TOO_LONG
,
"Value too long for column/tag"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_DELETE_WHERE
,
"The DELETE statement must have a definite time window range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG
,
"The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC
,
"Fill no
w
allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC
,
"Fill no
t
allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_WINDOW_PC
,
"Invalid windows pc"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC
,
"Window not allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC
,
"Stream not allowed"
)
...
...
@@ -566,6 +566,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SMA_INDEX, "Invalid sma index")
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INVALID_SELECTED_EXPR
,
"Invalid SELECTed expression"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_GET_META_ERROR
,
"Fail to get table info"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS
,
"Not unique table/alias"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC
,
"System table not allowed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_PAR_INTERNAL_ERROR
,
"Parser internal error"
)
//planner
...
...
tests/parallel_test/cases.task
浏览文件 @
575c4821
...
...
@@ -813,6 +813,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/concat2.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/systable_func.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity_1.py
...
...
tests/system-test/2-query/systable_func.py
0 → 100644
浏览文件 @
575c4821
import
taos
import
sys
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
#tdSql.init(conn.cursor())
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
# output sql.txt file
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
query
(
f
"select count(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select sum(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select min(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select max(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select stddev(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select avg(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select apercentile(`columns`, 50) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select top(`columns`, 3) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select bottom(`columns`, 3) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select spread(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select histogram(`columns`, 'user_input', '[1, 3, 5]', 0) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select hyperloglog(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select sample(`columns`, 3) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select tail(`columns`, 3) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select unique(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
query
(
f
"select mode(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select leastsquares(`columns`, 1, 1) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select elapsed(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select interp(`columns`) from `information_schema`.`ins_tables` range(0, 1) every(1s) fill(null);"
)
tdSql
.
error
(
f
"select percentile(`columns`, 50) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select derivative(`columns`, 1s, 0) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select irate(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select last_row(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select last(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select first(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select twa(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select diff(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select statecount(`columns`, 'GE', 0) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select stateduration(`columns`, 'GE', 0, 1s) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select csum(`columns`) from `information_schema`.`ins_tables`;"
)
tdSql
.
error
(
f
"select mavg(`columns`, 1) from `information_schema`.`ins_tables`;"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录