Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8b894921
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看板
提交
8b894921
编写于
7月 12, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: some problems of parser
上级
fb314259
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
1115 addition
and
1127 deletion
+1115
-1127
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+0
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+3
-2
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+4
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+23
-5
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1082
-1116
未找到文件。
source/common/src/tglobal.c
浏览文件 @
8b894921
...
@@ -114,7 +114,7 @@ int32_t tsMinSlidingTime = 10;
...
@@ -114,7 +114,7 @@ int32_t tsMinSlidingTime = 10;
// the maxinum number of distict query result
// the maxinum number of distict query result
int32_t
tsMaxNumOfDistinctResults
=
1000
*
10000
;
int32_t
tsMaxNumOfDistinctResults
=
1000
*
10000
;
// 1
us
for interval time range, changed accordingly
// 1
database precision unit
for interval time range, changed accordingly
int32_t
tsMinIntervalTime
=
1
;
int32_t
tsMinIntervalTime
=
1
;
// 20sec, the maximum value of stream computing delay, changed accordingly
// 20sec, the maximum value of stream computing delay, changed accordingly
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
8b894921
...
@@ -2481,7 +2481,6 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
...
@@ -2481,7 +2481,6 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
int32_t
code
=
tjsonToObject
(
pJson
,
jkSubplanId
,
jsonToSubplanId
,
&
pNode
->
id
);
int32_t
code
=
tjsonToObject
(
pJson
,
jkSubplanId
,
jsonToSubplanId
,
&
pNode
->
id
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSubplanType
,
pNode
->
subplanType
,
code
);
tjsonGetNumberValue
(
pJson
,
jkSubplanType
,
pNode
->
subplanType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanMsgType
,
&
pNode
->
msgType
);
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanMsgType
,
&
pNode
->
msgType
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
8b894921
...
@@ -956,7 +956,8 @@ void nodesDestroyNode(SNode* pNode) {
...
@@ -956,7 +956,8 @@ void nodesDestroyNode(SNode* pNode) {
}
}
case
QUERY_NODE_PHYSICAL_SUBPLAN
:
{
case
QUERY_NODE_PHYSICAL_SUBPLAN
:
{
SSubplan
*
pSubplan
=
(
SSubplan
*
)
pNode
;
SSubplan
*
pSubplan
=
(
SSubplan
*
)
pNode
;
nodesDestroyList
(
pSubplan
->
pChildren
);
// nodesDestroyList(pSubplan->pChildren);
nodesClearList
(
pSubplan
->
pChildren
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pNode
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pNode
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pDataSink
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pDataSink
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pTagCond
);
nodesDestroyNode
((
SNode
*
)
pSubplan
->
pTagCond
);
...
@@ -972,7 +973,7 @@ void nodesDestroyNode(SNode* pNode) {
...
@@ -972,7 +973,7 @@ void nodesDestroyNode(SNode* pNode) {
SNode
*
pElement
=
NULL
;
SNode
*
pElement
=
NULL
;
FOREACH
(
pElement
,
pPlan
->
pSubplans
)
{
FOREACH
(
pElement
,
pPlan
->
pSubplans
)
{
if
(
first
)
{
if
(
first
)
{
first
=
false
;
//
first = false;
nodesDestroyNode
(
pElement
);
nodesDestroyNode
(
pElement
);
}
else
{
}
else
{
nodesClearList
(((
SNodeListNode
*
)
pElement
)
->
pNodeList
);
nodesClearList
(((
SNodeListNode
*
)
pElement
)
->
pNodeList
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
8b894921
...
@@ -556,6 +556,7 @@ signed_literal(A) ::= TIMESTAMP NK_STRING(B).
...
@@ -556,6 +556,7 @@ signed_literal(A) ::= TIMESTAMP NK_STRING(B).
signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= NULL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B); }
signed_literal(A) ::= NULL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B); }
signed_literal(A) ::= literal_func(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= literal_func(B). { A = releaseRawExprNode(pCxt, B); }
signed_literal(A) ::= NK_QUESTION(B). { A = createPlaceholderValueNode(pCxt, &B); }
%type literal_list { SNodeList* }
%type literal_list { SNodeList* }
%destructor literal_list { nodesDestroyList($$); }
%destructor literal_list { nodesDestroyList($$); }
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
8b894921
...
@@ -133,7 +133,10 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
...
@@ -133,7 +133,10 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
assert
(
*
p
==
TS_PATH_DELIMITER
[
0
]);
assert
(
*
p
==
TS_PATH_DELIMITER
[
0
]);
int32_t
dbLen
=
p
-
pTableName
->
z
;
int32_t
dbLen
=
p
-
pTableName
->
z
;
char
name
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
if
(
dbLen
<=
0
)
{
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg2
);
}
char
name
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
strncpy
(
name
,
pTableName
->
z
,
dbLen
);
strncpy
(
name
,
pTableName
->
z
,
dbLen
);
dbLen
=
strdequote
(
name
);
dbLen
=
strdequote
(
name
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
8b894921
...
@@ -2173,14 +2173,28 @@ static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char uni
...
@@ -2173,14 +2173,28 @@ static int64_t getMonthsFromTimeVal(int64_t val, int32_t fromPrecision, char uni
return
-
1
;
return
-
1
;
}
}
static
const
char
*
getPrecisionStr
(
uint8_t
precision
)
{
switch
(
precision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
return
TSDB_TIME_PRECISION_MILLI_STR
;
case
TSDB_TIME_PRECISION_MICRO
:
return
TSDB_TIME_PRECISION_MICRO_STR
;
case
TSDB_TIME_PRECISION_NANO
:
return
TSDB_TIME_PRECISION_NANO_STR
;
default:
break
;
}
return
"unknown"
;
}
static
int32_t
checkIntervalWindow
(
STranslateContext
*
pCxt
,
SIntervalWindowNode
*
pInterval
)
{
static
int32_t
checkIntervalWindow
(
STranslateContext
*
pCxt
,
SIntervalWindowNode
*
pInterval
)
{
uint8_t
precision
=
((
SColumnNode
*
)
pInterval
->
pCol
)
->
node
.
resType
.
precision
;
uint8_t
precision
=
((
SColumnNode
*
)
pInterval
->
pCol
)
->
node
.
resType
.
precision
;
SValueNode
*
pInter
=
(
SValueNode
*
)
pInterval
->
pInterval
;
SValueNode
*
pInter
=
(
SValueNode
*
)
pInterval
->
pInterval
;
bool
valInter
=
TIME_IS_VAR_DURATION
(
pInter
->
unit
);
bool
valInter
=
TIME_IS_VAR_DURATION
(
pInter
->
unit
);
if
(
pInter
->
datum
.
i
<=
0
||
if
(
pInter
->
datum
.
i
<=
0
||
(
!
valInter
&&
pInter
->
datum
.
i
<
tsMinIntervalTime
))
{
(
!
valInter
&&
convertTimePrecision
(
pInter
->
datum
.
i
,
precision
,
TSDB_TIME_PRECISION_MICRO
)
<
tsMinIntervalTime
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL
,
tsMinIntervalTime
,
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL
,
tsMinIntervalTime
);
getPrecisionStr
(
precision
)
);
}
}
if
(
NULL
!=
pInterval
->
pOffset
)
{
if
(
NULL
!=
pInterval
->
pOffset
)
{
...
@@ -2754,6 +2768,11 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
...
@@ -2754,6 +2768,11 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
}
}
}
}
if
(
NULL
==
pPrimaryKeyExpr
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_COLUMNS_NUM
,
"Primary timestamp column can not be null"
);
}
return
addOrderByPrimaryKeyToQuery
(
pCxt
,
pPrimaryKeyExpr
,
pInsert
->
pQuery
);
return
addOrderByPrimaryKeyToQuery
(
pCxt
,
pPrimaryKeyExpr
,
pInsert
->
pQuery
);
}
}
...
@@ -2998,8 +3017,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
...
@@ -2998,8 +3017,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
int32_t
code
=
int32_t
code
=
checkRangeOption
(
pCxt
,
"buffer"
,
pOptions
->
buffer
,
TSDB_MIN_BUFFER_PER_VNODE
,
TSDB_MAX_BUFFER_PER_VNODE
);
checkRangeOption
(
pCxt
,
"buffer"
,
pOptions
->
buffer
,
TSDB_MIN_BUFFER_PER_VNODE
,
TSDB_MAX_BUFFER_PER_VNODE
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkRangeOption
(
pCxt
,
"cacheLast"
,
pOptions
->
cacheLast
,
TSDB_MIN_DB_CACHE_LAST
,
code
=
checkRangeOption
(
pCxt
,
"cacheLast"
,
pOptions
->
cacheLast
,
TSDB_MIN_DB_CACHE_LAST
,
TSDB_MAX_DB_CACHE_LAST
);
TSDB_MAX_DB_CACHE_LAST
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkRangeOption
(
pCxt
,
"cacheLastSize"
,
pOptions
->
cacheLastSize
,
TSDB_MIN_DB_CACHE_LAST_SIZE
,
code
=
checkRangeOption
(
pCxt
,
"cacheLastSize"
,
pOptions
->
cacheLastSize
,
TSDB_MIN_DB_CACHE_LAST_SIZE
,
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
8b894921
...
@@ -60,7 +60,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
...
@@ -60,7 +60,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
case
TSDB_CODE_PAR_EXPRIE_STATEMENT
:
case
TSDB_CODE_PAR_EXPRIE_STATEMENT
:
return
"This statement is no longer supported"
;
return
"This statement is no longer supported"
;
case
TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL
:
case
TSDB_CODE_PAR_INTER_VALUE_TOO_SMALL
:
return
"Interval cannot be less than %d
u
s"
;
return
"Interval cannot be less than %d
%
s"
;
case
TSDB_CODE_PAR_DB_NOT_SPECIFIED
:
case
TSDB_CODE_PAR_DB_NOT_SPECIFIED
:
return
"Database not specified"
;
return
"Database not specified"
;
case
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
:
case
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
:
...
...
source/libs/parser/src/sql.c
浏览文件 @
8b894921
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录