Skip to content

Commit

Permalink
use VectorValueSelector instead of BaseLongVectorValueSelector for St…
Browse files Browse the repository at this point in the history
…ringFirstAggregatorFactory.factorizeVector (#14957)
  • Loading branch information
clintropolis authored Sep 9, 2023
1 parent 09f7dfe commit 2b7f2c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.query.aggregation.SerializablePairLongString;
import org.apache.druid.query.aggregation.VectorAggregator;
import org.apache.druid.segment.vector.BaseLongVectorValueSelector;
import org.apache.druid.segment.vector.SingleValueDimensionVectorSelector;
import org.apache.druid.segment.vector.VectorValueSelector;

import javax.annotation.Nullable;
import java.nio.ByteBuffer;

public class SingleStringFirstDimensionVectorAggregator implements VectorAggregator
{
private final BaseLongVectorValueSelector timeSelector;
private final VectorValueSelector timeSelector;
private final SingleValueDimensionVectorSelector valueDimensionVectorSelector;
private long firstTime;
private final int maxStringBytes;
private final boolean useDefault = NullHandling.replaceWithDefault();

public SingleStringFirstDimensionVectorAggregator(
BaseLongVectorValueSelector timeSelector,
VectorValueSelector timeSelector,
SingleValueDimensionVectorSelector valueDimensionVectorSelector,
int maxStringBytes
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
import org.apache.druid.segment.column.ColumnHolder;
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.ValueType;
import org.apache.druid.segment.vector.BaseLongVectorValueSelector;
import org.apache.druid.segment.vector.SingleValueDimensionVectorSelector;
import org.apache.druid.segment.vector.VectorColumnSelectorFactory;
import org.apache.druid.segment.vector.VectorObjectSelector;
import org.apache.druid.segment.vector.VectorValueSelector;

import javax.annotation.Nullable;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -186,8 +186,7 @@ public BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory)
@Override
public VectorAggregator factorizeVector(VectorColumnSelectorFactory selectorFactory)
{
BaseLongVectorValueSelector timeSelector = (BaseLongVectorValueSelector) selectorFactory.makeValueSelector(
timeColumn);
final VectorValueSelector timeSelector = selectorFactory.makeValueSelector(timeColumn);
ColumnCapabilities capabilities = selectorFactory.getColumnCapabilities(fieldName);
if (capabilities != null) {
if (capabilities.is(ValueType.STRING) && capabilities.isDictionaryEncoded().isTrue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.druid.query.aggregation.SerializablePairLongString;
import org.apache.druid.query.aggregation.VectorAggregator;
import org.apache.druid.segment.DimensionHandlerUtils;
import org.apache.druid.segment.vector.BaseLongVectorValueSelector;
import org.apache.druid.segment.vector.VectorObjectSelector;
import org.apache.druid.segment.vector.VectorValueSelector;

Expand All @@ -42,7 +41,7 @@ public class StringFirstVectorAggregator implements VectorAggregator


public StringFirstVectorAggregator(
BaseLongVectorValueSelector timeSelector,
VectorValueSelector timeSelector,
VectorObjectSelector valueSelector,
int maxStringBytes
)
Expand Down

0 comments on commit 2b7f2c5

Please sign in to comment.