Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.spark.network.util;

import com.google.common.primitives.Ints;
import org.apache.commons.crypto.cipher.CryptoCipherFactory;

/**
* A central location that tracks all the settings we expose to users.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private static class EncryptionCheckerBootstrap extends ChannelOutboundHandlerAd
boolean foundEncryptionHandler;
String encryptHandlerName;

public EncryptionCheckerBootstrap(String encryptHandlerName) {
EncryptionCheckerBootstrap(String encryptHandlerName) {
this.encryptHandlerName = encryptHandlerName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public synchronized void close() throws IOException {
StorageUtils.dispose(byteBuffer);
}

//checkstyle.off: NoFinalizer
@Override
protected void finalize() throws IOException {
close();
}
//checkstyle.on: NoFinalizer
}
15 changes: 15 additions & 0 deletions dev/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@
<property name="file" value="dev/checkstyle-suppressions.xml"/>
</module>

<!--
If you wish to turn off checking for a section of code, you can put a comment in the source
before and after the section, with the following syntax:
// checkstyle:off no.XXX (such as checkstyle.off: NoFinalizer)
... // stuff that breaks the styles
// checkstyle:on
-->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="checkstyle.off\: ([\w\|]+)"/>
<property name="onCommentFormat" value="checkstyle.on\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

Copy link
Member

@HyukjinKwon HyukjinKwon Nov 15, 2016

Choose a reason for hiding this comment

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

Ah, I am sorry @ConeyLiu. I should have taken a look ahead first. I actually rather meant agreeing with the previous state if we should introduce such new property... Although I (as just one of contributors) think this might be worth, maybe this should be handled in a different PR.

Maybe, I think we could keep this change and then propose a new separate PR later if other people also agree with this.

Let us maybe please revert this change back and move back to the state which Sean approved for sure (but including the indentation fixes and newline fix). I will try to run the lint for sure as soon as you do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, maybe we need more advices.

Copy link
Member

Choose a reason for hiding this comment

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

Ah OK, this is needed in order to implement a checkstyle:off for Java like we use scalastyle:off for Scala? that's fine to do here if so, because it seems like we need it to get past the finalizer issue. I think that's a fine general mechanism to enable.

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
Expand Down Expand Up @@ -168,5 +182,6 @@
<module name="UnusedImports"/>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="FileContentsHolder"/>
Copy link
Member

Choose a reason for hiding this comment

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

What is this needed for, the checkstyle:off mechanism?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.spark.ml.feature.Interaction;
import org.apache.spark.ml.feature.VectorAssembler;
import org.apache.spark.ml.linalg.Vectors;
import org.apache.spark.sql.*;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.Metadata;
Expand Down Expand Up @@ -48,7 +47,7 @@ public static void main(String[] args) {
RowFactory.create(5, 9, 2, 7, 10, 7, 3),
RowFactory.create(6, 1, 1, 4, 2, 8, 4)
);

StructType schema = new StructType(new StructField[]{
Copy link
Member

Choose a reason for hiding this comment

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

If you are supposed to push more commits, let us revert this extra newline removal. I guess some guys don't like such changes. At least I was told twice before.

new StructField("id1", DataTypes.IntegerType, false, Metadata.empty()),
new StructField("id2", DataTypes.IntegerType, false, Metadata.empty()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static void main(String[] args) {
LogisticRegressionModel mlrModel = mlr.fit(training);

// Print the coefficients and intercepts for logistic regression with multinomial family
System.out.println("Multinomial coefficients: "
+ lrModel.coefficientMatrix() + "\nMultinomial intercepts: " + mlrModel.interceptVector());
System.out.println("Multinomial coefficients: " + lrModel.coefficientMatrix()
+ "\nMultinomial intercepts: " + mlrModel.interceptVector());
// $example off$

spark.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the number of elements from the first 8 bytes.
final long numElements = Platform.getLong(baseObject, baseOffset);
assert numElements >= 0 : "numElements (" + numElements + ") should >= 0";
assert numElements <= Integer.MAX_VALUE : "numElements (" + numElements + ") should <= Integer.MAX_VALUE";
assert numElements <= Integer.MAX_VALUE :
"numElements (" + numElements + ") should <= Integer.MAX_VALUE";

this.numElements = (int)numElements;
this.baseObject = baseObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the numBytes of key array from the first 8 bytes.
final long keyArraySize = Platform.getLong(baseObject, baseOffset);
assert keyArraySize >= 0 : "keyArraySize (" + keyArraySize + ") should >= 0";
assert keyArraySize <= Integer.MAX_VALUE : "keyArraySize (" + keyArraySize + ") should <= Integer.MAX_VALUE";
assert keyArraySize <= Integer.MAX_VALUE :
"keyArraySize (" + keyArraySize + ") should <= Integer.MAX_VALUE";
final int valueArraySize = sizeInBytes - (int)keyArraySize - 8;
assert valueArraySize >= 0 : "valueArraySize (" + valueArraySize + ") should >= 0";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.Set;

public class HiveHasherSuite {
private final static HiveHasher hasher = new HiveHasher();

@Test
public void testKnownIntegerInputs() {
Expand Down