Skip to content

Commit

Permalink
Bump spotless version to support java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
HTHou authored Jul 18, 2024
1 parent 4548541 commit 22fa427
Show file tree
Hide file tree
Showing 29 changed files with 119 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ private Constants() {} // can't construct

/** The value of <tt>System.getProperty("os.name")</tt>. * */
public static final String OS_NAME = System.getProperty("os.name");

/** True iff running on Linux. */
public static final boolean LINUX = OS_NAME.startsWith("Linux");

/** True iff running on Windows. */
public static final boolean WINDOWS = OS_NAME.startsWith("Windows");

/** True iff running on SunOS. */
public static final boolean SUN_OS = OS_NAME.startsWith("SunOS");

/** True iff running on Mac OS X */
public static final boolean MAC_OS_X = OS_NAME.startsWith("Mac OS X");

/** True iff running on FreeBSD */
public static final boolean FREE_BSD = OS_NAME.startsWith("FreeBSD");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class TSFileConfig implements Serializable {
public static final String MAGIC_STRING = "TsFile";
public static final String VERSION_NUMBER_V2 = "000002";
public static final String VERSION_NUMBER_V1 = "000001";

/** version number is changed to use 1 byte to represent since version 3. */
public static final byte VERSION_NUMBER = 0x03;

Expand All @@ -73,80 +74,112 @@ public class TSFileConfig implements Serializable {

/** The primitive array capacity threshold. */
public static final int ARRAY_CAPACITY_THRESHOLD = 1000;

/** Memory size threshold for flushing to disk, default value is 128MB. */
private int groupSizeInByte = 128 * 1024 * 1024;

/** The memory size for each series writer to pack page, default value is 64KB. */
private int pageSizeInByte = 64 * 1024;

/** The maximum number of data points in a page, default value is 10000. */
private int maxNumberOfPointsInPage = 10_000;

/** The maximum degree of a metadataIndex node, default value is 256. */
private int maxDegreeOfIndexNode = 256;

/** Data type for input timestamp, TsFile supports INT64. */
private TSDataType timeSeriesDataType = TSDataType.INT64;

/** Max length limitation of input string. */
private int maxStringLength = 128;

/** Floating-point precision. */
private int floatPrecision = 2;

/**
* Encoder of time column, TsFile supports TS_2DIFF, PLAIN and RLE(run-length encoding) Default
* value is TS_2DIFF.
*/
private String timeEncoding = "TS_2DIFF";

/**
* Encoder of value series. default value is PLAIN. For int, long data type, TsFile also supports
* TS_2DIFF, REGULAR, GORILLA and RLE(run-length encoding). For float, double data type, TsFile
* also supports TS_2DIFF, RLE(run-length encoding) and GORILLA. For text data type, TsFile only
* supports PLAIN.
*/
private String valueEncoder = "PLAIN";

/** Default bit width of RLE encoding is 8. */
private int rleBitWidth = 8;

/** Default block size of two-diff. delta encoding is 128. */
private int deltaBlockSize = 128;

/** Default frequency type is SINGLE_FREQ. */
private String freqType = "SINGLE_FREQ";

/** Default PLA max error is 100. */
private double plaMaxError = 100;

/** Default SDT max error is 100. */
private double sdtMaxError = 100;

/** Default DFT satisfy rate is 0.1 */
private double dftSatisfyRate = 0.1;

/** Data compression method, TsFile supports UNCOMPRESSED, SNAPPY, ZSTD or LZ4. */
private CompressionType compressor = CompressionType.LZ4;

/** Line count threshold for checking page memory occupied size. */
private int pageCheckSizeThreshold = 100;

/** Default endian value is BIG_ENDIAN. */
private String endian = "BIG_ENDIAN";

/** Default storage is in local file system. */
private FSType[] tSFileStorageFs = new FSType[] {FSType.LOCAL};

/** Default core-site.xml file path is /etc/hadoop/conf/core-site.xml */
private String coreSitePath = "/etc/hadoop/conf/core-site.xml";

/** Default hdfs-site.xml file path is /etc/hadoop/conf/hdfs-site.xml */
private String hdfsSitePath = "/etc/hadoop/conf/hdfs-site.xml";

/** Default hdfs ip is localhost. */
private String hdfsIp = "localhost";

/** Default hdfs port is 9000. */
private String hdfsPort = "9000";

/** Default DFS NameServices is hdfsnamespace. */
private String dfsNameServices = "hdfsnamespace.";

/** Default DFS HA name nodes are nn1 and nn2. */
private String dfsHaNamenodes = "nn1,nn2";

/** Default DFS HA automatic failover is enabled. */
private boolean dfsHaAutomaticFailoverEnabled = true;

/**
* Default DFS client failover proxy provider is
* "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider"
*/
private String dfsClientFailoverProxyProvider =
"org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider";

/** whether use kerberos to authenticate hdfs. */
private boolean useKerberos = false;

/** full path of kerberos keytab file. */
private String kerberosKeytabFilePath = "/path";

/** kerberos pricipal. */
private String kerberosPrincipal = "principal";

/** The acceptable error rate of bloom filter. */
private double bloomFilterErrorRate = 0.05;

/** The amount of data iterate each time. */
private int batchSize = 1000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ public byte[] compress(byte[] data, int offset, int length) throws IOException {
return GZIPCompress.compress(dataBefore);
}

/** @exception GZIPCompressOverflowException if compressed byte array is too small. */
/**
* @exception GZIPCompressOverflowException if compressed byte array is too small.
*/
@Override
public int compress(byte[] data, int offset, int length, byte[] compressed) throws IOException {
byte[] dataBefore = new byte[length];
Expand All @@ -304,7 +306,9 @@ public int compress(byte[] data, int offset, int length, byte[] compressed) thro
return res.length;
}

/** @exception GZIPCompressOverflowException if compressed ByteBuffer is too small. */
/**
* @exception GZIPCompressOverflowException if compressed ByteBuffer is too small.
*/
@Override
public int compress(ByteBuffer data, ByteBuffer compressed) throws IOException {
int length = data.remaining();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class IntPacker {
*/
/** Number of Integers for each pack operation. */
private static final int NUM_OF_INTS = 8;

/** bit-width. */
private int width;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class LongPacker {
*/
/** Number of Long values for each pack operation. */
private static final int NUM_OF_LONGS = 8;

/** bit-width. */
private int width;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ public abstract class DeltaBinaryDecoder extends Decoder {
protected int readIntTotalCount = 0;

protected int nextReadIndex = 0;

/** max bit length of all value in a pack. */
protected int packWidth;

/** data number in this pack. */
protected int packNum;

Expand Down Expand Up @@ -81,6 +83,7 @@ public static class IntDeltaDecoder extends DeltaBinaryDecoder {
private int firstValue;
private int[] data;
private int previous;

/** minimum value for all difference. */
private int minDeltaBase;

Expand Down Expand Up @@ -165,6 +168,7 @@ public static class LongDeltaDecoder extends DeltaBinaryDecoder {
private long firstValue;
private long[] data;
private long previous;

/** minimum value for all difference. */
private long minDeltaBase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public abstract class RegularDataDecoder extends Decoder {
protected int readIntTotalCount = 0;

protected int nextReadIndex = 0;

/** data number in this pack. */
protected int packNum;

Expand All @@ -66,6 +67,7 @@ public static class IntRegularDecoder extends RegularDataDecoder {
private boolean isMissingPoint;
private BitSet bitmap;
private int bitmapIndex;

/** minimum value for all difference. */
private int minDeltaBase;

Expand Down Expand Up @@ -177,6 +179,7 @@ public static class LongRegularDecoder extends RegularDataDecoder {
private boolean isMissingPoint;
private BitSet bitmap;
private int bitmapIndex;

/** minimum value for all difference. */
private long minDeltaBase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,30 @@
public abstract class RleDecoder extends Decoder {

protected TSFileConfig config = TSFileDescriptor.getInstance().getConfig();

/** mode to indicate current encoding type 0 - RLE 1 - BIT_PACKED. */
protected Mode mode;

/** bit width for bit-packing and rle to decode. */
protected int bitWidth;

/** number of data left for reading in current buffer. */
protected int currentCount;

/**
* how many bytes for all encoded data like [{@code <bitwidth> <encoded-data>}] in inputstream.
*/
protected int length;

/**
* a flag to indicate whether current pattern is end. false - need to start reading a new page
* true - current page isn't over.
*/
protected boolean isLengthAndBitWidthReaded;

/** buffer to save data format like [{@code <bitwidth> <encoded-data>}] for decoder. */
protected ByteBuffer byteCache;

/** number of bit-packing group in which is saved in header. */
protected int bitPackingNum;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public interface ITimeSeriesMetadata extends IMetadata {

void setChunkMetadataLoader(IChunkMetadataLoader chunkMetadataLoader);

/** @return true if data type is matched, otherwise false */
/**
* @return true if data type is matched, otherwise false
*/
boolean typeMatch(List<TSDataType> dataTypes);
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
public abstract class Statistics<T extends Serializable> {

private static final Logger LOG = LoggerFactory.getLogger(Statistics.class);

/**
* isEmpty being false means this statistic has been initialized and the max and min is not null.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class RowRecord {

private long timestamp;
private final List<Field> fields;

/** if any column is null, this field should be set to true; otherwise false */
private boolean hasNullField = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ public boolean hasNext() {
return rowIndex < positionCount;
}

/** @return A row in the TsBlock. The timestamp is at the last column. */
/**
* @return A row in the TsBlock. The timestamp is at the last column.
*/
@Override
public Object[] next() {
if (!hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ default double getDouble(Column c, int position) {
default Binary getBinary(Column c, int position) {
throw new UnsupportedOperationException(getClass().getName());
}

/** Gets a Object at {@code position}. */
default Object getObject(Column c, int position) {
return c.getObject(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ private void uncompressDataIfNecessary() throws IOException {
}
}

/** @return the returned BatchData may be empty, but never be null */
/**
* @return the returned BatchData may be empty, but never be null
*/
@SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
@Override
public BatchData getAllSatisfiedPageData(boolean ascending) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public class StringContainer {
private StringBuilder stringBuilder;
private ArrayList<String> sequenceList;
private ArrayList<String> reverseList;

/** the summation length of all string segments. */
private int totalLength = 0;

/** the count of string segments. */
private int count = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public class TsFileWriter implements AutoCloseable {

protected static final TSFileConfig config = TSFileDescriptor.getInstance().getConfig();
private static final Logger LOG = LoggerFactory.getLogger(TsFileWriter.class);

/** schema of this TsFile. */
protected final Schema schema;

/** IO writer of this TsFile. */
private final TsFileIOWriter fileWriter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class ChunkWriterImpl implements IChunkWriter {

/** SDT parameters */
private boolean isSdtEncoding;

// When the ChunkWriter WILL write the last data point in the chunk, set it to true to tell SDT
// saves the point.
private boolean isLastPoint;
Expand All @@ -92,7 +93,9 @@ public class ChunkWriterImpl implements IChunkWriter {

private Statistics<?> firstPageStatistics;

/** @param schema schema of this measurement */
/**
* @param schema schema of this measurement
*/
public ChunkWriterImpl(IMeasurementSchema schema) {
this.measurementSchema = schema;
this.compressor = ICompressor.getCompressor(schema.getCompressor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public class TSRecord {

/** timestamp of this TSRecord. */
public long time;

/** deviceId of this TSRecord. */
public String deviceId;

/** all value of this TSRecord. */
public List<DataPoint> dataPointList = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ public class Tablet {

/** Timestamps in this {@link Tablet} */
public long[] timestamps;

/** Each object is a primitive type array, which represents values of one measurement */
public Object[] values;

/** Each {@link BitMap} represents the existence of each value in the current column. */
public BitMap[] bitMaps;

/** The number of rows to include in this {@link Tablet} */
public int rowSize;

/** The maximum number of rows for this {@link Tablet} */
private final int maxRowNumber;

Expand Down Expand Up @@ -326,7 +330,9 @@ public int getTimeBytesSize() {
return rowSize * 8;
}

/** @return Total bytes of values */
/**
* @return Total bytes of values
*/
public int getTotalValueOccupation() {
int valueOccupation = 0;
int columnIndex = 0;
Expand Down
Loading

0 comments on commit 22fa427

Please sign in to comment.