Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
901c9b8f
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
901c9b8f
编写于
11月 14, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: some problems of parser
上级
7bddbb06
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
19 deletion
+20
-19
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+2
-3
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+7
-7
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+10
-8
未找到文件。
include/libs/nodes/querynodes.h
浏览文件 @
901c9b8f
...
...
@@ -74,9 +74,8 @@ typedef struct SColumnNode {
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
tableAlias
[
TSDB_TABLE_NAME_LEN
];
char
colName
[
TSDB_COL_NAME_LEN
];
// SNode* pProjectRef;
int16_t
dataBlockId
;
int16_t
slotId
;
int16_t
dataBlockId
;
int16_t
slotId
;
}
SColumnNode
;
typedef
struct
SColumnRefNode
{
...
...
source/libs/function/src/builtins.c
浏览文件 @
901c9b8f
...
...
@@ -475,7 +475,7 @@ static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t le
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1506,7 +1506,7 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1519,7 +1519,7 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
//if (1 != numOfParams && 3 != numOfParams && 4 != numOfParams) {
//
if (1 != numOfParams && 3 != numOfParams && 4 != numOfParams) {
if
(
1
!=
numOfParams
)
{
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
...
...
@@ -1835,7 +1835,7 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1894,7 +1894,7 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int
// add database precision as param
uint8_t
dbPrec
=
pFunc
->
node
.
resType
.
precision
;
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
int32_t
code
=
addDbPrecisonParam
(
&
pFunc
->
pParameterList
,
dbPrec
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2474,7 +2474,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"first"
,
.
type
=
FUNCTION_TYPE_FIRST
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
dynDataRequiredFunc
=
firstDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
@@ -2512,7 +2512,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"last"
,
.
type
=
FUNCTION_TYPE_LAST
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_IMPLICIT_TS_FUNC
|
FUNC_MGT_KEEP_ORDER_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
dynDataRequiredFunc
=
lastDynDataReq
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
901c9b8f
...
...
@@ -622,7 +622,7 @@ void nodesDestroyNode(SNode* pNode) {
}
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_COLUMN
:
// pProjectRef is weak reference, no need to release
case
QUERY_NODE_COLUMN
:
destroyExprNode
((
SExprNode
*
)
pNode
);
break
;
case
QUERY_NODE_VALUE
:
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
901c9b8f
...
...
@@ -744,7 +744,8 @@ static bool isPrimaryKeyImpl(SNode* pExpr) {
return
(
PRIMARYKEY_TIMESTAMP_COL_ID
==
((
SColumnNode
*
)
pExpr
)
->
colId
);
}
else
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pExpr
))
{
SFunctionNode
*
pFunc
=
(
SFunctionNode
*
)
pExpr
;
if
(
FUNCTION_TYPE_SELECT_VALUE
==
pFunc
->
funcType
)
{
if
(
FUNCTION_TYPE_SELECT_VALUE
==
pFunc
->
funcType
||
FUNCTION_TYPE_FIRST
==
pFunc
->
funcType
||
FUNCTION_TYPE_LAST
==
pFunc
->
funcType
)
{
return
isPrimaryKeyImpl
(
nodesListGetNode
(
pFunc
->
pParameterList
,
0
));
}
else
if
(
FUNCTION_TYPE_WSTART
==
pFunc
->
funcType
||
FUNCTION_TYPE_WEND
==
pFunc
->
funcType
)
{
return
true
;
...
...
@@ -787,7 +788,6 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p
static
void
setColumnInfoByExpr
(
STempTableNode
*
pTable
,
SExprNode
*
pExpr
,
SColumnNode
**
pColRef
)
{
SColumnNode
*
pCol
=
*
pColRef
;
// pCol->pProjectRef = (SNode*)pExpr;
if
(
NULL
==
pExpr
->
pAssociation
)
{
pExpr
->
pAssociation
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
);
}
...
...
@@ -2932,8 +2932,8 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode*
return
TSDB_CODE_SUCCESS
;
}
if
(
TSWINDOW_IS_EQUAL
(
pFill
->
timeRange
,
TSWINDOW_INITIALIZER
)
||
TSWINDOW_IS_EQUAL
(
pFill
->
timeRange
,
TSWINDOW_DESC_INITIALIZER
))
{
if
(
!
pCxt
->
createStream
&&
(
TSWINDOW_IS_EQUAL
(
pFill
->
timeRange
,
TSWINDOW_INITIALIZER
)
||
TSWINDOW_IS_EQUAL
(
pFill
->
timeRange
,
TSWINDOW_DESC_INITIALIZER
)
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE
);
}
...
...
@@ -5268,9 +5268,7 @@ static int32_t checkTopicQuery(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
static
int32_t
buildCreateTopicReq
(
STranslateContext
*
pCxt
,
SCreateTopicStmt
*
pStmt
,
SCMCreateTopicReq
*
pReq
)
{
SName
name
;
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
topicName
,
strlen
(
pStmt
->
topicName
));
tNameGetFullDbName
(
&
name
,
pReq
->
name
);
snprintf
(
pReq
->
name
,
sizeof
(
pReq
->
name
),
"%d.%s"
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
topicName
);
pReq
->
igExists
=
pStmt
->
ignoreExists
;
pReq
->
withMeta
=
pStmt
->
withMeta
;
...
...
@@ -5280,7 +5278,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
SName
name
;
if
(
'\0'
!=
pStmt
->
subSTbName
[
0
])
{
pReq
->
subType
=
TOPIC_SUB_TYPE__TABLE
;
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
subDbName
,
pStmt
->
subSTbName
,
&
name
);
...
...
@@ -5548,6 +5546,10 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SSelectStmt* pSelect) {
crossTableWithUdaf
(
pSelect
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_STREAM_QUERY
,
"Unsupported stream query"
);
}
if
(
NULL
!=
pSelect
->
pSubtable
&&
TSDB_DATA_TYPE_VARCHAR
!=
((
SExprNode
*
)
pSelect
->
pSubtable
)
->
resType
.
type
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_STREAM_QUERY
,
"SUBTABLE expression must be of VARCHAR type"
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录