Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff43adee
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
ff43adee
编写于
5月 19, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: some problems of parser and planner
上级
87f16127
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
4 deletion
+33
-4
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+2
-0
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+24
-1
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+3
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+3
-3
未找到文件。
include/libs/nodes/querynodes.h
浏览文件 @
ff43adee
...
...
@@ -236,6 +236,8 @@ typedef struct SSelectStmt {
bool
isTimeOrderQuery
;
bool
hasAggFuncs
;
bool
hasRepeatScanFuncs
;
bool
hasNonstdSQLFunc
;
bool
hasProjCol
;
}
SSelectStmt
;
typedef
enum
ESetOperatorType
{
SET_OP_TYPE_UNION_ALL
=
1
,
SET_OP_TYPE_UNION
}
ESetOperatorType
;
...
...
include/util/taoserror.h
浏览文件 @
ff43adee
...
...
@@ -649,6 +649,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_TBNAME TAOS_DEF_ERROR_CODE(0, 0x264C)
#define TSDB_CODE_PAR_INVALID_FUNCTION_NAME TAOS_DEF_ERROR_CODE(0, 0x264D)
#define TSDB_CODE_PAR_COMMENT_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x264E)
#define TSDB_CODE_PAR_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x264F)
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ff43adee
...
...
@@ -53,6 +53,8 @@ static bool afterGroupBy(ESqlClause clause) { return clause > SQL_CLAUSE_GROUP_B
static
bool
beforeHaving
(
ESqlClause
clause
)
{
return
clause
<
SQL_CLAUSE_HAVING
;
}
static
bool
afterHaving
(
ESqlClause
clause
)
{
return
clause
>
SQL_CLAUSE_HAVING
;
}
static
int32_t
addNamespace
(
STranslateContext
*
pCxt
,
void
*
pTable
)
{
size_t
currTotalLevel
=
taosArrayGetSize
(
pCxt
->
pNsLevel
);
if
(
currTotalLevel
>
pCxt
->
currLevel
)
{
...
...
@@ -276,6 +278,10 @@ static bool isScanPseudoColumnFunc(const SNode* pNode) {
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsScanPseudoColumnFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
}
static
bool
isNonstandardSQLFunc
(
const
SNode
*
pNode
)
{
return
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsNonstandardSQLFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
));
}
static
bool
isDistinctOrderBy
(
STranslateContext
*
pCxt
)
{
return
(
SQL_CLAUSE_ORDER_BY
==
pCxt
->
currClause
&&
pCxt
->
pCurrStmt
->
isDistinct
);
}
...
...
@@ -433,6 +439,7 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod
SArray
*
pTables
=
taosArrayGetP
(
pCxt
->
pNsLevel
,
pCxt
->
currLevel
);
size_t
nums
=
taosArrayGetSize
(
pTables
);
bool
found
=
false
;
bool
isInternalPk
=
isInternalPrimaryKey
(
pCol
);
for
(
size_t
i
=
0
;
i
<
nums
;
++
i
)
{
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
if
(
findAndSetColumn
(
pCol
,
pTable
))
{
...
...
@@ -440,10 +447,13 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
pCol
->
colName
);
}
found
=
true
;
if
(
isInternalPk
)
{
break
;
}
}
}
if
(
!
found
)
{
if
(
isInternalP
rimaryKey
(
pCol
)
)
{
if
(
isInternalP
k
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_INTERNAL_PK
);
}
else
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_COLUMN
,
pCol
->
colName
);
...
...
@@ -481,6 +491,9 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
}
res
=
(
found
?
DEAL_RES_CONTINUE
:
translateColumnWithoutPrefix
(
pCxt
,
pCol
));
}
if
(
afterHaving
(
pCxt
->
currClause
))
{
pCxt
->
pCurrStmt
->
hasProjCol
=
true
;
}
return
res
;
}
...
...
@@ -783,6 +796,16 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc)
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_TBNAME
);
}
}
if
(
afterHaving
(
pCxt
->
currClause
))
{
pCxt
->
pCurrStmt
->
hasProjCol
=
true
;
}
}
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
&&
fmIsNonstandardSQLFunc
(
pFunc
->
funcId
))
{
if
(
SQL_CLAUSE_SELECT
!=
pCxt
->
currClause
||
pCxt
->
pCurrStmt
->
hasNonstdSQLFunc
||
pCxt
->
pCurrStmt
->
hasAggFuncs
||
pCxt
->
pCurrStmt
->
hasProjCol
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
,
pFunc
->
functionName
);
}
pCxt
->
pCurrStmt
->
hasNonstdSQLFunc
=
true
;
}
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_CONTINUE
:
DEAL_RES_ERROR
;
}
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
ff43adee
...
...
@@ -164,6 +164,9 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Invalid function name"
;
case
TSDB_CODE_PAR_COMMENT_TOO_LONG
:
return
"Comment too long"
;
case
TSDB_CODE_PAR_NOT_ALLOWED_FUNC
:
return
"%s are allowed only in the SELECT list of a query. "
"And, cannot be mixed with other non scalar functions or columns."
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
ff43adee
...
...
@@ -24,9 +24,9 @@
#define SPLIT_FLAG_TEST_MASK(val, mask) (((val) & (mask)) != 0)
typedef
struct
SSplitContext
{
int32
_t
queryId
;
int32_t
groupId
;
bool
split
;
uint64
_t
queryId
;
int32_t
groupId
;
bool
split
;
}
SSplitContext
;
typedef
int32_t
(
*
FSplit
)(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录