Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e8527ee9
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
e8527ee9
编写于
2月 23, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix invalid dist count
上级
7d75939f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
35 addition
and
36 deletion
+35
-36
include/common/tcommon.h
include/common/tcommon.h
+6
-6
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+29
-30
未找到文件。
include/common/tcommon.h
浏览文件 @
e8527ee9
...
@@ -291,7 +291,6 @@ typedef struct STableBlockDistInfo {
...
@@ -291,7 +291,6 @@ typedef struct STableBlockDistInfo {
uint16_t
numOfFiles
;
uint16_t
numOfFiles
;
uint32_t
numOfTables
;
uint32_t
numOfTables
;
uint32_t
numOfBlocks
;
uint32_t
numOfBlocks
;
uint32_t
numOfVgroups
;
uint64_t
totalSize
;
uint64_t
totalSize
;
uint64_t
totalRows
;
uint64_t
totalRows
;
int32_t
maxRows
;
int32_t
maxRows
;
...
@@ -301,6 +300,7 @@ typedef struct STableBlockDistInfo {
...
@@ -301,6 +300,7 @@ typedef struct STableBlockDistInfo {
int32_t
firstSeekTimeUs
;
int32_t
firstSeekTimeUs
;
uint32_t
numOfInmemRows
;
uint32_t
numOfInmemRows
;
uint32_t
numOfSmallBlocks
;
uint32_t
numOfSmallBlocks
;
uint32_t
numOfVgroups
;
int32_t
blockRowsHisto
[
20
];
int32_t
blockRowsHisto
[
20
];
}
STableBlockDistInfo
;
}
STableBlockDistInfo
;
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
e8527ee9
...
@@ -795,7 +795,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -795,7 +795,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
((
int64_t
*
)
pCol
->
pData
)[
currentRow
]
=
pRes
->
v
;
((
int64_t
*
)
pCol
->
pData
)[
currentRow
]
=
pRes
->
v
;
// colDataAppendInt64(pCol, currentRow, &pRes->v);
// colDataAppendInt64(pCol, currentRow, &pRes->v);
break
;
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_INT
:
...
@@ -920,9 +920,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
...
@@ -920,9 +920,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
}
}
}
}
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
*
pDestPos
=
*
pSourcePos
;
}
*
pDestPos
=
*
pSourcePos
;
}
int32_t
minMaxCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
,
int32_t
isMinFunc
)
{
int32_t
minMaxCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
,
int32_t
isMinFunc
)
{
SResultRowEntryInfo
*
pDResInfo
=
GET_RES_INFO
(
pDestCtx
);
SResultRowEntryInfo
*
pDResInfo
=
GET_RES_INFO
(
pDestCtx
);
...
@@ -1742,7 +1740,6 @@ _fin_error:
...
@@ -1742,7 +1740,6 @@ _fin_error:
tMemBucketDestroy
(
pMemBucket
);
tMemBucketDestroy
(
pMemBucket
);
return
code
;
return
code
;
}
}
bool
getApercentileFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
)
{
bool
getApercentileFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
)
{
...
@@ -2156,7 +2153,8 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
...
@@ -2156,7 +2153,8 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
}
}
// All null data column, return directly.
// All null data column, return directly.
if
(
pInput
->
colDataSMAIsSet
&&
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
&&
pInputCol
->
hasNull
==
true
)
{
if
(
pInput
->
colDataSMAIsSet
&&
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
&&
pInputCol
->
hasNull
==
true
)
{
// save selectivity value for column consisted of all null values
// save selectivity value for column consisted of all null values
int32_t
code
=
firstlastSaveTupleData
(
pCtx
->
pSrcBlock
,
pInput
->
startRowIndex
,
pCtx
,
pInfo
);
int32_t
code
=
firstlastSaveTupleData
(
pCtx
->
pSrcBlock
,
pInput
->
startRowIndex
,
pCtx
,
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -2272,7 +2270,8 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
...
@@ -2272,7 +2270,8 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
}
}
// All null data column, return directly.
// All null data column, return directly.
if
(
pInput
->
colDataSMAIsSet
&&
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
&&
pInputCol
->
hasNull
==
true
)
{
if
(
pInput
->
colDataSMAIsSet
&&
(
pInput
->
pColumnDataAgg
[
0
]
->
numOfNull
==
pInput
->
totalRows
)
&&
pInputCol
->
hasNull
==
true
)
{
// save selectivity value for column consisted of all null values
// save selectivity value for column consisted of all null values
int32_t
code
=
firstlastSaveTupleData
(
pCtx
->
pSrcBlock
,
pInput
->
startRowIndex
,
pCtx
,
pInfo
);
int32_t
code
=
firstlastSaveTupleData
(
pCtx
->
pSrcBlock
,
pInput
->
startRowIndex
,
pCtx
,
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -2908,8 +2907,8 @@ static STopBotRes* getTopBotOutputInfo(SqlFunctionCtx* pCtx) {
...
@@ -2908,8 +2907,8 @@ static STopBotRes* getTopBotOutputInfo(SqlFunctionCtx* pCtx) {
return
pRes
;
return
pRes
;
}
}
static
int32_t
doAddIntoResult
(
SqlFunctionCtx
*
pCtx
,
void
*
pData
,
int32_t
rowIndex
,
SSDataBlock
*
pSrcBlock
,
uint16_t
type
,
static
int32_t
doAddIntoResult
(
SqlFunctionCtx
*
pCtx
,
void
*
pData
,
int32_t
rowIndex
,
SSDataBlock
*
pSrcBlock
,
uint64_t
uid
,
SResultRowEntryInfo
*
pEntryInfo
,
bool
isTopQuery
);
uint
16_t
type
,
uint
64_t
uid
,
SResultRowEntryInfo
*
pEntryInfo
,
bool
isTopQuery
);
static
void
addResult
(
SqlFunctionCtx
*
pCtx
,
STopBotResItem
*
pSourceItem
,
int16_t
type
,
bool
isTopQuery
);
static
void
addResult
(
SqlFunctionCtx
*
pCtx
,
STopBotResItem
*
pSourceItem
,
int16_t
type
,
bool
isTopQuery
);
...
@@ -5428,7 +5427,6 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
...
@@ -5428,7 +5427,6 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
pDistInfo
->
numOfBlocks
+=
p1
.
numOfBlocks
;
pDistInfo
->
numOfBlocks
+=
p1
.
numOfBlocks
;
pDistInfo
->
numOfTables
+=
p1
.
numOfTables
;
pDistInfo
->
numOfTables
+=
p1
.
numOfTables
;
pDistInfo
->
numOfInmemRows
+=
p1
.
numOfInmemRows
;
pDistInfo
->
numOfInmemRows
+=
p1
.
numOfInmemRows
;
pDistInfo
->
numOfVgroups
+=
p1
.
numOfVgroups
;
pDistInfo
->
totalSize
+=
p1
.
totalSize
;
pDistInfo
->
totalSize
+=
p1
.
totalSize
;
pDistInfo
->
totalRows
+=
p1
.
totalRows
;
pDistInfo
->
totalRows
+=
p1
.
totalRows
;
pDistInfo
->
numOfFiles
+=
p1
.
numOfFiles
;
pDistInfo
->
numOfFiles
+=
p1
.
numOfFiles
;
...
@@ -5445,6 +5443,7 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
...
@@ -5445,6 +5443,7 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
pDistInfo
->
maxRows
=
p1
.
maxRows
;
pDistInfo
->
maxRows
=
p1
.
maxRows
;
}
}
pDistInfo
->
numOfVgroups
+=
(
p1
.
numOfTables
!=
0
?
1
:
0
);
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pDistInfo
->
blockRowsHisto
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pDistInfo
->
blockRowsHisto
);
++
i
)
{
pDistInfo
->
blockRowsHisto
[
i
]
+=
p1
.
blockRowsHisto
[
i
];
pDistInfo
->
blockRowsHisto
[
i
]
+=
p1
.
blockRowsHisto
[
i
];
}
}
...
@@ -5463,7 +5462,6 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist
...
@@ -5463,7 +5462,6 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist
if
(
tEncodeU16
(
&
encoder
,
pInfo
->
numOfFiles
)
<
0
)
return
-
1
;
if
(
tEncodeU16
(
&
encoder
,
pInfo
->
numOfFiles
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfBlocks
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfBlocks
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfVgroups
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pInfo
->
totalSize
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pInfo
->
totalSize
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pInfo
->
totalRows
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pInfo
->
totalRows
)
<
0
)
return
-
1
;
...
@@ -5473,6 +5471,7 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist
...
@@ -5473,6 +5471,7 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
defMinRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
defMinRows
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfInmemRows
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfInmemRows
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfSmallBlocks
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfSmallBlocks
)
<
0
)
return
-
1
;
if
(
tEncodeU32
(
&
encoder
,
pInfo
->
numOfVgroups
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pInfo
->
blockRowsHisto
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pInfo
->
blockRowsHisto
);
++
i
)
{
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
blockRowsHisto
[
i
])
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
blockRowsHisto
[
i
])
<
0
)
return
-
1
;
...
@@ -5495,7 +5494,6 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo
...
@@ -5495,7 +5494,6 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo
if
(
tDecodeU16
(
&
decoder
,
&
pInfo
->
numOfFiles
)
<
0
)
return
-
1
;
if
(
tDecodeU16
(
&
decoder
,
&
pInfo
->
numOfFiles
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfVgroups
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pInfo
->
totalSize
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pInfo
->
totalSize
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pInfo
->
totalRows
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pInfo
->
totalRows
)
<
0
)
return
-
1
;
...
@@ -5505,6 +5503,7 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo
...
@@ -5505,6 +5503,7 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
defMinRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
defMinRows
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfInmemRows
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfInmemRows
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfSmallBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfSmallBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeU32
(
&
decoder
,
&
pInfo
->
numOfVgroups
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pInfo
->
blockRowsHisto
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tListLen
(
pInfo
->
blockRowsHisto
);
++
i
)
{
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
blockRowsHisto
[
i
])
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
blockRowsHisto
[
i
])
<
0
)
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录