Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
64a2c841
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
64a2c841
编写于
5月 05, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-168] fix bug in group by tbname
上级
2383e1e0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
7 deletion
+22
-7
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+18
-3
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+2
-2
未找到文件。
src/client/src/tscFunctionImpl.c
浏览文件 @
64a2c841
...
@@ -2965,14 +2965,28 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
...
@@ -2965,14 +2965,28 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
assert
(
pCtx
->
inputBytes
==
pCtx
->
outputBytes
);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
outputType
);
char
*
output
=
pCtx
->
aOutputBuf
;
if
(
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
}
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
outputType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
}
}
}
}
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
static
void
tag_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
INC_INIT_VAL
(
pCtx
,
1
);
INC_INIT_VAL
(
pCtx
,
1
);
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
char
*
output
=
pCtx
->
aOutputBuf
;
if
(
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
}
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
tag
.
nType
);
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
}
}
...
@@ -3007,7 +3021,8 @@ static void tag_function_f(SQLFunctionCtx *pCtx, int32_t index) {
...
@@ -3007,7 +3021,8 @@ static void tag_function_f(SQLFunctionCtx *pCtx, int32_t index) {
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
*
(
int16_t
*
)
output
=
pCtx
->
tag
.
nLen
;
output
+=
VARSTR_HEADER_SIZE
;
output
+=
VARSTR_HEADER_SIZE
;
}
}
tVariantDump
(
&
pCtx
->
tag
,
pCtx
->
aOutputBuf
,
pCtx
->
tag
.
nType
);
tVariantDump
(
&
pCtx
->
tag
,
output
,
pCtx
->
tag
.
nType
);
}
}
static
void
copy_function
(
SQLFunctionCtx
*
pCtx
)
{
static
void
copy_function
(
SQLFunctionCtx
*
pCtx
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
64a2c841
...
@@ -5132,7 +5132,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
...
@@ -5132,7 +5132,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
int16_t
colIndex
=
pColIndex
->
colIndex
;
int16_t
colIndex
=
pColIndex
->
colIndex
;
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
type
=
TSDB_DATA_TYPE_BINARY
;
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
// todo extract method
name
=
TSQL_TBNAME_L
;
name
=
TSQL_TBNAME_L
;
}
else
{
}
else
{
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
...
...
src/client/src/tscUtil.c
浏览文件 @
64a2c841
...
@@ -2134,7 +2134,7 @@ char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t colum
...
@@ -2134,7 +2134,7 @@ char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t colum
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
varDataLen
(
pData
);
int32_t
realLen
=
varDataLen
(
pData
);
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
*
(
char
*
)
(
pData
+
realLen
+
sizeof
(
int16_t
)
)
=
0
;
*
(
char
*
)
(
pData
+
realLen
+
VARSTR_HEADER_SIZE
)
=
0
;
}
}
return
pData
+
VARSTR_HEADER_SIZE
;
// head is the length of binary/nchar data
return
pData
+
VARSTR_HEADER_SIZE
;
// head is the length of binary/nchar data
...
...
src/query/src/queryExecutor.c
浏览文件 @
64a2c841
...
@@ -1427,7 +1427,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
...
@@ -1427,7 +1427,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
int32_t
index
=
pSqlFuncMsg
->
colInfo
.
colIndex
;
int32_t
index
=
pSqlFuncMsg
->
colInfo
.
colIndex
;
if
(
TSDB_COL_IS_TAG
(
pIndex
->
flag
))
{
if
(
TSDB_COL_IS_TAG
(
pIndex
->
flag
))
{
if
(
pIndex
->
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
pIndex
->
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
pCtx
->
inputBytes
=
TSDB_TABLE_NAME_LEN
;
pCtx
->
inputBytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pCtx
->
inputType
=
TSDB_DATA_TYPE_BINARY
;
pCtx
->
inputType
=
TSDB_DATA_TYPE_BINARY
;
}
else
{
}
else
{
pCtx
->
inputBytes
=
pQuery
->
tagColList
[
index
].
bytes
;
pCtx
->
inputBytes
=
pQuery
->
tagColList
[
index
].
bytes
;
...
@@ -5528,7 +5528,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
...
@@ -5528,7 +5528,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
bytes
=
tDataTypeDesc
[
type
].
nSize
;
bytes
=
tDataTypeDesc
[
type
].
nSize
;
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
// parse the normal column
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
// parse the normal column
type
=
TSDB_DATA_TYPE_BINARY
;
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
}
else
{
}
else
{
int32_t
j
=
getColumnIndexInSource
(
pQueryMsg
,
&
pExprs
[
i
].
base
,
pTagCols
);
int32_t
j
=
getColumnIndexInSource
(
pQueryMsg
,
&
pExprs
[
i
].
base
,
pTagCols
);
assert
(
j
<
pQueryMsg
->
numOfCols
||
j
<
pQueryMsg
->
numOfTags
);
assert
(
j
<
pQueryMsg
->
numOfCols
||
j
<
pQueryMsg
->
numOfTags
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录