Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e3fc92c9
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看板
提交
e3fc92c9
编写于
11月 24, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] fix bugs.
上级
f26fc83b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
8 deletion
+16
-8
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+13
-5
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-3
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
e3fc92c9
...
...
@@ -1767,10 +1767,10 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
return
TSDB_CODE_SUCCESS
;
}
void
setResultColName
(
char
*
name
,
tSQLExprItem
*
pItem
,
int32_t
functionId
,
SStrToken
*
pToken
)
{
void
setResultColName
(
char
*
name
,
tSQLExprItem
*
pItem
,
int32_t
functionId
,
SStrToken
*
pToken
,
bool
multiCols
)
{
if
(
pItem
->
aliasName
!=
NULL
)
{
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
}
else
{
}
else
if
(
multiCols
)
{
char
uname
[
TSDB_COL_NAME_LEN
]
=
{
0
};
int32_t
len
=
MIN
(
pToken
->
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
uname
,
pToken
->
z
,
len
);
...
...
@@ -1781,6 +1781,9 @@ void setResultColName(char* name, tSQLExprItem* pItem, int32_t functionId, SStrT
snprintf
(
tmp
,
size
,
"%s(%s)"
,
aAggs
[
functionId
].
aName
,
uname
);
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
}
else
{
// use the user-input result column name
int32_t
len
=
MIN
(
pItem
->
pNode
->
token
.
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
pItem
->
pNode
->
token
.
z
,
len
);
}
}
...
...
@@ -2055,7 +2058,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
for
(
int32_t
j
=
0
;
j
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
++
j
)
{
index
.
columnIndex
=
j
;
SStrToken
t
=
{.
z
=
pSchema
[
j
].
name
,
.
n
=
(
uint32_t
)
strnlen
(
pSchema
[
j
].
name
,
TSDB_COL_NAME_LEN
)};
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
t
);
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
t
,
true
);
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
&
pSchema
[
j
],
cvtFunc
,
name
,
colIndex
++
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -2077,7 +2080,9 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
SSchema
*
pSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
index
.
columnIndex
);
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
pParamElem
->
pNode
->
colInfo
);
bool
multiColOutput
=
pItem
->
pNode
->
pParam
->
nExpr
>
1
;
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
pParamElem
->
pNode
->
colInfo
,
multiColOutput
);
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
pSchema
,
cvtFunc
,
name
,
colIndex
+
i
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -2119,7 +2124,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
SStrToken
t
=
{.
z
=
pSchema
[
i
].
name
,
.
n
=
(
uint32_t
)
strnlen
(
pSchema
[
i
].
name
,
TSDB_COL_NAME_LEN
)};
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
t
);
setResultColName
(
name
,
pItem
,
cvtFunc
.
originFuncId
,
&
t
,
true
);
if
(
setExprInfoForFunctions
(
pCmd
,
pQueryInfo
,
&
pSchema
[
index
.
columnIndex
],
cvtFunc
,
name
,
colIndex
,
&
index
,
finalResult
)
!=
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -4243,6 +4248,9 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE
tExprTreeDestroy
(
&
p
,
NULL
);
taosArrayDestroy
(
colList
);
if
(
taosArrayGetSize
(
pQueryInfo
->
tagCond
.
pCond
)
>
0
&&
!
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"filter on tag not supported for normal table"
);
}
}
pCondExpr
->
pTagCond
=
NULL
;
...
...
src/query/src/qExecutor.c
浏览文件 @
e3fc92c9
...
...
@@ -947,10 +947,10 @@ static char *getDataBlock(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sas
if
(
functionId
==
TSDB_FUNC_ARITHM
)
{
sas
->
pArithExpr
=
&
pQuery
->
pExpr1
[
col
];
sas
->
offset
=
pQuery
->
pos
;
sas
->
colList
=
pQuery
->
colList
;
sas
->
offset
=
(
QUERY_IS_ASC_QUERY
(
pQuery
))
?
pQuery
->
pos
:
pQuery
->
pos
-
(
size
-
1
)
;
sas
->
colList
=
pQuery
->
colList
;
sas
->
numOfCols
=
pQuery
->
numOfCols
;
sas
->
data
=
calloc
(
pQuery
->
numOfCols
,
POINTER_BYTES
);
sas
->
data
=
calloc
(
pQuery
->
numOfCols
,
POINTER_BYTES
);
if
(
sas
->
data
==
NULL
)
{
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录