Class AggregateStatisticsRequest
- java.lang.Object
-
- com.gpudb.protocol.AggregateStatisticsRequest
-
- All Implemented Interfaces:
org.apache.avro.generic.GenericContainer,org.apache.avro.generic.IndexedRecord
public class AggregateStatisticsRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters forGPUdb.aggregateStatistics.Calculates the requested statistics of the given column(s) in a given table.
The available statistics are:
COUNT(number of total objects),MEAN,STDV(standard deviation),VARIANCE,SKEW,KURTOSIS,SUM,MIN,MAX,WEIGHTED_AVERAGE,CARDINALITY(unique count),ESTIMATED_CARDINALITY,PERCENTILE, andPERCENTILE_RANK.Estimated cardinality is calculated by using the hyperloglog approximation technique.
Percentiles and percentile ranks are approximate and are calculated using the t-digest algorithm. They must include the desired
PERCENTILE/PERCENTILE_RANK. To compute multiple percentiles each value must be specified separately (i.e. 'percentile(75.0),percentile(99.0),percentile_rank(1234.56),percentile_rank(-5)').A second, comma-separated value can be added to the
PERCENTILEstatistic to calculate percentile resolution, e.g., a 50th percentile with 200 resolution would be 'percentile(50,200)'.The weighted average statistic requires a weight column to be specified in
WEIGHT_COLUMN_NAME. The weighted average is then defined as the sum of the products ofcolumnNametimes theWEIGHT_COLUMN_NAMEvalues divided by the sum of theWEIGHT_COLUMN_NAMEvalues.Additional columns can be used in the calculation of statistics via
ADDITIONAL_COLUMN_NAMES. Values in these columns will be included in the overall aggregate calculation--individual aggregates will not be calculated per additional column. For instance, requesting theCOUNTandMEANofcolumnNamex andADDITIONAL_COLUMN_NAMESy and z, where x holds the numbers 1-10, y holds 11-20, and z holds 21-30, would return the total number of x, y, and z values (30), and the single average value across all x, y, and z values (15.5).The response includes a list of key/value pairs of each statistic requested and its corresponding value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAggregateStatisticsRequest.OptionsA set of string constants for theAggregateStatisticsRequestparameteroptions.static classAggregateStatisticsRequest.StatsA set of string constants for theAggregateStatisticsRequestparameterstats.
-
Constructor Summary
Constructors Constructor Description AggregateStatisticsRequest()Constructs an AggregateStatisticsRequest object with default parameters.AggregateStatisticsRequest(String tableName, String columnName, String stats, Map<String,String> options)Constructs an AggregateStatisticsRequest object with the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Objectget(int index)This method supports the Avro framework and is not intended to be called directly by the user.static org.apache.avro.SchemagetClassSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetColumnName()Name of the primary column for which the statistics are to be calculated.Map<String,String>getOptions()Optional parameters.org.apache.avro.SchemagetSchema()This method supports the Avro framework and is not intended to be called directly by the user.StringgetStats()Comma separated list of the statistics to calculate, e.g. "sum,mean".StringgetTableName()Name of the table on which the statistics operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.inthashCode()voidput(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.AggregateStatisticsRequestsetColumnName(String columnName)Name of the primary column for which the statistics are to be calculated.AggregateStatisticsRequestsetOptions(Map<String,String> options)Optional parameters.AggregateStatisticsRequestsetStats(String stats)Comma separated list of the statistics to calculate, e.g. "sum,mean".AggregateStatisticsRequestsetTableName(String tableName)Name of the table on which the statistics operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.StringtoString()
-
-
-
Constructor Detail
-
AggregateStatisticsRequest
public AggregateStatisticsRequest()
Constructs an AggregateStatisticsRequest object with default parameters.
-
AggregateStatisticsRequest
public AggregateStatisticsRequest(String tableName, String columnName, String stats, Map<String,String> options)
Constructs an AggregateStatisticsRequest object with the specified parameters.- Parameters:
tableName- Name of the table on which the statistics operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.columnName- Name of the primary column for which the statistics are to be calculated.stats- Comma separated list of the statistics to calculate, e.g. "sum,mean". Supported values:COUNT: Number of objects (independent of the given column(s)).MEAN: Arithmetic mean (average), equivalent to sum/count.STDV: Sample standard deviation (denominator is count-1).VARIANCE: Unbiased sample variance (denominator is count-1).SKEW: Skewness (third standardized moment).KURTOSIS: Kurtosis (fourth standardized moment).SUM: Sum of all values in the column(s).MIN: Minimum value of the column(s).MAX: Maximum value of the column(s).WEIGHTED_AVERAGE: Weighted arithmetic mean (using the optionWEIGHT_COLUMN_NAMEas the weighting column).CARDINALITY: Number of unique values in the column(s).ESTIMATED_CARDINALITY: Estimate (via hyperloglog technique) of the number of unique values in the column(s).PERCENTILE: Estimate (via t-digest) of the given percentile of the column(s) (percentile(50.0) will be an approximation of the median). Add a second, comma-separated value to calculate percentile resolution, e.g., 'percentile(75,150)'PERCENTILE_RANK: Estimate (via t-digest) of the percentile rank of the given value in the column(s) (if the given value is the median of the column(s), percentile_rank(<median>) will return approximately 50.0).
options- Optional parameters.ADDITIONAL_COLUMN_NAMES: A list of comma separated column names over which statistics can be accumulated along with the primary column. All columns listed andcolumnNamemust be of the same type. Must not include the column specified incolumnNameand no column can be listed twice.WEIGHT_COLUMN_NAME: Name of column used as weighting attribute for the weighted average statistic.
Map.
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Returns:
- The schema for the class.
-
getTableName
public String getTableName()
Name of the table on which the statistics operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.- Returns:
- The current value of
tableName.
-
setTableName
public AggregateStatisticsRequest setTableName(String tableName)
Name of the table on which the statistics operation will be performed, in [schema_name.]table_name format, using standard name resolution rules.- Parameters:
tableName- The new value fortableName.- Returns:
thisto mimic the builder pattern.
-
getColumnName
public String getColumnName()
Name of the primary column for which the statistics are to be calculated.- Returns:
- The current value of
columnName.
-
setColumnName
public AggregateStatisticsRequest setColumnName(String columnName)
Name of the primary column for which the statistics are to be calculated.- Parameters:
columnName- The new value forcolumnName.- Returns:
thisto mimic the builder pattern.
-
getStats
public String getStats()
Comma separated list of the statistics to calculate, e.g. "sum,mean". Supported values:COUNT: Number of objects (independent of the given column(s)).MEAN: Arithmetic mean (average), equivalent to sum/count.STDV: Sample standard deviation (denominator is count-1).VARIANCE: Unbiased sample variance (denominator is count-1).SKEW: Skewness (third standardized moment).KURTOSIS: Kurtosis (fourth standardized moment).SUM: Sum of all values in the column(s).MIN: Minimum value of the column(s).MAX: Maximum value of the column(s).WEIGHTED_AVERAGE: Weighted arithmetic mean (using the optionWEIGHT_COLUMN_NAMEas the weighting column).CARDINALITY: Number of unique values in the column(s).ESTIMATED_CARDINALITY: Estimate (via hyperloglog technique) of the number of unique values in the column(s).PERCENTILE: Estimate (via t-digest) of the given percentile of the column(s) (percentile(50.0) will be an approximation of the median). Add a second, comma-separated value to calculate percentile resolution, e.g., 'percentile(75,150)'PERCENTILE_RANK: Estimate (via t-digest) of the percentile rank of the given value in the column(s) (if the given value is the median of the column(s), percentile_rank(<median>) will return approximately 50.0).
- Returns:
- The current value of
stats.
-
setStats
public AggregateStatisticsRequest setStats(String stats)
Comma separated list of the statistics to calculate, e.g. "sum,mean". Supported values:COUNT: Number of objects (independent of the given column(s)).MEAN: Arithmetic mean (average), equivalent to sum/count.STDV: Sample standard deviation (denominator is count-1).VARIANCE: Unbiased sample variance (denominator is count-1).SKEW: Skewness (third standardized moment).KURTOSIS: Kurtosis (fourth standardized moment).SUM: Sum of all values in the column(s).MIN: Minimum value of the column(s).MAX: Maximum value of the column(s).WEIGHTED_AVERAGE: Weighted arithmetic mean (using the optionWEIGHT_COLUMN_NAMEas the weighting column).CARDINALITY: Number of unique values in the column(s).ESTIMATED_CARDINALITY: Estimate (via hyperloglog technique) of the number of unique values in the column(s).PERCENTILE: Estimate (via t-digest) of the given percentile of the column(s) (percentile(50.0) will be an approximation of the median). Add a second, comma-separated value to calculate percentile resolution, e.g., 'percentile(75,150)'PERCENTILE_RANK: Estimate (via t-digest) of the percentile rank of the given value in the column(s) (if the given value is the median of the column(s), percentile_rank(<median>) will return approximately 50.0).
- Parameters:
stats- The new value forstats.- Returns:
thisto mimic the builder pattern.
-
getOptions
public Map<String,String> getOptions()
Optional parameters.ADDITIONAL_COLUMN_NAMES: A list of comma separated column names over which statistics can be accumulated along with the primary column. All columns listed andcolumnNamemust be of the same type. Must not include the column specified incolumnNameand no column can be listed twice.WEIGHT_COLUMN_NAME: Name of column used as weighting attribute for the weighted average statistic.
Map.- Returns:
- The current value of
options.
-
setOptions
public AggregateStatisticsRequest setOptions(Map<String,String> options)
Optional parameters.ADDITIONAL_COLUMN_NAMES: A list of comma separated column names over which statistics can be accumulated along with the primary column. All columns listed andcolumnNamemust be of the same type. Must not include the column specified incolumnNameand no column can be listed twice.WEIGHT_COLUMN_NAME: Name of column used as weighting attribute for the weighted average statistic.
Map.- Parameters:
options- The new value foroptions.- Returns:
thisto mimic the builder pattern.
-
getSchema
public org.apache.avro.Schema getSchema()
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getSchemain interfaceorg.apache.avro.generic.GenericContainer- Returns:
- The schema object describing this class.
-
get
public Object get(int index)
This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
getin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to get- Returns:
- value of the field with the given index.
- Throws:
IndexOutOfBoundsException
-
put
public void put(int index, Object value)This method supports the Avro framework and is not intended to be called directly by the user.- Specified by:
putin interfaceorg.apache.avro.generic.IndexedRecord- Parameters:
index- the position of the field to setvalue- the value to set- Throws:
IndexOutOfBoundsException
-
-