You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2019/09/30 19:58:20 UTC

[incubator-pinot] 01/01: Refactor TransformBlockDataFetcher into RowBasedBlockValueFetcher

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch refactor_transform_fetcher
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 27cad489e56ff370892dfb061cc4e72dd4193415
Author: Jackie (Xiaotian) Jiang <xa...@linkedin.com>
AuthorDate: Mon Sep 30 12:56:44 2019 -0700

    Refactor TransformBlockDataFetcher into RowBasedBlockValueFetcher
    
    Add BlockValSet.isSingleValue() interface
    Remove the old value fetcher implementations
---
 .../apache/pinot/core/common/BaseBlockValSet.java  |   9 +-
 .../org/apache/pinot/core/common/BlockValSet.java  |   2 +
 .../core/common/RowBasedBlockValueFetcher.java     | 217 +++++++++++++
 .../core/operator/blocks/ProjectionBlock.java      |   9 +-
 .../core/operator/docvalsets/MultiValueSet.java    |   5 +
 .../operator/docvalsets/ProjectionBlockValSet.java |  75 ++---
 .../core/operator/docvalsets/SingleValueSet.java   |   5 +
 .../operator/docvalsets/TransformBlockValSet.java  |  10 +
 .../operator/query/SelectionOrderByOperator.java   |  18 +-
 .../transform/TransformBlockDataFetcher.java       | 351 ---------------------
 .../function/DistinctAggregationFunction.java      |   9 +-
 .../core/query/selection/SelectionFetcher.java     | 125 --------
 .../comparator/CompositeDocIdValComparator.java    |  85 -----
 .../comparator/DocIdDoubleValComparator.java       |  44 ---
 .../comparator/DocIdFloatValComparator.java        |  44 ---
 .../comparator/DocIdIntValComparator.java          |  44 ---
 .../comparator/DocIdLongValComparator.java         |  44 ---
 .../selection/comparator/IDocIdValComparator.java  |  24 --
 .../iterator/BytesSelectionColumnIterator.java     |  50 ---
 .../DoubleArraySelectionColumnIterator.java        |  45 ---
 .../iterator/DoubleSelectionColumnIterator.java    |  42 ---
 .../FloatArraySelectionColumnIterator.java         |  45 ---
 .../iterator/FloatSelectionColumnIterator.java     |  42 ---
 .../iterator/IntArraySelectionColumnIterator.java  |  45 ---
 .../iterator/IntSelectionColumnIterator.java       |  42 ---
 .../iterator/LongArraySelectionColumnIterator.java |  45 ---
 .../iterator/LongSelectionColumnIterator.java      |  42 ---
 .../iterator/SelectionColumnIterator.java          |  31 --
 .../SelectionMultiValueColumnIterator.java         |  44 ---
 ...SelectionSingleValueColumnWithDictIterator.java |  49 ---
 .../StringArraySelectionColumnIterator.java        |  45 ---
 .../iterator/StringSelectionColumnIterator.java    |  50 ---
 32 files changed, 286 insertions(+), 1451 deletions(-)

diff --git a/pinot-core/src/main/java/org/apache/pinot/core/common/BaseBlockValSet.java b/pinot-core/src/main/java/org/apache/pinot/core/common/BaseBlockValSet.java
index 88f2579..252a4f0 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/common/BaseBlockValSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/common/BaseBlockValSet.java
@@ -18,20 +18,13 @@
  */
 package org.apache.pinot.core.common;
 
