Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8455841
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看板
提交
d8455841
编写于
8月 10, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
ebf8755d
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
93 addition
and
4088 deletion
+93
-4088
include/libs/function/function.h
include/libs/function/function.h
+3
-13
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+0
-75
source/libs/function/inc/tfunctionInt.h
source/libs/function/inc/tfunctionInt.h
+3
-14
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+1
-9
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+0
-3910
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+0
-67
source/libs/function/src/tfunctionInt.c
source/libs/function/src/tfunctionInt.c
+86
-0
未找到文件。
include/libs/function/function.h
浏览文件 @
d8455841
...
...
@@ -54,10 +54,6 @@ typedef struct SFuncExecFuncs {
FExecCombine
combine
;
}
SFuncExecFuncs
;
typedef
struct
SFileBlockInfo
{
int32_t
numBlocksOfStep
;
}
SFileBlockInfo
;
#define MAX_INTERVAL_TIME_WINDOW 1000000 // maximum allowed time windows in final results
#define TOP_BOTTOM_QUERY_LIMIT 100
...
...
@@ -171,8 +167,6 @@ typedef struct tExprNode {
};
}
tExprNode
;
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
struct
SScalarParam
{
bool
colAlloced
;
SColumnInfoData
*
columnData
;
...
...
@@ -182,14 +176,10 @@ struct SScalarParam {
int32_t
numOfRows
;
};
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
SResultDataInfo
*
pInfo
,
int16_t
extLength
,
bool
isSuperTable
);
void
resetResultRowEntryResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
);
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
);
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
);
int32_t
getNumOfResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
SSDataBlock
*
pResBlock
);
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
);
typedef
struct
SPoint
{
int64_t
key
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
d8455841
...
...
@@ -2458,81 +2458,6 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
#if 0
int32_t maxNumOfTables = (int32_t)pResultInfo->capacity;
STagScanInfo *pInfo = pOperator->info;
SSDataBlock *pRes = pInfo->pRes;
int32_t count = 0;
SArray* pa = GET_TABLEGROUP(pRuntimeEnv, 0);
int32_t functionId = getExprFunctionId(&pOperator->exprSupp.pExprInfo[0]);
if (functionId == FUNCTION_TID_TAG) { // return the tags & table Id
assert(pQueryAttr->numOfOutput == 1);
SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[0];
int32_t rsize = pExprInfo->base.resSchema.bytes;
count = 0;
int16_t bytes = pExprInfo->base.resSchema.bytes;
int16_t type = pExprInfo->base.resSchema.type;
for(int32_t i = 0; i < pQueryAttr->numOfTags; ++i) {
if (pQueryAttr->tagColList[i].colId == pExprInfo->base.pColumns->info.colId) {
bytes = pQueryAttr->tagColList[i].bytes;
type = pQueryAttr->tagColList[i].type;
break;
}
}
SColumnInfoData* pColInfo = taosArrayGet(pRes->pDataBlock, 0);
while(pInfo->curPos < pInfo->totalTables && count < maxNumOfTables) {
int32_t i = pInfo->curPos++;
STableQueryInfo *item = taosArrayGetP(pa, i);
char *output = pColInfo->pData + count * rsize;
varDataSetLen(output, rsize - VARSTR_HEADER_SIZE);
output = varDataVal(output);
STableId* id = TSDB_TABLEID(item->pTable);
*(int16_t *)output = 0;
output += sizeof(int16_t);
*(int64_t *)output = id->uid; // memory align problem, todo serialize
output += sizeof(id->uid);
*(int32_t *)output = id->tid;
output += sizeof(id->tid);
*(int32_t *)output = pQueryAttr->vgId;
output += sizeof(pQueryAttr->vgId);
char* data = NULL;
if (pExprInfo->base.pColumns->info.colId == TSDB_TBNAME_COLUMN_INDEX) {
data = tsdbGetTableName(item->pTable);
} else {
data = tsdbGetTableTagVal(item->pTable, pExprInfo->base.pColumns->info.colId, type, bytes);
}
doSetTagValueToResultBuf(output, data, type, bytes);
count += 1;
}
//qDebug("QInfo:0x%"PRIx64" create (tableId, tag) info completed, rows:%d", GET_TASKID(pRuntimeEnv), count);
} else if (functionId == FUNCTION_COUNT) {// handle the "count(tbname)" query
SColumnInfoData* pColInfo = taosArrayGet(pRes->pDataBlock, 0);
*(int64_t*)pColInfo->pData = pInfo->totalTables;
count = 1;
pOperator->status = OP_EXEC_DONE;
//qDebug("QInfo:0x%"PRIx64" create count(tbname) query, res:%d rows:1", GET_TASKID(pRuntimeEnv), count);
} else { // return only the tags|table name etc.
#endif
STagScanInfo
*
pInfo
=
pOperator
->
info
;
SExprInfo
*
pExprInfo
=
&
pOperator
->
exprSupp
.
pExprInfo
[
0
];
SSDataBlock
*
pRes
=
pInfo
->
pRes
;
...
...
source/libs/function/inc/t
aggfunction
.h
→
source/libs/function/inc/t
functionInt
.h
浏览文件 @
d8455841
...
...
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_T
AGGFUNCTION
_H
#define TDENGINE_T
AGGFUNCTION
_H
#ifndef TDENGINE_T
FUNCTIONINT
_H
#define TDENGINE_T
FUNCTIONINT
_H
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -28,17 +28,6 @@ extern "C" {
#include "function.h"
#include "tudf.h"
#define AVG_FUNCTION_INTER_BUFFER_SIZE 50
#define DATA_SET_FLAG ',' // to denote the output area has data, not null value
#define DATA_SET_FLAG_SIZE sizeof(DATA_SET_FLAG)
typedef
struct
SInterpInfoDetail
{
TSKEY
ts
;
// interp specified timestamp
int8_t
type
;
int8_t
primaryCol
;
}
SInterpInfoDetail
;
bool
topbot_datablock_filter
(
SqlFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
/**
...
...
@@ -57,4 +46,4 @@ static FORCE_INLINE void initResultRowEntry(SResultRowEntryInfo *pResInfo, int32
}
#endif
#endif // TDENGINE_T
AGGFUNCTION
_H
#endif // TDENGINE_T
FUNCTIONINT
_H
source/libs/function/src/builtinsimpl.c
浏览文件 @
d8455841
...
...
@@ -18,10 +18,10 @@
#include "function.h"
#include "query.h"
#include "querynodes.h"
#include "taggfunction.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tdigest.h"
#include "tfunctionInt.h"
#include "tglobal.h"
#include "thistogram.h"
#include "tpercentile.h"
...
...
@@ -312,14 +312,6 @@ typedef struct SGroupKeyInfo {
#define GET_TS_LIST(x) ((TSKEY*)((x)->ptsList))
#define GET_TS_DATA(x, y) (GET_TS_LIST(x)[(y)])
#define DO_UPDATE_TAG_COLUMNS_WITHOUT_TS(ctx) \
do { \
for (int32_t _i = 0; _i < (ctx)->tagInfo.numOfTagCols; ++_i) { \
SqlFunctionCtx* __ctx = (ctx)->tagInfo.pTagCtxList[_i]; \
__ctx->fpSet.process(__ctx); \
} \
} while (0);
#define DO_UPDATE_SUBSID_RES(ctx, ts) \
do { \
for (int32_t _i = 0; _i < (ctx)->subsidiaries.num; ++_i) { \
...
...
source/libs/function/src/taggfunction.c
已删除
100644 → 0
浏览文件 @
ebf8755d
此差异已折叠。
点击以展开。
source/libs/function/src/texpr.c
已删除
100644 → 0
浏览文件 @
ebf8755d
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "function.h"
#include "os.h"
#include "texception.h"
#include "tmsg.h"
static
void
doExprTreeDestroy
(
tExprNode
**
pExpr
,
void
(
*
fp
)(
void
*
));
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
))
{
if
(
pNode
==
NULL
)
{
return
;
}
if
(
pNode
->
nodeType
==
TEXPR_BINARYEXPR_NODE
||
pNode
->
nodeType
==
TEXPR_UNARYEXPR_NODE
)
{
doExprTreeDestroy
(
&
pNode
,
fp
);
}
taosMemoryFree
(
pNode
);
}
static
void
doExprTreeDestroy
(
tExprNode
**
pExpr
,
void
(
*
fp
)(
void
*
))
{
if
(
*
pExpr
==
NULL
)
{
return
;
}
taosMemoryFree
(
*
pExpr
);
*
pExpr
=
NULL
;
}
// TODO: these three functions should be made global
static
void
*
exception_calloc
(
size_t
nmemb
,
size_t
size
)
{
void
*
p
=
taosMemoryCalloc
(
nmemb
,
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
return
p
;
}
static
void
*
exception_malloc
(
size_t
size
)
{
void
*
p
=
taosMemoryMalloc
(
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
return
p
;
}
static
UNUSED_FUNC
char
*
exception_strdup
(
const
char
*
str
)
{
char
*
p
=
strdup
(
str
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
return
p
;
}
source/libs/function/src/tfunctionInt.c
0 → 100644
浏览文件 @
d8455841
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "taosdef.h"
#include "tmsg.h"
#include "thash.h"
#include "ttypes.h"
#include "function.h"
#include "tbuffer.h"
#include "tcompression.h"
#include "tdatablock.h"
#include "tfunctionInt.h"
#include "thistogram.h"
#include "tpercentile.h"
#include "ttszip.h"
#include "tudf.h"
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
)
{
pCell
->
initialized
=
false
;
}
int32_t
getNumOfResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
num
,
SSDataBlock
*
pResBlock
)
{
int32_t
maxRows
=
0
;
for
(
int32_t
j
=
0
;
j
<
num
;
++
j
)
{
#if 0
int32_t id = pCtx[j].functionId;
/*
* ts, tag, tagprj function can not decide the output number of current query
* the number of output result is decided by main output
*/
if (id == FUNCTION_TS || id == FUNCTION_TAG || id == FUNCTION_TAGPRJ) {
continue;
}
#endif
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
&
pCtx
[
j
]);
if
(
pResInfo
!=
NULL
&&
maxRows
<
pResInfo
->
numOfRes
)
{
maxRows
=
pResInfo
->
numOfRes
;
}
}
assert
(
maxRows
>=
0
);
blockDataEnsureCapacity
(
pResBlock
,
maxRows
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pResBlock
->
pDataBlock
,
i
);
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
&
pCtx
[
i
]);
if
(
pResInfo
->
numOfRes
==
0
)
{
for
(
int32_t
j
=
0
;
j
<
pResInfo
->
numOfRes
;
++
j
)
{
colDataAppend
(
pCol
,
j
,
NULL
,
true
);
// TODO add set null data api
}
}
else
{
for
(
int32_t
j
=
0
;
j
<
pResInfo
->
numOfRes
;
++
j
)
{
colDataAppend
(
pCol
,
j
,
GET_ROWCELL_INTERBUF
(
pResInfo
),
false
);
}
}
}
pResBlock
->
info
.
rows
=
maxRows
;
return
maxRows
;
}
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
)
{
assert
(
pEntry
!=
NULL
);
return
pEntry
->
complete
;
}
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
)
{
return
pEntry
->
initialized
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录