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
11 changes: 11 additions & 0 deletions java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,17 @@ public static class SargApplier {
private final boolean writerUsedProlepticGregorian;
private final boolean convertToProlepticGregorian;

/**
* @deprecated Use the constructor having full parameters. This exists for backward compatibility.
*/
public SargApplier(SearchArgument sarg,
long rowIndexStride,
SchemaEvolution evolution,
OrcFile.WriterVersion writerVersion,
boolean useUTCTimestamp) {
this(sarg, rowIndexStride, evolution, writerVersion, useUTCTimestamp, false, false);
}

public SargApplier(SearchArgument sarg,
long rowIndexStride,
SchemaEvolution evolution,
Expand Down
22 changes: 21 additions & 1 deletion java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.orc.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
Expand All @@ -34,6 +35,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.sql.Date;
Expand Down Expand Up @@ -2296,7 +2298,7 @@ public void testPositionalEvolutionAddColumnPPD() throws IOException {

boolean[] rows = applier.pickRowGroups(new ReaderImpl.StripeInformationImpl(stripe, 1, -1, null),
indexes, null, encodings, null, false);
assertEquals(SargApplier.READ_ALL_RGS, rows); //cannot filter for new column, return all rows
assertEquals(true, Arrays.equals(SargApplier.READ_ALL_RGS, rows)); //cannot filter for new column, return all rows

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant but satisfies the Travis CI's EC_BAD_ARRAY_COMPARE error detection. We can make this as a separate PR.

}

private boolean[] includeAll(TypeDescription readerType) {
Expand Down Expand Up @@ -2358,4 +2360,22 @@ public void testCloseAtConstructorException() throws Exception {
assertTrue(isCalled);
verify(mockedDataReader, times(1)).close();
}

@Test
public void testSargApplier() throws Exception {
Configuration conf = new Configuration();
TypeDescription schema = TypeDescription.createLong();
SearchArgument sarg = SearchArgumentFactory.newBuilder().build();
SchemaEvolution evo = new SchemaEvolution(schema, schema, new Reader.Options(conf));
RecordReaderImpl.SargApplier applier1 =
new RecordReaderImpl.SargApplier(sarg, 0, evo, OrcFile.WriterVersion.ORC_135, false);

Field f1 = RecordReaderImpl.SargApplier.class.getDeclaredField("writerUsedProlepticGregorian");
f1.setAccessible(true);
assertFalse((boolean)f1.get(applier1));

Field f2 = RecordReaderImpl.SargApplier.class.getDeclaredField("convertToProlepticGregorian");
f2.setAccessible(true);
assertFalse((boolean)f2.get(applier1));
}
}