Jackie-Jiang commented on a change in pull request #3725: Replace partition
ranges with partitions
URL: https://github.com/apache/incubator-pinot/pull/3725#discussion_r250037182
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/ColumnPartitionMetadata.java
##########
@@ -41,77 +36,120 @@
* <ul>
* <li> Partition function.</li>
* <li> Number of partitions. </li>
- * <li> List of partition ranges. </li>
+ * <li> List of partitions. </li>
* </ul>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
-public class ColumnPartitionMetadata extends ColumnPartitionConfig {
-
- private final List<IntRange> _partitionRanges;
+@JsonDeserialize(using =
ColumnPartitionMetadata.ColumnPartitionMetadataDeserializer.class)
+public class ColumnPartitionMetadata {
+ private final String _functionName;
+ private final int _numPartitions;
+ private final List<Integer> _partitions;
/**
* Constructor for the class.
* @param functionName Name of the partition function.
* @param numPartitions Number of partitions for this column.
- * @param partitionRanges Partition ranges for the column.
+ * @param partitions Partitions for the column.
*/
- public ColumnPartitionMetadata(@JsonProperty("functionName") String
functionName,
- @JsonProperty("numPartitions") int numPartitions,
- @JsonProperty("partitionRanges") @JsonDeserialize(using =
PartitionRangesDeserializer.class) List<IntRange> partitionRanges) {
- super(functionName, numPartitions);
- _partitionRanges = partitionRanges;
+ public ColumnPartitionMetadata(String functionName, int numPartitions,
List<Integer> partitions) {
+ _functionName = functionName;
+ _numPartitions = numPartitions;
+ _partitions = partitions;
}
- /**
- * Returns the list of partition ranges.
- *
- * @return List of partition ranges.
- */
- @JsonSerialize(using = PartitionRangesSerializer.class)
- public List<IntRange> getPartitionRanges() {
- return _partitionRanges;
+ public String getFunctionName() {
+ return _functionName;
+ }
+
+ public int getNumPartitions() {
+ return _numPartitions;
+ }
+
+ public List<Integer> getPartitions() {
+ return _partitions;
}
@Override
- public boolean equals(Object o) {
- if (this == o) {
+ public boolean equals(Object obj) {
+ if (this == obj) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
- return false;
+ if (obj instanceof ColumnPartitionMetadata) {
+ ColumnPartitionMetadata that = (ColumnPartitionMetadata) obj;
+ return _functionName.equals(that._functionName) && _numPartitions ==
that._numPartitions && _partitions
+ .equals(that._partitions);
}
-
- ColumnPartitionMetadata that = (ColumnPartitionMetadata) o;
- return super.equals(that) && Objects.equals(_partitionRanges,
that._partitionRanges);
+ return false;
}
@Override
public int hashCode() {
- int hashCode = _partitionRanges != null ? _partitionRanges.hashCode() : 0;
+ int hashCode = _partitions != null ? _partitions.hashCode() : 0;
return EqualityUtils.hashCodeOf(super.hashCode(), hashCode);
}
/**
- * Custom Json serializer for list of IntRange's.
+ * Helper method to extract partitions from configuration.
+ * <p>
+ * There are two format of partition strings:
+ * <ul>
+ * <li>Integer format: e.g. {@code "0"}</li>
+ * <li>Range format (legacy): e.g. {@code "[0 0]"}</li>
Review comment:
Added
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]