Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2d7cf35f
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看板
提交
2d7cf35f
编写于
4月 19, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: some syntax parsing problems
上级
0b71a286
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
54 addition
and
21 deletion
+54
-21
include/util/tdef.h
include/util/tdef.h
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+23
-18
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1
-1
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+4
-0
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+2
-0
source/libs/planner/test/planTestUtil.h
source/libs/planner/test/planTestUtil.h
+2
-0
source/libs/planner/test/plannerTestMain.cpp
source/libs/planner/test/plannerTestMain.cpp
+20
-0
未找到文件。
include/util/tdef.h
浏览文件 @
2d7cf35f
...
...
@@ -199,7 +199,7 @@ typedef enum EOperatorType {
}
EOperatorType
;
typedef
enum
ELogicConditionType
{
LOGIC_COND_TYPE_AND
,
LOGIC_COND_TYPE_AND
=
1
,
LOGIC_COND_TYPE_OR
,
LOGIC_COND_TYPE_NOT
,
}
ELogicConditionType
;
...
...
source/libs/parser/inc/sql.y
浏览文件 @
2d7cf35f
...
...
@@ -646,7 +646,7 @@ predicate(A) ::= expression(B) BETWEEN expression(C) AND expression(D).
predicate(A) ::= expression(B) NOT BETWEEN expression(C) AND expression(D). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, D);
A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt,
C), releaseRawExprNode(pCxt, B
), releaseRawExprNode(pCxt, D)));
A = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt,
B), releaseRawExprNode(pCxt, C
), releaseRawExprNode(pCxt, D)));
}
predicate(A) ::= expression(B) IS NULL(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2d7cf35f
...
...
@@ -251,6 +251,9 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol
pCol
->
colType
=
pProjCol
->
colType
;
}
strcpy
(
pCol
->
colName
,
pExpr
->
aliasName
);
if
(
'\0'
==
pCol
->
node
.
aliasName
[
0
])
{
strcpy
(
pCol
->
node
.
aliasName
,
pCol
->
colName
);
}
pCol
->
node
.
resType
=
pExpr
->
resType
;
}
...
...
@@ -381,23 +384,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
}
res
=
(
found
?
DEAL_RES_CONTINUE
:
translateColumnWithoutPrefix
(
pCxt
,
pCol
));
}
if
(
DEAL_RES_ERROR
==
res
)
{
return
res
;
}
if
(
SQL_CLAUSE_WINDOW
==
pCxt
->
currClause
&&
QUERY_NODE_STATE_WINDOW
==
nodeType
(
pCxt
->
pCurrStmt
->
pWindow
))
{
if
(
!
IS_INTEGER_TYPE
(
pCol
->
node
.
resType
.
type
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE
);
}
if
(
COLUMN_TYPE_TAG
==
pCol
->
colType
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_COL
);
}
if
(
TSDB_SUPER_TABLE
==
pCol
->
tableType
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_TABLE
);
}
}
return
DEAL_RES_CONTINUE
;
}
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
...
...
@@ -1200,9 +1187,27 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode*
return
TSDB_CODE_SUCCESS
;
}
static
EDealRes
checkStateExpr
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
STranslateContext
*
pCxt
=
pContext
;
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
!
IS_INTEGER_TYPE
(
pCol
->
node
.
resType
.
type
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_TYPE
);
}
if
(
COLUMN_TYPE_TAG
==
pCol
->
colType
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_COL
);
}
if
(
TSDB_SUPER_TABLE
==
pCol
->
tableType
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_STATE_WIN_TABLE
);
}
}
return
DEAL_RES_CONTINUE
;
}
static
int32_t
checkStateWindow
(
STranslateContext
*
pCxt
,
SStateWindowNode
*
pState
)
{
nodesWalkExprPostOrder
(
pState
->
pExpr
,
checkStateExpr
,
pCxt
);
// todo check for "function not support for state_window"
return
TSDB_CODE_SUCCESS
;
return
pCxt
->
errCode
;
}
static
int32_t
checkSessionWindow
(
STranslateContext
*
pCxt
,
SSessionWindowNode
*
pSession
)
{
...
...
source/libs/parser/src/sql.c
浏览文件 @
2d7cf35f
...
...
@@ -3730,7 +3730,7 @@ static YYACTIONTYPE yy_reduce(
{
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy456
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy456
);
yylhsminor
.
yy456
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createNotBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy456
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy456
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy456
)));
yylhsminor
.
yy456
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createNotBetweenAnd
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy456
),
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy456
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy456
)));
}
yymsp
[
-
5
].
minor
.
yy456
=
yylhsminor
.
yy456
;
break
;
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
2d7cf35f
...
...
@@ -77,6 +77,10 @@ static bool osdMayBeOptimized(SLogicNode* pNode) {
if
(
QUERY_NODE_LOGIC_PLAN_SCAN
!=
nodeType
(
pNode
))
{
return
false
;
}
// todo: release after function splitting
if
(
TSDB_SUPER_TABLE
==
((
SScanLogicNode
*
)
pNode
)
->
pMeta
->
tableType
)
{
return
false
;
}
if
(
NULL
==
pNode
->
pParent
||
(
QUERY_NODE_LOGIC_PLAN_WINDOW
!=
nodeType
(
pNode
->
pParent
)
&&
QUERY_NODE_LOGIC_PLAN_AGG
!=
nodeType
(
pNode
->
pParent
)))
{
return
false
;
...
...
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
2d7cf35f
...
...
@@ -32,6 +32,8 @@ using namespace testing;
} \
} while(0);
bool
g_isDump
=
false
;
class
PlannerTestBaseImpl
{
public:
void
useDb
(
const
string
&
acctId
,
const
string
&
db
)
{
...
...
source/libs/planner/test/planTestUtil.h
浏览文件 @
2d7cf35f
...
...
@@ -32,4 +32,6 @@ private:
std
::
unique_ptr
<
PlannerTestBaseImpl
>
impl_
;
};
extern
bool
g_isDump
;
#endif // PLAN_TEST_UTIL_H
source/libs/planner/test/plannerTestMain.cpp
浏览文件 @
2d7cf35f
...
...
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
#include "mockCatalog.h"
#include "planTestUtil.h"
class
PlannerEnv
:
public
testing
::
Environment
{
public:
...
...
@@ -34,8 +35,27 @@ public:
virtual
~
PlannerEnv
()
{}
};
static
void
parseArg
(
int
argc
,
char
*
argv
[])
{
int
opt
=
0
;
const
char
*
optstring
=
""
;
static
struct
option
long_options
[]
=
{
{
"dump"
,
no_argument
,
NULL
,
'd'
},
{
0
,
0
,
0
,
0
}
};
while
((
opt
=
getopt_long
(
argc
,
argv
,
optstring
,
long_options
,
NULL
))
!=
-
1
)
{
switch
(
opt
)
{
case
'd'
:
g_isDump
=
true
;
break
;
default:
break
;
}
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
testing
::
AddGlobalTestEnvironment
(
new
PlannerEnv
());
testing
::
InitGoogleTest
(
&
argc
,
argv
);
parseArg
(
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录