Package org.apache.drill.exec.expr
Class StatisticsProvider<T extends Comparable<T>>
java.lang.Object
org.apache.drill.common.expression.visitors.AbstractExprVisitor<ColumnStatistics<?>,Void,RuntimeException>
org.apache.drill.exec.expr.StatisticsProvider<T>
- All Implemented Interfaces:
ExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
public class StatisticsProvider<T extends Comparable<T>>
extends AbstractExprVisitor<ColumnStatistics<?>,Void,RuntimeException>
-
Constructor Summary
ConstructorDescriptionStatisticsProvider
(Map<SchemaPath, ColumnStatistics<?>> columnStatMap, long rowCount, UdfUtilities udfUtilities) -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> ColumnStatistics<V>
getColumnStatistics
(V minVal, V maxVal, long nullsCount, TypeProtos.MinorType type) ReturnsColumnStatistics
instance with set min, max values and nulls count statistics specified in the arguments.static <V> ColumnStatistics<V>
getConstantColumnStatistics
(V minMaxValue, LogicalExpression expr) ReturnsColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0.static <V> ColumnStatistics<V>
getConstantColumnStatistics
(V minMaxValue, TypeProtos.MinorType type) ReturnsColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0.long
visitBooleanConstant
(ValueExpressions.BooleanExpression expr, Void value) visitDateConstant
(ValueExpressions.DateExpression expr, Void value) visitDoubleConstant
(ValueExpressions.DoubleExpression expr, Void value) visitFloatConstant
(ValueExpressions.FloatExpression expr, Void value) visitFunctionHolderExpression
(FunctionHolderExpression holderExpr, Void value) visitIntConstant
(ValueExpressions.IntExpression expr, Void value) visitLongConstant
(ValueExpressions.LongExpression expr, Void value) visitQuotedStringConstant
(ValueExpressions.QuotedString expr, Void value) visitTimeConstant
(ValueExpressions.TimeExpression expr, Void value) visitTypedFieldExpr
(TypedFieldExpr typedFieldExpr, Void value) visitUnknown
(LogicalExpression e, Void value) Handles implementation-specific expressions not known to the visitor structure.Methods inherited from class org.apache.drill.common.expression.visitors.AbstractExprVisitor
visitAnyValueExpression, visitBooleanOperator, visitCastExpression, visitConvertExpression, visitDecimal18Constant, visitDecimal28Constant, visitDecimal38Constant, visitDecimal9Constant, visitFunctionCall, visitIfExpression, visitIntervalDayConstant, visitIntervalYearConstant, visitNullConstant, visitNullExpression, visitParameter, visitSchemaPath
-
Constructor Details
-
StatisticsProvider
public StatisticsProvider(Map<SchemaPath, ColumnStatistics<?>> columnStatMap, long rowCount, UdfUtilities udfUtilities)
-
-
Method Details
-
getRowCount
public long getRowCount() -
visitUnknown
Description copied from class:AbstractExprVisitor
Handles implementation-specific expressions not known to the visitor structure. Since there are no "visitFoo" methods for these "unknown" expressions, subclassses should use the functionally-equivalentinstanceof
approach to parse out these "unknown" expressions.- Specified by:
visitUnknown
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitUnknown
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitTypedFieldExpr
- Specified by:
visitTypedFieldExpr
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitTypedFieldExpr
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitIntConstant
- Specified by:
visitIntConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitIntConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitBooleanConstant
public ColumnStatistics<Boolean> visitBooleanConstant(ValueExpressions.BooleanExpression expr, Void value) - Specified by:
visitBooleanConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitBooleanConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitLongConstant
- Specified by:
visitLongConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitLongConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitFloatConstant
public ColumnStatistics<Float> visitFloatConstant(ValueExpressions.FloatExpression expr, Void value) - Specified by:
visitFloatConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitFloatConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitDoubleConstant
public ColumnStatistics<Double> visitDoubleConstant(ValueExpressions.DoubleExpression expr, Void value) - Specified by:
visitDoubleConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitDoubleConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitDateConstant
- Specified by:
visitDateConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitDateConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitTimeStampConstant
public ColumnStatistics<Long> visitTimeStampConstant(ValueExpressions.TimeStampExpression expr, Void value) - Specified by:
visitTimeStampConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitTimeStampConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitTimeConstant
public ColumnStatistics<Integer> visitTimeConstant(ValueExpressions.TimeExpression expr, Void value) - Specified by:
visitTimeConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitTimeConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitQuotedStringConstant
public ColumnStatistics<String> visitQuotedStringConstant(ValueExpressions.QuotedString expr, Void value) - Specified by:
visitQuotedStringConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitQuotedStringConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitVarDecimalConstant
public ColumnStatistics<BigInteger> visitVarDecimalConstant(ValueExpressions.VarDecimalExpression expr, Void value) - Specified by:
visitVarDecimalConstant
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitVarDecimalConstant
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
visitFunctionHolderExpression
public ColumnStatistics<?> visitFunctionHolderExpression(FunctionHolderExpression holderExpr, Void value) - Specified by:
visitFunctionHolderExpression
in interfaceExprVisitor<ColumnStatistics<?>,
Void, RuntimeException> - Overrides:
visitFunctionHolderExpression
in classAbstractExprVisitor<ColumnStatistics<?>,
Void, RuntimeException>
-
getColumnStatistics
public static <V> ColumnStatistics<V> getColumnStatistics(V minVal, V maxVal, long nullsCount, TypeProtos.MinorType type) ReturnsColumnStatistics
instance with set min, max values and nulls count statistics specified in the arguments.- Type Parameters:
V
- type of min and max values- Parameters:
minVal
- min valuemaxVal
- max valuenullsCount
- nulls counttype
- type of the column- Returns:
ColumnStatistics
instance with set min, max values and nulls count statistics
-
getConstantColumnStatistics
public static <V> ColumnStatistics<V> getConstantColumnStatistics(V minMaxValue, LogicalExpression expr) ReturnsColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0. ResultingColumnStatistics
instance corresponds to a constant value, so nulls count is set to 0.- Type Parameters:
V
- type of min and max values- Parameters:
minMaxValue
- value of min and max statisticsexpr
- source of column type- Returns:
ColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0
-
getConstantColumnStatistics
public static <V> ColumnStatistics<V> getConstantColumnStatistics(V minMaxValue, TypeProtos.MinorType type) ReturnsColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0. ResultingColumnStatistics
instance corresponds to a constant value, so nulls count is set to 0.- Type Parameters:
V
- type of min and max values- Parameters:
minMaxValue
- value of min and max statisticstype
- column type- Returns:
ColumnStatistics
instance with min and max values set tominMaxValue
and nulls count set to 0
-