CTTY commented on code in PR #17785:
URL: https://github.com/apache/hudi/pull/17785#discussion_r2785073571
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFormatWriter.java:
##########
@@ -42,47 +43,45 @@
/**
* HoodieLogFormatWriter can be used to append blocks to a log file Use
HoodieLogFormat.WriterBuilder to construct.
*/
+@Getter
@Slf4j
-public class HoodieLogFormatWriter implements HoodieLogFormat.Writer {
+public class HoodieLogFormatWriter extends HoodieLogFormat.Writer {
- @Getter
- private HoodieLogFile logFile;
- private FSDataOutputStream output;
-
- private final HoodieStorage storage;
- @Getter
- private final long sizeThreshold;
- private final Integer bufferSize;
private final Short replication;
- private final String rolloverLogWriteToken;
- private final LogFileCreationCallback fileCreationHook;
+ private FSDataOutputStream outputStream;
private boolean closed = false;
private transient Thread shutdownThread = null;
- public HoodieLogFormatWriter(
- HoodieStorage storage,
- HoodieLogFile logFile,
+ @Builder(setterPrefix = "with")
+ private HoodieLogFormatWriter(
Integer bufferSize,
- Short replication,
+ HoodieStorage storage,
+ StoragePath parentPath,
+ String logFileId,
+ String fileExtension,
+ String instantTime,
+ Integer logVersion,
+ String logWriteToken,
+ String suffix,
+ Long fileLen,
Review Comment:
Same here
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java:
##########
@@ -288,11 +289,11 @@ protected HoodieLogFormat.Writer createLogWriter(String
instantTime, Option<File
protected HoodieLogFormat.Writer createLogWriter(String instantTime, String
fileSuffix, Option<FileSlice> fileSliceOpt) {
try {
if
(config.getWriteVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
- return HoodieLogFormat.newWriterBuilder()
-
.onParentPath(FSUtils.constructAbsolutePath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
- .withFileId(fileId)
+ return HoodieLogFormatWriter.builder()
+
.withParentPath(FSUtils.constructAbsolutePath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
+ .withLogFileId(fileId)
.withInstantTime(instantTime)
- .withFileSize(0L)
+ .withFileLen(0L)
Review Comment:
Should we change these names back to `FileSize` as well
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java:
##########
@@ -305,12 +306,12 @@ protected HoodieLogFormat.Writer createLogWriter(String
instantTime, String file
Option<HoodieLogFile> latestLogFile = fileSliceOpt.isPresent()
? fileSliceOpt.get().getLatestLogFile()
: Option.empty();
- return HoodieLogFormat.newWriterBuilder()
-
.onParentPath(FSUtils.constructAbsolutePath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
- .withFileId(fileId)
+ return HoodieLogFormatWriter.builder()
+
.withParentPath(FSUtils.constructAbsolutePath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
+ .withLogFileId(fileId)
.withInstantTime(instantTime)
.withLogVersion(latestLogFile.map(HoodieLogFile::getLogVersion).orElse(HoodieLogFile.LOGFILE_BASE_VERSION))
-
.withFileSize(latestLogFile.map(HoodieLogFile::getFileSize).orElse(0L))
+
.withFileLen(latestLogFile.map(HoodieLogFile::getFileSize).orElse(0L))
Review Comment:
Same here
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFormatWriter.java:
##########
@@ -42,47 +43,45 @@
/**
* HoodieLogFormatWriter can be used to append blocks to a log file Use
HoodieLogFormat.WriterBuilder to construct.
*/
+@Getter
@Slf4j
-public class HoodieLogFormatWriter implements HoodieLogFormat.Writer {
+public class HoodieLogFormatWriter extends HoodieLogFormat.Writer {
- @Getter
- private HoodieLogFile logFile;
- private FSDataOutputStream output;
-
- private final HoodieStorage storage;
- @Getter
- private final long sizeThreshold;
- private final Integer bufferSize;
private final Short replication;
- private final String rolloverLogWriteToken;
- private final LogFileCreationCallback fileCreationHook;
+ private FSDataOutputStream outputStream;
private boolean closed = false;
private transient Thread shutdownThread = null;
- public HoodieLogFormatWriter(
- HoodieStorage storage,
- HoodieLogFile logFile,
+ @Builder(setterPrefix = "with")
+ private HoodieLogFormatWriter(
Integer bufferSize,
- Short replication,
+ HoodieStorage storage,
+ StoragePath parentPath,
+ String logFileId,
+ String fileExtension,
+ String instantTime,
+ Integer logVersion,
+ String logWriteToken,
+ String suffix,
+ Long fileLen,
Long sizeThreshold,
- String rolloverLogWriteToken,
- LogFileCreationCallback fileCreationHook) {
- this.storage = storage;
- this.logFile = logFile;
- this.sizeThreshold = sizeThreshold;
- this.bufferSize = bufferSize != null ? bufferSize :
storage.getDefaultBufferSize();
+ LogFileCreationCallback fileCreationCallback,
+ HoodieTableVersion tableVersion,
+ Short replication
+ ) throws IOException {
+ super(bufferSize, storage, parentPath, logFileId, fileExtension,
instantTime, logVersion, logWriteToken,
+ suffix, fileLen, sizeThreshold, fileCreationCallback, tableVersion);
Review Comment:
Same here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]