Skip to content

Commit

Permalink
More warning cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Apr 24, 2015
1 parent ef6b3d3 commit 06e929d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
Expand Up @@ -237,6 +237,7 @@ public void free() {
map.free();
}

@SuppressWarnings("UseOfSystemOutOrSystemErr")
public void printPerfMetrics() {
if (!enablePerfMetrics) {
throw new IllegalStateException("Perf metrics not enabled");
Expand Down
Expand Up @@ -24,10 +24,7 @@
import javax.annotation.Nullable;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

import org.apache.spark.sql.Row;
import org.apache.spark.sql.types.DataType;
Expand Down Expand Up @@ -73,7 +70,7 @@ public final class UnsafeRow implements MutableRow {
private StructType schema;

private long getFieldOffset(int ordinal) {
return baseOffset + bitSetWidthInBytes + ordinal * 8;
return baseOffset + bitSetWidthInBytes + ordinal * 8L;
}

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

static {
settableFieldTypes = new HashSet<DataType>(Arrays.asList(new DataType[] {
IntegerType,
LongType,
DoubleType,
BooleanType,
ShortType,
ByteType,
FloatType
}));
settableFieldTypes = Collections.unmodifiableSet(
new HashSet<DataType>(
Arrays.asList(new DataType[] {
IntegerType,
LongType,
DoubleType,
BooleanType,
ShortType,
ByteType,
FloatType
})));

// We support get() on a superset of the types for which we support set():
readableFieldTypes = new HashSet<DataType>(Arrays.asList(new DataType[] {
StringType
}));
readableFieldTypes.addAll(settableFieldTypes);
final Set<DataType> _readableFieldTypes = new HashSet<DataType>(
Arrays.asList(new DataType[]{
StringType
}));
_readableFieldTypes.addAll(settableFieldTypes);
readableFieldTypes = Collections.unmodifiableSet(_readableFieldTypes);
}

/**
Expand Down Expand Up @@ -156,9 +157,6 @@ private void setNotNullAt(int i) {

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

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

import org.apache.spark.unsafe.PlatformDependent;

import java.lang.Object;

/**
* Methods for working with fixed-size uncompressed bitsets.
*
Expand Down

0 comments on commit 06e929d

Please sign in to comment.