This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-1.7 by this push:
new 88b47de ORC-947: Update coding guide to max line length 100 and
enforce it (#859)
88b47de is described below
commit 88b47deeb51dc70426adf0731c96d521b4802fde
Author: William Hyun <[email protected]>
AuthorDate: Sat Aug 14 15:01:38 2021 -0700
ORC-947: Update coding guide to max line length 100 and enforce it (#859)
### What changes were proposed in this pull request?
This PR aims to update the ORC Java coding guide to max line length 100 and
enforce it.
### Why are the changes needed?
Our coding guideline is outdated in terms of the max line length.
We had better make it consistent in our website and codebase.
### How was this patch tested?
Pass the CIs.
(cherry picked from commit 64bb8d3f212891052312bb8f7b8247b93fb111ea)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../bench/hive/RowFilterProjectionBenchmark.java | 9 ++++++---
.../bench/hive/rowfilter/RowFilterInputState.java | 6 ++++--
.../org/apache/orc/bench/spark/SparkBenchmark.java | 6 ++++--
java/core/src/java/org/apache/orc/OrcConf.java | 18 ++++++++++++------
java/core/src/java/org/apache/orc/Reader.java | 3 ++-
.../java/org/apache/orc/impl/BitFieldReader.java | 6 ++++--
.../src/java/org/apache/orc/impl/BufferChunk.java | 3 ++-
.../apache/orc/impl/ConvertTreeReaderFactory.java | 15 ++++++++++-----
.../org/apache/orc/impl/DataReaderProperties.java | 3 ++-
.../src/java/org/apache/orc/impl/DateUtils.java | 3 ++-
.../src/java/org/apache/orc/impl/InStream.java | 2 +-
.../src/java/org/apache/orc/impl/ReaderImpl.java | 12 ++++++++----
.../java/org/apache/orc/impl/RecordReaderImpl.java | 21 ++++++++++++++-------
.../org/apache/orc/impl/TreeReaderFactory.java | 22 ++++++++++++++--------
.../src/java/org/apache/orc/impl/WriterImpl.java | 20 ++++++++++----------
.../orc/impl/filter/leaf/LeafFilterFactory.java | 6 ++++--
.../org/apache/orc/impl/reader/StripePlanner.java | 8 +++++---
.../apache/orc/impl/reader/tree/BatchReader.java | 3 ++-
.../orc/impl/reader/tree/PrimitiveBatchReader.java | 3 ++-
.../orc/impl/reader/tree/StructBatchReader.java | 8 +++++---
.../org/apache/orc/impl/writer/TreeWriterBase.java | 3 ++-
.../src/java/org/apache/orc/util/BloomFilter.java | 2 +-
.../threeten/extra/chrono/HybridChronology.java | 6 ++++--
java/pom.xml | 3 ++-
.../src/java/org/apache/orc/tools/RowCount.java | 3 ++-
.../org/apache/orc/tools/convert/ConvertTool.java | 3 ++-
site/develop/coding.md | 2 +-
27 files changed, 127 insertions(+), 72 deletions(-)
diff --git
a/java/bench/hive/src/java/org/apache/orc/bench/hive/RowFilterProjectionBenchmark.java
b/java/bench/hive/src/java/org/apache/orc/bench/hive/RowFilterProjectionBenchmark.java
index 4cbfbe2..de7684d 100644
---
a/java/bench/hive/src/java/org/apache/orc/bench/hive/RowFilterProjectionBenchmark.java
+++
b/java/bench/hive/src/java/org/apache/orc/bench/hive/RowFilterProjectionBenchmark.java
@@ -137,7 +137,8 @@ public class RowFilterProjectionBenchmark implements
OrcBenchmark {
List<TypeDescription> children = schema.getChildren();
boolean foundFilterCol = false;
for (int c = children.get(0).getId(); c < schema.getMaximumId() + 1; ++c) {
- if (c < schema.getFieldNames().size() &&
schema.getFieldNames().get(c-1).compareTo(filter_column) == 0) {
+ if (c < schema.getFieldNames().size() &&
+ schema.getFieldNames().get(c-1).compareTo(filter_column) == 0) {
foundFilterCol = true;
include[c] = true;
}
@@ -153,7 +154,8 @@ public class RowFilterProjectionBenchmark implements
OrcBenchmark {
RecordReader rows =
reader.rows(reader.options()
.include(include)
- .setRowFilter(new String[]{filter_column},
RowFilterProjectionBenchmark::customIntRowFilter));
+ .setRowFilter(new String[]{filter_column},
+ RowFilterProjectionBenchmark::customIntRowFilter));
VectorizedRowBatch batch = schema.createRowBatch();
while (rows.nextBatch(batch)) {
@@ -195,7 +197,8 @@ public class RowFilterProjectionBenchmark implements
OrcBenchmark {
List<TypeDescription> children = schema.getChildren();
boolean foundFilterCol = false;
for (int c = children.get(0).getId(); c < schema.getMaximumId() + 1; ++c) {
- if (c < schema.getFieldNames().size() &&
schema.getFieldNames().get(c-1).compareTo(filter_column) == 0) {
+ if (c < schema.getFieldNames().size() &&
+ schema.getFieldNames().get(c-1).compareTo(filter_column) == 0) {
foundFilterCol = true;
include[c] = true;
}
diff --git
a/java/bench/hive/src/java/org/apache/orc/bench/hive/rowfilter/RowFilterInputState.java
b/java/bench/hive/src/java/org/apache/orc/bench/hive/rowfilter/RowFilterInputState.java
index dba28f8..dede8f9 100644
---
a/java/bench/hive/src/java/org/apache/orc/bench/hive/rowfilter/RowFilterInputState.java
+++
b/java/bench/hive/src/java/org/apache/orc/bench/hive/rowfilter/RowFilterInputState.java
@@ -53,7 +53,8 @@ public abstract class RowFilterInputState {
public void setup() throws IOException, IllegalAccessException {
TypeDescription.RowBatchVersion version =
(TypeDescription.RowBatchVersion) FieldUtils.readField(this,
"version", true);
- TypeDescription.Category benchType = (TypeDescription.Category)
FieldUtils.readField(this, "benchType", true);
+ TypeDescription.Category benchType =
+ (TypeDescription.Category) FieldUtils.readField(this, "benchType",
true);
String filterPerc = (String) FieldUtils.readField(this, "filterPerc",
true);
int filterColsNum = (int) FieldUtils.readField(this, "filterColsNum",
true);
String dataRelativePath = (String) FieldUtils.readField(this,
"dataRelativePath", true);
@@ -67,7 +68,8 @@ public abstract class RowFilterInputState {
include = new boolean[schema.getMaximumId() + 1];
for (TypeDescription child : schema.getChildren()) {
if (schema.getFieldNames().get(child.getId() -
1).compareTo(filterColumn) == 0) {
- System.out.println("Apply Filter on column: " +
schema.getFieldNames().get(child.getId() - 1));
+ System.out.println(
+ "Apply Filter on column: " +
schema.getFieldNames().get(child.getId() - 1));
include[child.getId()] = true;
} else if (child.getCategory() == benchType) {
System.out.println("Skip column(s): " +
schema.getFieldNames().get(child.getId() - 1));
diff --git
a/java/bench/spark/src/java/org/apache/orc/bench/spark/SparkBenchmark.java
b/java/bench/spark/src/java/org/apache/orc/bench/spark/SparkBenchmark.java
index f9c817d..ab6e12f 100644
--- a/java/bench/spark/src/java/org/apache/orc/bench/spark/SparkBenchmark.java
+++ b/java/bench/spark/src/java/org/apache/orc/bench/spark/SparkBenchmark.java
@@ -240,7 +240,8 @@ public class SparkBenchmark implements OrcBenchmark {
default:
throw new IllegalArgumentException("Unknown data set " +
source.dataset);
}
- Seq<Tuple2<String,String>> optionsScala =
JavaConverters.asScalaBufferConverter(options).asScala().toSeq();
+ Seq<Tuple2<String,String>> optionsScala =
+ JavaConverters.asScalaBufferConverter(options).asScala().toSeq();
@SuppressWarnings("unchecked")
Map<String,String> scalaMap = (Map<String,
String>)Map$.MODULE$.apply(optionsScala);
Function1<PartitionedFile,Iterator<InternalRow>> factory =
@@ -292,7 +293,8 @@ public class SparkBenchmark implements OrcBenchmark {
default:
break;
}
- Seq<Tuple2<String,String>> optionsScala =
JavaConverters.asScalaBufferConverter(options).asScala().toSeq();
+ Seq<Tuple2<String,String>> optionsScala =
+ JavaConverters.asScalaBufferConverter(options).asScala().toSeq();
@SuppressWarnings("unchecked")
Map<String,String> scalaMap = (Map<String,
String>)Map$.MODULE$.apply(optionsScala);
Function1<PartitionedFile,Iterator<InternalRow>> factory =
diff --git a/java/core/src/java/org/apache/orc/OrcConf.java
b/java/core/src/java/org/apache/orc/OrcConf.java
index a2c1ccb..1f40ce9 100644
--- a/java/core/src/java/org/apache/orc/OrcConf.java
+++ b/java/core/src/java/org/apache/orc/OrcConf.java
@@ -51,7 +51,8 @@ public enum OrcConf {
"Define the version of the file to write. Possible values are 0.11
and\n"+
" 0.12. If this parameter is not defined, ORC will use the run\n" +
" length encoding (RLE) introduced in Hive 0.12."),
- ENFORCE_COMPRESSION_BUFFER_SIZE("orc.buffer.size.enforce",
"hive.exec.orc.buffer.size.enforce", false,
+ ENFORCE_COMPRESSION_BUFFER_SIZE("orc.buffer.size.enforce",
+ "hive.exec.orc.buffer.size.enforce", false,
"Defines whether to enforce ORC compression buffer size."),
ENCODING_STRATEGY("orc.encoding.strategy", "hive.exec.orc.encoding.strategy",
"SPEED",
@@ -163,13 +164,16 @@ public enum OrcConf {
"testing. Setting this too low may negatively affect performance."),
OVERWRITE_OUTPUT_FILE("orc.overwrite.output.file",
"orc.overwrite.output.file", false,
"A boolean flag to enable overwriting of the output file if it already
exists.\n"),
- IS_SCHEMA_EVOLUTION_CASE_SENSITIVE("orc.schema.evolution.case.sensitive",
"orc.schema.evolution.case.sensitive", true,
- "A boolean flag to determine if the comparision of field names in
schema evolution is case sensitive .\n"),
+ IS_SCHEMA_EVOLUTION_CASE_SENSITIVE("orc.schema.evolution.case.sensitive",
+ "orc.schema.evolution.case.sensitive", true,
+ "A boolean flag to determine if the comparision of field names " +
+ "in schema evolution is case sensitive .\n"),
ALLOW_SARG_TO_FILTER("orc.sarg.to.filter", "org.sarg.to.filter", false,
"A boolean flag to determine if a SArg is allowed to
become a filter"),
READER_USE_SELECTED("orc.filter.use.selected", "orc.filter.use.selected",
false,
"A boolean flag to determine if the selected vector is
supported by\n"
- + "the reading application. If false, the output of
the ORC reader must have the filter\n"
+ + "the reading application. If false, the output of
the ORC reader "
+ + "must have the filter\n"
+ "reapplied to avoid using unset values in the
unselected rows.\n"
+ "If unsure please leave this as false."),
WRITE_VARIABLE_LENGTH_BLOCKS("orc.write.variable.length.blocks", null, false,
@@ -178,11 +182,13 @@ public enum OrcConf {
DIRECT_ENCODING_COLUMNS("orc.column.encoding.direct",
"orc.column.encoding.direct", "",
"Comma-separated list of columns for which dictionary encoding is to be
skipped."),
// some JVM doesn't allow array creation of size Integer.MAX_VALUE, so chunk
size is slightly less than max int
- ORC_MAX_DISK_RANGE_CHUNK_LIMIT("orc.max.disk.range.chunk.limit",
"hive.exec.orc.max.disk.range.chunk.limit",
+ ORC_MAX_DISK_RANGE_CHUNK_LIMIT("orc.max.disk.range.chunk.limit",
+ "hive.exec.orc.max.disk.range.chunk.limit",
Integer.MAX_VALUE - 1024, "When reading stripes >2GB, specify max limit
for the chunk size."),
ENCRYPTION("orc.encrypt", "orc.encrypt", null, "The list of keys and columns
to encrypt with"),
DATA_MASK("orc.mask", "orc.mask", null, "The masks to apply to the encrypted
columns"),
- KEY_PROVIDER("orc.key.provider", "orc.key.provider", "hadoop", "The kind of
KeyProvider to use for encryption."),
+ KEY_PROVIDER("orc.key.provider", "orc.key.provider", "hadoop",
+ "The kind of KeyProvider to use for encryption."),
PROLEPTIC_GREGORIAN("orc.proleptic.gregorian", "orc.proleptic.gregorian",
false,
"Should we read and write dates & times using the proleptic Gregorian
calendar\n" +
"instead of the hybrid Julian Gregorian? Hive before 3.1 and Spark
before 3.0\n" +
diff --git a/java/core/src/java/org/apache/orc/Reader.java
b/java/core/src/java/org/apache/orc/Reader.java
index 51c57a2..da06634 100644
--- a/java/core/src/java/org/apache/orc/Reader.java
+++ b/java/core/src/java/org/apache/orc/Reader.java
@@ -268,7 +268,8 @@ public interface Reader extends Closeable {
*
* @return this
*/
- public Options setRowFilter(String[] filterColumnNames,
Consumer<OrcFilterContext> filterCallback) {
+ public Options setRowFilter(
+ String[] filterColumnNames, Consumer<OrcFilterContext> filterCallback)
{
this.preFilterColumns = filterColumnNames;
this.skipRowCallback = filterCallback;
return this;
diff --git a/java/core/src/java/org/apache/orc/impl/BitFieldReader.java
b/java/core/src/java/org/apache/orc/impl/BitFieldReader.java
index f1d386c..66c48e3 100644
--- a/java/core/src/java/org/apache/orc/impl/BitFieldReader.java
+++ b/java/core/src/java/org/apache/orc/impl/BitFieldReader.java
@@ -70,7 +70,8 @@ public final class BitFieldReader {
for (int i = 0; i != filterContext.getSelectedSize(); i++) {
int idx = filterContext.getSelected()[i];
if (idx - previousIdx > 0) {
-
skip(TreeReaderFactory.TreeReader.countNonNullRowsInRange(previous.isNull,
previousIdx, idx));
+ skip(TreeReaderFactory.TreeReader.countNonNullRowsInRange(
+ previous.isNull, previousIdx, idx));
}
if (!previous.isNull[idx]) {
previous.vector[idx] = next();
@@ -79,7 +80,8 @@ public final class BitFieldReader {
}
previousIdx = idx + 1;
}
-
skip(TreeReaderFactory.TreeReader.countNonNullRowsInRange(previous.isNull,
previousIdx, (int)previousLen));
+ skip(TreeReaderFactory.TreeReader.countNonNullRowsInRange(
+ previous.isNull, previousIdx, (int)previousLen));
}
}
diff --git a/java/core/src/java/org/apache/orc/impl/BufferChunk.java
b/java/core/src/java/org/apache/orc/impl/BufferChunk.java
index 001135a..d43b2de 100644
--- a/java/core/src/java/org/apache/orc/impl/BufferChunk.java
+++ b/java/core/src/java/org/apache/orc/impl/BufferChunk.java
@@ -74,7 +74,8 @@ public class BufferChunk extends DiskRangeList {
sliceBuf.position(newPos);
sliceBuf.limit(newLimit);
} catch (Throwable t) {
- throw new RuntimeException("Failed to slice buffer chunk with range" + "
[" + this.offset + ", " + this.end
+ throw new RuntimeException(
+ "Failed to slice buffer chunk with range" + " [" + this.offset +
", " + this.end
+ "), position: " + chunk.position() + " limit: " +
chunk.limit() + ", "
+ (chunk.isDirect() ? "direct" : "array") + "; to [" + offset +
", " + end + ") "
+ t.getClass(), t);
diff --git
a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
index 2da0a2b..16b89dd 100644
--- a/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java
@@ -391,7 +391,8 @@ public class ConvertTreeReaderFactory extends
TreeReaderFactory {
private final TypeDescription readerType;
private final boolean downCastNeeded;
- AnyIntegerFromAnyIntegerTreeReader(int columnId, TypeDescription fileType,
TypeDescription readerType,
+ AnyIntegerFromAnyIntegerTreeReader(
+ int columnId, TypeDescription fileType, TypeDescription readerType,
Context context) throws IOException {
super(columnId, createFromInteger(columnId, fileType, context), context);
this.readerType = readerType;
@@ -679,7 +680,8 @@ public class ConvertTreeReaderFactory extends
TreeReaderFactory {
private DecimalColumnVector decimalColVector;
private DoubleColumnVector doubleColVector;
- DoubleFromDecimalTreeReader(int columnId, TypeDescription fileType,
Context context) throws IOException {
+ DoubleFromDecimalTreeReader(
+ int columnId, TypeDescription fileType, Context context) throws
IOException {
super(columnId, new DecimalTreeReader(columnId, fileType.getPrecision(),
fileType.getScale(), context), context);
this.precision = fileType.getPrecision();
@@ -994,7 +996,8 @@ public class ConvertTreeReaderFactory extends
TreeReaderFactory {
private int fileScale;
private ColumnVector decimalColVector;
- DecimalFromDecimalTreeReader(int columnId, TypeDescription fileType,
TypeDescription readerType, Context context)
+ DecimalFromDecimalTreeReader(
+ int columnId, TypeDescription fileType, TypeDescription readerType,
Context context)
throws IOException {
super(columnId, new DecimalTreeReader(columnId, fileType.getPrecision(),
fileType.getScale(), context), context);
@@ -1006,9 +1009,11 @@ public class ConvertTreeReaderFactory extends
TreeReaderFactory {
public void setConvertVectorElement(int elementNum) throws IOException {
if (decimalColVector instanceof Decimal64ColumnVector) {
- ((Decimal64ColumnVector) decimalColVector).set(elementNum,
fileDecimalColVector.vector[elementNum]);
+ ((Decimal64ColumnVector) decimalColVector).set(
+ elementNum, fileDecimalColVector.vector[elementNum]);
} else {
- ((DecimalColumnVector) decimalColVector).set(elementNum,
fileDecimalColVector.vector[elementNum]);
+ ((DecimalColumnVector) decimalColVector).set(
+ elementNum, fileDecimalColVector.vector[elementNum]);
}
}
diff --git a/java/core/src/java/org/apache/orc/impl/DataReaderProperties.java
b/java/core/src/java/org/apache/orc/impl/DataReaderProperties.java
index b128d9b..3bc5876 100644
--- a/java/core/src/java/org/apache/orc/impl/DataReaderProperties.java
+++ b/java/core/src/java/org/apache/orc/impl/DataReaderProperties.java
@@ -77,7 +77,8 @@ public final class DataReaderProperties {
private FSDataInputStream file;
private InStream.StreamOptions compression;
private boolean zeroCopy;
- private int maxDiskRangeChunkLimit = (int)
OrcConf.ORC_MAX_DISK_RANGE_CHUNK_LIMIT.getDefaultValue();
+ private int maxDiskRangeChunkLimit =
+ (int) OrcConf.ORC_MAX_DISK_RANGE_CHUNK_LIMIT.getDefaultValue();
private Builder() {
diff --git a/java/core/src/java/org/apache/orc/impl/DateUtils.java
b/java/core/src/java/org/apache/orc/impl/DateUtils.java
index 8660dc3..9a31c5d 100644
--- a/java/core/src/java/org/apache/orc/impl/DateUtils.java
+++ b/java/core/src/java/org/apache/orc/impl/DateUtils.java
@@ -175,7 +175,8 @@ public class DateUtils {
public static Integer parseDate(String date, boolean fromProleptic) {
try {
- TemporalAccessor time = (fromProleptic ? PROLEPTIC_DATE_FORMAT :
HYBRID_DATE_FORMAT).parse(date);
+ TemporalAccessor time =
+ (fromProleptic ? PROLEPTIC_DATE_FORMAT :
HYBRID_DATE_FORMAT).parse(date);
return (int) LocalDate.from(time).toEpochDay();
} catch (DateTimeParseException e) {
return null;
diff --git a/java/core/src/java/org/apache/orc/impl/InStream.java
b/java/core/src/java/org/apache/orc/impl/InStream.java
index fc45543..d478607 100644
--- a/java/core/src/java/org/apache/orc/impl/InStream.java
+++ b/java/core/src/java/org/apache/orc/impl/InStream.java
@@ -481,7 +481,7 @@ public abstract class InStream extends InputStream {
if (chunkLength > bufferSize) {
throw new IllegalArgumentException("Buffer size too small. size = " +
- bufferSize + " needed = " +
chunkLength + " in " + name);
+ bufferSize + " needed = " + chunkLength + " in " + name);
}
ByteBuffer slice = this.slice(chunkLength);
diff --git a/java/core/src/java/org/apache/orc/impl/ReaderImpl.java
b/java/core/src/java/org/apache/orc/impl/ReaderImpl.java
index 2f28618..ce04839 100644
--- a/java/core/src/java/org/apache/orc/impl/ReaderImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/ReaderImpl.java
@@ -305,7 +305,8 @@ public class ReaderImpl implements Reader {
}
@Override
- public List<StripeStatistics> getVariantStripeStatistics(EncryptionVariant
variant) throws IOException {
+ public List<StripeStatistics> getVariantStripeStatistics(EncryptionVariant
variant)
+ throws IOException {
if (variant == null) {
if (stripeStatistics == null) {
try (CompressionCodec codec = OrcCodecPool.getCodec(compressionKind)) {
@@ -575,7 +576,8 @@ public class ReaderImpl implements Reader {
this.stripes = tail.getStripes();
this.stripeStatistics = null;
this.encryption = new ReaderEncryption(tail.getFooter(), schema,
- tail.getStripeStatisticsOffset(), tail.getTailBuffer(), stripes,
options.getKeyProvider(), conf);
+ tail.getStripeStatisticsOffset(), tail.getTailBuffer(), stripes,
+ options.getKeyProvider(), conf);
}
this.types = OrcUtils.getOrcTypes(schema);
}
@@ -741,7 +743,8 @@ public class ReaderImpl implements Reader {
}
// clear does not clear the contents but sets position to 0 and limit =
capacity
buffer.clear();
- return new OrcTail(fileTailBuilder.build(), new
BufferChunk(buffer.slice(), 0), modificationTime);
+ return new OrcTail(fileTailBuilder.build(),
+ new BufferChunk(buffer.slice(), 0), modificationTime);
}
protected OrcTail extractFileTail(FileSystem fs, Path path,
@@ -1062,7 +1065,8 @@ public class ReaderImpl implements Reader {
if (included == null || included[sub]) {
for(int s = 0; s < colStats.size(); ++s) {
StripeStatisticsImpl resultElem = (StripeStatisticsImpl)
result.get(s);
- resultElem.updateColumn(sub,
colStats.get(s).getColumn(sub - variantType.getId()));
+ resultElem.updateColumn(sub,
+ colStats.get(s).getColumn(sub -
variantType.getId()));
}
}
}
diff --git a/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
b/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
index 3bc6102..b9ef27f 100644
--- a/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
@@ -215,7 +215,8 @@ public class RecordReaderImpl implements RecordReader {
this.schema = evolution.getReaderSchema();
this.path = fileReader.path;
this.rowIndexStride = fileReader.rowIndexStride;
- boolean ignoreNonUtf8BloomFilter =
OrcConf.IGNORE_NON_UTF8_BLOOM_FILTERS.getBoolean(fileReader.conf);
+ boolean ignoreNonUtf8BloomFilter =
+ OrcConf.IGNORE_NON_UTF8_BLOOM_FILTERS.getBoolean(fileReader.conf);
ReaderEncryption encryption = fileReader.getEncryption();
this.fileIncluded = evolution.getFileIncluded();
SearchArgument sarg = options.getSearchArgument();
@@ -582,7 +583,8 @@ public class RecordReaderImpl implements RecordReader {
TypeDescription type,
boolean
writerUsedProlepticGregorian,
boolean useUTCTimestamp) {
- ColumnStatistics cs = ColumnStatisticsImpl.deserialize(null, statsProto,
writerUsedProlepticGregorian, true);
+ ColumnStatistics cs = ColumnStatisticsImpl.deserialize(
+ null, statsProto, writerUsedProlepticGregorian, true);
ValueRange range = getValueRange(cs, predicate, useUTCTimestamp);
// files written before ORC-135 stores timestamp wrt to local timezone
causing issues with PPD.
@@ -677,7 +679,8 @@ public class RecordReaderImpl implements RecordReader {
result = evaluatePredicateMinMax(predicate, predObj, range);
if (shouldEvaluateBloomFilter(predicate, result, bloomFilter)) {
- return evaluatePredicateBloomFilter(predicate, predObj, bloomFilter,
range.hasNulls, useUTCTimestamp);
+ return evaluatePredicateBloomFilter(
+ predicate, predObj, bloomFilter, range.hasNulls, useUTCTimestamp);
} else {
return result;
}
@@ -805,7 +808,8 @@ public class RecordReaderImpl implements RecordReader {
for (Object arg : predicate.getLiteralList()) {
// if atleast one value in IN list exist in bloom filter, qualify
the row group/stripe
Object predObjItem = getBaseObjectForComparison(predicate.getType(),
(Comparable) arg);
- TruthValue result = checkInBloomFilter(bloomFilter, predObjItem,
hasNull, useUTCTimestamp);
+ TruthValue result =
+ checkInBloomFilter(bloomFilter, predObjItem, hasNull,
useUTCTimestamp);
if (result == TruthValue.YES_NO_NULL || result == TruthValue.YES_NO)
{
return result;
}
@@ -842,7 +846,8 @@ public class RecordReaderImpl implements RecordReader {
result = TruthValue.YES_NO_NULL;
}
} else {
- if (bf.testLong(SerializationUtils.convertToUtc(TimeZone.getDefault(),
((Timestamp) predObj).getTime()))) {
+ if (bf.testLong(SerializationUtils.convertToUtc(
+ TimeZone.getDefault(), ((Timestamp) predObj).getTime()))) {
result = TruthValue.YES_NO_NULL;
}
}
@@ -1107,7 +1112,8 @@ public class RecordReaderImpl implements RecordReader {
LOG.info("Skipping ORC PPD - " + e.getMessage() + " on "
+ predicate);
} else {
- final String reason = e.getClass().getSimpleName() + " when
evaluating predicate." +
+ final String reason = e.getClass().getSimpleName() +
+ " when evaluating predicate." +
" Skipping ORC PPD." +
" Stats: " + stats +
" Predicate: " + predicate;
@@ -1404,7 +1410,8 @@ public class RecordReaderImpl implements RecordReader {
// position of the follow. This is required to determine the non-null
values to skip on the
// non-filter columns.
seekToRowEntry(reader, readRG, TypeReader.ReadPhase.LEADER_PARENTS);
- reader.skipRows(fromFollowRow - (readRG * rowIndexStride),
TypeReader.ReadPhase.LEADER_PARENTS);
+ reader.skipRows(fromFollowRow - (readRG * rowIndexStride),
+ TypeReader.ReadPhase.LEADER_PARENTS);
// Move both the filter parents and non-filter forward, this will
compute the correct
// non-null skips on follow children
reader.skipRows(skipRows, TypeReader.ReadPhase.FOLLOWERS_AND_PARENTS);
diff --git a/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
b/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
index 91226ab..1ff3ea8 100644
--- a/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
@@ -110,7 +110,8 @@ public class TreeReaderFactory {
return this;
}
- public ReaderContext setFilterCallback(Set<Integer> filterColumnsList,
Consumer<OrcFilterContext> filterCallback) {
+ public ReaderContext setFilterCallback(
+ Set<Integer> filterColumnsList, Consumer<OrcFilterContext>
filterCallback) {
this.filterColumnIds = filterColumnsList;
this.filterCallback = filterCallback;
return this;
@@ -501,7 +502,8 @@ public class TreeReaderFactory {
this(columnId, null, null, context);
}
- protected ByteTreeReader(int columnId, InStream present, InStream data,
Context context) throws IOException {
+ protected ByteTreeReader(
+ int columnId, InStream present, InStream data, Context context) throws
IOException {
super(columnId, present, context);
this.reader = new RunLengthByteReader(data);
}
@@ -965,7 +967,8 @@ public class TreeReaderFactory {
// some nulls
int previousIdx = 0;
// conditions to ensure bounds checks skips
- for (int i = 0; batchSize <= result.isNull.length && i !=
filterContext.getSelectedSize(); i++) {
+ for (int i = 0; batchSize <= result.isNull.length &&
+ i != filterContext.getSelectedSize(); i++) {
int idx = filterContext.getSelected()[i];
if (idx - previousIdx > 0) {
utils.skipDouble(stream,
countNonNullRowsInRange(result.isNull, previousIdx, idx));
@@ -978,7 +981,8 @@ public class TreeReaderFactory {
}
previousIdx = idx + 1;
}
- utils.skipDouble(stream, countNonNullRowsInRange(result.isNull,
previousIdx, batchSize));
+ utils.skipDouble(stream,
+ countNonNullRowsInRange(result.isNull, previousIdx,
batchSize));
}
} else {
// no nulls
@@ -1516,7 +1520,8 @@ public class TreeReaderFactory {
valueStream = planner.getStream(new StreamName(columnId,
OrcProto.Stream.Kind.DATA));
scaleReader =
createIntegerReader(planner.getEncoding(columnId).getKind(),
- planner.getStream(new StreamName(columnId,
OrcProto.Stream.Kind.SECONDARY)), true, context);
+ planner.getStream(new StreamName(columnId,
OrcProto.Stream.Kind.SECONDARY)),
+ true, context);
}
@Override
@@ -2425,7 +2430,8 @@ public class TreeReaderFactory {
}
protected VarcharTreeReader(int columnId, int maxLength, InStream present,
InStream data,
- InStream length, InStream dictionary,
OrcProto.ColumnEncoding encoding,
+ InStream length, InStream dictionary,
+ OrcProto.ColumnEncoding encoding,
Context context) throws IOException {
super(columnId, present, data, length, dictionary, encoding, context);
this.maxLength = maxLength;
@@ -2652,8 +2658,8 @@ public class TreeReaderFactory {
public void startStripe(StripePlanner planner, ReadPhase readPhase) throws
IOException {
if (readPhase.contains(this.readerCategory)) {
super.startStripe(planner, readPhase);
- tags = new RunLengthByteReader(planner.getStream(new
StreamName(columnId,
-
OrcProto.Stream.Kind.DATA)));
+ tags = new RunLengthByteReader(planner.getStream(
+ new StreamName(columnId, OrcProto.Stream.Kind.DATA)));
}
for (TypeReader field : fields) {
if (field != null && TypeReader.shouldProcessChild(field, readPhase)) {
diff --git a/java/core/src/java/org/apache/orc/impl/WriterImpl.java
b/java/core/src/java/org/apache/orc/impl/WriterImpl.java
index 5491442..2e2e452 100644
--- a/java/core/src/java/org/apache/orc/impl/WriterImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/WriterImpl.java
@@ -802,12 +802,12 @@ public class WriterImpl implements WriterInternal,
MemoryManager.Callback {
}
rowsInStripe = stripeInfo.getNumberOfRows();
// update stripe information
- OrcProto.StripeInformation.Builder dirEntry = OrcProto.StripeInformation
- .newBuilder()
-
.setNumberOfRows(rowsInStripe)
-
.setIndexLength(stripeInfo.getIndexLength())
-
.setDataLength(stripeInfo.getDataLength())
-
.setFooterLength(stripeInfo.getFooterLength());
+ OrcProto.StripeInformation.Builder dirEntry =
+ OrcProto.StripeInformation.newBuilder()
+ .setNumberOfRows(rowsInStripe)
+ .setIndexLength(stripeInfo.getIndexLength())
+ .setDataLength(stripeInfo.getDataLength())
+
.setFooterLength(stripeInfo.getFooterLength());
// If this is the first stripe of the original file, we need to copy the
// encryption information.
if (stripeInfo.hasEncryptionStripeId()) {
@@ -934,10 +934,10 @@ public class WriterImpl implements WriterInternal,
MemoryManager.Callback {
* @param schema the type tree that we search for annotations
* @param keyOverrides user specified key overrides
*/
- private WriterEncryptionVariant[] setupEncryption(KeyProvider provider,
- TypeDescription schema,
- Map<String,
HadoopShims.KeyMetadata> keyOverrides
- ) throws IOException {
+ private WriterEncryptionVariant[] setupEncryption(
+ KeyProvider provider,
+ TypeDescription schema,
+ Map<String, HadoopShims.KeyMetadata> keyOverrides) throws IOException {
keyProvider = provider != null ? provider :
CryptoUtils.getKeyProvider(conf, new SecureRandom());
// Load the overrides into the cache so that we use the required key
versions.
diff --git
a/java/core/src/java/org/apache/orc/impl/filter/leaf/LeafFilterFactory.java
b/java/core/src/java/org/apache/orc/impl/filter/leaf/LeafFilterFactory.java
index 14f73d5..e3bfc30 100644
--- a/java/core/src/java/org/apache/orc/impl/filter/leaf/LeafFilterFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/filter/leaf/LeafFilterFactory.java
@@ -118,7 +118,8 @@ public class LeafFilterFactory {
negated);
case DATE:
return new LongFilters.LongLessThanEquals(colName,
- ((Date)
literal).toLocalDate().toEpochDay(), negated);
+ ((Date)
literal).toLocalDate().toEpochDay(),
+ negated);
case DECIMAL:
HiveDecimalWritable d = (HiveDecimalWritable) literal;
assert d.scale() <= colType.getScale();
@@ -269,7 +270,8 @@ public class LeafFilterFactory {
return negated ? new IsNotNullFilter(leaf.getColumnName()) :
new IsNullFilter(leaf.getColumnName());
default:
- throw new
FilterFactory.UnSupportedSArgException(String.format("Predicate: %s is not
supported", leaf));
+ throw new FilterFactory.UnSupportedSArgException(
+ String.format("Predicate: %s is not supported", leaf));
}
}
}
diff --git a/java/core/src/java/org/apache/orc/impl/reader/StripePlanner.java
b/java/core/src/java/org/apache/orc/impl/reader/StripePlanner.java
index 732d137..a08d664 100644
--- a/java/core/src/java/org/apache/orc/impl/reader/StripePlanner.java
+++ b/java/core/src/java/org/apache/orc/impl/reader/StripePlanner.java
@@ -521,7 +521,8 @@ public class StripePlanner {
for (StreamInformation stream : dataStreams) {
if (readPhase == TypeReader.ReadPhase.ALL
|| (readPhase == TypeReader.ReadPhase.LEADERS &&
filterColIds.contains(stream.column))
- || (readPhase == TypeReader.ReadPhase.FOLLOWERS &&
!filterColIds.contains(stream.column))) {
+ || (readPhase == TypeReader.ReadPhase.FOLLOWERS &&
+ !filterColIds.contains(stream.column))) {
processStream(stream, result, rowIndex, startGroup,
includedRowGroups, isCompressed, bufferSize);
} else {
@@ -560,14 +561,15 @@ public class StripePlanner {
encodings[stream.column].getKind(), kind, stream.kind,
isCompressed, hasNull[column]);
long start = Math.max(alreadyRead,
- stream.offset + (group == 0 ? 0 :
ri.getEntry(group).getPositions(posn)));
+ stream.offset + (group == 0 ? 0 :
ri.getEntry(group).getPositions(posn)));
long end = stream.offset;
if (endGroup == includedRowGroups.length - 1) {
end += stream.length;
} else {
long nextGroupOffset = ri.getEntry(endGroup +
1).getPositions(posn);
end += RecordReaderUtils.estimateRgEndOffset(isCompressed,
- bufferSize, false,
nextGroupOffset, stream.length);
+ bufferSize, false,
nextGroupOffset,
+ stream.length);
}
if (alreadyRead < end) {
addChunk(result, stream, start, end - start);
diff --git
a/java/core/src/java/org/apache/orc/impl/reader/tree/BatchReader.java
b/java/core/src/java/org/apache/orc/impl/reader/tree/BatchReader.java
index 27f8f41..f7b0067 100644
--- a/java/core/src/java/org/apache/orc/impl/reader/tree/BatchReader.java
+++ b/java/core/src/java/org/apache/orc/impl/reader/tree/BatchReader.java
@@ -62,5 +62,6 @@ public abstract class BatchReader {
public abstract void skipRows(long rows, TypeReader.ReadPhase readPhase)
throws IOException;
- public abstract void seek(PositionProvider[] index, TypeReader.ReadPhase
readPhase) throws IOException;
+ public abstract void seek(PositionProvider[] index, TypeReader.ReadPhase
readPhase)
+ throws IOException;
}
diff --git
a/java/core/src/java/org/apache/orc/impl/reader/tree/PrimitiveBatchReader.java
b/java/core/src/java/org/apache/orc/impl/reader/tree/PrimitiveBatchReader.java
index 846ff42..bc2f5c1 100644
---
a/java/core/src/java/org/apache/orc/impl/reader/tree/PrimitiveBatchReader.java
+++
b/java/core/src/java/org/apache/orc/impl/reader/tree/PrimitiveBatchReader.java
@@ -39,7 +39,8 @@ public class PrimitiveBatchReader extends BatchReader {
resetBatch(batch, batchSize);
}
- public void startStripe(StripePlanner planner, TypeReader.ReadPhase
readPhase) throws IOException {
+ public void startStripe(StripePlanner planner, TypeReader.ReadPhase
readPhase)
+ throws IOException {
rootType.startStripe(planner, readPhase);
}
diff --git
a/java/core/src/java/org/apache/orc/impl/reader/tree/StructBatchReader.java
b/java/core/src/java/org/apache/orc/impl/reader/tree/StructBatchReader.java
index 08d9e4c..d724e75 100644
--- a/java/core/src/java/org/apache/orc/impl/reader/tree/StructBatchReader.java
+++ b/java/core/src/java/org/apache/orc/impl/reader/tree/StructBatchReader.java
@@ -88,8 +88,9 @@ public class StructBatchReader extends BatchReader {
}
}
- private void nextBatchForLevel(VectorizedRowBatch batch, int batchSize,
TypeReader.ReadPhase readPhase)
- throws IOException {
+ private void nextBatchForLevel(
+ VectorizedRowBatch batch, int batchSize, TypeReader.ReadPhase readPhase)
+ throws IOException {
TypeReader[] children = structReader.fields;
for (int i = 0; i < children.length
&& (vectorColumnCount == -1 || i < vectorColumnCount);
++i) {
@@ -100,7 +101,8 @@ public class StructBatchReader extends BatchReader {
}
@Override
- public void startStripe(StripePlanner planner, TypeReader.ReadPhase
readPhase) throws IOException {
+ public void startStripe(StripePlanner planner, TypeReader.ReadPhase
readPhase)
+ throws IOException {
TypeReader[] children = ((TreeReaderFactory.StructTreeReader)
rootType).fields;
for (int i = 0; i < children.length &&
(vectorColumnCount == -1 || i < vectorColumnCount); ++i) {
diff --git a/java/core/src/java/org/apache/orc/impl/writer/TreeWriterBase.java
b/java/core/src/java/org/apache/orc/impl/writer/TreeWriterBase.java
index 1381ee5..5f8fed8 100644
--- a/java/core/src/java/org/apache/orc/impl/writer/TreeWriterBase.java
+++ b/java/core/src/java/org/apache/orc/impl/writer/TreeWriterBase.java
@@ -140,7 +140,8 @@ public abstract class TreeWriterBase implements TreeWriter {
boolean signed, boolean isDirectV2,
WriterContext writer) {
if (isDirectV2) {
- boolean alignedBitpacking =
writer.getEncodingStrategy().equals(OrcFile.EncodingStrategy.SPEED);
+ boolean alignedBitpacking =
+ writer.getEncodingStrategy().equals(OrcFile.EncodingStrategy.SPEED);
return new RunLengthIntegerWriterV2(output, signed, alignedBitpacking);
} else {
return new RunLengthIntegerWriter(output, signed);
diff --git a/java/core/src/java/org/apache/orc/util/BloomFilter.java
b/java/core/src/java/org/apache/orc/util/BloomFilter.java
index 5e3269d..81783c2 100644
--- a/java/core/src/java/org/apache/orc/util/BloomFilter.java
+++ b/java/core/src/java/org/apache/orc/util/BloomFilter.java
@@ -234,7 +234,7 @@ public class BloomFilter {
* @param that - bloom filter to merge
*/
public void merge(BloomFilter that) {
- if (this != that && this.numBits == that.numBits && this.numHashFunctions
== that.numHashFunctions) {
+ if (this != that && numBits == that.numBits && numHashFunctions ==
that.numHashFunctions) {
this.bitSet.putAll(that.bitSet);
} else {
throw new IllegalArgumentException("BloomFilters are not compatible for
merging." +
diff --git a/java/core/src/java/org/threeten/extra/chrono/HybridChronology.java
b/java/core/src/java/org/threeten/extra/chrono/HybridChronology.java
index eee9fe6..8dc775d 100644
--- a/java/core/src/java/org/threeten/extra/chrono/HybridChronology.java
+++ b/java/core/src/java/org/threeten/extra/chrono/HybridChronology.java
@@ -133,7 +133,8 @@ public final class HybridChronology
/**
* Range of proleptic month.
*/
- static final ValueRange PROLEPTIC_MONTH_RANGE = ValueRange.of(-999_998 *
12L, 999_999 * 12L + 11);
+ static final ValueRange PROLEPTIC_MONTH_RANGE =
+ ValueRange.of(-999_998 * 12L, 999_999 * 12L + 11);
/**
* Private constructor, that is public to satisfy the {@code
ServiceLoader}.
@@ -448,7 +449,8 @@ public final class HybridChronology
//-----------------------------------------------------------------------
@Override // override for return type
- public HybridDate resolveDate(Map<TemporalField, Long> fieldValues,
ResolverStyle resolverStyle) {
+ public HybridDate resolveDate(
+ Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle)
{
return (HybridDate) super.resolveDate(fieldValues, resolverStyle);
}
diff --git a/java/pom.xml b/java/pom.xml
index e94f224..8c11856 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -286,7 +286,8 @@
<module name="NewlineAtEndOfFile">
</module>
<module name="LineLength">
- <property name="max" value="120"/>
+ <property name="max" value="100"/>
+ <property name="ignorePattern" value="a href|https://|^ +\*
.*$|^ *// .*$|throw new IllegalArgumentException"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
diff --git a/java/tools/src/java/org/apache/orc/tools/RowCount.java
b/java/tools/src/java/org/apache/orc/tools/RowCount.java
index 5259134..02281d6 100644
--- a/java/tools/src/java/org/apache/orc/tools/RowCount.java
+++ b/java/tools/src/java/org/apache/orc/tools/RowCount.java
@@ -41,7 +41,8 @@ public class RowCount {
if (status.isFile() && status.getPath().getName().endsWith(".orc")) {
Path filename = status.getPath();
try (Reader reader = OrcFile.createReader(filename,
OrcFile.readerOptions(conf))) {
- System.out.println(String.format("%s %d", filename.toString(),
reader.getNumberOfRows()));
+ System.out.println(String.format("%s %d",
+ filename.toString(), reader.getNumberOfRows()));
} catch (IOException ioe) {
bad += 1;
System.err.println("Failed to read " + filename);
diff --git a/java/tools/src/java/org/apache/orc/tools/convert/ConvertTool.java
b/java/tools/src/java/org/apache/orc/tools/convert/ConvertTool.java
index 26589df..268efea 100644
--- a/java/tools/src/java/org/apache/orc/tools/convert/ConvertTool.java
+++ b/java/tools/src/java/org/apache/orc/tools/convert/ConvertTool.java
@@ -47,7 +47,8 @@ import java.util.zip.GZIPInputStream;
* A conversion tool to convert CSV or JSON files into ORC files.
*/
public class ConvertTool {
- static final String DEFAULT_TIMESTAMP_FORMAT =
"yyyy[[-][/]]MM[[-][/]]dd[['T'][ ]]HH:mm:ss[ ][XXX][X]";
+ static final String DEFAULT_TIMESTAMP_FORMAT =
+ "yyyy[[-][/]]MM[[-][/]]dd[['T'][ ]]HH:mm:ss[ ][XXX][X]";
private final List<FileInformation> fileList;
private final TypeDescription schema;
diff --git a/site/develop/coding.md b/site/develop/coding.md
index 5b3713b..e0c36e2 100644
--- a/site/develop/coding.md
+++ b/site/develop/coding.md
@@ -13,7 +13,7 @@ title: Coding Guidelines
## Formatting
-* All files must have an 80 character maximum line length.
+* All files must have an 100 character maximum line length.
* Indentation should be 2 spaces.
* Files should use spaces instead of tabs.
* Wrapping lines