Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ade0e5c5
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
未验证
提交
ade0e5c5
编写于
9月 22, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17010 from taosdata/fix/3.0_bugfix_wxy
fix: some parser problems
上级
3c65b2d8
cf39f2e2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
7 deletion
+30
-7
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+20
-0
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+7
-0
source/libs/planner/test/planJoinTest.cpp
source/libs/planner/test/planJoinTest.cpp
+2
-6
未找到文件。
include/util/taoserror.h
浏览文件 @
ade0e5c5
...
...
@@ -552,7 +552,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VALUE_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2653)
#define TSDB_CODE_PAR_INVALID_DELETE_WHERE TAOS_DEF_ERROR_CODE(0, 0x2655)
#define TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG TAOS_DEF_ERROR_CODE(0, 0x2656)
#define TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2657)
#define TSDB_CODE_PAR_INVALID_WINDOW_PC TAOS_DEF_ERROR_CODE(0, 0x2658)
#define TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC TAOS_DEF_ERROR_CODE(0, 0x2659)
...
...
@@ -565,6 +564,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661)
#define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662)
#define TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2663)
#define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ade0e5c5
...
...
@@ -264,6 +264,8 @@ static bool beforeHaving(ESqlClause clause) { return clause < SQL_CLAUSE_HAVING;
static
bool
afterHaving
(
ESqlClause
clause
)
{
return
clause
>
SQL_CLAUSE_HAVING
;
}
static
bool
beforeWindow
(
ESqlClause
clause
)
{
return
clause
<
SQL_CLAUSE_WINDOW
;
}
static
bool
hasSameTableAlias
(
SArray
*
pTables
)
{
if
(
taosArrayGetSize
(
pTables
)
<
2
)
{
return
false
;
...
...
@@ -1476,6 +1478,10 @@ static int32_t translateWindowPseudoColumnFunc(STranslateContext* pCxt, SFunctio
if
(
!
isSelectStmt
(
pCxt
->
pCurrStmt
)
||
NULL
==
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
pWindow
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_WINDOW_PC
);
}
if
(
beforeWindow
(
pCxt
->
currClause
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_WINDOW_PC
,
"There mustn't be %s"
,
pFunc
->
functionName
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2213,6 +2219,17 @@ static int32_t setTableCacheLastMode(STranslateContext* pCxt, SSelectStmt* pSele
return
code
;
}
static
int32_t
checkJoinTable
(
STranslateContext
*
pCxt
,
SJoinTableNode
*
pJoinTable
)
{
if
((
QUERY_NODE_TEMP_TABLE
==
nodeType
(
pJoinTable
->
pLeft
)
&&
!
isTimeLineQuery
(((
STempTableNode
*
)
pJoinTable
->
pLeft
)
->
pSubquery
))
||
(
QUERY_NODE_TEMP_TABLE
==
nodeType
(
pJoinTable
->
pRight
)
&&
!
isTimeLineQuery
(((
STempTableNode
*
)
pJoinTable
->
pRight
)
->
pSubquery
)))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_SUPPORT_JOIN
,
"Join requires valid time series input"
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateTable
(
STranslateContext
*
pCxt
,
SNode
*
pTable
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
nodeType
(
pTable
))
{
...
...
@@ -2259,6 +2276,9 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateTable
(
pCxt
,
pJoinTable
->
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkJoinTable
(
pCxt
,
pJoinTable
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pJoinTable
->
table
.
precision
=
calcJoinTablePrecision
(
pJoinTable
);
pJoinTable
->
table
.
singleTable
=
joinTableIsSingleTable
(
pJoinTable
);
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
ade0e5c5
...
...
@@ -445,4 +445,11 @@ TEST_F(ParserSelectTest, withoutFromSemanticCheck) {
run
(
"SELECT TBNAME"
,
TSDB_CODE_PAR_INVALID_TBNAME
);
}
TEST_F
(
ParserSelectTest
,
joinSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT * FROM (SELECT tag1, SUM(c1) s FROM st1 GROUP BY tag1) t1, st1 t2 where t1.tag1 = t2.tag1"
,
TSDB_CODE_PAR_NOT_SUPPORT_JOIN
);
}
}
// namespace ParserTest
source/libs/planner/test/planJoinTest.cpp
浏览文件 @
ade0e5c5
...
...
@@ -28,6 +28,8 @@ TEST_F(PlanJoinTest, basic) {
run
(
"SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 WHERE t1.ts = t2.ts"
);
run
(
"SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts"
);
run
(
"SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts"
);
}
TEST_F
(
PlanJoinTest
,
complex
)
{
...
...
@@ -56,9 +58,3 @@ TEST_F(PlanJoinTest, multiJoin) {
run
(
"SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts JOIN st1s3 t3 ON t1.ts = t3.ts"
);
}
TEST_F
(
PlanJoinTest
,
stable
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT t1.c1, t2.c1 FROM st1 t1 JOIN st2 t2 ON t1.ts = t2.ts "
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录