Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
d382c50b
T
TDengine
项目概览
小楼昨夜-听风雨
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d382c50b
编写于
6月 25, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:taosdata/TDengine into devx
上级
795bd8c0
8c95099d
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
621 addition
and
106 deletion
+621
-106
README-CN.md
README-CN.md
+8
-2
README.md
README.md
+6
-0
documentation20/cn/08.connector/docs.md
documentation20/cn/08.connector/docs.md
+3
-0
documentation20/cn/12.taos-sql/docs.md
documentation20/cn/12.taos-sql/docs.md
+34
-3
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+5
-0
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+2
-2
tests/pytest/insert/in_function.py
tests/pytest/insert/in_function.py
+486
-98
tests/pytest/tools/taosdumpTest.py
tests/pytest/tools/taosdumpTest.py
+2
-0
tests/pytest/tools/taosdumpTest2.py
tests/pytest/tools/taosdumpTest2.py
+74
-0
未找到文件。
README-CN.md
浏览文件 @
d382c50b
...
...
@@ -23,7 +23,7 @@ TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维
TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是
[
数据模型
](
https://www.taosdata.com/cn/documentation/architecture
)
与
[
数据建模
](
https://www.taosdata.com/cn/documentation/model
)
。除本文档之外,欢迎
[
下载产品白皮书
](
https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf
)
。
#
生成
#
构建
TDengine目前2.0版服务器仅能在Linux系统上安装和运行,后续会支持Windows、macOS等系统。客户端可以在Windows或Linux上安装和运行。任何OS的应用也可以选择RESTful接口连接服务器taosd。CPU支持X64/ARM64/MIPS64/Alpha64,后续会支持ARM32、RISC-V等CPU架构。用户可根据需求选择通过
[
源码
](
https://www.taosdata.com/cn/getting-started/#通过源码安装
)
或者
[
安装包
](
https://www.taosdata.com/cn/getting-started/#通过安装包安装
)
来安装。本快速指南仅适用于通过源码安装。
...
...
@@ -107,7 +107,7 @@ Go 连接器和 Grafana 插件在其他独立仓库,如果安装它们的话
git submodule update
--init
--recursive
```
##
生成
TDengine
##
构建
TDengine
### Linux 系统
...
...
@@ -116,6 +116,12 @@ mkdir debug && cd debug
cmake ..
&&
cmake
--build
.
```
您可以选择使用 Jemalloc 作为内存分配器,替代默认的 glibc:
```
bash
apt
install
autoconf
cmake ..
-DJEMALLOC_ENABLED
=
true
```
在X86-64、X86、arm64、arm32 和 mips64 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。
aarch64:
...
...
README.md
浏览文件 @
d382c50b
...
...
@@ -110,6 +110,12 @@ mkdir debug && cd debug
cmake ..
&&
cmake
--build
.
```
You can use Jemalloc as memory allocator instead of glibc:
```
apt install autoconf
cmake .. -DJEMALLOC_ENABLED=true
```
TDengine build script can detect the host machine's architecture on X86-64, X86, arm64, arm32 and mips64 platform.
You can also specify CPUTYPE option like aarch64 or aarch32 too if the detection result is not correct:
...
...
documentation20/cn/08.connector/docs.md
浏览文件 @
d382c50b
...
...
@@ -427,12 +427,15 @@ TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时
*
res:查询结果集,注意结果集中可能没有记录
*
param:调用
`taos_subscribe`
时客户程序提供的附加参数
*
code:错误码
**注意**
:在这个回调函数里不可以做耗时过长的处理,尤其是对于返回的结果集中数据较多的情况,否则有可能导致客户端阻塞等异常状态。如果必须进行复杂计算,则建议在另外的线程中进行处理。
*
`TAOS_RES *taos_consume(TAOS_SUB *tsub)`
同步模式下,该函数用来获取订阅的结果。 用户应用程序将其置于一个循环之中。 如两次调用
`taos_consume`
的间隔小于订阅的轮询周期,API将会阻塞,直到时间间隔超过此周期。 如果数据库有新记录到达,该API将返回该最新的记录,否则返回一个没有记录的空结果集。 如果返回值为
`NULL`
,说明系统出错。 异步模式下,用户程序不应调用此API。
**注意**
:在调用
`taos_consume()`
之后,用户应用应确保尽快调用
`taos_fetch_row()`
或
`taos_fetch_block()`
来处理订阅结果,否则服务端会持续缓存查询结果数据等待客户端读取,极端情况下会导致服务端内存消耗殆尽,影响服务稳定性。
*
`void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress)`
取消订阅。 如参数
`keepProgress`
不为0,API会保留订阅的进度信息,后续调用
`taos_subscribe`
时可以基于此进度继续;否则将删除进度信息,后续只能重新开始读取数据。
...
...
documentation20/cn/12.taos-sql/docs.md
浏览文件 @
d382c50b
...
...
@@ -854,7 +854,23 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
适用于:**表**。
适用于:**表、(超级表)**。
说明:从 2.1.3.0 版本开始,TWA 函数可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
- **IRATE**
```mysql
SELECT IRATE(field_name) FROM tb_name WHERE clause;
```
功能说明:计算瞬时增长率。使用时间区间中最后两个样本数据来计算瞬时增长速率;如果这两个值呈递减关系,那么只取最后一个数用于计算,而不是使用二者差值。
返回结果数据类型:双精度浮点数Double。
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
适用于:**表、(超级表)**。
说明:(从 2.1.3.0 版本开始新增此函数)IRATE 可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
- **SUM**
```mysql
...
...
@@ -1203,13 +1219,14 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
```
### 计算函数
- **DIFF**
```mysql
SELECT DIFF(field_name) FROM tb_name [WHERE clause];
```
功能说明:统计表中某列的值与前一行对应值的差。
返回结果数据类型:
同应用字段。
返回结果数据类型:同应用字段。
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
...
...
@@ -1227,13 +1244,27 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
Query OK, 2 row(s) in set (0.001162s)
```
- **DERIVATIVE**
```mysql
SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHERE clause];
```
功能说明:统计表中某列数值的单位变化率。其中单位时间区间的长度可以通过 time_interval 参数指定,最小可以是 1 秒(1s);ignore_negative 参数的值可以是 0 或 1,为 1 时表示忽略负值。
返回结果数据类型:双精度浮点数。
应用字段:不能应用在 timestamp、binary、nchar、bool 类型字段。
适用于:**表、(超级表)**。
说明:(从 2.1.3.0 版本开始新增此函数)输出结果行数是范围内总行数减一,第一行没有结果输出。DERIVATIVE 函数可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
- **SPREAD**
```mysql
SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause];
```
功能说明:统计表/超级表中某列的最大值和最小值之差。
返回结果数据类型:
双精度浮点数。
返回结果数据类型:双精度浮点数。
应用字段:不能应用在binary、nchar、bool类型字段。
...
...
src/common/inc/tdataformat.h
浏览文件 @
d382c50b
...
...
@@ -289,6 +289,11 @@ static FORCE_INLINE TKEY dataColsTKeyFirst(SDataCols *pCols) {
}
}
static
FORCE_INLINE
TSKEY
dataColsKeyAtRow
(
SDataCols
*
pCols
,
int
row
)
{
ASSERT
(
row
<
pCols
->
numOfRows
);
return
dataColsKeyAt
(
pCols
,
row
);
}
static
FORCE_INLINE
TSKEY
dataColsKeyFirst
(
SDataCols
*
pCols
)
{
if
(
pCols
->
numOfRows
)
{
return
dataColsKeyAt
(
pCols
,
0
);
...
...
src/common/src/tdataformat.c
浏览文件 @
d382c50b
...
...
@@ -452,7 +452,7 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *
SDataCols
*
pTarget
=
NULL
;
if
((
target
->
numOfRows
==
0
)
||
(
dataColsKeyLast
(
target
)
<
dataColsKey
First
(
source
)))
{
// No overlap
if
((
target
->
numOfRows
==
0
)
||
(
dataColsKeyLast
(
target
)
<
dataColsKey
AtRow
(
source
,
*
pOffset
)))
{
// No overlap
ASSERT
(
target
->
numOfRows
+
rowsToMerge
<=
target
->
maxPoints
);
for
(
int
i
=
0
;
i
<
rowsToMerge
;
i
++
)
{
for
(
int
j
=
0
;
j
<
source
->
numOfCols
;
j
++
)
{
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
d382c50b
...
...
@@ -982,9 +982,9 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments
->
len_of_binary
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-m"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
(
!
isStringNumber
(
argv
[
i
+
1
])))
{
(
isStringNumber
(
argv
[
i
+
1
])))
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-m need a
number
following!
\n
"
);
errorPrint
(
"%s"
,
"
\n\t
-m need a
letter-initial string
following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
arguments
->
tb_prefix
=
argv
[
++
i
];
...
...
tests/pytest/insert/in_function.py
浏览文件 @
d382c50b
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdumpTest.py
浏览文件 @
d382c50b
...
...
@@ -45,7 +45,9 @@ class TDTestCase:
for
i
in
range
(
100
):
sql
+=
"(%d, %d, 'nchar%d')"
%
(
currts
+
i
,
i
%
100
,
i
%
100
)
tdSql
.
execute
(
sql
)
os
.
system
(
"rm /tmp/*.sql"
)
os
.
system
(
"taosdump --databases db -o /tmp"
)
tdSql
.
execute
(
"drop database db"
)
...
...
tests/pytest/tools/taosdumpTest2.py
0 → 100644
浏览文件 @
d382c50b
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1601481600000
self
.
numberOfTables
=
1
self
.
numberOfRecords
=
15000
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)"
)
tdSql
.
execute
(
"create table t1 using st tags(0)"
)
currts
=
self
.
ts
finish
=
0
while
(
finish
<
self
.
numberOfRecords
):
sql
=
"insert into t1 values"
for
i
in
range
(
finish
,
self
.
numberOfRecords
):
sql
+=
"(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')"
%
(
currts
+
i
)
finish
=
i
+
1
if
(
1048576
-
len
(
sql
))
<
16384
:
break
tdSql
.
execute
(
sql
)
os
.
system
(
"rm /tmp/*.sql"
)
os
.
system
(
"taosdump --databases db -o /tmp -B 32766 -L 1048576"
)
tdSql
.
execute
(
"drop database db"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
0
)
os
.
system
(
"taosdump -i /tmp"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'db'
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'st'
)
tdSql
.
query
(
"select count(*) from t1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfRecords
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录