Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/12#discussion_r17748481
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/schema/stat/PTableStatsImpl.java 
---
    @@ -16,40 +16,37 @@
      * limitations under the License.
      */
     package org.apache.phoenix.schema.stat;
    + import java.util.List;
    +import java.util.TreeMap;
     
    -import java.util.Map;
    -
    -import org.apache.hadoop.hbase.HRegionInfo;
    -
    -import com.google.common.collect.ImmutableMap;
    -
    -
    -/**
    +import org.apache.hadoop.hbase.util.Bytes;
    +import org.apache.phoenix.util.SizedUtil;
    + 
    + /**
      * Implementation for PTableStats.
      */
     public class PTableStatsImpl implements PTableStats {
     
    -    // The map for guide posts should be immutable. We only take the 
current snapshot from outside
    -    // method call and store it.
    -    private Map<String, byte[][]> regionGuidePosts;
    +    public static final PTableStats NO_STATS = new PTableStatsImpl();
    +
    +    private TreeMap<byte[], List<byte[]>> guidePosts = new TreeMap<byte[], 
List<byte[]>>(Bytes.BYTES_COMPARATOR);
     
    -    public PTableStatsImpl() { }
    +    public PTableStatsImpl() {
    +        this(new TreeMap<byte[], List<byte[]>>(Bytes.BYTES_COMPARATOR));
    +    }
     
    -    public PTableStatsImpl(Map<String, byte[][]> stats) {
    -        regionGuidePosts = ImmutableMap.copyOf(stats);
    +    public PTableStatsImpl(TreeMap<byte[], List<byte[]>> guidePosts) {
    +        this.guidePosts = guidePosts;
         }
     
         @Override
    -    public byte[][] getRegionGuidePosts(HRegionInfo region) {
    -        return regionGuidePosts.get(region.getRegionNameAsString());
    +    public TreeMap<byte[], List<byte[]>> getGuidePosts() {
    +        return guidePosts;
         }
     
         @Override
    -    public Map<String, byte[][]> getGuidePosts(){
    -      if(regionGuidePosts != null) {
    -        return ImmutableMap.copyOf(regionGuidePosts);
    -      }
    -      
    -      return null;
    +    public long getEstimatedSize() {
    --- End diff --
    
    I suspect you're not using this getEstimatedSize() call, as PTableStats is 
not stored, right? If so, please remove.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to