You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/01/27 04:38:10 UTC
[iotdb] 01/02: change example
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch two_stage_pipeline
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit d2886bdf081a153db4bfc62889b7724a054b1295
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Wed Jan 27 10:35:12 2021 +0800
change example
---
.../session/src/main/java/org/apache/iotdb/SessionExample.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/example/session/src/main/java/org/apache/iotdb/SessionExample.java b/example/session/src/main/java/org/apache/iotdb/SessionExample.java
index 916374c..4be2c7b 100644
--- a/example/session/src/main/java/org/apache/iotdb/SessionExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/SessionExample.java
@@ -273,21 +273,19 @@ public class SessionExample {
Tablet tablet = new Tablet(ROOT_SG1_D1, schemaList, 1000);
- //Method 1 to add tablet data
- long timestamp = System.currentTimeMillis();
-
+ Random random = new Random(19876);
for (long row = 0; row < MAX_ROW_NUM; row++) {
int rowIndex = tablet.rowSize++;
+ long timestamp = random.nextInt((int) MAX_ROW_NUM);
tablet.addTimestamp(rowIndex, timestamp);
for (int s = 0; s < 1000; s++) {
- double value = new Random().nextDouble();
+ double value = random.nextDouble();
tablet.addValue(schemaList.get(s).getMeasurementId(), rowIndex, value);
}
if (tablet.rowSize == tablet.getMaxRowNumber()) {
- session.insertTablet(tablet, true);
+ session.insertTablet(tablet);
tablet.reset();
}
- timestamp++;
}
if (tablet.rowSize != 0) {