Jackie-Jiang commented on a change in pull request #5728:
URL: https://github.com/apache/incubator-pinot/pull/5728#discussion_r459044062



##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentLineageBasedSegmentSelector.java
##########
@@ -0,0 +1,80 @@
+/**
+ * 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.broker.routing.segmentselector;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.helix.ZNRecord;
+import org.apache.helix.model.ExternalView;
+import org.apache.helix.store.zk.ZkHelixPropertyStore;
+import org.apache.pinot.common.lineage.LineageEntry;
+import org.apache.pinot.common.lineage.LineageEntryState;
+import org.apache.pinot.common.lineage.SegmentLineage;
+import org.apache.pinot.common.lineage.SegmentLineageAccessHelper;
+import org.apache.pinot.common.request.BrokerRequest;
+
+
+public class SegmentLineageBasedSegmentSelector implements SegmentSelector {

Review comment:
       Don't implement `SegmentSelector` because it is not actually a segment 
selector, but a component inside the segment selector.
   You may re-design the methods for this class to make it easier to use, e.g. 
`public Set<String> refreshLinage(Set<String> onlineSegments);` which returns 
the candidate segments based on the linage

##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/OfflineSegmentSelector.java
##########
@@ -30,10 +31,17 @@
  * Segment selector for offline table.
  */
 public class OfflineSegmentSelector implements SegmentSelector {
+  private SegmentLineageBasedSegmentSelector 
_segmentLineageBasedSegmentSelector;

Review comment:
       ```suggestion
     private final SegmentLineageBasedSegmentSelector 
_segmentLineageBasedSegmentSelector;
   ```

##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorFactory.java
##########
@@ -17,19 +17,25 @@
  * under the License.
  */
 package org.apache.pinot.broker.routing.segmentselector;
+import org.apache.helix.ZNRecord;
+import org.apache.helix.store.zk.ZkHelixPropertyStore;
 import org.apache.pinot.spi.config.table.TableConfig;
 import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
 
 
 public class SegmentSelectorFactory {
   private SegmentSelectorFactory() {
   }
 
-  public static SegmentSelector getSegmentSelector(TableConfig tableConfig) {
+  public static SegmentSelector getSegmentSelector(TableConfig tableConfig,
+      ZkHelixPropertyStore<ZNRecord> propertyStore) {
+    String tableNameWithType =
+        
TableNameBuilder.forType(tableConfig.getTableType()).tableNameWithType(tableConfig.getTableName());

Review comment:
       Table name in table config always have the suffix
   ```suggestion
       String tableNameWithType = tableConfig.getTableName();
   ```




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

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



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

Reply via email to