fix incorrect ColumnInspector in IncrementalIndex.makeColumnSelectorFactory (#12155)

This commit is contained in:
Clint Wylie 2022-01-13 18:09:06 -08:00 committed by GitHub
parent eb4fafe08f
commit e0c4c568cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -39,7 +39,6 @@ import org.apache.druid.query.aggregation.AggregatorFactory;
import org.apache.druid.segment.DimensionHandlerUtils; import org.apache.druid.segment.DimensionHandlerUtils;
import org.apache.druid.segment.VirtualColumns; import org.apache.druid.segment.VirtualColumns;
import org.apache.druid.segment.column.ColumnType; import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.segment.column.ValueType; import org.apache.druid.segment.column.ValueType;
import org.apache.druid.segment.incremental.IncrementalIndex; import org.apache.druid.segment.incremental.IncrementalIndex;
import org.apache.druid.segment.serde.ComplexMetricSerde; import org.apache.druid.segment.serde.ComplexMetricSerde;
@ -331,7 +330,7 @@ public class InputRowSerde
writeString(k, out); writeString(k, out);
try (Aggregator agg = aggFactory.factorize( try (Aggregator agg = aggFactory.factorize(
IncrementalIndex.makeColumnSelectorFactory(RowSignature.empty(), VirtualColumns.EMPTY, aggFactory, supplier, true) IncrementalIndex.makeColumnSelectorFactory(VirtualColumns.EMPTY, aggFactory, supplier, true)
)) { )) {
try { try {
agg.aggregate(); agg.aggregate();

View File

@ -71,6 +71,7 @@ import org.apache.druid.segment.column.ColumnCapabilities;
import org.apache.druid.segment.column.ColumnCapabilitiesImpl; import org.apache.druid.segment.column.ColumnCapabilitiesImpl;
import org.apache.druid.segment.column.ColumnHolder; import org.apache.druid.segment.column.ColumnHolder;
import org.apache.druid.segment.column.ColumnType; import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.segment.column.ValueType; import org.apache.druid.segment.column.ValueType;
import org.apache.druid.segment.serde.ComplexMetricExtractor; import org.apache.druid.segment.serde.ComplexMetricExtractor;
import org.apache.druid.segment.serde.ComplexMetricSerde; import org.apache.druid.segment.serde.ComplexMetricSerde;
@ -112,17 +113,18 @@ public abstract class IncrementalIndex extends AbstractIndex implements Iterable
* @return column selector factory * @return column selector factory
*/ */
public static ColumnSelectorFactory makeColumnSelectorFactory( public static ColumnSelectorFactory makeColumnSelectorFactory(
final ColumnInspector columnInspector,
final VirtualColumns virtualColumns, final VirtualColumns virtualColumns,
final AggregatorFactory agg, final AggregatorFactory agg,
final Supplier<InputRow> in, final Supplier<InputRow> in,
final boolean deserializeComplexMetrics final boolean deserializeComplexMetrics
) )
{ {
// we use RowSignature.empty() because ColumnInspector here should be the InputRow schema, not the
// IncrementalIndex schema, because we are reading values from the InputRow
final RowBasedColumnSelectorFactory<InputRow> baseSelectorFactory = RowBasedColumnSelectorFactory.create( final RowBasedColumnSelectorFactory<InputRow> baseSelectorFactory = RowBasedColumnSelectorFactory.create(
RowAdapters.standardRow(), RowAdapters.standardRow(),
in::get, in::get,
columnInspector, RowSignature.empty(),
true true
); );
@ -1019,7 +1021,7 @@ public abstract class IncrementalIndex extends AbstractIndex implements Iterable
final boolean deserializeComplexMetrics final boolean deserializeComplexMetrics
) )
{ {
return makeColumnSelectorFactory(this, virtualColumns, agg, in, deserializeComplexMetrics); return makeColumnSelectorFactory(virtualColumns, agg, in, deserializeComplexMetrics);
} }
protected final Comparator<IncrementalIndexRow> dimsComparator() protected final Comparator<IncrementalIndexRow> dimsComparator()