Skip to content

Commit 6bc537a

Browse files
committed
Spotless
1 parent dd7095a commit 6bc537a

File tree

9 files changed

+85
-64
lines changed

9 files changed

+85
-64
lines changed

java/gandiva/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ under the License.
3838

3939
<dependencies>
4040
<dependency>
41-
<groupId>org.apache.arrow</groupId>
42-
<artifactId>arrow-format</artifactId>
41+
<groupId>org.apache.arrow</groupId>
42+
<artifactId>arrow-format</artifactId>
4343
</dependency>
4444
<dependency>
4545
<groupId>org.apache.arrow</groupId>

java/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.ArrayList;
2222
import java.util.List;
2323
import java.util.Set;
24-
2524
import org.apache.arrow.flatbuf.Type;
2625
import org.apache.arrow.gandiva.exceptions.GandivaException;
2726
import org.apache.arrow.gandiva.ipc.GandivaTypes;
@@ -113,7 +112,8 @@ private static Set<FunctionSignature> getSupportedFunctionsFromGandiva() throws
113112

114113
String functionName = protoFunctionSignature.getName();
115114
ArrowType returnType = getArrowType(protoFunctionSignature.getReturnType());
116-
ArrowType returnListType = getArrowTypeSimple(protoFunctionSignature.getReturnType().getListType());
115+
ArrowType returnListType =
116+
getArrowTypeSimple(protoFunctionSignature.getReturnType().getListType());
117117
List<List<ArrowType>> paramTypes = new ArrayList<List<ArrowType>>();
118118
for (ExtGandivaType type : protoFunctionSignature.getParamTypesList()) {
119119
ArrowType paramType = getArrowType(type);

java/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/FunctionSignature.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.google.common.base.MoreObjects;
2020
import com.google.common.base.Objects;
21-
2221
import java.util.ArrayList;
2322
import java.util.List;
2423
import org.apache.arrow.vector.types.pojo.ArrowType;
@@ -54,7 +53,10 @@ public String getName() {
5453
* @param returnListType optional list type
5554
* @param paramTypes - data type of input args.
5655
*/
57-
public FunctionSignature(String name, ArrowType returnType, ArrowType returnListType,
56+
public FunctionSignature(
57+
String name,
58+
ArrowType returnType,
59+
ArrowType returnListType,
5860
List<List<ArrowType>> paramTypes) {
5961
this.name = name;
6062
this.returnType = returnType;
@@ -64,6 +66,7 @@ public FunctionSignature(String name, ArrowType returnType, ArrowType returnList
6466

6567
/**
6668
* Ctor.
69+
*
6770
* @param name - name of the function.
6871
* @param returnType - data type of return
6972
* @param paramTypes - data type of input args.
@@ -78,7 +81,6 @@ public FunctionSignature(String name, ArrowType returnType, List<ArrowType> para
7881
paramArrowList.add(paramType);
7982
this.paramTypes.add(paramArrowList);
8083
}
81-
8284
}
8385

8486
/**
@@ -102,7 +104,8 @@ public boolean equals(Object signature) {
102104

103105
@Override
104106
public int hashCode() {
105-
return Objects.hashCode(this.name.toLowerCase(), this.returnType, this.returnListType, this.paramTypes);
107+
return Objects.hashCode(
108+
this.name.toLowerCase(), this.returnType, this.returnListType, this.paramTypes);
106109
}
107110

108111
@Override

java/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/JniLoader.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import static java.util.UUID.randomUUID;
2020

21+
import com.sun.jna.Library;
22+
import com.sun.jna.NativeLibrary;
2123
import java.io.File;
2224
import java.io.IOException;
2325
import java.io.InputStream;
@@ -29,15 +31,12 @@
2931
import java.util.concurrent.ConcurrentMap;
3032
import org.apache.arrow.gandiva.exceptions.GandivaException;
3133

32-
import com.sun.jna.Library;
33-
import com.sun.jna.NativeLibrary;
34-
3534
/** This class handles loading of the jni library, and acts as a bridge for the native functions. */
3635
class JniLoader {
3736
private static final String LIBRARY_NAME = "gandiva_jni";
38-
37+
3938
private static final int RTLD_GLOBAL = 0x00100;
40-
private static final int RTLD_LAZY = 0x00001;
39+
private static final int RTLD_LAZY = 0x00001;
4140

4241
private static volatile JniLoader INSTANCE;
4342
private static volatile long defaultConfiguration = 0L;
@@ -78,8 +77,7 @@ private static void loadGandivaLibraryFromJar(final String tmpDir)
7877
final File libraryFile = moveFileFromJarToTemp(tmpDir, libraryToLoad, LIBRARY_NAME);
7978
NativeLibrary.getInstance(
8079
libraryFile.getAbsolutePath(),
81-
Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL))
82-
);
80+
Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL)));
8381
System.load(libraryFile.getAbsolutePath());
8482
}
8583

