Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
a098310e
I
Iotdb
项目概览
apache
/
Iotdb
10 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a098310e
编写于
8月 22, 2019
作者:
Q
qiaojialin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix reviews
上级
f9a1ab8a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
71 addition
and
213 deletion
+71
-213
client/src/main/java/org/apache/iotdb/session/IoTDBRowBatch.java
...src/main/java/org/apache/iotdb/session/IoTDBRowBatch.java
+0
-1
docs/Documentation/UserGuide/7-Client API/1-Client API.md
docs/Documentation/UserGuide/7-Client API/1-Client API.md
+2
-2
example/client/pom.xml
example/client/pom.xml
+21
-24
example/client/src/main/java/org/apache/iotdb/client/SessionExample.java
...src/main/java/org/apache/iotdb/client/SessionExample.java
+10
-0
example/client/src/main/java/org/apache/iotdb/client/SessionTest.java
...nt/src/main/java/org/apache/iotdb/client/SessionTest.java
+0
-70
example/client/src/main/java/org/apache/iotdb/client/StatementExample.java
...c/main/java/org/apache/iotdb/client/StatementExample.java
+13
-11
example/tsfile/pom.xml
example/tsfile/pom.xml
+19
-26
jdbc/src/test/java/org/apache/iotdb/jdbc/demo/StatementDemo.java
...c/test/java/org/apache/iotdb/jdbc/demo/StatementDemo.java
+0
-68
server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java
...tdb/db/engine/storagegroup/StorageGroupProcessorTest.java
+0
-4
service-rpc/src/main/thrift/rpc.thrift
service-rpc/src/main/thrift/rpc.thrift
+6
-7
未找到文件。
client/src/main/java/org/apache/iotdb/session/IoTDBRowBatch.java
浏览文件 @
a098310e
...
...
@@ -57,7 +57,6 @@ public class IoTDBRowBatch {
columns
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
measurements
.
size
();
i
++)
{
TSDataValueList
dataValueList
=
new
TSDataValueList
();
dataValueList
.
setType
(
dataTypes
.
get
(
i
));
switch
(
dataTypes
.
get
(
i
))
{
case
BOOLEAN:
dataValueList
.
setBool_vals
(
new
ArrayList
<>());
...
...
docs/Documentation/UserGuide/7-Client API/1-Client API.md
浏览文件 @
a098310e
...
...
@@ -45,13 +45,13 @@ In root directory:
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-client</artifactId>
<version>0.
8
.0-SNAPSHOT</version>
<version>0.
9
.0-SNAPSHOT</version>
</dependency>
</dependencies>
```
## Examples
## Examples
without Standard JDBC
This chapter provides an example of how to open an IoTDB session, execute a batch insertion.
...
...
example/client/pom.xml
浏览文件 @
a098310e
...
...
@@ -19,28 +19,25 @@
under the License.
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
iotdb-examples
</artifactId>
<groupId>
org.apache.iotdb
</groupId>
<version>
0.9.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
client-example
</artifactId>
<name>
client-example
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
iotdb-client
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
iotdb-examples
</artifactId>
<groupId>
org.apache.iotdb
</groupId>
<version>
0.9.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
client-example
</artifactId>
<name>
client-example
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
iotdb-client
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
example/client/src/main/java/org/apache/iotdb/client/SessionExample.java
浏览文件 @
a098310e
...
...
@@ -6,6 +6,16 @@ import org.apache.iotdb.service.rpc.thrift.IoTDBDataType;
import
org.apache.iotdb.session.IoTDBRowBatch
;
import
org.apache.iotdb.session.Session
;
/**
* you need to set storage group and create timeseries first from Client or JDBC
*
* for this example:
*
* SET STORAGE GROUP TO root.sg1
* CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE
* CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE
* CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=RLE
*/
public
class
SessionExample
{
public
static
void
main
(
String
[]
args
)
{
...
...
example/client/src/main/java/org/apache/iotdb/client/SessionTest.java
已删除
100644 → 0
浏览文件 @
f9a1ab8a
package
org.apache.iotdb.client
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.iotdb.service.rpc.thrift.IoTDBDataType
;
import
org.apache.iotdb.session.IoTDBRowBatch
;
import
org.apache.iotdb.session.Session
;
public
class
SessionTest
{
public
static
void
main
(
String
[]
args
)
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
"org.apache.iotdb.jdbc.IoTDBDriver"
);
Connection
connection
=
null
;
try
{
connection
=
DriverManager
.
getConnection
(
"jdbc:iotdb://127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
();
statement
.
execute
(
"SET STORAGE GROUP TO root.sg1"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=FLOAT, ENCODING=RLE"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=RLE"
);
Session
session
=
new
Session
(
"127.0.0.1"
,
6667
,
"root"
,
"root"
);
session
.
open
();
List
<
String
>
measurements
=
new
ArrayList
<>();
measurements
.
add
(
"s1"
);
measurements
.
add
(
"s2"
);
measurements
.
add
(
"s3"
);
List
<
IoTDBDataType
>
dataTypes
=
new
ArrayList
<>();
dataTypes
.
add
(
IoTDBDataType
.
FLOAT
);
dataTypes
.
add
(
IoTDBDataType
.
FLOAT
);
dataTypes
.
add
(
IoTDBDataType
.
FLOAT
);
List
<
Object
>
values
=
new
ArrayList
<>();
values
.
add
(
1.0f
);
values
.
add
(
1.0f
);
values
.
add
(
1.0f
);
long
total
=
0
;
for
(
long
i
=
0
;
i
<
1000
;
i
++)
{
IoTDBRowBatch
rowBatch
=
new
IoTDBRowBatch
(
"root.sg1.d1"
,
measurements
,
dataTypes
);
for
(
long
j
=
0
;
j
<
100
;
j
++)
{
rowBatch
.
addRow
(
i
*
100
+
j
,
values
);
}
long
start
=
System
.
nanoTime
();
session
.
insertBatch
(
rowBatch
);
total
+=
System
.
nanoTime
()
-
start
;
}
System
.
out
.
println
(
"cost: "
+
total
);
session
.
close
();
statement
.
close
();
}
finally
{
connection
.
close
();
}
}
}
example/client/src/main/java/org/apache/iotdb/client/Statement
Test
.java
→
example/client/src/main/java/org/apache/iotdb/client/Statement
Example
.java
浏览文件 @
a098310e
...
...
@@ -25,7 +25,7 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.sql.Statement
;
public
class
Statement
Test
{
public
class
Statement
Example
{
public
static
void
main
(
String
[]
args
)
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
"org.apache.iotdb.jdbc.IoTDBDriver"
);
...
...
@@ -38,21 +38,23 @@ public class StatementTest {
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE"
);
statement
.
execute
(
"CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=FLOAT, ENCODING=RLE"
);
long
total
=
0
;
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
for
(
int
j
=
0
;
j
<
100
;
j
++)
{
statement
.
addBatch
(
"insert into root.sg1.d1(timestamp, s1, s2, s3) values("
+
(
i
*
100
+
j
)
+
","
+
1.0
+
","
+
1.0
+
","
+
1.0
+
")"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
statement
.
addBatch
(
"insert into root.sg1.d1(timestamp, s1, s2, s3) values("
+
(
i
*
10
+
j
)
+
","
+
1.0
+
","
+
1.0
+
","
+
1.0
+
")"
);
}
long
start
=
System
.
nanoTime
();
statement
.
executeBatch
();
total
+=
System
.
nanoTime
()
-
start
;
statement
.
clearBatch
();
}
System
.
out
.
println
(
"cost: "
+
total
);
ResultSet
resultSet
=
statement
.
executeQuery
(
"select * from root"
);
ResultSetMetaData
resultSetMetaData
=
resultSet
.
getMetaData
();
while
(
resultSet
.
next
())
{
StringBuilder
builder
=
new
StringBuilder
();
for
(
int
i
=
1
;
i
<=
resultSetMetaData
.
getColumnCount
();
i
++)
{
builder
.
append
(
resultSet
.
getString
(
i
)).
append
(
","
);
}
System
.
out
.
println
(
builder
);
}
statement
.
close
();
}
finally
{
connection
.
close
();
}
...
...
example/tsfile/pom.xml
浏览文件 @
a098310e
...
...
@@ -19,32 +19,25 @@
under the License.
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
iotdb-examples
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
iotdb-examples
</artifactId>
<artifactId>
tsfile-example
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
tsfile-example
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
<name>
tsfile-example
</name>
<!-- FIXME change it to the project's website -->
<url>
http://www.example.com
</url>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
tsfile
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<name>
tsfile-example
</name>
<!-- FIXME change it to the project's website -->
<url>
http://www.example.com
</url>
<dependencies>
<dependency>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
tsfile
</artifactId>
<version>
0.9.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
jdbc/src/test/java/org/apache/iotdb/jdbc/demo/StatementDemo.java
已删除
100644 → 0
浏览文件 @
f9a1ab8a
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package
org.apache.iotdb.jdbc.demo
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
public
class
StatementDemo
{
public
static
void
main
(
String
[]
args
)
throws
ClassNotFoundException
,
SQLException
{
Class
.
forName
(
"org.apache.iotdb.jdbc.IoTDBDriver"
);
Connection
connection
=
null
;
try
{
connection
=
DriverManager
.
getConnection
(
"jdbc:iotdb://127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
();
statement
.
execute
(
"SET STORAGE GROUP TO root.ln.wf01.wt01"
);
statement
.
execute
(
"CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN"
);
statement
.
execute
(
"CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,status) values(1509465600000,true)"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,status) values(1509465660000,true)"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,status) values(1509465720000,false)"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,temperature) values(1509465600000,25.957603)"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,temperature) values(1509465660000,24.359503)"
);
statement
.
execute
(
"insert into root.ln.wf01.wt01(timestamp,temperature) values(1509465720000,20.092794)"
);
ResultSet
resultSet
=
statement
.
executeQuery
(
"select * from root"
);
ResultSetMetaData
resultSetMetaData
=
resultSet
.
getMetaData
();
while
(
resultSet
.
next
())
{
StringBuilder
builder
=
new
StringBuilder
();
for
(
int
i
=
1
;
i
<=
resultSetMetaData
.
getColumnCount
();
i
++)
{
builder
.
append
(
resultSet
.
getString
(
i
)).
append
(
","
);
}
System
.
out
.
println
(
builder
);
}
statement
.
close
();
}
finally
{
connection
.
close
();
}
}
}
server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java
浏览文件 @
a098310e
...
...
@@ -92,9 +92,7 @@ public class StorageGroupProcessorTest {
Long
[]
times
=
new
Long
[
100
];
TSDataValueList
[]
dataValueLists
=
new
TSDataValueList
[
2
];
dataValueLists
[
0
]
=
new
TSDataValueList
();
dataValueLists
[
0
].
setType
(
IoTDBDataType
.
INT32
);
dataValueLists
[
1
]
=
new
TSDataValueList
();
dataValueLists
[
1
].
setType
(
IoTDBDataType
.
INT64
);
for
(
long
i
=
1
;
i
<=
100
;
i
++)
{
times
[(
int
)
i
-
1
]
=
i
;
dataValueLists
[
0
].
addToInt_vals
((
int
)
i
);
...
...
@@ -113,9 +111,7 @@ public class StorageGroupProcessorTest {
times
=
new
Long
[
100
];
dataValueLists
=
new
TSDataValueList
[
2
];
dataValueLists
[
0
]
=
new
TSDataValueList
();
dataValueLists
[
0
].
setType
(
IoTDBDataType
.
INT32
);
dataValueLists
[
1
]
=
new
TSDataValueList
();
dataValueLists
[
1
].
setType
(
IoTDBDataType
.
INT64
);
for
(
long
i
=
50
;
i
<=
149
;
i
++)
{
times
[(
int
)
i
-
50
]
=
i
;
dataValueLists
[
0
].
addToInt_vals
((
int
)
i
);
...
...
service-rpc/src/main/thrift/rpc.thrift
浏览文件 @
a098310e
...
...
@@ -202,13 +202,12 @@ struct TSDataValue{
struct TSDataValueList{
1: required IoTDBDataType type
2: optional list<bool> bool_vals
3: optional list<i32> int_vals
4: optional list<i64> long_vals
5: optional list<double> float_vals
6: optional list<double> double_vals
7: optional list<binary> binary_vals
1: optional list<bool> bool_vals
2: optional list<i32> int_vals
3: optional list<i64> long_vals
4: optional list<double> float_vals
5: optional list<double> double_vals
6: optional list<binary> binary_vals
}
struct TSRowRecord{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录