Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5ce92e62
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看板
未验证
提交
5ce92e62
编写于
5月 31, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
5月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13296 from taosdata/feature/3.0_wxy
fix: error in data precision of super table query
上级
1f833afe
96a0555d
变更
17
展开全部
显示空白变更内容
内联
并排
Showing
17 changed file
with
2538 addition
and
2524 deletion
+2538
-2524
include/common/ttokendef.h
include/common/ttokendef.h
+51
-52
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+0
-1
include/util/tdef.h
include/util/tdef.h
+0
-3
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+1
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+0
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+0
-5
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+1
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+30
-18
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2438
-2428
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+4
-6
source/libs/parser/test/parInitialDTest.cpp
source/libs/parser/test/parInitialDTest.cpp
+3
-3
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+2
-0
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+2
-0
tests/script/tsim/insert/update0.sim
tests/script/tsim/insert/update0.sim
+1
-1
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
+1
-1
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+3
-1
未找到文件。
include/common/ttokendef.h
浏览文件 @
5ce92e62
...
@@ -127,42 +127,42 @@
...
@@ -127,42 +127,42 @@
#define TK_BLOB 109
#define TK_BLOB 109
#define TK_VARBINARY 110
#define TK_VARBINARY 110
#define TK_DECIMAL 111
#define TK_DECIMAL 111
#define TK_
DELAY
112
#define TK_
FILE_FACTOR
112
#define TK_
FILE_FACTOR
113
#define TK_
NK_FLOAT
113
#define TK_
NK_FLOAT
114
#define TK_
ROLLUP
114
#define TK_
ROLLUP
115
#define TK_
TTL
115
#define TK_
TTL
116
#define TK_
SMA
116
#define TK_S
MA
117
#define TK_S
HOW
117
#define TK_
SHOW
118
#define TK_
DATABASES
118
#define TK_
DATABASES
119
#define TK_
TABLES
119
#define TK_
TABLES
120
#define TK_
STABLES
120
#define TK_
STABLES
121
#define TK_
MNODES
121
#define TK_M
NODES
122
#define TK_M
ODULES
122
#define TK_
MODULES
123
#define TK_
QNODES
123
#define TK_
QNODES
124
#define TK_
FUNCTIONS
124
#define TK_
FUNCTIONS
125
#define TK_
INDEXES
125
#define TK_
INDEXES
126
#define TK_
ACCOUNTS
126
#define TK_A
CCOUNTS
127
#define TK_A
PPS
127
#define TK_
APPS
128
#define TK_
CONNECTIONS
128
#define TK_
CONNECTIONS
129
#define TK_
LICENCE
129
#define TK_
LICENCE
130
#define TK_
GRANTS
130
#define TK_
GRANTS
131
#define TK_
QUERIES
131
#define TK_
QUERIES
132
#define TK_
SCORES
132
#define TK_
SCORE
S 133
#define TK_
TOPIC
S 133
#define TK_
TOPICS
134
#define TK_
VARIABLES
134
#define TK_
VARIABLES
135
#define TK_
BNODES
135
#define TK_
B
NODES 136
#define TK_
S
NODES 136
#define TK_
SNODES
137
#define TK_
CLUSTER
137
#define TK_
CLUSTER
138
#define TK_
TRANSACTIONS
138
#define TK_
TRANSACTIONS
139
#define TK_
LIKE
139
#define TK_
LIKE
140
#define TK_
INDEX
140
#define TK_
INDEX
141
#define TK_
FULLTEXT
141
#define TK_FU
LLTEXT
142
#define TK_FU
NCTION
142
#define TK_
FUNCTION
143
#define TK_
INTERVAL
143
#define TK_
INTERVAL
144
#define TK_
TOPIC
144
#define TK_
TOPIC
145
#define TK_
AS
145
#define TK_
AS
146
#define TK_
CONSUMER
146
#define TK_
CGROUP
147
#define TK_
GROUP
147
#define TK_WITH 148
#define TK_WITH 148
#define TK_SCHEMA 149
#define TK_SCHEMA 149
#define TK_DESC 150
#define TK_DESC 150
...
@@ -239,22 +239,21 @@
...
@@ -239,22 +239,21 @@
#define TK_PREV 221
#define TK_PREV 221
#define TK_LINEAR 222
#define TK_LINEAR 222
#define TK_NEXT 223
#define TK_NEXT 223
#define TK_GROUP 224
#define TK_HAVING 224
#define TK_HAVING 225
#define TK_ORDER 225
#define TK_ORDER 226
#define TK_SLIMIT 226
#define TK_SLIMIT 227
#define TK_SOFFSET 227
#define TK_SOFFSET 228
#define TK_LIMIT 228
#define TK_LIMIT 229
#define TK_OFFSET 229
#define TK_OFFSET 230
#define TK_ASC 230
#define TK_ASC 231
#define TK_NULLS 231
#define TK_NULLS 232
#define TK_ID 232
#define TK_ID 233
#define TK_NK_BITNOT 233
#define TK_NK_BITNOT 234
#define TK_INSERT 234
#define TK_INSERT 235
#define TK_VALUES 235
#define TK_VALUES 236
#define TK_IMPORT 236
#define TK_IMPORT 237
#define TK_NK_SEMI 237
#define TK_NK_SEMI 238
#define TK_FILE 238
#define TK_FILE 239
#define TK_NK_SPACE 300
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
#define TK_NK_COMMENT 301
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
5ce92e62
...
@@ -80,7 +80,6 @@ typedef struct SAlterDatabaseStmt {
...
@@ -80,7 +80,6 @@ typedef struct SAlterDatabaseStmt {
typedef
struct
STableOptions
{
typedef
struct
STableOptions
{
ENodeType
type
;
ENodeType
type
;
char
comment
[
TSDB_TB_COMMENT_LEN
];
char
comment
[
TSDB_TB_COMMENT_LEN
];
int32_t
delay
;
float
filesFactor
;
float
filesFactor
;
SNodeList
*
pRollupFuncs
;
SNodeList
*
pRollupFuncs
;
int32_t
ttl
;
int32_t
ttl
;
...
...
include/util/tdef.h
浏览文件 @
5ce92e62
...
@@ -344,9 +344,6 @@ typedef enum ELogicConditionType {
...
@@ -344,9 +344,6 @@ typedef enum ELogicConditionType {
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_MIN_ROLLUP_DELAY 1
#define TSDB_MAX_ROLLUP_DELAY 10
#define TSDB_DEFAULT_ROLLUP_DELAY 2
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
5ce92e62
...
@@ -305,6 +305,7 @@ static SNode* logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
...
@@ -305,6 +305,7 @@ static SNode* logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
CLONE_NODE_FIELD
(
pConditions
);
CLONE_NODE_FIELD
(
pConditions
);
CLONE_NODE_LIST_FIELD
(
pChildren
);
CLONE_NODE_LIST_FIELD
(
pChildren
);
COPY_SCALAR_FIELD
(
optimizedFlag
);
COPY_SCALAR_FIELD
(
optimizedFlag
);
COPY_SCALAR_FIELD
(
precision
);
return
(
SNode
*
)
pDst
;
return
(
SNode
*
)
pDst
;
}
}
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
5ce92e62
...
@@ -59,7 +59,6 @@ typedef enum EDatabaseOptionType {
...
@@ -59,7 +59,6 @@ typedef enum EDatabaseOptionType {
typedef
enum
ETableOptionType
{
typedef
enum
ETableOptionType
{
TABLE_OPTION_COMMENT
=
1
,
TABLE_OPTION_COMMENT
=
1
,
TABLE_OPTION_DELAY
,
TABLE_OPTION_FILE_FACTOR
,
TABLE_OPTION_FILE_FACTOR
,
TABLE_OPTION_ROLLUP
,
TABLE_OPTION_ROLLUP
,
TABLE_OPTION_TTL
,
TABLE_OPTION_TTL
,
...
...
source/libs/parser/inc/sql.y
浏览文件 @
5ce92e62
...
@@ -313,7 +313,6 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP.
...
@@ -313,7 +313,6 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP.
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELAY, &C); }
table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); }
table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); }
table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
...
@@ -408,7 +407,7 @@ cmd ::= CREATE TOPIC not_exists_opt(A)
...
@@ -408,7 +407,7 @@ cmd ::= CREATE TOPIC not_exists_opt(A)
cmd ::= CREATE TOPIC not_exists_opt(A)
cmd ::= CREATE TOPIC not_exists_opt(A)
topic_name(B) topic_options(D) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C, D); }
topic_name(B) topic_options(D) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C, D); }
cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); }
cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); }
cmd ::= DROP C
GROUP exists_opt(A) cgroup_name(B) ON topic_name(C).
{ pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); }
cmd ::= DROP C
ONSUMER GROUP exists_opt(A) cgroup_name(B) ON topic_name(C).
{ pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); }
topic_options(A) ::= . { A = createTopicOptions(pCxt); }
topic_options(A) ::= . { A = createTopicOptions(pCxt); }
topic_options(A) ::= topic_options(B) WITH TABLE. { ((STopicOptions*)B)->withTable = true; A = B; }
topic_options(A) ::= topic_options(B) WITH TABLE. { ((STopicOptions*)B)->withTable = true; A = B; }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
5ce92e62
...
@@ -857,7 +857,6 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) {
...
@@ -857,7 +857,6 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) {
CHECK_PARSER_STATUS
(
pCxt
);
CHECK_PARSER_STATUS
(
pCxt
);
STableOptions
*
pOptions
=
nodesMakeNode
(
QUERY_NODE_TABLE_OPTIONS
);
STableOptions
*
pOptions
=
nodesMakeNode
(
QUERY_NODE_TABLE_OPTIONS
);
CHECK_OUT_OF_MEM
(
pOptions
);
CHECK_OUT_OF_MEM
(
pOptions
);
pOptions
->
delay
=
TSDB_DEFAULT_ROLLUP_DELAY
;
pOptions
->
filesFactor
=
TSDB_DEFAULT_ROLLUP_FILE_FACTOR
;
pOptions
->
filesFactor
=
TSDB_DEFAULT_ROLLUP_FILE_FACTOR
;
pOptions
->
ttl
=
TSDB_DEFAULT_TABLE_TTL
;
pOptions
->
ttl
=
TSDB_DEFAULT_TABLE_TTL
;
return
(
SNode
*
)
pOptions
;
return
(
SNode
*
)
pOptions
;
...
@@ -867,7 +866,6 @@ SNode* createAlterTableOptions(SAstCreateContext* pCxt) {
...
@@ -867,7 +866,6 @@ SNode* createAlterTableOptions(SAstCreateContext* pCxt) {
CHECK_PARSER_STATUS
(
pCxt
);
CHECK_PARSER_STATUS
(
pCxt
);
STableOptions
*
pOptions
=
nodesMakeNode
(
QUERY_NODE_TABLE_OPTIONS
);
STableOptions
*
pOptions
=
nodesMakeNode
(
QUERY_NODE_TABLE_OPTIONS
);
CHECK_OUT_OF_MEM
(
pOptions
);
CHECK_OUT_OF_MEM
(
pOptions
);
pOptions
->
delay
=
-
1
;
pOptions
->
filesFactor
=
-
1
;
pOptions
->
filesFactor
=
-
1
;
pOptions
->
ttl
=
-
1
;
pOptions
->
ttl
=
-
1
;
return
(
SNode
*
)
pOptions
;
return
(
SNode
*
)
pOptions
;
...
@@ -882,9 +880,6 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
...
@@ -882,9 +880,6 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
sizeof
(((
STableOptions
*
)
pOptions
)
->
comment
));
sizeof
(((
STableOptions
*
)
pOptions
)
->
comment
));
}
}
break
;
break
;
case
TABLE_OPTION_DELAY
:
((
STableOptions
*
)
pOptions
)
->
delay
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
TABLE_OPTION_FILE_FACTOR
:
case
TABLE_OPTION_FILE_FACTOR
:
((
STableOptions
*
)
pOptions
)
->
filesFactor
=
taosStr2Float
(((
SToken
*
)
pVal
)
->
z
,
NULL
);
((
STableOptions
*
)
pOptions
)
->
filesFactor
=
taosStr2Float
(((
SToken
*
)
pVal
)
->
z
,
NULL
);
break
;
break
;
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
5ce92e62
...
@@ -53,7 +53,6 @@ static SKeyword keywordTable[] = {
...
@@ -53,7 +53,6 @@ static SKeyword keywordTable[] = {
{
"CACHE"
,
TK_CACHE
},
{
"CACHE"
,
TK_CACHE
},
{
"CACHELAST"
,
TK_CACHELAST
},
{
"CACHELAST"
,
TK_CACHELAST
},
{
"CAST"
,
TK_CAST
},
{
"CAST"
,
TK_CAST
},
{
"CGROUP"
,
TK_CGROUP
},
{
"CLUSTER"
,
TK_CLUSTER
},
{
"CLUSTER"
,
TK_CLUSTER
},
{
"COLUMN"
,
TK_COLUMN
},
{
"COLUMN"
,
TK_COLUMN
},
{
"COMMENT"
,
TK_COMMENT
},
{
"COMMENT"
,
TK_COMMENT
},
...
@@ -62,13 +61,13 @@ static SKeyword keywordTable[] = {
...
@@ -62,13 +61,13 @@ static SKeyword keywordTable[] = {
{
"CONNS"
,
TK_CONNS
},
{
"CONNS"
,
TK_CONNS
},
{
"CONNECTION"
,
TK_CONNECTION
},
{
"CONNECTION"
,
TK_CONNECTION
},
{
"CONNECTIONS"
,
TK_CONNECTIONS
},
{
"CONNECTIONS"
,
TK_CONNECTIONS
},
{
"CONSUMER"
,
TK_CONSUMER
},
{
"COUNT"
,
TK_COUNT
},
{
"COUNT"
,
TK_COUNT
},
{
"CREATE"
,
TK_CREATE
},
{
"CREATE"
,
TK_CREATE
},
{
"DATABASE"
,
TK_DATABASE
},
{
"DATABASE"
,
TK_DATABASE
},
{
"DATABASES"
,
TK_DATABASES
},
{
"DATABASES"
,
TK_DATABASES
},
{
"DAYS"
,
TK_DAYS
},
{
"DAYS"
,
TK_DAYS
},
{
"DBS"
,
TK_DBS
},
{
"DBS"
,
TK_DBS
},
{
"DELAY"
,
TK_DELAY
},
{
"DESC"
,
TK_DESC
},
{
"DESC"
,
TK_DESC
},
{
"DESCRIBE"
,
TK_DESCRIBE
},
{
"DESCRIBE"
,
TK_DESCRIBE
},
{
"DISTINCT"
,
TK_DISTINCT
},
{
"DISTINCT"
,
TK_DISTINCT
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
5ce92e62
...
@@ -465,20 +465,22 @@ static bool isPrimaryKey(STempTableNode* pTable, SNode* pExpr) {
...
@@ -465,20 +465,22 @@ static bool isPrimaryKey(STempTableNode* pTable, SNode* pExpr) {
return
isPrimaryKeyImpl
(
pTable
,
pExpr
);
return
isPrimaryKeyImpl
(
pTable
,
pExpr
);
}
}
static
bool
findAndSetColumn
(
SColumnNode
**
pColRef
,
const
STableNode
*
pTable
)
{
static
int32_t
findAndSetColumn
(
STranslateContext
*
pCxt
,
SColumnNode
**
pColRef
,
const
STableNode
*
pTable
,
bool
*
pFound
)
{
SColumnNode
*
pCol
=
*
pColRef
;
SColumnNode
*
pCol
=
*
pColRef
;
bool
f
ound
=
false
;
*
pF
ound
=
false
;
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
const
STableMeta
*
pMeta
=
((
SRealTableNode
*
)
pTable
)
->
pMeta
;
const
STableMeta
*
pMeta
=
((
SRealTableNode
*
)
pTable
)
->
pMeta
;
if
(
isInternalPrimaryKey
(
pCol
))
{
if
(
isInternalPrimaryKey
(
pCol
))
{
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
pMeta
->
schema
,
false
,
pCol
);
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
pMeta
->
schema
,
false
,
pCol
);
return
true
;
*
pFound
=
true
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
nums
=
pMeta
->
tableInfo
.
numOfTags
+
pMeta
->
tableInfo
.
numOfColumns
;
int32_t
nums
=
pMeta
->
tableInfo
.
numOfTags
+
pMeta
->
tableInfo
.
numOfColumns
;
for
(
int32_t
i
=
0
;
i
<
nums
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
nums
;
++
i
)
{
if
(
0
==
strcmp
(
pCol
->
colName
,
pMeta
->
schema
[
i
].
name
))
{
if
(
0
==
strcmp
(
pCol
->
colName
,
pMeta
->
schema
[
i
].
name
))
{
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
pMeta
->
schema
+
i
,
(
i
>=
pMeta
->
tableInfo
.
numOfColumns
),
pCol
);
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
pMeta
->
schema
+
i
,
(
i
>=
pMeta
->
tableInfo
.
numOfColumns
),
pCol
);
f
ound
=
true
;
*
pF
ound
=
true
;
break
;
break
;
}
}
}
}
...
@@ -489,13 +491,15 @@ static bool findAndSetColumn(SColumnNode** pColRef, const STableNode* pTable) {
...
@@ -489,13 +491,15 @@ static bool findAndSetColumn(SColumnNode** pColRef, const STableNode* pTable) {
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
if
(
0
==
strcmp
(
pCol
->
colName
,
pExpr
->
aliasName
)
||
if
(
0
==
strcmp
(
pCol
->
colName
,
pExpr
->
aliasName
)
||
(
isPrimaryKey
((
STempTableNode
*
)
pTable
,
pNode
)
&&
isInternalPrimaryKey
(
pCol
)))
{
(
isPrimaryKey
((
STempTableNode
*
)
pTable
,
pNode
)
&&
isInternalPrimaryKey
(
pCol
)))
{
if
(
*
pFound
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
pCol
->
colName
);
}
setColumnInfoByExpr
(
pTable
,
pExpr
,
pColRef
);
setColumnInfoByExpr
(
pTable
,
pExpr
,
pColRef
);
found
=
true
;
*
pFound
=
true
;
break
;
}
}
}
}
}
}
return
found
;
return
TSDB_CODE_SUCCESS
;
}
}
static
EDealRes
translateColumnWithPrefix
(
STranslateContext
*
pCxt
,
SColumnNode
**
pCol
)
{
static
EDealRes
translateColumnWithPrefix
(
STranslateContext
*
pCxt
,
SColumnNode
**
pCol
)
{
...
@@ -506,7 +510,12 @@ static EDealRes translateColumnWithPrefix(STranslateContext* pCxt, SColumnNode**
...
@@ -506,7 +510,12 @@ static EDealRes translateColumnWithPrefix(STranslateContext* pCxt, SColumnNode**
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
if
(
belongTable
(
pCxt
->
pParseCxt
->
db
,
(
*
pCol
),
pTable
))
{
if
(
belongTable
(
pCxt
->
pParseCxt
->
db
,
(
*
pCol
),
pTable
))
{
foundTable
=
true
;
foundTable
=
true
;
if
(
findAndSetColumn
(
pCol
,
pTable
))
{
bool
foundCol
=
false
;
pCxt
->
errCode
=
findAndSetColumn
(
pCxt
,
pCol
,
pTable
,
&
foundCol
);
if
(
TSDB_CODE_SUCCESS
!=
pCxt
->
errCode
)
{
return
DEAL_RES_ERROR
;
}
if
(
foundCol
)
{
break
;
break
;
}
}
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_COLUMN
,
(
*
pCol
)
->
colName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_COLUMN
,
(
*
pCol
)
->
colName
);
...
@@ -525,16 +534,21 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod
...
@@ -525,16 +534,21 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod
bool
isInternalPk
=
isInternalPrimaryKey
(
*
pCol
);
bool
isInternalPk
=
isInternalPrimaryKey
(
*
pCol
);
for
(
size_t
i
=
0
;
i
<
nums
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
nums
;
++
i
)
{
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
if
(
findAndSetColumn
(
pCol
,
pTable
))
{
bool
foundCol
=
false
;
pCxt
->
errCode
=
findAndSetColumn
(
pCxt
,
pCol
,
pTable
,
&
foundCol
);
if
(
TSDB_CODE_SUCCESS
!=
pCxt
->
errCode
)
{
return
DEAL_RES_ERROR
;
}
if
(
foundCol
)
{
if
(
found
)
{
if
(
found
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
(
*
pCol
)
->
colName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
(
*
pCol
)
->
colName
);
}
}
found
=
true
;
found
=
true
;
}
if
(
isInternalPk
)
{
if
(
isInternalPk
)
{
break
;
break
;
}
}
}
}
}
if
(
!
found
)
{
if
(
!
found
)
{
if
(
isInternalPk
)
{
if
(
isInternalPk
)
{
if
(
NULL
!=
pCxt
->
pCurrStmt
->
pWindow
)
{
if
(
NULL
!=
pCxt
->
pCurrStmt
->
pWindow
)
{
...
@@ -1939,7 +1953,9 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
...
@@ -1939,7 +1953,9 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
}
}
pCol
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
pCol
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
strcpy
(
pCol
->
colName
,
PK_TS_COL_INTERNAL_NAME
);
strcpy
(
pCol
->
colName
,
PK_TS_COL_INTERNAL_NAME
);
if
(
!
findAndSetColumn
(
&
pCol
,
pTable
))
{
bool
found
=
false
;
int32_t
code
=
findAndSetColumn
(
pCxt
,
&
pCol
,
pTable
,
&
found
);
if
(
TSDB_CODE_SUCCESS
!=
code
||
!
found
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TIMELINE_FUNC
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TIMELINE_FUNC
);
}
}
*
pPrimaryKey
=
(
SNode
*
)
pCol
;
*
pPrimaryKey
=
(
SNode
*
)
pCol
;
...
@@ -2617,10 +2633,7 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt
...
@@ -2617,10 +2633,7 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt
}
}
static
int32_t
checkCreateTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
static
int32_t
checkCreateTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
int32_t
code
=
checkRangeOption
(
pCxt
,
"delay"
,
pStmt
->
pOptions
->
delay
,
TSDB_MIN_ROLLUP_DELAY
,
TSDB_MAX_ROLLUP_DELAY
);
int32_t
code
=
checTableFactorOption
(
pCxt
,
pStmt
->
pOptions
->
filesFactor
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checTableFactorOption
(
pCxt
,
pStmt
->
pOptions
->
filesFactor
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTableRollupOption
(
pCxt
,
pStmt
->
pOptions
->
pRollupFuncs
);
code
=
checkTableRollupOption
(
pCxt
,
pStmt
->
pOptions
->
pRollupFuncs
);
}
}
...
@@ -2861,7 +2874,6 @@ static int32_t buildRollupAst(STranslateContext* pCxt, SCreateTableStmt* pStmt,
...
@@ -2861,7 +2874,6 @@ static int32_t buildRollupAst(STranslateContext* pCxt, SCreateTableStmt* pStmt,
static
int32_t
buildCreateStbReq
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
,
SMCreateStbReq
*
pReq
)
{
static
int32_t
buildCreateStbReq
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
,
SMCreateStbReq
*
pReq
)
{
pReq
->
igExists
=
pStmt
->
ignoreExists
;
pReq
->
igExists
=
pStmt
->
ignoreExists
;
pReq
->
xFilesFactor
=
pStmt
->
pOptions
->
filesFactor
;
pReq
->
xFilesFactor
=
pStmt
->
pOptions
->
filesFactor
;
pReq
->
delay
=
pStmt
->
pOptions
->
delay
;
pReq
->
ttl
=
pStmt
->
pOptions
->
ttl
;
pReq
->
ttl
=
pStmt
->
pOptions
->
ttl
;
columnDefNodeToField
(
pStmt
->
pCols
,
&
pReq
->
pColumns
);
columnDefNodeToField
(
pStmt
->
pCols
,
&
pReq
->
pColumns
);
columnDefNodeToField
(
pStmt
->
pTags
,
&
pReq
->
pTags
);
columnDefNodeToField
(
pStmt
->
pTags
,
&
pReq
->
pTags
);
...
...
source/libs/parser/src/sql.c
浏览文件 @
5ce92e62
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
5ce92e62
...
@@ -298,14 +298,12 @@ TEST_F(ParserInitialCTest, createStable) {
...
@@ -298,14 +298,12 @@ TEST_F(ParserInitialCTest, createStable) {
auto
setCreateStbReqFunc
=
[
&
](
const
char
*
pTbname
,
int8_t
igExists
=
0
,
auto
setCreateStbReqFunc
=
[
&
](
const
char
*
pTbname
,
int8_t
igExists
=
0
,
float
xFilesFactor
=
TSDB_DEFAULT_ROLLUP_FILE_FACTOR
,
float
xFilesFactor
=
TSDB_DEFAULT_ROLLUP_FILE_FACTOR
,
int32_t
delay
=
TSDB_DEFAULT_ROLLUP_DELAY
,
int32_t
ttl
=
TSDB_DEFAULT_TABLE_TTL
,
int32_t
ttl
=
TSDB_DEFAULT_TABLE_TTL
,
const
char
*
pComment
=
nullptr
)
{
const
char
*
pComment
=
nullptr
)
{
memset
(
&
expect
,
0
,
sizeof
(
SMCreateStbReq
));
memset
(
&
expect
,
0
,
sizeof
(
SMCreateStbReq
));
int32_t
len
=
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.test.%s"
,
pTbname
);
int32_t
len
=
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.test.%s"
,
pTbname
);
expect
.
name
[
len
]
=
'\0'
;
expect
.
name
[
len
]
=
'\0'
;
expect
.
igExists
=
igExists
;
expect
.
igExists
=
igExists
;
expect
.
xFilesFactor
=
xFilesFactor
;
expect
.
xFilesFactor
=
xFilesFactor
;
expect
.
delay
=
delay
;
expect
.
ttl
=
ttl
;
expect
.
ttl
=
ttl
;
if
(
nullptr
!=
pComment
)
{
if
(
nullptr
!=
pComment
)
{
expect
.
comment
=
strdup
(
pComment
);
expect
.
comment
=
strdup
(
pComment
);
...
@@ -393,7 +391,7 @@ TEST_F(ParserInitialCTest, createStable) {
...
@@ -393,7 +391,7 @@ TEST_F(ParserInitialCTest, createStable) {
addFieldToCreateStbReqFunc
(
false
,
"id"
,
TSDB_DATA_TYPE_INT
);
addFieldToCreateStbReqFunc
(
false
,
"id"
,
TSDB_DATA_TYPE_INT
);
run
(
"CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"
);
run
(
"CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"
);
setCreateStbReqFunc
(
"t1"
,
1
,
0.1
,
2
,
100
,
"test create table"
);
setCreateStbReqFunc
(
"t1"
,
1
,
0.1
,
100
,
"test create table"
);
addFieldToCreateStbReqFunc
(
true
,
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
,
0
,
0
);
addFieldToCreateStbReqFunc
(
true
,
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
,
0
,
0
);
addFieldToCreateStbReqFunc
(
true
,
"c1"
,
TSDB_DATA_TYPE_INT
);
addFieldToCreateStbReqFunc
(
true
,
"c1"
,
TSDB_DATA_TYPE_INT
);
addFieldToCreateStbReqFunc
(
true
,
"c2"
,
TSDB_DATA_TYPE_UINT
);
addFieldToCreateStbReqFunc
(
true
,
"c2"
,
TSDB_DATA_TYPE_UINT
);
...
@@ -431,7 +429,7 @@ TEST_F(ParserInitialCTest, createStable) {
...
@@ -431,7 +429,7 @@ TEST_F(ParserInitialCTest, createStable) {
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, "
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, "
"a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, "
"a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, "
"a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) "
"a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1
DELAY 2
"
);
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1"
);
}
}
TEST_F
(
ParserInitialCTest
,
createStream
)
{
TEST_F
(
ParserInitialCTest
,
createStream
)
{
...
@@ -464,7 +462,7 @@ TEST_F(ParserInitialCTest, createTable) {
...
@@ -464,7 +462,7 @@ TEST_F(ParserInitialCTest, createTable) {
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, a8 BINARY(20), "
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, a8 BINARY(20), "
"a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
"a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
"a14 NCHAR(30), a15 VARCHAR(50)) "
"a14 NCHAR(30), a15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1
DELAY 2
"
);
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1"
);
run
(
"CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy')"
);
run
(
"CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy')"
);
...
...
source/libs/parser/test/parInitialDTest.cpp
浏览文件 @
5ce92e62
...
@@ -32,7 +32,7 @@ TEST_F(ParserInitialDTest, dropBnode) {
...
@@ -32,7 +32,7 @@ TEST_F(ParserInitialDTest, dropBnode) {
run
(
"DROP BNODE ON DNODE 1"
);
run
(
"DROP BNODE ON DNODE 1"
);
}
}
// DROP CGROUP [ IF EXISTS ] cgroup_name ON topic_name
// DROP C
ONSUMER
GROUP [ IF EXISTS ] cgroup_name ON topic_name
TEST_F
(
ParserInitialDTest
,
dropCGroup
)
{
TEST_F
(
ParserInitialDTest
,
dropCGroup
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
...
@@ -56,10 +56,10 @@ TEST_F(ParserInitialDTest, dropCGroup) {
...
@@ -56,10 +56,10 @@ TEST_F(ParserInitialDTest, dropCGroup) {
});
});
setDropCgroupReqFunc
(
"tp1"
,
"cg1"
);
setDropCgroupReqFunc
(
"tp1"
,
"cg1"
);
run
(
"DROP CGROUP cg1 ON tp1"
);
run
(
"DROP C
ONSUMER
GROUP cg1 ON tp1"
);
setDropCgroupReqFunc
(
"tp1"
,
"cg1"
,
1
);
setDropCgroupReqFunc
(
"tp1"
,
"cg1"
,
1
);
run
(
"DROP CGROUP IF EXISTS cg1 ON tp1"
);
run
(
"DROP C
ONSUMER
GROUP IF EXISTS cg1 ON tp1"
);
}
}
// todo drop database
// todo drop database
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
5ce92e62
...
@@ -252,6 +252,8 @@ TEST_F(ParserSelectTest, semanticError) {
...
@@ -252,6 +252,8 @@ TEST_F(ParserSelectTest, semanticError) {
// TSDB_CODE_PAR_AMBIGUOUS_COLUMN
// TSDB_CODE_PAR_AMBIGUOUS_COLUMN
run
(
"SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1"
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
PARSER_STAGE_TRANSLATE
);
run
(
"SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1"
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
PARSER_STAGE_TRANSLATE
);
run
(
"SELECT c2 FROM (SELECT c1 c2, c2 FROM t1)"
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
PARSER_STAGE_TRANSLATE
);
// TSDB_CODE_PAR_WRONG_VALUE_TYPE
// TSDB_CODE_PAR_WRONG_VALUE_TYPE
run
(
"SELECT timestamp '2010a' FROM t1"
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
PARSER_STAGE_TRANSLATE
);
run
(
"SELECT timestamp '2010a' FROM t1"
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
PARSER_STAGE_TRANSLATE
);
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
5ce92e62
...
@@ -124,6 +124,7 @@ static int32_t createChildLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelec
...
@@ -124,6 +124,7 @@ static int32_t createChildLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelec
SLogicNode
*
pNode
=
NULL
;
SLogicNode
*
pNode
=
NULL
;
int32_t
code
=
func
(
pCxt
,
pSelect
,
&
pNode
);
int32_t
code
=
func
(
pCxt
,
pSelect
,
&
pNode
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pNode
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pNode
)
{
pNode
->
precision
=
pSelect
->
precision
;
code
=
pushLogicNode
(
pCxt
,
pRoot
,
pNode
);
code
=
pushLogicNode
(
pCxt
,
pRoot
,
pNode
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
...
@@ -400,6 +401,7 @@ static int32_t createLogicNodeByTable(SLogicPlanContext* pCxt, SSelectStmt* pSel
...
@@ -400,6 +401,7 @@ static int32_t createLogicNodeByTable(SLogicPlanContext* pCxt, SSelectStmt* pSel
nodesDestroyNode
(
pNode
);
nodesDestroyNode
(
pNode
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pNode
->
precision
=
pSelect
->
precision
;
*
pLogicNode
=
pNode
;
*
pLogicNode
=
pNode
;
}
}
return
code
;
return
code
;
...
...
tests/script/tsim/insert/update0.sim
浏览文件 @
5ce92e62
...
@@ -9,7 +9,7 @@ sql create database d0 keep 365000d,365000d,365000d
...
@@ -9,7 +9,7 @@ sql create database d0 keep 365000d,365000d,365000d
sql use d0
sql use d0
print =============== create super table and register rsma
print =============== create super table and register rsma
sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1
delay 2
;
sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1;
sql show stables
sql show stables
if $rows != 1 then
if $rows != 1 then
...
...
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
浏览文件 @
5ce92e62
...
@@ -9,7 +9,7 @@ sql create database d0 retentions 15s:7d,1m:21d,15m:365d;
...
@@ -9,7 +9,7 @@ sql create database d0 retentions 15s:7d,1m:21d,15m:365d;
sql use d0
sql use d0
print =============== create super table and register rsma
print =============== create super table and register rsma
sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1
delay 2
;
sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1;
sql show stables
sql show stables
if $rows != 1 then
if $rows != 1 then
...
...
tests/system-test/fulltest.sh
浏览文件 @
5ce92e62
...
@@ -72,7 +72,9 @@ python3 ./test.py -f 2-query/arccos.py
...
@@ -72,7 +72,9 @@ python3 ./test.py -f 2-query/arccos.py
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/query_cols_tags_and_or.py
python3 ./test.py
-f
2-query/query_cols_tags_and_or.py
# python3 ./test.py -f 2-query/nestedQuery.py
# python3 ./test.py -f 2-query/nestedQuery.py
python3 ./test.py
-f
2-query/nestedQuery_str.py
# TD-15983 subquery output duplicate name column.
# Please Xiangyang Guo modify the following script
# python3 ./test.py -f 2-query/nestedQuery_str.py
python3 ./test.py
-f
2-query/avg.py
python3 ./test.py
-f
2-query/avg.py
python3 ./test.py
-f
2-query/elapsed.py
python3 ./test.py
-f
2-query/elapsed.py
python3 ./test.py
-f
2-query/csum.py
python3 ./test.py
-f
2-query/csum.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录