dbwong commented on a change in pull request #482: PHOENIX-4925 Use a Variant
Segment tree to organize Guide Post Info
URL: https://github.com/apache/phoenix/pull/482#discussion_r297310324
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostsInfo.java
##########
@@ -17,138 +17,913 @@
*/
package org.apache.phoenix.schema.stats;
-import java.util.Collections;
import java.util.List;
+import java.util.LinkedList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Set;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.util.ByteUtil;
-import org.apache.phoenix.util.SizedUtil;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.util.ScanUtil;
+import org.apache.phoenix.util.ScanUtil.BytesComparator;
+import org.apache.phoenix.query.KeyRange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@VisibleForTesting
+final class DecodedGuidePostChunk {
+ /**
+ * The index of the guide post chunk in the chunk array.
+ */
+ private final int guidePostChunkIndex;
+
+ /**
+ * The key range of the guide posts in this chunk
+ */
+ private KeyRange keyRange;
+
+ /**
+ * The guide posts in this chunk.
+ */
+ private final List<byte[]> guidePosts;
+
+ public DecodedGuidePostChunk(int guidePostChunkIndex, KeyRange keyRange,
List<byte[]> guidePosts) {
+ Preconditions.checkArgument(guidePostChunkIndex !=
GuidePostChunk.INVALID_GUIDEPOST_CHUNK_INDEX);
+ Preconditions.checkArgument(guidePosts.size() > 0);
+
+ this.guidePostChunkIndex = guidePostChunkIndex;
+ this.keyRange = keyRange;
+ this.guidePosts = guidePosts;
+ }
+
+ public int getGuidePostChunkIndex() {
+ return guidePostChunkIndex;
+ }
+
+ public List<byte[]> getGuidePosts() {
+ return guidePosts;
+ }
+
+ @Override
+ public boolean equals(Object o) {
Review comment:
In java typically if you need a custom equals you need a custom hashcode
function.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services