You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/07/23 21:31:07 UTC
[orc] branch main updated: ORC-858: Add
NoLineWrap/OneStatementPerLine/NeedBraces checkstyle rules (#760)
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 82ca66a ORC-858: Add NoLineWrap/OneStatementPerLine/NeedBraces checkstyle rules (#760)
82ca66a is described below
commit 82ca66ac068cfa16088b401a4b72cbcfed0e8fb7
Author: William Hyun <wi...@apache.org>
AuthorDate: Fri Jul 23 14:31:00 2021 -0700
ORC-858: Add NoLineWrap/OneStatementPerLine/NeedBraces checkstyle rules (#760)
### What changes were proposed in this pull request?
This PR aims to add NoLineWrap, OneStatementPerLine, NeedBraces checkstyle rules.
### Why are the changes needed?
This will improve code quality.
### How was this patch tested?
Pass the GHA.
---
.../org/apache/orc/impl/DataReaderProperties.java | 2 +-
.../org/apache/orc/impl/RunLengthIntegerReaderV2.java | 19 ++++++++++++++-----
.../java/org/apache/orc/impl/TreeReaderFactory.java | 6 ++++--
java/pom.xml | 5 +++++
.../java/org/apache/orc/tools/convert/JsonReader.java | 3 ++-
5 files changed, 26 insertions(+), 9 deletions(-)
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 99b3fb8..b128d9b 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,7 @@ 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/RunLengthIntegerReaderV2.java b/java/core/src/java/org/apache/orc/impl/RunLengthIntegerReaderV2.java
index b2b3dad..e205be5 100644
--- a/java/core/src/java/org/apache/orc/impl/RunLengthIntegerReaderV2.java
+++ b/java/core/src/java/org/apache/orc/impl/RunLengthIntegerReaderV2.java
@@ -63,11 +63,20 @@ public class RunLengthIntegerReaderV2 implements IntegerReader {
}
currentEncoding = encodings[(firstByte >>> 6) & 0x03];
switch (currentEncoding) {
- case SHORT_REPEAT: readShortRepeatValues(firstByte); break;
- case DIRECT: readDirectValues(firstByte); break;
- case PATCHED_BASE: readPatchedBaseValues(firstByte); break;
- case DELTA: readDeltaValues(firstByte); break;
- default: throw new IOException("Unknown encoding " + currentEncoding);
+ case SHORT_REPEAT:
+ readShortRepeatValues(firstByte);
+ break;
+ case DIRECT:
+ readDirectValues(firstByte);
+ break;
+ case PATCHED_BASE:
+ readPatchedBaseValues(firstByte);
+ break;
+ case DELTA:
+ readDeltaValues(firstByte);
+ break;
+ default:
+ throw new IOException("Unknown encoding " + currentEncoding);
}
}
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 eeff360..cc44b03 100644
--- a/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
+++ b/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
@@ -1831,8 +1831,9 @@ public class TreeReaderFactory {
if (idx - previousIdx > 0) {
valueReader.skip(countNonNullRowsInRange(result.isNull, previousIdx, idx));
}
- if (!result.isNull[r])
+ if (!result.isNull[r]) {
result.vector[idx].setFromLongAndScale(valueReader.next(), scale);
+ }
previousIdx = idx + 1;
}
valueReader.skip(countNonNullRowsInRange(result.isNull, previousIdx, batchSize));
@@ -2284,8 +2285,9 @@ public class TreeReaderFactory {
// and set strings one by one
if (filterContext.isSelectedInUse()) {
// Set all string values to null - offset and length is zero
- for (int i = 0; i < batchSize; i++)
+ for (int i = 0; i < batchSize; i++) {
result.setRef(i, dictionaryBufferInBytesCache, 0, 0);
+ }
// Read selected rows from stream
for (int i = 0; i != filterContext.getSelectedSize(); i++) {
int idx = filterContext.getSelected()[i];
diff --git a/java/pom.xml b/java/pom.xml
index 4597e08..8352fc2 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -286,6 +286,11 @@
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="UnusedImports"/>
+ <module name="NoLineWrap"/>
+ <module name="OneStatementPerLine"/>
+ <module name="NeedBraces">
+ <property name="allowSingleLineStatement" value="true"/>
+ </module>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
</module>
diff --git a/java/tools/src/java/org/apache/orc/tools/convert/JsonReader.java b/java/tools/src/java/org/apache/orc/tools/convert/JsonReader.java
index 0118c20..1611779 100644
--- a/java/tools/src/java/org/apache/orc/tools/convert/JsonReader.java
+++ b/java/tools/src/java/org/apache/orc/tools/convert/JsonReader.java
@@ -263,8 +263,9 @@ public class JsonReader implements RecordReader {
public MapColumnConverter(TypeDescription schema) {
TypeDescription keyType = schema.getChildren().get(0);
- if (keyType.getCategory() != TypeDescription.Category.STRING)
+ if (keyType.getCategory() != TypeDescription.Category.STRING) {
throw new IllegalArgumentException("JSON can only support MAP key in STRING type: " + schema);
+ }
keyConverter = createConverter(keyType);
valueConverter = createConverter(schema.getChildren().get(1));
}