1
0

[checkstyle] Add ConstantName java checkstyle rule (#1066)

* add SimplifyBooleanExpression java checkstyle rule
* collapse empty tags in scalastyle file
This commit is contained in:
lamber-ken
2019-12-04 18:59:15 +08:00
committed by leesf
parent b2d9638bea
commit b3e0ebbc4a
38 changed files with 192 additions and 186 deletions

View File

@@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(HoodieClientTestHarness.class);
private static final Logger LOG = LoggerFactory.getLogger(HoodieClientTestHarness.class);
protected transient JavaSparkContext jsc = null;
protected transient SQLContext sqlContext;
@@ -119,13 +119,13 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im
*/
protected void cleanupSparkContexts() {
if (sqlContext != null) {
logger.info("Clearing sql context cache of spark-session used in previous test-case");
LOG.info("Clearing sql context cache of spark-session used in previous test-case");
sqlContext.clearCache();
sqlContext = null;
}
if (jsc != null) {
logger.info("Closing spark context used in previous test-case");
LOG.info("Closing spark context used in previous test-case");
jsc.close();
jsc.stop();
jsc = null;
@@ -157,7 +157,7 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im
*/
protected void cleanupFileSystem() throws IOException {
if (fs != null) {
logger.warn("Closing file-system instance used in previous test-run");
LOG.warn("Closing file-system instance used in previous test-run");
fs.close();
}
}

View File

@@ -72,7 +72,7 @@ import java.util.stream.Collectors;
*/
public class HoodieClientTestUtils {
private static final transient Logger log = LogManager.getLogger(HoodieClientTestUtils.class);
private static final transient Logger LOG = LogManager.getLogger(HoodieClientTestUtils.class);
private static final Random RANDOM = new Random();
public static List<WriteStatus> collectStatuses(Iterator<List<WriteStatus>> statusListItr) {
@@ -166,7 +166,7 @@ public class HoodieClientTestUtils {
try {
HashMap<String, String> paths =
getLatestFileIDsToFullPath(basePath, commitTimeline, Arrays.asList(commitInstant));
log.info("Path :" + paths.values());
LOG.info("Path :" + paths.values());
return sqlContext.read().parquet(paths.values().toArray(new String[paths.size()]))
.filter(String.format("%s ='%s'", HoodieRecord.COMMIT_TIME_METADATA_FIELD, commitTime));
} catch (Exception e) {

View File

@@ -46,7 +46,7 @@ import java.util.zip.InflaterInputStream;
*/
public class TestRawTripPayload implements HoodieRecordPayload<TestRawTripPayload> {
private static final transient ObjectMapper mapper = new ObjectMapper();
private static final transient ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private String partitionPath;
private String rowKey;
private byte[] jsonDataCompressed;
@@ -71,7 +71,7 @@ public class TestRawTripPayload implements HoodieRecordPayload<TestRawTripPayloa
public TestRawTripPayload(String jsonData) throws IOException {
this.jsonDataCompressed = compressData(jsonData);
this.dataSize = jsonData.length();
Map<String, Object> jsonRecordMap = mapper.readValue(jsonData, Map.class);
Map<String, Object> jsonRecordMap = OBJECT_MAPPER.readValue(jsonData, Map.class);
this.rowKey = jsonRecordMap.get("_row_key").toString();
this.partitionPath = jsonRecordMap.get("time").toString().split("T")[0].replace("-", "/");
this.isDeleted = false;