java/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/ListVectorExpander.java

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
1817
package org.apache.arrow.gandiva.evaluator;
1918

2019
import org.apache.arrow.vector.complex.ListVector;
2120

2221
/**
23-
* This class provides the functionality to expand output ListVectors using a callback mechanism from
24-
* gandiva.
22+
* This class provides the functionality to expand output ListVectors using a callback mechanism
23+
* from gandiva.
2524
*/
2625
public class ListVectorExpander {
2726
private final ListVector[] bufferVectors;
@@ -32,20 +31,18 @@ public ListVectorExpander(ListVector[] bufferVectors) {
3231
this.bufferVectors = bufferVectors;
3332
}
3433

35-
/**
36-
* Result of ListVector expansion.
37-
*/
34+
/** Result of ListVector expansion. */
3835
public static class ExpandResult {
3936
public long address;
4037
public long capacity;
4138
public long validityaddress;
4239

4340
/**
4441
* Result of expanding the buffer.
42+
*
4543
* @param address Data buffer address
4644
* @param capacity Capacity
4745
* @param validAdd Validity buffer address
48-
*
4946
*/
5047
public ExpandResult(long address, long capacity, long validAdd) {
5148
this.address = address;
@@ -55,29 +52,44 @@ public ExpandResult(long address, long capacity, long validAdd) {
5552
}
5653

5754
/**
58-
* Expand vector at specified index. This is used as a back call from jni, and is only
59-
* relevant for ListVectors.
55+
* Expand vector at specified index. This is used as a back call from jni, and is only relevant
56+
* for ListVectors.
6057
*
6158
* @param index index of buffer in the list passed to jni.
6259
* @param toCapacity the size to which the buffer should be expanded to.
63-
*
64-
* @return address and size of the buffer after expansion.
60+
* @return address and size of the buffer after expansion.
6561
*/
6662
public ExpandResult expandOutputVectorAtIndex(int index, long toCapacity) {
6763
if (index >= bufferVectors.length || bufferVectors[index] == null) {
6864
throw new IllegalArgumentException("invalid index " + index);
6965
}
7066

7167
ListVector vector = bufferVectors[index];
72-
while (vector.getDataVector().getFieldBuffers().get(ListVectorExpander.valueBufferIndex).capacity() < toCapacity) {
73-
//Just realloc the data vector.
68+
while (vector
69+
.getDataVector()
70+
.getFieldBuffers()
71+
.get(ListVectorExpander.valueBufferIndex)
72+
.capacity()
73+
< toCapacity) {
74+
// Just realloc the data vector.
7475
vector.getDataVector().reAlloc();
7576
}
76-
77+
7778
return new ExpandResult(
78-
vector.getDataVector().getFieldBuffers().get(ListVectorExpander.valueBufferIndex).memoryAddress(),
79-
vector.getDataVector().getFieldBuffers().get(ListVectorExpander.valueBufferIndex).capacity(),
80-
vector.getDataVector().getFieldBuffers().get(ListVectorExpander.validityBufferIndex).memoryAddress());
79+
vector
80+
.getDataVector()
81+
.getFieldBuffers()
82+
.get(ListVectorExpander.valueBufferIndex)
83+
.memoryAddress(),
84+
vector
85+
.getDataVector()
86+
.getFieldBuffers()
87+
.get(ListVectorExpander.valueBufferIndex)
88+
.capacity(),
89+
vector
90+
.getDataVector()
91+
.getFieldBuffers()
92+
.get(ListVectorExpander.validityBufferIndex)
93+
.memoryAddress());
8194
}
82-
8395
}

java/gandiva/src/main/java/org/apache/arrow/gandiva/evaluator/Projector.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,33 @@ private void evaluate(
379379
outAddrs[idx] = valueVector.getOffsetBuffer().memoryAddress();
380380
outSizes[idx++] = valueVector.getOffsetBuffer().capacity();
381381

382-
//vector valid
383-
outAddrs[idx] = ((ListVector) valueVector).getDataVector().getFieldBuffers()
384-
.get(ListVectorExpander.validityBufferIndex).memoryAddress();
385-
outSizes[idx++] = ((ListVector) valueVector).getDataVector().getFieldBuffers()
386-
.get(ListVectorExpander.validityBufferIndex).capacity();
382+
// vector valid
383+
outAddrs[idx] =
384+
((ListVector) valueVector)
385+
.getDataVector()
386+
.getFieldBuffers()
387+
.get(ListVectorExpander.validityBufferIndex)
388+
.memoryAddress();
389+
outSizes[idx++] =
390+
((ListVector) valueVector)
391+
.getDataVector()
392+
.getFieldBuffers()
393+
.get(ListVectorExpander.validityBufferIndex)
394+
.capacity();
387395

388-
//vector offset
389-
outAddrs[idx] = ((ListVector) valueVector).getDataVector().getFieldBuffers()
390-
.get(ListVectorExpander.valueBufferIndex).memoryAddress();
391-
outSizes[idx++] = ((ListVector) valueVector).getDataVector().getFieldBuffers()
392-
.get(ListVectorExpander.valueBufferIndex).capacity();
396+
// vector offset
397+
outAddrs[idx] =
398+
((ListVector) valueVector)
399+
.getDataVector()
400+
.getFieldBuffers()
401+
.get(ListVectorExpander.valueBufferIndex)
402+
.memoryAddress();
403+
outSizes[idx++] =
404+
((ListVector) valueVector)
405+
.getDataVector()
406+
.getFieldBuffers()
407+
.get(ListVectorExpander.valueBufferIndex)
408+
.capacity();
393409
} else {
394410
outAddrs[idx] = valueVector.getDataBuffer().memoryAddress();
395411
outSizes[idx++] = valueVector.getDataBuffer().capacity();

java/gandiva/src/main/java/org/apache/arrow/gandiva/expression/ArrowTypeHelper.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ private static void initArrowTypeInterval(
260260
* @param builder the builder to use
261261
* @return Protobuf representing the arrow type
262262
*/
263-
public static GandivaTypes.ExtGandivaType arrowTypeToProtobuf(ArrowType arrowType, ArrowType subType,
264-
GandivaTypes.ExtGandivaType.Builder builder)
263+
public static GandivaTypes.ExtGandivaType arrowTypeToProtobuf(
264+
ArrowType arrowType, ArrowType subType, GandivaTypes.ExtGandivaType.Builder builder)
265265
throws GandivaException {
266266

267267
byte typeId = arrowType.getTypeID().getFlatbufID();
@@ -365,7 +365,6 @@ public static GandivaTypes.ExtGandivaType arrowTypeToProtobuf(ArrowType arrowTyp
365365
return builder.build();
366366
}
367367

368-
369368
/**
370369
* Converts an arrow type into a protobuf.
371370
*
@@ -402,8 +401,8 @@ public static GandivaTypes.Field arrowFieldToProtobuf(Field field) throws Gandiv
402401
builder.setNullable(field.isNullable());
403402

404403
ArrowType subType = null;
405-
if (field.getChildren().size() > 0 && field.getChildren().get(0)
406-
.getType().getTypeID().getFlatbufID() != Type.List) {
404+
if (field.getChildren().size() > 0
405+
&& field.getChildren().get(0).getType().getTypeID().getFlatbufID() != Type.List) {
407406
subType = field.getChildren().get(0).getType();
408407
}
409408

@@ -413,7 +412,6 @@ public static GandivaTypes.Field arrowFieldToProtobuf(Field field) throws Gandiv
413412
builder.addChildren(ArrowTypeHelper.arrowFieldToProtobuf(child));
414413
}
415414
}
416-
417415

418416
return builder.build();
419417
}

java/gandiva/src/main/java/org/apache/arrow/gandiva/expression/FunctionNode.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
package org.apache.arrow.gandiva.expression;
1818

1919
import java.util.List;
20-
2120
import org.apache.arrow.flatbuf.Type;
2221
import org.apache.arrow.gandiva.exceptions.GandivaException;
2322
import org.apache.arrow.gandiva.ipc.GandivaTypes;
2423
import org.apache.arrow.vector.types.pojo.ArrowType;
2524
import org.apache.arrow.vector.types.pojo.Field;
2625

27-
2826
/** Node representing an arbitrary function in an expression. */
2927
class FunctionNode implements TreeNode {
3028
private final String function;
@@ -36,13 +34,12 @@ class FunctionNode implements TreeNode {
3634
this.function = function;
3735
this.children = children;
3836
this.retType = inField.getType();
39-
if (inField.getChildren().size() > 0 && inField.getChildren().get(0)
40-
.getType().getTypeID().getFlatbufID() != Type.List) {
37+
if (inField.getChildren().size() > 0
38+
&& inField.getChildren().get(0).getType().getTypeID().getFlatbufID() != Type.List) {
4139
this.retListType = inField.getChildren().get(0).getType();
4240
} else {
4341
this.retListType = null;
4442
}
45-
4643
}
4744

4845
FunctionNode(String function, List<TreeNode> children, ArrowType inType) {
@@ -51,7 +48,7 @@ class FunctionNode implements TreeNode {
5148
this.retType = inType;
5249
this.retListType = null;
5350
}
54-
51+
5552
FunctionNode(String function, List<TreeNode> children, ArrowType inType, ArrowType listType) {
5653
this.function = function;
5754
this.children = children;

java/gandiva/src/main/java/org/apache/arrow/gandiva/expression/TreeBuilder.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ public static TreeNode makeFunction(String function, List<TreeNode> children, Ar
9292
*
9393
* @param function Name of the function, e.g. add
9494
* @param children The arguments to the function
95-
* @param retType The type of the return value of the operator
96-
* @param listType The type of the list return value of the operator
95+
* @param retType The type of the return value of the operator
96+
* @param listType The type of the list return value of the operator
9797
* @return Node representing a function
9898
*/
99-
public static TreeNode makeFunction(String function,
100-
List<TreeNode> children,
101-
ArrowType retType, ArrowType listType) {
99+
public static TreeNode makeFunction(
100+
String function, List<TreeNode> children, ArrowType retType, ArrowType listType) {
102101
return new FunctionNode(function, children, retType, listType);
103102
}
104103

@@ -107,12 +106,10 @@ public static TreeNode makeFunction(String function,
107106
*
108107
* @param function Name of the function, e.g. add
109108
* @param children The arguments to the function
110-
* @param retType The field of the return value of the operator, could be a complex type.
109+
* @param retType The field of the return value of the operator, could be a complex type.
111110
* @return Node representing a function
112111
*/
113-
public static TreeNode makeFunction(String function,
114-
List<TreeNode> children,
115-
Field retType) {
112+
public static TreeNode makeFunction(String function, List<TreeNode> children, Field retType) {
116113
return new FunctionNode(function, children, retType);
117114
}
118115

0 commit comments

Comments
 (0)