-import org.apache.pinot.common.data.FieldSpec;
-
-
 /**
  * Abstract base class implementation for BlockValSet
  */
 public abstract class BaseBlockValSet implements BlockValSet {
-  @Override
-  public BlockValIterator iterator() {
-    throw new UnsupportedOperationException();
-  }
 
   @Override
-  public FieldSpec.DataType getValueType() {
+  public BlockValIterator iterator() {
     throw new UnsupportedOperationException();
   }
 
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/common/BlockValSet.java b/pinot-core/src/main/java/org/apache/pinot/core/common/BlockValSet.java
index b39d126..98891e1 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/common/BlockValSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/common/BlockValSet.java
@@ -27,6 +27,8 @@ public interface BlockValSet {
 
   DataType getValueType();
 
+  boolean isSingleValue();
+
   /**
    * DOCUMENT ID BASED APIs
    */
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/common/RowBasedBlockValueFetcher.java b/pinot-core/src/main/java/org/apache/pinot/core/common/RowBasedBlockValueFetcher.java
new file mode 100644
index 0000000..72a7694
--- /dev/null
+++ b/pinot-core/src/main/java/org/apache/pinot/core/common/RowBasedBlockValueFetcher.java
@@ -0,0 +1,217 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.common;
+
+import java.io.Serializable;
+import org.apache.pinot.common.data.FieldSpec.DataType;
+
+
+public class RowBasedBlockValueFetcher {
+  private final ValueFetcher[] _valueFetchers;
+
+  public RowBasedBlockValueFetcher(BlockValSet[] blockValSets) {
+    int numColumns = blockValSets.length;
+    _valueFetchers = new ValueFetcher[numColumns];
+    for (int i = 0; i < numColumns; i++) {
+      _valueFetchers[i] = createFetcher(blockValSets[i]);
+    }
+  }
+
+  public Serializable[] getRow(int docId) {
+    int numColumns = _valueFetchers.length;
+    Serializable[] row = new Serializable[numColumns];
+    for (int i = 0; i < numColumns; i++) {
+      row[i] = _valueFetchers[i].getValue(docId);
+    }
+    return row;
+  }
+
+  private ValueFetcher createFetcher(BlockValSet blockValSet) {
+    DataType valueType = blockValSet.getValueType();
+    if (blockValSet.isSingleValue()) {
+      switch (valueType) {
+        case INT:
+          return new IntSingleValueFetcher(blockValSet.getIntValuesSV());
+        case LONG:
+          return new LongSingleValueFetcher(blockValSet.getLongValuesSV());
+        case FLOAT:
+          return new FloatSingleValueFetcher(blockValSet.getFloatValuesSV());
+        case DOUBLE:
+          return new DoubleSingleValueFetcher(blockValSet.getDoubleValuesSV());
+        case STRING:
+          return new StringSingleValueFetcher(blockValSet.getStringValuesSV());
+        case BYTES:
+          return new BytesValueFetcher(blockValSet.getBytesValuesSV());
+        default:
+          throw new IllegalStateException();
+      }
+    } else {
+      switch (valueType) {
+        case INT:
+          return new IntMultiValueFetcher(blockValSet.getIntValuesMV());
+        case LONG:
+          return new LongMultiValueFetcher(blockValSet.getLongValuesMV());
+        case FLOAT:
+          return new FloatMultiValueFetcher(blockValSet.getFloatValuesMV());
+        case DOUBLE:
+          return new DoubleMultiValueFetcher(blockValSet.getDoubleValuesMV());
+        case STRING:
+          return new StringMultiValueFetcher(blockValSet.getStringValuesMV());
+        default:
+          throw new IllegalStateException();
+      }
+    }
+  }
+
+  private interface ValueFetcher {
+    Serializable getValue(int docId);
+  }
+
+  private class IntSingleValueFetcher implements ValueFetcher {
+    private final int[] _values;
+
+    IntSingleValueFetcher(int[] values) {
+      _values = values;
+    }
+
+    public Integer getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class LongSingleValueFetcher implements ValueFetcher {
+    private final long[] _values;
+
+    LongSingleValueFetcher(long[] values) {
+      _values = values;
+    }
+
+    public Long getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class FloatSingleValueFetcher implements ValueFetcher {
+    private final float[] _values;
+
+    FloatSingleValueFetcher(float[] values) {
+      _values = values;
+    }
+
+    public Float getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class DoubleSingleValueFetcher implements ValueFetcher {
+    private final double[] _values;
+
+    DoubleSingleValueFetcher(double[] values) {
+      _values = values;
+    }
+
+    public Double getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class StringSingleValueFetcher implements ValueFetcher {
+    private final String[] _values;
+
+    StringSingleValueFetcher(String[] values) {
+      _values = values;
+    }
+
+    public String getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class BytesValueFetcher implements ValueFetcher {
+    private final byte[][] _values;
+
+    BytesValueFetcher(byte[][] values) {
+      _values = values;
+    }
+
+    public byte[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class IntMultiValueFetcher implements ValueFetcher {
+    private final int[][] _values;
+
+    IntMultiValueFetcher(int[][] values) {
+      _values = values;
+    }
+
+    public int[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class LongMultiValueFetcher implements ValueFetcher {
+    private final long[][] _values;
+
+    LongMultiValueFetcher(long[][] values) {
+      _values = values;
+    }
+
+    public long[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class FloatMultiValueFetcher implements ValueFetcher {
+    private final float[][] _values;
+
+    FloatMultiValueFetcher(float[][] values) {
+      _values = values;
+    }
+
+    public float[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class DoubleMultiValueFetcher implements ValueFetcher {
+    private final double[][] _values;
+
+    DoubleMultiValueFetcher(double[][] values) {
+      _values = values;
+    }
+
+    public double[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+
+  private class StringMultiValueFetcher implements ValueFetcher {
+    private final String[][] _values;
+
+    StringMultiValueFetcher(String[][] values) {
+      _values = values;
+    }
+
+    public String[] getValue(int docId) {
+      return _values[docId];
+    }
+  }
+}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/ProjectionBlock.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/ProjectionBlock.java
index 48dda48..1179885 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/ProjectionBlock.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/ProjectionBlock.java
@@ -63,13 +63,10 @@ public class ProjectionBlock implements Block {
     throw new UnsupportedOperationException();
   }
 
-  // TODO: let selection operator use DataBlockCache as well
-  public Block getBlock(String column) {
-    return _blockMap.get(column);
-  }
-
   public BlockValSet getBlockValueSet(String column) {
-    return new ProjectionBlockValSet(_dataBlockCache, column, _blockMap.get(column).getMetadata().getDataType());
+    BlockMetadata blockMetadata = _blockMap.get(column).getMetadata();
+    return new ProjectionBlockValSet(_dataBlockCache, column, blockMetadata.getDataType(),
+        blockMetadata.isSingleValue());
   }
 
   public DocIdSetBlock getDocIdSetBlock() {
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/MultiValueSet.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/MultiValueSet.java
index 37cc021..cde916a 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/MultiValueSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/MultiValueSet.java
@@ -45,4 +45,9 @@ public final class MultiValueSet extends BaseBlockValSet {
   public DataType getValueType() {
     return _dataType;
   }
+
+  @Override
+  public boolean isSingleValue() {
+    return false;
+  }
 }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/ProjectionBlockValSet.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/ProjectionBlockValSet.java
index ac9f89e..d19ed6e 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/ProjectionBlockValSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/ProjectionBlockValSet.java
@@ -18,7 +18,7 @@
  */
 package org.apache.pinot.core.operator.docvalsets;
 
-import org.apache.pinot.common.data.FieldSpec;
+import org.apache.pinot.common.data.FieldSpec.DataType;
 import org.apache.pinot.core.common.BaseBlockValSet;
 import org.apache.pinot.core.common.DataBlockCache;
 import org.apache.pinot.core.operator.ProjectionOperator;
@@ -32,7 +32,8 @@ import org.apache.pinot.core.operator.ProjectionOperator;
 public class ProjectionBlockValSet extends BaseBlockValSet {
   private final DataBlockCache _dataBlockCache;
   private final String _column;
-  private final FieldSpec.DataType _dataType;
+  private final DataType _dataType;
+  private final boolean _singleValue;
 
   /**
    * Constructor for the class.
@@ -42,64 +43,48 @@ public class ProjectionBlockValSet extends BaseBlockValSet {
    * @param dataBlockCache data block cache
    * @param column Projection column.
    */
-  public ProjectionBlockValSet(DataBlockCache dataBlockCache, String column, FieldSpec.DataType dataType) {
+  public ProjectionBlockValSet(DataBlockCache dataBlockCache, String column, DataType dataType, boolean singleValue) {
     _dataBlockCache = dataBlockCache;
     _column = column;
     _dataType = dataType;
+    _singleValue = singleValue;
   }
 
   @Override
-  public int[] getIntValuesSV() {
-    return _dataBlockCache.getIntValuesForSVColumn(_column);
+  public DataType getValueType() {
+    return _dataType;
   }
 
   @Override
-  public int[][] getIntValuesMV() {
-    return _dataBlockCache.getIntValuesForMVColumn(_column);
+  public boolean isSingleValue() {
+    return _singleValue;
   }
 
   @Override
-  public long[] getLongValuesSV() {
-    return _dataBlockCache.getLongValuesForSVColumn(_column);
+  public int[] getDictionaryIdsSV() {
+    return _dataBlockCache.getDictIdsForSVColumn(_column);
   }
 
   @Override
-  public long[][] getLongValuesMV() {
-    return _dataBlockCache.getLongValuesForMVColumn(_column);
+  public int[] getIntValuesSV() {
+    return _dataBlockCache.getIntValuesForSVColumn(_column);
   }
 
   @Override
-  public float[] getFloatValuesSV() {
-    return _dataBlockCache.getFloatValuesForSVColumn(_column);
+  public long[] getLongValuesSV() {
+    return _dataBlockCache.getLongValuesForSVColumn(_column);
   }
 
   @Override
-  public float[][] getFloatValuesMV() {
-    return _dataBlockCache.getFloatValuesForMVColumn(_column);
+  public float[] getFloatValuesSV() {
+    return _dataBlockCache.getFloatValuesForSVColumn(_column);
   }
 
-  /**
-   * Returns an array of single values for the given doc Ids.
-   * Caller chooses T based on data type.
-   *
-   * @return Array of single-values from dataBlockCache.
-   */
   @Override
   public double[] getDoubleValuesSV() {
     return _dataBlockCache.getDoubleValuesForSVColumn(_column);
   }
 
-  /**
-   * Returns an array of multi-values for the given doc Ids.
-   * Caller chooses T based on data type.
-   *
-   * @return Array of multi-values from dataBlockCache.
-   */
-  @Override
-  public double[][] getDoubleValuesMV() {
-    return _dataBlockCache.getDoubleValuesForMVColumn(_column);
-  }
-
   @Override
   public String[] getStringValuesSV() {
     return _dataBlockCache.getStringValuesForSVColumn(_column);
@@ -111,23 +96,33 @@ public class ProjectionBlockValSet extends BaseBlockValSet {
   }
 
   @Override
-  public String[][] getStringValuesMV() {
-    return _dataBlockCache.getStringValuesForMVColumn(_column);
+  public int[][] getDictionaryIdsMV() {
+    return _dataBlockCache.getDictIdsForMVColumn(_column);
   }
 
   @Override
-  public FieldSpec.DataType getValueType() {
-    return _dataType;
+  public int[][] getIntValuesMV() {
+    return _dataBlockCache.getIntValuesForMVColumn(_column);
   }
 
   @Override
-  public int[] getDictionaryIdsSV() {
-    return _dataBlockCache.getDictIdsForSVColumn(_column);
+  public long[][] getLongValuesMV() {
+    return _dataBlockCache.getLongValuesForMVColumn(_column);
   }
 
   @Override
-  public int[][] getDictionaryIdsMV() {
-    return _dataBlockCache.getDictIdsForMVColumn(_column);
+  public float[][] getFloatValuesMV() {
+    return _dataBlockCache.getFloatValuesForMVColumn(_column);
+  }
+
+  @Override
+  public double[][] getDoubleValuesMV() {
+    return _dataBlockCache.getDoubleValuesForMVColumn(_column);
+  }
+
+  @Override
+  public String[][] getStringValuesMV() {
+    return _dataBlockCache.getStringValuesForMVColumn(_column);
   }
 
   @Override
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/SingleValueSet.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/SingleValueSet.java
index ea47430..9fa04ab 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/SingleValueSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/SingleValueSet.java
@@ -49,6 +49,11 @@ public final class SingleValueSet extends BaseBlockValSet {
   }
 
   @Override
+  public boolean isSingleValue() {
+    return true;
+  }
+
+  @Override
   public void getIntValues(int[] inDocIds, int inStartPos, int inDocIdsSize, int[] outValues, int outStartPos) {
     int inEndPos = inStartPos + inDocIdsSize;
     ReaderContext context = _reader.createContext();
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/TransformBlockValSet.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/TransformBlockValSet.java
index b8b6b22..516cd94 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/TransformBlockValSet.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/docvalsets/TransformBlockValSet.java
@@ -48,6 +48,11 @@ public class TransformBlockValSet extends BaseBlockValSet {
   }
 
   @Override
+  public boolean isSingleValue() {
+    return _transformFunction.getResultMetadata().isSingleValue();
+  }
+
+  @Override
   public int[] getDictionaryIdsSV() {
     return _transformFunction.transformToDictIdsSV(_projectionBlock);
   }
@@ -78,6 +83,11 @@ public class TransformBlockValSet extends BaseBlockValSet {
   }
 
   @Override
+  public byte[][] getBytesValuesSV() {
+    return _transformFunction.transformToBytesValuesSV(_projectionBlock);
+  }
+
+  @Override
   public int[][] getDictionaryIdsMV() {
     return _transformFunction.transformToDictIdsMV(_projectionBlock);
   }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java
index eee2ceb..422638a 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java
@@ -28,16 +28,15 @@ import org.apache.pinot.common.request.transform.TransformExpressionTree;
 import org.apache.pinot.common.utils.DataSchema;
 import org.apache.pinot.common.utils.primitive.ByteArray;
 import org.apache.pinot.core.common.BlockValSet;
+import org.apache.pinot.core.common.RowBasedBlockValueFetcher;
 import org.apache.pinot.core.indexsegment.IndexSegment;
 import org.apache.pinot.core.operator.BaseOperator;
 import org.apache.pinot.core.operator.ExecutionStatistics;
 import org.apache.pinot.core.operator.blocks.IntermediateResultsBlock;
 import org.apache.pinot.core.operator.blocks.TransformBlock;
-import org.apache.pinot.core.operator.transform.TransformBlockDataFetcher;
 import org.apache.pinot.core.operator.transform.TransformOperator;
 import org.apache.pinot.core.operator.transform.TransformResultMetadata;
 import org.apache.pinot.core.query.selection.SelectionOperatorUtils;
-import org.apache.pinot.core.segment.index.readers.Dictionary;
 
 
 public class SelectionOrderByOperator extends BaseOperator<IntermediateResultsBlock> {
@@ -48,8 +47,6 @@ public class SelectionOrderByOperator extends BaseOperator<IntermediateResultsBl
   private final List<SelectionSort> _sortSequence;
   private final List<TransformExpressionTree> _expressions;
   private final TransformResultMetadata[] _expressionMetadata;
-  private final Dictionary[] _dictionaries;
-  private final BlockValSet[] _blockValSets;
   private final DataSchema _dataSchema;
   private final int _numRowsToKeep;
   private final PriorityQueue<Serializable[]> _rows;
@@ -65,17 +62,12 @@ public class SelectionOrderByOperator extends BaseOperator<IntermediateResultsBl
 
     int numExpressions = _expressions.size();
     _expressionMetadata = new TransformResultMetadata[numExpressions];
-    _dictionaries = new Dictionary[numExpressions];
-    _blockValSets = new BlockValSet[numExpressions];
     String[] columnNames = new String[numExpressions];
     DataSchema.ColumnDataType[] columnDataTypes = new DataSchema.ColumnDataType[numExpressions];
     for (int i = 0; i < numExpressions; i++) {
       TransformExpressionTree expression = _expressions.get(i);
       TransformResultMetadata expressionMetadata = _transformOperator.getResultMetadata(expression);
       _expressionMetadata[i] = expressionMetadata;
-      if (expressionMetadata.hasDictionary()) {
-        _dictionaries[i] = _transformOperator.getDictionary(expression);
-      }
       columnNames[i] = expression.toString();
       columnDataTypes[i] =
           DataSchema.ColumnDataType.fromDataType(expressionMetadata.getDataType(), expressionMetadata.isSingleValue());
@@ -142,17 +134,17 @@ public class SelectionOrderByOperator extends BaseOperator<IntermediateResultsBl
     TransformBlock transformBlock;
     while ((transformBlock = _transformOperator.nextBlock()) != null) {
       int numExpressions = _expressions.size();
+      BlockValSet[] blockValSets = new BlockValSet[numExpressions];
       for (int i = 0; i < numExpressions; i++) {
         TransformExpressionTree expression = _expressions.get(i);
-        _blockValSets[i] = transformBlock.getBlockValueSet(expression);
+        blockValSets[i] = transformBlock.getBlockValueSet(expression);
       }
-      TransformBlockDataFetcher dataFetcher =
-          new TransformBlockDataFetcher(_blockValSets, _dictionaries, _expressionMetadata);
+      RowBasedBlockValueFetcher blockValueFetcher = new RowBasedBlockValueFetcher(blockValSets);
 
       int numDocsFetched = transformBlock.getNumDocs();
       numDocsScanned += numDocsFetched;
       for (int i = 0; i < numDocsFetched; i++) {
-        SelectionOperatorUtils.addToPriorityQueue(dataFetcher.getRow(i), _rows, _numRowsToKeep);
+        SelectionOperatorUtils.addToPriorityQueue(blockValueFetcher.getRow(i), _rows, _numRowsToKeep);
       }
     }
 
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/TransformBlockDataFetcher.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/TransformBlockDataFetcher.java
deleted file mode 100644
index 08d0bbf..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/TransformBlockDataFetcher.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.operator.transform;
-
-import java.io.Serializable;
-import org.apache.pinot.common.data.FieldSpec.DataType;
-import org.apache.pinot.core.common.BlockValSet;
-import org.apache.pinot.core.segment.index.readers.Dictionary;
-
-
-public class TransformBlockDataFetcher {
-
-  private final Fetcher[] _fetchers;
-
-  public TransformBlockDataFetcher(BlockValSet[] blockValSets, Dictionary[] dictionaries,
-      TransformResultMetadata[] expressionResultMetadata) {
-    _fetchers = new Fetcher[blockValSets.length];
-    for (int i = 0; i < blockValSets.length; i++) {
-      if (dictionaries.length == 0 && expressionResultMetadata.length == 0) {
-        _fetchers[i] = createSVNoDictionaryFetcher(blockValSets[i]);
-      } else {
-        _fetchers[i] = createFetcher(blockValSets[i], dictionaries[i], expressionResultMetadata[i]);
-      }
-    }
-  }
-
-  public Serializable[] getRow(int docId) {
-    Serializable[] row = new Serializable[_fetchers.length];
-    for (int i = 0; i < _fetchers.length; i++) {
-      row[i] = _fetchers[i].getValue(docId);
-    }
-    return row;
-  }
-
-  /**
-   * Create SV non-dictionary based fetcher
-   * @param blockValSet column value set
-   * @return fetcher
-   */
-  private Fetcher createSVNoDictionaryFetcher(BlockValSet blockValSet) {
-    switch (blockValSet.getValueType()) {
-      case INT:
-        return new SVIntValueFetcher(blockValSet.getIntValuesSV());
-      case LONG:
-        return new SVLongValueFetcher(blockValSet.getLongValuesSV());
-      case FLOAT:
-        return new SVFloatValueFetcher(blockValSet.getFloatValuesSV());
-      case DOUBLE:
-        return new SVDoubleValueFetcher(blockValSet.getDoubleValuesSV());
-      case BOOLEAN:
-      case STRING:
-        return new SVStringValueFetcher(blockValSet.getStringValuesSV());
-      case BYTES:
-        return new SVBytesValueFetcher(blockValSet.getBytesValuesSV());
-    }
-
-    throw new UnsupportedOperationException();
-  }
-
-  private Fetcher createFetcher(BlockValSet blockValSet, Dictionary dictionary,
-      TransformResultMetadata expressionResultMetadata) {
-    if (expressionResultMetadata.hasDictionary()) {
-      if (expressionResultMetadata.isSingleValue()) {
-        return new DictionaryBasedSVValueFetcher(dictionary, blockValSet.getDictionaryIdsSV(),
-            expressionResultMetadata.getDataType());
-      } else {
-        switch (expressionResultMetadata.getDataType()) {
-          case INT:
-            return new DictionaryBasedMVIntValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-          case LONG:
-            return new DictionaryBasedMVLongValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-          case FLOAT:
-            return new DictionaryBasedMVFloatValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-          case DOUBLE:
-            return new DictionaryBasedMVDoubleValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-          case BOOLEAN:
-          case STRING:
-            return new DictionaryBasedMVStringValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-          case BYTES:
-            return new DictionaryBasedMVBytesValueFetcher(dictionary, blockValSet.getDictionaryIdsMV());
-        }
-      }
-    } else {
-      switch (expressionResultMetadata.getDataType()) {
-        case INT:
-          return new SVIntValueFetcher(blockValSet.getIntValuesSV());
-        case LONG:
-          return new SVLongValueFetcher(blockValSet.getLongValuesSV());
-        case FLOAT:
-          return new SVFloatValueFetcher(blockValSet.getFloatValuesSV());
-        case DOUBLE:
-          return new SVDoubleValueFetcher(blockValSet.getDoubleValuesSV());
-        case BOOLEAN:
-        case STRING:
-          return new SVStringValueFetcher(blockValSet.getStringValuesSV());
-        case BYTES:
-          return new SVBytesValueFetcher(blockValSet.getBytesValuesSV());
-      }
-    }
-    throw new UnsupportedOperationException();
-  }
-}
-
-interface Fetcher {
-
-  Serializable getValue(int docId);
-}
-
-class SVIntValueFetcher implements Fetcher {
-
-  private int[] _values;
-
-  SVIntValueFetcher(int[] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class SVLongValueFetcher implements Fetcher {
-
-  private long[] _values;
-
-  SVLongValueFetcher(long[] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class SVFloatValueFetcher implements Fetcher {
-
-  private float[] _values;
-
-  SVFloatValueFetcher(float[] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class SVDoubleValueFetcher implements Fetcher {
-
-  private double[] _values;
-
-  SVDoubleValueFetcher(double[] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class SVStringValueFetcher implements Fetcher {
-
-  private String[] _values;
-
-  SVStringValueFetcher(String[] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class SVBytesValueFetcher implements Fetcher {
-
-  private byte[][] _values;
-
-  SVBytesValueFetcher(byte[][] values) {
-    _values = values;
-  }
-
-  public Serializable getValue(int docId) {
-    return _values[docId];
-  }
-}
-
-class DictionaryBasedSVValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[] _dictionaryIds;
-  private DataType _dataType;
-
-  DictionaryBasedSVValueFetcher(Dictionary dictionary, int[] dictionaryIds, DataType dataType) {
-
-    _dictionary = dictionary;
-    _dictionaryIds = dictionaryIds;
-    _dataType = dataType;
-  }
-
-  public Serializable getValue(int docId) {
-    return (Serializable) _dictionary.get(_dictionaryIds[docId]);
-  }
-}
-
-class DictionaryBasedMVIntValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVIntValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    int[] values = new int[dictIds.length];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getIntValue(dictId);
-    }
-    return values;
-  }
-}
-
-class DictionaryBasedMVLongValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVLongValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    long[] values = new long[dictIds.length];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getLongValue(dictId);
-    }
-    return values;
-  }
-}
-
-class DictionaryBasedMVFloatValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVFloatValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    float[] values = new float[dictIds.length];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getFloatValue(dictId);
-    }
-    return values;
-  }
-}
-
-class DictionaryBasedMVDoubleValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVDoubleValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    double[] values = new double[dictIds.length];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getDoubleValue(dictId);
-    }
-    return values;
-  }
-}
-
-class DictionaryBasedMVStringValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVStringValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    String[] values = new String[dictIds.length];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getStringValue(dictId);
-    }
-    return values;
-  }
-}
-
-class DictionaryBasedMVBytesValueFetcher implements Fetcher {
-
-  private Dictionary _dictionary;
-  private int[][] _dictionaryIdsArray;
-
-  DictionaryBasedMVBytesValueFetcher(Dictionary dictionary, int[][] dictionaryIdsArray) {
-
-    _dictionary = dictionary;
-    _dictionaryIdsArray = dictionaryIdsArray;
-  }
-
-  public Serializable getValue(int docId) {
-    int[] dictIds = _dictionaryIdsArray[docId];
-    byte[][] values = new byte[dictIds.length][];
-    for (int i = 0; i < dictIds.length; i++) {
-      int dictId = dictIds[i];
-      values[i] = _dictionary.getBytesValue(dictId);
-    }
-    return values;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctAggregationFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctAggregationFunction.java
index cf68e1d..8f1a868 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctAggregationFunction.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctAggregationFunction.java
@@ -24,14 +24,12 @@ import org.apache.pinot.common.data.FieldSpec;
 import org.apache.pinot.common.function.AggregationFunctionType;
 import org.apache.pinot.common.utils.DataSchema.ColumnDataType;
 import org.apache.pinot.core.common.BlockValSet;
+import org.apache.pinot.core.common.RowBasedBlockValueFetcher;
 import org.apache.pinot.core.data.table.Key;
-import org.apache.pinot.core.operator.transform.TransformBlockDataFetcher;
-import org.apache.pinot.core.operator.transform.TransformResultMetadata;
 import org.apache.pinot.core.query.aggregation.AggregationResultHolder;
 import org.apache.pinot.core.query.aggregation.DistinctTable;
 import org.apache.pinot.core.query.aggregation.ObjectAggregationResultHolder;
 import org.apache.pinot.core.query.aggregation.groupby.GroupByResultHolder;
-import org.apache.pinot.core.segment.index.readers.Dictionary;
 import org.apache.pinot.pql.parsers.pql2.ast.FunctionCallAstNode;
 
 
@@ -89,8 +87,7 @@ public class DistinctAggregationFunction implements AggregationFunction<Distinct
 
     // TODO: Follow up PR will make few changes to start using DictionaryBasedAggregationOperator
     // for DISTINCT queries without filter.
-    TransformBlockDataFetcher transformBlockDataFetcher =
-        new TransformBlockDataFetcher(blockValSets, new Dictionary[0], new TransformResultMetadata[0]);
+    RowBasedBlockValueFetcher blockValueFetcher = new RowBasedBlockValueFetcher(blockValSets);
 
     int rowIndex = 0;
     // TODO: Do early termination in the operator itself which should
@@ -99,7 +96,7 @@ public class DistinctAggregationFunction implements AggregationFunction<Distinct
     // has to communicate back that required number of records have
     // been collected
     while (rowIndex < length && _distinctTable.size() < _limit) {
-      Object[] columnData = transformBlockDataFetcher.getRow(rowIndex);
+      Object[] columnData = blockValueFetcher.getRow(rowIndex);
       _distinctTable.addKey(new Key(columnData));
       rowIndex++;
     }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionFetcher.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionFetcher.java
deleted file mode 100644
index 94cde48..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionFetcher.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection;
-
-import java.io.Serializable;
-import org.apache.pinot.common.utils.DataSchema;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.query.selection.iterator.BytesSelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.DoubleArraySelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.DoubleSelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.FloatArraySelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.FloatSelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.IntArraySelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.IntSelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.LongArraySelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.LongSelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.SelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.SelectionSingleValueColumnWithDictIterator;
-import org.apache.pinot.core.query.selection.iterator.StringArraySelectionColumnIterator;
-import org.apache.pinot.core.query.selection.iterator.StringSelectionColumnIterator;
-
-
-/**
- * Selection fetcher is used for querying rows from given blocks and schema.
- * SelectionFetcher will initialize iterators on each data column and provide
- * the ability to return a Serializable array as a row for a given docId.
- *
- */
-public class SelectionFetcher {
-  private final int _numColumns;
-  private final SelectionColumnIterator[] _selectionColumnIterators;
-
-  public SelectionFetcher(Block[] blocks, DataSchema dataSchema) {
-    _numColumns = blocks.length;
-    _selectionColumnIterators = new SelectionColumnIterator[_numColumns];
-
-    for (int i = 0; i < _numColumns; i++) {
-      Block block = blocks[i];
-      DataSchema.ColumnDataType columnDataType = dataSchema.getColumnDataType(i);
-      if (block.getMetadata().hasDictionary()) {
-        // With dictionary
-
-        switch (columnDataType) {
-          // Single value
-          case INT:
-          case LONG:
-          case FLOAT:
-          case DOUBLE:
-          case STRING:
-          case BYTES:
-            _selectionColumnIterators[i] = new SelectionSingleValueColumnWithDictIterator(block);
-            break;
-          // Multi value
-          case INT_ARRAY:
-            _selectionColumnIterators[i] = new IntArraySelectionColumnIterator(block);
-            break;
-          case FLOAT_ARRAY:
-            _selectionColumnIterators[i] = new FloatArraySelectionColumnIterator(block);
-            break;
-          case LONG_ARRAY:
-            _selectionColumnIterators[i] = new LongArraySelectionColumnIterator(block);
-            break;
-          case DOUBLE_ARRAY:
-            _selectionColumnIterators[i] = new DoubleArraySelectionColumnIterator(block);
-            break;
-          case STRING_ARRAY:
-            _selectionColumnIterators[i] = new StringArraySelectionColumnIterator(block);
-            break;
-          default:
-            throw new UnsupportedOperationException();
-        }
-      } else {
-        // No dictionary
-
-        switch (columnDataType) {
-          case INT:
-            _selectionColumnIterators[i] = new IntSelectionColumnIterator(block);
-            break;
-          case LONG:
-            _selectionColumnIterators[i] = new LongSelectionColumnIterator(block);
-            break;
-          case FLOAT:
-            _selectionColumnIterators[i] = new FloatSelectionColumnIterator(block);
-            break;
-          case DOUBLE:
-            _selectionColumnIterators[i] = new DoubleSelectionColumnIterator(block);
-            break;
-          case STRING:
-            _selectionColumnIterators[i] = new StringSelectionColumnIterator(block);
-            break;
-          case BYTES:
-            _selectionColumnIterators[i] = new BytesSelectionColumnIterator(block);
-            break;
-          // TODO: add multi value support
-          default:
-            throw new UnsupportedOperationException();
-        }
-      }
-    }
-  }
-
-  public Serializable[] getRow(int docId) {
-    final Serializable[] row = new Serializable[_numColumns];
-    for (int i = 0; i < _numColumns; i++) {
-      row[i] = _selectionColumnIterators[i].getValue(docId);
-    }
-    return row;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/CompositeDocIdValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/CompositeDocIdValComparator.java
deleted file mode 100644
index e463c7f..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/CompositeDocIdValComparator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import org.apache.pinot.common.request.SelectionSort;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Comparator to order the doc id based on sort sequence across multiple blocks
- */
-public final class CompositeDocIdValComparator implements Comparator<Integer> {
-  private final List<SelectionSort> sortSequence;
-  private final Block[] blocks;
-  IDocIdValComparator[] docIdValComparators;
-  boolean[] eligibleToCompare;
-
-  public CompositeDocIdValComparator(List<SelectionSort> sortSequence, Block[] blocks) {
-    this.sortSequence = sortSequence;
-    this.blocks = blocks;
-    docIdValComparators = new IDocIdValComparator[blocks.length];
-    eligibleToCompare = new boolean[blocks.length];
-    Arrays.fill(eligibleToCompare, true);
-    for (int i = 0; i < sortSequence.size(); ++i) {
-      if (!blocks[i].getMetadata().isSingleValue()) {
-        eligibleToCompare[i] = false;
-        continue;
-      }
-
-      if (blocks[i].getMetadata().hasDictionary()) {
-        docIdValComparators[i] = new DocIdIntValComparator(blocks[i], sortSequence.get(i).isIsAsc());
-      } else {
-        switch (blocks[i].getMetadata().getDataType()) {
-          case INT:
-            docIdValComparators[i] = new DocIdIntValComparator(blocks[i], sortSequence.get(i).isIsAsc());
-            break;
-          case LONG:
-            docIdValComparators[i] = new DocIdLongValComparator(blocks[i], sortSequence.get(i).isIsAsc());
-            break;
-          case FLOAT:
-            docIdValComparators[i] = new DocIdFloatValComparator(blocks[i], sortSequence.get(i).isIsAsc());
-            break;
-          case DOUBLE:
-            docIdValComparators[i] = new DocIdDoubleValComparator(blocks[i], sortSequence.get(i).isIsAsc());
-            break;
-          default:
-            eligibleToCompare[i] = false;
-        }
-      }
-    }
-  }
-
-  @Override
-  public int compare(Integer docId1, Integer docId2) {
-    int ret = 0;
-    for (int i = 0; i < sortSequence.size(); ++i) {
-      if (eligibleToCompare[i]) {
-        ret = docIdValComparators[i].compare(docId1, docId2);
-        if (ret != 0) {
-          return ret;
-        }
-      }
-    }
-    return ret;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdDoubleValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdDoubleValComparator.java
deleted file mode 100644
index 1bf25c8..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdDoubleValComparator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-public class DocIdDoubleValComparator implements IDocIdValComparator {
-
-  int orderToggleMultiplier = 1;
-  private final BlockSingleValIterator blockValSetIterator;
-
-  public DocIdDoubleValComparator(Block block, boolean ascending) {
-    blockValSetIterator = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-    if (!ascending) {
-      orderToggleMultiplier = -1;
-    }
-  }
-
-  public int compare(int docId1, int docId2) {
-    blockValSetIterator.skipTo(docId1);
-    double val1 = blockValSetIterator.nextDoubleVal();
-    blockValSetIterator.skipTo(docId2);
-    double val2 = blockValSetIterator.nextDoubleVal();
-    return Double.compare(val1, val2) * orderToggleMultiplier;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdFloatValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdFloatValComparator.java
deleted file mode 100644
index 3b54545..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdFloatValComparator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-public class DocIdFloatValComparator implements IDocIdValComparator {
-
-  int orderToggleMultiplier = 1;
-  private final BlockSingleValIterator blockValSetIterator;
-
-  public DocIdFloatValComparator(Block block, boolean ascending) {
-    blockValSetIterator = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-    if (!ascending) {
-      orderToggleMultiplier = -1;
-    }
-  }
-
-  public int compare(int docId1, int docId2) {
-    blockValSetIterator.skipTo(docId1);
-    float val1 = blockValSetIterator.nextFloatVal();
-    blockValSetIterator.skipTo(docId2);
-    float val2 = blockValSetIterator.nextFloatVal();
-    return Float.compare(val1, val2) * orderToggleMultiplier;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdIntValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdIntValComparator.java
deleted file mode 100644
index e4880e3..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdIntValComparator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-public class DocIdIntValComparator implements IDocIdValComparator {
-
-  int orderToggleMultiplier = 1;
-  private final BlockSingleValIterator blockValSetIterator;
-
-  public DocIdIntValComparator(Block block, boolean ascending) {
-    blockValSetIterator = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-    if (ascending) {
-      orderToggleMultiplier = -1;
-    }
-  }
-
-  public int compare(int docId1, int docId2) {
-    blockValSetIterator.skipTo(docId1);
-    int val1 = blockValSetIterator.nextIntVal();
-    blockValSetIterator.skipTo(docId2);
-    int val2 = blockValSetIterator.nextIntVal();
-    return Integer.compare(val1, val2) * orderToggleMultiplier;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdLongValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdLongValComparator.java
deleted file mode 100644
index 5a7db74..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/DocIdLongValComparator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-public class DocIdLongValComparator implements IDocIdValComparator {
-
-  int orderToggleMultiplier = 1;
-  private final BlockSingleValIterator blockValSetIterator;
-
-  public DocIdLongValComparator(Block block, boolean ascending) {
-    blockValSetIterator = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-    if (!ascending) {
-      orderToggleMultiplier = -1;
-    }
-  }
-
-  public int compare(int docId1, int docId2) {
-    blockValSetIterator.skipTo(docId1);
-    long val1 = blockValSetIterator.nextLongVal();
-    blockValSetIterator.skipTo(docId2);
-    long val2 = blockValSetIterator.nextLongVal();
-    return Long.compare(val1, val2) * orderToggleMultiplier;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/IDocIdValComparator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/IDocIdValComparator.java
deleted file mode 100644
index ea059ea..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/comparator/IDocIdValComparator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.comparator;
-
-public interface IDocIdValComparator {
-
-  int compare(int docId1, int docId2);
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/BytesSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/BytesSelectionColumnIterator.java
deleted file mode 100644
index 3666bdc..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/BytesSelectionColumnIterator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import com.clearspring.analytics.util.Preconditions;
-import java.io.Serializable;
-import org.apache.pinot.common.data.FieldSpec;
-import org.apache.pinot.common.utils.BytesUtils;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-/**
- * Iterator on bytes no dictionary column selection query.
- *
- */
-public class BytesSelectionColumnIterator implements SelectionColumnIterator {
-  private final FieldSpec.DataType _dataType;
-  protected BlockSingleValIterator bvIter;
-
-  public BytesSelectionColumnIterator(Block block) {
-    _dataType = block.getMetadata().getDataType();
-    Preconditions
-        .checkArgument(_dataType.equals(FieldSpec.DataType.BYTES),
-            "Illegal data type for BytesSelectionColumnIterator: " + _dataType);
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextBytesVal();
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleArraySelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleArraySelectionColumnIterator.java
deleted file mode 100644
index fdefb11..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleArraySelectionColumnIterator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Iterator on double array column selection query.
- *
- */
-public class DoubleArraySelectionColumnIterator extends SelectionMultiValueColumnIterator {
-
-  public DoubleArraySelectionColumnIterator(Block block) {
-    super(block);
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    int dictSize = bvIter.nextIntVal(dictIds);
-    double[] rawIntRow = new double[dictSize];
-    for (int dictIdx = 0; dictIdx < dictSize; ++dictIdx) {
-      rawIntRow[dictIdx] = (Double) (dict.get(dictIds[dictIdx]));
-    }
-    return rawIntRow;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleSelectionColumnIterator.java
deleted file mode 100644
index 001e7d5..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/DoubleSelectionColumnIterator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-/**
- * Iterator on double no dictionary column selection query.
- *
- */
-public class DoubleSelectionColumnIterator implements SelectionColumnIterator {
-  protected BlockSingleValIterator bvIter;
-
-  public DoubleSelectionColumnIterator(Block block) {
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextDoubleVal();
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatArraySelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatArraySelectionColumnIterator.java
deleted file mode 100644
index 6c83259..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatArraySelectionColumnIterator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Iterator on float array column selection query.
- *
- */
-public class FloatArraySelectionColumnIterator extends SelectionMultiValueColumnIterator {
-
-  public FloatArraySelectionColumnIterator(Block block) {
-    super(block);
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    int dictSize = bvIter.nextIntVal(dictIds);
-    float[] rawIntRow = new float[dictSize];
-    for (int dictIdx = 0; dictIdx < dictSize; ++dictIdx) {
-      rawIntRow[dictIdx] = (Float) (dict.get(dictIds[dictIdx]));
-    }
-    return rawIntRow;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatSelectionColumnIterator.java
deleted file mode 100644
index bf4934b..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/FloatSelectionColumnIterator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-/**
- * Iterator on float no dictionary column selection query.
- *
- */
-public class FloatSelectionColumnIterator implements SelectionColumnIterator {
-  protected BlockSingleValIterator bvIter;
-
-  public FloatSelectionColumnIterator(Block block) {
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextFloatVal();
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntArraySelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntArraySelectionColumnIterator.java
deleted file mode 100644
index 1151599..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntArraySelectionColumnIterator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Iterator on int array column selection query.
- *
- */
-public class IntArraySelectionColumnIterator extends SelectionMultiValueColumnIterator {
-
-  public IntArraySelectionColumnIterator(Block block) {
-    super(block);
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    int dictSize = bvIter.nextIntVal(dictIds);
-    int[] rawIntRow = new int[dictSize];
-    for (int dictIdx = 0; dictIdx < dictSize; ++dictIdx) {
-      rawIntRow[dictIdx] = (Integer) (dict.get(dictIds[dictIdx]));
-    }
-    return rawIntRow;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntSelectionColumnIterator.java
deleted file mode 100644
index abf15c4..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/IntSelectionColumnIterator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-/**
- * Iterator on int no dictionary column selection query.
- *
- */
-public class IntSelectionColumnIterator implements SelectionColumnIterator {
-  protected BlockSingleValIterator bvIter;
-
-  public IntSelectionColumnIterator(Block block) {
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextIntVal();
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongArraySelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongArraySelectionColumnIterator.java
deleted file mode 100644
index 10c616f..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongArraySelectionColumnIterator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Iterator on long array column selection query.
- *
- */
-public class LongArraySelectionColumnIterator extends SelectionMultiValueColumnIterator {
-
-  public LongArraySelectionColumnIterator(Block block) {
-    super(block);
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    int dictSize = bvIter.nextIntVal(dictIds);
-    long[] rawIntRow = new long[dictSize];
-    for (int dictIdx = 0; dictIdx < dictSize; ++dictIdx) {
-      rawIntRow[dictIdx] = (Long) (dict.get(dictIds[dictIdx]));
-    }
-    return rawIntRow;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongSelectionColumnIterator.java
deleted file mode 100644
index f77e243..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/LongSelectionColumnIterator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-
-
-/**
- * Iterator on long no dictionary column selection query.
- *
- */
-public class LongSelectionColumnIterator implements SelectionColumnIterator {
-  protected BlockSingleValIterator bvIter;
-
-  public LongSelectionColumnIterator(Block block) {
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextLongVal();
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionColumnIterator.java
deleted file mode 100644
index 3aab108..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionColumnIterator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-
-
-/**
- * Column iterator interface for selection query on a column.
- *
- */
-public interface SelectionColumnIterator {
-
-  Serializable getValue(int docId);
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionMultiValueColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionMultiValueColumnIterator.java
deleted file mode 100644
index f4fd22f..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionMultiValueColumnIterator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockMultiValIterator;
-import org.apache.pinot.core.segment.index.readers.Dictionary;
-
-
-/**
- * Iterator on multi-value column selection query.
- *
- */
-public abstract class SelectionMultiValueColumnIterator implements SelectionColumnIterator {
-  protected BlockMultiValIterator bvIter;
-  protected Dictionary dict;
-  protected int[] dictIds;
-
-  public SelectionMultiValueColumnIterator(Block block) {
-    bvIter = (BlockMultiValIterator) block.getBlockValueSet().iterator();
-    dict = block.getMetadata().getDictionary();
-    dictIds = new int[block.getMetadata().getMaxNumberOfMultiValues()];
-  }
-
-  @Override
-  public abstract Serializable getValue(int docId);
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionSingleValueColumnWithDictIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionSingleValueColumnWithDictIterator.java
deleted file mode 100644
index 3139cfa..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/SelectionSingleValueColumnWithDictIterator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.common.data.FieldSpec;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-import org.apache.pinot.core.segment.index.readers.Dictionary;
-import org.apache.pinot.common.utils.BytesUtils;
-
-
-/**
- * Iterator on single-value column with dictionary for selection query.
- *
- */
-public class SelectionSingleValueColumnWithDictIterator implements SelectionColumnIterator {
-  protected BlockSingleValIterator _blockSingleValIterator;
-  protected Dictionary _dictionary;
-  private final FieldSpec.DataType _dataType;
-
-  public SelectionSingleValueColumnWithDictIterator(Block block) {
-    _blockSingleValIterator = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-    _dataType = block.getMetadata().getDataType();
-    _dictionary = block.getMetadata().getDictionary();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    _blockSingleValIterator.skipTo(docId);
-    return (Serializable) _dictionary.get(_blockSingleValIterator.nextIntVal());
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringArraySelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringArraySelectionColumnIterator.java
deleted file mode 100644
index 00ee405..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringArraySelectionColumnIterator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import java.io.Serializable;
-import org.apache.pinot.core.common.Block;
-
-
-/**
- * Iterator on string array column selection query.
- *
- */
-public class StringArraySelectionColumnIterator extends SelectionMultiValueColumnIterator {
-
-  public StringArraySelectionColumnIterator(Block block) {
-    super(block);
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    int dictSize = bvIter.nextIntVal(dictIds);
-    String[] rawIntRow = new String[dictSize];
-    for (int dictIdx = 0; dictIdx < dictSize; ++dictIdx) {
-      rawIntRow[dictIdx] = (String) (dict.get(dictIds[dictIdx]));
-    }
-    return rawIntRow;
-  }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringSelectionColumnIterator.java b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringSelectionColumnIterator.java
deleted file mode 100644
index 3cde6a4..0000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/iterator/StringSelectionColumnIterator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.query.selection.iterator;
-
-import com.clearspring.analytics.util.Preconditions;
-import java.io.Serializable;
-import org.apache.pinot.common.data.FieldSpec;
-import org.apache.pinot.core.common.Block;
-import org.apache.pinot.core.common.BlockSingleValIterator;
-import org.apache.pinot.common.utils.BytesUtils;
-
-
-/**
- * Iterator on double no dictionary column selection query.
- *
- */
-public class StringSelectionColumnIterator implements SelectionColumnIterator {
-  private final FieldSpec.DataType _dataType;
-  protected BlockSingleValIterator bvIter;
-
-  public StringSelectionColumnIterator(Block block) {
-    _dataType = block.getMetadata().getDataType();
-    Preconditions
-        .checkArgument(_dataType.equals(FieldSpec.DataType.STRING),
-            "Illegal data type for StringSelectionColumnIterator: " + _dataType);
-    bvIter = (BlockSingleValIterator) block.getBlockValueSet().iterator();
-  }
-
-  @Override
-  public Serializable getValue(int docId) {
-    bvIter.skipTo(docId);
-    return bvIter.nextStringVal();
-  }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org