accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (ACCUMULO-3913) Add per table sampling
Date Tue, 15 Sep 2015 14:42:46 GMT


ASF GitHub Bot commented on ACCUMULO-3913:

Github user keith-turner commented on a diff in the pull request:
    --- Diff: core/src/main/java/org/apache/accumulo/core/sample/ ---
    @@ -0,0 +1,45 @@
    + * 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
    + *
    + *
    + *
    + * 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;
    +import org.apache.accumulo.core.client.admin.SamplerConfiguration;
    + * A function that decides which key values are stored in a tables sample. As Accumuo
compacts data and creates rfiles it uses a Sampler to decided what to
    + * store in the rfiles sample section. The class name of the Sampler and the Samplers
configuration are stored in each rfile. A scan of a tables sample will
    + * only succeed if all rfiles were created with the same sampler and sampler configuration.
    + *
    + * <p>
    + * Since the decisions that Sampler makes are persisted, the behavior of a Sampler for
a given configuration should always be the same. One way to offer a new
    + * behavior is to offer new options, while still supporting old behavior with a Samplers
existing options.
    + *
    + * <p>
    + * Ideally a sampler that selects a Key k1 would also select updates for k1. For example
if a Sampler selects :
    + * {@code row='000989' family='name' qualifier='last' visibility='ADMIN' time=9 value='Doe'},
it would be nice if it also selected :
    + * {@code row='000989' family='name' qualifier='last' visibility='ADMIN' time=20 value='Dough'}.
Using hash and modulo on the key fields is a good way to
    + * accomplish this and {@link AbstractHashSampler} provides a good basis for implementation.
    + *
    + * @since 1.8.0
    + */
    +public interface Sampler {
    +  void init(SamplerConfiguration config);
    +  boolean accept(Key k);
    --- End diff --
    Added javadoc in 3d0be31

> Add per table sampling
> ----------------------
>                 Key: ACCUMULO-3913
>                 URL:
>             Project: Accumulo
>          Issue Type: Improvement
>            Reporter: Keith Turner
>             Fix For: 1.8.0
> I am working on prototyping adding hash based sampling to Accumulo.  I am trying to accomplish
the following goals in the prototype.
>   # Have each RFile store a sample per locality group.  Also store the configuration
used to generate the sample.
>   # Use sampling functions that ensure the same row columns exist across the samples
in all RFiles. Hash mod is a good candidate that gives a random sample that's consistent across
>   # Have scanners support scanning RFile's samples sets.  Scan should fail if RFiles
have different sample configuration.  Different sampling config implies the RFile's sample
sets contain a possibly disjoint set of row columns.
>   # Support generating sample data for RFiles generated for bulk import
>   # Support sample data in the memory map
>   # Support enabling and disabling sampling per table AND configuring a sample function.
> I am currently using the following function in my prototype to determine what data an
RFile stores in its sample set.  This code will always select same subset of rows for each
RFile's sample set.  I have not yet made the function configurable.
> {code:java}
> public class RowSampler implements Sampler {
>   private HashFunction hasher = Hashing.murmur3_32();
>   @Override
>   public boolean accept(Key k) {
>     ByteSequence row = k.getRowData();
>     HashCode hc = hasher.hashBytes(row.getBackingArray(), row.offset(), row.length());
>     return hc.asInt() % 1009 == 0;
>   }
> }
> {code}
> Although not yet implemented, the divisor in this RowSample could be configurable. RFiles
with sample data would store the fact that a RowSample with a divisor of 1009 was used to
generate sample data.

This message was sent by Atlassian JIRA

View raw message