Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2badb991
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看板
提交
2badb991
编写于
8月 10, 2021
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/query' of github.com:taosdata/TDengine into feature/query
上级
0a45ee68
ccb66fca
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
16 deletion
+23
-16
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
src/common/src/tglobal.c
src/common/src/tglobal.c
+2
-2
src/os/src/detail/osTime.c
src/os/src/detail/osTime.c
+1
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+13
-7
tests/script/general/parser/fill_us.sim
tests/script/general/parser/fill_us.sim
+2
-2
tests/script/general/parser/last_cache.sim
tests/script/general/parser/last_cache.sim
+1
-1
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+1
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
2badb991
...
@@ -914,8 +914,8 @@ static int32_t checkInvalidExprForTimeWindow(SSqlCmd* pCmd, SQueryInfo* pQueryIn
...
@@ -914,8 +914,8 @@ static int32_t checkInvalidExprForTimeWindow(SSqlCmd* pCmd, SQueryInfo* pQueryIn
}
}
int32_t
validateIntervalNode
(
SSqlObj
*
pSql
,
SQueryInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
)
{
int32_t
validateIntervalNode
(
SSqlObj
*
pSql
,
SQueryInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
)
{
const
char
*
msg1
=
"sliding cannot be used without interval"
;
const
char
*
msg2
=
"interval cannot be less than 10 ms"
;
const
char
*
msg2
=
"interval cannot be less than 10 ms"
;
const
char
*
msg3
=
"sliding cannot be used without interval"
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
@@ -924,7 +924,7 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
...
@@ -924,7 +924,7 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
if
(
!
TPARSER_HAS_TOKEN
(
pSqlNode
->
interval
.
interval
))
{
if
(
!
TPARSER_HAS_TOKEN
(
pSqlNode
->
interval
.
interval
))
{
if
(
TPARSER_HAS_TOKEN
(
pSqlNode
->
sliding
))
{
if
(
TPARSER_HAS_TOKEN
(
pSqlNode
->
sliding
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
1
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -945,7 +945,7 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
...
@@ -945,7 +945,7 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
if
(
pQueryInfo
->
interval
.
intervalUnit
!=
'n'
&&
pQueryInfo
->
interval
.
intervalUnit
!=
'y'
)
{
if
(
pQueryInfo
->
interval
.
intervalUnit
!=
'n'
&&
pQueryInfo
->
interval
.
intervalUnit
!=
'y'
)
{
// interval cannot be less than 10 milliseconds
// interval cannot be less than 10 milliseconds
if
(
convertTimePrecision
(
pQueryInfo
->
interval
.
interval
,
tinfo
.
precision
,
TSDB_TIME_PRECISION_MI
LLI
)
<
tsMinIntervalTime
)
{
if
(
convertTimePrecision
(
pQueryInfo
->
interval
.
interval
,
tinfo
.
precision
,
TSDB_TIME_PRECISION_MI
CRO
)
<
tsMinIntervalTime
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
}
}
...
...
src/common/src/tglobal.c
浏览文件 @
2badb991
...
@@ -84,8 +84,8 @@ int32_t tsMaxNumOfOrderedResults = 100000;
...
@@ -84,8 +84,8 @@ int32_t tsMaxNumOfOrderedResults = 100000;
// 10 ms for sliding time, the value will changed in case of time precision changed
// 10 ms for sliding time, the value will changed in case of time precision changed
int32_t
tsMinSlidingTime
=
10
;
int32_t
tsMinSlidingTime
=
10
;
// 1
0 m
s for interval time range, changed accordingly
// 1
u
s for interval time range, changed accordingly
int32_t
tsMinIntervalTime
=
1
0
;
int32_t
tsMinIntervalTime
=
1
;
// 20sec, the maximum value of stream computing delay, changed accordingly
// 20sec, the maximum value of stream computing delay, changed accordingly
int32_t
tsMaxStreamComputDelay
=
20000
;
int32_t
tsMaxStreamComputDelay
=
20000
;
...
...
src/os/src/detail/osTime.c
浏览文件 @
2badb991
...
@@ -348,6 +348,7 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec
...
@@ -348,6 +348,7 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec
{
1
.
0
/
1000000
,
1
.
0
/
1000
,
1
.}
};
{
1
.
0
/
1000000
,
1
.
0
/
1000
,
1
.}
};
return
(
int64_t
)((
double
)
time
*
factors
[
fromPrecision
][
toPrecision
]);
return
(
int64_t
)((
double
)
time
*
factors
[
fromPrecision
][
toPrecision
]);
}
}
static
int32_t
getDuration
(
int64_t
val
,
char
unit
,
int64_t
*
result
,
int32_t
timePrecision
)
{
static
int32_t
getDuration
(
int64_t
val
,
char
unit
,
int64_t
*
result
,
int32_t
timePrecision
)
{
switch
(
unit
)
{
switch
(
unit
)
{
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
2badb991
...
@@ -39,6 +39,12 @@ enum {
...
@@ -39,6 +39,12 @@ enum {
TSDB_QUERY_TYPE_LAST
=
2
,
TSDB_QUERY_TYPE_LAST
=
2
,
};
};
enum
{
TSDB_CACHED_TYPE_NONE
=
0
,
TSDB_CACHED_TYPE_LASTROW
=
1
,
TSDB_CACHED_TYPE_LAST
=
2
,
};
typedef
struct
SQueryFilePos
{
typedef
struct
SQueryFilePos
{
int32_t
fid
;
int32_t
fid
;
int32_t
slot
;
int32_t
slot
;
...
@@ -2751,10 +2757,11 @@ bool tsdbNextDataBlock(TsdbQueryHandleT pHandle) {
...
@@ -2751,10 +2757,11 @@ bool tsdbNextDataBlock(TsdbQueryHandleT pHandle) {
int64_t
stime
=
taosGetTimestampUs
();
int64_t
stime
=
taosGetTimestampUs
();
int64_t
elapsedTime
=
stime
;
int64_t
elapsedTime
=
stime
;
// TODO refactor: remove "type"
if
(
pQueryHandle
->
type
==
TSDB_QUERY_TYPE_LAST
)
{
if
(
pQueryHandle
->
type
==
TSDB_QUERY_TYPE_LAST
)
{
if
(
pQueryHandle
->
cachelastrow
==
1
)
{
if
(
pQueryHandle
->
cachelastrow
==
TSDB_CACHED_TYPE_LASTROW
)
{
return
loadCachedLastRow
(
pQueryHandle
);
return
loadCachedLastRow
(
pQueryHandle
);
}
else
if
(
pQueryHandle
->
cachelastrow
==
2
)
{
}
else
if
(
pQueryHandle
->
cachelastrow
==
TSDB_CACHED_TYPE_LAST
)
{
return
loadCachedLast
(
pQueryHandle
);
return
loadCachedLast
(
pQueryHandle
);
}
}
}
}
...
@@ -2960,7 +2967,7 @@ out:
...
@@ -2960,7 +2967,7 @@ out:
}
}
bool
isTsdbCacheLastRow
(
TsdbQueryHandleT
*
pQueryHandle
)
{
bool
isTsdbCacheLastRow
(
TsdbQueryHandleT
*
pQueryHandle
)
{
return
((
STsdbQueryHandle
*
)
pQueryHandle
)
->
cachelastrow
>
0
;
return
((
STsdbQueryHandle
*
)
pQueryHandle
)
->
cachelastrow
>
TSDB_CACHED_TYPE_NONE
;
}
}
int32_t
checkForCachedLastRow
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
groupList
)
{
int32_t
checkForCachedLastRow
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
groupList
)
{
...
@@ -2978,9 +2985,9 @@ int32_t checkForCachedLastRow(STsdbQueryHandle* pQueryHandle, STableGroupInfo *g
...
@@ -2978,9 +2985,9 @@ int32_t checkForCachedLastRow(STsdbQueryHandle* pQueryHandle, STableGroupInfo *g
if
(((
STable
*
)
pInfo
->
pTable
)
->
lastRow
)
{
if
(((
STable
*
)
pInfo
->
pTable
)
->
lastRow
)
{
code
=
tsdbGetCachedLastRow
(
pInfo
->
pTable
,
NULL
,
&
key
);
code
=
tsdbGetCachedLastRow
(
pInfo
->
pTable
,
NULL
,
&
key
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pQueryHandle
->
cachelastrow
=
0
;
pQueryHandle
->
cachelastrow
=
TSDB_CACHED_TYPE_NONE
;
}
else
{
}
else
{
pQueryHandle
->
cachelastrow
=
1
;
pQueryHandle
->
cachelastrow
=
TSDB_CACHED_TYPE_LASTROW
;
}
}
}
}
...
@@ -3000,12 +3007,11 @@ int32_t checkForCachedLast(STsdbQueryHandle* pQueryHandle) {
...
@@ -3000,12 +3007,11 @@ int32_t checkForCachedLast(STsdbQueryHandle* pQueryHandle) {
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
pQueryHandle
->
pTsdb
&&
atomic_load_8
(
&
pQueryHandle
->
pTsdb
->
hasCachedLastColumn
)){
if
(
pQueryHandle
->
pTsdb
&&
atomic_load_8
(
&
pQueryHandle
->
pTsdb
->
hasCachedLastColumn
)){
pQueryHandle
->
cachelastrow
=
2
;
pQueryHandle
->
cachelastrow
=
TSDB_CACHED_TYPE_LAST
;
}
}
// update the tsdb query time range
// update the tsdb query time range
if
(
pQueryHandle
->
cachelastrow
)
{
if
(
pQueryHandle
->
cachelastrow
)
{
pQueryHandle
->
window
=
TSWINDOW_INITIALIZER
;
pQueryHandle
->
checkFiles
=
false
;
pQueryHandle
->
checkFiles
=
false
;
pQueryHandle
->
activeIndex
=
-
1
;
// start from -1
pQueryHandle
->
activeIndex
=
-
1
;
// start from -1
}
}
...
...
tests/script/general/parser/fill_us.sim
浏览文件 @
2badb991
...
@@ -959,14 +959,14 @@ endi
...
@@ -959,14 +959,14 @@ endi
if $data31 != 9.000000000 then
if $data31 != 9.000000000 then
return -1
return -1
endi
endi
if $data41 !=
null
then
if $data41 !=
NULL
then
print ===== $data41
print ===== $data41
return -1
return -1
endi
endi
if $data51 != 16.000000000 then
if $data51 != 16.000000000 then
return -1
return -1
endi
endi
if $data61 !=
null
then
if $data61 !=
NULL
then
print ===== $data61
print ===== $data61
return -1
return -1
endi
endi
...
...
tests/script/general/parser/last_cache.sim
浏览文件 @
2badb991
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v
0
system sh/cfg.sh -n dnode1 -c walLevel -v
1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
...
...
tests/script/general/parser/testSuite.sim
浏览文件 @
2badb991
...
@@ -12,7 +12,7 @@ run general/parser/create_tb.sim
...
@@ -12,7 +12,7 @@ run general/parser/create_tb.sim
run general/parser/dbtbnameValidate.sim
run general/parser/dbtbnameValidate.sim
run general/parser/fill.sim
run general/parser/fill.sim
run general/parser/fill_stb.sim
run general/parser/fill_stb.sim
#run general/parser/fill_us.sim #
run general/parser/fill_us.sim
run general/parser/first_last.sim
run general/parser/first_last.sim
run general/parser/import_commit1.sim
run general/parser/import_commit1.sim
run general/parser/import_commit2.sim
run general/parser/import_commit2.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录