You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/04/18 09:17:49 UTC
[iotdb] branch junit14 created (now 6ab99ffe99)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a change to branch junit14
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 6ab99ffe99 copy the code from eclipse collection
This branch includes the following new commits:
new 5f7b5f1e42 Junit14
new fb5ef9a7d0 add more
new 6ab99ffe99 copy the code from eclipse collection
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[iotdb] 01/03: Junit14
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch junit14
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 5f7b5f1e42bc856bac5bcc7439c1db83eb0b1eeb
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Apr 18 15:03:13 2022 +0800
Junit14
---
server/pom.xml | 1 +
.../{main => test}/java/org/apache/iotdb/db/utils/EnvironmentUtils.java | 0
.../{main => test}/java/org/apache/iotdb/db/utils/SchemaTestUtils.java | 0
3 files changed, 1 insertion(+)
diff --git a/server/pom.xml b/server/pom.xml
index eab0492825..e6c9c29adf 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -237,6 +237,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
similarity index 100%
rename from server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
rename to server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/SchemaTestUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
similarity index 100%
rename from server/src/main/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
rename to server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
[iotdb] 03/03: copy the code from eclipse collection
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch junit14
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 6ab99ffe990fc9bc79bfbf07c5b7ddae6a723ccd
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Apr 18 17:17:32 2022 +0800
copy the code from eclipse collection
---
LICENSE | 10 ++
tsfile/pom.xml | 5 -
.../iotdb/tsfile/encoding/decoder/FreqDecoder.java | 26 ++--
.../iotdb/tsfile/encoding/encoder/FreqEncoder.java | 26 ++--
.../apache/iotdb/tsfile/utils/BitConstructor.java | 32 ++---
.../apache/iotdb/tsfile/utils/ByteArrayList.java | 135 +++++++++++++++++++++
6 files changed, 192 insertions(+), 42 deletions(-)
diff --git a/LICENSE b/LICENSE
index d84f2bd354..6919175829 100644
--- a/LICENSE
+++ b/LICENSE
@@ -234,3 +234,13 @@ The following files include code modified from Michael Burman's gorilla-tsc proj
Copyright: 2016-2018 Michael Burman and/or other contributors
Project page: https://github.com/burmanm/gorilla-tsc
License: http://www.apache.org/licenses/LICENSE-2.0
+
+--------------------------------------------------------------------------------
+
+The following files include code modified from Eclipse Collections project.
+
+./tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ByteArrayList.java
+
+Copyright: 2021 Goldman Sachs
+Project page: https://www.eclipse.org/collections
+License: https://github.com/eclipse/eclipse-collections/blob/master/LICENSE-EDL-1.0.txt
diff --git a/tsfile/pom.xml b/tsfile/pom.xml
index edb728b8ad..30eb5e75b3 100644
--- a/tsfile/pom.xml
+++ b/tsfile/pom.xml
@@ -59,11 +59,6 @@
<artifactId>JTransforms</artifactId>
<version>3.1</version>
</dependency>
- <dependency>
- <groupId>org.eclipse.collections</groupId>
- <artifactId>eclipse-collections</artifactId>
- <version>10.4.0</version>
- </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FreqDecoder.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FreqDecoder.java
index 3797681738..e4df75cb9d 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FreqDecoder.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/FreqDecoder.java
@@ -1,18 +1,22 @@
/*
- * Copyright 2021 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.iotdb.tsfile.encoding.decoder;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FreqEncoder.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FreqEncoder.java
index 39e5c4e6be..dafa96384d 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FreqEncoder.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/encoder/FreqEncoder.java
@@ -1,18 +1,22 @@
/*
- * Copyright 2021 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.iotdb.tsfile.encoding.encoder;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BitConstructor.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BitConstructor.java
index 444927f6cb..5441c85071 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BitConstructor.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BitConstructor.java
@@ -1,21 +1,23 @@
/*
- * Copyright 2021 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.iotdb.tsfile.utils;
-import org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList;
+package org.apache.iotdb.tsfile.utils;
public class BitConstructor {
@@ -81,8 +83,8 @@ public class BitConstructor {
if (cnt == 0) {
data.addAll(bytes);
} else {
- for (int i = 0; i < bytes.length; i++) {
- add(bytes[i], 8);
+ for (byte aByte : bytes) {
+ add(aByte, 8);
}
}
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ByteArrayList.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ByteArrayList.java
new file mode 100644
index 0000000000..b3ffd4f599
--- /dev/null
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ByteArrayList.java
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+/**
+ * This class includes code modified from Eclipse Collections project.
+ *
+ * <p>Copyright: 2021 Goldman Sachs
+ *
+ * <p>Project page: https://www.eclipse.org/collections/
+ *
+ * <p>License: https://github.com/eclipse/eclipse-collections/blob/master/LICENSE-EDL-1.0.txt
+ */
+package org.apache.iotdb.tsfile.utils;
+
+import java.util.Arrays;
+
+public class ByteArrayList {
+
+ private static final byte[] DEFAULT_SIZED_EMPTY_ARRAY = {};
+ private static final byte[] ZERO_SIZED_ARRAY = {};
+ private static final int MAXIMUM_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+ protected int size;
+ protected transient byte[] items = DEFAULT_SIZED_EMPTY_ARRAY;
+
+ public ByteArrayList() {}
+
+ public ByteArrayList(int initialCapacity) {
+ this.items = initialCapacity == 0 ? ZERO_SIZED_ARRAY : new byte[initialCapacity];
+ }
+
+ private void ensureCapacityForAdd() {
+ if (this.items == DEFAULT_SIZED_EMPTY_ARRAY) {
+ this.items = new byte[10];
+ } else {
+ this.transferItemsToNewArrayWithCapacity(this.sizePlusFiftyPercent(this.size));
+ }
+ }
+
+ private int sizePlusFiftyPercent(int oldSize) {
+ int result = oldSize + (oldSize >> 1) + 1;
+ return result < oldSize ? MAXIMUM_ARRAY_SIZE : result;
+ }
+
+ private void transferItemsToNewArrayWithCapacity(int newCapacity) {
+ this.items = this.copyItemsWithNewCapacity(newCapacity);
+ }
+
+ private byte[] copyItemsWithNewCapacity(int newCapacity) {
+ byte[] newItems = new byte[newCapacity];
+ System.arraycopy(this.items, 0, newItems, 0, Math.min(this.size, newCapacity));
+ return newItems;
+ }
+
+ public boolean add(byte newItem) {
+ if (this.items.length == this.size) {
+ this.ensureCapacityForAdd();
+ }
+ this.items[this.size] = newItem;
+ this.size++;
+ return true;
+ }
+
+ public boolean addAll(byte... source) {
+ if (source.length < 1) {
+ return false;
+ }
+ this.copyItems(source.length, source);
+ return true;
+ }
+
+ private void copyItems(int sourceSize, byte[] source) {
+ int newSize = this.size + sourceSize;
+ this.ensureCapacity(newSize);
+ System.arraycopy(source, 0, this.items, this.size, sourceSize);
+ this.size = newSize;
+ }
+
+ public void ensureCapacity(int minCapacity) {
+ int oldCapacity = this.items.length;
+ if (minCapacity > oldCapacity) {
+ int newCapacity = Math.max(this.sizePlusFiftyPercent(oldCapacity), minCapacity);
+ this.transferItemsToNewArrayWithCapacity(newCapacity);
+ }
+ }
+
+ public byte[] toArray() {
+ byte[] newItems = new byte[this.size];
+ System.arraycopy(this.items, 0, newItems, 0, this.size);
+ return newItems;
+ }
+
+ public byte removeAtIndex(int index) {
+ byte previous = this.get(index);
+ int totalOffset = this.size - index - 1;
+ if (totalOffset > 0) {
+ System.arraycopy(this.items, index + 1, this.items, index, totalOffset);
+ }
+ --this.size;
+ this.items[this.size] = (byte) 0;
+ return previous;
+ }
+
+ public byte get(int index) {
+ if (index < this.size) {
+ return this.items[index];
+ }
+ throw new IndexOutOfBoundsException("Index: " + index + " Size: " + this.size);
+ }
+
+ public void clear() {
+ Arrays.fill(this.items, 0, size, (byte) 0);
+ this.size = 0;
+ }
+
+ public int size() {
+ return this.size;
+ }
+}
[iotdb] 02/03: add more
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch junit14
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit fb5ef9a7d0db93fa18086ebdfb9fabc60e07f4bc
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Apr 18 16:25:29 2022 +0800
add more
---
cross-tests/pom.xml | 2 ++
influxdb-protocol/pom.xml | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/cross-tests/pom.xml b/cross-tests/pom.xml
index a25770cace..b040d53215 100644
--- a/cross-tests/pom.xml
+++ b/cross-tests/pom.xml
@@ -56,10 +56,12 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.9.0</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
<build>
diff --git a/influxdb-protocol/pom.xml b/influxdb-protocol/pom.xml
index b7541d235e..82344019d1 100644
--- a/influxdb-protocol/pom.xml
+++ b/influxdb-protocol/pom.xml
@@ -66,7 +66,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>