This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new f65bf52c1eee refactor: Add Lombok annotations to hudi-common module
(part 1) (#17630)
f65bf52c1eee is described below
commit f65bf52c1eeed2d9d052ef239abb5b2aa786ccea
Author: voonhous <[email protected]>
AuthorDate: Sat Dec 20 08:35:14 2025 +0800
refactor: Add Lombok annotations to hudi-common module (part 1) (#17630)
---
.../org/apache/hudi/BaseHoodieTableFileIndex.java | 70 +++++-----------------
.../org/apache/hudi/avro/AvroLogicalTypeEnum.java | 14 ++---
.../AvroSchemaComparatorForSchemaEvolution.java | 6 +-
.../apache/hudi/avro/AvroSchemaCompatibility.java | 18 +++---
.../java/org/apache/hudi/avro/AvroSchemaUtils.java | 14 ++---
.../apache/hudi/avro/HoodieAvroWrapperUtils.java | 20 ++-----
.../org/apache/hudi/avro/JoinedGenericRecord.java | 8 +--
.../java/org/apache/hudi/avro/JsonEncoder.java | 12 ++--
.../transaction/lock/InProcessLockProvider.java | 28 ++++-----
.../hudi/exception/HoodieMetaSyncException.java | 9 ++-
.../apache/hudi/expression/BinaryExpression.java | 26 +++-----
.../java/org/apache/hudi/expression/Literal.java | 21 ++-----
.../org/apache/hudi/expression/NameReference.java | 13 ++--
.../org/apache/hudi/expression/Predicates.java | 9 ++-
.../hudi/index/secondary/HoodieSecondaryIndex.java | 25 ++------
.../index/secondary/SecondaryIndexManager.java | 15 +++--
.../hudi/common/data/CloseValidationIterator.java | 8 +--
.../common/model/TestHoodieCommitMetadata.java | 7 +--
.../hudi/common/table/read/buffer/TestRecord.java | 33 ++--------
.../hudi/common/testutils/CompactionTestUtils.java | 8 +--
.../HoodieAdaptablePayloadDataGenerator.java | 10 +---
.../common/testutils/HoodieTestDataGenerator.java | 52 +++-------------
.../hudi/common/testutils/RawTripTestPayload.java | 13 ++--
.../hudi/common/testutils/SchemaTestUtil.java | 5 +-
.../minicluster/ZookeeperTestService.java | 20 +++----
.../testutils/reader/DataGenerationPlan.java | 43 ++-----------
.../testutils/reader/HoodieFileSliceTestUtils.java | 2 +-
.../TestClosableSortedDedupingIterator.java | 6 +-
.../common/util/collection/TestRocksDBDAO.java | 51 ++--------------
.../util/collection/TestSortingIterator.java | 12 ++--
.../HoodieBackedTestDelayedTableMetadata.java | 11 ++--
.../hudi/tableformat/TestActiveTimeline.java | 7 +--
.../apache/hudi/tableformat/TestTableFormat.java | 6 +-
.../hudi/timeline/TestTimelineServiceClient.java | 21 ++-----
.../org/apache/hudi/ExpressionIndexSupport.scala | 2 +-
.../scala/org/apache/hudi/HoodieFileIndex.scala | 2 +-
.../hudi/MergeOnReadIncrementalRelationV1.scala | 2 +-
.../hudi/MergeOnReadIncrementalRelationV2.scala | 2 +-
.../apache/hudi/PartitionBucketIndexSupport.scala | 2 +-
.../org/apache/hudi/SparkBaseIndexSupport.scala | 2 +-
.../apache/hudi/SparkHoodieTableFileIndex.scala | 8 +--
.../org/apache/hudi/TestHoodieFileIndex.scala | 2 +-
42 files changed, 185 insertions(+), 460 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java
b/hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java
index e25a5224d36a..059ada25e6ae 100644
--- a/hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java
+++ b/hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java
@@ -54,8 +54,10 @@ import org.apache.hudi.storage.HoodieStorage;
import org.apache.hudi.storage.StoragePath;
import org.apache.hudi.storage.StoragePathInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Value;
+import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.io.Serializable;
@@ -66,7 +68,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -89,17 +90,21 @@ import static
org.apache.hudi.common.table.timeline.TimelineUtils.validateTimest
* <li>Query instant/range</li>
* </ul>
*/
+@Slf4j
public abstract class BaseHoodieTableFileIndex implements AutoCloseable {
- private static final Logger LOG =
LoggerFactory.getLogger(BaseHoodieTableFileIndex.class);
+ @Getter(AccessLevel.PROTECTED)
private final String[] partitionColumns;
+ @Getter
protected final HoodieMetadataConfig metadataConfig;
private final TypedProperties configProperties;
+ @Getter
private final HoodieTableQueryType queryType;
private final Option<String> specifiedQueryInstant;
private final Option<String> incrementalQueryStartTime;
private final Option<String> incrementalQueryEndTime;
+ @Getter(AccessLevel.PROTECTED)
private final List<StoragePath> queryPaths;
private final boolean shouldIncludePendingCommits;
@@ -114,6 +119,7 @@ public abstract class BaseHoodieTableFileIndex implements
AutoCloseable {
// In lazy listing case, if no predicate on partition is provided, all
partitions will still be loaded.
private final boolean shouldListLazily;
+ @Getter
private final StoragePath basePath;
private final HoodieTableMetaClient metaClient;
@@ -195,13 +201,6 @@ public abstract class BaseHoodieTableFileIndex implements
AutoCloseable {
return getActiveTimeline().filterCompletedInstants().lastInstant();
}
- /**
- * Returns table's base-path
- */
- public StoragePath getBasePath() {
- return basePath;
- }
-
public int getFileSlicesCount() {
return getAllInputFileSlices().values().stream()
.mapToInt(List::size).sum();
@@ -212,25 +211,6 @@ public abstract class BaseHoodieTableFileIndex implements
AutoCloseable {
resetTableMetadata(null);
}
- public HoodieTableQueryType getQueryType() {
- return queryType;
- }
-
- /**
- * Returns the configuration properties
- */
- public HoodieMetadataConfig getMetadataConfig() {
- return metadataConfig;
- }
-
- protected String[] getPartitionColumns() {
- return partitionColumns;
- }
-
- protected List<StoragePath> getQueryPaths() {
- return queryPaths;
- }
-
/**
* Returns all partition paths matching the ones explicitly provided by the
query (if any)
*/
@@ -490,7 +470,7 @@ public abstract class BaseHoodieTableFileIndex implements
AutoCloseable {
ensurePreloadedPartitions(getAllQueryPartitionPaths());
}
- LOG.info("Refresh table {}, spent: {} ms",
metaClient.getTableConfig().getTableName(), timer.endTimer());
+ log.info("Refresh table {}, spent: {} ms",
metaClient.getTableConfig().getTableName(), timer.endTimer());
}
private void validate(HoodieTimeline activeTimeline, Option<String>
queryInstant) {
@@ -575,31 +555,11 @@ public abstract class BaseHoodieTableFileIndex implements
AutoCloseable {
* Partition path information containing the relative partition path
* and values of partition columns.
*/
- public static final class PartitionPath implements Serializable {
-
- final String path;
- final Object[] values;
-
- public PartitionPath(String path, Object[] values) {
- this.path = path;
- this.values = values;
- }
-
- public String getPath() {
- return path;
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof PartitionPath
- && Objects.equals(path, ((PartitionPath) other).path)
- && Arrays.equals(values, ((PartitionPath) other).values);
- }
+ @Value
+ public static class PartitionPath implements Serializable {
- @Override
- public int hashCode() {
- return path.hashCode() * 1103 + Arrays.hashCode(values);
- }
+ String path;
+ Object[] values;
}
/**
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroLogicalTypeEnum.java
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroLogicalTypeEnum.java
index 45eddbd77dd4..39703cfb2de0 100644
--- a/hudi-common/src/main/java/org/apache/hudi/avro/AvroLogicalTypeEnum.java
+++ b/hudi-common/src/main/java/org/apache/hudi/avro/AvroLogicalTypeEnum.java
@@ -18,11 +18,17 @@
package org.apache.hudi.avro;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
/**
* Enum of Avro logical types that merciful json convertor are aware of.
* Currently, all logical types offered by Avro 1.10 is supported here.
* Check https://avro.apache.org/docs/1.10.0/spec.html#Logical+Types for more
details.
*/
+@AllArgsConstructor(access = AccessLevel.PACKAGE)
+@Getter
public enum AvroLogicalTypeEnum {
DECIMAL("decimal"),
UUID("uuid"),
@@ -36,12 +42,4 @@ public enum AvroLogicalTypeEnum {
DURATION("duration");
private final String value;
-
- AvroLogicalTypeEnum(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
}
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaComparatorForSchemaEvolution.java
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaComparatorForSchemaEvolution.java
index 3cd3a7025113..fb57891997f5 100644
---
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaComparatorForSchemaEvolution.java
+++
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaComparatorForSchemaEvolution.java
@@ -18,6 +18,8 @@
package org.apache.hudi.avro;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.apache.avro.LogicalType;
import org.apache.avro.LogicalTypes.Decimal;
import org.apache.avro.Schema;
@@ -136,11 +138,9 @@ import java.util.stream.Collectors;
* <li>Custom properties</li>
* </ul>
*/
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class AvroSchemaComparatorForSchemaEvolution {
- protected AvroSchemaComparatorForSchemaEvolution() {
- }
-
private static final AvroSchemaComparatorForSchemaEvolution VALIDATOR = new
AvroSchemaComparatorForSchemaEvolution();
public static boolean schemaEquals(Schema s1, Schema s2) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaCompatibility.java
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaCompatibility.java
index a1ad79236e2b..8a3ebf6eaa4e 100644
---
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaCompatibility.java
+++
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaCompatibility.java
@@ -21,13 +21,14 @@ package org.apache.hudi.avro;
import org.apache.hudi.common.util.Either;
import org.apache.hudi.common.util.Option;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.apache.avro.AvroRuntimeException;
import org.apache.avro.LogicalTypes;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.apache.avro.Schema.Type;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -62,14 +63,9 @@ import static
org.apache.hudi.common.util.ValidationUtils.checkState;
* a union</li>
* </ol>
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
public class AvroSchemaCompatibility {
- private static final Logger LOG =
LoggerFactory.getLogger(AvroSchemaCompatibility.class);
-
- /**
- * Utility class cannot be instantiated.
- */
- private AvroSchemaCompatibility() {
- }
/**
* Message to annotate reader/writer schema pairs that are compatible.
@@ -267,7 +263,7 @@ public class AvroSchemaCompatibility {
private SchemaCompatibilityResult getCompatibility(final Schema reader,
final Schema writer,
final
Deque<LocationInfo> locations) {
- LOG.debug("Checking compatibility of reader {} with writer {}", reader,
writer);
+ log.debug("Checking compatibility of reader {} with writer {}", reader,
writer);
final ReaderWriter pair = new ReaderWriter(reader, writer);
SchemaCompatibilityResult result = mMemoizeMap.get(pair);
if (result != null) {
@@ -772,6 +768,7 @@ public class AvroSchemaCompatibility {
mIncompatibilities);
}
}
+
//
-----------------------------------------------------------------------------------------------
public static final class Incompatibility {
@@ -923,6 +920,7 @@ public class AvroSchemaCompatibility {
getLocation(), mMessage, mReaderFragment, mWriterFragment);
}
}
+
//
-----------------------------------------------------------------------------------------------
/**
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java
b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java
index 0eae120a5cfd..d9dd9869c69b 100644
--- a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java
@@ -30,10 +30,11 @@ import org.apache.hudi.internal.schema.InternalSchema;
import org.apache.hudi.internal.schema.action.TableChanges;
import org.apache.hudi.internal.schema.utils.SchemaChangeUtils;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.apache.avro.Schema;
import org.apache.avro.SchemaCompatibility;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -54,13 +55,10 @@ import static
org.apache.hudi.internal.schema.convert.InternalSchemaConverter.co
/**
* Utils for Avro Schema.
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
public class AvroSchemaUtils {
- private static final Logger LOG =
LoggerFactory.getLogger(AvroSchemaUtils.class);
-
- private AvroSchemaUtils() {
- }
-
/**
* See {@link #isSchemaCompatible(Schema, Schema, boolean, boolean)} doc for
more details
*/
@@ -383,7 +381,7 @@ public class AvroSchemaUtils {
try {
schemaProps = schema.getObjectProps();
} catch (Exception e) {
- LOG.warn("Error while getting object properties from schema: {}",
schema, e);
+ log.warn("Error while getting object properties from schema: {}",
schema, e);
}
for (Map.Entry<String, Object> prop : schemaProps.entrySet()) {
newSchema.addProp(prop.getKey(), prop.getValue());
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroWrapperUtils.java
b/hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroWrapperUtils.java
index c3c0d33c54c6..91590a0210d5 100644
--- a/hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroWrapperUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroWrapperUtils.java
@@ -37,6 +37,8 @@ import org.apache.hudi.common.util.collection.ArrayComparable;
import org.apache.hudi.common.util.collection.Pair;
import org.apache.hudi.util.Lazy;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.apache.avro.Conversions;
import org.apache.avro.LogicalTypes;
import org.apache.avro.Schema;
@@ -235,6 +237,7 @@ public class HoodieAvroWrapperUtils {
return Pair.of(false, null);
}
+ @AllArgsConstructor
public enum PrimitiveWrapperType {
V1(Object.class, HoodieAvroWrapperUtils::wrapValueIntoAvro,
HoodieAvroWrapperUtils::unwrapAvroValueWrapper, GenericRecord.class),
NULL(Void.class, HoodieAvroWrapperUtils::wrapNull,
HoodieAvroWrapperUtils::unwrapNull, Void.class),
@@ -246,22 +249,13 @@ public class HoodieAvroWrapperUtils {
STRING(String.class, HoodieAvroWrapperUtils::wrapString,
HoodieAvroWrapperUtils::unwrapString, StringWrapper.class),
BYTES(ByteBuffer.class, HoodieAvroWrapperUtils::wrapBytes,
HoodieAvroWrapperUtils::unwrapBytes, BytesWrapper.class);
+ @Getter
private final Class<?> clazz;
private final Function<Comparable<?>, Object> wrapper;
private final Function<Object, Comparable<?>> unwrapper;
+ @Getter
private final Class<?> wrapperClass;
- PrimitiveWrapperType(Class<?> clazz, Function<Comparable<?>, Object>
wrapper, Function<Object, Comparable<?>> unwrapper, Class<?> wrapperClass) {
- this.clazz = clazz;
- this.wrapper = wrapper;
- this.unwrapper = unwrapper;
- this.wrapperClass = wrapperClass;
- }
-
- public Class<?> getClazz() {
- return clazz;
- }
-
public Object wrap(Comparable<?> value) {
return wrapper.apply(value);
}
@@ -269,10 +263,6 @@ public class HoodieAvroWrapperUtils {
public Comparable<?> unwrap(Object value) {
return unwrapper.apply(value);
}
-
- public Class<?> getWrapperClass() {
- return wrapperClass;
- }
}
private static Object wrapNull(Comparable<?> value) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/avro/JoinedGenericRecord.java
b/hudi-common/src/main/java/org/apache/hudi/avro/JoinedGenericRecord.java
index 9abbbe38fa72..5509a16dd801 100644
--- a/hudi-common/src/main/java/org/apache/hudi/avro/JoinedGenericRecord.java
+++ b/hudi-common/src/main/java/org/apache/hudi/avro/JoinedGenericRecord.java
@@ -20,6 +20,7 @@ package org.apache.hudi.avro;
import org.apache.hudi.common.model.HoodieRecord;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
@@ -27,8 +28,10 @@ import org.apache.avro.generic.GenericRecord;
* Impl of {@link GenericRecord} to abstract meta fields and an actual data
records of type GenericRecord.
*/
public class JoinedGenericRecord implements GenericRecord {
+
private final GenericRecord dataRecord;
private final Object[] metaFields;
+ @Getter
private final Schema schema;
public JoinedGenericRecord(GenericRecord dataRecord, int metaFieldsSize,
Schema schema) {
@@ -82,9 +85,4 @@ public class JoinedGenericRecord implements GenericRecord {
}
return pos;
}
-
- @Override
- public Schema getSchema() {
- return schema;
- }
}
diff --git a/hudi-common/src/main/java/org/apache/hudi/avro/JsonEncoder.java
b/hudi-common/src/main/java/org/apache/hudi/avro/JsonEncoder.java
index 01b44ead24fd..37f67f8df80f 100644
--- a/hudi-common/src/main/java/org/apache/hudi/avro/JsonEncoder.java
+++ b/hudi-common/src/main/java/org/apache/hudi/avro/JsonEncoder.java
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.avro.AvroTypeException;
import org.apache.avro.Schema;
import org.apache.avro.io.Encoder;
@@ -61,6 +63,8 @@ public class JsonEncoder extends ParsingEncoder implements
Parser.ActionHandler
private static final String LINE_SEPARATOR =
System.getProperty("line.separator");
final Parser parser;
private JsonGenerator out;
+ @Getter
+ @Setter
private boolean includeNamespace = true;
/**
@@ -114,14 +118,6 @@ public class JsonEncoder extends ParsingEncoder implements
Parser.ActionHandler
return g;
}
- public boolean isIncludeNamespace() {
- return includeNamespace;
- }
-
- public void setIncludeNamespace(final boolean includeNamespace) {
- this.includeNamespace = includeNamespace;
- }
-
/**
* Reconfigures this JsonEncoder to use the output stream provided.
* <p/>
diff --git
a/hudi-common/src/main/java/org/apache/hudi/client/transaction/lock/InProcessLockProvider.java
b/hudi-common/src/main/java/org/apache/hudi/client/transaction/lock/InProcessLockProvider.java
index eec16ff4e89c..cebe0936400c 100644
---
a/hudi-common/src/main/java/org/apache/hudi/client/transaction/lock/InProcessLockProvider.java
+++
b/hudi-common/src/main/java/org/apache/hudi/client/transaction/lock/InProcessLockProvider.java
@@ -28,8 +28,8 @@ import org.apache.hudi.common.util.ValidationUtils;
import org.apache.hudi.exception.HoodieLockException;
import org.apache.hudi.storage.StorageConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
import java.util.Map;
@@ -47,10 +47,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* HoodieLockException. Threads other than the current lock owner, will
* block on lock() and return false on tryLock().
*/
+@Slf4j
public class InProcessLockProvider implements
LockProvider<ReentrantReadWriteLock>, Serializable {
- private static final Logger LOG =
LoggerFactory.getLogger(InProcessLockProvider.class);
private static final Map<String, ReentrantReadWriteLock>
LOCK_INSTANCE_PER_BASEPATH = new ConcurrentHashMap<>();
+ @Getter
private final ReentrantReadWriteLock lock;
private final String basePath;
private final long maxWaitTimeMillis;
@@ -66,12 +67,12 @@ public class InProcessLockProvider implements
LockProvider<ReentrantReadWriteLoc
@Override
public void lock() {
- LOG.info(getLogMessage(LockState.ACQUIRING));
+ log.info(getLogMessage(LockState.ACQUIRING));
if (lock.isWriteLockedByCurrentThread()) {
throw new HoodieLockException(getLogMessage(LockState.ALREADY_ACQUIRED));
}
lock.writeLock().lock();
- LOG.info(getLogMessage(LockState.ACQUIRED));
+ log.info(getLogMessage(LockState.ACQUIRED));
}
@Override
@@ -81,7 +82,7 @@ public class InProcessLockProvider implements
LockProvider<ReentrantReadWriteLoc
@Override
public boolean tryLock(long time, TimeUnit unit) {
- LOG.info(getLogMessage(LockState.ACQUIRING));
+ log.info(getLogMessage(LockState.ACQUIRING));
if (lock.isWriteLockedByCurrentThread()) {
throw new HoodieLockException(getLogMessage(LockState.ALREADY_ACQUIRED));
}
@@ -93,36 +94,31 @@ public class InProcessLockProvider implements
LockProvider<ReentrantReadWriteLoc
throw new
HoodieLockException(getLogMessage(LockState.FAILED_TO_ACQUIRE));
}
- LOG.info(getLogMessage(isLockAcquired ? LockState.ACQUIRED :
LockState.FAILED_TO_ACQUIRE));
+ log.info(getLogMessage(isLockAcquired ? LockState.ACQUIRED :
LockState.FAILED_TO_ACQUIRE));
return isLockAcquired;
}
@Override
public void unlock() {
- LOG.info(getLogMessage(LockState.RELEASING));
+ log.info(getLogMessage(LockState.RELEASING));
try {
if (lock.isWriteLockedByCurrentThread()) {
lock.writeLock().unlock();
- LOG.info(getLogMessage(LockState.RELEASED));
+ log.info(getLogMessage(LockState.RELEASED));
} else {
- LOG.info("Cannot unlock because the current thread does not hold the
lock.");
+ log.info("Cannot unlock because the current thread does not hold the
lock.");
}
} catch (Exception e) {
throw new
HoodieLockException(getLogMessage(LockState.FAILED_TO_RELEASE), e);
}
}
- @Override
- public ReentrantReadWriteLock getLock() {
- return lock;
- }
-
@Override
public void close() {
if (lock.isWriteLockedByCurrentThread()) {
lock.writeLock().unlock();
}
- LOG.info(getLogMessage(LockState.ALREADY_RELEASED));
+ log.info(getLogMessage(LockState.ALREADY_RELEASED));
}
private String getLogMessage(LockState state) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/exception/HoodieMetaSyncException.java
b/hudi-common/src/main/java/org/apache/hudi/exception/HoodieMetaSyncException.java
index ba9e51c2ee1a..e604ed3cc523 100644
---
a/hudi-common/src/main/java/org/apache/hudi/exception/HoodieMetaSyncException.java
+++
b/hudi-common/src/main/java/org/apache/hudi/exception/HoodieMetaSyncException.java
@@ -18,15 +18,14 @@
package org.apache.hudi.exception;
+import lombok.Getter;
+
import java.util.Map;
public class HoodieMetaSyncException extends HoodieException {
- private Map<String,HoodieException> failedMetaSyncs;
-
- public Map<String,HoodieException> getFailedMetaSyncs() {
- return failedMetaSyncs;
- }
+ @Getter
+ private Map<String, HoodieException> failedMetaSyncs;
public HoodieMetaSyncException(String msg, Throwable e) {
super(msg, e);
diff --git
a/hudi-common/src/main/java/org/apache/hudi/expression/BinaryExpression.java
b/hudi-common/src/main/java/org/apache/hudi/expression/BinaryExpression.java
index a0afdc189281..d38c531a2359 100644
--- a/hudi-common/src/main/java/org/apache/hudi/expression/BinaryExpression.java
+++ b/hudi-common/src/main/java/org/apache/hudi/expression/BinaryExpression.java
@@ -18,36 +18,24 @@
package org.apache.hudi.expression;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import java.util.Arrays;
import java.util.List;
/**
* The expression that accept two child expressions.
*/
+@AllArgsConstructor(access = AccessLevel.PACKAGE)
+@Getter
public abstract class BinaryExpression implements Expression {
- private final Operator operator;
private final Expression left;
+ private final Operator operator;
private final Expression right;
- BinaryExpression(Expression left, Operator operator, Expression right) {
- this.left = left;
- this.operator = operator;
- this.right = right;
- }
-
- public Operator getOperator() {
- return operator;
- }
-
- public Expression getLeft() {
- return left;
- }
-
- public Expression getRight() {
- return right;
- }
-
@Override
public List<Expression> getChildren() {
return Arrays.asList(left, right);
diff --git a/hudi-common/src/main/java/org/apache/hudi/expression/Literal.java
b/hudi-common/src/main/java/org/apache/hudi/expression/Literal.java
index 14df7668c5dc..c364a5595d67 100644
--- a/hudi-common/src/main/java/org/apache/hudi/expression/Literal.java
+++ b/hudi-common/src/main/java/org/apache/hudi/expression/Literal.java
@@ -21,12 +21,17 @@ package org.apache.hudi.expression;
import org.apache.hudi.internal.schema.Type;
import org.apache.hudi.internal.schema.Types;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import javax.xml.bind.DatatypeConverter;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.util.UUID;
+@AllArgsConstructor
+@Getter
public class Literal<T> extends LeafExpression {
public static <V> Literal from(V value) {
@@ -81,21 +86,7 @@ public class Literal<T> extends LeafExpression {
}
private final T value;
- private final Type type;
-
- public Literal(T value, Type type) {
- this.value = value;
- this.type = type;
- }
-
- public T getValue() {
- return value;
- }
-
- @Override
- public Type getDataType() {
- return type;
- }
+ private final Type dataType;
@Override
public Object eval(StructLike data) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/expression/NameReference.java
b/hudi-common/src/main/java/org/apache/hudi/expression/NameReference.java
index 7d41a61791fe..19ce43ddfa82 100644
--- a/hudi-common/src/main/java/org/apache/hudi/expression/NameReference.java
+++ b/hudi-common/src/main/java/org/apache/hudi/expression/NameReference.java
@@ -20,18 +20,15 @@ package org.apache.hudi.expression;
import org.apache.hudi.internal.schema.Type;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
public class NameReference extends LeafExpression {
private final String name;
- public NameReference(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
@Override
public Type getDataType() {
throw new UnsupportedOperationException("NameReference is not bound yet");
diff --git
a/hudi-common/src/main/java/org/apache/hudi/expression/Predicates.java
b/hudi-common/src/main/java/org/apache/hudi/expression/Predicates.java
index ed7b6b00b5c1..e5dd07e2bfe6 100644
--- a/hudi-common/src/main/java/org/apache/hudi/expression/Predicates.java
+++ b/hudi-common/src/main/java/org/apache/hudi/expression/Predicates.java
@@ -20,6 +20,8 @@ package org.apache.hudi.expression;
import org.apache.hudi.internal.schema.Type;
+import lombok.Getter;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -416,6 +418,8 @@ public class Predicates {
}
public static class StringStartsWithAny implements Predicate {
+
+ @Getter
private final Operator operator;
private final Expression left;
private final List<Expression> right;
@@ -434,11 +438,6 @@ public class Predicates {
return children;
}
- @Override
- public Operator getOperator() {
- return operator;
- }
-
@Override
public Object eval(StructLike data) {
for (Expression e : right) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/index/secondary/HoodieSecondaryIndex.java
b/hudi-common/src/main/java/org/apache/hudi/index/secondary/HoodieSecondaryIndex.java
index c75da2b74cca..96dff8b320ea 100644
---
a/hudi-common/src/main/java/org/apache/hudi/index/secondary/HoodieSecondaryIndex.java
+++
b/hudi-common/src/main/java/org/apache/hudi/index/secondary/HoodieSecondaryIndex.java
@@ -21,6 +21,9 @@ package org.apache.hudi.index.secondary;
import org.apache.hudi.exception.HoodieSecondaryIndexException;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -28,7 +31,10 @@ import java.util.Map;
/**
* Represents a single secondary index.
*/
+@NoArgsConstructor
+@Getter
public class HoodieSecondaryIndex {
+
private String indexName;
private SecondaryIndexType indexType;
@@ -36,9 +42,6 @@ public class HoodieSecondaryIndex {
private LinkedHashMap<String, Map<String, String>> columns;
private Map<String, String> options;
- public HoodieSecondaryIndex() {
- }
-
public HoodieSecondaryIndex(
String indexName,
SecondaryIndexType indexType,
@@ -52,22 +55,6 @@ public class HoodieSecondaryIndex {
validate();
}
- public String getIndexName() {
- return indexName;
- }
-
- public SecondaryIndexType getIndexType() {
- return indexType;
- }
-
- public Map<String, Map<String, String>> getColumns() {
- return columns;
- }
-
- public Map<String, String> getOptions() {
- return options;
- }
-
public static Builder builder() {
return new Builder();
}
diff --git
a/hudi-common/src/main/java/org/apache/hudi/index/secondary/SecondaryIndexManager.java
b/hudi-common/src/main/java/org/apache/hudi/index/secondary/SecondaryIndexManager.java
index f3c594d6c779..3ad8bcf29dca 100644
---
a/hudi-common/src/main/java/org/apache/hudi/index/secondary/SecondaryIndexManager.java
+++
b/hudi-common/src/main/java/org/apache/hudi/index/secondary/SecondaryIndexManager.java
@@ -26,9 +26,10 @@ import org.apache.hudi.common.util.CollectionUtils;
import org.apache.hudi.common.util.Option;
import org.apache.hudi.exception.HoodieSecondaryIndexException;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.apache.avro.Schema;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -41,14 +42,12 @@ import java.util.stream.Collectors;
/**
* Manages secondary index.
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
public class SecondaryIndexManager {
- private static final Logger LOG =
LoggerFactory.getLogger(SecondaryIndexManager.class);
private static volatile SecondaryIndexManager _instance;
- private SecondaryIndexManager() {
- }
-
public static SecondaryIndexManager getInstance() {
if (_instance == null) {
synchronized (SecondaryIndexManager.class) {
@@ -124,7 +123,7 @@ public class SecondaryIndexManager {
SecondaryIndexUtils.toJsonString(newSecondaryIndexes));
HoodieTableConfig.update(metaClient.getStorage(),
metaClient.getMetaPath(), updatedProps);
- LOG.info("Success to add secondary index metadata: {}",
secondaryIndexToAdd);
+ log.info("Success to add secondary index metadata: {}",
secondaryIndexToAdd);
// TODO: build index
}
@@ -160,7 +159,7 @@ public class SecondaryIndexManager {
CollectionUtils.createSet(HoodieTableConfig.SECONDARY_INDEXES_METADATA.key()));
}
- LOG.info("Success to delete secondary index metadata: {}", indexName);
+ log.info("Success to delete secondary index metadata: {}", indexName);
// TODO: drop index data
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/data/CloseValidationIterator.java
b/hudi-common/src/test/java/org/apache/hudi/common/data/CloseValidationIterator.java
index b61bdd6536f1..7b75c7e3332a 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/data/CloseValidationIterator.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/data/CloseValidationIterator.java
@@ -21,6 +21,8 @@ package org.apache.hudi.common.data;
import org.apache.hudi.common.util.collection.ClosableIterator;
+import lombok.Getter;
+
import java.util.Iterator;
/**
@@ -28,17 +30,15 @@ import java.util.Iterator;
* @param <T> type of record within the iterator
*/
class CloseValidationIterator<T> implements ClosableIterator<T> {
+
private final Iterator<T> inner;
+ @Getter
private boolean isClosed = false;
public CloseValidationIterator(Iterator<T> inner) {
this.inner = inner;
}
- public boolean isClosed() {
- return isClosed;
- }
-
@Override
public void close() {
isClosed = true;
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/model/TestHoodieCommitMetadata.java
b/hudi-common/src/test/java/org/apache/hudi/common/model/TestHoodieCommitMetadata.java
index a8459a716266..f4e56430f434 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/model/TestHoodieCommitMetadata.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/model/TestHoodieCommitMetadata.java
@@ -29,15 +29,14 @@ import
org.apache.hudi.common.table.timeline.TimelineMetadataUtils;
import
org.apache.hudi.common.table.timeline.versioning.v1.CommitMetadataSerDeV1;
import org.apache.hudi.common.testutils.HoodieTestUtils;
import org.apache.hudi.common.util.CollectionUtils;
-import org.apache.hudi.io.util.FileIOUtils;
import org.apache.hudi.common.util.JsonUtils;
import org.apache.hudi.common.util.Option;
import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.io.util.FileIOUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.avro.reflect.ReflectData;
import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -59,8 +58,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests hoodie commit metadata {@link HoodieCommitMetadata}.
*/
+@Slf4j
public class TestHoodieCommitMetadata {
- private static final Logger LOGGER =
LoggerFactory.getLogger(TestHoodieCommitMetadata.class);
private static final List<String> EXPECTED_FIELD_NAMES = Arrays.asList(
"partitionToWriteStats", "compacted", "extraMetadata", "operationType");
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/table/read/buffer/TestRecord.java
b/hudi-common/src/test/java/org/apache/hudi/common/table/read/buffer/TestRecord.java
index bb9e6d672a93..8f2affc85073 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/table/read/buffer/TestRecord.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/table/read/buffer/TestRecord.java
@@ -19,36 +19,11 @@
package org.apache.hudi.common.table.read.buffer;
-import java.util.Objects;
+import lombok.Value;
+@Value
class TestRecord {
- private final String recordKey;
- private final int value;
- public TestRecord(String recordKey, int value) {
- this.recordKey = recordKey;
- this.value = value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- TestRecord that = (TestRecord) o;
- return value == that.value && Objects.equals(recordKey, that.recordKey);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(recordKey, value);
- }
-
- public String getRecordKey() {
- return recordKey;
- }
-
- public int getValue() {
- return value;
- }
+ String recordKey;
+ int value;
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/CompactionTestUtils.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/CompactionTestUtils.java
index b08b726e83fb..ae2a87bb102e 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/CompactionTestUtils.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/CompactionTestUtils.java
@@ -34,6 +34,8 @@ import org.apache.hudi.common.util.collection.Pair;
import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.storage.StoragePath;
+import lombok.Getter;
+
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;
@@ -199,6 +201,7 @@ public class CompactionTestUtils {
*/
public static class DummyHoodieBaseFile extends HoodieBaseFile {
+ @Getter
private final String path;
public DummyHoodieBaseFile(String path) {
@@ -206,11 +209,6 @@ public class CompactionTestUtils {
this.path = path;
}
- @Override
- public String getPath() {
- return path;
- }
-
@Override
public String getFileId() {
return UUID.randomUUID().toString();
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieAdaptablePayloadDataGenerator.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieAdaptablePayloadDataGenerator.java
index e705820dd258..03699bc0180d 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieAdaptablePayloadDataGenerator.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieAdaptablePayloadDataGenerator.java
@@ -38,6 +38,7 @@ import org.apache.hudi.common.schema.HoodieSchemaUtils;
import org.apache.hudi.common.table.HoodieTableConfig;
import org.apache.hudi.common.util.Option;
+import lombok.Getter;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
@@ -211,6 +212,7 @@ public class HoodieAdaptablePayloadDataGenerator {
Option.of(SCHEMA.toAvroSchema()));
}
+ @Getter
public static class RecordGen {
public static final Set<Class<?>> SUPPORTED_PAYLOAD_CLASSES = new
HashSet<>(Arrays.asList(
@@ -238,14 +240,6 @@ public class HoodieAdaptablePayloadDataGenerator {
}
}
- public Class<?> getPayloadClass() {
- return payloadClass;
- }
-
- public String getOrderingField() {
- return orderingField;
- }
-
GenericRecord populateForInsert(GenericRecord r, long ts) {
r.put(orderingField, ts);
if (payloadClass == AWSDmsAvroPayload.class) {
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestDataGenerator.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestDataGenerator.java
index cc84de43e382..0fa61f3f5e9d 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestDataGenerator.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestDataGenerator.java
@@ -46,6 +46,9 @@ import org.apache.hudi.storage.StoragePath;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
import org.apache.avro.Conversions;
import org.apache.avro.LogicalTypes;
import org.apache.avro.Schema;
@@ -81,7 +84,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
@@ -258,6 +260,7 @@ public class HoodieTestDataGenerator implements
AutoCloseable {
//Maintains all the existing keys schema wise
private final Map<String, Map<Integer, KeyPartition>> existingKeysBySchema;
+ @Getter
private final String[] partitionPaths;
//maintains the count of existing keys schema wise
private Map<String, Integer> numKeysBySchema;
@@ -1445,10 +1448,6 @@ Generate random record using TRIP_ENCODED_DECIMAL_SCHEMA
return list;
}
- public String[] getPartitionPaths() {
- return partitionPaths;
- }
-
public int getNumExistingKeys(String schemaStr) {
return numKeysBySchema.getOrDefault(schemaStr, 0);
}
@@ -1507,7 +1506,11 @@ Generate random record using TRIP_ENCODED_DECIMAL_SCHEMA
* The fields identify the record with the combination of the recordKey and
partitionPath and assert that the proper
* value is present with the orderingVal and the riderValue, which is
updated as part of the update utility methods.
*/
+ @Getter
+ @EqualsAndHashCode
+ @ToString
public static class RecordIdentifier {
+
private final String recordKey;
private final String orderingVal;
private final String partitionPath;
@@ -1536,45 +1539,6 @@ Generate random record using TRIP_ENCODED_DECIMAL_SCHEMA
String riderValue = ((GenericRecord) record.getData()).hasField("rider")
? ((GenericRecord) record.getData()).get("rider").toString() : "";
return new RecordIdentifier(recordKey, partitionPath, orderingValStr,
riderValue);
}
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- RecordIdentifier that = (RecordIdentifier) o;
- return Objects.equals(recordKey, that.recordKey)
- && Objects.equals(orderingVal, that.orderingVal)
- && Objects.equals(partitionPath, that.partitionPath)
- && Objects.equals(riderValue, that.riderValue);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(recordKey, orderingVal, partitionPath, riderValue);
- }
-
- public String getRecordKey() {
- return recordKey;
- }
-
- public String getOrderingVal() {
- return orderingVal;
- }
-
- public String getPartitionPath() {
- return partitionPath;
- }
-
- public String getRiderValue() {
- return riderValue;
- }
-
- @Override
- public String toString() {
- return "RowKey: " + recordKey + ", PartitionPath: " + partitionPath
- + ", OrderingVal: " + orderingVal + ", RiderValue: " + riderValue;
- }
}
public static class SchemaEvolutionConfigs {
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/RawTripTestPayload.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/RawTripTestPayload.java
index f11c7a62be4c..4f21aa571479 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/RawTripTestPayload.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/RawTripTestPayload.java
@@ -21,10 +21,11 @@ package org.apache.hudi.common.testutils;
import org.apache.hudi.avro.MercifulJsonConverter;
import org.apache.hudi.common.model.HoodieRecordPayload;
-import org.apache.hudi.io.util.FileIOUtils;
import org.apache.hudi.common.util.Option;
+import org.apache.hudi.io.util.FileIOUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.generic.IndexedRecord;
@@ -49,7 +50,9 @@ public class RawTripTestPayload implements
HoodieRecordPayload<RawTripTestPayloa
private static final MercifulJsonConverter JSON_CONVERTER = new
MercifulJsonConverter();
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+ @Getter
private String partitionPath;
+ @Getter
private String rowKey;
private byte[] jsonDataCompressed;
private int dataSize;
@@ -66,10 +69,6 @@ public class RawTripTestPayload implements
HoodieRecordPayload<RawTripTestPayloa
this.orderingVal = Integer.valueOf(jsonRecordMap.getOrDefault("number",
0).toString());
}
- public String getPartitionPath() {
- return partitionPath;
- }
-
@Override
public RawTripTestPayload preCombine(RawTripTestPayload oldValue) {
if (!orderingVal.equals(DEFAULT_ORDERING_VALUE) &&
oldValue.orderingVal.compareTo(orderingVal) > 0) {
@@ -112,10 +111,6 @@ public class RawTripTestPayload implements
HoodieRecordPayload<RawTripTestPayloa
return Option.of(metadataMap);
}
- public String getRowKey() {
- return rowKey;
- }
-
public String getJsonData() throws IOException {
return unCompressData(jsonDataCompressed);
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/SchemaTestUtil.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/SchemaTestUtil.java
index 9298017070eb..3a714c6361ad 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/SchemaTestUtil.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/SchemaTestUtil.java
@@ -31,6 +31,7 @@ import org.apache.hudi.common.schema.HoodieSchemaUtils;
import org.apache.hudi.common.util.Option;
import org.apache.hudi.exception.HoodieIOException;
+import lombok.NoArgsConstructor;
import org.apache.avro.generic.GenericArray;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumReader;
@@ -67,6 +68,7 @@ import static
org.apache.hudi.common.testutils.HoodieTestDataGenerator.genPseudo
/**
* A utility class for testing schema.
*/
+@NoArgsConstructor
public final class SchemaTestUtil {
private static final String RESOURCE_SAMPLE_DATA = "/sample.data";
@@ -74,9 +76,6 @@ public final class SchemaTestUtil {
private final Random random = new Random(0xDEED);
- public SchemaTestUtil() {
- }
-
public static HoodieSchema getSimpleSchema() throws IOException {
return new
HoodieSchema.Parser().parse(SchemaTestUtil.class.getResourceAsStream("/simple-test.avsc"));
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/minicluster/ZookeeperTestService.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/minicluster/ZookeeperTestService.java
index b7e090174d2f..d3e835966242 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/minicluster/ZookeeperTestService.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/minicluster/ZookeeperTestService.java
@@ -18,13 +18,13 @@
package org.apache.hudi.common.testutils.minicluster;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileUtil;
import org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.persistence.FileTxnLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
@@ -53,16 +53,16 @@ import static
org.apache.hudi.common.util.StringUtils.getUTF8Bytes;
* <p/>
* 4. The ZK cluster will re-use a data dir on the local filesystem if it
already exists instead of blowing it away.
*/
+@Slf4j
public class ZookeeperTestService {
- private static final Logger LOG =
LoggerFactory.getLogger(ZookeeperTestService.class);
-
private static final int TICK_TIME = 2000;
private static final int CONNECTION_TIMEOUT = 30000;
/**
* Configuration settings.
*/
+ @Getter
private Configuration hadoopConf;
private String workDir;
private Integer clientPort = 2828;
@@ -82,10 +82,6 @@ public class ZookeeperTestService {
this.hadoopConf = config;
}
- public Configuration getHadoopConf() {
- return hadoopConf;
- }
-
public ZooKeeperServer start() throws IOException, InterruptedException {
Objects.requireNonNull(workDir, "The localBaseFsLocation must be set
before starting cluster.");
@@ -105,7 +101,7 @@ public class ZookeeperTestService {
// NOTE: Changed from the original, where InetSocketAddress was
// originally created to bind to the wildcard IP, we now configure it.
- LOG.info("Zookeeper force binding to: " + this.bindIP);
+ log.info("Zookeeper force binding to: " + this.bindIP);
standaloneServerFactory.configure(new InetSocketAddress(bindIP,
clientPort), 1000);
// Start up this ZK server
@@ -122,7 +118,7 @@ public class ZookeeperTestService {
}
started = true;
- LOG.info("Zookeeper Minicluster service started on client port: " +
clientPort);
+ log.info("Zookeeper Minicluster service started on client port: " +
clientPort);
return zooKeeperServer;
}
@@ -141,7 +137,7 @@ public class ZookeeperTestService {
standaloneServerFactory = null;
zooKeeperServer = null;
- LOG.info("Zookeeper Minicluster service shut down.");
+ log.info("Zookeeper Minicluster service shut down.");
}
private void recreateDir(File dir, boolean clean) throws IOException {
@@ -221,7 +217,7 @@ public class ZookeeperTestService {
}
} catch (IOException e) {
// ignore as this is expected
- LOG.info("server " + hostname + ":" + port + " not up " + e);
+ log.info("server " + hostname + ":" + port + " not up " + e);
}
if (System.currentTimeMillis() > start + timeout) {
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/DataGenerationPlan.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/DataGenerationPlan.java
index 666a2ff11ce9..7acd3cb38e16 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/DataGenerationPlan.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/DataGenerationPlan.java
@@ -19,6 +19,9 @@
package org.apache.hudi.common.testutils.reader;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
import java.util.List;
/**
@@ -29,6 +32,8 @@ import java.util.List;
* 1. One plan generates one file, either a base file, or a log file.
* 2. One file contains one operation, e.g., insert, delete, or update.
*/
+@AllArgsConstructor
+@Getter
public class DataGenerationPlan {
// The values for "_row_key" field.
private final List<String> recordKeys;
@@ -47,44 +52,6 @@ public class DataGenerationPlan {
DELETE
}
- public DataGenerationPlan(List<String> recordKeys,
- String partitionPath,
- long timestamp,
- OperationType operationType,
- String instantTime,
- boolean writePositions) {
- this.recordKeys = recordKeys;
- this.partitionPath = partitionPath;
- this.timestamp = timestamp;
- this.operationType = operationType;
- this.instantTime = instantTime;
- this.writePositions = writePositions;
- }
-
- public List<String> getRecordKeys() {
- return recordKeys;
- }
-
- public String getPartitionPath() {
- return partitionPath;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public OperationType getOperationType() {
- return operationType;
- }
-
- public String getInstantTime() {
- return instantTime;
- }
-
- public boolean getWritePositions() {
- return writePositions;
- }
-
public static Builder newBuilder() {
return new Builder();
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/HoodieFileSliceTestUtils.java
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/HoodieFileSliceTestUtils.java
index 9120a6d50d0c..2cf0ca226be5 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/HoodieFileSliceTestUtils.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/testutils/reader/HoodieFileSliceTestUtils.java
@@ -372,7 +372,7 @@ public class HoodieFileSliceTestUtils {
logFilePlan.getInstantTime(),
i,
blockType,
- logFilePlan.getWritePositions(),
+ logFilePlan.isWritePositions(),
keyToPositionMap));
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestClosableSortedDedupingIterator.java
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestClosableSortedDedupingIterator.java
index bd3d39b40711..7e98d30f65fc 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestClosableSortedDedupingIterator.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestClosableSortedDedupingIterator.java
@@ -17,6 +17,7 @@
package org.apache.hudi.common.util.collection;
+import lombok.Getter;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -318,6 +319,7 @@ public class TestClosableSortedDedupingIterator {
private static class AutoCloseableIterator implements Iterator<String>,
AutoCloseable {
private final List<String> data;
private int index = 0;
+ @Getter
private boolean closed = false;
public AutoCloseableIterator(List<String> data) {
@@ -341,10 +343,6 @@ public class TestClosableSortedDedupingIterator {
public void close() throws Exception {
closed = true;
}
-
- public boolean isClosed() {
- return closed;
- }
}
@Test
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestRocksDBDAO.java
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestRocksDBDAO.java
index 4a85b91c3d94..a9de2bf26fed 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestRocksDBDAO.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestRocksDBDAO.java
@@ -20,6 +20,7 @@ package org.apache.hudi.common.util.collection;
import org.apache.hudi.common.table.view.FileSystemViewStorageConfig;
+import lombok.Value;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -274,52 +275,12 @@ public class TestRocksDBDAO {
/**
* A payload definition for {@link TestRocksDBDAO}.
*/
+ @Value
public static class Payload<T> implements Serializable {
- private final String prefix;
- private final T key;
- private final String val;
- private final String family;
-
- public Payload(String prefix, T key, String val, String family) {
- this.prefix = prefix;
- this.key = key;
- this.val = val;
- this.family = family;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public T getKey() {
- return key;
- }
-
- public String getVal() {
- return val;
- }
-
- public String getFamily() {
- return family;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Payload payload = (Payload) o;
- return Objects.equals(prefix, payload.prefix) && Objects.equals(key,
payload.key)
- && Objects.equals(val, payload.val) && Objects.equals(family,
payload.family);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(prefix, key, val, family);
- }
+ String prefix;
+ T key;
+ String val;
+ String family;
}
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestSortingIterator.java
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestSortingIterator.java
index cbea8dd360ac..1fb19c6d5b87 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestSortingIterator.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/util/collection/TestSortingIterator.java
@@ -18,6 +18,7 @@
package org.apache.hudi.common.util.collection;
+import lombok.Getter;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -158,8 +159,11 @@ public class TestSortingIterator {
* Test implementation of AutoCloseable iterator for testing purposes
*/
private static class TestAutoCloseableIterator<T> implements Iterator<T>,
AutoCloseable {
+
private final Iterator<T> delegate;
+ @Getter
private boolean closed = false;
+ @Getter
private int closeCount = 0;
public TestAutoCloseableIterator(Iterator<T> delegate) {
@@ -183,13 +187,5 @@ public class TestSortingIterator {
closeCount++;
}
}
-
- public boolean isClosed() {
- return closed;
- }
-
- public int getCloseCount() {
- return closeCount;
- }
}
}
\ No newline at end of file
diff --git
a/hudi-common/src/test/java/org/apache/hudi/metadata/HoodieBackedTestDelayedTableMetadata.java
b/hudi-common/src/test/java/org/apache/hudi/metadata/HoodieBackedTestDelayedTableMetadata.java
index 51a300ef5822..526de15a05b7 100644
---
a/hudi-common/src/test/java/org/apache/hudi/metadata/HoodieBackedTestDelayedTableMetadata.java
+++
b/hudi-common/src/test/java/org/apache/hudi/metadata/HoodieBackedTestDelayedTableMetadata.java
@@ -23,15 +23,14 @@ import org.apache.hudi.common.config.HoodieMetadataConfig;
import org.apache.hudi.common.engine.HoodieEngineContext;
import org.apache.hudi.storage.HoodieStorage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
/**
* Table metadata provided by an internal DFS backed Hudi metadata table,
* with an intentional delay in `reset()` to test concurrent reads and writes.
*/
+@Slf4j
public class HoodieBackedTestDelayedTableMetadata extends
HoodieBackedTableMetadata {
- private static final Logger LOG =
LoggerFactory.getLogger(HoodieBackedTestDelayedTableMetadata.class);
public HoodieBackedTestDelayedTableMetadata(HoodieEngineContext
engineContext,
HoodieStorage storage,
@@ -43,13 +42,13 @@ public class HoodieBackedTestDelayedTableMetadata extends
HoodieBackedTableMetad
@Override
public void reset() {
- LOG.info("Sleeping for 5 seconds in reset() to simulate processing ...");
+ log.info("Sleeping for 5 seconds in reset() to simulate processing ...");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- LOG.warn("Sleep is interrupted", e);
+ log.warn("Sleep is interrupted", e);
}
- LOG.info("Sleep in reset() is finished.");
+ log.info("Sleep in reset() is finished.");
super.reset();
}
}
diff --git
a/hudi-common/src/test/java/org/apache/hudi/tableformat/TestActiveTimeline.java
b/hudi-common/src/test/java/org/apache/hudi/tableformat/TestActiveTimeline.java
index f8e4b8f0438d..2aec246a1618 100644
---
a/hudi-common/src/test/java/org/apache/hudi/tableformat/TestActiveTimeline.java
+++
b/hudi-common/src/test/java/org/apache/hudi/tableformat/TestActiveTimeline.java
@@ -24,6 +24,8 @@ import
org.apache.hudi.common.table.timeline.versioning.v2.ActiveTimelineV2;
import org.apache.hudi.common.table.timeline.versioning.v2.InstantComparatorV2;
import org.apache.hudi.common.util.collection.Pair;
+import lombok.NoArgsConstructor;
+
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -34,6 +36,7 @@ import java.util.stream.Stream;
/**
* An active timeline for test table format which merges timeline assuming
test-format as the source of truth.
*/
+@NoArgsConstructor
public class TestActiveTimeline extends ActiveTimelineV2 {
public TestActiveTimeline(
@@ -55,10 +58,6 @@ public class TestActiveTimeline extends ActiveTimelineV2 {
applyLayoutFilters);
}
- public TestActiveTimeline() {
-
- }
-
@Override
protected List<HoodieInstant> getInstantsFromFileSystem(
HoodieTableMetaClient metaClient,
diff --git
a/hudi-common/src/test/java/org/apache/hudi/tableformat/TestTableFormat.java
b/hudi-common/src/test/java/org/apache/hudi/tableformat/TestTableFormat.java
index 9781978a51ef..344b2111dc17 100644
--- a/hudi-common/src/test/java/org/apache/hudi/tableformat/TestTableFormat.java
+++ b/hudi-common/src/test/java/org/apache/hudi/tableformat/TestTableFormat.java
@@ -28,6 +28,8 @@ import org.apache.hudi.common.table.timeline.TimelineFactory;
import org.apache.hudi.common.table.view.FileSystemViewManager;
import org.apache.hudi.metadata.TableMetadataFactory;
+import lombok.NoArgsConstructor;
+
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -39,12 +41,10 @@ import java.util.function.Supplier;
* Test implementation of HoodieTableFormat that records all Hoodie instants
in memory.
* Used for functional testing of HoodieTableFormat.
*/
+@NoArgsConstructor
public class TestTableFormat implements HoodieTableFormat {
private static final Map<String, List<HoodieInstant>> RECORDED_INSTANTS =
new ConcurrentHashMap<>();
-
- public TestTableFormat() {
- }
public static List<HoodieInstant> getRecordedInstants(String basePath) {
return RECORDED_INSTANTS.getOrDefault(basePath, Collections.emptyList());
diff --git
a/hudi-common/src/test/java/org/apache/hudi/timeline/TestTimelineServiceClient.java
b/hudi-common/src/test/java/org/apache/hudi/timeline/TestTimelineServiceClient.java
index ae4aa5ae7ec9..b9baec2516c1 100644
---
a/hudi-common/src/test/java/org/apache/hudi/timeline/TestTimelineServiceClient.java
+++
b/hudi-common/src/test/java/org/apache/hudi/timeline/TestTimelineServiceClient.java
@@ -23,6 +23,9 @@ import org.apache.hudi.common.util.Option;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.apache.http.NoHttpResponseException;
import org.apache.http.ParseException;
import org.eclipse.jetty.server.Server;
@@ -173,30 +176,18 @@ class TestTimelineServiceClient {
}
}
+ @AllArgsConstructor
private static class InducedFailuresInfo {
private final ExceptionType exceptionType;
private final int maxInducedFailures;
- public InducedFailuresInfo(ExceptionType exceptionType, int
maxInducedFailures) {
- this.exceptionType = exceptionType;
- this.maxInducedFailures = maxInducedFailures;
- }
-
+ @Getter
+ @AllArgsConstructor(access = AccessLevel.PACKAGE)
public enum ExceptionType {
NO_HTTP_RESPONSE_EXCEPTION(NoHttpResponseException.class),
PARSE_EXCEPTION(ParseException.class);
private final Class<? extends Exception> exceptionType;
-
- // Constructor to set the float value for each enum constant
- ExceptionType(Class<? extends Exception> exceptionType) {
- this.exceptionType = exceptionType;
- }
-
- // Method to get the float value for an enum constant
- public Class<? extends Exception> getExceptionType() {
- return this.exceptionType;
- }
}
}
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ExpressionIndexSupport.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ExpressionIndexSupport.scala
index fad5b97323dc..1d20af05b7e8 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ExpressionIndexSupport.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ExpressionIndexSupport.scala
@@ -595,7 +595,7 @@ class ExpressionIndexSupport(spark: SparkSession,
}.toSet
// Update the map with the new partition and its file names
- partitionToFileMap.updated(partitionPath.path,
partitionToFileMap.getOrElse(partitionPath.path, Set.empty) ++ fileNames)
+ partitionToFileMap.updated(partitionPath.getPath,
partitionToFileMap.getOrElse(partitionPath.getPath, Set.empty) ++ fileNames)
case None =>
partitionToFileMap // Skip if no partition path
}
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
index 08a69f9348a5..9658fd451ec8 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
@@ -174,7 +174,7 @@ case class HoodieFileIndex(spark: SparkSession,
override def listFiles(partitionFilters: Seq[Expression], dataFilters:
Seq[Expression]): Seq[PartitionDirectory] = {
val slices = filterFileSlices(dataFilters, partitionFilters).flatMap(
{ case (partitionOpt, fileSlices) =>
- fileSlices.filter(!_.isEmpty).map(fs => (
InternalRow.fromSeq(partitionOpt.get.values), fs))
+ fileSlices.filter(!_.isEmpty).map(fs => (
InternalRow.fromSeq(partitionOpt.get.getValues), fs))
}
)
prepareFileSlices(slices)
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV1.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV1.scala
index 522152558085..e0fc7ceb6824 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV1.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV1.scala
@@ -137,7 +137,7 @@ case class MergeOnReadIncrementalRelationV1(override val
sqlContext: SQLContext,
val modifiedPartitions = getWritePartitionPaths(commitsMetadata)
fileIndex.listMatchingPartitionPaths(HoodieFileIndex.convertFilterForTimestampKeyGenerator(metaClient,
partitionFilters))
- .map(p => p.path).filter(p => modifiedPartitions.contains(p))
+ .map(p => p.getPath).filter(p => modifiedPartitions.contains(p))
.flatMap { relativePartitionPath =>
fsView.getLatestMergedFileSlicesBeforeOrOn(relativePartitionPath,
latestCommit).iterator().asScala
}
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV2.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV2.scala
index fb30b247093f..aea594d9157c 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV2.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelationV2.scala
@@ -131,7 +131,7 @@ case class MergeOnReadIncrementalRelationV2(override val
sqlContext: SQLContext,
val modifiedPartitions = getWritePartitionPaths(commitsMetadata)
fileIndex.listMatchingPartitionPaths(HoodieFileIndex.convertFilterForTimestampKeyGenerator(metaClient,
partitionFilters))
- .map(p => p.path).filter(p => modifiedPartitions.contains(p))
+ .map(p => p.getPath).filter(p => modifiedPartitions.contains(p))
.flatMap { relativePartitionPath =>
fsView.getLatestMergedFileSlicesBeforeOrOn(relativePartitionPath,
latestCommit).iterator().asScala
}
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/PartitionBucketIndexSupport.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/PartitionBucketIndexSupport.scala
index fd8a008bc36a..eb137e6336f5 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/PartitionBucketIndexSupport.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/PartitionBucketIndexSupport.scala
@@ -68,7 +68,7 @@ class PartitionBucketIndexSupport(spark: SparkSession,
Option.apply(prunedPartitionsAndFileSlices.flatMap(v => {
val partitionPathOption = v._1
val fileSlices = v._2
- val numBuckets =
calc.get.computeNumBuckets(partitionPathOption.getOrElse(new PartitionPath("",
Array())).path)
+ val numBuckets =
calc.get.computeNumBuckets(partitionPathOption.getOrElse(new PartitionPath("",
Array())).getPath)
val bucketIdsBitMapByFilter =
filterQueriesWithBucketHashField(queryFilters, numBuckets)
if (bucketIdsBitMapByFilter.isDefined &&
bucketIdsBitMapByFilter.get.cardinality() > 0) {
val allFilesName = getPrunedPartitionsAndFileNames(fileIndex,
Seq((partitionPathOption, fileSlices)))._2
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkBaseIndexSupport.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkBaseIndexSupport.scala
index cad2754c0759..594fd9cad9a3 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkBaseIndexSupport.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkBaseIndexSupport.scala
@@ -85,7 +85,7 @@ abstract class SparkBaseIndexSupport(spark: SparkSession,
Seq[FileSlice])]): (Set[String],
Set[String]) = {
val (prunedPartitions, prunedFiles) =
prunedPartitionsAndFileSlices.foldLeft((Set.empty[String], Set.empty[String])) {
case ((partitionSet, fileSet), (partitionPathOpt, fileSlices)) =>
- val updatedPartitionSet =
partitionPathOpt.map(_.path).map(partitionSet + _).getOrElse(partitionSet)
+ val updatedPartitionSet =
partitionPathOpt.map(_.getPath).map(partitionSet + _).getOrElse(partitionSet)
val updatedFileSet = fileSlices.foldLeft(fileSet) { (fileAcc,
fileSlice) =>
val baseFile =
Option(fileSlice.getBaseFile.orElse(null)).map(_.getFileName)
val logFiles = if (fileIndex.includeLogFiles) {
diff --git
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala
index ad4fab8e5c3d..cd79b78ddb81 100644
---
a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala
+++
b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala
@@ -198,7 +198,7 @@ class SparkHoodieTableFileIndex(spark: SparkSession,
// Prune the partition path by the partition filters
val prunedPartitions = listMatchingPartitionPaths(partitionFilters)
getInputFileSlices(prunedPartitions: _*).asScala.map {
- case (partition, fileSlices) => (partition.path,
fileSlices.asScala.toSeq)
+ case (partition, fileSlices) => (partition.getPath,
fileSlices.asScala.toSeq)
}.toMap
}
@@ -272,7 +272,7 @@ class SparkHoodieTableFileIndex(spark: SparkSession,
.asInstanceOf[BasePredicate]
}
val prunedPartitionPaths = partitionPaths.filter {
- partitionPath =>
boundPredicate.eval(InternalRow.fromSeq(partitionPath.values))
+ partitionPath =>
boundPredicate.eval(InternalRow.fromSeq(partitionPath.getValues))
}.toSeq
logInfo(s"Using provided predicates to prune number of target table's
partitions scanned from" +
@@ -281,7 +281,7 @@ class SparkHoodieTableFileIndex(spark: SparkSession,
prunedPartitionPaths
} else {
logWarning(s"Unable to apply partition pruning, due to failure to
parse partition values from the" +
- s" following path(s): ${partitionPaths.find(_.values.length ==
0).map(e => e.getPath)}")
+ s" following path(s): ${partitionPaths.find(_.getValues.length ==
0).map(e => e.getPath)}")
partitionPaths.toSeq
}
@@ -444,7 +444,7 @@ object SparkHoodieTableFileIndex extends
SparkAdapterSupport {
private val PUT_LEAF_FILES_METHOD_NAME = "putLeafFiles"
private def haveProperPartitionValues(partitionPaths: Seq[PartitionPath]) = {
- partitionPaths.forall(_.values.length > 0)
+ partitionPaths.forall(_.getValues.length > 0)
}
private def extractEqualityPredicatesLiteralValues(predicates:
Seq[Expression], zoneId: String): Map[String, (String, Option[Any])] = {
diff --git
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieFileIndex.scala
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieFileIndex.scala
index fa79272acb16..d5e0c6a927ac 100644
---
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieFileIndex.scala
+++
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieFileIndex.scala
@@ -740,7 +740,7 @@ class TestHoodieFileIndex extends HoodieSparkClientTestBase
with ScalaAssertionS
val fileIndex = HoodieFileIndex(spark, metaClient, None,
queryOpts ++ Map(HoodieMetadataConfig.ENABLE.key ->
useMetaFileList.toString))
// test if table is partitioned on nested columns,
getAllQueryPartitionPaths does not break
- assert(fileIndex.getAllQueryPartitionPaths.get(0).path.equals("c"))
+ assert(fileIndex.getAllQueryPartitionPaths.get(0).getPath.equals("c"))
}
@Test