Jackie-Jiang commented on code in PR #10656:
URL: https://github.com/apache/pinot/pull/10656#discussion_r1203126876


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java:
##########
@@ -444,4 +447,36 @@ public static boolean 
hasPreConfiguredInstancePartitions(TableConfig tableConfig
     return hasPreConfiguredInstancePartitions(tableConfig)
         && 
tableConfig.getInstancePartitionsMap().containsKey(instancePartitionsType);
   }
+
+  /**
+   * Get the partition column from InstanceAssignmentConfigUtils

Review Comment:
   (minor) Update the javadoc



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java:
##########
@@ -444,4 +447,36 @@ public static boolean 
hasPreConfiguredInstancePartitions(TableConfig tableConfig
     return hasPreConfiguredInstancePartitions(tableConfig)
         && 
tableConfig.getInstancePartitionsMap().containsKey(instancePartitionsType);
   }
+
+  /**
+   * Get the partition column from InstanceAssignmentConfigUtils
+   * @param tableConfig table config
+   * @return partition column
+   */
+  public static String getPartitionColumn(TableConfig tableConfig) {
+    String partitionColumn = null;
+
+    // check getInstanceAssignmentConfigMap is null or empty,
+    if (!MapUtils.isEmpty(tableConfig.getInstanceAssignmentConfigMap())) {
+      for (String key : tableConfig.getInstanceAssignmentConfigMap().keySet()) 
{

Review Comment:
   (minor) Avoid extra map lookup by using `entrySet()`



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java:
##########
@@ -444,4 +447,36 @@ public static boolean 
hasPreConfiguredInstancePartitions(TableConfig tableConfig
     return hasPreConfiguredInstancePartitions(tableConfig)
         && 
tableConfig.getInstancePartitionsMap().containsKey(instancePartitionsType);
   }
+
+  /**
+   * Get the partition column from InstanceAssignmentConfigUtils
+   * @param tableConfig table config
+   * @return partition column
+   */
+  public static String getPartitionColumn(TableConfig tableConfig) {
+    String partitionColumn = null;
+
+    // check getInstanceAssignmentConfigMap is null or empty,
+    if (!MapUtils.isEmpty(tableConfig.getInstanceAssignmentConfigMap())) {
+      for (String key : tableConfig.getInstanceAssignmentConfigMap().keySet()) 
{
+        //check getInstanceAssignmentConfigMap has the key of TableType
+        if (Objects.equals(key, tableConfig.getTableType().toString())) {

Review Comment:
   The key of the map is not always the table type. We can simply loop over the 
map (`values()`), and return the partition column if it is configured



-- 
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: commits-unsubscr...@pinot.apache.org

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