Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
73fcf1e1
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看板
提交
73fcf1e1
编写于
8月 25, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1151]
上级
2271ac92
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
40 addition
and
44 deletion
+40
-44
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+22
-17
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+18
-27
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
73fcf1e1
...
@@ -433,16 +433,25 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
...
@@ -433,16 +433,25 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
int32_t
bytes
=
pInfo
->
pSqlExpr
->
resBytes
;
int32_t
bytes
=
pInfo
->
pSqlExpr
->
resBytes
;
char
*
pData
=
pRes
->
data
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
+
bytes
*
pRes
->
row
;
char
*
pData
=
pRes
->
data
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
+
bytes
*
pRes
->
row
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
varDataLen
(
pData
);
assert
(
realLen
<=
bytes
-
VARSTR_HEADER_SIZE
);
if
(
isNull
(
pData
,
type
))
{
// user defined constant value output columns
pRes
->
tsrow
[
columnIndex
]
=
NULL
;
if
(
pInfo
->
pSqlExpr
->
colInfo
.
flag
==
TSDB_COL_UDC
)
{
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
pData
=
pInfo
->
pSqlExpr
->
param
[
1
].
pz
;
pRes
->
length
[
columnIndex
]
=
pInfo
->
pSqlExpr
->
param
[
1
].
nLen
;
pRes
->
tsrow
[
columnIndex
]
=
(
pInfo
->
pSqlExpr
->
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
?
NULL
:
pData
;
}
else
{
}
else
{
pRes
->
tsrow
[
columnIndex
]
=
((
tstr
*
)
pData
)
->
data
;
assert
(
bytes
==
tDataTypeDesc
[
type
].
nSize
);
pRes
->
tsrow
[
columnIndex
]
=
isNull
(
pData
,
type
)
?
NULL
:
&
pInfo
->
pSqlExpr
->
param
[
1
].
i64Key
;
pRes
->
length
[
columnIndex
]
=
bytes
;
}
}
}
else
{
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
varDataLen
(
pData
);
assert
(
realLen
<=
bytes
-
VARSTR_HEADER_SIZE
);
pRes
->
tsrow
[
columnIndex
]
=
(
isNull
(
pData
,
type
))
?
NULL
:
((
tstr
*
)
pData
)
->
data
;
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
VARSTR_HEADER_SIZE
)
{
// todo refactor
*
(
pData
+
realLen
+
VARSTR_HEADER_SIZE
)
=
0
;
*
(
pData
+
realLen
+
VARSTR_HEADER_SIZE
)
=
0
;
}
}
...
@@ -451,14 +460,10 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
...
@@ -451,14 +460,10 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
}
else
{
}
else
{
assert
(
bytes
==
tDataTypeDesc
[
type
].
nSize
);
assert
(
bytes
==
tDataTypeDesc
[
type
].
nSize
);
if
(
isNull
(
pData
,
type
))
{
pRes
->
tsrow
[
columnIndex
]
=
isNull
(
pData
,
type
)
?
NULL
:
pData
;
pRes
->
tsrow
[
columnIndex
]
=
NULL
;
}
else
{
pRes
->
tsrow
[
columnIndex
]
=
pData
;
}
pRes
->
length
[
columnIndex
]
=
bytes
;
pRes
->
length
[
columnIndex
]
=
bytes
;
}
}
}
}
}
extern
void
*
tscCacheHandle
;
extern
void
*
tscCacheHandle
;
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
73fcf1e1
...
@@ -2902,17 +2902,11 @@ static FORCE_INLINE void date_col_output_function_f(SQLFunctionCtx *pCtx, int32_
...
@@ -2902,17 +2902,11 @@ static FORCE_INLINE void date_col_output_function_f(SQLFunctionCtx *pCtx, int32_
}
}
static
void
col_project_function
(
SQLFunctionCtx
*
pCtx
)
{
static
void
col_project_function
(
SQLFunctionCtx
*
pCtx
)
{
if
(
pCtx
->
numOfParams
==
2
)
{
// the number of output rows should not affect the final number of rows, so set it to be 0
// the number of output rows should not affect the final number of rows, so set it to be 0
SET_VAL
(
pCtx
,
pCtx
->
size
,
1
);
if
(
pCtx
->
numOfParams
==
2
)
{
return
;
char
*
output
=
pCtx
->
aOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
tVariantDump
(
&
pCtx
->
param
[
1
],
output
,
pCtx
->
outputType
,
true
);
output
+=
pCtx
->
outputBytes
;
}
}
}
else
{
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
INC_INIT_VAL
(
pCtx
,
pCtx
->
size
);
char
*
pData
=
GET_INPUT_CHAR
(
pCtx
);
char
*
pData
=
GET_INPUT_CHAR
(
pCtx
);
...
@@ -2924,27 +2918,24 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
...
@@ -2924,27 +2918,24 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
pCtx
->
inputBytes
);
pCtx
->
inputBytes
);
}
}
}
}
}
pCtx
->
aOutputBuf
+=
pCtx
->
size
*
pCtx
->
outputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
size
*
pCtx
->
outputBytes
;
}
}
static
void
col_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
static
void
col_project_function_f
(
SQLFunctionCtx
*
pCtx
,
int32_t
index
)
{
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
if
(
pCtx
->
numOfParams
==
2
)
{
// the number of output rows should not affect the final number of rows, so set it to be 0
return
;
}
// only one output
// only one output
if
(
pCtx
->
param
[
0
].
i64Key
==
1
&&
pResInfo
->
numOfRes
>=
1
)
{
if
(
pCtx
->
param
[
0
].
i64Key
==
1
&&
pResInfo
->
numOfRes
>=
1
)
{
return
;
return
;
}
}
if
(
pCtx
->
numOfParams
==
2
)
{
// the number of output rows should not affect the final number of rows, so set it to be 0
SET_VAL
(
pCtx
,
pCtx
->
size
,
1
);
tVariantDump
(
&
pCtx
->
param
[
1
],
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
true
);
}
else
{
INC_INIT_VAL
(
pCtx
,
1
);
INC_INIT_VAL
(
pCtx
,
1
);
char
*
pData
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
index
);
char
*
pData
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
index
);
memcpy
(
pCtx
->
aOutputBuf
,
pData
,
pCtx
->
inputBytes
);
memcpy
(
pCtx
->
aOutputBuf
,
pData
,
pCtx
->
inputBytes
);
}
pCtx
->
aOutputBuf
+=
pCtx
->
inputBytes
;
pCtx
->
aOutputBuf
+=
pCtx
->
inputBytes
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录