accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request: ACCUMULO-3913 Added per table sampling
Date Wed, 09 Sep 2015 20:44:19 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/46#discussion_r39093685
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/sample/impl/SamplerConfigurationImpl.java
---
    @@ -0,0 +1,181 @@
    +/*
    + * 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.accumulo.core.sample.impl;
    +
    +import java.io.DataInput;
    +import java.io.DataOutput;
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashMap;
    +import java.util.LinkedHashMap;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Map.Entry;
    +
    +import org.apache.accumulo.core.client.admin.SamplerConfiguration;
    +import org.apache.accumulo.core.conf.AccumuloConfiguration;
    +import org.apache.accumulo.core.conf.Property;
    +import org.apache.accumulo.core.tabletserver.thrift.TSamplerConfiguration;
    +import org.apache.accumulo.core.util.Pair;
    +import org.apache.hadoop.io.Writable;
    +
    +public class SamplerConfigurationImpl implements Writable {
    +  private String className;
    +  private Map<String,String> options;
    +
    +  public SamplerConfigurationImpl(DataInput in) throws IOException {
    +    readFields(in);
    +  }
    +
    +  public SamplerConfigurationImpl(SamplerConfiguration sc) {
    +    this.className = sc.getSamplerClassName();
    +    this.options = new HashMap<>(sc.getOptions());
    +  }
    +
    +  public SamplerConfigurationImpl(String className, Map<String,String> options)
{
    +    this.className = className;
    +    this.options = options;
    +  }
    +
    +  public SamplerConfigurationImpl() {}
    +
    +  public String getClassName() {
    +    return className;
    +  }
    +
    +  public Map<String,String> getOptions() {
    +    return Collections.unmodifiableMap(options);
    +  }
    +
    +  @Override
    +  public int hashCode() {
    +    return 31 * className.hashCode() + options.hashCode();
    +  }
    +
    +  @Override
    +  public boolean equals(Object o) {
    +    if (o instanceof SamplerConfigurationImpl) {
    +      SamplerConfigurationImpl osc = (SamplerConfigurationImpl) o;
    +
    +      return className.equals(osc.className) && options.equals(osc.options);
    +    }
    +
    +    return false;
    +  }
    +
    +  @Override
    +  public void write(DataOutput out) throws IOException {
    --- End diff --
    
    I was thinking about this.   This class is persisted in RFile.   I am uncertain about
introducing thrift into RFile's persistence.   I don't have a good reason not too, it just
gives me pause (some of the RPC incompatibilities introduced between Thrift 0.9.0 and 0.9.1
are what make me hesitate).  Personally I would be more comfortable using protobuf in RFiles
persistence, but that would be a new project dependency.  Also if we ever move away from thrift
for RPC, RFile would still have to use thrift.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message