• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

adapter/H01-Jun-2020-16,32210,865

algorithm/H01-Jun-2020-7,3064,320

dev/checkstyle/H01-Jun-2020-339256

flight/H01-Jun-2020-13,1868,380

format/H01-Jun-2020-167148

gandiva/H03-May-2022-7,1644,721

memory/H01-Jun-2020-12,9136,984

performance/H01-Jun-2020-2,9631,890

plasma/H01-Jun-2020-934504

tools/H01-Jun-2020-1,5581,116

vector/H01-Jun-2020-66,44741,296

README.mdH A D01-Jun-20205.6 KiB13081

api-changes.mdH A D01-Jun-20202 KiB3310

pom.xmlH A D01-Jun-202026 KiB746691

README.md

1<!---
2  Licensed to the Apache Software Foundation (ASF) under one
3  or more contributor license agreements.  See the NOTICE file
4  distributed with this work for additional information
5  regarding copyright ownership.  The ASF licenses this file
6  to you under the Apache License, Version 2.0 (the
7  "License"); you may not use this file except in compliance
8  with the License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing,
13  software distributed under the License is distributed on an
14  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  KIND, either express or implied.  See the License for the
16  specific language governing permissions and limitations
17  under the License.
18-->
19
20# Arrow Java
21
22## Getting Started
23
24The following guides explain the fundamental data structures used in the Java implementation of Apache Arrow.
25
26- [ValueVector](https://arrow.apache.org/docs/java/vector.html) is an abstraction that is used to store a sequence of values having the same type in an individual column.
27- [VectorSchemaRoot](https://arrow.apache.org/docs/java/vector_schema_root.html) is a container that can hold multiple vectors based on a schema.
28- The [Reading/Writing IPC formats](https://arrow.apache.org/docs/java/ipc.html) guide explains how to stream record batches as well as serializing record batches to files.
29
30Generated javadoc documentation is available [here](https://arrow.apache.org/docs/java/).
31
32## Setup Build Environment
33
34install:
35 - Java 8 or later
36 - Maven 3.3 or later
37
38## Building and running tests
39
40```
41git submodule update --init --recursive # Needed for flight
42cd java
43mvn install
44```
45## Building and running tests for arrow jni modules like gandiva and orc (optional)
46
47[Arrow Cpp][2] must be built before this step. The cpp build directory must
48be provided as the value for argument arrow.cpp.build.dir. eg.
49
50```
51cd java
52mvn install -P arrow-jni -am -Darrow.cpp.build.dir=../../release
53```
54
55The gandiva library is still in Alpha stages, and subject to API changes without
56deprecation warnings.
57
58## Flatbuffers dependency
59
60Arrow uses Google's Flatbuffers to transport metadata.  The java version of the library
61requires the generated flatbuffer classes can only be used with the same version that
62generated them.  Arrow packages a version of the arrow-vector module that shades flatbuffers
63and arrow-format into a single JAR.  Using the classifier "shade-format-flatbuffers" in your
64pom.xml will make use of this JAR, you can then exclude/resolve the original dependency to
65a version of your choosing.
66
67## Performance Tuning
68
69There are several system/environmental variables that users can configure.  These trade off safety (they turn off checking) for speed.  Typically they are only used in production settings after the code has been thoroughly tested without using them.
70
71* Bounds Checking for memory accesses: Bounds checking is on by default.  You can disable it by setting either the
72system property("arrow.enable_unsafe_memory_access") or the environmental variable
73("ARROW_ENABLE_UNSAFE_MEMORY_ACCESS") to "true". When both the system property and the environmental
74variable are set, the system property takes precedence.
75
76* null checking for gets: ValueVector get methods (not getObject) methods by default verify the slot is not null.  You can disable it by setting either the
77system property("arrow.enable_null_check_for_get") or the environmental variable
78("ARROW_ENABLE_NULL_CHECK_FOR_GET") to "false". When both the system property and the environmental
79variable are set, the system property takes precedence.
80
81## Java Properties
82
83For java 9 or later, should set "-Dio.netty.tryReflectionSetAccessible=true".
84This fixes `java.lang.UnsupportedOperationException: sun.misc.Unsafe or java.nio.DirectByteBuffer.(long, int) not available`. thrown by netty.
85## Java Code Style Guide
86
87Arrow Java follows the Google style guide [here][3] with the following
88differences:
89
90* Imports are grouped, from top to bottom, in this order: static imports,
91standard Java, org.\*, com.\*
92* Line length can be up to 120 characters
93* Operators for line wrapping are at end-of-line
94* Naming rules for methods, parameters, etc. have been relaxed
95* Disabled `NoFinalizer`, `OverloadMethodsDeclarationOrder`, and
96`VariableDeclarationUsageDistance` due to the existing code base. These rules
97should be followed when possible.
98
99Refer to `java/dev/checkstyle/checkstyle.xml for rule specifics.
100
101## Test Logging Configuration
102
103When running tests, Arrow Java uses the Logback logger with SLF4J. By default,
104it uses the logback.xml present in the corresponding module's src/test/resources
105directory, which has the default log level set to INFO.
106Arrow Java can be built with an alternate logback configuration file using the
107following command run in the project root directory:
108
109```bash
110mvn -Dlogback.configurationFile=file:<path-of-logback-file>
111```
112
113See [Logback Configuration][1] for more details.
114
115## Integration Tests
116
117Integration tests which require more time or more memory can be run by activating
118the `integration-tests` profile. This activates the [maven failsafe][4] plugin
119and any class prefixed with `IT` will be run during the testing phase. The integration
120tests currently require a larger amount of memory (>4GB) and time to complete. To activate
121the profile:
122
123```bash
124mvn -Pintegration-tests <rest of mvn arguments>
125```
126
127[1]: https://logback.qos.ch/manual/configuration.html
128[2]: https://github.com/apache/arrow/blob/master/cpp/README.md
129[3]: http://google.github.io/styleguide/javaguide.html
130[4]: https://maven.apache.org/surefire/maven-failsafe-plugin/