Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fdbab777
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
fdbab777
编写于
4月 08, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
4月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11310 from taosdata/feature/3.0_wxy
TD-14457 TD-14537 TD-14571 bugfix
上级
5fd76a87
e87e7c33
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
48 addition
and
19 deletion
+48
-19
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+2
-0
include/util/taoserror.h
include/util/taoserror.h
+11
-10
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+32
-8
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
未找到文件。
include/libs/nodes/querynodes.h
浏览文件 @
fdbab777
...
...
@@ -124,6 +124,7 @@ typedef struct STableNode {
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
tableAlias
[
TSDB_TABLE_NAME_LEN
];
uint8_t
precision
;
}
STableNode
;
struct
STableMeta
;
...
...
@@ -236,6 +237,7 @@ typedef struct SSelectStmt {
SNode
*
pLimit
;
SNode
*
pSlimit
;
char
stmtName
[
TSDB_TABLE_NAME_LEN
];
uint8_t
precision
;
}
SSelectStmt
;
typedef
enum
ESetOperatorType
{
...
...
include/util/taoserror.h
浏览文件 @
fdbab777
...
...
@@ -483,16 +483,17 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617)
#define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618)
#define TSDB_CODE_PAR_INVALID_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2619)
#define TSDB_CODE_PAR_INVALID_STR_OPTION TAOS_DEF_ERROR_CODE(0, 0x2620)
#define TSDB_CODE_PAR_INVALID_ENUM_OPTION TAOS_DEF_ERROR_CODE(0, 0x2621)
#define TSDB_CODE_PAR_INVALID_TTL_OPTION TAOS_DEF_ERROR_CODE(0, 0x2622)
#define TSDB_CODE_PAR_INVALID_KEEP_NUM TAOS_DEF_ERROR_CODE(0, 0x2623)
#define TSDB_CODE_PAR_INVALID_KEEP_ORDER TAOS_DEF_ERROR_CODE(0, 0x2624)
#define TSDB_CODE_PAR_INVALID_KEEP_VALUE TAOS_DEF_ERROR_CODE(0, 0x2625)
#define TSDB_CODE_PAR_INVALID_COMMENT_OPTION TAOS_DEF_ERROR_CODE(0, 0x2626)
#define TSDB_CODE_PAR_INVALID_F_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2627)
#define TSDB_CODE_PAR_INVALID_ROLLUP_OPTION TAOS_DEF_ERROR_CODE(0, 0x2628)
#define TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION TAOS_DEF_ERROR_CODE(0, 0x2629)
#define TSDB_CODE_PAR_INVALID_STR_OPTION TAOS_DEF_ERROR_CODE(0, 0x261A)
#define TSDB_CODE_PAR_INVALID_ENUM_OPTION TAOS_DEF_ERROR_CODE(0, 0x261B)
#define TSDB_CODE_PAR_INVALID_TTL_OPTION TAOS_DEF_ERROR_CODE(0, 0x261C)
#define TSDB_CODE_PAR_INVALID_KEEP_NUM TAOS_DEF_ERROR_CODE(0, 0x261D)
#define TSDB_CODE_PAR_INVALID_KEEP_ORDER TAOS_DEF_ERROR_CODE(0, 0x261E)
#define TSDB_CODE_PAR_INVALID_KEEP_VALUE TAOS_DEF_ERROR_CODE(0, 0x261F)
#define TSDB_CODE_PAR_INVALID_COMMENT_OPTION TAOS_DEF_ERROR_CODE(0, 0x2620)
#define TSDB_CODE_PAR_INVALID_F_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2621)
#define TSDB_CODE_PAR_INVALID_ROLLUP_OPTION TAOS_DEF_ERROR_CODE(0, 0x2622)
#define TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION TAOS_DEF_ERROR_CODE(0, 0x2623)
#define TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST TAOS_DEF_ERROR_CODE(0, 0x2624)
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
fdbab777
...
...
@@ -1578,7 +1578,7 @@ static int32_t datumToJson(const void* pObj, SJson* pJson) {
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
code
=
tjsonAdd
Integer
ToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
b
);
code
=
tjsonAdd
Bool
ToObject
(
pJson
,
jkValueDatum
,
pNode
->
datum
.
b
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
fdbab777
...
...
@@ -376,8 +376,9 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
}
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
uint8_t
precision
=
(
NULL
!=
pCxt
->
pCurrStmt
?
pCxt
->
pCurrStmt
->
precision
:
pVal
->
node
.
resType
.
precision
);
if
(
pVal
->
isDuration
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
p
Val
->
node
.
resType
.
p
recision
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
precision
)
!=
TSDB_CODE_SUCCESS
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
}
else
{
...
...
@@ -421,7 +422,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
if
(
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
pVal
->
node
.
resType
.
bytes
,
p
Val
->
node
.
resType
.
p
recision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
pVal
->
node
.
resType
.
bytes
,
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
break
;
...
...
@@ -683,6 +684,19 @@ static int32_t setTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTa
return
code
;
}
static
uint8_t
getStmtPrecision
(
SNode
*
pStmt
)
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pStmt
))
{
return
((
SSelectStmt
*
)
pStmt
)
->
precision
;
}
return
0
;
}
static
uint8_t
getJoinTablePrecision
(
SJoinTableNode
*
pJoinTable
)
{
uint8_t
lp
=
((
STableNode
*
)
pJoinTable
->
pLeft
)
->
precision
;
uint8_t
rp
=
((
STableNode
*
)
pJoinTable
->
pRight
)
->
precision
;
return
(
lp
>
rp
?
rp
:
lp
);
}
static
int32_t
translateTable
(
STranslateContext
*
pCxt
,
SNode
*
pTable
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
nodeType
(
pTable
))
{
...
...
@@ -695,6 +709,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
pRealTable
->
table
.
tableName
);
}
pRealTable
->
table
.
precision
=
pRealTable
->
pMeta
->
tableInfo
.
precision
;
code
=
setTableVgroupList
(
pCxt
,
&
name
,
pRealTable
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addNamespace
(
pCxt
,
pRealTable
);
...
...
@@ -705,6 +720,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
STempTableNode
*
pTempTable
=
(
STempTableNode
*
)
pTable
;
code
=
translateSubquery
(
pCxt
,
pTempTable
->
pSubquery
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pTempTable
->
table
.
precision
=
getStmtPrecision
(
pTempTable
->
pSubquery
);
code
=
addNamespace
(
pCxt
,
pTempTable
);
}
break
;
...
...
@@ -716,6 +732,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
code
=
translateTable
(
pCxt
,
pJoinTable
->
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pJoinTable
->
table
.
precision
=
getJoinTablePrecision
(
pJoinTable
);
code
=
translateExpr
(
pCxt
,
pJoinTable
->
pOnCond
);
}
break
;
...
...
@@ -852,9 +869,12 @@ static int32_t translateHaving(STranslateContext* pCxt, SSelectStmt* pSelect) {
return
code
;
}
static
int32_t
translateGroupBy
(
STranslateContext
*
pCxt
,
SNodeList
*
pGroupByList
)
{
static
int32_t
translateGroupBy
(
STranslateContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
if
(
NULL
!=
pSelect
->
pGroupByList
&&
NULL
!=
pSelect
->
pWindow
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST
);
}
pCxt
->
currClause
=
SQL_CLAUSE_GROUP_BY
;
return
translateExprList
(
pCxt
,
pGroupByList
);
return
translateExprList
(
pCxt
,
p
Select
->
p
GroupByList
);
}
static
int32_t
translateIntervalWindow
(
STranslateContext
*
pCxt
,
SIntervalWindowNode
*
pInterval
)
{
...
...
@@ -899,14 +919,18 @@ static int32_t translateWhere(STranslateContext* pCxt, SNode* pWhere) {
return
translateExpr
(
pCxt
,
pWhere
);
}
static
int32_t
translateFrom
(
STranslateContext
*
pCxt
,
S
Node
*
pTable
)
{
static
int32_t
translateFrom
(
STranslateContext
*
pCxt
,
S
SelectStmt
*
pSelect
)
{
pCxt
->
currClause
=
SQL_CLAUSE_FROM
;
return
translateTable
(
pCxt
,
pTable
);
int32_t
code
=
translateTable
(
pCxt
,
pSelect
->
pFromTable
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pSelect
->
precision
=
((
STableNode
*
)
pSelect
->
pFromTable
)
->
precision
;
}
return
code
;
}
static
int32_t
translateSelect
(
STranslateContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
pCxt
->
pCurrStmt
=
pSelect
;
int32_t
code
=
translateFrom
(
pCxt
,
pSelect
->
pFromTable
);
int32_t
code
=
translateFrom
(
pCxt
,
pSelect
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateWhere
(
pCxt
,
pSelect
->
pWhere
);
}
...
...
@@ -917,7 +941,7 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
code
=
translateWindow
(
pCxt
,
pSelect
->
pWindow
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateGroupBy
(
pCxt
,
pSelect
->
pGroupByList
);
code
=
translateGroupBy
(
pCxt
,
pSelect
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateHaving
(
pCxt
,
pSelect
);
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
fdbab777
...
...
@@ -89,6 +89,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"invalid option rollup: only one function is allowed"
;
case
TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION
:
return
"invalid option retentions"
;
case
TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST
:
return
"GROUP BY and WINDOW-clause can't be used together"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录