Skip to content
Merged
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
1 change: 0 additions & 1 deletion java/bench/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<relativePath>..</relativePath>
</parent>

<groupId>org.apache.orc</groupId>
<artifactId>orc-benchmarks-core</artifactId>
<version>1.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
3 changes: 2 additions & 1 deletion java/core/src/java/org/apache/orc/impl/OrcAcidUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;

public class OrcAcidUtils {
public static final String ACID_STATS = "hive.acid.stats";
Expand Down Expand Up @@ -68,7 +69,7 @@ public static long getLastFlushLength(FileSystem fs,
}
}

private static final Charset utf8 = Charset.forName("UTF-8");
private static final Charset utf8 = StandardCharsets.UTF_8;
private static final CharsetDecoder utf8Decoder = utf8.newDecoder();

public static AcidStats parseAcidStats(Reader reader) {
Expand Down
2 changes: 1 addition & 1 deletion java/core/src/java/org/apache/orc/impl/ReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class ReaderImpl implements Reader {
protected List<OrcProto.StripeStatistics> stripeStatistics;
private final int metadataSize;
protected final List<OrcProto.Type> types;
private TypeDescription schema;
private final TypeDescription schema;
private final List<OrcProto.UserMetadataItem> userMetadata;
private final List<OrcProto.ColumnStatistics> fileStats;
private final List<StripeInformation> stripes;
Expand Down
33 changes: 12 additions & 21 deletions java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,11 @@ private static boolean shouldEvaluateBloomFilter(PredicateLeaf predicate,
// 1) Bloom filter is available
// 2) Min/Max evaluation yield YES or MAYBE
// 3) Predicate is EQUALS or IN list
if (bloomFilter != null
&& result != TruthValue.NO_NULL && result != TruthValue.NO
&& (predicate.getOperator().equals(PredicateLeaf.Operator.EQUALS)
|| predicate.getOperator().equals(PredicateLeaf.Operator.NULL_SAFE_EQUALS)
|| predicate.getOperator().equals(PredicateLeaf.Operator.IN))) {
return true;
}
return false;
return bloomFilter != null
&& result != TruthValue.NO_NULL && result != TruthValue.NO
&& (predicate.getOperator().equals(PredicateLeaf.Operator.EQUALS)
|| predicate.getOperator().equals(PredicateLeaf.Operator.NULL_SAFE_EQUALS)
|| predicate.getOperator().equals(PredicateLeaf.Operator.IN));
}

private static TruthValue evaluatePredicateMinMax(PredicateLeaf predicate,
Expand Down Expand Up @@ -748,11 +745,11 @@ private static TruthValue checkInBloomFilter(BloomFilter bf,
TruthValue result = hasNull ? TruthValue.NO_NULL : TruthValue.NO;

if (predObj instanceof Long) {
if (bf.testLong(((Long) predObj).longValue())) {
if (bf.testLong((Long) predObj)) {
result = TruthValue.YES_NO_NULL;
}
} else if (predObj instanceof Double) {
if (bf.testDouble(((Double) predObj).doubleValue())) {
if (bf.testDouble((Double) predObj)) {
result = TruthValue.YES_NO_NULL;
}
} else if (predObj instanceof String || predObj instanceof Text ||
Expand Down Expand Up @@ -836,10 +833,10 @@ private static Comparable getBaseObjectForComparison(PredicateLeaf.Type type,
break;
case DECIMAL:
if (obj instanceof Boolean) {
return new HiveDecimalWritable(((Boolean) obj).booleanValue() ?
return new HiveDecimalWritable((Boolean) obj ?
HiveDecimal.ONE : HiveDecimal.ZERO);
} else if (obj instanceof Integer) {
return new HiveDecimalWritable(((Integer) obj).intValue());
return new HiveDecimalWritable((Integer) obj);
} else if (obj instanceof Long) {
return new HiveDecimalWritable(((Long) obj));
} else if (obj instanceof Float || obj instanceof Double ||
Expand All @@ -866,10 +863,6 @@ private static Comparable getBaseObjectForComparison(PredicateLeaf.Type type,
return Double.valueOf(obj.toString());
} else if (obj instanceof Timestamp) {
return TimestampUtils.getDouble((Timestamp) obj);
} else if (obj instanceof HiveDecimal) {
return ((HiveDecimal) obj).doubleValue();
} else if (obj instanceof BigDecimal) {
return ((BigDecimal) obj).doubleValue();
}
break;
case LONG:
Expand Down Expand Up @@ -897,7 +890,7 @@ private static Comparable getBaseObjectForComparison(PredicateLeaf.Type type,
} else if (obj instanceof Float) {
return TimestampUtils.doubleToTimestamp(((Float) obj).doubleValue());
} else if (obj instanceof Double) {
return TimestampUtils.doubleToTimestamp(((Double) obj).doubleValue());
return TimestampUtils.doubleToTimestamp((Double) obj);
} else if (obj instanceof HiveDecimal) {
return TimestampUtils.decimalToTimestamp((HiveDecimal) obj);
} else if (obj instanceof HiveDecimalWritable) {
Expand Down Expand Up @@ -933,7 +926,7 @@ public static class SargApplier {
private final long rowIndexStride;
// same as the above array, but indices are set to true
private final boolean[] sargColumns;
private SchemaEvolution evolution;
private final SchemaEvolution evolution;
private final long[] exceptionCount;
private final boolean useUTCTimestamp;
private final boolean writerUsedProlepticGregorian;
Expand Down Expand Up @@ -1264,9 +1257,7 @@ private int computeBatchSize(long targetBatchSize) {
endRowGroup += 1;
}

final long markerPosition =
(endRowGroup * rowIndexStride) < rowCountInStripe ? (endRowGroup * rowIndexStride)
: rowCountInStripe;
final long markerPosition = Math.min((endRowGroup * rowIndexStride), rowCountInStripe);
batchSize = (int) Math.min(targetBatchSize, (markerPosition - rowInStripe));

if (isLogDebugEnabled && batchSize < targetBatchSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public int hashCode() {

private long currentGeneration = 0;

private final TreeMap<Key, ByteBuffer> getBufferTree(boolean direct) {
private TreeMap<Key, ByteBuffer> getBufferTree(boolean direct) {
return direct ? directBuffers : buffers;
}

Expand Down
15 changes: 8 additions & 7 deletions java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ protected static IntegerReader createIntegerReader(OrcProto.ColumnEncoding.Kind
switch (kind) {
case DIRECT_V2:
case DICTIONARY_V2:
return new RunLengthIntegerReaderV2(in, signed, context == null ? false : context.isSkipCorrupt());
return new RunLengthIntegerReaderV2(in, signed,
context != null && context.isSkipCorrupt());
case DIRECT:
case DICTIONARY:
return new RunLengthIntegerReader(in, signed);
Expand Down Expand Up @@ -1098,13 +1099,13 @@ public void skipRows(long items) throws IOException {
public static class TimestampTreeReader extends TreeReader {
protected IntegerReader data = null;
protected IntegerReader nanos = null;
private Map<String, Long> baseTimestampMap;
private final Map<String, Long> baseTimestampMap;
protected long base_timestamp;
private final TimeZone readerTimeZone;
private final boolean instantType;
private TimeZone writerTimeZone;
private boolean hasSameTZRules;
private ThreadLocal<DateFormat> threadLocalDateFormat;
private final ThreadLocal<DateFormat> threadLocalDateFormat;
private final boolean useProleptic;
private final boolean fileUsesProleptic;

Expand Down Expand Up @@ -1416,7 +1417,7 @@ public static class DecimalTreeReader extends TreeReader {
protected InStream valueStream;
protected IntegerReader scaleReader = null;
private int[] scratchScaleVector;
private byte[] scratchBytes;
private final byte[] scratchBytes;

DecimalTreeReader(int columnId,
int precision,
Expand Down Expand Up @@ -1953,7 +1954,7 @@ public static void readOrcByteArrays(InStream stream,
final int batchSize) throws IOException {
if (result.noNulls || !(result.isRepeating && result.isNull[0])) {
byte[] allBytes =
commonReadByteArrays(stream, lengths, scratchlcv, result, (int) batchSize);
commonReadByteArrays(stream, lengths, scratchlcv, result, batchSize);

// Too expensive to figure out 'repeating' by comparisons.
result.isRepeating = false;
Expand Down Expand Up @@ -2213,7 +2214,7 @@ private void readDictionaryByteArray(BytesColumnVector result, FilterContext fil
scratchlcv.isRepeating = result.isRepeating;
scratchlcv.noNulls = result.noNulls;
scratchlcv.isNull = result.isNull;
scratchlcv.ensureSize((int) batchSize, false);
scratchlcv.ensureSize(batchSize, false);
reader.nextVector(scratchlcv, scratchlcv.vector, batchSize);
if (!scratchlcv.isRepeating) {
// The vector has non-repeating strings. Iterate thru the batch
Expand Down Expand Up @@ -2572,7 +2573,7 @@ public void skipRows(long items) throws IOException {
}
}

private static FilterContext NULL_FILTER = new FilterContext() {
private static final FilterContext NULL_FILTER = new FilterContext() {
@Override
public void reset() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class StripePlanner {
private String writerTimezone;
private long currentStripeId;
private long originalStripeId;
private Map<StreamName, StreamInformation> streams = new HashMap<>();
private final Map<StreamName, StreamInformation> streams = new HashMap<>();
// the index streams sorted by offset
private final List<StreamInformation> indexStreams = new ArrayList<>();
// the data streams sorted by offset
Expand Down