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


##########
pinot-common/src/main/java/org/apache/pinot/common/partition/function/BoundedColumnValuePartitionFunction.java:
##########
@@ -16,29 +16,34 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.segment.spi.partition;
+package org.apache.pinot.common.partition.function;
 
 import com.google.common.base.Preconditions;
 import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.pinot.segment.spi.partition.PartitionFunction;
+import org.apache.pinot.segment.spi.partition.PartitionIdNormalizer;
+import org.apache.pinot.spi.annotations.PartitionFunctionType;
 
 
-/**
- * Implementation of {@link PartitionFunction} which partitions based 
configured column values.
- *
- * "columnPartitionMap": {
- *   "subject": {
- *     "functionName": "BoundedColumnValue",
- *     "functionConfig": {
- *       "columnValues": "Maths|English|Chemistry",
- *       "columnValuesDelimiter": "|"
- *     },
- *     "numPartitions": 4
- *   }
- * }
- * With this partition config on column "subject", partitionId would be 1 for 
Maths, 2 for English and 3 for Chemistry.
- * partitionId would be "0" for all other values which may occur, therefore 
'numPartitions' is set to 4.
- */
+/// Implementation of [PartitionFunction] which partitions based on configured 
column values.
+///
+/// ```json
+/// "columnPartitionMap": {
+///   "subject": {
+///     "functionName": "BoundedColumnValue",
+///     "functionConfig": {
+///       "columnValues": "Maths|English|Chemistry",
+///       "columnValuesDelimiter": "|"
+///     },
+///     "numPartitions": 4
+///   }
+/// }
+/// ```
+///
+/// With this partition config on column "subject", `partitionId` is `1` for 
Maths, `2` for English and `3` for
+/// Chemistry. `partitionId` is `0` for all other values which may occur, 
therefore `numPartitions` is set to `4`.
+@PartitionFunctionType(names = "BoundedColumnValue")

Review Comment:
   We don't really need this annotation. Consider replacing it by adding:
   ```
     default List<String> getNames() {
       return List.of(getName());
     }
   ```



##########
pinot-common/src/main/java/org/apache/pinot/common/partition/function/BoundedColumnValuePartitionFunction.java:
##########
@@ -91,6 +94,12 @@ public Map<String, String> getFunctionConfig() {
     return _functionConfig;
   }
 
+  @Override
+  public PartitionIdNormalizer getPartitionIdNormalizer() {
+    // Output is a fixed mapping in [0, numPartitions); POSITIVE_MODULO is a 
no-op label.
+    return PartitionIdNormalizer.POSITIVE_MODULO;

Review Comment:
   Consider adding an explicit NO_OP normalizer



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