yashmayya commented on code in PR #17846: URL: https://github.com/apache/pinot/pull/17846#discussion_r2908916998
########## pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ColocatedJoinIntegrationTest.java: ########## @@ -0,0 +1,195 @@ +/** + * 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; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.File; +import org.apache.commons.io.FileUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + + +/** + * Integration tests for colocated joins using the multi-stage query engine (single partition). + * + * <p>Uses {@code getNumPartitions() = 1} so each segment has exactly one partition (required by + * {@link org.apache.pinot.broker.routing.segmentpartition.SegmentPartitionMetadataManager}). + * Validates two-table, self, left, and right joins with joinOptions/tableOptions or Review Comment: We need to test colocated semi-joins too ########## pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ColocatedJoinIntegrationTest.java: ########## @@ -0,0 +1,195 @@ +/** + * 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; + +import com.fasterxml.jackson.databind.JsonNode; +import java.io.File; +import org.apache.commons.io.FileUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertTrue; + + +/** + * Integration tests for colocated joins using the multi-stage query engine (single partition). + * + * <p>Uses {@code getNumPartitions() = 1} so each segment has exactly one partition (required by + * {@link org.apache.pinot.broker.routing.segmentpartition.SegmentPartitionMetadataManager}). + * Validates two-table, self, left, and right joins with joinOptions/tableOptions or + * inferPartitionHint. For multiple partitions check ColocatedJoinMultiPartitionIntegrationTest + */ +public class ColocatedJoinIntegrationTest extends ColocatedJoinIntegrationTestBase { + + /** Single partition per segment so ZK partition metadata is valid (segment must have exactly one partition). */ + private static final int NUM_PARTITIONS = 1; + + @Override + protected int getNumPartitions() { + return NUM_PARTITIONS; + } + + @Override + protected File getSegmentBuildTempDir() { + return _tempDir; + } + + @BeforeClass + public void setUp() + throws Exception { + super.setUpColocatedBase(); + } + + @AfterClass + public void tearDown() + throws Exception { + stopServer(); + stopBroker(); + stopController(); + stopZk(); + if (_tempDir != null && _tempDir.exists()) { + FileUtils.deleteDirectory(_tempDir); + } + } + + @Test + public void testTwoTableJoinWithJoinOptionsAndTableOptions() + throws Exception { + String sql = "SELECT /*+ joinOptions(is_colocated_by_join_keys='true') */ COUNT(*) FROM " + + "userAttributes ua JOIN userGroups ug ON ua.userUUID = ug.userUUID"; + JsonNode result = postQuery(sql); + assertNoExceptions(result); + assertTrue(getCountFromResult(result) >= 1, "Join should return at least one row"); Review Comment: How are we validating that the join was colocated? -- 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]
