Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d6e01767
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d6e01767
编写于
6月 27, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 27, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2458 from taosdata/feature/query
Feature/query
上级
625248df
5835964c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
59 addition
and
27 deletion
+59
-27
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+3
-1
src/client/tests/CMakeLists.txt
src/client/tests/CMakeLists.txt
+15
-0
src/common/src/ttimezone.c
src/common/src/ttimezone.c
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+16
-9
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+10
-2
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+1
-1
src/util/src/ttime.c
src/util/src/ttime.c
+12
-14
tests/script/general/parser/projection_limit_offset.sim
tests/script/general/parser/projection_limit_offset.sim
+1
-0
未找到文件。
src/client/CMakeLists.txt
浏览文件 @
d6e01767
...
...
@@ -34,7 +34,9 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
VERSION_INFO
)
MESSAGE
(
STATUS
"build version
${
VERSION_INFO
}
"
)
SET_TARGET_PROPERTIES
(
taos PROPERTIES VERSION
${
VERSION_INFO
}
SOVERSION 1
)
ADD_SUBDIRECTORY
(
tests
)
ELSEIF
(
TD_WINDOWS_64
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/windows
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/windows/win32
)
...
...
src/client/tests/CMakeLists.txt
0 → 100644
浏览文件 @
d6e01767
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
FIND_PATH
(
HEADER_GTEST_INCLUDE_DIR gtest.h /usr/include/gtest /usr/local/include/gtest
)
FIND_LIBRARY
(
LIB_GTEST_STATIC_DIR libgtest.a /usr/lib/ /usr/local/lib
)
IF
(
HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR
)
MESSAGE
(
STATUS
"gTest library found, build unit test"
)
INCLUDE_DIRECTORIES
(
${
HEADER_GTEST_INCLUDE_DIR
}
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
cliTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
cliTest taos tutil common gtest pthread
)
ENDIF
()
\ No newline at end of file
src/common/src/ttimezone.c
浏览文件 @
d6e01767
...
...
@@ -20,6 +20,7 @@
#include "tconfig.h"
#include "tutil.h"
// TODO refactor to set the tz value through parameter
void
tsSetTimeZone
()
{
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
uPrint
(
"timezone is set to %s by %s"
,
tsTimezone
,
tsCfgStatusStr
[
cfg_timezone
->
cfgStatus
]);
...
...
src/query/src/qExecutor.c
浏览文件 @
d6e01767
...
...
@@ -822,7 +822,7 @@ static char *getDataBlock(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sas
}
/**
*
*
todo set the last value for pQueryTableInfo as in rowwiseapplyfunctions
* @param pRuntimeEnv
* @param forwardStep
* @param tsCols
...
...
@@ -1064,16 +1064,18 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
STableQueryInfo
*
item
=
pQuery
->
current
;
TSKEY
*
tsCols
=
(
TSKEY
*
)
((
SColumnInfoData
*
)
taosArrayGet
(
pDataBlock
,
0
))
->
pData
;
bool
groupbyStateValue
=
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
);
SColumnInfoData
*
pColumnInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pDataBlock
,
0
);
TSKEY
*
tsCols
=
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
?
(
TSKEY
*
)
pColumnInfoData
->
pData
:
NULL
;
bool
groupbyColumnValue
=
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
);
SArithmeticSupport
*
sasArray
=
calloc
((
size_t
)
pQuery
->
numOfOutput
,
sizeof
(
SArithmeticSupport
));
int16_t
type
=
0
;
int16_t
bytes
=
0
;
char
*
groupbyColumnData
=
NULL
;
if
(
groupby
State
Value
)
{
if
(
groupby
Column
Value
)
{
groupbyColumnData
=
getGroupbyColumnData
(
pQuery
,
&
type
,
&
bytes
,
pDataBlock
);
}
...
...
@@ -1161,7 +1163,7 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
pWindowResInfo
->
curIndex
=
index
;
}
else
{
// other queries
// decide which group this rows belongs to according to current state value
if
(
groupby
State
Value
)
{
if
(
groupby
Column
Value
)
{
char
*
val
=
groupbyColumnData
+
bytes
*
offset
;
int32_t
ret
=
setGroupResultOutputBuf
(
pRuntimeEnv
,
val
,
type
,
bytes
);
...
...
@@ -1186,9 +1188,14 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
}
}
}
item
->
lastKey
=
tsCols
[
offset
]
+
step
;
assert
(
offset
>=
0
);
if
(
tsCols
!=
NULL
)
{
item
->
lastKey
=
tsCols
[
offset
]
+
step
;
}
else
{
item
->
lastKey
=
(
QUERY_IS_ASC_QUERY
(
pQuery
)
?
pDataBlockInfo
->
window
.
ekey
:
pDataBlockInfo
->
window
.
skey
)
+
step
;
}
// todo refactor: extract method
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
if
(
pQuery
->
pSelectExpr
[
i
].
base
.
functionId
!=
TSDB_FUNC_ARITHM
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
d6e01767
...
...
@@ -553,10 +553,18 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) {
return
0
;
}
void
tsdbRefTable
(
STable
*
pTable
)
{
T_REF_INC
(
pTable
);
}
void
tsdbRefTable
(
STable
*
pTable
)
{
int16_t
ref
=
T_REF_INC
(
pTable
);
tsdbTrace
(
"ref table:%s, uid:%"
PRIu64
", tid:%d, ref:%d"
,
TABLE_CHAR_NAME
(
pTable
),
pTable
->
tableId
.
uid
,
pTable
->
tableId
.
tid
,
ref
);
}
void
tsdbUnRefTable
(
STable
*
pTable
)
{
if
(
T_REF_DEC
(
pTable
)
==
0
)
{
int16_t
ref
=
T_REF_DEC
(
pTable
);
tsdbTrace
(
"unref table:%s, uid:%"
PRIu64
", tid:%d, ref:%d"
,
TABLE_CHAR_NAME
(
pTable
),
pTable
->
tableId
.
uid
,
pTable
->
tableId
.
tid
,
ref
);
if
(
ref
==
0
)
{
tsdbTrace
(
"destroy table:%s uid:%"
PRIu64
", tid:%d"
,
TABLE_CHAR_NAME
(
pTable
),
pTable
->
tableId
.
uid
,
pTable
->
tableId
.
tid
);
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_CHILD_TABLE
)
{
tsdbUnRefTable
(
pTable
->
pSuper
);
}
...
...
src/util/src/tskiplist.c
浏览文件 @
d6e01767
...
...
@@ -38,7 +38,7 @@ static FORCE_INLINE int32_t getSkipListNodeRandomHeight(SSkipList *pSkipList) {
const
uint32_t
factor
=
4
;
int32_t
n
=
1
;
while
((
taosR
and
()
%
factor
)
==
0
&&
n
<=
pSkipList
->
maxLevel
)
{
while
((
r
and
()
%
factor
)
==
0
&&
n
<=
pSkipList
->
maxLevel
)
{
n
++
;
}
...
...
src/util/src/ttime.c
浏览文件 @
d6e01767
...
...
@@ -48,23 +48,21 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
const
unsigned
int
day
,
const
unsigned
int
hour
,
const
unsigned
int
min
,
const
unsigned
int
sec
)
{
unsigned
int
mon
=
mon0
,
year
=
year0
;
/* 1..12 -> 11,12,1..10 */
if
(
0
>=
(
int
)
(
mon
-=
2
))
{
mon
+=
12
;
/* Puts Feb last since it has leap day */
year
-=
1
;
}
//int64_t res = (((((int64_t) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
// year*365 - 719499)*24 + hour)*60 + min)*60 + sec);
int64_t
res
;
res
=
367
*
((
int64_t
)
mon
)
/
12
;
res
+=
year
/
4
-
year
/
100
+
year
/
400
+
day
+
year
*
365
-
719499
;
unsigned
int
mon
=
mon0
,
year
=
year0
;
/* 1..12 -> 11,12,1..10 */
if
(
0
>=
(
int
)
(
mon
-=
2
))
{
mon
+=
12
;
/* Puts Feb last since it has leap day */
year
-=
1
;
}
int64_t
res
=
367
*
((
int64_t
)
mon
)
/
12
;
res
+=
((
int64_t
)(
year
/
4
-
year
/
100
+
year
/
400
+
day
+
year
*
365
)
-
719499
);
// this value may be less than 0
res
=
res
*
24
;
res
=
((
res
+
hour
)
*
60
+
min
)
*
60
+
sec
;
return
(
res
+
timezone
);
return
(
res
+
timezone
);
}
// ==== mktime() kernel code =================//
static
int64_t
m_deltaUtc
=
0
;
...
...
tests/script/general/parser/projection_limit_offset.sim
浏览文件 @
d6e01767
...
...
@@ -80,6 +80,7 @@ print $rows
sql select ts from group_mt0 where ts>='1970-1-1 8:1:43' and ts<='1970-1-1 8:1:43.500' limit 8000 offset 0;
if $rows != 4008 then
print expect 4008, actual:$rows
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录