1
0

[MINOR] Fix typo and others (#2164)

* remove HoodieSerializationException that will never be throw
* remove unused method, make HoodieException more readable
* fix typo
This commit is contained in:
dugenkui
2020-10-12 08:52:44 +08:00
committed by GitHub
parent 86db4da33c
commit d4d4c8c899
6 changed files with 9 additions and 20 deletions

View File

@@ -23,7 +23,7 @@ import org.apache.hudi.common.util.StringUtils;
import org.apache.hudi.common.util.collection.Pair;
import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.exception.HoodieIOException;
import org.apache.hudi.exception.SchemaCompatabilityException;
import org.apache.hudi.exception.SchemaCompatibilityException;
import org.apache.avro.Conversions.DecimalConversion;
import org.apache.avro.JsonProperties;
@@ -321,7 +321,7 @@ public class HoodieAvroUtils {
}
}
if (!GenericData.get().validate(newSchema, newRecord)) {
throw new SchemaCompatabilityException(
throw new SchemaCompatibilityException(
"Unable to validate the rewritten record " + record + " against schema " + newSchema);
}
return newRecord;

View File

@@ -319,7 +319,7 @@ public class HoodieLogFileReader implements HoodieLogFormat.Reader {
boolean hasMagic = hasNextMagic();
if (!hasMagic) {
throw new CorruptedLogFileException(
logFile + "could not be read. Did not find the magic bytes at the start of the block");
logFile + " could not be read. Did not find the magic bytes at the start of the block");
}
return hasMagic;
} catch (EOFException e) {

View File

@@ -18,8 +18,6 @@
package org.apache.hudi.common.util;
import org.apache.hudi.exception.HoodieSerializationException;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
@@ -72,7 +70,6 @@ public class SerializationUtils {
* @param objectData the serialized object, must not be null
* @return the deserialized object
* @throws IllegalArgumentException if {@code objectData} is {@code null}
* @throws HoodieSerializationException (runtime) if the serialization fails
*/
public static <T> T deserialize(final byte[] objectData) {
if (objectData == null) {

View File

@@ -47,12 +47,4 @@ public class HoodieException extends RuntimeException implements Serializable {
super(t);
}
protected static String format(String message, Object... args) {
String[] argStrings = new String[args.length];
for (int i = 0; i < args.length; i += 1) {
argStrings[i] = String.valueOf(args[i]);
}
return String.format(String.valueOf(message), (Object[]) argStrings);
}
}

View File

@@ -21,17 +21,17 @@ package org.apache.hudi.exception;
/**
* An exception thrown when schema has compatibility problems.
*/
public class SchemaCompatabilityException extends HoodieException {
public class SchemaCompatibilityException extends HoodieException {
public SchemaCompatabilityException(String message) {
public SchemaCompatibilityException(String message) {
super(message);
}
public SchemaCompatabilityException(String message, Throwable t) {
public SchemaCompatibilityException(String message, Throwable t) {
super(message, t);
}
public SchemaCompatabilityException(Throwable t) {
public SchemaCompatibilityException(Throwable t) {
super(t);
}
}

View File

@@ -20,7 +20,7 @@ package org.apache.hudi.avro;
import org.apache.avro.JsonProperties;
import org.apache.hudi.common.model.HoodieRecord;
import org.apache.hudi.exception.SchemaCompatabilityException;
import org.apache.hudi.exception.SchemaCompatibilityException;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
@@ -147,7 +147,7 @@ public class TestHoodieAvroUtils {
rec.put("non_pii_col", "val1");
rec.put("pii_col", "val2");
rec.put("timestamp", 3.5);
assertThrows(SchemaCompatabilityException.class, () -> HoodieAvroUtils.rewriteRecord(rec, new Schema.Parser().parse(SCHEMA_WITH_NON_NULLABLE_FIELD)));
assertThrows(SchemaCompatibilityException.class, () -> HoodieAvroUtils.rewriteRecord(rec, new Schema.Parser().parse(SCHEMA_WITH_NON_NULLABLE_FIELD)));
}
@Test