Skip to content

Commit

Permalink
Build: Upgrade to Gradle 7.x (apache#2826)
Browse files Browse the repository at this point in the history
* Build: Upgrade to Gradle 7
* Build: Properly exclude stuff from shadedJar content
This change is required after upgrading to ShadowJar plugin 7.0.0 due to
GradleUp/shadow#505 not excluding files
the same way it used to.
* Fix ErrorProne / errors due to newer ErrorProne version
* Fix checkstyle violations due to newer Checkstyle version
  • Loading branch information
nastra authored Sep 17, 2021
1 parent 604fd28 commit 57477c3
Show file tree
Hide file tree
Showing 19 changed files with 644 additions and 394 deletions.
3 changes: 1 addition & 2 deletions .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypecastParenPad"/> <!-- Java Style Guide: Horizontal whitespace -->
<module name="UnnecessaryParentheses"/>
<module name="UnusedImports"> <!-- Java Style Guide: No unused imports -->
<property name="processJavadoc" value="true"/>
</module>
Expand Down Expand Up @@ -420,7 +419,7 @@
<property name="max" value="12"/>
</module>
<module name="JavadocMethod"> <!-- Java Style Guide: Where Javadoc is used -->
<property name="scope" value="public"/>
<property name="accessModifiers" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void nextDictEncodedBatch(
protected abstract void nextVal(
FieldVector vector, int idx, ValuesAsBytesReader valuesReader, int typeWidth, byte[] byteArray);
protected abstract void nextDictEncodedVal(
FieldVector vector, int startOffset, VectorizedDictionaryEncodedParquetValuesReader reader,
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode);
}

Expand All @@ -320,10 +320,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.timestampMillisDictEncodedReader().nextBatch(vector,
idx, numValues, dict, nullabilityHolder, typeWidth);
idx, numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
vector.getDataBuffer().setLong((long) idx * typeWidth, dict.decodeToLong(reader.readInteger()) * 1000);
}
Expand All @@ -342,10 +342,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.fixedWidthBinaryDictEncodedReader()
.nextBatch(vector, idx, numValues, dict, nullabilityHolder, typeWidth);
.nextBatch(vector, idx, numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
ByteBuffer buffer = dict.decodeToBinary(reader.readInteger()).toByteBuffer();
vector.getDataBuffer().setBytes(
Expand All @@ -366,10 +366,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.fixedLengthDecimalDictEncodedReader()
.nextBatch(vector, idx, numValues, dict, nullabilityHolder, typeWidth);
.nextBatch(vector, idx, numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
ByteBuffer decimalBytes = dict.decodeToBinary(reader.readInteger()).toByteBuffer();
byte[] vectorBytes = new byte[typeWidth];
Expand All @@ -390,10 +390,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.fixedSizeBinaryDictEncodedReader().nextBatch(vector, idx,
numValues, dict, nullabilityHolder, typeWidth);
numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
byte[] bytes = dict.decodeToBinary(reader.readInteger()).getBytes();
byte[] vectorBytes = new byte[typeWidth];
Expand Down Expand Up @@ -427,10 +427,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.varWidthBinaryDictEncodedReader().nextBatch(vector, idx,
numValues, dict, nullabilityHolder, typeWidth);
numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
((BaseVariableWidthVector) vector).setSafe(
idx, dict.decodeToBinary(reader.readInteger()).getBytesUnsafe());
Expand All @@ -448,10 +448,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.intBackedDecimalDictEncodedReader()
.nextBatch(vector, idx, numValues, dict, nullabilityHolder, typeWidth);
.nextBatch(vector, idx, numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
((DecimalVector) vector).set(idx, dict.decodeToInt(reader.readInteger()));
}
Expand All @@ -468,10 +468,10 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
if (Mode.RLE.equals(mode)) {
reader.longBackedDecimalDictEncodedReader()
.nextBatch(vector, idx, numValues, dict, nullabilityHolder, typeWidth);
.nextBatch(vector, idx, numValuesToRead, dict, nullabilityHolder, typeWidth);
} else if (Mode.PACKED.equals(mode)) {
((DecimalVector) vector).set(
idx, dict.decodeToLong(reader.readInteger()));
Expand All @@ -489,7 +489,7 @@ protected void nextVal(
@Override
protected void nextDictEncodedVal(
FieldVector vector, int idx, VectorizedDictionaryEncodedParquetValuesReader reader,
int numValues, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
int numValuesToRead, Dictionary dict, NullabilityHolder nullabilityHolder, int typeWidth, Mode mode) {
throw new UnsupportedOperationException();
}
}
Expand Down
15 changes: 13 additions & 2 deletions baseline.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ subprojects {
apply plugin: 'com.palantir.baseline-checkstyle'
apply plugin: 'com.palantir.baseline-error-prone'
}
apply plugin: 'com.palantir.baseline-scalastyle'
apply plugin: 'com.github.alisiikh.scalastyle'
apply plugin: 'com.palantir.baseline-class-uniqueness'
apply plugin: 'com.palantir.baseline-reproducibility'
apply plugin: 'com.palantir.baseline-exact-dependencies'
Expand All @@ -47,7 +47,7 @@ subprojects {

// So we apply Spotless manually to get a similar effect to baseline-format, but change the
// import order.
pluginManager.withPlugin('com.diffplug.gradle.spotless') {
pluginManager.withPlugin('com.diffplug.spotless') {
spotless {
java {
target 'src/main/java/**/*.java', 'src/test/java/**/*.java', 'src/jmh/java/**/*.java'
Expand Down Expand Up @@ -82,4 +82,15 @@ subprojects {
)
}
}

pluginManager.withPlugin('com.github.alisiikh.scalastyle') {
scalastyle {
config = file("${rootDir}/project/scalastyle_config.xml")
inputEncoding = 'UTF-8'
outputEncoding = 'UTF-8'
failOnWarning = false
verbose = false
quiet = false
}
}
}
Loading

0 comments on commit 57477c3

Please sign in to comment.