org.apache.datasketches.pig.cpc

## Class GetEstimateAndErrorBounds

- java.lang.Object
- - org.apache.pig.EvalFunc<org.apache.pig.data.Tuple>
  - - org.apache.datasketches.pig.cpc.GetEstimateAndErrorBounds

    public class GetEstimateAndErrorBounds
    extends org.apache.pig.EvalFunc<org.apache.pig.data.Tuple>

This is a User Defined Function (UDF) for obtaining the distinct count estimate along with a lower and upper bound from a given CpcSketch.

The result is a tuple with three double values: estimate, lower bound and upper bound. The bounds are best estimates for the confidence interval given kappa, which represents the number of standard deviations from the mean (1, 2 or 3).

Author:
  Alexander Saydakov

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.pig.EvalFunc

`org.apache.pig.EvalFunc.SchemaType`

### Field Summary

### Fields inherited from class org.apache.pig.EvalFunc

`log, pigLogger, reporter, returnType`

### Constructor Summary

Constructors
Constructor and Description
`GetEstimateAndErrorBounds()` Constructor with default kappa and seed
`GetEstimateAndErrorBounds(String kappa)` Constructor with given kappa and default seed
`GetEstimateAndErrorBounds(String kappa, String seed)` Constructor with given kappa and seed

### Method Summary

All Methods Instance Methods Concrete Methods
`org.apache.pig.data.Tuple` `exec(org.apache.pig.data.Tuple sketchTuple)`
`org.apache.pig.impl.logicalLayer.schema.Schema` `outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)` The output is a Sketch Result Tuple Schema.

### Methods inherited from class org.apache.pig.EvalFunc

`allowCompileTimeCalculation, finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLoadCaster, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GetEstimateAndErrorBounds

    public GetEstimateAndErrorBounds()

Constructor with default kappa and seed

#### GetEstimateAndErrorBounds

    public GetEstimateAndErrorBounds(String kappa)

Constructor with given kappa and default seed

Parameters:
  `kappa` - in a form of a String

#### GetEstimateAndErrorBounds

    public GetEstimateAndErrorBounds(String kappa,
                                     String seed)

Constructor with given kappa and seed

Parameters:
  `kappa` - in a form of a String
  `seed` - in a form of a String

### Method Detail

#### exec

    public org.apache.pig.data.Tuple exec(org.apache.pig.data.Tuple sketchTuple)
                                   throws IOException

Specified by:
  `exec` in class `org.apache.pig.EvalFunc<org.apache.pig.data.Tuple>`
Throws:
  `IOException`

#### outputSchema

    public org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)

The output is a Sketch Result Tuple Schema.

Overrides:
  `outputSchema` in class `org.apache.pig.EvalFunc<org.apache.pig.data.Tuple>`