Copilot commented on code in PR #18876: URL: https://github.com/apache/pinot/pull/18876#discussion_r3801898720
########## pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/UuidUpsertRealtimeTest.java: ########## @@ -0,0 +1,134 @@ +/** + * 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 java.io.File; +import java.nio.ByteBuffer; +import java.time.Duration; +import java.util.List; +import org.apache.avro.Schema.Field; +import org.apache.avro.Schema.Type; +import org.apache.avro.file.DataFileWriter; +import org.apache.avro.generic.GenericData; +import org.apache.pinot.client.ResultSet; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.data.FieldSpec.DataType; +import org.apache.pinot.spi.data.Schema; +import org.apache.pinot.spi.utils.UuidUtils; +import org.apache.pinot.util.TestUtils; +import org.testng.annotations.Test; + +import static org.apache.avro.Schema.create; +import static org.testng.Assert.assertEquals; + + +/// Verifies realtime UUID ingestion and full-upsert deduplication with a UUID primary key. Review Comment: Java single-line comments conventionally use `//` (or `/** ... */` for class-level Javadoc). Using `///` is legal but atypical and can be confusing for readers and tooling. Consider switching to `//` (or Javadoc if you want it surfaced in generated docs). ########## pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/UuidUpsertRealtimeTest.java: ########## @@ -0,0 +1,134 @@ +/** + * 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 java.io.File; +import java.nio.ByteBuffer; +import java.time.Duration; +import java.util.List; +import org.apache.avro.Schema.Field; +import org.apache.avro.Schema.Type; +import org.apache.avro.file.DataFileWriter; +import org.apache.avro.generic.GenericData; +import org.apache.pinot.client.ResultSet; +import org.apache.pinot.spi.config.table.TableConfig; +import org.apache.pinot.spi.data.FieldSpec.DataType; +import org.apache.pinot.spi.data.Schema; +import org.apache.pinot.spi.utils.UuidUtils; +import org.apache.pinot.util.TestUtils; +import org.testng.annotations.Test; + +import static org.apache.avro.Schema.create; +import static org.testng.Assert.assertEquals; + + +/// Verifies realtime UUID ingestion and full-upsert deduplication with a UUID primary key. +@Test(suiteName = "CustomClusterIntegrationTest") +public class UuidUpsertRealtimeTest extends CustomDataQueryClusterIntegrationTest { + private static final String TABLE_NAME = "UuidUpsertRealtimeTest"; + private static final String UUID_PK_COLUMN = "uuidPk"; + private static final long BASE_TIME_MS = 1_700_100_000_000L; + private static final List<String> UUID_PK_VALUES = List.of( + "550e8400-e29b-41d4-a716-446655440000", + "550e8400-e29b-41d4-a716-446655440001", + "550e8400-e29b-41d4-a716-446655440000"); + + @Override + public String getTableName() { + return TABLE_NAME; + } + + @Override + public boolean isRealtimeTable() { + return true; + } + + @Override + protected int getNumKafkaPartitions() { + return 1; + } + + @Override + protected void waitForAllDocsLoaded(long timeoutMs) { + TestUtils.waitForCondition(() -> getPinotConnection().execute( + "SELECT COUNT(*) FROM " + TABLE_NAME + " OPTION(skipUpsert=true)").getResultSet(0).getLong(0) + == UUID_PK_VALUES.size(), + 100L, timeoutMs, "Failed to load all UUID upsert records", Duration.ofSeconds(5)); + } + + @Override + public int getNumAvroFiles() { + return 1; + } + + @Override + protected int getRealtimeSegmentFlushSize() { + return 2; + } + + @Override + protected TableConfig createRealtimeTableConfig(File sampleAvroFile) { + return createUpsertTableConfig(sampleAvroFile, UUID_PK_COLUMN, null, getNumKafkaPartitions()); Review Comment: The test asserts 'later duplicate wins' using the event timestamp, but the upsert table config passes `null` for the comparison column. If the underlying upsert behavior is based on ingestion order/offset (or another implicit comparator), this can make the winner selection less deterministic and potentially flaky across environments. Prefer setting the comparison column to `getTimeColumnName()` (and keeping the produced timestamps increasing) so the test’s expected winner is explicitly enforced by config. -- 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]
