Update PostAggregator to be backwards compat (#12138)

This change mimics what was done in PR #11917 to
fix the incompatibilities produced by #11713. #11917
fixed it with AggregatorFactory by creating default
methods to allow for extensions built against old
jars to still work.  This does the same for PostAggregator
This commit is contained in:
imply-cheddar 2022-01-11 19:18:14 +09:00 committed by GitHub
parent 7cf9192765
commit eb0bae49ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -23,6 +23,8 @@ import org.apache.druid.guice.annotations.ExtensionPoint;
import org.apache.druid.java.util.common.Cacheable;
import org.apache.druid.segment.ColumnInspector;
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.ColumnTypeFactory;
import org.apache.druid.segment.column.ValueType;
import javax.annotation.Nullable;
import java.util.Comparator;
@ -48,10 +50,27 @@ public interface PostAggregator extends Cacheable
/**
* Return the output type of a row processed with this post aggregator. Refer to the {@link ColumnType} javadocs
* for details on the implications of choosing a type.
*
* @param signature
*/
@Nullable
ColumnType getType(ColumnInspector signature);
default ColumnType getType(ColumnInspector signature)
{
return ColumnTypeFactory.ofValueType(getType());
}
/**
* This method is deprecated and will be removed soon. Use {@link #getType(ColumnInspector)} instead. Do not call this
* method, it will likely produce incorrect results, it exists for backwards compatibility.
*/
@Deprecated
default ValueType getType()
{
throw new UnsupportedOperationException(
"Do not call or implement this method, it is deprecated, use 'getType(ColumnInspector)' instead"
);
}
/**
* Allows returning an enriched post aggregator, built from contextual information available from the given map of