Skip to content

Commit

Permalink
apply spotless-maven-plugin in trino module.
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangFru committed Oct 17, 2023
1 parent e8594e5 commit 7415823
Show file tree
Hide file tree
Showing 79 changed files with 8,081 additions and 5,840 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ public interface KVTable<T> extends Serializable, Closeable {
*/
void initialize(Iterator<T> dataStream) throws IOException;

/** @return if the rowData is filtered, return true. */
/**
* @return if the rowData is filtered, return true.
*/
boolean filter(T value);

/** @return if initialization is completed, return true. */
/**
* @return if initialization is completed, return true.
*/
boolean initialized();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ public class LogKafkaPartitionSplitState extends KafkaPartitionSplitState {
* opposite RowKind.
*/
private boolean retracting;
/** @see LogKafkaPartitionSplit#retractStopOffset */
/**
* @see LogKafkaPartitionSplit#retractStopOffset
*/
@Nullable private Long retractStopOffset;
/** @see LogKafkaPartitionSplit#revertStartOffset */
/**
* @see LogKafkaPartitionSplit#revertStartOffset
*/
@Nullable private Long revertStartOffset;
/** @see LogKafkaPartitionSplit#retractingEpicNo */
/**
* @see LogKafkaPartitionSplit#retractingEpicNo
*/
@Nullable private Long retractingEpicNo;
/** @see LogKafkaPartitionSplit#retractingUpstreamId */
/**
* @see LogKafkaPartitionSplit#retractingUpstreamId
*/
@Nullable private String retractingUpstreamId;
/** Key: upstream job id + "_" + epicNo, Value: epic start offset */
private final NavigableMap<String, Long> upstreamEpicStartOffsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ public class LogRecordWithRetractInfo<T> extends ConsumerRecord<byte[], byte[]>
* opposite RowKind.
*/
private final boolean retracting;
/** @see LogKafkaPartitionSplit#retractStopOffset */
/**
* @see LogKafkaPartitionSplit#retractStopOffset
*/
private final Long retractStoppingOffset;
/** @see LogKafkaPartitionSplit#revertStartOffset */
/**
* @see LogKafkaPartitionSplit#revertStartOffset
*/
private final Long revertStartingOffset;
/** @see LogKafkaPartitionSplit#retractingEpicNo */
/**
* @see LogKafkaPartitionSplit#retractingEpicNo
*/
private final Long retractingEpicNo;

private final LogData<T> logData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public LogicalType project(LogicalType logicalType) {
return this.project(TypeConversions.fromLogicalToDataType(logicalType)).getLogicalType();
}

/** @return {@code true} whether this projection is nested or not. */
/**
* @return {@code true} whether this projection is nested or not.
*/
public abstract boolean isNested();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void cancel() {}
false);
}

public void init() {};
public void init() {}
;

public abstract void doRun(
WatermarkGenerator<RowData> generator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public class TestArcticSource extends TestRowDataReaderFunction implements Seria
protected static final String sinkTableName = "test_sink_exactly_once";
protected static final TableIdentifier FAIL_TABLE_ID =
TableIdentifier.of(
TableTestHelper.TEST_CATALOG_NAME, TableTestHelper.TEST_DB_NAME, sinkTableName);;
TableTestHelper.TEST_CATALOG_NAME, TableTestHelper.TEST_DB_NAME, sinkTableName);
;

@Before
public void testSetup() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ public interface KVTable<T> extends Serializable, Closeable {
*/
void initialize(Iterator<T> dataStream) throws IOException;

/** @return if the rowData is filtered, return true. */
/**
* @return if the rowData is filtered, return true.
*/
boolean filter(T value);

/** @return if initialization is completed, return true. */
/**
* @return if initialization is completed, return true.
*/
boolean initialized();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ public class LogKafkaPartitionSplitState extends KafkaPartitionSplitState {
* opposite RowKind.
*/
private boolean retracting;
/** @see LogKafkaPartitionSplit#retractStopOffset */
/**
* @see LogKafkaPartitionSplit#retractStopOffset
*/
@Nullable private Long retractStopOffset;
/** @see LogKafkaPartitionSplit#revertStartOffset */
/**
* @see LogKafkaPartitionSplit#revertStartOffset
*/
@Nullable private Long revertStartOffset;
/** @see LogKafkaPartitionSplit#retractingEpicNo */
/**
* @see LogKafkaPartitionSplit#retractingEpicNo
*/
@Nullable private Long retractingEpicNo;
/** @see LogKafkaPartitionSplit#retractingUpstreamId */
/**
* @see LogKafkaPartitionSplit#retractingUpstreamId
*/
@Nullable private String retractingUpstreamId;
/** Key: upstream job id + "_" + epicNo, Value: epic start offset */
private final NavigableMap<String, Long> upstreamEpicStartOffsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ public class LogRecordWithRetractInfo<T> extends ConsumerRecord<byte[], byte[]>
* opposite RowKind.
*/
private final boolean retracting;
/** @see LogKafkaPartitionSplit#retractStopOffset */
/**
* @see LogKafkaPartitionSplit#retractStopOffset
*/
private final Long retractStoppingOffset;
/** @see LogKafkaPartitionSplit#revertStartOffset */
/**
* @see LogKafkaPartitionSplit#revertStartOffset
*/
private final Long revertStartingOffset;
/** @see LogKafkaPartitionSplit#retractingEpicNo */
/**
* @see LogKafkaPartitionSplit#retractingEpicNo
*/
private final Long retractingEpicNo;

private final LogData<T> logData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public LogicalType project(LogicalType logicalType) {
return this.project(TypeConversions.fromLogicalToDataType(logicalType)).getLogicalType();
}

/** @return {@code true} whether this projection is nested or not. */
/**
* @return {@code true} whether this projection is nested or not.
*/
public abstract boolean isNested();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void cancel() {}
false);
}

