Copilot commented on code in PR #18234:
URL: https://github.com/apache/pinot/pull/18234#discussion_r3112764295


##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ProtoBufCodeGenMessageDecoderTest.java:
##########
@@ -0,0 +1,290 @@
+/**
+ * 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.pinot.integration.tests.custom;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.os72.protobuf.dynamic.DynamicSchema;
+import com.google.common.primitives.Longs;
+import com.google.protobuf.Descriptors;
+import com.google.protobuf.DynamicMessage;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import org.apache.pinot.integration.tests.ClusterIntegrationTestUtils;
+import 
org.apache.pinot.plugin.inputformat.protobuf.ProtoBufCodeGenMessageDecoder;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.DateTimeFieldSpec;
+import org.apache.pinot.spi.data.DimensionFieldSpec;
+import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.stream.StreamConfigProperties;
+import org.apache.pinot.spi.stream.StreamDataProducer;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+
+/**
+ * Integration test for {@link ProtoBufCodeGenMessageDecoder}.
+ *
+ * <p>Pushes protobuf-serialized {@code SampleRecord} messages (defined in 
{@code sample.proto})
+ * into Kafka, configures a realtime Pinot table to decode them with {@link 
ProtoBufCodeGenMessageDecoder},
+ * and validates that data is ingested and queryable.
+ *
+ * <p>Required test resources in {@code 
pinot-integration-tests/src/test/resources/}:
+ * <ul>
+ *   <li>{@code sample-samplerecord.jar} — compiled protobuf classes for 
{@code SampleRecord}.
+ *       To regenerate: copy {@code sample.jar} from
+ *       {@code 
pinot-plugins/pinot-input-format/pinot-protobuf/src/test/resources/}.</li>
+ *   <li>{@code sample-samplerecord.desc} — binary {@code FileDescriptorSet} 
for constructing
+ *       messages via {@link DynamicMessage} without a generated Java class.
+ *       To regenerate: copy {@code sample.desc} from the same source 
directory.</li>
+ * </ul>
+ * Both resources are copies of the test resources in {@code pinot-protobuf}, 
renamed to avoid
+ * classpath conflicts with that module's own resources when both are on the 
test classpath.
+ *
+ * <p>Thread-safety: inherits the shared-cluster pattern from {@link 
CustomDataQueryClusterIntegrationTest}.
+ */
+public class ProtoBufCodeGenMessageDecoderTest extends 
CustomDataQueryClusterIntegrationTest {
+
+  private static final String TABLE_NAME = "ProtoBufCodeGenTest";
+  private static final int NUM_RECORDS = 200;
+  private static final int NUM_DISTINCT_FRIENDS = 5;
+  private static final String PROTO_CLASS_NAME_VALUE =
+      "org.apache.pinot.plugin.inputformat.protobuf.Sample$SampleRecord";
+  private static final String PROTO_DESCRIPTOR_RESOURCE = 
"sample-samplerecord.desc";
+  private static final String PROTO_JAR_RESOURCE = "sample-samplerecord.jar";
+  private static final String PROTO_MESSAGE_TYPE = "SampleRecord";
+
+  private static final String COL_NAME = "name";
+  private static final String COL_ID = "id";
+  private static final String COL_EMAIL = "email";
+  private static final String COL_FRIENDS = "friends";
+
+  @Override
+  public String getTableName() {
+    return TABLE_NAME;
+  }
+
+  @Override
+  public Schema createSchema() {
+    return new Schema.SchemaBuilder()
+        .setSchemaName(TABLE_NAME)
+        .addField(new DimensionFieldSpec(COL_NAME, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_EMAIL, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_FRIENDS, 
FieldSpec.DataType.STRING, false))
+        .addField(new DateTimeFieldSpec(COL_ID, FieldSpec.DataType.INT,
+            "1:SECONDS:EPOCH", "1:SECONDS"))
+        .build();
+  }
+
+  @Override
+  public long getCountStarResult() {
+    return NUM_RECORDS;
+  }
+
+  @Override
+  public boolean isRealtimeTable() {
+    return true;
+  }
+
+  @Override
+  protected Map<String, String> getStreamConfigMap() {
+    Map<String, String> streamConfigMap = super.getStreamConfigMap();
+    String streamType = "kafka";
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType, 
StreamConfigProperties.STREAM_DECODER_CLASS),
+        ProtoBufCodeGenMessageDecoder.class.getName());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + 
ProtoBufCodeGenMessageDecoder.PROTOBUF_JAR_FILE_PATH),
+        getJarFileUri());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + ProtoBufCodeGenMessageDecoder.PROTO_CLASS_NAME),
+        PROTO_CLASS_NAME_VALUE);
+    return streamConfigMap;
+  }
+
+  @Override
+  protected TableConfig createRealtimeTableConfig(File sampleAvroFile) {
+    // sampleAvroFile is not used — data is pushed as protobuf bytes, not Avro
+    return new TableConfigBuilder(TableType.REALTIME)
+        .setTableName(getTableName())
+        .setStreamConfigs(getStreamConfigs())
+        .setTimeColumnName(COL_ID)
+        .setNumReplicas(getNumReplicas())
+        .build();
+  }
+
+  /**
+   * Returns a single dummy file. The base class passes {@code 
avroFiles.get(0)} to
+   * {@link #createRealtimeTableConfig(File)}, so the list must be non-empty. 
The file is not read.
+   */
+  @Override
+  public List<File> createAvroFiles()
+      throws Exception {
+    File dummy = new File(_tempDir, "dummy.avro");
+    dummy.createNewFile();
+    return List.of(dummy);
+  }
+
+  /**
+   * Pushes {@link #NUM_RECORDS} protobuf-encoded {@code SampleRecord} 
messages to Kafka.
+   *
+   * <p>Uses {@link DynamicMessage} with the pre-compiled {@code 
sample-samplerecord.desc} descriptor
+   * so no generated Java sources are needed at compile time.
+   *
+   * <p>Each record {@code i} has:
+   * <ul>
+   *   <li>{@code id = i} (also the time column, values 0–{@link 
#NUM_RECORDS})</li>

Review Comment:
   The Javadoc claims id values are "0–NUM_RECORDS", but the loop produces ids 
in the range 0..NUM_RECORDS-1. Updating the comment avoids confusion when 
debugging ingestion/query results.
   ```suggestion
      *   <li>{@code id = i} (also the time column, values 0–{@code NUM_RECORDS 
- 1})</li>
   ```



##########
pinot-integration-tests/src/test/resources/sample-samplerecord.desc:
##########
@@ -0,0 +1,8 @@
+
+�
+sample.proto,org.apache.pinot.plugin.inputformat.protobuf"b
+SampleRecord
+name (     Rname
+id (Rid
+email (    Remail
+friends (  Rfriendsbproto3

Review Comment:
   This descriptor file is binary protobuf content checked into git, which is 
difficult to review and easy to drift from its source .proto over time. 
Consider generating it during the build/test setup from a checked-in .proto (or 
another reproducible source) so the repo doesn’t need to track opaque binary 
blobs.
   ```suggestion
   syntax = "proto3";
   
   package org.apache.pinot.plugin.inputformat.protobuf;
   
   message SampleRecord {
     string name = 1;
     int32 id = 2;
     string email = 3;
     repeated string friends = 4;
   }
   ```



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ProtoBufCodeGenMessageDecoderTest.java:
##########
@@ -0,0 +1,290 @@
+/**
+ * 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.pinot.integration.tests.custom;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.os72.protobuf.dynamic.DynamicSchema;
+import com.google.common.primitives.Longs;
+import com.google.protobuf.Descriptors;
+import com.google.protobuf.DynamicMessage;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import org.apache.pinot.integration.tests.ClusterIntegrationTestUtils;
+import 
org.apache.pinot.plugin.inputformat.protobuf.ProtoBufCodeGenMessageDecoder;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.DateTimeFieldSpec;
+import org.apache.pinot.spi.data.DimensionFieldSpec;
+import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.stream.StreamConfigProperties;
+import org.apache.pinot.spi.stream.StreamDataProducer;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+
+/**
+ * Integration test for {@link ProtoBufCodeGenMessageDecoder}.
+ *
+ * <p>Pushes protobuf-serialized {@code SampleRecord} messages (defined in 
{@code sample.proto})
+ * into Kafka, configures a realtime Pinot table to decode them with {@link 
ProtoBufCodeGenMessageDecoder},
+ * and validates that data is ingested and queryable.
+ *
+ * <p>Required test resources in {@code 
pinot-integration-tests/src/test/resources/}:
+ * <ul>
+ *   <li>{@code sample-samplerecord.jar} — compiled protobuf classes for 
{@code SampleRecord}.
+ *       To regenerate: copy {@code sample.jar} from
+ *       {@code 
pinot-plugins/pinot-input-format/pinot-protobuf/src/test/resources/}.</li>
+ *   <li>{@code sample-samplerecord.desc} — binary {@code FileDescriptorSet} 
for constructing
+ *       messages via {@link DynamicMessage} without a generated Java class.
+ *       To regenerate: copy {@code sample.desc} from the same source 
directory.</li>
+ * </ul>
+ * Both resources are copies of the test resources in {@code pinot-protobuf}, 
renamed to avoid
+ * classpath conflicts with that module's own resources when both are on the 
test classpath.
+ *
+ * <p>Thread-safety: inherits the shared-cluster pattern from {@link 
CustomDataQueryClusterIntegrationTest}.
+ */
+public class ProtoBufCodeGenMessageDecoderTest extends 
CustomDataQueryClusterIntegrationTest {
+
+  private static final String TABLE_NAME = "ProtoBufCodeGenTest";
+  private static final int NUM_RECORDS = 200;
+  private static final int NUM_DISTINCT_FRIENDS = 5;
+  private static final String PROTO_CLASS_NAME_VALUE =
+      "org.apache.pinot.plugin.inputformat.protobuf.Sample$SampleRecord";
+  private static final String PROTO_DESCRIPTOR_RESOURCE = 
"sample-samplerecord.desc";
+  private static final String PROTO_JAR_RESOURCE = "sample-samplerecord.jar";
+  private static final String PROTO_MESSAGE_TYPE = "SampleRecord";
+
+  private static final String COL_NAME = "name";
+  private static final String COL_ID = "id";
+  private static final String COL_EMAIL = "email";
+  private static final String COL_FRIENDS = "friends";
+
+  @Override
+  public String getTableName() {
+    return TABLE_NAME;
+  }
+
+  @Override
+  public Schema createSchema() {
+    return new Schema.SchemaBuilder()
+        .setSchemaName(TABLE_NAME)
+        .addField(new DimensionFieldSpec(COL_NAME, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_EMAIL, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_FRIENDS, 
FieldSpec.DataType.STRING, false))
+        .addField(new DateTimeFieldSpec(COL_ID, FieldSpec.DataType.INT,
+            "1:SECONDS:EPOCH", "1:SECONDS"))
+        .build();
+  }
+
+  @Override
+  public long getCountStarResult() {
+    return NUM_RECORDS;
+  }
+
+  @Override
+  public boolean isRealtimeTable() {
+    return true;
+  }
+
+  @Override
+  protected Map<String, String> getStreamConfigMap() {
+    Map<String, String> streamConfigMap = super.getStreamConfigMap();
+    String streamType = "kafka";
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType, 
StreamConfigProperties.STREAM_DECODER_CLASS),
+        ProtoBufCodeGenMessageDecoder.class.getName());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + 
ProtoBufCodeGenMessageDecoder.PROTOBUF_JAR_FILE_PATH),
+        getJarFileUri());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + ProtoBufCodeGenMessageDecoder.PROTO_CLASS_NAME),
+        PROTO_CLASS_NAME_VALUE);
+    return streamConfigMap;
+  }
+
+  @Override
+  protected TableConfig createRealtimeTableConfig(File sampleAvroFile) {
+    // sampleAvroFile is not used — data is pushed as protobuf bytes, not Avro
+    return new TableConfigBuilder(TableType.REALTIME)
+        .setTableName(getTableName())
+        .setStreamConfigs(getStreamConfigs())
+        .setTimeColumnName(COL_ID)
+        .setNumReplicas(getNumReplicas())
+        .build();
+  }
+
+  /**
+   * Returns a single dummy file. The base class passes {@code 
avroFiles.get(0)} to
+   * {@link #createRealtimeTableConfig(File)}, so the list must be non-empty. 
The file is not read.
+   */
+  @Override
+  public List<File> createAvroFiles()
+      throws Exception {
+    File dummy = new File(_tempDir, "dummy.avro");
+    dummy.createNewFile();

Review Comment:
   `dummy.createNewFile()` ignores the return value and doesn’t guarantee the 
file exists/was created successfully. Since the file is never read, it may be 
simpler to skip creating it entirely (just return a placeholder File), or 
create a temp file and assert/ensure it exists to avoid silent setup issues.
   ```suggestion
   
   ```



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ProtoBufCodeGenMessageDecoderTest.java:
##########
@@ -0,0 +1,290 @@
+/**
+ * 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.pinot.integration.tests.custom;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.os72.protobuf.dynamic.DynamicSchema;
+import com.google.common.primitives.Longs;
+import com.google.protobuf.Descriptors;
+import com.google.protobuf.DynamicMessage;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import org.apache.pinot.integration.tests.ClusterIntegrationTestUtils;
+import 
org.apache.pinot.plugin.inputformat.protobuf.ProtoBufCodeGenMessageDecoder;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.DateTimeFieldSpec;
+import org.apache.pinot.spi.data.DimensionFieldSpec;
+import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.stream.StreamConfigProperties;
+import org.apache.pinot.spi.stream.StreamDataProducer;
+import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+
+/**
+ * Integration test for {@link ProtoBufCodeGenMessageDecoder}.
+ *
+ * <p>Pushes protobuf-serialized {@code SampleRecord} messages (defined in 
{@code sample.proto})
+ * into Kafka, configures a realtime Pinot table to decode them with {@link 
ProtoBufCodeGenMessageDecoder},
+ * and validates that data is ingested and queryable.
+ *
+ * <p>Required test resources in {@code 
pinot-integration-tests/src/test/resources/}:
+ * <ul>
+ *   <li>{@code sample-samplerecord.jar} — compiled protobuf classes for 
{@code SampleRecord}.
+ *       To regenerate: copy {@code sample.jar} from
+ *       {@code 
pinot-plugins/pinot-input-format/pinot-protobuf/src/test/resources/}.</li>
+ *   <li>{@code sample-samplerecord.desc} — binary {@code FileDescriptorSet} 
for constructing
+ *       messages via {@link DynamicMessage} without a generated Java class.
+ *       To regenerate: copy {@code sample.desc} from the same source 
directory.</li>
+ * </ul>
+ * Both resources are copies of the test resources in {@code pinot-protobuf}, 
renamed to avoid
+ * classpath conflicts with that module's own resources when both are on the 
test classpath.
+ *
+ * <p>Thread-safety: inherits the shared-cluster pattern from {@link 
CustomDataQueryClusterIntegrationTest}.
+ */
+public class ProtoBufCodeGenMessageDecoderTest extends 
CustomDataQueryClusterIntegrationTest {
+
+  private static final String TABLE_NAME = "ProtoBufCodeGenTest";
+  private static final int NUM_RECORDS = 200;
+  private static final int NUM_DISTINCT_FRIENDS = 5;
+  private static final String PROTO_CLASS_NAME_VALUE =
+      "org.apache.pinot.plugin.inputformat.protobuf.Sample$SampleRecord";
+  private static final String PROTO_DESCRIPTOR_RESOURCE = 
"sample-samplerecord.desc";
+  private static final String PROTO_JAR_RESOURCE = "sample-samplerecord.jar";
+  private static final String PROTO_MESSAGE_TYPE = "SampleRecord";
+
+  private static final String COL_NAME = "name";
+  private static final String COL_ID = "id";
+  private static final String COL_EMAIL = "email";
+  private static final String COL_FRIENDS = "friends";
+
+  @Override
+  public String getTableName() {
+    return TABLE_NAME;
+  }
+
+  @Override
+  public Schema createSchema() {
+    return new Schema.SchemaBuilder()
+        .setSchemaName(TABLE_NAME)
+        .addField(new DimensionFieldSpec(COL_NAME, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_EMAIL, FieldSpec.DataType.STRING, 
true))
+        .addField(new DimensionFieldSpec(COL_FRIENDS, 
FieldSpec.DataType.STRING, false))
+        .addField(new DateTimeFieldSpec(COL_ID, FieldSpec.DataType.INT,
+            "1:SECONDS:EPOCH", "1:SECONDS"))
+        .build();
+  }
+
+  @Override
+  public long getCountStarResult() {
+    return NUM_RECORDS;
+  }
+
+  @Override
+  public boolean isRealtimeTable() {
+    return true;
+  }
+
+  @Override
+  protected Map<String, String> getStreamConfigMap() {
+    Map<String, String> streamConfigMap = super.getStreamConfigMap();
+    String streamType = "kafka";
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType, 
StreamConfigProperties.STREAM_DECODER_CLASS),
+        ProtoBufCodeGenMessageDecoder.class.getName());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + 
ProtoBufCodeGenMessageDecoder.PROTOBUF_JAR_FILE_PATH),
+        getJarFileUri());
+    streamConfigMap.put(
+        StreamConfigProperties.constructStreamProperty(streamType,
+            "decoder.prop." + ProtoBufCodeGenMessageDecoder.PROTO_CLASS_NAME),
+        PROTO_CLASS_NAME_VALUE);
+    return streamConfigMap;
+  }
+
+  @Override
+  protected TableConfig createRealtimeTableConfig(File sampleAvroFile) {
+    // sampleAvroFile is not used — data is pushed as protobuf bytes, not Avro
+    return new TableConfigBuilder(TableType.REALTIME)
+        .setTableName(getTableName())
+        .setStreamConfigs(getStreamConfigs())
+        .setTimeColumnName(COL_ID)
+        .setNumReplicas(getNumReplicas())
+        .build();
+  }
+
+  /**
+   * Returns a single dummy file. The base class passes {@code 
avroFiles.get(0)} to
+   * {@link #createRealtimeTableConfig(File)}, so the list must be non-empty. 
The file is not read.
+   */
+  @Override
+  public List<File> createAvroFiles()
+      throws Exception {
+    File dummy = new File(_tempDir, "dummy.avro");
+    dummy.createNewFile();
+    return List.of(dummy);
+  }
+
+  /**
+   * Pushes {@link #NUM_RECORDS} protobuf-encoded {@code SampleRecord} 
messages to Kafka.
+   *
+   * <p>Uses {@link DynamicMessage} with the pre-compiled {@code 
sample-samplerecord.desc} descriptor
+   * so no generated Java sources are needed at compile time.
+   *
+   * <p>Each record {@code i} has:
+   * <ul>
+   *   <li>{@code id = i} (also the time column, values 0–{@link 
#NUM_RECORDS})</li>
+   *   <li>{@code name = "name-i"}</li>
+   *   <li>{@code email = "[email protected]"}</li>
+   *   <li>{@code friends = ["friend-{i % NUM_DISTINCT_FRIENDS}"]}</li>
+   * </ul>
+   */
+  @Override
+  protected void pushDataIntoKafka(List<File> dataFiles)
+      throws Exception {
+    Descriptors.Descriptor descriptor = loadSampleRecordDescriptor();
+    Descriptors.FieldDescriptor nameField = 
descriptor.findFieldByName(COL_NAME);
+    Descriptors.FieldDescriptor idField = descriptor.findFieldByName(COL_ID);
+    Descriptors.FieldDescriptor emailField = 
descriptor.findFieldByName(COL_EMAIL);
+    Descriptors.FieldDescriptor friendsField = 
descriptor.findFieldByName(COL_FRIENDS);
+

Review Comment:
   After `descriptor.findFieldByName(...)`, the returned FieldDescriptor can be 
null if the descriptor or field names drift (e.g., resource regenerated 
differently). Adding explicit assertions for each field (name/id/email/friends) 
would fail fast with a clear message instead of a later NullPointerException 
during message building.
   ```suggestion
   
       assertNotNull(nameField, "Missing protobuf field in descriptor: " + 
COL_NAME);
       assertNotNull(idField, "Missing protobuf field in descriptor: " + 
COL_ID);
       assertNotNull(emailField, "Missing protobuf field in descriptor: " + 
COL_EMAIL);
       assertNotNull(friendsField, "Missing protobuf field in descriptor: " + 
COL_FRIENDS);
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to