Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3dbb5554
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
3dbb5554
编写于
7月 05, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: last(*)/frist(*), etc. do not return the tag column
上级
24d0fc45
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
18 deletion
+16
-18
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+11
-13
tests/script/tsim/stable/tag_modify.sim
tests/script/tsim/stable/tag_modify.sim
+2
-2
tests/script/tsim/stable/tag_rename.sim
tests/script/tsim/stable/tag_rename.sim
+3
-3
未找到文件。
source/libs/parser/src/parTranslater.c
浏览文件 @
3dbb5554
...
...
@@ -558,11 +558,11 @@ static void setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SColum
pCol
->
node
.
resType
=
pExpr
->
resType
;
}
static
int32_t
createColumnsByTable
(
STranslateContext
*
pCxt
,
const
STableNode
*
pTable
,
SNodeList
*
pList
)
{
static
int32_t
createColumnsByTable
(
STranslateContext
*
pCxt
,
const
STableNode
*
pTable
,
bool
igTags
,
SNodeList
*
pList
)
{
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
const
STableMeta
*
pMeta
=
((
SRealTableNode
*
)
pTable
)
->
pMeta
;
int32_t
nums
=
pMeta
->
tableInfo
.
numOfColumns
+
((
TSDB_SUPER_TABLE
==
pMeta
->
tableType
)
?
pMeta
->
tableInfo
.
numOfTags
:
0
);
int32_t
nums
=
pMeta
->
tableInfo
.
numOfColumns
+
(
igTags
?
0
:
((
TSDB_SUPER_TABLE
==
pMeta
->
tableType
)
?
pMeta
->
tableInfo
.
numOfTags
:
0
)
);
for
(
int32_t
i
=
0
;
i
<
nums
;
++
i
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN
);
if
(
NULL
==
pCol
)
{
...
...
@@ -1934,7 +1934,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
return
code
;
}
static
int32_t
createAllColumns
(
STranslateContext
*
pCxt
,
SNodeList
**
pCols
)
{
static
int32_t
createAllColumns
(
STranslateContext
*
pCxt
,
bool
igTags
,
SNodeList
**
pCols
)
{
*
pCols
=
nodesMakeList
();
if
(
NULL
==
*
pCols
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_OUT_OF_MEMORY
);
...
...
@@ -1943,7 +1943,7 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) {
size_t
nums
=
taosArrayGetSize
(
pTables
);
for
(
size_t
i
=
0
;
i
<
nums
;
++
i
)
{
STableNode
*
pTable
=
taosArrayGetP
(
pTables
,
i
);
int32_t
code
=
createColumnsByTable
(
pCxt
,
pTable
,
*
pCols
);
int32_t
code
=
createColumnsByTable
(
pCxt
,
pTable
,
igTags
,
*
pCols
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
...
...
@@ -1980,7 +1980,7 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) {
return
(
SNode
*
)
pFunc
;
}
static
int32_t
createTableAllCols
(
STranslateContext
*
pCxt
,
SColumnNode
*
pCol
,
SNodeList
**
pOutput
)
{
static
int32_t
createTableAllCols
(
STranslateContext
*
pCxt
,
SColumnNode
*
pCol
,
bool
igTags
,
SNodeList
**
pOutput
)
{
STableNode
*
pTable
=
NULL
;
int32_t
code
=
findTable
(
pCxt
,
pCol
->
tableAlias
,
&
pTable
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
==
*
pOutput
)
{
...
...
@@ -1990,7 +1990,7 @@ static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SN
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createColumnsByTable
(
pCxt
,
pTable
,
*
pOutput
);
code
=
createColumnsByTable
(
pCxt
,
pTable
,
igTags
,
*
pOutput
);
}
return
code
;
}
...
...
@@ -2012,11 +2012,9 @@ static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrc
SNode
*
pPara
=
NULL
;
FOREACH
(
pPara
,
pSrcParas
)
{
if
(
isStar
(
pPara
))
{
code
=
createAllColumns
(
pCxt
,
&
pExprs
);
// The syntax definition ensures that * and other parameters do not appear at the same time
break
;
code
=
createAllColumns
(
pCxt
,
true
,
&
pExprs
);
}
else
if
(
isTableStar
(
pPara
))
{
code
=
createTableAllCols
(
pCxt
,
(
SColumnNode
*
)
pPara
,
&
pExprs
);
code
=
createTableAllCols
(
pCxt
,
(
SColumnNode
*
)
pPara
,
true
,
&
pExprs
);
}
else
{
code
=
nodesListMakeStrictAppend
(
&
pExprs
,
nodesCloneNode
(
pPara
));
}
...
...
@@ -2075,7 +2073,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
isStar
(
pNode
))
{
SNodeList
*
pCols
=
NULL
;
code
=
createAllColumns
(
pCxt
,
&
pCols
);
code
=
createAllColumns
(
pCxt
,
false
,
&
pCols
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
INSERT_LIST
(
pSelect
->
pProjectionList
,
pCols
);
ERASE_NODE
(
pSelect
->
pProjectionList
);
...
...
@@ -2091,7 +2089,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
}
else
if
(
isTableStar
(
pNode
))
{
SNodeList
*
pCols
=
NULL
;
code
=
createTableAllCols
(
pCxt
,
(
SColumnNode
*
)
pNode
,
&
pCols
);
code
=
createTableAllCols
(
pCxt
,
(
SColumnNode
*
)
pNode
,
false
,
&
pCols
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
INSERT_LIST
(
pSelect
->
pProjectionList
,
pCols
);
ERASE_NODE
(
pSelect
->
pProjectionList
);
...
...
tests/script/tsim/stable/tag_modify.sim
浏览文件 @
3dbb5554
...
...
@@ -14,7 +14,7 @@ sql_error alter table db.stb MODIFY tag ts int
sql_error alter table db.stb MODIFY tag t2 binary(3)
sql_error alter table db.stb MODIFY tag t2 int
sql_error alter table db.stb MODIFY tag t1 int
sql create table db.ctb using db.stb tags(101, "123
45
")
sql create table db.ctb using db.stb tags(101, "123")
sql insert into db.ctb values(now, 1, "1234")
sql select * from db.stb
...
...
@@ -32,7 +32,7 @@ endi
if $data[0][3] != 101 then
return -1
endi
if $data[0][4] != 123
4
then
if $data[0][4] != 123 then
return -1
endi
...
...
tests/script/tsim/stable/tag_rename.sim
浏览文件 @
3dbb5554
...
...
@@ -14,7 +14,7 @@ sql_error alter table db.stb rename tag ts c3
sql_error alter table db.stb rename tag t2 t1
sql_error alter table db.stb rename tag t2 t2
sql_error alter table db.stb rename tag t1 t2
sql create table db.ctb using db.stb tags(101, "123
45
")
sql create table db.ctb using db.stb tags(101, "123")
sql insert into db.ctb values(now, 1, "1234")
sql select * from db.stb
...
...
@@ -32,7 +32,7 @@ endi
if $data[0][3] != 101 then
return -1
endi
if $data[0][4] != 123
4
then
if $data[0][4] != 123 then
return -1
endi
...
...
@@ -56,7 +56,7 @@ endi
if $data[0][3] != 101 then
return -1
endi
if $data[0][4] != 123
4
then
if $data[0][4] != 123 then
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录