This is an automated email from the ASF dual-hosted git repository.
leirui pushed a commit to branch research/M4-visualization
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/research/M4-visualization by
this push:
new d959a04159 add
d959a04159 is described below
commit d959a04159411bf27afa8a2a218df4e168fb3be1
Author: Lei Rui <[email protected]>
AuthorDate: Sat Oct 8 22:49:36 2022 +0800
add
---
.../org/apache/iotdb/db/service/TSServiceImpl.java | 120 ++++++-------
.../apache/iotdb/session/MyBasicOperationTest.java | 11 +-
.../session/MyRealDataTest1_WriteAndQuery.java | 188 +++++++++++----------
.../iotdb/session/MyRealDataTest2_OnlyQuery.java | 2 +-
.../session/MyRealDataTest3_WriteAndRawQuery.java | 183 ++++++++++----------
.../tsfile/common/constant/TsFileConstant.java | 15 +-
.../encoding/decoder/DeltaBinaryDecoder.java | 40 ++---
7 files changed, 276 insertions(+), 283 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 4636f867b5..7d5ba86751 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -18,22 +18,6 @@
*/
package org.apache.iotdb.db.service;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.sql.SQLException;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.apache.iotdb.db.IOMonitor;
import org.apache.iotdb.db.auth.AuthException;
import org.apache.iotdb.db.auth.AuthorityChecker;
@@ -147,13 +131,29 @@ import
org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.read.common.Path;
import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
+
+import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * Thrift RPC implementation at server side.
- */
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.sql.SQLException;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+/** Thrift RPC implementation at server side. */
public class TSServiceImpl implements TSIService.Iface {
private static final Logger LOGGER =
LoggerFactory.getLogger(TSServiceImpl.class);
@@ -327,9 +327,7 @@ public class TSServiceImpl implements TSIService.Iface {
}
}
- /**
- * release single operation resource
- */
+ /** release single operation resource */
public void releaseQueryResource(long queryId) throws StorageEngineException
{
sessionManager.releaseQueryResource(queryId);
}
@@ -610,13 +608,13 @@ public class TSServiceImpl implements TSIService.Iface {
return physicalPlan.isQuery()
? internalExecuteQueryStatement(
- statement,
- req.statementId,
- physicalPlan,
- req.fetchSize,
- req.timeout,
- sessionManager.getUsername(req.getSessionId()),
- req.isEnableRedirectQuery())
+ statement,
+ req.statementId,
+ physicalPlan,
+ req.fetchSize,
+ req.timeout,
+ sessionManager.getUsername(req.getSessionId()),
+ req.isEnableRedirectQuery())
: executeUpdateStatement(physicalPlan, req.getSessionId());
} catch (InterruptedException e) {
LOGGER.error(INFO_INTERRUPT_ERROR, req, e);
@@ -643,13 +641,13 @@ public class TSServiceImpl implements TSIService.Iface {
// System.out.println("====DEBUG====: fetchSize=" + req.fetchSize);
return physicalPlan.isQuery()
? internalExecuteQueryStatement(
- statement,
- req.statementId,
- physicalPlan,
- req.fetchSize,
- req.timeout,
- sessionManager.getUsername(req.getSessionId()),
- req.isEnableRedirectQuery())
+ statement,
+ req.statementId,
+ physicalPlan,
+ req.fetchSize,
+ req.timeout,
+ sessionManager.getUsername(req.getSessionId()),
+ req.isEnableRedirectQuery())
: RpcUtils.getTSExecuteStatementResp(
TSStatusCode.EXECUTE_STATEMENT_ERROR, "Statement is not a query
statement.");
} catch (InterruptedException e) {
@@ -672,13 +670,13 @@ public class TSServiceImpl implements TSIService.Iface {
+ ". timeColumnTS2DIFFLoadBatchCost="
+ TsFileConstant.timeColumnTS2DIFFLoadBatchCost.getSum()
+ "us"
-// + ". countForRegularEqual="
-// + TsFileConstant.countForRegularEqual
-// + ". countForRegularNOTEqual="
-// + TsFileConstant.countForRegularNOTEqual
-// + ". countForRegularZero="
-// + TsFileConstant.countForRegularZero
- );
+ // + ". countForRegularEqual="
+ // + TsFileConstant.countForRegularEqual
+ // + ". countForRegularNOTEqual="
+ // + TsFileConstant.countForRegularNOTEqual
+ // + ". countForRegularZero="
+ // + TsFileConstant.countForRegularZero
+ );
IOMonitor.finish();
return ret;
}
@@ -694,13 +692,13 @@ public class TSServiceImpl implements TSIService.Iface {
processor.rawDataQueryReqToPhysicalPlan(req,
sessionManager.getZoneId(req.sessionId));
return physicalPlan.isQuery()
? internalExecuteQueryStatement(
- "",
- req.statementId,
- physicalPlan,
- req.fetchSize,
- config.getQueryTimeoutThreshold(),
- sessionManager.getUsername(req.sessionId),
- req.isEnableRedirectQuery())
+ "",
+ req.statementId,
+ physicalPlan,
+ req.fetchSize,
+ config.getQueryTimeoutThreshold(),
+ sessionManager.getUsername(req.sessionId),
+ req.isEnableRedirectQuery())
: RpcUtils.getTSExecuteStatementResp(
TSStatusCode.EXECUTE_STATEMENT_ERROR, "Statement is not a query
statement.");
} catch (InterruptedException e) {
@@ -716,7 +714,7 @@ public class TSServiceImpl implements TSIService.Iface {
/**
* @param plan must be a plan for Query: FillQueryPlan, AggregationPlan,
GroupByTimePlan, UDFPlan,
- * some AuthorPlan
+ * some AuthorPlan
*/
@SuppressWarnings({"squid:S3776", "squid:S1141"}) // Suppress high Cognitive
Complexity warning
private TSExecuteStatementResp internalExecuteQueryStatement(
@@ -728,8 +726,8 @@ public class TSServiceImpl implements TSIService.Iface {
String username,
boolean enableRedirect)
throws QueryProcessException, SQLException, StorageEngineException,
- QueryFilterOptimizationException, MetadataException, IOException,
InterruptedException,
- TException, AuthException {
+ QueryFilterOptimizationException, MetadataException, IOException,
InterruptedException,
+ TException, AuthException {
// start record execution time
IOMonitor.setSQL(statement);
@@ -867,9 +865,7 @@ public class TSServiceImpl implements TSIService.Iface {
dataSet.getDataTypes().stream().map(Enum::toString).collect(Collectors.toList()));
}
- /**
- * get ResultSet schema
- */
+ /** get ResultSet schema */
private TSExecuteStatementResp getQueryColumnHeaders(PhysicalPlan
physicalPlan, String username)
throws AuthException, TException, QueryProcessException,
MetadataException {
@@ -1138,12 +1134,10 @@ public class TSServiceImpl implements TSIService.Iface {
return encoder;
}
- /**
- * create QueryDataSet and buffer it for fetchResults
- */
+ /** create QueryDataSet and buffer it for fetchResults */
private QueryDataSet createQueryDataSet(long queryId, PhysicalPlan
physicalPlan, int fetchSize)
throws QueryProcessException, QueryFilterOptimizationException,
StorageEngineException,
- IOException, MetadataException, SQLException, TException,
InterruptedException {
+ IOException, MetadataException, SQLException, TException,
InterruptedException {
QueryContext context = genQueryContext(queryId, physicalPlan.isDebug());
if (physicalPlan instanceof QueryPlan) {
@@ -1202,7 +1196,7 @@ public class TSServiceImpl implements TSIService.Iface {
statement, sessionManager.getZoneId(sessionId),
DEFAULT_FETCH_SIZE);
return physicalPlan.isQuery()
? RpcUtils.getTSExecuteStatementResp(
- TSStatusCode.EXECUTE_STATEMENT_ERROR, "Statement is a query
statement.")
+ TSStatusCode.EXECUTE_STATEMENT_ERROR, "Statement is a query
statement.")
: executeUpdateStatement(physicalPlan, sessionId);
}
@@ -1632,9 +1626,7 @@ public class TSServiceImpl implements TSIService.Iface {
return insertTabletPlan;
}
- /**
- * construct one InsertMultiTabletPlan and process it
- */
+ /** construct one InsertMultiTabletPlan and process it */
public TSStatus insertTabletsInternal(TSInsertTabletsReq req) throws
IllegalPathException {
List<InsertTabletPlan> insertTabletPlanList = new ArrayList<>();
InsertMultiTabletPlan insertMultiTabletPlan = new InsertMultiTabletPlan();
diff --git
a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest.java
b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest.java
index 4ef67976ef..a452310523 100644
--- a/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest.java
+++ b/session/src/test/java/org/apache/iotdb/session/MyBasicOperationTest.java
@@ -1,9 +1,11 @@
package org.apache.iotdb.session;
+import org.apache.iotdb.tsfile.utils.BytesUtils;
+
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+
import java.text.DecimalFormat;
import java.util.Random;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.iotdb.tsfile.utils.BytesUtils;
public class MyBasicOperationTest {
@@ -20,7 +22,7 @@ public class MyBasicOperationTest {
int low = 0; // inclusive
int high = 256; // exclusive
int packNum = 128;
- int packWidth = 8; //equal to one byte length
+ int packWidth = 8; // equal to one byte length
byte[] buf = new byte[packNum];
for (int i = 0; i < packNum; i++) {
int v = r.nextInt(high - low) + low;
@@ -70,7 +72,8 @@ public class MyBasicOperationTest {
double p90 = statistics.getPercentile(90);
double p95 = statistics.getPercentile(95);
String res =
- name + "_stats"
+ name
+ + "_stats"
+ ": "
+ "num="
+ statistics.getN()
diff --git
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
index 2704989f0c..4b2402214e 100644
---
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
+++
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
@@ -1,24 +1,5 @@
package org.apache.iotdb.session;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.allRegularBytesSize;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.byteArrayLengthStatistics;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForHitNewDeltas;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForNotHitNewDeltas;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularEqual;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularNOTEqual;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularZero;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.prepareAllRegulars;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.timeColumnTS2DIFFLoadBatchCost;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.compaction.CompactionStrategy;
@@ -29,11 +10,32 @@ import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.session.SessionDataSet.DataIterator;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.allRegularBytesSize;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.byteArrayLengthStatistics;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForHitNewDeltas;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForNotHitNewDeltas;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularEqual;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularNOTEqual;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularZero;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.prepareAllRegulars;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.timeColumnTS2DIFFLoadBatchCost;
+
public class MyRealDataTest1_WriteAndQuery {
private static final IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
@@ -51,77 +53,79 @@ public class MyRealDataTest1_WriteAndQuery {
private static final String queryFormat_UDF =
"select M4(%1$s,'tqs'='%3$d','tqe'='%4$d','w'='%5$d') from %2$s where
time>=%3$d and time<%4$d";
-// private static String device = "root.game";
-// private static String measurement = "s6";
-// private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
-// private static String timestamp_precision = "ns"; // ns, us, ms
-// private static long dataMinTime = 0;
-// private static long dataMaxTime = 617426057626L;
-// private static long total_time_length = dataMaxTime - dataMinTime;
-// private static int total_point_number = 1200000;
-// private static int iotdb_chunk_point_size = 100000;
-// private static long chunkAvgTimeLen = (long) Math
-// .ceil(total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
-// private static String filePath =
-//
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\BallSpeed.csv";
-// private static int deletePercentage = 0; // 0 means no deletes. 0-100
-// private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-// private static int timeIdx = 0; // 时间戳idx,从0开始
-// private static int valueIdx = 1; // 值idx,从0开始
-// private static int w = 2;
-// private static long range = total_time_length;
-// private static boolean enableRegularityTimeDecode = true;
-// private static long regularTimeInterval = 511996L;
-// private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
-
-// private static String device = "root.debs2012";
-// private static String measurement = "mf03";
-// private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
-// private static String timestamp_precision = "ns"; // ns, us, ms
-// private static long dataMinTime = 1329955200008812200L;
-// private static long dataMaxTime = 1329965999991045200L;
-// private static long total_time_length = dataMaxTime - dataMinTime;
-// private static int total_point_number = 1076102;
-// private static int iotdb_chunk_point_size = 100000;
-// private static long chunkAvgTimeLen = (long) Math
-// .ceil(total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
-// private static String filePath =
-//
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\MF03.csv";
-// private static int deletePercentage = 0; // 0 means no deletes. 0-100
-// private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-// private static int timeIdx = 0; // 时间戳idx,从0开始
-// private static int valueIdx = 1; // 值idx,从0开始
-// private static int w = 2;
-// private static long range = total_time_length;
-// private static boolean enableRegularityTimeDecode = true;
-// private static long regularTimeInterval = 10000900L;
-// private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
-
-// private static String device = "root.kobelco.trans.03.1090001603.2401604";
-// private static String measurement = "KOB_0002_00_67";
-// private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
-// private static String timestamp_precision = "ms"; // ns, us, ms
-// private static long dataMinTime = 1616805035973L;
-// private static long dataMaxTime = 1627380839563L;
-// private static long total_time_length = dataMaxTime - dataMinTime;
-// private static int total_point_number = 1943180;
-// private static int iotdb_chunk_point_size = 100000;
-// private static long chunkAvgTimeLen =
-// (long)
-// Math.ceil(
-// total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
-// private static String filePath =
-//
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
-// private static int deletePercentage = 0; // 0 means no deletes. 0-100
-// private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-// private static int timeIdx = 0; // 时间戳idx,从0开始
-// private static int valueIdx = 1; // 值idx,从0开始
-// private static int w = 3;
-// private static long range = total_time_length;
-// private static boolean enableRegularityTimeDecode = true;
-// private static long regularTimeInterval = 1000L;
-// private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
-
+ // private static String device = "root.game";
+ // private static String measurement = "s6";
+ // private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
+ // private static String timestamp_precision = "ns"; // ns, us, ms
+ // private static long dataMinTime = 0;
+ // private static long dataMaxTime = 617426057626L;
+ // private static long total_time_length = dataMaxTime - dataMinTime;
+ // private static int total_point_number = 1200000;
+ // private static int iotdb_chunk_point_size = 100000;
+ // private static long chunkAvgTimeLen = (long) Math
+ // .ceil(total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
+ // private static String filePath =
+ //
+ //
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\BallSpeed.csv";
+ // private static int deletePercentage = 0; // 0 means no deletes. 0-100
+ // private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+ // private static int timeIdx = 0; // 时间戳idx,从0开始
+ // private static int valueIdx = 1; // 值idx,从0开始
+ // private static int w = 2;
+ // private static long range = total_time_length;
+ // private static boolean enableRegularityTimeDecode = true;
+ // private static long regularTimeInterval = 511996L;
+ // private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3:
CPV
+
+ // private static String device = "root.debs2012";
+ // private static String measurement = "mf03";
+ // private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
+ // private static String timestamp_precision = "ns"; // ns, us, ms
+ // private static long dataMinTime = 1329955200008812200L;
+ // private static long dataMaxTime = 1329965999991045200L;
+ // private static long total_time_length = dataMaxTime - dataMinTime;
+ // private static int total_point_number = 1076102;
+ // private static int iotdb_chunk_point_size = 100000;
+ // private static long chunkAvgTimeLen = (long) Math
+ // .ceil(total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
+ // private static String filePath =
+ //
+ //
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\MF03.csv";
+ // private static int deletePercentage = 0; // 0 means no deletes. 0-100
+ // private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+ // private static int timeIdx = 0; // 时间戳idx,从0开始
+ // private static int valueIdx = 1; // 值idx,从0开始
+ // private static int w = 2;
+ // private static long range = total_time_length;
+ // private static boolean enableRegularityTimeDecode = true;
+ // private static long regularTimeInterval = 10000900L;
+ // private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3:
CPV
+
+ // private static String device =
"root.kobelco.trans.03.1090001603.2401604";
+ // private static String measurement = "KOB_0002_00_67";
+ // private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
+ // private static String timestamp_precision = "ms"; // ns, us, ms
+ // private static long dataMinTime = 1616805035973L;
+ // private static long dataMaxTime = 1627380839563L;
+ // private static long total_time_length = dataMaxTime - dataMinTime;
+ // private static int total_point_number = 1943180;
+ // private static int iotdb_chunk_point_size = 100000;
+ // private static long chunkAvgTimeLen =
+ // (long)
+ // Math.ceil(
+ // total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
+ // private static String filePath =
+ //
+ //
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
+ // private static int deletePercentage = 0; // 0 means no deletes. 0-100
+ // private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+ // private static int timeIdx = 0; // 时间戳idx,从0开始
+ // private static int valueIdx = 1; // 值idx,从0开始
+ // private static int w = 3;
+ // private static long range = total_time_length;
+ // private static boolean enableRegularityTimeDecode = true;
+ // private static long regularTimeInterval = 1000L;
+ // private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3:
CPV
private static String device = "root.sg1";
private static String measurement = "RcvTime";
@@ -193,9 +197,7 @@ public class MyRealDataTest1_WriteAndQuery {
EnvironmentUtils.cleanEnv();
}
- /**
- * Before writing data, make sure check the server parameter configurations.
- */
+ /** Before writing data, make sure check the server parameter
configurations. */
// Usage: java -jar WriteData-0.12.4.jar device measurement dataType
timestamp_precision
// total_time_length total_point_number iotdb_chunk_point_size filePath
deleteFreq deleteLen
// timeIdx valueIdx
diff --git
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest2_OnlyQuery.java
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest2_OnlyQuery.java
index ed038f0a97..a2df4fdc9b 100644
---
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest2_OnlyQuery.java
+++
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest2_OnlyQuery.java
@@ -28,8 +28,8 @@ import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForNot
import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularEqual;
import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularNOTEqual;
import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularZero;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.prepareAllRegulars;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.timeColumnTS2DIFFLoadBatchCost;
public class MyRealDataTest2_OnlyQuery {
diff --git
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest3_WriteAndRawQuery.java
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest3_WriteAndRawQuery.java
index 41a10c572f..7483330705 100644
---
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest3_WriteAndRawQuery.java
+++
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest3_WriteAndRawQuery.java
@@ -1,24 +1,5 @@
package org.apache.iotdb.session;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.allRegularBytesSize;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.byteArrayLengthStatistics;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForHitNewDeltas;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForNotHitNewDeltas;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularEqual;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularNOTEqual;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularZero;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.prepareAllRegulars;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
-import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.timeColumnTS2DIFFLoadBatchCost;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.compaction.CompactionStrategy;
@@ -29,11 +10,32 @@ import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.session.SessionDataSet.DataIterator;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.allRegularBytesSize;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.byteArrayLengthStatistics;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForHitNewDeltas;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForNotHitNewDeltas;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularEqual;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularNOTEqual;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.countForRegularZero;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.prepareAllRegulars;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.regularNewDeltasStatistics;
+import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.timeColumnTS2DIFFLoadBatchCost;
+
public class MyRealDataTest3_WriteAndRawQuery {
private static final IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
@@ -60,8 +62,10 @@ public class MyRealDataTest3_WriteAndRawQuery {
private static long total_time_length = dataMaxTime - dataMinTime;
private static int total_point_number = 1200000;
private static int iotdb_chunk_point_size = 100000;
- private static long chunkAvgTimeLen = (long) Math
- .ceil(total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
+ private static long chunkAvgTimeLen =
+ (long)
+ Math.ceil(
+ total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
private static String filePath =
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\BallSpeed.csv";
private static int deletePercentage = 0; // 0 means no deletes. 0-100
@@ -98,30 +102,31 @@ public class MyRealDataTest3_WriteAndRawQuery {
// private static long regularTimeInterval = 10000900L;
// private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3:
CPV
-// private static String device = "root.kobelco.trans.03.1090001603.2401604";
-// private static String measurement = "KOB_0002_00_67";
-// private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
-// private static String timestamp_precision = "ms"; // ns, us, ms
-// private static long dataMinTime = 1616805035973L;
-// private static long dataMaxTime = 1627380839563L;
-// private static long total_time_length = dataMaxTime - dataMinTime;
-// private static int total_point_number = 1943180;
-// private static int iotdb_chunk_point_size = 100000;
-// private static long chunkAvgTimeLen =
-// (long)
-// Math.ceil(
-// total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
-// private static String filePath =
-//
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
-// private static int deletePercentage = 0; // 0 means no deletes. 0-100
-// private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
-// private static int timeIdx = 0; // 时间戳idx,从0开始
-// private static int valueIdx = 1; // 值idx,从0开始
-// private static int w = 3;
-// private static long range = total_time_length;
-// private static boolean enableRegularityTimeDecode = true;
-// private static long regularTimeInterval = 1000L;
-// private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
+ // private static String device =
"root.kobelco.trans.03.1090001603.2401604";
+ // private static String measurement = "KOB_0002_00_67";
+ // private static TSDataType tsDataType = TSDataType.INT64; //
TSDataType.DOUBLE;
+ // private static String timestamp_precision = "ms"; // ns, us, ms
+ // private static long dataMinTime = 1616805035973L;
+ // private static long dataMaxTime = 1627380839563L;
+ // private static long total_time_length = dataMaxTime - dataMinTime;
+ // private static int total_point_number = 1943180;
+ // private static int iotdb_chunk_point_size = 100000;
+ // private static long chunkAvgTimeLen =
+ // (long)
+ // Math.ceil(
+ // total_time_length / Math.ceil(total_point_number * 1.0 /
iotdb_chunk_point_size));
+ // private static String filePath =
+ //
+ //
"D:\\github\\m4-lsm\\M4-visualization-exp\\src\\main\\java\\org\\apache\\iotdb\\datasets\\KOB_2.csv";
+ // private static int deletePercentage = 0; // 0 means no deletes. 0-100
+ // private static int deleteLenPercentage = 0; // 0-100
每次删除的时间长度,用chunkAvgTimeLen的百分比表示
+ // private static int timeIdx = 0; // 时间戳idx,从0开始
+ // private static int valueIdx = 1; // 值idx,从0开始
+ // private static int w = 3;
+ // private static long range = total_time_length;
+ // private static boolean enableRegularityTimeDecode = true;
+ // private static long regularTimeInterval = 1000L;
+ // private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3:
CPV
@Before
public void setUp() throws Exception {
@@ -168,9 +173,7 @@ public class MyRealDataTest3_WriteAndRawQuery {
EnvironmentUtils.cleanEnv();
}
- /**
- * Before writing data, make sure check the server parameter configurations.
- */
+ /** Before writing data, make sure check the server parameter
configurations. */
// Usage: java -jar WriteData-0.12.4.jar device measurement dataType
timestamp_precision
// total_time_length total_point_number iotdb_chunk_point_size filePath
deleteFreq deleteLen
// timeIdx valueIdx
@@ -220,27 +223,27 @@ public class MyRealDataTest3_WriteAndRawQuery {
// query result size is no more than 8000*4=32000.
session.setFetchSize(1000000);
-// String sql;
-// if (approach.equals("mac")) {
-// // MAC UDF
-// sql = String.format(queryFormat_UDF, measurement, device, minTime,
maxTime, w); // MAC
-// } else {
-// // MOC and CPV sql use the same sql queryFormat.
-// sql =
-// String.format(
-// queryFormat,
-// measurement,
-// measurement,
-// measurement,
-// measurement,
-// measurement,
-// measurement,
-// device,
-// minTime,
-// maxTime,
-// interval,
-// timestamp_precision); // note the time precision unit
-// }
+ // String sql;
+ // if (approach.equals("mac")) {
+ // // MAC UDF
+ // sql = String.format(queryFormat_UDF, measurement, device, minTime,
maxTime, w); // MAC
+ // } else {
+ // // MOC and CPV sql use the same sql queryFormat.
+ // sql =
+ // String.format(
+ // queryFormat,
+ // measurement,
+ // measurement,
+ // measurement,
+ // measurement,
+ // measurement,
+ // measurement,
+ // device,
+ // minTime,
+ // maxTime,
+ // interval,
+ // timestamp_precision); // note the time precision unit
+ // }
String sql = String.format("select %s from %s", measurement, device);
System.out.println("[QueryData] sql=" + sql);
@@ -250,28 +253,28 @@ public class MyRealDataTest3_WriteAndRawQuery {
// System.out.println(dataSet.getColumnNames());
while (iterator.next()) { // this way avoid constructing rowRecord
c++;
-// String ans;
-// if (approach.equals("mac")) {
-// ans =
-// String.format(
-// "%s,%s",
-// iterator.getString(1), // time
-// iterator.getString(2)); // M4
-// } else {
-// ans =
-// String.format(
-// "%s,%s,%s,%s,%s,%s,%s",
-// iterator.getString(1), // time
-// iterator.getString(2), // min_time
-// iterator.getString(3), // max_time
-// iterator.getString(4), // first_value
-// iterator.getString(5), // last_value
-// iterator.getString(6), // min_value & bottomTime
-// iterator.getString(7)); // max_value & topTime
-// }
-// System.out.println(ans);
+ // String ans;
+ // if (approach.equals("mac")) {
+ // ans =
+ // String.format(
+ // "%s,%s",
+ // iterator.getString(1), // time
+ // iterator.getString(2)); // M4
+ // } else {
+ // ans =
+ // String.format(
+ // "%s,%s,%s,%s,%s,%s,%s",
+ // iterator.getString(1), // time
+ // iterator.getString(2), // min_time
+ // iterator.getString(3), // max_time
+ // iterator.getString(4), // first_value
+ // iterator.getString(5), // last_value
+ // iterator.getString(6), // min_value & bottomTime
+ // iterator.getString(7)); // max_value & topTime
+ // }
+ // System.out.println(ans);
}
-// Assert.assertEquals(w, c);
+ // Assert.assertEquals(w, c);
System.out.println("total point number=" + c);
// session.executeNonQueryStatement("clear cache");
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
index 349ddf6d9d..75be680e75 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/constant/TsFileConstant.java
@@ -40,15 +40,18 @@ public class TsFileConstant {
public static DescriptiveStatistics regularNewDeltasStatistics = new
DescriptiveStatistics();
- public static DescriptiveStatistics countForHitNewDeltas = new
DescriptiveStatistics(); // allRegularBytes contains
- public static DescriptiveStatistics countForNotHitNewDeltas = new
DescriptiveStatistics(); // allRegularBytes not contains
+ public static DescriptiveStatistics countForHitNewDeltas =
+ new DescriptiveStatistics(); // allRegularBytes contains
+ public static DescriptiveStatistics countForNotHitNewDeltas =
+ new DescriptiveStatistics(); // allRegularBytes not contains
- public static DescriptiveStatistics byteArrayLengthStatistics = new
DescriptiveStatistics(); // regular bytes length
+ public static DescriptiveStatistics byteArrayLengthStatistics =
+ new DescriptiveStatistics(); // regular bytes length
- public static DescriptiveStatistics allRegularBytesSize = new
DescriptiveStatistics(); // allRegularBytes map size
+ public static DescriptiveStatistics allRegularBytesSize =
+ new DescriptiveStatistics(); // allRegularBytes map size
public static DescriptiveStatistics prepareAllRegulars = new
DescriptiveStatistics();
- private TsFileConstant() {
- }
+ private TsFileConstant() {}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
index 705ac4f603..78a0d65124 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
@@ -19,10 +19,6 @@
package org.apache.iotdb.tsfile.encoding.decoder;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.encoding.encoder.DeltaBinaryEncoder;
@@ -31,9 +27,15 @@ import org.apache.iotdb.tsfile.utils.BytesUtils;
import org.apache.iotdb.tsfile.utils.Pair;
import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* This class is a decoder for decoding the byte array that encoded by {@code
- * DeltaBinaryEncoder}.DeltaBinaryDecoder just supports integer and long
values.<br> .
+ * DeltaBinaryEncoder}.DeltaBinaryDecoder just supports integer and long
values.<br>
+ * .
*
* @see DeltaBinaryEncoder
*/
@@ -42,24 +44,16 @@ public abstract class DeltaBinaryDecoder extends Decoder {
protected long count = 0;
protected byte[] deltaBuf;
- /**
- * the first value in one pack.
- */
+ /** the first value in one pack. */
protected int readIntTotalCount = 0;
protected int nextReadIndex = 0;
- /**
- * max bit length of all value in a pack.
- */
+ /** max bit length of all value in a pack. */
protected int packWidth;
- /**
- * data number in this pack.
- */
+ /** data number in this pack. */
protected int packNum;
- /**
- * how many bytes data takes after encoding.
- */
+ /** how many bytes data takes after encoding. */
protected int encodingLength;
public DeltaBinaryDecoder() {
@@ -92,9 +86,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
private int firstValue;
private int[] data;
private int previous;
- /**
- * minimum value for all difference.
- */
+ /** minimum value for all difference. */
private int minDeltaBase;
public IntDeltaDecoder() {
@@ -178,9 +170,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
private long firstValue;
private long[] data;
private long previous;
- /**
- * minimum value for all difference.
- */
+ /** minimum value for all difference. */
private long minDeltaBase;
private boolean enableRegularityTimeDecode;
@@ -249,7 +239,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
}
} else if (newRegularDelta < 0
|| newRegularDelta
- >= Math.pow(2, packWidth)) { // no need to compare equality cause
impossible
+ >= Math.pow(2, packWidth)) { // no need to compare equality
cause impossible
for (int i = 0; i < packNum; i++) {
long v = BytesUtils.bytesToLong(deltaBuf, packWidth * i,
packWidth);
data[i] = previous + minDeltaBase + v;
@@ -360,7 +350,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
System.out.println("[RL]no");
TsFileConstant.countForRegularNOTEqual++;
}
-// data[i] = previous + regularTimeInterval;
+ // data[i] = previous + regularTimeInterval;
previous = data[i];
}
}