Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c64ea43f
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看板
未验证
提交
c64ea43f
编写于
4月 27, 2022
作者:
H
Haojun Liao
提交者:
GitHub
4月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11918 from taosdata/feature/3.0_liaohj
refactor: do some internal refactor.
上级
443ae244
02cee2ba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
23 deletion
+44
-23
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+8
-7
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+36
-16
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
c64ea43f
...
...
@@ -117,22 +117,23 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
int32_t
type
=
pColumnInfoData
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
int32_t
dataLen
=
varDataTLen
(
pData
);
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
dataLen
=
0
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BIGINT
||
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BIGINT
||
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
dataLen
=
LONG_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
;
}
dataLen
+=
CHAR_BYTES
;
}
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
if
(
pAttr
->
allocLen
<
pAttr
->
length
+
dataLen
)
{
uint32_t
newSize
=
pAttr
->
allocLen
;
if
(
newSize
==
0
)
{
if
(
newSize
<=
1
)
{
newSize
=
8
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
c64ea43f
...
...
@@ -1034,7 +1034,7 @@ void setInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx, SSDataBlo
}
}
static
int32_t
doCreateConstantValColumnInfo
(
SInputColumnInfoData
*
pInput
,
SFunctParam
*
pFuncParam
,
int32_t
type
,
static
int32_t
doCreateConstantValColumnInfo
(
SInputColumnInfoData
*
pInput
,
SFunctParam
*
pFuncParam
,
int32_t
paramIndex
,
int32_t
numOfRows
)
{
SColumnInfoData
*
pColInfo
=
NULL
;
if
(
pInput
->
pData
[
paramIndex
]
==
NULL
)
{
...
...
@@ -1044,17 +1044,17 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
}
// Set the correct column info (data type and bytes)
pColInfo
->
info
.
type
=
t
ype
;
pColInfo
->
info
.
bytes
=
tDataTypes
[
type
].
bytes
;
pColInfo
->
info
.
type
=
pFuncParam
->
param
.
nT
ype
;
pColInfo
->
info
.
bytes
=
pFuncParam
->
param
.
nLen
;
pInput
->
pData
[
paramIndex
]
=
pColInfo
;
}
else
{
pColInfo
=
pInput
->
pData
[
paramIndex
];
}
ASSERT
(
!
IS_VAR_DATA_TYPE
(
type
));
colInfoDataEnsureCapacity
(
pColInfo
,
0
,
numOfRows
);
int8_t
type
=
pFuncParam
->
param
.
nType
;
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_UBIGINT
)
{
int64_t
v
=
pFuncParam
->
param
.
i
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
...
...
@@ -1065,6 +1065,12 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
colDataAppendDouble
(
pColInfo
,
i
,
&
v
);
}
}
else
if
(
type
==
TSDB_DATA_TYPE_VARCHAR
)
{
char
*
tmp
=
taosMemoryMalloc
(
pFuncParam
->
param
.
nLen
+
VARSTR_HEADER_SIZE
);
STR_WITH_SIZE_TO_VARSTR
(
tmp
,
pFuncParam
->
param
.
pz
,
pFuncParam
->
param
.
nLen
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
colDataAppend
(
pColInfo
,
i
,
tmp
,
false
);
}
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1104,7 +1110,7 @@ static int32_t doSetInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCt
pInput
->
numOfRows
=
pBlock
->
info
.
rows
;
pInput
->
startRowIndex
=
0
;
code
=
doCreateConstantValColumnInfo
(
pInput
,
pFuncParam
,
pFuncParam
->
param
.
nType
,
j
,
pBlock
->
info
.
rows
);
code
=
doCreateConstantValColumnInfo
(
pInput
,
pFuncParam
,
j
,
pBlock
->
info
.
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -6684,18 +6690,32 @@ SArray* extractColumnInfo(SNodeList* pNodeList) {
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
STargetNode
*
pNode
=
(
STargetNode
*
)
nodesListGetNode
(
pNodeList
,
i
);
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
// todo extract method
SColumn
c
=
{
0
};
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
precision
=
pColNode
->
node
.
resType
.
precision
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
taosArrayPush
(
pList
,
&
c
);
if
(
nodeType
(
pNode
->
pExpr
)
==
QUERY_NODE_COLUMN
)
{
SColumnNode
*
pColNode
=
(
SColumnNode
*
)
pNode
->
pExpr
;
// todo extract method
SColumn
c
=
{
0
};
c
.
slotId
=
pColNode
->
slotId
;
c
.
colId
=
pColNode
->
colId
;
c
.
type
=
pColNode
->
node
.
resType
.
type
;
c
.
bytes
=
pColNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pColNode
->
node
.
resType
.
scale
;
c
.
precision
=
pColNode
->
node
.
resType
.
precision
;
taosArrayPush
(
pList
,
&
c
);
}
else
if
(
nodeType
(
pNode
->
pExpr
)
==
QUERY_NODE_VALUE
)
{
SValueNode
*
pValNode
=
(
SValueNode
*
)
pNode
->
pExpr
;
SColumn
c
=
{
0
};
c
.
slotId
=
pNode
->
slotId
;
c
.
colId
=
pNode
->
slotId
;
c
.
type
=
pValNode
->
node
.
type
;
c
.
bytes
=
pValNode
->
node
.
resType
.
bytes
;
c
.
scale
=
pValNode
->
node
.
resType
.
scale
;
c
.
precision
=
pValNode
->
node
.
resType
.
precision
;
taosArrayPush
(
pList
,
&
c
);
}
}
return
pList
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录