Skip to content
Open
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
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,72 @@
under the License.
-->

# Arrow Java
# Siren fork of Arrow Java

The properties `drill.enable_unsafe_memory_access` and
`arrow.enable_unsafe_memory_access` are prefixed with `siren` and their
default value is set to `true`. The first property is deprecated.

## Check that Arrow uses Unsafe class to access off-heap memory for memory allocation
In order to check that Arrow uses Unsafe class for memory allocation, run the unit test `CheckArrowTest` in
`https://github.com/sirensolutions/siren-platform/blob/master/core/src/test/java/io/siren/federate/core/common/CheckArrowTest.java`.

## Build

To build the `memory`, `format`, `vector` and `algorithm` modules:

```sh
$ cd java
$ mvn clean package
```

Because of the default value change of `unsafe_memory_access` property, some
tests in `vector` fail.

```sh
mvn -pl memory,memory/memory-core,memory/memory-unsafe,format,vector,algorithm install -Dsiren.arrow.enable_unsafe_memory_access=false -Dsiren.drill.enable_unsafe_memory_access=false
```

## Make a new release of Siren's Apache Arrow

- Tests should pass.

- Make a new version:

```sh
mvn versions:set -DnewVersion=siren-0.14.1-2
```

- tag the commit for the release

```sh
git tag --sign siren-0.14.1-2
````

- Deploy to Siren's Google Artifact Registry:
```sh
# Deploy all modules (format, memory, vector, algorithm)
$ mvn -pl memory,memory/memory-core,memory/memory-unsafe,format,vector,algorithm deploy \
-Dsiren.arrow.enable_unsafe_memory_access=false \
-Dsiren.drill.enable_unsafe_memory_access=false \
-DskipTests \
-DaltDeploymentRepository=gar-maven-local-siren-snapshot::default::artifactregistry://europe-west1-maven.pkg.dev/siren-cicd/maven-local-siren-snapshot
# Deploy the parent POM
$ mvn deploy:deploy-file \
-Durl=artifactregistry://europe-west1-maven.pkg.dev/siren-cicd/maven-local-siren-snapshot \
-DpomFile=pom.xml -Dfile=pom.xml \
-DgroupId=org.apache.arrow \
-DartifactId=arrow-java-root \
-Dversion=siren-18.3.0-1-SNAPSHOT \
-Dpackaging=pom
```
## Update to a new version of Siren's Apache Arrow
Developer tips on updating to a new version of Arrow can be found here: https://sirensolutions.atlassian.net/wiki/spaces/EN/pages/3108864001/Upgrading+Federate+Apache+Arrow+Version .

- add `git@github.com:apache/arrow-java.git` as the `upstream` remote.
- execute `git fetch --all --tags`
- create a temporary branch from `siren-changes`
- rebase against the new tag.

## Getting Started

Expand Down
14 changes: 3 additions & 11 deletions algorithm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>
<artifactId>arrow-algorithm</artifactId>
<name>Arrow Algorithms</name>
Expand All @@ -32,7 +32,8 @@ under the License.
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-vector</artifactId>
<classifier>${arrow.vector.classifier}</classifier>
<version>${project.version}</version>
<classifier>shade</classifier>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
Expand All @@ -41,15 +42,6 @@ under the License.
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value-annotations</artifactId>
Expand Down
5 changes: 2 additions & 3 deletions algorithm/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

module org.apache.arrow.algorithm {
module arrow.algorithm.siren {
exports org.apache.arrow.algorithm.search;
exports org.apache.arrow.algorithm.deduplicate;
exports org.apache.arrow.algorithm.dictionary;
Expand All @@ -24,6 +24,5 @@
exports org.apache.arrow.algorithm.sort;

requires jdk.unsupported;
requires org.apache.arrow.memory.core;
requires org.apache.arrow.vector;
requires arrow.vector.siren;
}
2 changes: 1 addition & 1 deletion format/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<artifactId>arrow-format</artifactId>
Expand Down
4 changes: 3 additions & 1 deletion gandiva/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<groupId>org.apache.arrow.gandiva</groupId>
Expand All @@ -40,6 +40,7 @@ under the License.
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
Expand All @@ -66,6 +67,7 @@ under the License.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

Expand Down
3 changes: 2 additions & 1 deletion memory/memory-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<artifactId>arrow-memory-core</artifactId>
Expand All @@ -39,6 +39,7 @@ under the License.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class BoundsChecking {
+ " true (to not check) or false (to check, default)");
}
String newProperty = System.getProperty("arrow.enable_unsafe_memory_access");

// The priority of determining the unsafe flag:
// 1. The system properties take precedence over the environmental variable.
// 2. The new system property takes precedence over the new system property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InaccessibleObjectException;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down Expand Up @@ -82,7 +83,6 @@ public Object run() {

// get the offset of the address field in a java.nio.Buffer object
Field addressField = java.nio.Buffer.class.getDeclaredField("address");
addressField.setAccessible(true);
BYTE_BUFFER_ADDRESS_OFFSET = UNSAFE.objectFieldOffset(addressField);

Constructor<?> directBufferConstructor;
Expand All @@ -109,6 +109,9 @@ public Object run() {
} catch (SecurityException e) {
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
} catch (InaccessibleObjectException e) {
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.arrow.memory;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.lang.reflect.Field;
import java.net.URLClassLoader;
Expand Down Expand Up @@ -55,15 +54,15 @@ private boolean getFlagValue(ClassLoader classLoader) throws Exception {
}

/**
* Ensure the flag for bounds checking is enabled by default. This will protect users from JVM
* crashes.
* Siren: Ensure the flag for bounds checking is disabled by default. Enabling it will protect
* users from JVM crashes.
*/
@Test
public void testDefaultValue() throws Exception {
ClassLoader classLoader = copyClassLoader();
if (classLoader != null) {
boolean boundsCheckingEnabled = getFlagValue(classLoader);
assertTrue(boundsCheckingEnabled);
assertFalse(boundsCheckingEnabled);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class TestOpens {
/** Instantiating the RootAllocator should poke MemoryUtil and fail. */
@Test
@EnabledForJreRange(min = JAVA_16)
@EnabledForJreRange(max = JAVA_16)
public void testMemoryUtilFailsLoudly() {
// This test is configured by Maven to run WITHOUT add-opens. So this should fail on JDK16+
// (where JEP396 means that add-opens is required to access JDK internals).
Expand Down
3 changes: 2 additions & 1 deletion memory/memory-netty-buffer-patch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<artifactId>arrow-memory-netty-buffer-patch</artifactId>
Expand All @@ -33,6 +33,7 @@ under the License.
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
Expand Down
3 changes: 2 additions & 1 deletion memory/memory-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<artifactId>arrow-memory-netty</artifactId>
Expand All @@ -33,6 +33,7 @@ under the License.
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
Expand Down
3 changes: 2 additions & 1 deletion memory/memory-unsafe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>

<artifactId>arrow-memory-unsafe</artifactId>
Expand All @@ -33,6 +33,7 @@ under the License.
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
Expand Down
2 changes: 1 addition & 1 deletion memory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ under the License.
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>18.3.0</version>
<version>siren-18.3.0-1-SNAPSHOT</version>
</parent>
<artifactId>arrow-memory</artifactId>
<packaging>pom</packaging>
Expand Down
Loading