Skip to content

Commit 37cec8b

Browse files
remove unnecessary dependency to TileDB-Java
1 parent b38f228 commit 37cec8b

File tree

6 files changed

+45
-21
lines changed

6 files changed

+45
-21
lines changed

build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,10 @@ dependencies {
158158
implementation group: 'org.apache.arrow', name: 'arrow-vector', version: '9.0.0'
159159
implementation group: 'org.apache.arrow', name: 'arrow-compression', version: '9.0.0'
160160
implementation group: 'org.apache.arrow', name: 'arrow-memory-unsafe', version: '9.0.0'
161-
implementation 'io.tiledb:tiledb-java:0.17.2'
162161
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
163162
testImplementation 'org.mockito:mockito-core:3.12.4'
164163
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
165164
testImplementation 'junit:junit:4.13.1'
166-
167165
}
168166

169167
import org.gradle.plugins.signing.Sign
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package io.tiledb.cloud;
2+
3+
public class Pair<F, S> implements java.io.Serializable {
4+
private F first;
5+
private S second;
6+
7+
private Pair() {}
8+
9+
public Pair(F first, S second) {
10+
this.first = first;
11+
this.second = second;
12+
}
13+
14+
public F getFirst() {
15+
return first;
16+
}
17+
18+
public void setFirst(F first) {
19+
this.first = first;
20+
}
21+
22+
public S getSecond() {
23+
return second;
24+
}
25+
26+
public void setSecond(S second) {
27+
this.second = second;
28+
}
29+
30+
/**
31+
* Returns an empty Pair
32+
*
33+
* @return The Pair
34+
*/
35+
public static Pair empty() {
36+
return new Pair();
37+
}
38+
}
39+

src/main/java/io/tiledb/cloud/TileDBLogin.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package io.tiledb.cloud;
22

3-
import java.util.Objects;
4-
53
public class TileDBLogin {
64
/** The client password */
75
private String password;

src/main/java/io/tiledb/cloud/TileDBSQL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public TileDBSQL(TileDBClient tileDBClient, String namespace, SQLParameters sql)
5454
* @return A pair that consists of an ArrayList of all valueVectors and the
5555
* number of batches read.
5656
*/
57-
public io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> execArrow(){
57+
public Pair<ArrayList<ValueVector>, Integer> execArrow(){
5858
try {
5959
assert sql.getResultFormat() != null;
6060
byte[] bytes = apiInstance.runSQLBytes(namespace, sql, "none");
@@ -81,7 +81,7 @@ public io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> execArrow(){
8181
}
8282
}
8383
reader.close();
84-
return new io.tiledb.java.api.Pair<>(valueVectors, readBatchesCount);
84+
return new Pair<>(valueVectors, readBatchesCount);
8585

8686
} catch (IOException | ApiException e) {
8787
throw new RuntimeException(e);

src/main/java/io/tiledb/cloud/TileDBUDF.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11
package io.tiledb.cloud;
22

3-
import com.google.gson.Gson;
43
import io.tiledb.cloud.rest_api.ApiException;
54
import io.tiledb.cloud.rest_api.api.UdfApi;
65
import io.tiledb.cloud.rest_api.model.*;
7-
import io.tiledb.java.api.Pair;
8-
import org.apache.arrow.compression.CommonsCompressionFactory;
9-
import org.apache.arrow.memory.RootAllocator;
10-
import org.apache.arrow.memory.UnsafeAllocationManager;
11-
import org.apache.arrow.vector.FieldVector;
126
import org.apache.arrow.vector.ValueVector;
13-
import org.apache.arrow.vector.VectorSchemaRoot;
14-
import org.apache.arrow.vector.ipc.ArrowStreamReader;
15-
import org.apache.arrow.vector.util.TransferPair;
167
import org.json.JSONArray;
178
import org.json.JSONObject;
189

19-
import java.io.ByteArrayInputStream;
2010
import java.io.IOException;
2111
import java.util.ArrayList;
22-
import java.util.Arrays;
2312
import java.util.HashMap;
2413
import java.util.List;
2514

@@ -134,7 +123,7 @@ public JSONArray executeGenericJSONArray(GenericUDF genericUDF){
134123
* @param arguments The UDF arguments
135124
* @return A pair that consists of an ArrayList of all valueVectors and the number of batches read.
136125
*/
137-
public io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> executeGenericArrow(GenericUDF genericUDF,
126+
public Pair<ArrayList<ValueVector>, Integer> executeGenericArrow(GenericUDF genericUDF,
138127
HashMap<String, Object> arguments){
139128
String serializedArgs = serializeArgs(arguments);
140129
genericUDF.setArgument(serializedArgs);
@@ -154,7 +143,7 @@ public io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> executeGenericAr
154143
* @param genericUDF The generic UDF definition
155144
* @return A pair that consists of an ArrayList of all valueVectors and the number of batches read.
156145
*/
157-
public io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> executeGenericArrow(GenericUDF genericUDF){
146+
public Pair<ArrayList<ValueVector>, Integer> executeGenericArrow(GenericUDF genericUDF){
158147
genericUDF.setResultFormat(ResultFormat.ARROW);
159148
try {
160149
byte[] bytes = apiInstance.submitGenericUDFBytes(namespace, genericUDF, "none");

src/main/java/io/tiledb/cloud/TileDBUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static String serializeArgs(HashMap<String, Object> arguments) {
3636
* @return A pair that consists of an ArrayList of all valueVectors and the number of batches read.
3737
* @throws IOException
3838
*/
39-
protected static io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> createValueVectors(byte[] bytes) throws IOException {
39+
protected static Pair<ArrayList<ValueVector>, Integer> createValueVectors(byte[] bytes) throws IOException {
4040
ArrayList<ValueVector> valueVectors = null;
4141
int readBatchesCount = 0;
4242

@@ -59,6 +59,6 @@ protected static io.tiledb.java.api.Pair<ArrayList<ValueVector>, Integer> create
5959
}
6060
}
6161
reader.close();
62-
return new io.tiledb.java.api.Pair<>(valueVectors, readBatchesCount);
62+
return new Pair<>(valueVectors, readBatchesCount);
6363
}
6464
}

0 commit comments

Comments
 (0)