public final class NullableNumericAggregator extends Object implements Aggregator
Aggregator
.
The result of this aggregator will be null if all the values to be aggregated are null values or no values are
aggregated at all. If any of the values are non-null, the result will be the aggregated value of the delegate
aggregator.
When wrapped by this class, the underlying aggregator's required storage space is increased by one byte. The extra
byte is a boolean that stores whether or not any non-null values have been seen. The extra byte is placed before
the underlying aggregator's normal state. (Buffer layout = [nullability byte] [delegate storage bytes])
Used by NullableNumericAggregatorFactory.factorize(ColumnSelectorFactory)
to wrap non-null aware
aggregators. This class is only used when SQL compatible null handling is enabled.Constructor and Description |
---|
NullableNumericAggregator(Aggregator delegate,
BaseNullableColumnValueSelector selector) |
Modifier and Type | Method and Description |
---|---|
void |
aggregate() |
void |
close() |
Object |
get() |
double |
getDouble()
The default implementation casts
Aggregator.getFloat() to double. |
float |
getFloat() |
long |
getLong() |
boolean |
isNull()
returns true if aggregator's output type is primitive long/double/float and aggregated value is null,
but when aggregated output type is Object, this method always returns false,
and users are advised to check nullability for the object returned by
Aggregator.get()
method. |
public NullableNumericAggregator(Aggregator delegate, BaseNullableColumnValueSelector selector)
public void aggregate()
aggregate
in interface Aggregator
@Nullable public Object get()
get
in interface Aggregator
public float getFloat()
getFloat
in interface Aggregator
public long getLong()
getLong
in interface Aggregator
public double getDouble()
Aggregator
Aggregator.getFloat()
to double.
This default method is added to enable smooth backward compatibility, please re-implement it if your aggregators
work with numeric double columns.getDouble
in interface Aggregator
public boolean isNull()
Aggregator
Aggregator.get()
method.
The default implementation always return false to enable smooth backward compatibility,
re-implement if your aggregator is nullable.isNull
in interface Aggregator
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Aggregator
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.