[ https://issues.apache.org/jira/browse/APEXMALHAR-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341612#comment-15341612 ]
ASF GitHub Bot commented on APEXMALHAR-2094: -------------------------------------------- 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 > Quantiles sketch operator > ------------------------- > > Key: APEXMALHAR-2094 > URL: https://issues.apache.org/jira/browse/APEXMALHAR-2094 > Project: Apache Apex Malhar > Issue Type: New Feature > Reporter: Sandeep Narayanaswami > Assignee: Sandeep Narayanaswami > Priority: Minor > > An operator that "sketches" in an online fashion the probability distribution > of an input (numeric) data stream, enabling computation of quantiles and > cumulative distribution functions. -- This message was sent by Atlassian JIRA (v6.3.4#6332)