xiangfu0 commented on code in PR #18446:
URL: https://github.com/apache/pinot/pull/18446#discussion_r3212003845
##########
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:
Done in 1b3e70e — added an explicit `NO_OP` value to `PartitionIdNormalizer`
(identity, no validation).
`BoundedColumnValuePartitionFunction.getPartitionIdNormalizer()` now returns
`NO_OP`. The range-invariant test correctly skips `NO_OP` and a new
`testNoOpIsIdentity` locks the pass-through semantics.
##########
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:
Done in 8bb35d7 — annotation deleted entirely; `PartitionFunction` now has a
`default List<String> getNames() { return Collections.singletonList(getName());
}` and the factory drives discovery off it. Only `MurmurPartitionFunction`
overrides (returns `["Murmur", "Murmur2"]`).
--
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]