public void init() {};
public void init() {}
;

public abstract void doRun(
WatermarkGenerator<RowData> generator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public class TestArcticSource extends TestRowDataReaderFunction implements Seria
protected static final String sinkTableName = "test_sink_exactly_once";
protected static final TableIdentifier FAIL_TABLE_ID =
TableIdentifier.of(
TableTestHelper.TEST_CATALOG_NAME, TableTestHelper.TEST_DB_NAME, sinkTableName);;
TableTestHelper.TEST_CATALOG_NAME, TableTestHelper.TEST_DB_NAME, sinkTableName);
;

@Before
public void testSetup() throws IOException {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.7</version>
<version>1.15.0</version>
</googleJavaFormat>
<removeUnusedImports />
<importOrder>
Expand Down
13 changes: 13 additions & 0 deletions trino/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,19 @@
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
<sourceDirectory>src/main/java</sourceDirectory>
</build>
Expand Down
11 changes: 4 additions & 7 deletions trino/src/main/java/com/netease/arctic/ArcticErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@

package com.netease.arctic;

import static io.trino.spi.ErrorType.EXTERNAL;

import io.trino.spi.ErrorCode;
import io.trino.spi.ErrorCodeSupplier;
import io.trino.spi.ErrorType;

import static io.trino.spi.ErrorType.EXTERNAL;

/**
* Error code
*/
public enum ArcticErrorCode
implements ErrorCodeSupplier {
/** Error code */
public enum ArcticErrorCode implements ErrorCodeSupplier {
ARCTIC_BAD_DATA(4, EXTERNAL);

private final ErrorCode errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
import com.netease.arctic.catalog.ArcticCatalog;
import com.netease.arctic.table.TableMetaStore;

/**
* A interface of factory to generate ArcticCatalog
*/
/** A interface of factory to generate ArcticCatalog */
public interface ArcticCatalogFactory {

/**
* generate ArcticCatalog
*/
/** generate ArcticCatalog */
ArcticCatalog getArcticCatalog();

TableMetaStore getTableMetastore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@
import org.apache.iceberg.io.LocationProvider;
import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.StructLikeMap;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* A wrapper of {@link ArcticCatalog} to resolve sub table, such as "tableName#change","tableName#base"
* A wrapper of {@link ArcticCatalog} to resolve sub table, such as
* "tableName#change","tableName#base"
*/
public class ArcticCatalogSupportTableSuffix implements ArcticCatalog {

Expand All @@ -82,8 +84,7 @@ public String name() {
}

@Override
public void initialize(
AmsClient client, CatalogMeta meta, Map<String, String> properties) {
public void initialize(AmsClient client, CatalogMeta meta, Map<String, String> properties) {
arcticCatalog.initialize(client, meta, properties);
}

Expand Down Expand Up @@ -111,12 +112,18 @@ public List<TableIdentifier> listTables(String database) {
public ArcticTable loadTable(TableIdentifier tableIdentifier) {
TableNameResolve tableNameResolve = new TableNameResolve(tableIdentifier.getTableName());
if (tableNameResolve.withSuffix()) {
TableIdentifier newTableIdentifier = TableIdentifier.of(tableIdentifier.getCatalog(),
tableIdentifier.getDatabase(), tableNameResolve.getTableName());
TableIdentifier newTableIdentifier =
TableIdentifier.of(
tableIdentifier.getCatalog(),
tableIdentifier.getDatabase(),
tableNameResolve.getTableName());
ArcticTable arcticTable = arcticCatalog.loadTable(newTableIdentifier);
if (arcticTable.isUnkeyedTable()) {
throw new IllegalArgumentException("table " + newTableIdentifier + " is not keyed table can not use " +
"change or base suffix");
throw new IllegalArgumentException(
"table "
+ newTableIdentifier
+ " is not keyed table can not use "
+ "change or base suffix");
}
KeyedTable keyedTable = arcticTable.asKeyedTable();
if (tableNameResolve.isBase()) {
Expand All @@ -139,8 +146,7 @@ public boolean dropTable(TableIdentifier tableIdentifier, boolean purge) {
}

@Override
public TableBuilder newTableBuilder(
TableIdentifier identifier, Schema schema) {
public TableBuilder newTableBuilder(TableIdentifier identifier, Schema schema) {
return arcticCatalog.newTableBuilder(identifier, schema);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -22,9 +21,7 @@
import io.airlift.configuration.Config;
import io.airlift.configuration.ConfigDescription;

/**
* Arctic config
*/
/** Arctic config */
public class ArcticConfig {
private String catalogUrl;
private boolean hdfsImpersonationEnabled;
Expand Down
Loading

0 comments on commit 7415823

Please sign in to comment.