Copilot commented on code in PR #1605:
URL: https://github.com/apache/fluss/pull/1605#discussion_r2312477127


##########
fluss-common/src/main/java/org/apache/fluss/record/MemoryLogRecordsIndexedBuilder.java:
##########
@@ -70,31 +39,13 @@ private MemoryLogRecordsIndexedBuilder(
             byte magic,
             AbstractPagedOutputView pagedOutputView,
             boolean appendOnly) {
-        this.appendOnly = appendOnly;
-        checkArgument(
-                schemaId <= Short.MAX_VALUE,
-                "schemaId shouldn't be greater than the max value of short: " 
+ Short.MAX_VALUE);
-        this.baseLogOffset = baseLogOffset;
-        this.schemaId = schemaId;
-        this.writeLimit = writeLimit;
-        this.magic = magic;
-        this.pagedOutputView = pagedOutputView;
-        this.firstSegment = pagedOutputView.getCurrentSegment();
-        this.writerId = NO_WRITER_ID;
-        this.batchSequence = NO_BATCH_SEQUENCE;
-        this.currentRecordNumber = 0;
-        this.isClosed = false;
-
-        // We don't need to write header information while the builder 
creating,
-        // we'll skip it first.
-        this.pagedOutputView.setPosition(RECORD_BATCH_HEADER_SIZE);
-        this.sizeInBytes = RECORD_BATCH_HEADER_SIZE;
+        super(baseLogOffset, schemaId, writeLimit, magic, pagedOutputView, 
appendOnly);
     }
 
     public static MemoryLogRecordsIndexedBuilder builder(
             int schemaId, int writeLimit, AbstractPagedOutputView outputView, 
boolean appendOnly) {
         return new MemoryLogRecordsIndexedBuilder(
-                BUILDER_DEFAULT_OFFSET,
+                LOG_MAGIC_VALUE_V0,

Review Comment:
   The first parameter should be `BUILDER_DEFAULT_OFFSET` (0) for the base log 
offset, not `LOG_MAGIC_VALUE_V0`. The parameter order is baseLogOffset, 
schemaId, writeLimit, magic, outputView, appendOnly.



##########
fluss-common/src/main/java/org/apache/fluss/record/MemoryLogRecordsCompactedBuilder.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fluss.record;
+
+import org.apache.fluss.annotation.VisibleForTesting;
+import org.apache.fluss.memory.AbstractPagedOutputView;
+import org.apache.fluss.row.compacted.CompactedRow;
+
+import java.io.IOException;
+
+import static org.apache.fluss.record.LogRecordBatch.CURRENT_LOG_MAGIC_VALUE;
+import static org.apache.fluss.record.LogRecordBatch.LOG_MAGIC_VALUE_V0;
+
+/**
+ * Default builder for {@link MemoryLogRecords} of log records in {@link
+ * org.apache.fluss.metadata.LogFormat#COMPACTED} format.
+ */
+public class MemoryLogRecordsCompactedBuilder
+        extends AbstractRowMemoryLogRecordsBuilder<CompactedRow> {
+
+    private MemoryLogRecordsCompactedBuilder(
+            long baseLogOffset,
+            int schemaId,
+            int writeLimit,
+            byte magic,
+            AbstractPagedOutputView pagedOutputView,
+            boolean appendOnly) {
+        super(baseLogOffset, schemaId, writeLimit, magic, pagedOutputView, 
appendOnly);
+    }
+
+    public static MemoryLogRecordsCompactedBuilder builder(
+            int schemaId, int writeLimit, AbstractPagedOutputView outputView, 
boolean appendOnly) {
+        return new MemoryLogRecordsCompactedBuilder(
+                LOG_MAGIC_VALUE_V0,

Review Comment:
   The first parameter should be `BUILDER_DEFAULT_OFFSET` (0) for the base log 
offset, not `LOG_MAGIC_VALUE_V0`. The parameter order is baseLogOffset, 
schemaId, writeLimit, magic, outputView, appendOnly.



-- 
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: issues-unsubscr...@fluss.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to