dbwong commented on a change in pull request #482: PHOENIX-4925 Use Segment tree to organize Guide Post Info URL: https://github.com/apache/phoenix/pull/482#discussion_r275095001
########## File path: phoenix-core/src/main/java/org/apache/phoenix/schema/stats/GuidePostChunk.java ########## @@ -0,0 +1,224 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.schema.stats; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.phoenix.query.KeyRange; +import org.apache.phoenix.util.Closeables; +import org.apache.phoenix.util.PrefixByteCodec; +import org.apache.phoenix.util.PrefixByteDecoder; +import org.apache.phoenix.util.SizedUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayInputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.EOFException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.phoenix.schema.stats.GuidePostChunkBuilder; + +/** + * A guide post chunk is comprised of a group of guide posts, and it has one of key ranges below: + * (UNBOUND, gp_i0], (gp_i0, gp_i1], (gp_i1, gp_i2], ..., (gp_in, gp_n], (gp_n, UNBOUND) + * where gp_x is one of guide post collected on the server side. The last guide post chunk is a DUMMY chunk + * which contains one DUMMY guide post. + * + * Eventually the guide post chunk should be built and compressed on the server side when collecting stats. + * It is now the minimal data unit for compression/decompression and will be the minimal data unit stored + * into the SYSTEM_STATS table in the future. + */ +public final class GuidePostChunk { + public static final int INVALID_GUIDEPOST_CHUNK_INDEX = -1; + public static final Logger logger = LoggerFactory.getLogger(GuidePostChunk.class); + + /** + * The index of the guide post chunk in the chunk array. + */ + private final int guidePostChunkIndex; Review comment: This seems to be leaking the top level classes lower into this class. The accessor is never used. Can you briefly explain why this index is needed to be tracked in multiple levels? InnerPointLookupResult in GuidePostsInfo even has 2 separate indexes tracked. ---------------------------------------------------------------- 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
