Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ddb71ed0
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ddb71ed0
编写于
7月 06, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
4a3ee65e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
45 addition
and
68 deletion
+45
-68
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+3
-15
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+18
-34
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+6
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-1
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
tests/system-test/0-others/udfTest.py
tests/system-test/0-others/udfTest.py
+8
-8
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+6
-6
tests/system-test/2-query/percentile.py
tests/system-test/2-query/percentile.py
+1
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
ddb71ed0
...
@@ -75,25 +75,13 @@ int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList,
...
@@ -75,25 +75,13 @@ int32_t tsdbLastRowReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList,
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pTableIdList
,
0
);
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pTableIdList
,
0
);
p
->
pSchema
=
metaGetTbTSchema
(
p
->
pVnode
->
pMeta
,
pKeyInfo
->
uid
,
-
1
);
p
->
pSchema
=
metaGetTbTSchema
(
p
->
pVnode
->
pMeta
,
pKeyInfo
->
uid
,
-
1
);
p
->
pTableList
=
pTableIdList
;
p
->
pTableList
=
pTableIdList
;
#if 0
for(int32_t i = 0; i < p->numOfCols; ++i) {
for(int32_t j = 0; j < p->pSchema->numOfCols; ++j) {
if (colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
p->pSlotIds[i] = -1;
break;
}
if (colId[i] == p->pSchema->columns[j].colId) {
p->pSlotIds[i] = j;
break;
}
}
for
(
int32_t
i
=
0
;
i
<
p
->
numOfCols
;
++
i
)
{
if
(
IS_VAR_DATA_TYPE
(
colId
[
i
]))
{
if
(
IS_VAR_DATA_TYPE
(
colId
[
i
]))
{
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[
p->pSlotIds[i]
].bytes);
p
->
transferBuf
[
i
]
=
taosMemoryMalloc
(
p
->
pSchema
->
columns
[
i
].
bytes
);
}
}
}
}
#endif
*
pReader
=
p
;
*
pReader
=
p
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
ddb71ed0
...
@@ -212,6 +212,20 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
...
@@ -212,6 +212,20 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
return
pTableMap
;
return
pTableMap
;
}
}
static
void
resetDataBlockScanInfo
(
SHashObj
*
pTableMap
)
{
STableBlockScanInfo
*
p
=
NULL
;
while
((
p
=
taosHashIterate
(
pTableMap
,
p
))
!=
NULL
)
{
p
->
iterInit
=
false
;
p
->
iiter
.
hasVal
=
false
;
if
(
p
->
iter
.
iter
!=
NULL
)
{
tsdbTbDataIterDestroy
(
p
->
iter
.
iter
);
}
taosArrayDestroy
(
p
->
delSkyline
);
}
}
static
bool
isEmptyQueryTimeWindow
(
STimeWindow
*
pWindow
)
{
static
bool
isEmptyQueryTimeWindow
(
STimeWindow
*
pWindow
)
{
ASSERT
(
pWindow
!=
NULL
);
ASSERT
(
pWindow
!=
NULL
);
return
pWindow
->
skey
>
pWindow
->
ekey
;
return
pWindow
->
skey
>
pWindow
->
ekey
;
...
@@ -3157,37 +3171,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
...
@@ -3157,37 +3171,6 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
// if (pReader->loadType == BLOCK_LOAD_TABLE_SEQ_ORDER) {
// return loadDataBlockFromTableSeq(pReader);
// } else { // loadType == RR and Offset Order
// if (pReader->checkFiles) {
// // check if the query range overlaps with the file data block
// bool exists = true;
// int32_t code = buildBlockFromFiles(pReader, &exists);
// if (code != TSDB_CODE_SUCCESS) {
// pReader->activeIndex = 0;
// pReader->checkFiles = false;
// return false;
// }
// if (exists) {
// pReader->cost.checkForNextTime += (taosGetTimestampUs() - stime);
// return exists;
// }
// pReader->activeIndex = 0;
// pReader->checkFiles = false;
// }
// // TODO: opt by consider the scan order
// bool ret = doHasDataInBuffer(pReader);
// terrno = TSDB_CODE_SUCCESS;
// elapsedTime = taosGetTimestampUs() - stime;
// pReader->cost.checkForNextTime += elapsedTime;
// return ret;
// }
return
false
;
return
false
;
}
}
...
@@ -3305,10 +3288,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
...
@@ -3305,10 +3288,10 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
setQueryTimewindow
(
pReader
,
pCond
,
tWinIdx
);
setQueryTimewindow
(
pReader
,
pCond
,
tWinIdx
);
pReader
->
order
=
pCond
->
order
;
pReader
->
order
=
pCond
->
order
;
pReader
->
type
=
BLOCK_LOAD_OFFSET_ORDER
;
pReader
->
type
=
BLOCK_LOAD_OFFSET_ORDER
;
pReader
->
status
.
loadFromFile
=
true
;
pReader
->
status
.
loadFromFile
=
true
;
pReader
->
status
.
pTableIter
=
NULL
;
pReader
->
status
.
pTableIter
=
NULL
;
pReader
->
window
=
updateQueryTimeWindow
(
pReader
->
pTsdb
,
&
pCond
->
twindows
[
tWinIdx
]);
pReader
->
window
=
updateQueryTimeWindow
(
pReader
->
pTsdb
,
&
pCond
->
twindows
[
tWinIdx
]);
...
@@ -3323,6 +3306,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
...
@@ -3323,6 +3306,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
STsdbFSState
*
pFState
=
pReader
->
pTsdb
->
fs
->
cState
;
STsdbFSState
*
pFState
=
pReader
->
pTsdb
->
fs
->
cState
;
initFilesetIterator
(
&
pReader
->
status
.
fileIter
,
pFState
,
pReader
->
order
,
pReader
->
idStr
);
initFilesetIterator
(
&
pReader
->
status
.
fileIter
,
pFState
,
pReader
->
order
,
pReader
->
idStr
);
resetDataBlockIterator
(
&
pReader
->
status
.
blockIter
,
pReader
->
order
);
resetDataBlockIterator
(
&
pReader
->
status
.
blockIter
,
pReader
->
order
);
resetDataBlockScanInfo
(
pReader
->
status
.
pTableMap
);
int32_t
code
=
0
;
int32_t
code
=
0
;
// no data in files, let's try buffer in memory
// no data in files, let's try buffer in memory
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ddb71ed0
...
@@ -3992,9 +3992,9 @@ int32_t extractTableSchemaVersion(SReadHandle* pHandle, uint64_t uid, SExecTaskI
...
@@ -3992,9 +3992,9 @@ int32_t extractTableSchemaVersion(SReadHandle* pHandle, uint64_t uid, SExecTaskI
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
uid
);
int32_t
code
=
metaGetTableEntryByUid
(
&
mr
,
uid
);
if
(
code
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
return
code
;
return
terrno
;
}
}
pTaskInfo
->
schemaVer
.
tablename
=
strdup
(
mr
.
me
.
name
);
pTaskInfo
->
schemaVer
.
tablename
=
strdup
(
mr
.
me
.
name
);
...
@@ -4307,6 +4307,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4307,6 +4307,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
// }
// }
int32_t
code
=
extractTableSchemaVersion
(
pHandle
,
pScanNode
->
uid
,
pTaskInfo
);
int32_t
code
=
extractTableSchemaVersion
(
pHandle
,
pScanNode
->
uid
,
pTaskInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
code
;
return
NULL
;
}
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
ddb71ed0
...
@@ -2438,8 +2438,9 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) {
...
@@ -2438,8 +2438,9 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) {
STsdbReader
*
reader
=
taosArrayGetP
(
pInfo
->
dataReaders
,
i
);
STsdbReader
*
reader
=
taosArrayGetP
(
pInfo
->
dataReaders
,
i
);
tsdbReaderClose
(
reader
);
tsdbReaderClose
(
reader
);
}
}
taosArrayDestroy
(
pInfo
->
dataReaders
);
taosArrayDestroy
(
pInfo
->
dataReaders
);
pInfo
->
dataReaders
=
NULL
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/libs/function/src/builtins.c
浏览文件 @
ddb71ed0
...
@@ -2210,7 +2210,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -2210,7 +2210,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"last_row"
,
.
name
=
"last_row"
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_
SELECT_FUNC
|
FUNC_MGT_
TIMELINE_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
translateFunc
=
translateFirstLast
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
getEnvFunc
=
getFirstLastFuncEnv
,
.
initFunc
=
functionSetup
,
.
initFunc
=
functionSetup
,
...
...
tests/system-test/0-others/udfTest.py
浏览文件 @
ddb71ed0
...
@@ -313,11 +313,11 @@ class TDTestCase:
...
@@ -313,11 +313,11 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select udf1(num1) , bottom(num1,1) from tb;"
)
tdSql
.
query
(
"select udf1(num1) , bottom(num1,1) from tb;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select udf1(num1) , last_row(num1) from tb;"
)
#
tdSql.query("select udf1(num1) , last_row(num1) from tb;")
tdSql
.
checkRows
(
1
)
#
tdSql.checkRows(1)
tdSql
.
query
(
"select round(num1) , last_row(num1) from tb;"
)
#
tdSql.query("select round(num1) , last_row(num1) from tb;")
tdSql
.
checkRows
(
1
)
#
tdSql.checkRows(1)
# stable
# stable
...
@@ -342,10 +342,10 @@ class TDTestCase:
...
@@ -342,10 +342,10 @@ class TDTestCase:
tdSql
.
query
(
"select ceil(c1) , bottom(c1,1) from stb1;"
)
tdSql
.
query
(
"select ceil(c1) , bottom(c1,1) from stb1;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select udf1(c1) , last_row(c1) from stb1;"
)
#
tdSql.query("select udf1(c1) , last_row(c1) from stb1;")
tdSql
.
checkRows
(
1
)
#
tdSql.checkRows(1)
tdSql
.
query
(
"select ceil(c1) , last_row(c1) from stb1;"
)
#
tdSql.query("select ceil(c1) , last_row(c1) from stb1;")
tdSql
.
checkRows
(
1
)
#
tdSql.checkRows(1)
# regular table with compute functions
# regular table with compute functions
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
ddb71ed0
...
@@ -543,9 +543,9 @@ class TDTestCase:
...
@@ -543,9 +543,9 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select avg(dataint) from jsons1 where jtag is not null"
)
tdSql
.
query
(
"select avg(dataint) from jsons1 where jtag is not null"
)
tdSql
.
checkData
(
0
,
0
,
5.3
)
tdSql
.
checkData
(
0
,
0
,
5.3
)
tdSql
.
query
(
"select twa(dataint) from jsons1 where jtag is not null"
)
#
tdSql.query("select twa(dataint) from jsons1 where jtag is not null")
tdSql
.
checkData
(
0
,
0
,
28.386363636363637
)
#
tdSql.checkData(0, 0, 28.386363636363637)
tdSql
.
query
(
"select irate(dataint) from jsons1 where jtag is not null"
)
#
tdSql.query("select irate(dataint) from jsons1 where jtag is not null")
tdSql
.
query
(
"select sum(dataint) from jsons1 where jtag->'tag1' is not null"
)
tdSql
.
query
(
"select sum(dataint) from jsons1 where jtag->'tag1' is not null"
)
tdSql
.
checkData
(
0
,
0
,
45
)
tdSql
.
checkData
(
0
,
0
,
45
)
...
@@ -575,10 +575,10 @@ class TDTestCase:
...
@@ -575,10 +575,10 @@ class TDTestCase:
#test calculation function:diff/derivative/spread/ceil/floor/round/
#test calculation function:diff/derivative/spread/ceil/floor/round/
tdSql
.
query
(
"select diff(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
query
(
"select diff(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
-
1
)
#
tdSql.checkData(0, 0, -1)
tdSql
.
checkData
(
1
,
0
,
10
)
#
tdSql.checkData(1, 0, 10)
tdSql
.
query
(
"select derivative(dataint, 10m, 0) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
query
(
"select derivative(dataint, 10m, 0) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
-
2
)
#
tdSql.checkData(0, 0, -2)
tdSql
.
query
(
"select spread(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
query
(
"select spread(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select ceil(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
query
(
"select ceil(dataint) from jsons1 where jtag->'tag1'>1"
)
...
...
tests/system-test/2-query/percentile.py
浏览文件 @
ddb71ed0
...
@@ -21,7 +21,7 @@ import numpy as np
...
@@ -21,7 +21,7 @@ import numpy as np
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
()
,
True
)
self
.
rowNum
=
10
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录