Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/.mvn/.develocity/
/.mvn/wrapper/maven-wrapper.jar
**/target/**
!java/tsfile/target/generated-sources/antlr4
!java/tsfile/target/generated-sources/freemarker
/java/tsfile/test.tsfile


Expand Down
42 changes: 42 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,45 @@ The following files include code is copied from lzokay project.
Copyright: (c) 2018 Jack Andersen
Project page: https://github.com/AxioDL/lzokay
License: https://github.com/AxioDL/lzokay/blob/master/LICENSE

--------------------------------------------------------------------------------

The following files include code modified from Apache Commons Lang project.

./java/tsfile/src/main/java/org/apache/tsfile/external/commons/lang3/*

Apache Commons Lang is open source software licensed under the Apache License 2.0 and supported by the Apache Software Foundation.
Project page: https://github.com/apache/commons-lang
License: https://github.com/apache/commons-lang/blob/master/LICENSE.txt

--------------------------------------------------------------------------------

The following files include code modified from Apache Commons IO project.

./java/tsfile/src/main/java/org/apache/tsfile/external/commons/io/*

Apache Commons IO is open source software licensed under the Apache License 2.0 and supported by the Apache Software Foundation.
Project page: https://github.com/apache/commons-io
License: https://github.com/apache/commons-io/blob/master/LICENSE.txt

--------------------------------------------------------------------------------

The following files include code modified from Apache Commons CodeC project.

./java/tsfile/src/main/java/org/apache/tsfile/external/commons/codec/*

Apache Commons CodeC is open source software licensed under the Apache License 2.0 and supported by the Apache Software Foundation.
Project page: https://github.com/apache/commons-codec
License: https://github.com/apache/commons-codec/blob/master/LICENSE.txt

--------------------------------------------------------------------------------

The following files include code modified from Apache Commons Collections project.

./java/tsfile/src/main/java/org/apache/tsfile/external/commons/collections4/*

Apache Commons Collections is open source software licensed under the Apache License 2.0 and supported by the Apache Software Foundation.
Project page: https://github.com/apache/commons-collections
License: https://github.com/apache/commons-collections/blob/master/LICENSE.txt

--------------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion cpp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-parent</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>tsfile-cpp</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion java/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-java</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<name>TsFile: Java: Common</name>
Expand Down
4 changes: 2 additions & 2 deletions java/examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-java</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>examples</artifactId>
<name>TsFile: Java: Examples</name>
Expand All @@ -36,7 +36,7 @@
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
14 changes: 2 additions & 12 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-parent</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>tsfile-java</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
<packaging>pom</packaging>
<name>TsFile: Java</name>
<modules>
Expand All @@ -48,16 +48,6 @@
<artifactId>snappy-java</artifactId>
<version>1.1.10.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.18.0</version>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
Expand Down
14 changes: 3 additions & 11 deletions java/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,25 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-java</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>tools</artifactId>
<name>TsFile: Java: Tools</name>
<dependencies>
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>common</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.tsfile.tools;

import org.apache.tsfile.enums.ColumnCategory;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.external.commons.io.FilenameUtils;
import org.apache.tsfile.file.metadata.TableSchema;
import org.apache.tsfile.file.metadata.enums.CompressionType;
import org.apache.tsfile.file.metadata.enums.TSEncoding;
Expand All @@ -35,8 +37,6 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -55,6 +55,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -318,7 +319,7 @@ private static void cpFile(String sourceFilePath, String targetDirectoryPath) {

public static void writeToNewCSV(
String headerLine, String fileAbsolutePath, List<String> data, String newFileName) {
if (schema.hasHeader && StringUtils.isNotEmpty(headerLine)) {
if (schema.hasHeader && Objects.nonNull(headerLine) && !headerLine.isEmpty()) {
data.add(0, headerLine);
}
String inputFileAbsolutePath = new File(inputDirectoryStr).getAbsolutePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

package org.apache.tsfile.tools;

import org.apache.tsfile.external.commons.io.FileUtils;
import org.apache.tsfile.read.TsFileSequenceReader;
import org.apache.tsfile.read.common.block.TsBlock;
import org.apache.tsfile.read.controller.CachedChunkLoaderImpl;
import org.apache.tsfile.read.controller.MetadataQuerierByFileImpl;
import org.apache.tsfile.read.query.executor.TableQueryExecutor;
import org.apache.tsfile.read.reader.block.TsBlockReader;

import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down
12 changes: 2 additions & 10 deletions java/tsfile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.tsfile</groupId>
<artifactId>tsfile-java</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</parent>
<artifactId>tsfile</artifactId>
<name>TsFile: Java: TsFile</name>
Expand All @@ -38,7 +38,7 @@
<dependency>
<groupId>org.apache.tsfile</groupId>
<artifactId>common</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>2.2.0-251010-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
Expand All @@ -48,14 +48,6 @@
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.tsfile.external.commons.codec.binary;

/////////////////////////////////////////////////////////////////////////////////////////////////
// IoTDB
/////////////////////////////////////////////////////////////////////////////////////////////////

public class Hex {

/** Used to build output as hex. */
private static final char[] DIGITS_LOWER = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};

