apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupeshchawda <...@git.apache.org>
Subject [GitHub] apex-malhar pull request #301: [APEXMALHAR-2094] Quantiles operator
Date Tue, 21 Jun 2016 11:38:31 GMT
Github user bhupeshchawda commented on a diff in the pull request:

    https://github.com/apache/apex-malhar/pull/301#discussion_r67852225
  
    --- Diff: sketches/src/test/java/org/apache/apex/malhar/sketches/QuantilesEstimatorTest.java
---
    @@ -0,0 +1,204 @@
    +/**
    + * 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.apex.malhar.sketches;
    +
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.List;
    +import java.util.Random;
    +
    +import javax.validation.ConstraintViolationException;
    +
    +import org.junit.Assert;
    +import org.junit.Test;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import org.apache.hadoop.conf.Configuration;
    +
    +import com.datatorrent.api.DAG;
    +import com.datatorrent.api.DefaultInputPort;
    +import com.datatorrent.api.DefaultOutputPort;
    +import com.datatorrent.api.InputOperator;
    +import com.datatorrent.api.LocalMode;
    +import com.datatorrent.api.StreamingApplication;
    +import com.datatorrent.common.util.BaseOperator;
    +import com.datatorrent.lib.io.ConsoleOutputOperator;
    +import com.datatorrent.lib.testbench.CollectorTestSink;
    +import com.datatorrent.lib.util.TestUtils;
    +
    +public class QuantilesEstimatorTest
    +{
    +  private static Logger LOG = LoggerFactory.getLogger(QuantilesEstimatorTest.class);
    +
    +  public static class NumberSource extends BaseOperator implements InputOperator
    +  {
    +    public final DefaultOutputPort<Double> output = new DefaultOutputPort<>();
    +
    +    private Random rand = new Random(1234L);
    +
    +    public NumberSource() {}
    +
    +    @Override
    +    public void emitTuples()
    +    {
    +      output.emit(rand.nextGaussian());
    +    }
    +  }
    +
    +  public static class PmfSink extends BaseOperator
    +  {
    +    public final DefaultInputPort<double[]> input = new DefaultInputPort<double[]>()
    +    {
    +      @Override
    +      public void process(double[] tuple) {}
    +    };
    +
    +    public PmfSink() {}
    +  }
    +
    +  public static class QuantileSink extends BaseOperator
    +  {
    +    public final DefaultInputPort<double[]> input = new DefaultInputPort<double[]>()
    +    {
    +      @Override
    +      public void process(double[] tuple) {}
    +    };
    +
    +    public QuantileSink() {}
    +  }
    +
    +  public static class CdfSink extends BaseOperator
    --- End diff --
    
    Not used


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