Skip to content

Commit

Permalink
Update PostAggregator to be backwards compat (apache#12138)
Browse files Browse the repository at this point in the history
This change mimics what was done in PR apache#11917 to
fix the incompatibilities produced by apache#11713. apache#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

(cherry picked from commit eb0bae4)
  • Loading branch information
imply-cheddar authored and sachinsagare committed Oct 31, 2022
1 parent a50469f commit 83f1ff8
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
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;
Expand All @@ -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
Expand Down

0 comments on commit 83f1ff8

Please sign in to comment.