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 Tue, 15 Sep 2015 00:54:05 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/46#discussion_r39464868
  
    --- 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 added a comment to the source code in 356d2a6


---
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