mirror of https://github.com/apache/druid.git
Default implementation for getDouble(). (#4595)
* Default implementation for getDouble(). * use getFloat for default implementation. * addressed comment. * new line.
This commit is contained in:
parent
d4ef0f6d94
commit
c372d2ecc1
|
@ -41,7 +41,16 @@ public interface Aggregator extends Closeable
|
|||
Object get();
|
||||
float getFloat();
|
||||
long getLong();
|
||||
double getDouble();
|
||||
|
||||
/**
|
||||
* The default implementation casts {@link 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.
|
||||
*/
|
||||
default double getDouble()
|
||||
{
|
||||
return (double) getFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
void close();
|
||||
|
|
|
@ -123,11 +123,18 @@ public interface BufferAggregator extends HotLoopCallee
|
|||
* have an {@link AggregatorFactory#getTypeName()} of "double".
|
||||
* If unimplemented, throwing an {@link UnsupportedOperationException} is common and recommended.
|
||||
*
|
||||
* The default implementation casts {@link BufferAggregator#getFloat(ByteBuffer, int)} to double.
|
||||
* This default method is added to enable smooth backward compatibility, please re-implement it if your aggregators
|
||||
* work with numeric double columns.
|
||||
*
|
||||
* @param buf byte buffer storing the byte array representation of the aggregate
|
||||
* @param position offset within the byte buffer at which the aggregate value is stored
|
||||
* @return the double representation of the aggregate
|
||||
*/
|
||||
double getDouble(ByteBuffer buf, int position);
|
||||
default double getDouble(ByteBuffer buf, int position)
|
||||
{
|
||||
return (double) getFloat(buf, position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release any resources used by the aggregator
|
||||
|
|
Loading…
Reference in New Issue