Skip to content

Commit 06e929d

Browse files
committed
More warning cleanup
1 parent ef6b3d3 commit 06e929d

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeFixedWidthAggregationMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public void free() {
237237
map.free();
238238
}
239239

240+
@SuppressWarnings("UseOfSystemOutOrSystemErr")
240241
public void printPerfMetrics() {
241242
if (!enablePerfMetrics) {
242243
throw new IllegalStateException("Perf metrics not enabled");

sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
import javax.annotation.Nullable;
2525
import java.math.BigDecimal;
2626
import java.sql.Date;
27-
import java.util.Arrays;
28-
import java.util.HashSet;
29-
import java.util.List;
30-
import java.util.Set;
27+
import java.util.*;
3128

3229
import org.apache.spark.sql.Row;
3330
import org.apache.spark.sql.types.DataType;
@@ -73,7 +70,7 @@ public final class UnsafeRow implements MutableRow {
7370
private StructType schema;
7471

7572
private long getFieldOffset(int ordinal) {
76-
return baseOffset + bitSetWidthInBytes + ordinal * 8;
73+
return baseOffset + bitSetWidthInBytes + ordinal * 8L;
7774
}
7875

7976
public static int calculateBitSetWidthInBytes(int numFields) {
@@ -91,21 +88,25 @@ public static int calculateBitSetWidthInBytes(int numFields) {
9188
public static final Set<DataType> readableFieldTypes;
9289

9390
static {
94-
settableFieldTypes = new HashSet<DataType>(Arrays.asList(new DataType[] {
95-
IntegerType,
96-
LongType,
97-
DoubleType,
98-
BooleanType,
99-
ShortType,
100-
ByteType,
101-
FloatType
102-
}));
91+
settableFieldTypes = Collections.unmodifiableSet(
92+
new HashSet<DataType>(
93+
Arrays.asList(new DataType[] {
94+
IntegerType,
95+
LongType,
96+
DoubleType,
97+
BooleanType,
98+
ShortType,
99+
ByteType,
100+
FloatType
101+
})));
103102

104103
// We support get() on a superset of the types for which we support set():
105-
readableFieldTypes = new HashSet<DataType>(Arrays.asList(new DataType[] {
106-
StringType
107-
}));
108-
readableFieldTypes.addAll(settableFieldTypes);
104+
final Set<DataType> _readableFieldTypes = new HashSet<DataType>(
105+
Arrays.asList(new DataType[]{
106+
StringType
107+
}));
108+
_readableFieldTypes.addAll(settableFieldTypes);
109+
readableFieldTypes = Collections.unmodifiableSet(_readableFieldTypes);
109110
}
110111

111112
/**
@@ -156,9 +157,6 @@ private void setNotNullAt(int i) {
156157

157158
@Override
158159
public void update(int ordinal, Object value) {
159-
assert schema != null : "schema cannot be null when calling the generic update()";
160-
final DataType type = schema.fields()[ordinal].dataType();
161-
// TODO: match based on the type, then set. This will be slow.
162160
throw new UnsupportedOperationException();
163161
}
164162

@@ -240,6 +238,7 @@ public Object apply(int i) {
240238
@Override
241239
public Object get(int i) {
242240
assertIndexIsValid(i);
241+
assert (schema != null) : "Schema must be defined when calling generic get() method";
243242
final DataType dataType = schema.fields()[i].dataType();
244243
// The ordering of these `if` statements is intentional: internally, it looks like this only
245244
// gets invoked in JoinedRow when trying to access UTF8String columns. It's extremely unlikely

unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import org.apache.spark.unsafe.PlatformDependent;
2121

22-
import java.lang.Object;
23-
2422
/**
2523
* Methods for working with fixed-size uncompressed bitsets.
2624
*

0 commit comments

Comments
 (0)