/** Used to build output as hex. */
private static final char[] DIGITS_UPPER = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};

/**
* Converts an array of bytes into a String representing the hexadecimal values of each byte in
* order. The returned String will be double the length of the passed array, as it takes two
* characters to represent any given byte.
*
* @param data a byte[] to convert to hexadecimal characters
* @return A String containing lower-case hexadecimal characters
* @since 1.4
*/
public static String encodeHexString(final byte[] data) {
return new String(encodeHex(data));
}

/**
* Converts an array of bytes into an array of characters representing the hexadecimal values of
* each byte in order. The returned array will be double the length of the passed array, as it
* takes two characters to represent any given byte.
*
* @param data a byte[] to convert to hexadecimal characters
* @return A char[] containing lower-case hexadecimal characters
*/
public static char[] encodeHex(final byte[] data) {
return encodeHex(data, true);
}

/**
* Converts an array of bytes into an array of characters representing the hexadecimal values of
* each byte in order. The returned array will be double the length of the passed array, as it
* takes two characters to represent any given byte.
*
* @param data a byte[] to convert to Hex characters
* @param toLowerCase {@code true} converts to lowercase, {@code false} to uppercase
* @return A char[] containing hexadecimal characters in the selected case
* @since 1.4
*/
public static char[] encodeHex(final byte[] data, final boolean toLowerCase) {
return encodeHex(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER);
}

/**
* Converts an array of bytes into an array of characters representing the hexadecimal values of
* each byte in order. The returned array will be double the length of the passed array, as it
* takes two characters to represent any given byte.
*
* @param data a byte[] to convert to hexadecimal characters
* @param toDigits the output alphabet (must contain at least 16 chars)
* @return A char[] containing the appropriate characters from the alphabet For best results, this
* should be either upper- or lower-case hex.
* @since 1.4
*/
protected static char[] encodeHex(final byte[] data, final char[] toDigits) {
final int dataLength = data.length;
final char[] out = new char[dataLength << 1];
encodeHex(data, 0, dataLength, toDigits, out, 0);
return out;
}

/**
* Converts an array of bytes into an array of characters representing the hexadecimal values of
* each byte in order.
*
* @param data a byte[] to convert to hexadecimal characters
* @param dataOffset the position in {@code data} to start encoding from
* @param dataLen the number of bytes from {@code dataOffset} to encode
* @param toDigits the output alphabet (must contain at least 16 chars)
* @param out a char[] which will hold the resultant appropriate characters from the alphabet.
* @param outOffset the position within {@code out} at which to start writing the encoded
* characters.
*/
private static void encodeHex(
final byte[] data,
final int dataOffset,
final int dataLen,
final char[] toDigits,
final char[] out,
final int outOffset) {
// two characters form the hex value.
for (int i = dataOffset, j = outOffset; i < dataOffset + dataLen; i++) {
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
out[j++] = toDigits[0x0F & data[i]];
}
}
}
Loading
Loading