Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a94e5f9b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a94e5f9b
编写于
7月 01, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: csum/diff/mavg support subquery
上级
129c9251
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
12 deletion
+30
-12
include/util/taoserror.h
include/util/taoserror.h
+1
-0
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
+18
-7
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+7
-4
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+3
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
a94e5f9b
...
...
@@ -572,6 +572,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x265B)
#define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x265C)
#define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D)
#define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E)
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
source/libs/function/src/builtins.c
浏览文件 @
a94e5f9b
...
...
@@ -1934,7 +1934,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"derivative"
,
.
type
=
FUNCTION_TYPE_DERIVATIVE
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
translateFunc
=
translateDerivative
,
.
getEnvFunc
=
getDerivativeFuncEnv
,
.
initFunc
=
derivativeFuncSetup
,
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
a94e5f9b
...
...
@@ -512,11 +512,9 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol
pExpr
->
pAssociation
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
);
}
taosArrayPush
(
pExpr
->
pAssociation
,
&
pColRef
);
if
(
NULL
!=
pTable
)
{
strcpy
(
pCol
->
tableAlias
,
pTable
->
tableAlias
);
}
else
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pExpr
))
{
strcpy
(
pCol
->
tableAlias
,
pTable
->
tableAlias
);
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pExpr
))
{
SColumnNode
*
pProjCol
=
(
SColumnNode
*
)
pExpr
;
strcpy
(
pCol
->
tableAlias
,
pProjCol
->
tableAlias
);
pCol
->
tableId
=
pProjCol
->
tableId
;
pCol
->
colId
=
pProjCol
->
colId
;
pCol
->
colType
=
pProjCol
->
colType
;
...
...
@@ -788,12 +786,12 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
return
DEAL_RES_CONTINUE
;
}
if
(
TSDB_DATA_TYPE_NULL
==
pVal
->
node
.
resType
.
type
)
{
// TODO
//pVal->node.resType = targetDt;
// TODO
//
pVal->node.resType = targetDt;
pVal
->
translate
=
true
;
pVal
->
isNull
=
true
;
return
DEAL_RES_CONTINUE
;
}
}
if
(
pVal
->
isDuration
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
precision
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1638,6 +1636,16 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
checkWindowFuncCoexist
(
STranslateContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
if
(
NULL
==
pSelect
->
pWindow
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
NULL
!=
pSelect
->
pWindow
&&
!
pSelect
->
hasAggFuncs
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
toVgroupsInfo
(
SArray
*
pVgs
,
SVgroupsInfo
**
pVgsInfo
)
{
size_t
vgroupNum
=
taosArrayGetSize
(
pVgs
);
*
pVgsInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgroupsInfo
)
+
sizeof
(
SVgroupInfo
)
*
vgroupNum
);
...
...
@@ -2584,6 +2592,9 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkAggColCoexist
(
pCxt
,
pSelect
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkWindowFuncCoexist
(
pCxt
,
pSelect
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkLimit
(
pCxt
,
pSelect
);
}
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
a94e5f9b
...
...
@@ -198,6 +198,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Invalid option %s"
;
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
:
return
"No valid function in window query"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
@@ -337,11 +339,11 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen) {
static
bool
isValidateTag
(
char
*
input
)
{
if
(
!
input
)
return
false
;
for
(
size_t
i
=
0
;
i
<
strlen
(
input
);
++
i
)
{
#ifdef WINDOWS
#ifdef WINDOWS
if
(
input
[
i
]
<
0x20
||
input
[
i
]
>
0x7E
)
return
false
;
#else
#else
if
(
isprint
(
input
[
i
])
==
0
)
return
false
;
#endif
#endif
}
return
true
;
}
...
...
@@ -381,7 +383,8 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, SMs
char
*
jsonKey
=
item
->
string
;
if
(
!
isValidateTag
(
jsonKey
))
{
fprintf
(
stdout
,
"%s(%d) %s %08"
PRId64
"
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
taosGetSelfPthreadId
());
fflush
(
stdout
);
fprintf
(
stdout
,
"%s(%d) %s %08"
PRId64
"
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
taosGetSelfPthreadId
());
fflush
(
stdout
);
retCode
=
buildSyntaxErrMsg
(
pMsgBuf
,
"json key not validate"
,
jsonKey
);
goto
end
;
}
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
a94e5f9b
...
...
@@ -728,6 +728,9 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
}
SFillNode
*
pFillNode
=
(
SFillNode
*
)(((
SIntervalWindowNode
*
)
pSelect
->
pWindow
)
->
pFill
);
if
(
FILL_MODE_NONE
==
pFillNode
->
mode
)
{
return
TSDB_CODE_SUCCESS
;
}
SFillLogicNode
*
pFill
=
(
SFillLogicNode
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_FILL
);
if
(
NULL
==
pFill
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录