accumulo-dev mailing list archives

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

    https://github.com/apache/accumulo/pull/46#discussion_r39094345
  
    --- 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 --
    
    > 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)
    
    I don't think we ever had problems with Thrift messages being incompatible, did we? RFile
having a "thrift" dependency is a valid point, just not for worry about backwards compatibility
IMO.
    
    Either way, the root of the reason I brought it up is that we have 2 different serializations
for this class. That's a smell to me. I have no stake besides the opinion that we should have
one and not many serializations. :)


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