Skip to content

Commit 56e95a0

Browse files
xiangfu0claude
andcommitted
Document identity-only contract of getPartitionIdNormalizer
Minor clarification: the reviewer flagged that legacy partition functions (HashCodePartitionFunction / ByteArrayPartitionFunction) use Kafka-style abs handling Integer.MIN_VALUE → 0, while PartitionIntNormalizer.ABS does strict mod-then-abs. These differ at the MIN_VALUE edge case. The string returned from getPartitionIdNormalizer is purely advertised for staleness/identity matching between config-side and segment-side function metadata, not used to drive runtime normalization for legacy functions (which have their own internal partition-id calculation). Expression-mode pipelines are the only code path where this value is authoritative (via PartitionIntNormalizer.fromConfigString). Document the contract on the SPI Javadoc so plugin authors and future maintainers don't mistake the string for a runtime hook. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7832cde commit 56e95a0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/partition/PartitionFunction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ default String getFunctionExpr() {
103103
return null;
104104
}
105105

106+
/**
107+
* Reports the int-normalizer used by this partition function (e.g. {@code POSITIVE_MODULO}, {@code ABS},
108+
* {@code MASK}). The returned string is used by the framework only for identity / staleness matching between
109+
* config-side and segment-side function metadata; it does not drive runtime normalization. Legacy partition
110+
* functions (Murmur, FNV, HashCode, ByteArray, Modulo) report the closest matching normalizer name even though
111+
* their internal implementation may differ subtly at edge cases (e.g. Kafka-style abs handling
112+
* {@code Integer.MIN_VALUE → 0} vs strict mod-then-abs). Expression-mode pipelines drive normalization through
113+
* {@code PartitionIntNormalizer} directly and are the only code path where this value is authoritative.
114+
*/
106115
@JsonIgnore
107116
@Nullable
108117
default String getPartitionIdNormalizer() {

0 commit comments

Comments
 (0)