/// <summary> /// Equality only holds for partitions from the same table. Partition equality only takes /// into account the partition keys, since there is a 1 to 1 correspondence between /// partition keys and the hash buckets and range keys. /// </summary> /// <param name="other">The other partition of the same table.</param> public bool Equals(Partition?other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (PartitionKeyStart.SequenceEqual(other.PartitionKeyStart) && PartitionKeyEnd.SequenceEqual(other.PartitionKeyEnd)); }
/// <summary> /// The hash code only takes into account the partition keys, since there is a 1 to 1 /// correspondence between partition keys and the hash buckets and range keys. /// </summary> public override int GetHashCode() => PartitionKeyStart.GetContentHashCode();
/// <summary> /// Partition comparison is only reasonable when comparing partitions /// from the same table, and since Kudu does not yet allow partition /// splitting, no two distinct partitions can have the same start /// partition key. Accordingly, partitions are compared strictly by /// the start partition key. /// </summary> /// <param name="other">The other partition of the same table.</param> public int CompareTo(Partition?other) => PartitionKeyStart.SequenceCompareTo(other?.PartitionKeyStart);