Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd3174df
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看板
提交
dd3174df
编写于
3月 01, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
18112c74
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
550 addition
and
185 deletion
+550
-185
src/client/src/tscServer.c
src/client/src/tscServer.c
+0
-2
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-0
src/inc/tsdb.h
src/inc/tsdb.h
+3
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+9
-3
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+13
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+473
-161
src/query/src/queryMain.c
src/query/src/queryMain.c
+2
-3
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+49
-13
未找到文件。
src/client/src/tscServer.c
浏览文件 @
dd3174df
...
...
@@ -494,8 +494,6 @@ int tscProcessSql(SSqlObj *pSql) {
return
pSql
->
res
.
code
;
}
}
else
if
(
pCmd
->
command
>=
TSDB_SQL_LOCAL
)
{
//pSql->epSet = tscMgmtEpSet;
// } else { // local handler
return
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
dd3174df
...
...
@@ -497,6 +497,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
0
);
int16_t
funcId
=
pExpr
->
functionId
;
// add the invisible timestamp column
if
((
pExpr
->
colInfo
.
colId
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
||
(
funcId
!=
TSDB_FUNC_TS
&&
funcId
!=
TSDB_FUNC_TS_DUMMY
&&
funcId
!=
TSDB_FUNC_PRJ
))
{
...
...
src/inc/tsdb.h
浏览文件 @
dd3174df
...
...
@@ -307,7 +307,7 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo *tsdb, uint64_t uid, TSKEY key, const
SColIndex
*
pColIndex
,
int32_t
numOfCols
);
/**
* dest
or
y the created table group list, which is generated by tag query
* dest
ro
y the created table group list, which is generated by tag query
* @param pGroupList
*/
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
...
...
@@ -339,6 +339,8 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle);
void
tsdbResetQueryHandle
(
TsdbQueryHandleT
queryHandle
,
STsdbQueryCond
*
pCond
);
void
tsdbResetQueryHandleForNewTable
(
TsdbQueryHandleT
queryHandle
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
);
/**
* get the statistics of repo usage
* @param repo. point to the tsdbrepo
...
...
src/query/inc/qExecutor.h
浏览文件 @
dd3174df
...
...
@@ -241,12 +241,16 @@ typedef void (*__optr_cleanup_fn_t)(void* param, int32_t num);
struct
SOperatorInfo
;
typedef
struct
{
FILE
*
file
;
// file struct pointer
}
SFileResultInfo
;
typedef
struct
SQueryRuntimeEnv
{
jmp_buf
env
;
SQuery
*
pQuery
;
void
*
qinfo
;
uint16_t
scanFlag
;
// denotes reversed scan of data or not
SFillInfo
*
pFillInfo
;
SFillInfo
*
pFillInfo
;
// todo move to operatorInfo
void
*
pQueryHandle
;
int32_t
prevGroupId
;
// previous executed group id
...
...
@@ -264,10 +268,10 @@ typedef struct SQueryRuntimeEnv {
SArithmeticSupport
*
sasArray
;
SSDataBlock
*
outputBuf
;
int32_t
groupIndex
;
int32_t
tableIndex
;
int32_t
tableIndex
;
//TODO remove it
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
struct
SOperatorInfo
*
proot
;
struct
SOperatorInfo
*
pTableScanner
;
// table scan operator
SGroupResInfo
groupResInfo
;
int64_t
currentOffset
;
// dynamic offset value
...
...
@@ -364,6 +368,8 @@ typedef struct STableScanInfo {
int32_t
numOfOutput
;
int64_t
elapsedTime
;
int32_t
tableIndex
;
}
STableScanInfo
;
typedef
struct
STagScanInfo
{
...
...
src/query/src/qAggMain.c
浏览文件 @
dd3174df
...
...
@@ -208,7 +208,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
if
(
functionId
==
TSDB_FUNC_TS_COMP
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
sizeof
(
int32_t
);
// this results is compressed ts data
*
bytes
=
1
;
// this results is compressed ts data, only one byte
*
interBytes
=
POINTER_BYTES
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -4203,11 +4203,22 @@ static void ts_comp_finalize(SQLFunctionCtx *pCtx) {
STSBuf
*
pTSbuf
=
pInfo
->
pTSBuf
;
tsBufFlush
(
pTSbuf
);
qDebug
(
"total timestamp :%"
PRId64
,
pTSbuf
->
numOfTotal
);
// TODO refactor transfer ownership of current file
*
(
FILE
**
)
pCtx
->
pOutput
=
pTSbuf
->
f
;
pResInfo
->
complete
=
true
;
// get the file size
struct
stat
fStat
;
if
((
fstat
(
fileno
(
pTSbuf
->
f
),
&
fStat
)
==
0
))
{
pResInfo
->
numOfRes
=
fStat
.
st_size
;
}
pTSbuf
->
remainOpen
=
true
;
tsBufDestroy
(
pTSbuf
);
doFinalizer
(
pCtx
);
}
...
...
src/query/src/qExecutor.c
浏览文件 @
dd3174df
此差异已折叠。
点击以展开。
src/query/src/queryMain.c
浏览文件 @
dd3174df
...
...
@@ -312,10 +312,9 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
int64_t
s
=
GET_NUM_OF_RESULTS
(
pRuntimeEnv
);
size_t
size
=
getResultSize
(
pQInfo
,
&
s
);
int32_t
s
=
GET_NUM_OF_RESULTS
(
pRuntimeEnv
);
size_t
size
=
pQuery
->
resultRowSize
*
s
;
size
+=
sizeof
(
int32_t
);
size
+=
sizeof
(
STableIdInfo
)
*
taosHashGetSize
(
pQInfo
->
arrTableIdInfo
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
dd3174df
...
...
@@ -295,8 +295,8 @@ static void resetCheckInfo(STsdbQueryHandle* pQueryHandle) {
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
STableCheckInfo
*
pCheckInfo
=
(
STableCheckInfo
*
)
taosArrayGet
(
pQueryHandle
->
pTableCheckInfo
,
i
);
pCheckInfo
->
lastKey
=
pQueryHandle
->
window
.
skey
;
pCheckInfo
->
iter
=
tSkipListDestroyIter
(
pCheckInfo
->
iter
);
pCheckInfo
->
iiter
=
tSkipListDestroyIter
(
pCheckInfo
->
iiter
);
pCheckInfo
->
iter
=
tSkipListDestroyIter
(
pCheckInfo
->
iter
);
pCheckInfo
->
iiter
=
tSkipListDestroyIter
(
pCheckInfo
->
iiter
);
pCheckInfo
->
initBuf
=
false
;
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
...
...
@@ -453,6 +453,39 @@ void tsdbResetQueryHandle(TsdbQueryHandleT queryHandle, STsdbQueryCond *pCond) {
resetCheckInfo
(
pQueryHandle
);
}
void
tsdbResetQueryHandleForNewTable
(
TsdbQueryHandleT
queryHandle
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
)
{
STsdbQueryHandle
*
pQueryHandle
=
queryHandle
;
pQueryHandle
->
order
=
pCond
->
order
;
pQueryHandle
->
window
=
pCond
->
twindow
;
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_ALL
;
pQueryHandle
->
cur
.
fid
=
-
1
;
pQueryHandle
->
cur
.
win
=
TSWINDOW_INITIALIZER
;
pQueryHandle
->
checkFiles
=
true
;
pQueryHandle
->
activeIndex
=
0
;
// current active table index
pQueryHandle
->
locateStart
=
false
;
pQueryHandle
->
loadExternalRow
=
pCond
->
loadExternalRows
;
if
(
ASCENDING_TRAVERSE
(
pCond
->
order
))
{
assert
(
pQueryHandle
->
window
.
skey
<=
pQueryHandle
->
window
.
ekey
);
}
else
{
assert
(
pQueryHandle
->
window
.
skey
>=
pQueryHandle
->
window
.
ekey
);
}
// allocate buffer in order to load data blocks from file
memset
(
pQueryHandle
->
statis
,
0
,
sizeof
(
SDataStatis
));
tsdbInitDataBlockLoadInfo
(
&
pQueryHandle
->
dataBlockLoadInfo
);
tsdbInitCompBlockLoadInfo
(
&
pQueryHandle
->
compBlockLoadInfo
);
STsdbMeta
*
pMeta
=
tsdbGetMeta
(
pQueryHandle
->
pTsdb
);
pQueryHandle
->
pTableCheckInfo
=
createCheckInfoFromTableGroup
(
pQueryHandle
,
groupList
,
pMeta
);
if
(
pQueryHandle
->
pTableCheckInfo
==
NULL
)
{
tsdbCleanupQueryHandle
(
pQueryHandle
);
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
}
}
TsdbQueryHandleT
tsdbQueryLastRow
(
STsdbRepo
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
,
SMemRef
*
pMemRef
)
{
pCond
->
twindow
=
updateLastrowForEachGroup
(
groupList
);
...
...
@@ -3105,23 +3138,26 @@ static void* doFreeColumnInfoData(SArray* pColumnInfoData) {
return
NULL
;
}
static
void
*
destroyTableCheckInfo
(
SArray
*
pTableCheckInfo
)
{
size_t
size
=
taosArrayGetSize
(
pTableCheckInfo
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STableCheckInfo
*
p
=
taosArrayGet
(
pTableCheckInfo
,
i
);
destroyTableMemIterator
(
p
);
tfree
(
p
->
pCompInfo
);
}
taosArrayDestroy
(
pTableCheckInfo
);
return
NULL
;
}
void
tsdbCleanupQueryHandle
(
TsdbQueryHandleT
queryHandle
)
{
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
queryHandle
;
if
(
pQueryHandle
==
NULL
)
{
return
;
}
if
(
pQueryHandle
->
pTableCheckInfo
!=
NULL
)
{
size_t
size
=
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STableCheckInfo
*
pTableCheckInfo
=
taosArrayGet
(
pQueryHandle
->
pTableCheckInfo
,
i
);
destroyTableMemIterator
(
pTableCheckInfo
);
tfree
(
pTableCheckInfo
->
pCompInfo
);
}
taosArrayDestroy
(
pQueryHandle
->
pTableCheckInfo
);
}
pQueryHandle
->
pTableCheckInfo
=
destroyTableCheckInfo
(
pQueryHandle
->
pTableCheckInfo
);
pQueryHandle
->
pColumns
=
doFreeColumnInfoData
(
pQueryHandle
->
pColumns
);
taosArrayDestroy
(
pQueryHandle
->
defaultLoadColumn
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录