This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a7356d4 fix sonar (#34)
a7356d4 is described below
commit a7356d4e6402b1435257cca8a8977f18be65763d
Author: Da Rui Lei <[email protected]>
AuthorDate: Tue Feb 19 19:42:13 2019 +0800
fix sonar (#34)
* revoke modifications for duplicated codes; polish according to reviews
* Update DeltaBinaryEncoder.java, ChunkGroupFooter.java,
TsFileDecodingException.java, BitmapEncoder.java, IoTDBQueryResultSet.java,
IoTDBQueryResultSet.java, EncodingConfig.java for fixing Sonar tips.
* rename Compressor to ICompressor; rename UnCompressor to IUnCompressor
---
.../iotdb/jdbc/IoTDBMetadataResultMetadata.java | 1 +
.../apache/iotdb/jdbc/IoTDBMetadataResultSet.java | 70 +++--
.../org/apache/iotdb/jdbc/IoTDBQueryResultSet.java | 348 +++++++++++----------
.../org/apache/iotdb/jdbc/IoTDBResultMetadata.java | 25 +-
.../org/apache/iotdb/jdbc/IoTDBSQLException.java | 9 +-
.../java/org/apache/iotdb/jdbc/IoTDBStatement.java | 18 +-
.../iotdb/tsfile/common/conf/TSFileDescriptor.java | 52 +--
.../compress/{Compressor.java => ICompressor.java} | 23 +-
.../{UnCompressor.java => IUnCompressor.java} | 23 +-
.../tsfile/encoding/bitpacking/IntPacker.java | 30 +-
.../tsfile/encoding/bitpacking/LongPacker.java | 11 +-
.../tsfile/encoding/common/EncodingConfig.java | 5 +
.../tsfile/encoding/decoder/BitmapDecoder.java | 54 ++--
.../iotdb/tsfile/encoding/decoder/Decoder.java | 65 ++--
.../encoding/decoder/DeltaBinaryDecoder.java | 6 +-
.../encoding/decoder/DoublePrecisionDecoder.java | 13 +-
.../tsfile/encoding/decoder/FloatDecoder.java | 4 +-
.../tsfile/encoding/decoder/IntRleDecoder.java | 15 +-
.../tsfile/encoding/decoder/LongRleDecoder.java | 12 +-
.../tsfile/encoding/decoder/PlainDecoder.java | 18 +-
.../iotdb/tsfile/encoding/decoder/RleDecoder.java | 48 ++-
.../encoding/decoder/SinglePrecisionDecoder.java | 12 +-
.../tsfile/encoding/encoder/BitmapEncoder.java | 7 +-
.../encoding/encoder/DeltaBinaryEncoder.java | 23 +-
.../encoding/encoder/DoublePrecisionEncoder.java | 5 +
.../iotdb/tsfile/encoding/encoder/Encoder.java | 10 +-
.../tsfile/encoding/encoder/FloatEncoder.java | 1 +
.../tsfile/encoding/encoder/IntRleEncoder.java | 7 +-
.../tsfile/encoding/encoder/LongRleEncoder.java | 1 +
.../tsfile/encoding/encoder/PlainEncoder.java | 13 +-
.../iotdb/tsfile/encoding/encoder/RleEncoder.java | 12 +-
.../encoding/encoder/SinglePrecisionEncoder.java | 3 +-
.../tsfile/encoding/encoder/TSEncodingBuilder.java | 16 +-
.../tsfile/exception/cache/CacheException.java | 2 +
.../encoding/TsFileDecodingException.java | 2 +
.../encoding/TsFileEncodingException.java | 2 +
.../org/apache/iotdb/tsfile/file/MetaMarker.java | 6 +-
.../iotdb/tsfile/file/footer/ChunkGroupFooter.java | 11 +-
.../iotdb/tsfile/file/header/ChunkHeader.java | 12 +-
.../iotdb/tsfile/file/header/PageHeader.java | 15 +-
.../tsfile/file/metadata/ChunkGroupMetaData.java | 6 +-
.../iotdb/tsfile/file/metadata/ChunkMetaData.java | 5 +-
.../tsfile/file/metadata/TsDeviceMetadata.java | 2 +-
.../file/metadata/TsDeviceMetadataIndex.java | 3 +-
.../iotdb/tsfile/file/metadata/TsDigest.java | 23 +-
.../iotdb/tsfile/file/metadata/TsFileMetaData.java | 2 +
.../iotdb/tsfile/read/TsFileSequenceReader.java | 4 +-
.../tsfile/read/reader/chunk/ChunkReader.java | 6 +-
.../iotdb/tsfile/utils/ReadWriteIOUtils.java | 1 +
.../iotdb/tsfile/write/chunk/ChunkBuffer.java | 4 +-
.../tsfile/write/schema/MeasurementSchema.java | 12 +-
.../apache/iotdb/tsfile/compress/CompressTest.java | 8 +-
.../tsfile/encoding/bitpacking/IntPackerTest.java | 3 +-
.../tsfile/encoding/bitpacking/LongPackerTest.java | 5 +-
.../tsfile/encoding/decoder/BitmapDecoderTest.java | 6 +-
55 files changed, 593 insertions(+), 507 deletions(-)
diff --git
a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultMetadata.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultMetadata.java
index 4009082..cda286f 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultMetadata.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultMetadata.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.jdbc;
import java.sql.ResultSetMetaData;
diff --git
a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultSet.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultSet.java
index 3d56da4..f0b7445 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultSet.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBMetadataResultSet.java
@@ -46,6 +46,8 @@ public class IoTDBMetadataResultSet extends
IoTDBQueryResultSet {
private int colCount; // the number of columns for show
private String[] showLabels; // headers for show
+ private static final String METHOD_NOT_SUPPORTED = "Method not supported";
+
/**
* Constructor used for the result of DatabaseMetadata.getColumns()
*/
@@ -74,122 +76,122 @@ public class IoTDBMetadataResultSet extends
IoTDBQueryResultSet {
@Override
public void close() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int findColumn(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public BigDecimal getBigDecimal(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public BigDecimal getBigDecimal(int columnIndex, int scale) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public BigDecimal getBigDecimal(String columnName, int scale) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean getBoolean(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean getBoolean(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public byte getByte(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public byte getByte(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public byte[] getBytes(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public byte[] getBytes(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getConcurrency() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Date getDate(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Date getDate(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public double getDouble(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public double getDouble(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getFetchDirection() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public float getFloat(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public float getFloat(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getInt(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getInt(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public long getLong(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public long getLong(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -214,27 +216,27 @@ public class IoTDBMetadataResultSet extends
IoTDBQueryResultSet {
@Override
public Object getObject(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Object getObject(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public short getShort(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public short getShort(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Statement getStatement() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -285,12 +287,12 @@ public class IoTDBMetadataResultSet extends
IoTDBQueryResultSet {
@Override
public Time getTime(int columnIndex) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Time getTime(String columnName) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -300,17 +302,17 @@ public class IoTDBMetadataResultSet extends
IoTDBQueryResultSet {
@Override
public SQLWarning getWarnings() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean isClosed() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean wasNull() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
public enum MetadataType {
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBQueryResultSet.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBQueryResultSet.java
index 83159dd..e622ead 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBQueryResultSet.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBQueryResultSet.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.jdbc;
import java.io.InputStream;
@@ -52,16 +53,18 @@ import
org.apache.iotdb.service.rpc.thrift.TSFetchResultsResp;
import org.apache.iotdb.service.rpc.thrift.TSIService;
import org.apache.iotdb.service.rpc.thrift.TSOperationHandle;
import org.apache.iotdb.service.rpc.thrift.TSQueryDataSet;
-import org.apache.iotdb.service.rpc.thrift.TS_SessionHandle;
import org.apache.iotdb.tsfile.read.common.Field;
import org.apache.iotdb.tsfile.read.common.RowRecord;
import org.apache.thrift.TException;
+import org.slf4j.LoggerFactory;
public class IoTDBQueryResultSet implements ResultSet {
+ private static final org.slf4j.Logger LOGGER =
LoggerFactory.getLogger(IoTDBQueryResultSet.class);
+ private static final String METHOD_NOT_SUPPORTED = "Method not supported";
private final String TIMESTAMP_STR = "Time";
- private final String LIMIT_STR = "LIMIT";
- private final String OFFSET_STR = "OFFSET";
+ private static final String limitStr = "LIMIT";
+ private static final String offsetStr = "OFFSET";
private Statement statement = null;
private String sql;
private SQLWarning warningChain = null;
@@ -89,20 +92,20 @@ public class IoTDBQueryResultSet implements ResultSet {
* nor LIMIT is constrained. maxRowsOrRowsLimit > 0 means that maxRows and/or
* LIMIT are constrained.
* 1) When neither maxRows nor LIMIT is constrained, i.e., maxRows=0 and
rowsLimit=0,
- * maxRowsOrRowsLimit = 0; 2). When both maxRows and LIMIT are constrained,
i.e., maxRows>0 and
- * rowsLimit>0, maxRowsOrRowsLimit = min(maxRows, rowsLimit); 3) When
maxRows is constrained and
- * LIMIT is NOT constrained, i.e., maxRows>0 and rowsLimit=0,
maxRowsOrRowsLimit = maxRows;
+ * maxRowsOrRowsLimit = 0 2). When both maxRows and LIMIT are constrained,
i.e., maxRows>0 and
+ * rowsLimit>0, maxRowsOrRowsLimit = min(maxRows, rowsLimit) 3) When maxRows
is constrained and
+ * LIMIT is NOT constrained, i.e., maxRows>0 and rowsLimit=0,
maxRowsOrRowsLimit = maxRows
* 4) When maxRows is NOT constrained and LIMIT is constrained, i.e.,
maxRows=0 and
- * rowsLimit>0, maxRowsOrRowsLimit = rowsLimit;
+ * rowsLimit>0, maxRowsOrRowsLimit = rowsLimit
*/
private int maxRowsOrRowsLimit;
public IoTDBQueryResultSet() {
-
+ // do nothing
}
public IoTDBQueryResultSet(Statement statement, List<String> columnName,
TSIService.Iface client,
- TS_SessionHandle sessionHandle, TSOperationHandle operationHandle,
+ TSOperationHandle operationHandle,
String sql, String aggregations,
List<String> columnTypeList) throws SQLException {
this.statement = statement;
@@ -132,7 +135,7 @@ public class IoTDBQueryResultSet implements ResultSet {
String[] splited = sql.toUpperCase().split("\\s+");
List<String> arraySplited = Arrays.asList(splited);
try {
- int posLimit = arraySplited.indexOf(LIMIT_STR);
+ int posLimit = arraySplited.indexOf(limitStr);
if (posLimit != -1) {
rowsLimit = Integer.parseInt(splited[posLimit + 1]);
@@ -145,7 +148,7 @@ public class IoTDBQueryResultSet implements ResultSet {
}
// check if OFFSET is constrained after LIMIT has been constrained
- int posOffset = arraySplited.indexOf(OFFSET_STR);
+ int posOffset = arraySplited.indexOf(offsetStr);
if (posOffset != -1) {
// NOTE that OFFSET <OFFSETValue>: OFFSETValue is ensured to be a
non-negative
// integer by the server side
@@ -159,32 +162,32 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean absolute(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void afterLast() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void beforeFirst() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void cancelRowUpdates() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -211,18 +214,16 @@ public class IoTDBQueryResultSet implements ResultSet {
Utils.verifySuccess(closeResp.getStatus());
}
} catch (SQLException e) {
- throw new SQLException("Error occurs for close opeation in server side
becasuse "
- + e.getMessage());
+ throw new SQLException("Error occurs for close opeation in server side
becasuse " + e);
} catch (TException e) {
throw new SQLException(
- "Error occurs when connecting to server for close operation,
becasue: "
- + e.getMessage());
+ "Error occurs when connecting to server for close operation,
becasue: " + e);
}
}
@Override
public void deleteRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -232,27 +233,27 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public boolean first() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Array getArray(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Array getArray(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public InputStream getAsciiStream(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public InputStream getAsciiStream(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -278,22 +279,22 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public InputStream getBinaryStream(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public InputStream getBinaryStream(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Blob getBlob(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Blob getBlob(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -304,10 +305,14 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public boolean getBoolean(String columnName) throws SQLException {
String b = getValueByName(columnName);
- if (b.trim().equalsIgnoreCase("0")) {
+ if (b == null) {
+ throw new SQLException(
+ String.format("The value got by %s (column name) is NULL.",
columnName));
+ }
+ if ("0".equalsIgnoreCase(b.trim())) {
return false;
}
- if (b.trim().equalsIgnoreCase("1")) {
+ if ("1".equalsIgnoreCase(b.trim())) {
return true;
}
return Boolean.parseBoolean(b);
@@ -328,33 +333,33 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public byte[] getBytes(int columnIndex) throws SQLException {
// TODO Auto-generated method stub
- return null;
+ return new byte[0];
}
@Override
public byte[] getBytes(String columnName) throws SQLException {
// TODO Auto-generated method stub
- return null;
+ return new byte[0];
}
@Override
public Reader getCharacterStream(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Reader getCharacterStream(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Clob getClob(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Clob getClob(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -364,7 +369,7 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public String getCursorName() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -379,12 +384,12 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public Date getDate(int arg0, Calendar arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Date getDate(String arg0, Calendar arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -404,17 +409,17 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public void setFetchDirection(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getFetchSize() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void setFetchSize(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -429,7 +434,7 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public int getHoldability() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -459,32 +464,32 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public Reader getNCharacterStream(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Reader getNCharacterStream(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public NClob getNClob(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public NClob getNClob(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public String getNString(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public String getNString(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -499,57 +504,57 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public Object getObject(int arg0, Map<String, Class<?>> arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Object getObject(String arg0, Map<String, Class<?>> arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public <T> T getObject(int arg0, Class<T> arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public <T> T getObject(String arg0, Class<T> arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Ref getRef(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Ref getRef(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public int getRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public RowId getRowId(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public RowId getRowId(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public SQLXML getSQLXML(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public SQLXML getSQLXML(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -589,12 +594,12 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public Time getTime(int arg0, Calendar arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Time getTime(String arg0, Calendar arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -609,12 +614,12 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public Timestamp getTimestamp(String arg0, Calendar arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -624,22 +629,22 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public URL getURL(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public URL getURL(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public InputStream getUnicodeStream(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public InputStream getUnicodeStream(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -649,17 +654,17 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public void insertRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean isAfterLast() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean isBeforeFirst() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -669,27 +674,27 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public boolean isFirst() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean isLast() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean last() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void moveToCurrentRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void moveToInsertRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
// the next record rule without constraints
@@ -708,7 +713,8 @@ public class IoTDBQueryResultSet implements ResultSet {
recordItr = records.iterator();
}
} catch (TException e) {
- throw new SQLException("Cannot fetch result from server, because of
network connection");
+ throw new SQLException(
+ "Cannot fetch result from server, because of network connection:
{} ", e);
}
}
@@ -726,7 +732,7 @@ public class IoTDBQueryResultSet implements ResultSet {
if (maxRowsOrRowsLimit > 0 && rowsFetched >= maxRowsOrRowsLimit) {
// The constraint of maxRows instead of rowsLimit is embodied
if (rowsLimit == 0 || (maxRows > 0 && maxRows < rowsLimit)) {
- System.out.println("Reach max rows " + maxRows);
+ LOGGER.debug("Reach max rows " + maxRows);
}
return false;
}
@@ -756,448 +762,448 @@ public class IoTDBQueryResultSet implements ResultSet {
@Override
public boolean previous() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void refreshRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean relative(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean rowDeleted() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean rowInserted() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public boolean rowUpdated() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateArray(int arg0, Array arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateArray(String arg0, Array arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(int arg0, InputStream arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(String arg0, InputStream arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(int arg0, InputStream arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(String arg0, InputStream arg1, int arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(int arg0, InputStream arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBigDecimal(String arg0, BigDecimal arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(int arg0, InputStream arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(String arg0, InputStream arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(int arg0, InputStream arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(String arg0, InputStream arg1, int arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(int arg0, InputStream arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(int arg0, Blob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(String arg0, Blob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(int arg0, InputStream arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(String arg0, InputStream arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(int arg0, InputStream arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBlob(String arg0, InputStream arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBoolean(int arg0, boolean arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBoolean(String arg0, boolean arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateByte(int arg0, byte arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateByte(String arg0, byte arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBytes(int arg0, byte[] arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateBytes(String arg0, byte[] arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(int arg0, Reader arg1) throws SQLException
{
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(String arg0, Reader arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(int arg0, Reader arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(int arg0, Reader arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateCharacterStream(String arg0, Reader arg1, long arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(int arg0, Clob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(String arg0, Clob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(int arg0, Reader arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(String arg0, Reader arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(int arg0, Reader arg1, long arg2) throws SQLException
{
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateClob(String arg0, Reader arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateDate(int arg0, Date arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateDate(String arg0, Date arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateDouble(int arg0, double arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateDouble(String arg0, double arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateFloat(int arg0, float arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateFloat(String arg0, float arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateInt(int arg0, int arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateInt(String arg0, int arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateLong(int arg0, long arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateLong(String arg0, long arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNCharacterStream(int arg0, Reader arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNCharacterStream(String arg0, Reader arg1) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNCharacterStream(int arg0, Reader arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(int arg0, NClob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(String arg0, NClob arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(int arg0, Reader arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(String arg0, Reader arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(int arg0, Reader arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNClob(String arg0, Reader arg1, long arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNString(int arg0, String arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNString(String arg0, String arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNull(int arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateNull(String arg0) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateObject(int arg0, Object arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateObject(String arg0, Object arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateObject(int arg0, Object arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateObject(String arg0, Object arg1, int arg2) throws
SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateRef(int arg0, Ref arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateRef(String arg0, Ref arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateRow() throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateRowId(int arg0, RowId arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateRowId(String arg0, RowId arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateShort(int arg0, short arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateShort(String arg0, short arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateString(int arg0, String arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateString(String arg0, String arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateTime(int arg0, Time arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateTime(String arg0, Time arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException {
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
public void updateTimestamp(String arg0, Timestamp arg1) throws SQLException
{
- throw new SQLException("Method not supported");
+ throw new SQLException(METHOD_NOT_SUPPORTED);
}
@Override
@@ -1213,7 +1219,7 @@ public class IoTDBQueryResultSet implements ResultSet {
private String findColumnNameByIndex(int columnIndex) throws SQLException {
if (columnIndex <= 0) {
- throw new SQLException(String.format("column index should start from
1"));
+ throw new SQLException("column index should start from 1");
}
if (columnIndex > columnInfoList.size()) {
throw new SQLException(
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
index 4668095..03652c7 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBResultMetadata.java
@@ -65,7 +65,7 @@ public class IoTDBResultMetadata implements ResultSetMetaData
{
@Override
public int getColumnCount() throws SQLException {
- if (columnInfoList == null || columnInfoList.size() == 0) {
+ if (columnInfoList == null || columnInfoList.isEmpty()) {
throw new SQLException("No column exists");
}
return columnInfoList.size();
@@ -79,15 +79,7 @@ public class IoTDBResultMetadata implements
ResultSetMetaData {
@Override
public String getColumnLabel(int column) throws SQLException {
- if (columnInfoList == null || columnInfoList.size() == 0) {
- throw new SQLException("No column exists");
- }
- if (column > columnInfoList.size()) {
- throw new SQLException(String.format("column %d does not exist",
column));
- }
- if (column <= 0) {
- throw new SQLException(String.format("column index should start from 1",
column));
- }
+ checkColumnIndex(column);
return columnInfoList.get(column - 1);
}
@@ -96,19 +88,22 @@ public class IoTDBResultMetadata implements
ResultSetMetaData {
return getColumnLabel(column);
}
- @Override
- public int getColumnType(int column) throws SQLException {
- // TODO Auto-generated method stub
- if (columnInfoList == null || columnInfoList.size() == 0) {
+ private void checkColumnIndex(int column) throws SQLException {
+ if (columnInfoList == null || columnInfoList.isEmpty()) {
throw new SQLException("No column exists");
}
if (column > columnInfoList.size()) {
throw new SQLException(String.format("column %d does not exist",
column));
}
if (column <= 0) {
- throw new SQLException(String.format("column index should start from 1",
column));
+ throw new SQLException("column index should start from 1");
}
+ }
+ @Override
+ public int getColumnType(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ checkColumnIndex(column);
if (column == 1) {
return Types.TIMESTAMP;
}
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
index 4c543df..c265fe0 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.jdbc;
import java.sql.SQLException;
@@ -23,17 +24,9 @@ import java.sql.SQLException;
public class IoTDBSQLException extends SQLException {
private static final long serialVersionUID = -3306001287342258977L;
- private String errorMessage;
public IoTDBSQLException(String reason) {
super(reason);
}
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
}
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
index 0cda242..431d52e 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.jdbc;
import java.sql.BatchUpdateException;
@@ -223,10 +224,8 @@ public class IoTDBStatement implements Statement {
/**
* There are four kinds of sql here: (1) show timeseries path (2) show
storage group (3) query sql
- * (4) update sql .
- * <p></p>
- * (1) and (2) return new TsfileMetadataResultSet (3) return new
TsfileQueryResultSet (4) simply
- * get executed
+ * (4) update sql . <p></p> (1) and (2) return new TsfileMetadataResultSet
(3) return new
+ * TsfileQueryResultSet (4) simply get executed
*/
private boolean executeSQL(String sql) throws TException, SQLException {
isCancelled = false;
@@ -251,9 +250,9 @@ public class IoTDBStatement implements Statement {
operationHandle = execResp.getOperationHandle();
Utils.verifySuccess(execResp.getStatus());
if (execResp.getOperationHandle().hasResultSet) {
- resultSet = new IoTDBQueryResultSet(this, execResp.getColumns(),
client, sessionHandle,
- operationHandle,
- sql, execResp.getOperationType(),
getColumnsType(execResp.getColumns()));
+ resultSet = new IoTDBQueryResultSet(this, execResp.getColumns(),
client,
+ operationHandle, sql, execResp.getOperationType(),
+ getColumnsType(execResp.getColumns()));
return true;
}
return false;
@@ -347,9 +346,8 @@ public class IoTDBStatement implements Statement {
TSExecuteStatementResp execResp = client.executeQueryStatement(execReq);
operationHandle = execResp.getOperationHandle();
Utils.verifySuccess(execResp.getStatus());
- resultSet = new IoTDBQueryResultSet(this, execResp.getColumns(), client,
sessionHandle,
- operationHandle, sql,
- execResp.getOperationType(), getColumnsType(execResp.getColumns()));
+ resultSet = new IoTDBQueryResultSet(this, execResp.getColumns(), client,
+ operationHandle, sql, execResp.getOperationType(),
getColumnsType(execResp.getColumns()));
return resultSet;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileDescriptor.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileDescriptor.java
index 52285cd..83852e0 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileDescriptor.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileDescriptor.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.common.conf;
import java.io.File;
@@ -67,7 +68,7 @@ public class TSFileDescriptor {
}
}
- private URL getResource(String filename, ClassLoader classLoader) {
+ private static URL getResource(String filename, ClassLoader classLoader) {
return Loader.getResource(filename, classLoader);
}
@@ -105,32 +106,39 @@ public class TSFileDescriptor {
Properties properties = new Properties();
try {
properties.load(inputStream);
- conf.groupSizeInByte = Integer
- .parseInt(properties.getProperty("group_size_in_byte",
conf.groupSizeInByte + ""));
- conf.pageSizeInByte = Integer
- .parseInt(properties.getProperty("page_size_in_byte",
conf.pageSizeInByte + ""));
- conf.maxNumberOfPointsInPage = Integer.parseInt(
+ TSFileConfig.groupSizeInByte = Integer
+ .parseInt(
+ properties.getProperty("group_size_in_byte",
+ Integer.toString(TSFileConfig.groupSizeInByte)));
+ TSFileConfig.pageSizeInByte = Integer
+ .parseInt(properties
+ .getProperty("page_size_in_byte",
Integer.toString(TSFileConfig.pageSizeInByte)));
+ TSFileConfig.maxNumberOfPointsInPage = Integer.parseInt(
properties
- .getProperty("max_number_of_points_in_page",
conf.maxNumberOfPointsInPage + ""));
- conf.timeSeriesDataType = properties
- .getProperty("time_series_data_type", conf.timeSeriesDataType);
- conf.maxStringLength = Integer
- .parseInt(properties.getProperty("max_string_length",
conf.maxStringLength + ""));
- conf.floatPrecision = Integer
- .parseInt(properties.getProperty("float_precision",
conf.floatPrecision + ""));
- conf.timeSeriesEncoder = properties
- .getProperty("time_series_encoder", conf.timeSeriesEncoder);
- conf.valueEncoder = properties.getProperty("value_encoder",
conf.valueEncoder);
- conf.compressor = properties.getProperty("compressor", conf.compressor);
+ .getProperty("max_number_of_points_in_page",
+ Integer.toString(TSFileConfig.maxNumberOfPointsInPage)));
+ TSFileConfig.timeSeriesDataType = properties
+ .getProperty("time_series_data_type",
TSFileConfig.timeSeriesDataType);
+ TSFileConfig.maxStringLength = Integer
+ .parseInt(properties
+ .getProperty("max_string_length",
Integer.toString(TSFileConfig.maxStringLength)));
+ TSFileConfig.floatPrecision = Integer
+ .parseInt(properties
+ .getProperty("float_precision",
Integer.toString(TSFileConfig.floatPrecision)));
+ TSFileConfig.timeSeriesEncoder = properties
+ .getProperty("time_series_encoder", TSFileConfig.timeSeriesEncoder);
+ TSFileConfig.valueEncoder = properties
+ .getProperty("value_encoder", TSFileConfig.valueEncoder);
+ TSFileConfig.compressor = properties.getProperty("compressor",
TSFileConfig.compressor);
} catch (IOException e) {
- LOGGER.warn("Cannot load config file because {}, use default
configuration", e.getMessage());
+ LOGGER.warn("Cannot load config file, use default configuration", e);
} catch (Exception e) {
- LOGGER.error("Loading settings {} failed because {}", url,
e.getMessage());
+ LOGGER.error("Loading settings {} failed", url, e);
} finally {
try {
inputStream.close();
} catch (IOException e) {
- LOGGER.error("Failed to close stream for loading config because {}",
e.getMessage());
+ LOGGER.error("Failed to close stream for loading config", e);
}
}
@@ -138,6 +146,10 @@ public class TSFileDescriptor {
private static class TsfileDescriptorHolder {
+ private TsfileDescriptorHolder() {
+ throw new IllegalAccessError("Utility class");
+ }
+
private static final TSFileDescriptor INSTANCE = new TSFileDescriptor();
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/Compressor.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/ICompressor.java
similarity index 84%
rename from
tsfile/src/main/java/org/apache/iotdb/tsfile/compress/Compressor.java
rename to tsfile/src/main/java/org/apache/iotdb/tsfile/compress/ICompressor.java
index 28d1614..0b04a8d 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/Compressor.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/ICompressor.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.compress;
import java.io.IOException;
@@ -27,9 +28,9 @@ import org.xerial.snappy.Snappy;
/**
* compress data according to type in schema.
*/
-public abstract class Compressor {
+public interface ICompressor {
- public static Compressor getCompressor(String name) {
+ static ICompressor getCompressor(String name) {
return getCompressor(CompressionType.valueOf(name));
}
@@ -39,7 +40,7 @@ public abstract class Compressor {
* @param name CompressionType
* @return the Compressor of specified CompressionType
*/
- public static Compressor getCompressor(CompressionType name) {
+ static ICompressor getCompressor(CompressionType name) {
if (name == null) {
throw new CompressionTypeNotSupportedException("NULL");
}
@@ -53,14 +54,14 @@ public abstract class Compressor {
}
}
- public abstract byte[] compress(byte[] data) throws IOException;
+ byte[] compress(byte[] data) throws IOException;
/**
* abstract method of compress.
*
* @return byte length of compressed data.
*/
- public abstract int compress(byte[] data, int offset, int length, byte[]
compressed)
+ int compress(byte[] data, int offset, int length, byte[] compressed)
throws IOException;
/**
@@ -70,16 +71,16 @@ public abstract class Compressor {
* @param compressed MUST be DirectByteBuffer for Snappy.
* @return byte length of compressed data.
*/
- public abstract int compress(ByteBuffer data, ByteBuffer compressed) throws
IOException;
+ int compress(ByteBuffer data, ByteBuffer compressed) throws IOException;
- public abstract int getMaxBytesForCompression(int uncompressedDataSize);
+ int getMaxBytesForCompression(int uncompressedDataSize);
- public abstract CompressionType getType();
+ CompressionType getType();
/**
* NoCompressor will do nothing for data and return the input data directly.
*/
- public static class NoCompressor extends Compressor {
+ class NoCompressor implements ICompressor {
@Override
public byte[] compress(byte[] data) {
@@ -107,12 +108,12 @@ public abstract class Compressor {
}
}
- public static class SnappyCompressor extends Compressor {
+ class SnappyCompressor implements ICompressor {
@Override
public byte[] compress(byte[] data) throws IOException {
if (data == null) {
- return null;
+ return new byte[0];
}
return Snappy.compress(data);
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/UnCompressor.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
similarity index 88%
rename from
tsfile/src/main/java/org/apache/iotdb/tsfile/compress/UnCompressor.java
rename to
tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
index 5fe1420..ff14fed 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/UnCompressor.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/compress/IUnCompressor.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.compress;
import java.io.IOException;
@@ -29,7 +30,7 @@ import org.xerial.snappy.Snappy;
/**
* uncompress data according to type in metadata.
*/
-public abstract class UnCompressor {
+public interface IUnCompressor {
/**
* get the UnCompressor based on the CompressionType.
@@ -37,7 +38,7 @@ public abstract class UnCompressor {
* @param name CompressionType
* @return the UnCompressor of specified CompressionType
*/
- public static UnCompressor getUnCompressor(CompressionType name) {
+ static IUnCompressor getUnCompressor(CompressionType name) {
if (name == null) {
throw new CompressionTypeNotSupportedException("NULL");
}
@@ -51,7 +52,7 @@ public abstract class UnCompressor {
}
}
- public abstract int getUncompressedLength(byte[] array, int offset, int
length)
+ int getUncompressedLength(byte[] array, int offset, int length)
throws IOException;
/**
@@ -59,7 +60,7 @@ public abstract class UnCompressor {
*
* @param buffer MUST be DirectByteBuffer
*/
- public abstract int getUncompressedLength(ByteBuffer buffer) throws
IOException;
+ int getUncompressedLength(ByteBuffer buffer) throws IOException;
/**
* uncompress the byte array.
@@ -79,7 +80,7 @@ public abstract class UnCompressor {
* @param outOffset -
* @return the valid length of the output array
*/
- public abstract int uncompress(byte[] byteArray, int offset, int length,
byte[] output,
+ int uncompress(byte[] byteArray, int offset, int length, byte[] output,
int outOffset)
throws IOException;
@@ -89,11 +90,11 @@ public abstract class UnCompressor {
* @param compressed MUST be DirectByteBuffer
* @param uncompressed MUST be DirectByteBuffer
*/
- public abstract int uncompress(ByteBuffer compressed, ByteBuffer
uncompressed) throws IOException;
+ int uncompress(ByteBuffer compressed, ByteBuffer uncompressed) throws
IOException;
- public abstract CompressionType getCodecName();
+ CompressionType getCodecName();
- public static class NoUnCompressor extends UnCompressor {
+ class NoUnCompressor implements IUnCompressor {
@Override
public int getUncompressedLength(byte[] array, int offset, int length) {
@@ -127,7 +128,7 @@ public abstract class UnCompressor {
}
}
- public static class SnappyUnCompressor extends UnCompressor {
+ class SnappyUnCompressor implements IUnCompressor {
private static final Logger LOGGER =
LoggerFactory.getLogger(SnappyUnCompressor.class);
@@ -144,7 +145,7 @@ public abstract class UnCompressor {
@Override
public byte[] uncompress(byte[] bytes) {
if (bytes == null) {
- return null;
+ return new byte[0];
}
try {
@@ -155,7 +156,7 @@ public abstract class UnCompressor {
+ "bytes is {}",
bytes, e);
}
- return null;
+ return new byte[0];
}
@Override
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPacker.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPacker.java
index 1b80da2..c59eef7 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPacker.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPacker.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.bitpacking;
/**
@@ -53,13 +54,13 @@ public class IntPacker {
}
/**
- * Encode 8 ({@link IntPacker#NUM_OF_INTS}) Integers from the array 'values'
- * with specified bit-width to bytes.
+ * Encode 8 ({@link IntPacker#NUM_OF_INTS}) Integers from the array 'values'
with specified
+ * bit-width to bytes.
+ *
* @param values - array where '8 Integers' are in
* @param offset - the offset of first Integer to be encoded
- * @param buf - encoded bytes, buf size must be equal to
- * ({@link IntPacker#NUM_OF_INTS} * {@link IntPacker#width} /
- * 8)
+ * @param buf - encoded bytes, buf size must be equal to ({@link
IntPacker#NUM_OF_INTS} * {@link
+ * IntPacker#width} / 8)
*/
public void pack8Values(int[] values, int offset, byte[] buf) {
int bufIdx = 0;
@@ -92,7 +93,6 @@ public class IntPacker {
// put the first 'leftSize' bits of the Integer into remaining space
of the buffer
buffer |= (values[valueIdx] >>> (width - leftSize));
leftBit = width - leftSize;
- leftSize = 0;
}
// put the buffer into the final result
@@ -109,9 +109,10 @@ public class IntPacker {
/**
* decode Integers from byte array.
*
- * @param buf - array where bytes are in.
+ * @param buf - array where bytes are in.
* @param offset - offset of first byte to be decoded in buf
- * @param values - decoded result , the length of 'values' should be @{link
IntPacker#NUM_OF_INTS}
+ * @param values - decoded result , the length of 'values' should be @{link
+ * IntPacker#NUM_OF_INTS}
*/
public void unpack8Values(byte[] buf, int offset, int[] values) {
int byteIdx = offset;
@@ -125,7 +126,7 @@ public class IntPacker {
// If current available bits are not enough to decode one Integer,
// then add next byte from buf to 'buffer' until totalBits >= width
while (totalBits < width) {
- buffer = ((buffer << 8) | (buf[byteIdx] & 0xFF));
+ buffer = (buffer << 8) | (buf[byteIdx] & 0xFF);
byteIdx++;
totalBits += 8;
}
@@ -137,21 +138,20 @@ public class IntPacker {
values[valueIdx] = (int) (buffer >>> (totalBits - width));
valueIdx++;
totalBits -= width;
- buffer = (buffer & ((1 << totalBits) - 1));
+ buffer = buffer & ((1 << totalBits) - 1);
}
}
}
/**
- * decode all values from 'buf' with specified offset and length decoded
result
- * will be saved in the array named 'values'.
+ * decode all values from 'buf' with specified offset and length decoded
result will be saved in
+ * the array named 'values'.
*
- * @param buf array where all bytes are in.
- * @param offset the offset of first byte to be decoded in buf.
+ * @param buf array where all bytes are in.
* @param length length of bytes to be decoded in buf.
* @param values decoded result.
*/
- public void unpackAllValues(byte[] buf, int offset, int length, int[]
values) {
+ public void unpackAllValues(byte[] buf, int length, int[] values) {
int idx = 0;
int k = 0;
while (idx < length) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPacker.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPacker.java
index cb0ab04..11b649d 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPacker.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPacker.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.bitpacking;
/**
@@ -93,7 +94,6 @@ public class LongPacker {
// put the first 'leftSize' bits of the Long into remaining space of
the buffer
buffer |= (values[valueIdx] >>> (width - leftSize));
leftBit = width - leftSize;
- leftSize = 0;
}
// put the buffer into the final result
@@ -132,7 +132,7 @@ public class LongPacker {
if (width - totalBits >= leftBits) {
// then put left bits in current byte to current long value
values[valueIdx] = values[valueIdx] << leftBits;
- values[valueIdx] = (values[valueIdx] | ((((1L << leftBits) - 1)) &
buf[byteIdx]));
+ values[valueIdx] = values[valueIdx] | (((1L << leftBits) - 1) &
buf[byteIdx]);
totalBits += leftBits;
// get next byte
byteIdx++;
@@ -143,8 +143,8 @@ public class LongPacker {
// numbers of bits to be take
int t = width - totalBits;
values[valueIdx] = values[valueIdx] << t;
- values[valueIdx] = (values[valueIdx]
- | ((((1L << leftBits) - 1)) & buf[byteIdx]) >>> (leftBits - t));
+ values[valueIdx] = values[valueIdx]
+ | (((1L << leftBits) - 1) & buf[byteIdx]) >>> (leftBits - t);
leftBits -= t;
totalBits += t;
}
@@ -161,11 +161,10 @@ public class LongPacker {
* array named 'values'.
*
* @param buf array where all bytes are in.
- * @param offset the offset of first byte to be decoded in buf.
* @param length length of bytes to be decoded in buf.
* @param values decoded result
*/
- public void unpackAllValues(byte[] buf, int offset, int length, long[]
values) {
+ public void unpackAllValues(byte[] buf, int length, long[] values) {
int idx = 0;
int k = 0;
while (idx < length) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/common/EncodingConfig.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/common/EncodingConfig.java
index f7551d5..3bb6d7f 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/common/EncodingConfig.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/common/EncodingConfig.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.common;
/**
@@ -25,6 +26,10 @@ package org.apache.iotdb.tsfile.encoding.common;
*/
public class EncodingConfig {
+ private EncodingConfig() {
+ throw new IllegalAccessError("Utility class");
+ }
+
/**
* if number n repeats more than(>=) RLE_MAX_REPEATED_NUM times, use rle
encoding, otherwise use
* bit-packing.
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoder.java
index 5ff3abb..b920e43 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -25,7 +26,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.iotdb.tsfile.encoding.common.EndianType;
import org.apache.iotdb.tsfile.exception.encoding.TsFileDecodingException;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.utils.Binary;
@@ -37,6 +37,9 @@ import org.slf4j.LoggerFactory;
/**
* Decoder switch or enums value using bitmap, bitmap-encoding:. {@code
<length> <num>
* <encoded-data>}
+ *
+ * @deprecated (2019.1.25, The bitmap data type has been removed., We can
reserve this class, and
+ *reuse it later.)
*/
@Deprecated
public class BitmapDecoder extends Decoder {
@@ -70,10 +73,8 @@ public class BitmapDecoder extends Decoder {
/**
* BitmapDecoder constructor.
- *
- * @param endianType deprecated
*/
- public BitmapDecoder(EndianType endianType) {
+ public BitmapDecoder() {
super(TSEncoding.BITMAP);
this.reset();
LOGGER.debug("tsfile-encoding BitmapDecoder: init bitmap decoder");
@@ -98,7 +99,7 @@ public class BitmapDecoder extends Decoder {
int offset = 7 - ((number - currentCount) % 8);
for (Map.Entry<Integer, byte[]> entry : this.buffer.entrySet()) {
byte[] tmp = entry.getValue();
- if ((tmp[index] & ((byte) 1 << offset)) != 0) {
+ if (((tmp[index] & 0xff) & ((byte) 1 << offset)) != 0) {
result = entry.getKey();
}
}
@@ -106,7 +107,7 @@ public class BitmapDecoder extends Decoder {
return result;
}
- private void getLengthAndNumber(ByteBuffer buffer) throws IOException {
+ private void getLengthAndNumber(ByteBuffer buffer) {
this.length = ReadWriteForEncodingUtils.readUnsignedVarInt(buffer);
this.number = ReadWriteForEncodingUtils.readUnsignedVarInt(buffer);
// TODO maybe this.byteCache = buffer is faster, but not safe
@@ -155,32 +156,25 @@ public class BitmapDecoder extends Decoder {
*/
public List<Pair<Integer, byte[]>> decodeAll(int target, List<ByteBuffer>
pageList) {
List<Pair<Integer, byte[]>> resultList = new ArrayList<>();
- for (ByteBuffer buffer : pageList) {
- try {
- reset();
- getLengthAndNumber(buffer);
- int byteArrayLength = (this.number + 7) / 8;
- byte[] tmp = new byte[byteArrayLength];
- while (byteCache.remaining() > 0) {
- int value = ReadWriteForEncodingUtils.readUnsignedVarInt(byteCache);
- if (value == target) {
- byteCache.get(tmp, 0, byteArrayLength);
- break;
- } else {
- byteCache.position(byteCache.position() + byteArrayLength);
- }
+ for (ByteBuffer bufferPage : pageList) {
+ reset();
+ getLengthAndNumber(bufferPage);
+ int byteArrayLength = (this.number + 7) / 8;
+ byte[] tmp = new byte[byteArrayLength];
+ while (byteCache.remaining() > 0) {
+ int value = ReadWriteForEncodingUtils.readUnsignedVarInt(byteCache);
+ if (value == target) {
+ byteCache.get(tmp, 0, byteArrayLength);
+ break;
+ } else {
+ byteCache.position(byteCache.position() + byteArrayLength);
}
-
- resultList.add(new Pair<>(this.number, tmp));
- LOGGER.debug("tsfile-encoding BitmapDecoder: number {} in current
page, byte length {}",
- this.number,
- byteArrayLength);
- } catch (IOException e) {
- LOGGER.error(
- "tsfile-encoding BitmapDecoder: error occurs when decoding all
numbers in page {}, "
- + "number {}",
- buffer, this.number, e);
}
+
+ resultList.add(new Pair<>(this.number, tmp));
+ LOGGER.debug("tsfile-encoding BitmapDecoder: number {} in current page,
byte length {}",
+ this.number,
+ byteArrayLength);
}
return resultList;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/Decoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/Decoder.java
index bb516bb..18df718 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/Decoder.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/Decoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -29,12 +30,20 @@ import org.apache.iotdb.tsfile.utils.Binary;
public abstract class Decoder {
- public TSEncoding type;
+ private TSEncoding type;
public Decoder(TSEncoding type) {
this.type = type;
}
+ public void setType(TSEncoding type) {
+ this.type = type;
+ }
+
+ public TSEncoding getType() {
+ return type;
+ }
+
/**
* get Decoder object by type.
*
@@ -46,23 +55,43 @@ public abstract class Decoder {
// PLA and DFT encoding are not supported in current version
if (type == TSEncoding.PLAIN) {
return new PlainDecoder(EndianType.LITTLE_ENDIAN);
- } else if (type == TSEncoding.RLE && dataType == TSDataType.BOOLEAN) {
- return new IntRleDecoder(EndianType.LITTLE_ENDIAN);
- } else if (type == TSEncoding.TS_2DIFF && dataType == TSDataType.INT32) {
- return new DeltaBinaryDecoder.IntDeltaDecoder();
- } else if (type == TSEncoding.TS_2DIFF && dataType == TSDataType.INT64) {
- return new DeltaBinaryDecoder.LongDeltaDecoder();
- } else if (type == TSEncoding.RLE && dataType == TSDataType.INT32) {
- return new IntRleDecoder(EndianType.LITTLE_ENDIAN);
- } else if (type == TSEncoding.RLE && dataType == TSDataType.INT64) {
- return new LongRleDecoder(EndianType.LITTLE_ENDIAN);
- } else if ((dataType == TSDataType.FLOAT || dataType == TSDataType.DOUBLE)
- && (type == TSEncoding.RLE || type == TSEncoding.TS_2DIFF)) {
- return new FloatDecoder(TSEncoding.valueOf(type.toString()), dataType);
- } else if (type == TSEncoding.GORILLA && dataType == TSDataType.FLOAT) {
- return new SinglePrecisionDecoder();
- } else if (type == TSEncoding.GORILLA && dataType == TSDataType.DOUBLE) {
- return new DoublePrecisionDecoder();
+ } else if (type == TSEncoding.RLE) {
+ switch (dataType) {
+ case BOOLEAN:
+ case INT32:
+ return new IntRleDecoder(EndianType.LITTLE_ENDIAN);
+ case INT64:
+ return new LongRleDecoder(EndianType.LITTLE_ENDIAN);
+ case FLOAT:
+ case DOUBLE:
+ return new FloatDecoder(TSEncoding.valueOf(type.toString()),
dataType);
+ default:
+ throw new TsFileDecodingException(
+ "Decoder not found:" + type + " , DataType is :" + dataType);
+ }
+ } else if (type == TSEncoding.TS_2DIFF) {
+ switch (dataType) {
+ case INT32:
+ return new DeltaBinaryDecoder.IntDeltaDecoder();
+ case INT64:
+ return new DeltaBinaryDecoder.LongDeltaDecoder();
+ case FLOAT:
+ case DOUBLE:
+ return new FloatDecoder(TSEncoding.valueOf(type.toString()),
dataType);
+ default:
+ throw new TsFileDecodingException(
+ "Decoder not found:" + type + " , DataType is :" + dataType);
+ }
+ } else if (type == TSEncoding.GORILLA) {
+ switch (dataType) {
+ case FLOAT:
+ return new SinglePrecisionDecoder();
+ case DOUBLE:
+ return new DoublePrecisionDecoder();
+ default:
+ throw new TsFileDecodingException(
+ "Decoder not found:" + type + " , DataType is :" + dataType);
+ }
} else {
throw new TsFileDecodingException(
"Decoder not found:" + type + " , DataType is :" + dataType);
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 db508d8..b4ed46f 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
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -24,8 +25,6 @@ import
org.apache.iotdb.tsfile.encoding.encoder.DeltaBinaryEncoder;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.utils.BytesUtils;
import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* This class is a decoder for decoding the byte array that encoded by {@code
@@ -36,7 +35,6 @@ import org.slf4j.LoggerFactory;
*/
public abstract class DeltaBinaryDecoder extends Decoder {
- private static final Logger LOG =
LoggerFactory.getLogger(DeltaBinaryDecoder.class);
protected long count = 0;
protected byte[] deltaBuf;
@@ -166,6 +164,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
@Override
public void reset() {
+ // do nothing
}
}
@@ -251,6 +250,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
@Override
public void reset() {
+ // do nothing
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DoublePrecisionDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DoublePrecisionDecoder.java
index d608a3e..d780c55 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DoublePrecisionDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DoublePrecisionDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -34,6 +35,7 @@ public class DoublePrecisionDecoder extends GorillaDecoder {
private long preValue;
public DoublePrecisionDecoder() {
+ // do nothing
}
@Override
@@ -57,8 +59,7 @@ public class DoublePrecisionDecoder extends GorillaDecoder {
getNextValue(buffer);
return tmp;
} catch (IOException e) {
- LOGGER.error("DoublePrecisionDecoder cannot read first double number
because: {}",
- e.getMessage());
+ LOGGER.error("DoublePrecisionDecoder cannot read first double number",
e);
}
} else {
try {
@@ -66,8 +67,7 @@ public class DoublePrecisionDecoder extends GorillaDecoder {
getNextValue(buffer);
return tmp;
} catch (IOException e) {
- LOGGER.error("DoublePrecisionDecoder cannot read following double
number because: {}",
- e.getMessage());
+ LOGGER.error("DoublePrecisionDecoder cannot read following double
number", e);
}
}
return Double.NaN;
@@ -111,9 +111,4 @@ public class DoublePrecisionDecoder extends GorillaDecoder {
isEnd = true;
}
}
-
- @Override
- public void reset() {
- super.reset();
- }
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FloatDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FloatDecoder.java
index f65a810..12ab6f8 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FloatDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FloatDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -92,8 +93,7 @@ public class FloatDecoder extends Decoder {
public double readDouble(ByteBuffer buffer) {
readMaxPointValue(buffer);
long value = decoder.readLong(buffer);
- double result = value / maxPointValue;
- return result;
+ return value / maxPointValue;
}
private void readMaxPointValue(ByteBuffer buffer) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/IntRleDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/IntRleDecoder.java
index 1eca225..b4cd1fc 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/IntRleDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/IntRleDecoder.java
@@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
import java.nio.ByteBuffer;
+import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.encoding.bitpacking.IntPacker;
import org.apache.iotdb.tsfile.encoding.common.EndianType;
import org.apache.iotdb.tsfile.exception.encoding.TsFileDecodingException;
@@ -62,8 +64,7 @@ public class IntRleDecoder extends RleDecoder {
/**
* read an int value from InputStream.
*
- * @param buffer
- * - ByteBuffer
+ * @param buffer - ByteBuffer
* @return value - current valid value
*/
@Override
@@ -84,7 +85,7 @@ public class IntRleDecoder extends RleDecoder {
}
}
--currentCount;
- int result = 0;
+ int result;
switch (mode) {
case RLE:
result = currentValue;
@@ -116,18 +117,14 @@ public class IntRleDecoder extends RleDecoder {
@Override
protected void readBitPackingBuffer(int bitPackedGroupCount, int
lastBitPackedNum) {
- currentBuffer = new int[bitPackedGroupCount * config.RLE_MIN_REPEATED_NUM];
+ currentBuffer = new int[bitPackedGroupCount *
TSFileConfig.RLE_MIN_REPEATED_NUM];
byte[] bytes = new byte[bitPackedGroupCount * bitWidth];
int bytesToRead = bitPackedGroupCount * bitWidth;
bytesToRead = Math.min(bytesToRead, byteCache.remaining());
byteCache.get(bytes, 0, bytesToRead);
// save all int values in currentBuffer
- packer.unpackAllValues(bytes, 0, bytesToRead, currentBuffer);
+ packer.unpackAllValues(bytes, bytesToRead, currentBuffer);
}
- @Override
- public void reset() {
- super.reset();
- }
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/LongRleDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/LongRleDecoder.java
index b918538..4819666 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/LongRleDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/LongRleDecoder.java
@@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
import java.nio.ByteBuffer;
+import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.encoding.bitpacking.LongPacker;
import org.apache.iotdb.tsfile.encoding.common.EndianType;
import org.apache.iotdb.tsfile.exception.encoding.TsFileDecodingException;
@@ -78,7 +80,7 @@ public class LongRleDecoder extends RleDecoder {
}
}
--currentCount;
- long result = 0;
+ long result;
switch (mode) {
case RLE:
result = currentValue;
@@ -111,18 +113,14 @@ public class LongRleDecoder extends RleDecoder {
@Override
protected void readBitPackingBuffer(int bitPackedGroupCount, int
lastBitPackedNum)
throws IOException {
- currentBuffer = new long[bitPackedGroupCount *
config.RLE_MIN_REPEATED_NUM];
+ currentBuffer = new long[bitPackedGroupCount *
TSFileConfig.RLE_MIN_REPEATED_NUM];
byte[] bytes = new byte[bitPackedGroupCount * bitWidth];
int bytesToRead = bitPackedGroupCount * bitWidth;
bytesToRead = Math.min(bytesToRead, byteCache.remaining());
byteCache.get(bytes, 0, bytesToRead);
// save all long values in currentBuffer
- packer.unpackAllValues(bytes, 0, bytesToRead, currentBuffer);
+ packer.unpackAllValues(bytes, bytesToRead, currentBuffer);
}
- @Override
- public void reset() {
- super.reset();
- }
}
\ No newline at end of file
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/PlainDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/PlainDecoder.java
index 9678555..158bbfc 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/PlainDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/PlainDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -35,7 +36,15 @@ import org.slf4j.LoggerFactory;
public class PlainDecoder extends Decoder {
private static final Logger LOGGER =
LoggerFactory.getLogger(PlainDecoder.class);
- public EndianType endianType;
+ private EndianType endianType;
+
+ public EndianType getEndianType() {
+ return endianType;
+ }
+
+ public void setEndianType(EndianType endianType) {
+ this.endianType = endianType;
+ }
public PlainDecoder(EndianType endianType) {
super(TSEncoding.PLAIN);
@@ -45,11 +54,7 @@ public class PlainDecoder extends Decoder {
@Override
public boolean readBoolean(ByteBuffer buffer) {
int ch1 = ReadWriteIOUtils.read(buffer);
- if (ch1 == 0) {
- return false;
- } else {
- return true;
- }
+ return ch1 != 0;
}
@Override
@@ -124,5 +129,6 @@ public class PlainDecoder extends Decoder {
@Override
public void reset() {
+ // do nothing
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/RleDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/RleDecoder.java
index c22b6c3..7e52ce6 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/RleDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/RleDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -36,7 +37,16 @@ import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
*/
public abstract class RleDecoder extends Decoder {
- public EndianType endianType;
+ private EndianType endianType;
+
+ public EndianType getEndianType() {
+ return endianType;
+ }
+
+ public void setEndianType(EndianType endianType) {
+ this.endianType = endianType;
+ }
+
protected TSFileConfig config = TSFileDescriptor.getInstance().getConfig();
/**
* mode to indicate current encoding type 0 - RLE 1 - BIT_PACKED.
@@ -111,20 +121,7 @@ public abstract class RleDecoder extends Decoder {
readNumberInRle();
break;
case BIT_PACKED:
- int bitPackedGroupCount = header >> 1;
- // in last bit-packing group, there may be some useless value,
- // lastBitPackedNum indicates how many values is useful
- int lastBitPackedNum = ReadWriteIOUtils.read(byteCache);
- if (bitPackedGroupCount > 0) {
-
- currentCount = (bitPackedGroupCount - 1) *
config.RLE_MIN_REPEATED_NUM + lastBitPackedNum;
- bitPackingNum = currentCount;
- } else {
- throw new TsFileDecodingException(String.format(
- "tsfile-encoding IntRleDecoder: bitPackedGroupCount %d, smaller
than 1",
- bitPackedGroupCount));
- }
- readBitPackingBuffer(bitPackedGroupCount, lastBitPackedNum);
+ callReadBitPackingBuffer(header);
break;
default:
throw new TsFileDecodingException(
@@ -132,13 +129,30 @@ public abstract class RleDecoder extends Decoder {
}
}
+ protected void callReadBitPackingBuffer(int header) throws IOException {
+ int bitPackedGroupCount = header >> 1;
+ // in last bit-packing group, there may be some useless value,
+ // lastBitPackedNum indicates how many values is useful
+ int lastBitPackedNum = ReadWriteIOUtils.read(byteCache);
+ if (bitPackedGroupCount > 0) {
+
+ currentCount =
+ (bitPackedGroupCount - 1) * TSFileConfig.RLE_MIN_REPEATED_NUM +
lastBitPackedNum;
+ bitPackingNum = currentCount;
+ } else {
+ throw new TsFileDecodingException(String.format(
+ "tsfile-encoding IntRleDecoder: bitPackedGroupCount %d, smaller than
1",
+ bitPackedGroupCount));
+ }
+ readBitPackingBuffer(bitPackedGroupCount, lastBitPackedNum);
+ }
+
/**
* read length and bit width of current package before we decode number.
*
* @param buffer ByteBuffer
*/
protected void readLengthAndBitWidth(ByteBuffer buffer) {
- // long st = System.currentTimeMillis();
length = ReadWriteForEncodingUtils.readUnsignedVarInt(buffer);
byte[] tmp = new byte[length];
buffer.get(tmp, 0, length);
@@ -231,7 +245,7 @@ public abstract class RleDecoder extends Decoder {
throw new TsFileDecodingException("Method readBigDecimal is not supproted
by RleDecoder");
}
- protected static enum Mode {
+ protected enum Mode {
RLE, BIT_PACKED
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/SinglePrecisionDecoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/SinglePrecisionDecoder.java
index 8dac0ba..db2a7c1 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/SinglePrecisionDecoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/SinglePrecisionDecoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import java.io.IOException;
@@ -34,6 +35,7 @@ public class SinglePrecisionDecoder extends GorillaDecoder {
private int preValue;
public SinglePrecisionDecoder() {
+ //do nothing
}
@Override
@@ -53,8 +55,7 @@ public class SinglePrecisionDecoder extends GorillaDecoder {
getNextValue(buffer);
return tmp;
} catch (IOException e) {
- LOGGER.error("SinglePrecisionDecoder cannot read first float number
because: {}",
- e.getMessage());
+ LOGGER.error("SinglePrecisionDecoder cannot read first float number",
e);
}
} else {
try {
@@ -62,8 +63,7 @@ public class SinglePrecisionDecoder extends GorillaDecoder {
getNextValue(buffer);
return tmp;
} catch (IOException e) {
- LOGGER.error("SinglePrecisionDecoder cannot read following float
number "
- + "because: {}", e.getMessage());
+ LOGGER.error("SinglePrecisionDecoder cannot read following float
number", e);
}
}
return Float.NaN;
@@ -108,8 +108,4 @@ public class SinglePrecisionDecoder extends GorillaDecoder {
}
}
- @Override
- public void reset() {
- super.reset();
- }
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/BitmapEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/BitmapEncoder.java
index 8868b95..c954792 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/BitmapEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/BitmapEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -24,7 +25,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.iotdb.tsfile.encoding.common.EndianType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.utils.ReadWriteForEncodingUtils;
import org.slf4j.Logger;
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
* bit-index := a list of 01 sequence to record the position of the value above
* }
* </pre>.
+
* Decode switch or enum values using bitmap, bitmap-encode.{@code <length>
<num> <encoded data> }
* @deprecated This class has been deprecated.
* @since deprecated since 0.4.0
@@ -60,10 +61,8 @@ public class BitmapEncoder extends Encoder {
/**
* BitmapEncoder constructor.
- *
- * @param endianType deprecated
*/
- public BitmapEncoder(EndianType endianType) {
+ public BitmapEncoder() {
super(TSEncoding.BITMAP);
this.values = new ArrayList<>();
LOGGER.debug("tsfile-encoding BitmapEncoder: init bitmap encoder");
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DeltaBinaryEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DeltaBinaryEncoder.java
index 0fac59b..3f8bf72 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DeltaBinaryEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DeltaBinaryEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -26,28 +27,24 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * <p>
- * DeltaBinaryEncoder is a encoder for compressing data in type of integer and
long.We adapt a
+ * <p> DeltaBinaryEncoder is a encoder for compressing data in type of integer
and long.We adapt a
* hypothesis that contiguous data points have similar values. Thus the
difference value of two
* adjacent points is smaller than those two point values. One integer in java
takes 32-bits. If an
* positive number is less than 2^m, the bits of this integer which index from
m to 31 are all 0.
* Given an array which length is n, if all values in input data array are all
positive and less
- * than 2^m, we need actually m*n, but not 32*n bits to store the array.
- * </p>
- * <p>
- * DeltaBinaryEncoder calculates difference between two adjacent points and
record the minimum of
- * those difference values firstly. Then it save two_diff value that
difference minus minimum of
- * them, to make sure all two_diff values are positive. Then it statistics the
longest bit length
- * {@code m} it takes for each two_diff value, which means the bit length that
maximum two_diff
- * value takes. Only the low m bits are saved into result byte array for all
two_diff values.
- * </p>
+ * than 2^m, we need actually m*n, but not 32*n bits to store the array. </p>
<p> DeltaBinaryEncoder
+ * calculates difference between two adjacent points and record the minimum of
those difference
+ * values firstly. Then it save two_diff value that difference minus minimum
of them, to make sure
+ * all two_diff values are positive. Then it statistics the longest bit length
{@code m} it takes
+ * for each two_diff value, which means the bit length that maximum two_diff
value takes. Only the
+ * low m bits are saved into result byte array for all two_diff values. </p>
*
* @author kangrong
*/
public abstract class DeltaBinaryEncoder extends Encoder {
protected static final int BLOCK_DEFAULT_SIZE = 128;
- private static final Logger LOG =
LoggerFactory.getLogger(DeltaBinaryEncoder.class);
+ private static final Logger LOGGER =
LoggerFactory.getLogger(DeltaBinaryEncoder.class);
protected ByteArrayOutputStream out;
protected int blockSize;
// input value is stored in deltaBlackBuffer temporarily
@@ -119,7 +116,7 @@ public abstract class DeltaBinaryEncoder extends Encoder {
try {
flushBlockBuffer(out);
} catch (IOException e) {
- LOG.error("flush data to stream failed!");
+ LOGGER.error("flush data to stream failed!", e);
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DoublePrecisionEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DoublePrecisionEncoder.java
index 72f0d46..381b0f9 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DoublePrecisionEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/DoublePrecisionEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -29,6 +30,10 @@ public class DoublePrecisionEncoder extends GorillaEncoder {
private long preValue;
+ public DoublePrecisionEncoder() {
+ //do nothing
+ }
+
@Override
public void encode(double value, ByteArrayOutputStream out) throws
IOException {
if (!flag) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/Encoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/Encoder.java
index dffced2..22a36c7 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/Encoder.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/Encoder.java
@@ -36,7 +36,15 @@ public abstract class Encoder {
public static final String MAX_STRING_LENGTH = "max_string_length";
public static final String MAX_POINT_NUMBER = "max_point_number";
- protected TSEncoding type;
+ private TSEncoding type;
+
+ public void setType(TSEncoding type) {
+ this.type = type;
+ }
+
+ public TSEncoding getType() {
+ return type;
+ }
public Encoder(TSEncoding type) {
this.type = type;
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FloatEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FloatEncoder.java
index 7d627c8..d04986c 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FloatEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FloatEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/IntRleEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/IntRleEncoder.java
index a1d4d14..a41b840 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/IntRleEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/IntRleEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -60,10 +61,8 @@ public class IntRleEncoder extends RleEncoder<Integer> {
/**
* write all values buffered in the cache to an OutputStream.
*
- * @param out
- * - byteArrayOutputStream
- * @throws IOException
- * cannot flush to OutputStream
+ * @param out - byteArrayOutputStream
+ * @throws IOException cannot flush to OutputStream
*/
@Override
public void flush(ByteArrayOutputStream out) throws IOException {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/LongRleEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/LongRleEncoder.java
index bab69a0..c20d9db 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/LongRleEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/LongRleEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/PlainEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/PlainEncoder.java
index 0cd848a..295fc4c 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/PlainEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/PlainEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -47,6 +48,14 @@ public class PlainEncoder extends Encoder {
this.maxStringLength = maxStringLength;
}
+ public void setEndianType(EndianType endianType) {
+ this.endianType = endianType;
+ }
+
+ public EndianType getEndianType() {
+ return endianType;
+ }
+
@Override
public void encode(boolean value, ByteArrayOutputStream out) {
if (value) {
@@ -59,7 +68,7 @@ public class PlainEncoder extends Encoder {
@Override
public void encode(short value, ByteArrayOutputStream out) {
if (this.endianType == EndianType.LITTLE_ENDIAN) {
- out.write((value >> 0) & 0xFF);
+ out.write(value & 0xFF);
out.write((value >> 8) & 0xFF);
} else if (this.endianType == EndianType.BIG_ENDIAN) {
LOGGER.error(
@@ -72,7 +81,7 @@ public class PlainEncoder extends Encoder {
@Override
public void encode(int value, ByteArrayOutputStream out) {
if (this.endianType == EndianType.LITTLE_ENDIAN) {
- out.write((value >> 0) & 0xFF);
+ out.write(value & 0xFF);
out.write((value >> 8) & 0xFF);
out.write((value >> 16) & 0xFF);
out.write((value >> 24) & 0xFF);
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/RleEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/RleEncoder.java
index c6ca813..e05a313 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/RleEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/RleEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -60,7 +61,16 @@ import org.slf4j.LoggerFactory;
public abstract class RleEncoder<T extends Comparable<T>> extends Encoder {
private static final Logger LOGGER =
LoggerFactory.getLogger(RleEncoder.class);
- protected EndianType endianType;
+
+ private EndianType endianType;
+
+ public EndianType getEndianType() {
+ return endianType;
+ }
+
+ public void setEndianType(EndianType endianType) {
+ this.endianType = endianType;
+ }
/**
* we save all value in a list and calculate its bitwidth.
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SinglePrecisionEncoder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SinglePrecisionEncoder.java
index 6cb14d2..7c88245 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SinglePrecisionEncoder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/SinglePrecisionEncoder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.io.ByteArrayOutputStream;
@@ -40,7 +41,7 @@ public class SinglePrecisionEncoder extends GorillaEncoder {
preValue = Float.floatToIntBits(value);
leadingZeroNum = Integer.numberOfLeadingZeros(preValue);
tailingZeroNum = Integer.numberOfTrailingZeros(preValue);
- out.write((preValue >> 0) & 0xFF);
+ out.write(preValue & 0xFF);
out.write((preValue >> 8) & 0xFF);
out.write((preValue >> 16) & 0xFF);
out.write((preValue >> 24) & 0xFF);
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/TSEncodingBuilder.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/TSEncodingBuilder.java
index 7ab03c9..5154050 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/TSEncodingBuilder.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/TSEncodingBuilder.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.encoder;
import java.util.Map;
@@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
*/
public abstract class TSEncodingBuilder {
- private static final Logger LOG =
LoggerFactory.getLogger(TSEncodingBuilder.class);
+ private static final Logger LOGGER =
LoggerFactory.getLogger(TSEncodingBuilder.class);
protected final TSFileConfig conf;
public TSEncodingBuilder() {
@@ -110,7 +111,8 @@ public abstract class TSEncodingBuilder {
maxStringLength =
Integer.valueOf(props.get(Encoder.MAX_STRING_LENGTH));
if (maxStringLength < 0) {
maxStringLength = TSFileConfig.maxStringLength;
- LOG.warn("cannot set max string length to negative value, replaced
with default value:{}",
+ LOGGER.warn(
+ "cannot set max string length to negative value, replaced with
default value:{}",
maxStringLength);
}
}
@@ -153,8 +155,9 @@ public abstract class TSEncodingBuilder {
maxPointNumber = Integer.valueOf(props.get(Encoder.MAX_POINT_NUMBER));
if (maxPointNumber < 0) {
maxPointNumber = TSFileConfig.floatPrecision;
- LOG.warn("cannot set max point number to negative value, replaced
with default value:{}",
- maxPointNumber);
+ LOGGER
+ .warn("cannot set max point number to negative value, replaced
with default value:{}",
+ maxPointNumber);
}
}
}
@@ -200,8 +203,9 @@ public abstract class TSEncodingBuilder {
maxPointNumber = Integer.valueOf(props.get(Encoder.MAX_POINT_NUMBER));
if (maxPointNumber < 0) {
maxPointNumber = TSFileConfig.floatPrecision;
- LOG.warn("cannot set max point number to negative value, replaced
with default value:{}",
- maxPointNumber);
+ LOGGER
+ .warn("cannot set max point number to negative value, replaced
with default value:{}",
+ maxPointNumber);
}
}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
index 910af37..c8bfe12 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
@@ -16,11 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.exception.cache;
public class CacheException extends Exception {
public CacheException() {
+ //do nothing
}
public CacheException(String message) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
index 06de4d7..39e12fe 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.exception.encoding;
import org.apache.iotdb.tsfile.exception.TsFileRuntimeException;
@@ -31,6 +32,7 @@ public class TsFileDecodingException extends
TsFileRuntimeException {
private static final long serialVersionUID = -8632392900655017028L;
public TsFileDecodingException() {
+ //do nothing
}
public TsFileDecodingException(String message, Throwable cause) {
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
index 8941aa7..946e248 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.exception.encoding;
import org.apache.iotdb.tsfile.exception.TsFileRuntimeException;
@@ -31,6 +32,7 @@ public class TsFileEncodingException extends
TsFileRuntimeException {
private static final long serialVersionUID = -7225811149696714845L;
public TsFileEncodingException() {
+ //do nothing
}
public TsFileEncodingException(String message, Throwable cause) {
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
index e93cd94..ec38232 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file;
import java.io.IOException;
@@ -29,9 +30,10 @@ public class MetaMarker {
public static final byte CHUNK_HEADER = 1;
public static final byte SEPARATOR = 2;
+ private MetaMarker() {
+ }
+
public static void handleUnexpectedMarker(byte marker) throws IOException {
throw new IOException("Unexpected marker " + marker);
}
-
- private MetaMarker(){}
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/footer/ChunkGroupFooter.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/footer/ChunkGroupFooter.java
index 25b8aba..4cdcf85 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/footer/ChunkGroupFooter.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/footer/ChunkGroupFooter.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.footer;
import java.io.IOException;
@@ -90,16 +91,17 @@ public class ChunkGroupFooter {
public static ChunkGroupFooter deserializeFrom(FileChannel channel, long
offset,
boolean markerRead)
throws IOException {
+ long offsetVar = offset;
if (!markerRead) {
- offset++;
+ offsetVar++;
}
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
- channel.read(buffer, offset);
+ channel.read(buffer, offsetVar);
buffer.flip();
int size = buffer.getInt();
- offset += Integer.BYTES;
+ offsetVar += Integer.BYTES;
buffer = ByteBuffer.allocate(getSerializedSize(size));
- ReadWriteIOUtils.readAsPossible(channel, offset, buffer);
+ ReadWriteIOUtils.readAsPossible(channel, offsetVar, buffer);
buffer.flip();
String deviceID = ReadWriteIOUtils.readStringWithoutLength(buffer, size);
long dataSize = ReadWriteIOUtils.readLong(buffer);
@@ -140,7 +142,6 @@ public class ChunkGroupFooter {
length += ReadWriteIOUtils.write(deviceID, outputStream);
length += ReadWriteIOUtils.write(dataSize, outputStream);
length += ReadWriteIOUtils.write(numberOfChunks, outputStream);
- assert length == getSerializedSize();
return length;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/ChunkHeader.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/ChunkHeader.java
index 9aefed4..2c27256 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/ChunkHeader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/ChunkHeader.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.header;
import java.io.IOException;
@@ -133,16 +134,17 @@ public class ChunkHeader {
*/
public static ChunkHeader deserializeFrom(FileChannel channel, long offset,
boolean markerRead)
throws IOException {
+ long offsetVar = offset;
if (!markerRead) {
- offset++;
+ offsetVar++;
}
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
- channel.read(buffer, offset);
+ channel.read(buffer, offsetVar);
buffer.flip();
int size = buffer.getInt();
- offset += Integer.BYTES;
+ offsetVar += Integer.BYTES;
buffer = ByteBuffer.allocate(getSerializedSize(size));
- ReadWriteIOUtils.readAsPossible(channel, offset, buffer);
+ ReadWriteIOUtils.readAsPossible(channel, offsetVar, buffer);
buffer.flip();
String measurementID = ReadWriteIOUtils.readStringWithoutLength(buffer,
size);
return deserializePartFrom(measurementID, buffer);
@@ -192,7 +194,6 @@ public class ChunkHeader {
length += ReadWriteIOUtils.write(compressionType, outputStream);
length += ReadWriteIOUtils.write(encodingType, outputStream);
length += ReadWriteIOUtils.write(maxTombstoneTime, outputStream);
- assert length == getSerializedSize();
return length;
}
@@ -212,7 +213,6 @@ public class ChunkHeader {
length += ReadWriteIOUtils.write(compressionType, buffer);
length += ReadWriteIOUtils.write(encodingType, buffer);
length += ReadWriteIOUtils.write(maxTombstoneTime, buffer);
- assert length == getSerializedSize();
return length;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
index 9c9eca6..aa38ecf 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.header;
import java.io.IOException;
@@ -32,7 +33,7 @@ public class PageHeader {
private int uncompressedSize;
private int compressedSize;
private int numOfValues;
- private Statistics<?> statistics;
+ private Statistics statistics;
private long maxTimestamp;
private long minTimestamp;
@@ -40,15 +41,16 @@ public class PageHeader {
private int serializedSize;
public PageHeader(int uncompressedSize, int compressedSize, int numOfValues,
- Statistics<?> statistics,
- long maxTimestamp, long minTimestamp) {
+ Statistics statistics,
+ long maxTimestamp, long minTimestamp) {
this.uncompressedSize = uncompressedSize;
this.compressedSize = compressedSize;
this.numOfValues = numOfValues;
if (statistics == null) {
- statistics = new NoStatistics();
+ this.statistics = new NoStatistics();
+ } else {
+ this.statistics = statistics;
}
- this.statistics = statistics;
this.maxTimestamp = maxTimestamp;
this.minTimestamp = minTimestamp;
serializedSize = calculatePageHeaderSize();
@@ -114,7 +116,7 @@ public class PageHeader {
this.numOfValues = numOfValues;
}
- public Statistics<?> getStatistics() {
+ public Statistics getStatistics() {
return statistics;
}
@@ -142,7 +144,6 @@ public class PageHeader {
length += ReadWriteIOUtils.write(maxTimestamp, outputStream);
length += ReadWriteIOUtils.write(minTimestamp, outputStream);
length += statistics.serialize(outputStream);
- assert length == getSerializedSize();
return length;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkGroupMetaData.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkGroupMetaData.java
index ceac1b8..880005c 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkGroupMetaData.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkGroupMetaData.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -106,7 +107,7 @@ public class ChunkGroupMetaData {
public static ChunkGroupMetaData deserializeFrom(ByteBuffer buffer) {
ChunkGroupMetaData chunkGroupMetaData = new ChunkGroupMetaData();
- chunkGroupMetaData.deviceID = (ReadWriteIOUtils.readString(buffer));
+ chunkGroupMetaData.deviceID = ReadWriteIOUtils.readString(buffer);
int size = ReadWriteIOUtils.readInt(buffer);
@@ -176,7 +177,6 @@ public class ChunkGroupMetaData {
for (ChunkMetaData chunkMetaData : chunkMetaDataList) {
byteLen += chunkMetaData.serializeTo(outputStream);
}
- assert byteLen == getSerializedSize();
return byteLen;
}
@@ -196,8 +196,6 @@ public class ChunkGroupMetaData {
for (ChunkMetaData chunkMetaData : chunkMetaDataList) {
byteLen += chunkMetaData.serializeTo(buffer);
}
- assert byteLen == getSerializedSize();
-
return byteLen;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetaData.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetaData.java
index dea423c..607a298 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetaData.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/ChunkMetaData.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -215,8 +216,6 @@ public class ChunkMetaData {
} else {
byteLen += valuesStatistics.serializeTo(outputStream);
}
-
- assert byteLen == getSerializedSize();
return byteLen;
}
@@ -241,8 +240,6 @@ public class ChunkMetaData {
} else {
byteLen += valuesStatistics.serializeTo(buffer);
}
-
- assert byteLen == getSerializedSize();
return byteLen;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadata.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadata.java
index 2de1a72..a7c4a5a 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadata.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadata.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -182,7 +183,6 @@ public class TsDeviceMetadata {
byteLen += chunkGroupMetaData.serializeTo(outputStream);
}
}
- assert getSerializedSize() == byteLen;
return byteLen;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadataIndex.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadataIndex.java
index 0ba26dd..fbc6633 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadataIndex.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDeviceMetadataIndex.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -44,7 +45,7 @@ public class TsDeviceMetadataIndex {
private long endTime;
public TsDeviceMetadataIndex() {
-
+ //do nothing
}
/**
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDigest.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDigest.java
index bc1e841..869c2f4 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDigest.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsDigest.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -47,11 +48,11 @@ public class TsDigest {
}
public static int serializeNullTo(OutputStream outputStream) throws
IOException {
- return ReadWriteIOUtils.write(0, outputStream);// Integer.BYTES;
+ return ReadWriteIOUtils.write(0, outputStream);
}
public static int serializeNullTo(ByteBuffer buffer) {
- return ReadWriteIOUtils.write(0, buffer);// Integer.BYTES;
+ return ReadWriteIOUtils.write(0, buffer);
}
/**
@@ -167,17 +168,16 @@ public class TsDigest {
}
int byteLen = 0;
if (statistics == null || statistics.size() == 0) {
- byteLen += ReadWriteIOUtils.write(0, outputStream);// Integer.BYTES;
+ byteLen += ReadWriteIOUtils.write(0, outputStream);
} else {
- byteLen += ReadWriteIOUtils.write(statistics.size(), outputStream);//
Integer.BYTES;
+ byteLen += ReadWriteIOUtils.write(statistics.size(), outputStream);
for (Map.Entry<String, ByteBuffer> entry : statistics.entrySet()) {
byteLen += ReadWriteIOUtils
- .write(entry.getKey(), outputStream);// Integer.BYTES+key.length()
+ .write(entry.getKey(), outputStream);
byteLen += ReadWriteIOUtils
- .write(entry.getValue(), outputStream);//
Integer.BYTES+value.remaining();
+ .write(entry.getValue(), outputStream);
}
}
- assert byteLen == getSerializedSize();
return byteLen;
}
@@ -195,16 +195,15 @@ public class TsDigest {
int byteLen = 0;
if (statistics == null || statistics.size() == 0) {
- byteLen += ReadWriteIOUtils.write(0, buffer);// Integer.BYTES;
+ byteLen += ReadWriteIOUtils.write(0, buffer);
} else {
- byteLen += ReadWriteIOUtils.write(statistics.size(), buffer);//
Integer.BYTES;
+ byteLen += ReadWriteIOUtils.write(statistics.size(), buffer);
for (Map.Entry<String, ByteBuffer> entry : statistics.entrySet()) {
- byteLen += ReadWriteIOUtils.write(entry.getKey(), buffer);//
Integer.BYTES+key.length()
+ byteLen += ReadWriteIOUtils.write(entry.getKey(), buffer);
byteLen += ReadWriteIOUtils
- .write(entry.getValue(), buffer);//
Integer.BYTES+value.remaining();
+ .write(entry.getValue(), buffer);
}
}
- assert byteLen == getSerializedSize();
return byteLen;
}
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
index 995e640..3cf9f0b 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.file.metadata;
import java.io.IOException;
@@ -52,6 +53,7 @@ public class TsFileMetaData {
private String createdBy;
public TsFileMetaData() {
+ //do nothing
}
/**
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
index ede2186..1bc0694 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Paths;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
-import org.apache.iotdb.tsfile.compress.UnCompressor;
+import org.apache.iotdb.tsfile.compress.IUnCompressor;
import org.apache.iotdb.tsfile.file.footer.ChunkGroupFooter;
import org.apache.iotdb.tsfile.file.header.ChunkHeader;
import org.apache.iotdb.tsfile.file.header.PageHeader;
@@ -274,7 +274,7 @@ public class TsFileSequenceReader {
private ByteBuffer readPage(PageHeader header, CompressionType type, long
position)
throws IOException {
ByteBuffer buffer = readData(position, header.getCompressedSize());
- UnCompressor unCompressor = UnCompressor.getUnCompressor(type);
+ IUnCompressor unCompressor = IUnCompressor.getUnCompressor(type);
ByteBuffer uncompressedBuffer =
ByteBuffer.allocate(header.getUncompressedSize());
switch (type) {
case UNCOMPRESSED:
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/chunk/ChunkReader.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/chunk/ChunkReader.java
index 172d99b..b46cb87 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/chunk/ChunkReader.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/chunk/ChunkReader.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
-import org.apache.iotdb.tsfile.compress.UnCompressor;
+import org.apache.iotdb.tsfile.compress.IUnCompressor;
import org.apache.iotdb.tsfile.encoding.decoder.Decoder;
import org.apache.iotdb.tsfile.file.header.ChunkHeader;
import org.apache.iotdb.tsfile.file.header.PageHeader;
@@ -38,7 +38,7 @@ public abstract class ChunkReader {
ChunkHeader chunkHeader;
private ByteBuffer chunkDataBuffer;
- private UnCompressor unCompressor;
+ private IUnCompressor unCompressor;
private Decoder valueDecoder;
private Decoder timeDecoder = Decoder.getDecoderByType(
TSEncoding.valueOf(TSFileConfig.timeSeriesEncoder),
@@ -64,7 +64,7 @@ public abstract class ChunkReader {
this.filter = filter;
this.chunkDataBuffer = chunk.getData();
chunkHeader = chunk.getHeader();
- this.unCompressor =
UnCompressor.getUnCompressor(chunkHeader.getCompressionType());
+ this.unCompressor =
IUnCompressor.getUnCompressor(chunkHeader.getCompressionType());
valueDecoder = Decoder
.getDecoderByType(chunkHeader.getEncodingType(),
chunkHeader.getDataType());
data = new BatchData(chunkHeader.getDataType());
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteIOUtils.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteIOUtils.java
index 19ef1d5..2e289f5 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteIOUtils.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteIOUtils.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.utils;
import java.io.IOException;
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkBuffer.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkBuffer.java
index 7fd9a0e..9fef1db 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkBuffer.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkBuffer.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
-import org.apache.iotdb.tsfile.compress.Compressor;
+import org.apache.iotdb.tsfile.compress.ICompressor;
import org.apache.iotdb.tsfile.exception.write.PageException;
import org.apache.iotdb.tsfile.file.header.PageHeader;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
public class ChunkBuffer {
private static final Logger LOG = LoggerFactory.getLogger(ChunkBuffer.class);
- private final Compressor compressor;
+ private final ICompressor compressor;
private final MeasurementSchema schema;
private int numOfPages;
diff --git
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/schema/MeasurementSchema.java
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/schema/MeasurementSchema.java
index 1d35a48..a65a434 100644
---
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/schema/MeasurementSchema.java
+++
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/schema/MeasurementSchema.java
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Objects;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.compress.Compressor;
+import org.apache.iotdb.tsfile.compress.ICompressor;
import org.apache.iotdb.tsfile.encoding.encoder.Encoder;
import org.apache.iotdb.tsfile.encoding.encoder.TSEncodingBuilder;
import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
@@ -53,7 +53,7 @@ public class MeasurementSchema implements
Comparable<MeasurementSchema> {
private TSEncoding encoding;
private String measurementId;
private TSEncodingBuilder encodingConverter;
- private Compressor compressor;
+ private ICompressor compressor;
private TSFileConfig conf;
private Map<String, String> props = new HashMap<>();
@@ -91,7 +91,7 @@ public class MeasurementSchema implements
Comparable<MeasurementSchema> {
// initialize TSEncoding. e.g. set max error for PLA and SDT
encodingConverter = TSEncodingBuilder.getConverter(encoding);
encodingConverter.initFromProps(props);
- this.compressor = Compressor.getCompressor(compressionType);
+ this.compressor = ICompressor.getCompressor(compressionType);
}
/**
@@ -107,7 +107,7 @@ public class MeasurementSchema implements
Comparable<MeasurementSchema> {
measurementSchema.encoding = ReadWriteIOUtils.readEncoding(inputStream);
CompressionType compressionType =
ReadWriteIOUtils.readCompressionType(inputStream);
- measurementSchema.compressor = Compressor.getCompressor(compressionType);
+ measurementSchema.compressor = ICompressor.getCompressor(compressionType);
int size = ReadWriteIOUtils.readInt(inputStream);
if (size > 0) {
@@ -137,7 +137,7 @@ public class MeasurementSchema implements
Comparable<MeasurementSchema> {
measurementSchema.encoding = ReadWriteIOUtils.readEncoding(buffer);
CompressionType compressionType =
ReadWriteIOUtils.readCompressionType(buffer);
- measurementSchema.compressor = Compressor.getCompressor(compressionType);
+ measurementSchema.compressor = ICompressor.getCompressor(compressionType);
int size = ReadWriteIOUtils.readInt(buffer);
if (size > 0) {
@@ -218,7 +218,7 @@ public class MeasurementSchema implements
Comparable<MeasurementSchema> {
return encodingConverter.getEncoder(type);
}
- public Compressor getCompressor() {
+ public ICompressor getCompressor() {
return compressor;
}
diff --git
a/tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
b/tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
index fc8d412..bd77c67 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
@@ -50,8 +50,8 @@ public class CompressTest {
public void snappyCompressorTest1() throws IOException {
PublicBAOS out = new PublicBAOS();
out.write(inputString.getBytes("UTF-8"));
- Compressor.SnappyCompressor compressor = new Compressor.SnappyCompressor();
- UnCompressor.SnappyUnCompressor unCompressor = new
UnCompressor.SnappyUnCompressor();
+ ICompressor.SnappyCompressor compressor = new
ICompressor.SnappyCompressor();
+ IUnCompressor.SnappyUnCompressor unCompressor = new
IUnCompressor.SnappyUnCompressor();
byte[] compressed = compressor.compress(out.getBuf());
byte[] uncompressed = unCompressor.uncompress(compressed);
String result = new String(uncompressed, "UTF-8");
@@ -62,8 +62,8 @@ public class CompressTest {
public void snappyCompressorTest2() throws IOException {
PublicBAOS out = new PublicBAOS();
out.write(inputString.getBytes("UTF-8"));
- Compressor.SnappyCompressor compressor = new Compressor.SnappyCompressor();
- UnCompressor.SnappyUnCompressor unCompressor = new
UnCompressor.SnappyUnCompressor();
+ ICompressor.SnappyCompressor compressor = new
ICompressor.SnappyCompressor();
+ IUnCompressor.SnappyUnCompressor unCompressor = new
IUnCompressor.SnappyUnCompressor();
byte[] compressed = new
byte[compressor.getMaxBytesForCompression(out.size())];
int size = compressor.compress(out.getBuf(), 0, out.size(), compressed);
byte[] bytes = Arrays.copyOfRange(compressed, 0, size);
diff --git
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPackerTest.java
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPackerTest.java
index 6a45c62..90046ed 100644
---
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPackerTest.java
+++
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/IntPackerTest.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.bitpacking;
import static org.junit.Assert.assertEquals;
@@ -49,7 +50,7 @@ public class IntPackerTest {
}
}
int res[] = new int[count * 8];
- packer.unpackAllValues(bb, 0, bb.length, res);
+ packer.unpackAllValues(bb, bb.length, res);
for (int i = 0; i < count * 8; i++) {
int v = preValues.get(i);
diff --git
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPackerTest.java
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPackerTest.java
index 98d8ae6..bb89d33 100644
---
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPackerTest.java
+++
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/bitpacking/LongPackerTest.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.bitpacking;
import static org.junit.Assert.assertEquals;
@@ -57,7 +58,7 @@ public class LongPackerTest {
}
}
long tres[] = new long[count * 8];
- packer.unpackAllValues(bb, 0, bb.length, tres);
+ packer.unpackAllValues(bb, bb.length, tres);
for (int i = 0; i < count * 8; i++) {
long v = preValues.get(i);
@@ -101,7 +102,7 @@ public class LongPackerTest {
new DataInputStream(bais).readFully(bytes, 0, bytesToRead);
// save all long values in currentBuffer
- packer.unpackAllValues(bytes, 0, bytesToRead, readArray);
+ packer.unpackAllValues(bytes, bytesToRead, readArray);
for (int i = 0; i < 16; i++) {
long v = bpList.get(i);
assertEquals(readArray[i], v);
diff --git
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoderTest.java
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoderTest.java
index 8846f46..909425a 100644
---
a/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoderTest.java
+++
b/tsfile/src/test/java/org/apache/iotdb/tsfile/encoding/decoder/BitmapDecoderTest.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.iotdb.tsfile.encoding.decoder;
import static org.junit.Assert.assertEquals;
@@ -24,7 +25,6 @@ import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
-import org.apache.iotdb.tsfile.encoding.common.EndianType;
import org.apache.iotdb.tsfile.encoding.encoder.BitmapEncoder;
import org.apache.iotdb.tsfile.encoding.encoder.Encoder;
import org.junit.After;
@@ -73,7 +73,7 @@ public class BitmapDecoderTest {
private void testInt(List<Integer> list, boolean isDebug, int repeatCount)
throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Encoder encoder = new BitmapEncoder(EndianType.LITTLE_ENDIAN);
+ Encoder encoder = new BitmapEncoder();
for (int i = 0; i < repeatCount; i++) {
for (int value : list) {
encoder.encode(value, baos);
@@ -82,7 +82,7 @@ public class BitmapDecoderTest {
}
ByteBuffer bais = ByteBuffer.wrap(baos.toByteArray());
- Decoder decoder = new BitmapDecoder(EndianType.LITTLE_ENDIAN);
+ Decoder decoder = new BitmapDecoder();
for (int i = 0; i < repeatCount; i++) {
for (int value : list) {
int value_ = decoder.readInt(bais);