Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down