Skip to content

Commit

Permalink
[HUDI-8012] Update checkstyle.xml and fix checkstyle errors (apache#1…
Browse files Browse the repository at this point in the history
…1672)

* [HUDI-8012] Update checkstyle.xml based on the new release

* Upgrade checkstyle and plugin

* Fix checkstyle errors

* Suppress checkstyle error for sql
  • Loading branch information
yihua authored Aug 12, 2024
1 parent b7e11b1 commit c71b2da
Show file tree
Hide file tree
Showing 68 changed files with 209 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public class ITTestGluePartitionPushdown {
private Column[] partitionsColumn = {Column.builder().name("part1").type("int").build(), Column.builder().name("part2").type("string").build()};
List<FieldSchema> partitionsFieldSchema = Arrays.asList(new FieldSchema("part1", "int"), new FieldSchema("part2", "string"));

public ITTestGluePartitionPushdown() throws IOException {}
public ITTestGluePartitionPushdown() throws IOException {
}

@BeforeEach
public void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.function.Function;
import java.util.stream.Collectors;


/**
* Helper class to render table for hoodie-cli.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

public class ShellEvaluationResultUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ShellEvaluationResultUtil.class);
private ShellEvaluationResultUtil() {}

private ShellEvaluationResultUtil() {
}

public static boolean isSuccess(Object shellEvaluationResult) {
boolean hasError = shellEvaluationResult instanceof Throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ private List<RenameOpResult> runRenamingOps(HoodieTableMetaClient metaClient,
*/
public static class RenameOpResult extends OperationResult<RenameInfo> {

public RenameOpResult() {}
public RenameOpResult() {
}

public RenameOpResult(Pair<HoodieLogFile, HoodieLogFile> op, boolean success, Option<Exception> exception) {
super(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ private void createNodeIfNotExists(String path) throws Exception {
}
}
}



// Only used for testing
public ZookeeperBasedLockProvider(
final LockConfiguration lockConfiguration, final CuratorFramework curatorFrameworkClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public LazyIterableIterator(Iterator<I> in) {
/**
* Called once, before any elements are processed.
*/
protected void start() {}
protected void start() {
}

/**
* Block computation to be overwritten by sub classes.
Expand All @@ -55,7 +56,8 @@ protected void start() {}
/**
* Called once, after all elements are processed.
*/
protected void end() {}
protected void end() {
}

//////////////////
// iterable implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ public static <T> Function<HoodieRecord<T>, HoodieInsertValueGenResult<HoodieRec
}

@Override
protected void start() {}
protected void start() {
}

@Override
protected void end() {}
protected void end() {
}

protected CopyOnWriteInsertHandler getInsertHandler() {
return new CopyOnWriteInsertHandler(hoodieConfig, instantTime, areRecordsSorted, hoodieTable, idPrefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class OperationResult<T> implements Serializable {
private boolean success;
private Option<Exception> exception;

public OperationResult() {}
public OperationResult() {
}

public OperationResult(T operation, boolean success, Option<Exception> exception) {
this.operation = operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

import static org.apache.hudi.common.table.timeline.HoodieInstant.UNDERSCORE;


/**
* Version 7 is going to be placeholder version for bridge release 0.16.0.
* Version 8 is the placeholder version to track 1.x.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,22 @@ public DummyMetricsReporter(Properties props, MetricRegistry registry) {
}

@Override
public void start() {}
public void start() {
}

@Override
public void report() {}
public void report() {
}

@Override
public void stop() {}
public void stop() {
}
}

public static class IllegalTestMetricsReporter {

public IllegalTestMetricsReporter(Properties props, MetricRegistry registry) {}
public IllegalTestMetricsReporter(Properties props, MetricRegistry registry) {
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.IOException;
import java.util.List;


/**
* Tests for write helpers
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ private static HoodieRowDataFileWriter newParquetInternalRowFileWriter(
HoodieRowDataParquetWriteSupport writeSupport =
new HoodieRowDataParquetWriteSupport((Configuration) table.getStorageConf().unwrap(), rowType, filter);
return new HoodieRowDataParquetWriter(
convertToStoragePath(path), new HoodieParquetConfig<>(
writeSupport,
getCompressionCodecName(writeConfig.getParquetCompressionCodec()),
writeConfig.getParquetBlockSize(),
writeConfig.getParquetPageSize(),
writeConfig.getParquetMaxFileSize(),
new HadoopStorageConfiguration(writeSupport.getHadoopConf()),
writeConfig.getParquetCompressionRatio(),
writeConfig.parquetDictionaryEnabled()));
convertToStoragePath(path),
new HoodieParquetConfig<>(
writeSupport,
getCompressionCodecName(writeConfig.getParquetCompressionCodec()),
writeConfig.getParquetBlockSize(),
writeConfig.getParquetPageSize(),
writeConfig.getParquetMaxFileSize(),
new HadoopStorageConfiguration(writeSupport.getHadoopConf()),
writeConfig.getParquetCompressionRatio(),
writeConfig.parquetDictionaryEnabled()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class JavaUpgradeDowngradeHelper implements SupportsUpgradeDowngrade {
private static final JavaUpgradeDowngradeHelper SINGLETON_INSTANCE =
new JavaUpgradeDowngradeHelper();

private JavaUpgradeDowngradeHelper() {}
private JavaUpgradeDowngradeHelper() {
}

public static JavaUpgradeDowngradeHelper getInstance() {
return SINGLETON_INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public class SparkHoodieBloomIndexHelper extends BaseHoodieBloomIndexHelper {
private static final SparkHoodieBloomIndexHelper SINGLETON_INSTANCE =
new SparkHoodieBloomIndexHelper();

private SparkHoodieBloomIndexHelper() {}
private SparkHoodieBloomIndexHelper() {
}

public static SparkHoodieBloomIndexHelper getInstance() {
return SINGLETON_INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ public List<WriteStatus> getWriteStatuses() throws IOException {
return writeStatusList;
}

public void abort() {}
public void abort() {
}

public void close() throws IOException {
for (HoodieRowCreateHandle rowCreateHandle : handles.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public long getLen() {
}

@Override
public void setWorkingDirectory(Path path) {}
public void setWorkingDirectory(Path path) {
}

@Override
public Path getWorkingDirectory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.hudi.common.util.queue.WaitStrategyFactory;
import org.apache.hudi.config.HoodieWriteConfig;
import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.execution.HoodieLazyInsertIterable.HoodieInsertValueGenResult;
import org.apache.hudi.testutils.HoodieSparkClientTestHarness;

import org.apache.avro.generic.IndexedRecord;
Expand Down Expand Up @@ -114,13 +115,13 @@ public void testRecordReading() {
}
});

HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer>() {
HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer>() {

private int count = 0;

@Override
public void consume(HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord> record) {
public void consume(HoodieInsertValueGenResult<HoodieRecord> record) {
count++;
afterRecord.add((HoodieAvroRecord) record.getResult());
try {
Expand All @@ -136,7 +137,7 @@ public void consume(HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRe
public Integer finish() {
return count;
}
};
};

DisruptorExecutor<HoodieRecord, Tuple2<HoodieRecord, Option<IndexedRecord>>, Integer> exec = null;

Expand Down Expand Up @@ -170,7 +171,7 @@ public void testCompositeProducerRecordReading() throws Exception {
final int numProducers = 40;
final List<List<HoodieRecord>> recs = new ArrayList<>();

final DisruptorMessageQueue<HoodieRecord, HoodieLazyInsertIterable.HoodieInsertValueGenResult> queue =
final DisruptorMessageQueue<HoodieRecord, HoodieInsertValueGenResult> queue =
new DisruptorMessageQueue(1024, getTransformerInternal(HoodieTestDataGenerator.AVRO_SCHEMA, writeConfig),
"BLOCKING_WAIT", numProducers, new Runnable() {
@Override
Expand Down Expand Up @@ -223,11 +224,11 @@ public void run() {
IntStream.range(0, numProducers).boxed().collect(Collectors.toMap(Function.identity(), x -> 0));

// setup consumer and start disruptor
HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer>() {
HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer>() {

@Override
public void consume(HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord> payload) {
public void consume(HoodieInsertValueGenResult<HoodieRecord> payload) {
// Read recs and ensure we have covered all producer recs.
final HoodieRecord rec = payload.getResult();
Pair<Integer, Integer> producerPos = keyToProducerAndIndexMap.get(rec.getRecordKey());
Expand Down Expand Up @@ -299,23 +300,24 @@ public void testException() throws Exception {
}));
}
}

HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord>, Integer>() {

int count = 0;
@Override
public void consume(HoodieLazyInsertIterable.HoodieInsertValueGenResult<HoodieRecord> payload) {
// Read recs and ensure we have covered all producer recs.
final HoodieRecord rec = payload.getResult();
count++;
}

@Override
public Integer finish() {
return count;
}
};
HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer> consumer =
new HoodieConsumer<HoodieInsertValueGenResult<HoodieRecord>, Integer>() {

int count = 0;

@Override
public void consume(HoodieInsertValueGenResult<HoodieRecord> payload) {
// Read recs and ensure we have covered all producer recs.
final HoodieRecord rec = payload.getResult();
count++;
}

@Override
public Integer finish() {
return count;
}
};

DisruptorExecutor<HoodieRecord, Tuple2<HoodieRecord, Option<IndexedRecord>>, Integer> exec = new DisruptorExecutor(1024,
producers, consumer, getTransformerInternal(HoodieTestDataGenerator.AVRO_SCHEMA, writeConfig),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public class AvroSchemaUtils {

private static final Logger LOG = LoggerFactory.getLogger(AvroSchemaUtils.class);

private AvroSchemaUtils() {}
private AvroSchemaUtils() {
}

/**
* See {@link #isSchemaCompatible(Schema, Schema, boolean, boolean)} doc for more details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import static org.apache.hudi.common.util.StringUtils.fromUTF8Bytes;
import static org.apache.hudi.common.util.StringUtils.getUTF8Bytes;


/**
* Custom serializer used for generic Avro containers.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public MercifulJsonConverter() {
this(false, "__");
}


/**
* Allows enabling sanitization and allows choice of invalidCharMask for sanitization
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static ClusteringGroupInfo create(HoodieClusteringGroup clusteringGroup)

// Only for serialization/de-serialization
@Deprecated
public ClusteringGroupInfo() {}
public ClusteringGroupInfo() {
}

private ClusteringGroupInfo(final List<ClusteringOperation> operations, final int numOutputGroups) {
this.operations = operations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static ClusteringOperation create(HoodieSliceInfo sliceInfo) {

// Only for serialization/de-serialization
@Deprecated
public ClusteringOperation() {}
public ClusteringOperation() {
}

private ClusteringOperation(final String dataFilePath, final List<String> deltaFilePaths, final String fileId,
final String partitionPath, final String bootstrapFilePath, final int version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public class CompactionOperation implements Serializable {

// Only for serialization/de-serialization
@Deprecated
public CompactionOperation() {}
public CompactionOperation() {
}

public CompactionOperation(String fileId, String partitionPath, String baseInstantTime,
Option<String> dataFileCommitTime, List<String> deltaFileNames, Option<String> dataFileName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class HoodieKey implements Serializable {
private String partitionPath;

// Required for serializer
public HoodieKey() {}
public HoodieKey() {
}

public HoodieKey(String recordKey, String partitionPath) {
this.recordKey = recordKey;
Expand Down
Loading

0 comments on commit c71b2da

Please sign in to comment.