ajantha-bhat commented on code in PR #8701:
URL: https://github.com/apache/iceberg/pull/8701#discussion_r1355276522


##########
kafka-connect/kafka-connect-events/src/main/java/org/apache/iceberg/connect/events/CommitCompletePayload.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.iceberg.connect.events;
+
+import java.util.UUID;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaBuilder;
+
+public class CommitCompletePayload implements Payload {
+
+  private UUID commitId;
+  private Long vtts;
+  private final Schema avroSchema;
+
+  private static final Schema AVRO_SCHEMA =
+      SchemaBuilder.builder()
+          .record(CommitCompletePayload.class.getName())
+          .fields()
+          .name("commitId")
+          .prop(FIELD_ID_PROP, DUMMY_FIELD_ID)
+          .type(UUID_SCHEMA)
+          .noDefault()
+          .name("vtts")
+          .prop(FIELD_ID_PROP, DUMMY_FIELD_ID)
+          .type()
+          .nullable()
+          .longType()
+          .noDefault()
+          .endRecord();
+
+  // Used by Avro reflection to instantiate this class when reading events
+  public CommitCompletePayload(Schema avroSchema) {
+    this.avroSchema = avroSchema;
+  }
+
+  public CommitCompletePayload(UUID commitId, Long vtts) {
+    this.commitId = commitId;
+    this.vtts = vtts;
+    this.avroSchema = AVRO_SCHEMA;
+  }
+
+  public UUID commitId() {
+    return commitId;
+  }
+
+  public Long vtts() {

Review Comment:
   Can you please add a comment explaining this field? I can understand it is 
some time-stamp. But not clearly with the abbreviation. 



##########
kafka-connect/kafka-connect-events/src/test/java/org/apache/iceberg/connect/events/EventTestUtil.java:
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.iceberg.connect.events;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileContent;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.Metrics;
+import org.apache.iceberg.PartitionData;
+import org.apache.iceberg.common.DynConstructors;
+import org.apache.iceberg.common.DynConstructors.Ctor;
+import org.apache.iceberg.types.Types.NestedField;
+import org.apache.iceberg.types.Types.StringType;
+import org.apache.iceberg.types.Types.StructType;
+
+public class EventTestUtil {
+  public static DataFile createDataFile() {
+    Ctor<DataFile> ctor =
+        DynConstructors.builder(DataFile.class)
+            .hiddenImpl(
+                "org.apache.iceberg.GenericDataFile",
+                int.class,
+                String.class,
+                FileFormat.class,
+                PartitionData.class,
+                long.class,
+                Metrics.class,
+                ByteBuffer.class,
+                List.class,
+                int[].class,
+                Integer.class)
+            .build();
+
+    PartitionData partitionData =
+        new PartitionData(StructType.of(NestedField.required(999, "type", 
StringType.get())));
+    Metrics metrics =
+        new Metrics(
+            1L,
+            Collections.emptyMap(),
+            Collections.emptyMap(),
+            Collections.emptyMap(),
+            Collections.emptyMap());
+
+    return ctor.newInstance(
+        1,
+        "path",
+        FileFormat.PARQUET,
+        partitionData,
+        1L,
+        metrics,
+        ByteBuffer.wrap(new byte[] {0}),
+        null,
+        null,
+        1);
+  }
+
+  public static DeleteFile createDeleteFile() {
+    Ctor<DeleteFile> ctor =
+        DynConstructors.builder(DeleteFile.class)
+            .hiddenImpl(
+                "org.apache.iceberg.GenericDeleteFile",
+                int.class,
+                FileContent.class,
+                String.class,
+                FileFormat.class,
+                PartitionData.class,
+                long.class,
+                Metrics.class,
+                int[].class,
+                Integer.class,
+                List.class,
+                ByteBuffer.class)
+            .build();
+
+    PartitionData partitionData =
+        new PartitionData(StructType.of(NestedField.required(999, "type", 
StringType.get())));
+    Metrics metrics =
+        new Metrics(
+            1L,
+            Collections.emptyMap(),
+            Collections.emptyMap(),
+            Collections.emptyMap(),
+            Collections.emptyMap());
+
+    return ctor.newInstance(
+        1,
+        FileContent.EQUALITY_DELETES,
+        "path",
+        FileFormat.PARQUET,
+        partitionData,
+        1L,
+        metrics,
+        new int[] {1},
+        1,
+        Collections.singletonList(1L),
+        ByteBuffer.wrap(new byte[] {0}));
+  }
+
+  private EventTestUtil() {}

Review Comment:
   nit: Can we move the constructor up?



##########
kafka-connect/kafka-connect-events/src/test/java/org/apache/iceberg/connect/events/EventSerializationTest.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.iceberg.connect.events;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.UUID;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.types.Types.StructType;
+import org.junit.jupiter.api.Test;
+
+public class EventSerializationTest {

Review Comment:
   nit: Majority of the testcase in Iceberg starts with Test prefix. So, maybe 
we can rename it. 



##########
kafka-connect/kafka-connect-events/src/main/java/org/apache/iceberg/connect/events/TableName.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.iceberg.connect.events;
+
+import static java.util.stream.Collectors.toList;
+
+import java.util.Arrays;
+import java.util.List;
+import org.apache.avro.Schema;
+import org.apache.avro.SchemaBuilder;
+import org.apache.avro.util.Utf8;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
+
+public class TableName implements Element {

Review Comment:
   nit: TableName may give an impression that it doesn't contain the namespace 
info. 
   Can be `TableInfo` or `TableIdentifier`?



-- 
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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to