Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2db0b407
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1183
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2db0b407
编写于
7月 16, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
7月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14952 from taosdata/feature/3.0_debug_wxy
fix: multi-rows function validity check
上级
53d8c2d7
52327cc2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
54 addition
and
57 deletion
+54
-57
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-2
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-0
source/libs/function/inc/functionMgtInt.h
source/libs/function/inc/functionMgtInt.h
+3
-4
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+11
-11
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+2
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+29
-29
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+6
-6
tests/system-test/2-query/statecount.py
tests/system-test/2-query/statecount.py
+1
-1
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
2db0b407
...
...
@@ -190,14 +190,13 @@ bool fmIsUserDefinedFunc(int32_t funcId);
bool
fmIsDistExecFunc
(
int32_t
funcId
);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmIsForbidWindowFunc
(
int32_t
funcId
);
bool
fmIsForbidGroupByFunc
(
int32_t
funcId
);
bool
fmIsIntervalInterpoFunc
(
int32_t
funcId
);
bool
fmIsInterpFunc
(
int32_t
funcId
);
bool
fmIsLastRowFunc
(
int32_t
funcId
);
bool
fmIsSystemInfoFunc
(
int32_t
funcId
);
bool
fmIsImplicitTsFunc
(
int32_t
funcId
);
bool
fmIsClientPseudoColumnFunc
(
int32_t
funcId
);
bool
fmIsMultiRowsFunc
(
int32_t
funcId
);
int32_t
fmGetDistMethod
(
const
SFunctionNode
*
pFunc
,
SFunctionNode
**
pPartialFunc
,
SFunctionNode
**
pMergeFunc
);
...
...
include/libs/nodes/querynodes.h
浏览文件 @
2db0b407
...
...
@@ -258,6 +258,7 @@ typedef struct SSelectStmt {
bool
hasAggFuncs
;
bool
hasRepeatScanFuncs
;
bool
hasIndefiniteRowsFunc
;
bool
hasMultiRowsFunc
;
bool
hasSelectFunc
;
bool
hasSelectValFunc
;
bool
hasOtherVectorFunc
;
...
...
source/libs/function/inc/functionMgtInt.h
浏览文件 @
2db0b407
...
...
@@ -44,10 +44,9 @@ extern "C" {
#define FUNC_MGT_FORBID_FILL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(15)
#define FUNC_MGT_INTERVAL_INTERPO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(16)
#define FUNC_MGT_FORBID_STREAM_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(17)
#define FUNC_MGT_FORBID_WINDOW_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(18)
#define FUNC_MGT_FORBID_GROUP_BY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19)
#define FUNC_MGT_SYSTEM_INFO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20)
#define FUNC_MGT_CLIENT_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21)
#define FUNC_MGT_SYSTEM_INFO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(18)
#define FUNC_MGT_CLIENT_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19)
#define FUNC_MGT_MULTI_ROWS_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
...
...
source/libs/function/src/builtins.c
浏览文件 @
2db0b407
...
...
@@ -2079,7 +2079,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"top"
,
.
type
=
FUNCTION_TYPE_TOP
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
INDEFINITE
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
MULTI
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
...
...
@@ -2093,7 +2093,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"bottom"
,
.
type
=
FUNCTION_TYPE_BOTTOM
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
INDEFINITE
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
MULTI
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
...
...
@@ -2320,7 +2320,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"histogram"
,
.
type
=
FUNCTION_TYPE_HISTOGRAM
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_
INDEFINITE
_ROWS_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_
MULTI
_ROWS_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
translateFunc
=
translateHistogram
,
.
getEnvFunc
=
getHistogramFuncEnv
,
.
initFunc
=
histogramFunctionSetup
,
...
...
@@ -2396,7 +2396,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"diff"
,
.
type
=
FUNCTION_TYPE_DIFF
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateDiff
,
.
getEnvFunc
=
getDiffFuncEnv
,
.
initFunc
=
diffFunctionSetup
,
...
...
@@ -2406,7 +2406,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"statecount"
,
.
type
=
FUNCTION_TYPE_STATE_COUNT
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateStateCount
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2416,7 +2416,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"stateduration"
,
.
type
=
FUNCTION_TYPE_STATE_DURATION
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateStateDuration
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2426,7 +2426,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"csum"
,
.
type
=
FUNCTION_TYPE_CSUM
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateCsum
,
.
getEnvFunc
=
getCsumFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2436,7 +2436,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"mavg"
,
.
type
=
FUNCTION_TYPE_MAVG
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateMavg
,
.
getEnvFunc
=
getMavgFuncEnv
,
.
initFunc
=
mavgFunctionSetup
,
...
...
@@ -2446,7 +2446,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"sample"
,
.
type
=
FUNCTION_TYPE_SAMPLE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
INDEFINITE
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_
MULTI
_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateSample
,
.
getEnvFunc
=
getSampleFuncEnv
,
.
initFunc
=
sampleFunctionSetup
,
...
...
@@ -2457,7 +2457,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"tail"
,
.
type
=
FUNCTION_TYPE_TAIL
,
.
classification
=
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_
FORBID_WINDOW_FUNC
|
FUNC_MGT_FORBID_GROUP_BY_FUNC
|
FUNC_MGT_
IMPLICIT_TS_FUNC
,
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
translateFunc
=
translateTail
,
.
getEnvFunc
=
getTailFuncEnv
,
.
initFunc
=
tailFunctionSetup
,
...
...
@@ -2468,7 +2468,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
name
=
"unique"
,
.
type
=
FUNCTION_TYPE_UNIQUE
,
.
classification
=
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_
FORBID_WINDOW_FUNC
|
FUNC_MGT_FORBID_GROUP_BY_FUNC
|
FUNC_MGT_
IMPLICIT_TS_FUNC
,
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
translateFunc
=
translateUnique
,
.
getEnvFunc
=
getUniqueFuncEnv
,
.
initFunc
=
uniqueFunctionSetup
,
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
2db0b407
...
...
@@ -175,16 +175,14 @@ bool fmIsIntervalInterpoFunc(int32_t funcId) { return isSpecificClassifyFunc(fun
bool
fmIsForbidStreamFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_STREAM_FUNC
);
}
bool
fmIsForbidWindowFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_WINDOW_FUNC
);
}
bool
fmIsForbidGroupByFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_GROUP_BY_FUNC
);
}
bool
fmIsSystemInfoFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_SYSTEM_INFO_FUNC
);
}
bool
fmIsImplicitTsFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_IMPLICIT_TS_FUNC
);
}
bool
fmIsClientPseudoColumnFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_CLIENT_PC_FUNC
);
}
bool
fmIsMultiRowsFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_MULTI_ROWS_FUNC
);
}
bool
fmIsInterpFunc
(
int32_t
funcId
)
{
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
return
false
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2db0b407
...
...
@@ -1058,7 +1058,9 @@ static int32_t translateAggFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
if
(
hasInvalidFuncNesting
(
pFunc
->
pParameterList
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_AGG_FUNC_NESTING
);
}
if
(
isSelectStmt
(
pCxt
->
pCurrStmt
)
&&
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasIndefiniteRowsFunc
)
{
// The auto-generated COUNT function in the DELETE statement is legal
if
(
isSelectStmt
(
pCxt
->
pCurrStmt
)
&&
(((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasIndefiniteRowsFunc
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasMultiRowsFunc
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
...
...
@@ -1093,7 +1095,27 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isSelectStmt
(
pCxt
->
pCurrStmt
)
||
SQL_CLAUSE_SELECT
!=
pCxt
->
currClause
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasIndefiniteRowsFunc
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasAggFuncs
)
{
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasIndefiniteRowsFunc
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasAggFuncs
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasMultiRowsFunc
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
if
(
NULL
!=
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pWindow
||
NULL
!=
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pGroupByList
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
"%s function is not supported in window query or group query"
,
pFunc
->
functionName
);
}
if
(
hasInvalidFuncNesting
(
pFunc
->
pParameterList
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_AGG_FUNC_NESTING
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateMultiRowsFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsMultiRowsFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isSelectStmt
(
pCxt
->
pCurrStmt
)
||
SQL_CLAUSE_SELECT
!=
pCxt
->
currClause
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasIndefiniteRowsFunc
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasAggFuncs
||
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
hasMultiRowsFunc
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
if
(
hasInvalidFuncNesting
(
pFunc
->
pParameterList
))
{
...
...
@@ -1131,16 +1153,6 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateForbidWindowFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsForbidWindowFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
isSelectStmt
(
pCxt
->
pCurrStmt
)
&&
NULL
!=
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pWindow
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateForbidStreamFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsForbidStreamFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1151,16 +1163,6 @@ static int32_t translateForbidStreamFunc(STranslateContext* pCxt, SFunctionNode*
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateForbidGroupByFunc
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
!
fmIsForbidGroupByFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
isSelectStmt
(
pCxt
->
pCurrStmt
)
&&
NULL
!=
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pGroupByList
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_GROUP_BY_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
;
...
...
@@ -1191,7 +1193,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu
if
(
!
fmIsMultiResFunc
(
pFunc
->
funcId
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
SQL_CLAUSE_SELECT
!=
pCxt
->
currClause
)
{
if
(
SQL_CLAUSE_SELECT
!=
pCxt
->
currClause
)
{
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
if
(
isStar
(
pPara
)
||
isTableStar
(
pPara
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
...
...
@@ -1206,6 +1208,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
pSelect
->
hasAggFuncs
=
pSelect
->
hasAggFuncs
?
true
:
fmIsAggFunc
(
pFunc
->
funcId
);
pSelect
->
hasRepeatScanFuncs
=
pSelect
->
hasRepeatScanFuncs
?
true
:
fmIsRepeatScanFunc
(
pFunc
->
funcId
);
pSelect
->
hasIndefiniteRowsFunc
=
pSelect
->
hasIndefiniteRowsFunc
?
true
:
fmIsIndefiniteRowsFunc
(
pFunc
->
funcId
);
pSelect
->
hasMultiRowsFunc
=
pSelect
->
hasMultiRowsFunc
?
true
:
fmIsMultiRowsFunc
(
pFunc
->
funcId
);
if
(
fmIsSelectFunc
(
pFunc
->
funcId
))
{
pSelect
->
hasSelectFunc
=
true
;
++
(
pSelect
->
selectFuncNum
);
...
...
@@ -1322,21 +1325,18 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateWindowPseudoColumnFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidWindowFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidStreamFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateForbidGroupByFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateRepeatScanFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateMultiResFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateMultiRowsFunc
(
pCxt
,
pFunc
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
setFuncClassification
(
pCxt
->
pCurrStmt
,
pFunc
);
}
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
2db0b407
...
...
@@ -152,9 +152,9 @@ TEST_F(ParserSelectTest, IndefiniteRowsFuncSemanticCheck) {
run
(
"SELECT DIFF(c1), CSUM(c1) FROM t1"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
run
(
"SELECT CSUM(c3) FROM t1 STATE_WINDOW(c1)"
,
TSDB_CODE_PAR_
WINDOW_
NOT_ALLOWED_FUNC
);
run
(
"SELECT CSUM(c3) FROM t1 STATE_WINDOW(c1)"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
run
(
"SELECT DIFF(c1) FROM t1 INTERVAL(10s)"
,
TSDB_CODE_PAR_
WINDOW_
NOT_ALLOWED_FUNC
);
run
(
"SELECT DIFF(c1) FROM t1 INTERVAL(10s)"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
TEST_F
(
ParserSelectTest
,
useDefinedFunc
)
{
...
...
@@ -178,9 +178,9 @@ TEST_F(ParserSelectTest, uniqueFunc) {
TEST_F
(
ParserSelectTest
,
uniqueFuncSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT UNIQUE(c1) FROM t1 INTERVAL(10S)"
,
TSDB_CODE_PAR_
WINDOW_
NOT_ALLOWED_FUNC
);
run
(
"SELECT UNIQUE(c1) FROM t1 INTERVAL(10S)"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
run
(
"SELECT UNIQUE(c1) FROM t1 GROUP BY c2"
,
TSDB_CODE_PAR_
GROUP_BY_
NOT_ALLOWED_FUNC
);
run
(
"SELECT UNIQUE(c1) FROM t1 GROUP BY c2"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
TEST_F
(
ParserSelectTest
,
tailFunc
)
{
...
...
@@ -194,9 +194,9 @@ TEST_F(ParserSelectTest, tailFunc) {
TEST_F
(
ParserSelectTest
,
tailFuncSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT TAIL(c1, 10) FROM t1 INTERVAL(10S)"
,
TSDB_CODE_PAR_
WINDOW_
NOT_ALLOWED_FUNC
);
run
(
"SELECT TAIL(c1, 10) FROM t1 INTERVAL(10S)"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
run
(
"SELECT TAIL(c1, 10) FROM t1 GROUP BY c2"
,
TSDB_CODE_PAR_
GROUP_BY_
NOT_ALLOWED_FUNC
);
run
(
"SELECT TAIL(c1, 10) FROM t1 GROUP BY c2"
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
);
}
TEST_F
(
ParserSelectTest
,
partitionBy
)
{
...
...
tests/system-test/2-query/statecount.py
浏览文件 @
2db0b407
...
...
@@ -335,7 +335,7 @@ class TDTestCase:
# tdSql.checkRows(21)
# group by
tdSql
.
query
(
"select statecount(c1,'GT',1) from ct1 group by c1"
)
tdSql
.
error
(
"select statecount(c1,'GT',1) from ct1 group by c1"
)
tdSql
.
error
(
"select statecount(c1,'GT',1) from ct1 group by tbname"
)
# super table
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录