Skip to content

Commit 830f53a

Browse files
authored
Apache Arrow upgrade (#17)
* upgrade apache arrow to 9.0.0 * testing with multiple jdk versions * changelog updates
1 parent 4e2973b commit 830f53a

File tree

11 files changed

+56
-15
lines changed

11 files changed

+56
-15
lines changed

.github/workflows/maven-build.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111

12+
strategy:
13+
matrix:
14+
java-version: [ 11, 17, 18 ]
15+
1216
steps:
1317
- uses: actions/checkout@v2
14-
- name: Set up JDK 11
18+
- name: Set up JDK
1519
uses: actions/setup-java@v2
1620
with:
17-
java-version: '11'
21+
java-version: ${{ matrix.java-version }}
1822
distribution: 'adopt'
1923
- name: Build with Maven
2024
env:
2125
CLIENT_ID: ${{ secrets.CLIENT_ID }}
2226
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
2327
CLIENT_CREDENTIALS_URL: ${{ secrets.CLIENT_CREDENTIALS_URL }}
24-
run: mvn clean install
28+
run: |
29+
export JAVA_TOOL_OPTIONS="--add-opens=java.base/java.nio=ALL-UNNAMED"
30+
mvn clean install

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v0.4.1-alpha
4+
* Adding support to new java versions.
5+
* Upgrading `apache arrow` version to `9.0.0`.
6+
* Fix protobuf metadata integration test.
7+
* Run integration tests using jdks 11, 17 & 18.
8+
* Fix memory leak issue
9+
* If seeing errors like module java.base does not "opens java.nio" to unnamed module
10+
please make sure to run java with `--add-opens=java.base/java.nio=ALL-UNNAMED` argument
11+
or set JAVA_TOOL_OPTIONS environment variable
12+
```shell
13+
export JAVA_TOOL_OPTIONS="--add-opens=java.base/java.nio=ALL-UNNAMED"
14+
```
315
## v0.4.0-alpha
416
* Renamed:
517
- `execute` to `executeV1`.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Note that `mvn install` is required to build and run the examples.
5757

5858
mvn clean
5959

60+
**If facing errors like ` module java.base does not "opens java.nio" to unnamed module`**
61+
62+
export JAVA_TOOL_OPTIONS="--add-opens=java.base/java.nio=ALL-UNNAMED"
63+
6064
### Create a configuration file
6165

6266
In order to run the examples you will need to create an SDK config file.
@@ -86,7 +90,7 @@ In order to use the `rai-sdk-java`, you need add this dependency to your project
8690
<dependency>
8791
<groupId>com.relationalai</groupId>
8892
<artifactId>rai-sdk</artifactId>
89-
<version>0.4.0-alpha</version>
93+
<version>0.4.1-alpha</version>
9094
</dependency>
9195

9296
You need also to point maven to the SDK GitHub packages repository in the project's POM:

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<description>The RelationalAI Software Development Kit (SDK) for Java</description>
2222
<groupId>com.relationalai</groupId>
2323
<artifactId>rai-sdk-pom</artifactId>
24-
<version>0.4.0-alpha</version>
24+
<version>0.4.1-alpha</version>
2525
<packaging>pom</packaging>
2626
<url></url>
2727

@@ -37,7 +37,7 @@
3737
<maven.compiler.source>11</maven.compiler.source>
3838
<maven.compiler.target>11</maven.compiler.target>
3939
<jsoniter.version>0.9.19</jsoniter.version>
40-
<apache.arrow.version>7.0.0</apache.arrow.version>
40+
<apache.arrow.version>9.0.0</apache.arrow.version>
4141
<protobuf.version>3.21.1</protobuf.version>
4242
<protobuf-java-format.version>1.4</protobuf-java-format.version>
4343
</properties>

rai-sdk-examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<groupId>com.relationalai</groupId>
2222
<artifactId>rai-sdk-pom</artifactId>
23-
<version>0.4.0-alpha</version>
23+
<version>0.4.1-alpha</version>
2424
</parent>
2525

2626
<name>RelationalAI SDK for Java Examples</name>

rai-sdk-protos/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<groupId>com.relationalai</groupId>
2222
<artifactId>rai-sdk-pom</artifactId>
23-
<version>0.4.0-alpha</version>
23+
<version>0.4.1-alpha</version>
2424
</parent>
2525

2626
<name>RelationalAI SDK Protobuf for Java</name>

rai-sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<groupId>com.relationalai</groupId>
2222
<artifactId>rai-sdk-pom</artifactId>
23-
<version>0.4.0-alpha</version>
23+
<version>0.4.1-alpha</version>
2424
</parent>
2525

2626
<name>RelationalAI SDK for Java Package</name>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.relationalai;
2+
3+
import org.apache.arrow.memory.RootAllocator;
4+
5+
public class ArrowUtils implements AutoCloseable {
6+
private static RootAllocator allocator;
7+
8+
public static RootAllocator getOrCreateRootAllocator() {
9+
if (allocator == null) {
10+
allocator = new RootAllocator(Long.MAX_VALUE);
11+
}
12+
13+
return allocator;
14+
}
15+
16+
@Override
17+
public void close() throws Exception {
18+
allocator.close();
19+
}
20+
}

rai-sdk/src/main/java/com/relationalai/Client.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private List<ArrowRelation> readArrowFiles(List<TransactionAsyncFile> files) thr
286286
if ("application/vnd.apache.arrow.stream".equals(file.contentType.toLowerCase())) {
287287
ByteArrayInputStream in = new ByteArrayInputStream(file.data);
288288
List<FieldVector> fieldVectors = null;
289-
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
289+
RootAllocator allocator = ArrowUtils.getOrCreateRootAllocator();
290290

291291
try(ArrowStreamReader arrowStreamReader = new ArrowStreamReader(in, allocator)){
292292
VectorSchemaRoot root = arrowStreamReader.getVectorSchemaRoot();
@@ -313,7 +313,6 @@ private List<ArrowRelation> readArrowFiles(List<TransactionAsyncFile> files) thr
313313
}
314314
}
315315
}
316-
allocator.close();
317316
}
318317
}
319318
}

rai-sdk/src/test/resources/metadata.pb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
>
33
3
44
"
5-

6-
�output
5+

6+
�output
77

88

99


rai-sdk/src/test/resources/metadata.pb.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ relations {
55
constant_type {
66
rel_type {
77
tag: PRIMITIVE_TYPE
8-
primitive_type: SYMBOL
8+
primitive_type: STRING
99
}
1010
value {
1111
arguments {
12-
tag: SYMBOL
12+
tag: STRING
1313
string_val: "output"
1414
}
1515
}

0 commit comments

Comments
 (0)