Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d937ce6d
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看板
提交
d937ce6d
编写于
11月 03, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add json tag support for group by
上级
50b82d68
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-11
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
d937ce6d
...
@@ -5926,7 +5926,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5926,7 +5926,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
}
}
// handle the first part of order by
// handle the first part of order by
tVariant
*
pVar
=
taosArrayGet
(
pSortOrder
,
0
)
;
tVariant
*
pVar
=
&
((
CommonItem
*
)
taosArrayGet
(
pSortOrder
,
0
))
->
pVar
;
// e.g., order by 1 asc, return directly with out further check.
// e.g., order by 1 asc, return directly with out further check.
if
(
pVar
->
nType
>=
TSDB_DATA_TYPE_TINYINT
&&
pVar
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
if
(
pVar
->
nType
>=
TSDB_DATA_TYPE_TINYINT
&&
pVar
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
...
@@ -5996,10 +5996,10 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5996,10 +5996,10 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
if
(
orderByTags
)
{
if
(
orderByTags
)
{
pQueryInfo
->
groupbyExpr
.
orderIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
pQueryInfo
->
groupbyExpr
.
orderIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
tVariantList
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
}
else
if
(
orderByGroupbyCol
)
{
}
else
if
(
orderByGroupbyCol
)
{
tVariantList
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
...
@@ -6020,12 +6020,12 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6020,12 +6020,12 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
return
invalidOperationMsg
(
pMsgBuf
,
msg5
);
return
invalidOperationMsg
(
pMsgBuf
,
msg5
);
}
}
tVariantList
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
order
.
order
=
p1
->
sortOrder
;
pQueryInfo
->
order
.
order
=
p1
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
}
else
{
tVariantList
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
if
(
udf
)
{
if
(
udf
)
{
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
...
@@ -6051,7 +6051,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6051,7 +6051,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
}
}
}
}
}
else
{
}
else
{
tVariantList
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
if
(
orderByTags
)
{
if
(
orderByTags
)
{
pQueryInfo
->
groupbyExpr
.
orderIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
pQueryInfo
->
groupbyExpr
.
orderIndex
=
index
.
columnIndex
-
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
pQueryInfo
->
groupbyExpr
.
orderType
=
pItem
->
sortOrder
;
pQueryInfo
->
groupbyExpr
.
orderType
=
pItem
->
sortOrder
;
...
@@ -6079,7 +6079,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6079,7 +6079,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
return
invalidOperationMsg
(
pMsgBuf
,
msg6
);
return
invalidOperationMsg
(
pMsgBuf
,
msg6
);
}
else
{
}
else
{
tVariantList
Item
*
p1
=
taosArrayGet
(
pSortOrder
,
1
);
Common
Item
*
p1
=
taosArrayGet
(
pSortOrder
,
1
);
pQueryInfo
->
order
.
order
=
p1
->
sortOrder
;
pQueryInfo
->
order
.
order
=
p1
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
pQueryInfo
->
order
.
orderColId
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
}
}
...
@@ -6110,7 +6110,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6110,7 +6110,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
}
}
tVariantList
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
groupbyExpr
.
orderIndex
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
groupbyExpr
.
orderIndex
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
pQueryInfo
->
groupbyExpr
.
orderType
=
p1
->
sortOrder
;
}
}
...
@@ -6136,7 +6136,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6136,7 +6136,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
}
}
}
}
tVariantList
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
...
@@ -6147,7 +6147,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6147,7 +6147,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
}
}
tVariantList
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
}
else
{
}
else
{
...
@@ -6163,7 +6163,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -6163,7 +6163,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
return
invalidOperationMsg
(
pMsgBuf
,
msg11
);
}
}
tVariantList
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
Common
Item
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录