Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a63b848a
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a63b848a
编写于
1月 16, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory leaks
上级
eb2def1e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
19 deletion
+24
-19
src/client/src/tscAst.c
src/client/src/tscAst.c
+3
-3
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+2
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+10
-5
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+8
-7
src/util/src/ttypes.c
src/util/src/ttypes.c
+1
-2
未找到文件。
src/client/src/tscAst.c
浏览文件 @
a63b848a
...
...
@@ -492,12 +492,12 @@ static void setInitialValueForRangeQueryCondition(tSKipListQueryCond *q, int8_t
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_BINARY
:
{
q
->
upperBnd
.
nType
=
type
;
q
->
upperBnd
.
pz
=
"
\0
"
;
q
->
upperBnd
.
pz
=
NULL
;
q
->
upperBnd
.
nLen
=
-
1
;
q
->
lowerBnd
.
nType
=
type
;
q
->
lowerBnd
.
pz
=
"
\0
"
;
q
->
lowerBnd
.
nLen
=
0
;
q
->
lowerBnd
.
pz
=
NULL
;
q
->
lowerBnd
.
nLen
=
-
1
;
}
}
}
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
a63b848a
...
...
@@ -3272,7 +3272,7 @@ char *arithmetic_callback_function(void *param, char *name, int32_t colId) {
static
void
arithmetic_function
(
SQLFunctionCtx
*
pCtx
)
{
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
pCtx
->
size
;
SArithmeticSupport
*
sas
=
(
SArithmeticSupport
*
)
pCtx
->
param
[
0
].
pz
;
SArithmeticSupport
*
sas
=
(
SArithmeticSupport
*
)
pCtx
->
param
[
1
].
pz
;
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
pCtx
->
size
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
arithmetic_callback_function
);
...
...
@@ -3282,7 +3282,7 @@ static void arithmetic_function(SQLFunctionCtx *pCtx) {
static
void
arithmetic_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
INC_INIT_VAL
(
pCtx
,
1
);
SArithmeticSupport
*
sas
=
(
SArithmeticSupport
*
)
pCtx
->
param
[
0
].
pz
;
SArithmeticSupport
*
sas
=
(
SArithmeticSupport
*
)
pCtx
->
param
[
1
].
pz
;
sas
->
offset
=
index
;
tSQLBinaryExprCalcTraverse
(
sas
->
pExpr
->
pBinExprInfo
.
pBinExpr
,
1
,
pCtx
->
aOutputBuf
,
sas
,
pCtx
->
order
,
...
...
src/client/src/tscSQLParser.c
浏览文件 @
a63b848a
...
...
@@ -5205,6 +5205,13 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t tableIn
}
}
// limit the output to be 1 for each state value
static
void
doLimitOutputNormalColOfGroupby
(
SSqlExpr
*
pExpr
)
{
int32_t
outputRow
=
1
;
tVariantCreateFromBinary
(
&
pExpr
->
param
[
0
],
(
char
*
)
&
outputRow
,
sizeof
(
int32_t
),
TSDB_DATA_TYPE_INT
);
pExpr
->
numOfParams
=
1
;
}
void
doAddGroupColumnForSubquery
(
SSqlCmd
*
pCmd
,
int32_t
tagIndex
)
{
int32_t
index
=
pCmd
->
groupbyExpr
.
columnInfo
[
tagIndex
].
colIdx
;
...
...
@@ -5217,9 +5224,8 @@ void doAddGroupColumnForSubquery(SSqlCmd* pCmd, int32_t tagIndex) {
pSchema
->
bytes
,
pSchema
->
bytes
);
pExpr
->
colInfo
.
flag
=
TSDB_COL_NORMAL
;
pExpr
->
param
[
0
].
i64Key
=
1
;
pExpr
->
numOfParams
=
1
;
doLimitOutputNormalColOfGroupby
(
pExpr
);
// NOTE: tag column does not add to source column list
SColumnList
list
=
{
0
};
list
.
num
=
1
;
...
...
@@ -5263,8 +5269,7 @@ static void doUpdateSqlFunctionForColPrj(SSqlCmd* pCmd) {
for
(
int32_t
j
=
0
;
j
<
pCmd
->
groupbyExpr
.
numOfGroupCols
;
++
j
)
{
if
(
pExpr
->
colInfo
.
colId
==
pCmd
->
groupbyExpr
.
columnInfo
[
j
].
colId
)
{
qualifiedCol
=
true
;
pExpr
->
param
[
0
].
i64Key
=
1
;
// limit the output to be 1 for each state value
doLimitOutputNormalColOfGroupby
(
pExpr
);
pExpr
->
numOfParams
=
1
;
break
;
}
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
a63b848a
...
...
@@ -2028,7 +2028,7 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, int64_t startQueryTimes
pCtx
->
ptsList
=
(
int64_t
*
)(
primaryColumnData
+
startOffset
*
TSDB_KEYSIZE
);
}
else
if
(
functionId
==
TSDB_FUNC_ARITHM
)
{
pCtx
->
param
[
0
].
pz
=
param
;
pCtx
->
param
[
1
].
pz
=
param
;
}
pCtx
->
startOffset
=
startOffset
;
...
...
@@ -2117,14 +2117,15 @@ static int32_t setupQueryRuntimeEnv(SMeterObj *pMeterObj, SQuery *pQuery, SQuery
pCtx
->
order
=
pQuery
->
order
.
order
;
pCtx
->
functionId
=
pSqlFuncMsg
->
functionId
;
/*
* tricky: in case of char array parameters, we employ the shallow copy
* method and get the ownership of the char array, it later release the allocated memory if exists
*/
pCtx
->
numOfParams
=
pSqlFuncMsg
->
numOfParams
;
for
(
int32_t
j
=
0
;
j
<
pCtx
->
numOfParams
;
++
j
)
{
pCtx
->
param
[
j
].
nType
=
pSqlFuncMsg
->
arg
[
j
].
argType
;
pCtx
->
param
[
j
].
i64Key
=
pSqlFuncMsg
->
arg
[
j
].
argValue
.
i64
;
int16_t
type
=
pSqlFuncMsg
->
arg
[
j
].
argType
;
int16_t
bytes
=
pSqlFuncMsg
->
arg
[
j
].
argBytes
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
tVariantCreateFromBinary
(
&
pCtx
->
param
[
j
],
pSqlFuncMsg
->
arg
->
argValue
.
pz
,
bytes
,
type
);
}
else
{
tVariantCreateFromBinary
(
&
pCtx
->
param
[
j
],
(
char
*
)
&
pSqlFuncMsg
->
arg
[
j
].
argValue
.
i64
,
bytes
,
type
);
}
}
// set the order information for top/bottom query
...
...
src/util/src/ttypes.c
浏览文件 @
a63b848a
...
...
@@ -163,10 +163,9 @@ void tVariantCreateFromBinary(tVariant *pVar, char *pz, uint32_t len, uint32_t t
void
tVariantDestroy
(
tVariant
*
pVar
)
{
if
(
pVar
==
NULL
)
return
;
if
(
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
&&
pVar
->
nLen
>
0
)
{
if
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
free
(
pVar
->
pz
);
pVar
->
pz
=
NULL
;
pVar
->
nLen
=
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录