This is an automated email from the ASF dual-hosted git repository.
yashmayya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 7ef566ab538 Remove 13 unreferenced dead classes from core,
segment-local and query-planner (#19124)
7ef566ab538 is described below
commit 7ef566ab538f3d442ae6fb5f542a3909af262437
Author: Yash Mayya <[email protected]>
AuthorDate: Thu Jul 30 11:40:36 2026 -0400
Remove 13 unreferenced dead classes from core, segment-local and
query-planner (#19124)
---
.../data/manager/offline/LookupRecordLocation.java | 50 ----
.../core/data/manager/realtime/TimerService.java | 29 ---
.../core/operator/blocks/EmptyFilterBlock.java | 37 ---
.../pinot/core/util/BaseIndexedPriorityQueue.java | 104 --------
.../core/util/IntDoubleIndexedPriorityQueue.java | 283 ---------------------
.../core/util/IntObjectIndexedPriorityQueue.java | 283 ---------------------
.../java/org/apache/pinot/core/util/SizeUtil.java | 36 ---
.../util/IntDoubleIndexedPriorityQueueTest.java | 107 --------
.../util/IntObjectIndexedPriorityQueueTest.java | 118 ---------
.../logical/ParentToChildrenStageCalculator.java | 56 ----
.../local/segment/index/column/NumValuesInfo.java | 41 ---
.../index/readers/ValidDocIndexReaderImpl.java | 37 ---
.../index/readers/vector/HnswDocIdCollector.java | 88 -------
13 files changed, 1269 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/LookupRecordLocation.java
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/LookupRecordLocation.java
deleted file mode 100644
index 32f25ed9692..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/LookupRecordLocation.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.data.manager.offline;
-
-import org.apache.pinot.segment.local.segment.readers.PinotSegmentRecordReader;
-import org.apache.pinot.spi.data.readers.GenericRow;
-
-
-public class LookupRecordLocation {
- private final PinotSegmentRecordReader _pinotSegmentRecordReader;
- private final int _docId;
-
- public LookupRecordLocation(PinotSegmentRecordReader
pinotSegmentRecordReader, int docId) {
- _pinotSegmentRecordReader = pinotSegmentRecordReader;
- _docId = docId;
- }
-
- public PinotSegmentRecordReader getPinotSegmentRecordReader() {
- return _pinotSegmentRecordReader;
- }
-
- public int getDocId() {
- return _docId;
- }
-
- public GenericRow getRecord(GenericRow reuse) {
- _pinotSegmentRecordReader.getRecord(_docId, reuse);
- return reuse;
- }
-
- public Object getValue(String column) {
- return _pinotSegmentRecordReader.getValue(_docId, column);
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/TimerService.java
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/TimerService.java
deleted file mode 100644
index 0922872a0af..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/TimerService.java
+++ /dev/null
@@ -1,29 +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.data.manager.realtime;
-
-import java.util.Timer;
-
-
-public class TimerService {
- private TimerService() {
- }
-
- public static final Timer TIMER = new
Timer("RealtimeIndexingSegmentDataManager", true);
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/EmptyFilterBlock.java
b/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/EmptyFilterBlock.java
deleted file mode 100644
index 06139eff4ed..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/EmptyFilterBlock.java
+++ /dev/null
@@ -1,37 +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.blocks;
-
-import org.apache.pinot.core.operator.docidsets.EmptyDocIdSet;
-
-
-/**
- * Singleton class which extends {@link FilterBlock} that is empty, i.e. does
not contain any document.
- */
-public final class EmptyFilterBlock extends FilterBlock {
- private EmptyFilterBlock() {
- super(EmptyDocIdSet.getInstance());
- }
-
- private static final EmptyFilterBlock INSTANCE = new EmptyFilterBlock();
-
- public static EmptyFilterBlock getInstance() {
- return INSTANCE;
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/util/BaseIndexedPriorityQueue.java
b/pinot-core/src/main/java/org/apache/pinot/core/util/BaseIndexedPriorityQueue.java
deleted file mode 100644
index 517370fc9b8..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/util/BaseIndexedPriorityQueue.java
+++ /dev/null
@@ -1,104 +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.util;
-
-import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
-
-
-/**
- * Abstract base class for IndexedPriorityQueue's.
- *
- */
-public abstract class BaseIndexedPriorityQueue {
-
- protected boolean _minHeap;
- protected Int2IntOpenHashMap _keyToIndexMap;
- protected Int2IntOpenHashMap _indexToKeyMap;
-
- /**
- * Constructor for the class.
- *
- * @param initialCapacity Initial capacity for the priority queue
- * @param minHeap Min order, ie smallest element on top.
- */
- public BaseIndexedPriorityQueue(int initialCapacity, boolean minHeap) {
- _minHeap = minHeap;
- _keyToIndexMap = new Int2IntOpenHashMap(initialCapacity);
- _indexToKeyMap = new Int2IntOpenHashMap(initialCapacity);
- }
-
- /**
- * Helper method to update key/index mappings.
- *
- * @param key Key for position
- * @param position Position for key
- */
- protected void updateKeyIndexMap(int key, int position) {
- _keyToIndexMap.put(key, position);
- _indexToKeyMap.put(position, key);
- }
-
- /**
- * Helper method to swap keys for the specified indices.
- * @param index1 First index
- * @param index2 Second index
- */
- protected void swapKeys(int index1, int index2) {
- int key1 = _indexToKeyMap.get(index1);
- int key2 = _indexToKeyMap.get(index2);
-
- updateKeyIndexMap(key1, index2);
- updateKeyIndexMap(key2, index1);
- }
-
- /**
- * Returns index of left child of the specified index.
- * Does not check for actual existence of the child in the
- * priority queue.
- *
- * @param index Index for which to find the left child.
- * @return Index of the left.
- */
- protected int getLeftChildIndex(int index) {
- return ((2 * (index + 1)) - 1);
- }
-
- /**
- * Returns index of right child of the specified index.
- * Does not check for actual existence of the child in the
- * priority queue.
- *
- * @param index Index for which to find the right child.
- * @return Index of the right.
- */
- protected int getRightChildIndex(int index) {
- return (2 * (index + 1));
- }
-
- /**
- * Returns the index of parent for the specified node.
- * Returns -1 for root.
- *
- * @param index Index of node for which to identify the parent.
- * @return Index of parent.
- */
- protected int getParentIndex(int index) {
- return (((index + 1) / 2) - 1);
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueue.java
b/pinot-core/src/main/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueue.java
deleted file mode 100644
index 638b0a57c36..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueue.java
+++ /dev/null
@@ -1,283 +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.util;
-
-import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
-import javax.annotation.concurrent.NotThreadSafe;
-import org.apache.pinot.spi.utils.Pairs.IntDoublePair;
-
-
-/**
- * Heap based Indexed priority queue with primitive 'int' key and 'double'
value.
- *
- * Allows for the following:
- * <ul>
- * <li> O(1) access to values inserted using their corresponding keys. </li>
- * <li> Dynamic update of values (heap order is maintained after updates).
</li>
- * <li> Min or max ordering, can be specified in the constructor. </li>
- * </ul>
- */
-@NotThreadSafe
-@SuppressWarnings("Duplicates")
-public class IntDoubleIndexedPriorityQueue extends BaseIndexedPriorityQueue {
- DoubleArrayList _values;
- IntDoublePair _reusablePair;
-
- /**
- * Constructor for the class.
- *
- * @param initialCapacity Initial capacity for the priority queue
- * @param minHeap Min order, ie smallest element on top.
- */
- public IntDoubleIndexedPriorityQueue(int initialCapacity, boolean minHeap) {
- super(initialCapacity, minHeap);
- _values = new DoubleArrayList(initialCapacity);
- _reusablePair = new IntDoublePair(0, 0.0);
- }
-
- /**
- * Puts the element into the priority queue.
- * <ul>
- * <li> If key does not exist, it is added to the priority queue. </li>
- * <li> If key exists, then the value is updated, and the priority queue
ordering is maintained. </li>
- * <li> Runtime complexity of {@code O(log(n)}). </li>
- * </ul>
- * @param key Integer key for the value
- * @param value Double value of the key
- */
- public void put(int key, double value) {
- if (!_keyToIndexMap.containsKey(key)) {
- _values.add(value);
-
- int last = _values.size() - 1;
- updateKeyIndexMap(key, last);
- siftUp(last);
- } else {
- int index = _keyToIndexMap.get(key);
- _values.set(index, value);
-
- // Sift the value up or down, as the case may be.
- if (!siftDown(index)) {
- siftUp(index);
- }
- }
- }
-
- /**
- * Returns the value for the specified key.
- * <ul>
- * <li> Returns null if the specified key does not exist. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @param key Key for which to return the value
- * @return Value for the key
- */
- public IntDoublePair get(int key) {
- if (!_keyToIndexMap.containsKey(key)) {
- return null;
- }
-
- int index = _keyToIndexMap.get(key);
- double value = _values.getDouble(index);
- _reusablePair.setIntValue(index);
- _reusablePair.setDoubleValue(value);
-
- return _reusablePair;
- }
-
- /**
- * Returns the key+value pair with the max priority (min for minHeap mode)
- * <ul>
- * <li> key+value pair is removed from the priority queue. </li>
- * <li> Returns null if the priority queue is empty. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @return Key+Value pair
- */
- public IntDoublePair poll() {
- if (isEmpty()) {
- return null;
- }
-
- IntDoublePair poll = peek();
- int lastIndex = _values.size() - 1;
- swapValues(0, lastIndex);
- _values.removeDouble(lastIndex);
-
- _keyToIndexMap.remove(_indexToKeyMap.get(lastIndex));
- _indexToKeyMap.remove(lastIndex);
-
- if (!_values.isEmpty()) {
- siftDown(0);
- }
-
- return poll;
- }
-
- /**
- * Returns the key+value pair with the max priority (min for minHeap mode)
- * <ul>
- * <li> key+value pair is not removed from the priority queue. </li>
- * <li> Throws runtime exception if the priority queue is empty. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @return Key+Value pair
- */
- public IntDoublePair peek() {
- if (_values.isEmpty()) {
- throw new RuntimeException("Empty collection");
- }
- _reusablePair.setIntValue(_indexToKeyMap.get(0));
- _reusablePair.setDoubleValue(_values.getDouble(0));
- return _reusablePair;
- }
-
- /**
- * Returns true if the priority queue is empty, false otherwise.
- *
- * @return True if empty, false otherwise
- */
- public boolean isEmpty() {
- return _values.isEmpty();
- }
-
- /**
- * Helper method that moves the element at the specified index up
- * until the heap ordering is established.
- *
- * @param index Index of element to sift up.
- */
- private void siftUp(int index) {
- // Return if already at root node.
- if (index == 0) {
- return;
- }
-
- while (index != 0) {
- int parentIndex = getParentIndex(index);
- double value = _values.getDouble(index);
- double parentValue = _values.getDouble(parentIndex);
-
- if (compare(parentValue, value) == 1) {
- swapValues(index, parentIndex);
- index = parentIndex;
- } else {
- // No more sifting up required, break
- break;
- }
- }
- }
-
- /**
- * Helper method that moves the element at the specified index down
- * until the heap ordering is established.
- *
- * @param index Index of element to sift down.
- * @return True if sifted, false otherwise.
- */
- private boolean siftDown(int index) {
- boolean hasChildren = hasChildren(index);
- if (!hasChildren) {
- return false;
- }
-
- boolean sifted = false;
- while (true) {
- int leftChildIndex = getLeftChildIndex(index);
- int rightChildIndex = getRightChildIndex(index);
-
- int minIndex;
- int size = _values.size();
- if (leftChildIndex >= size && rightChildIndex >= size) { // This is leaf
node, all done.
- break;
- } else if (rightChildIndex >= size) { // Node only has left child which
will be the minimum.
- minIndex = leftChildIndex;
- } else { // Node has both left and right children, find the minimum of
the two.
- double leftChildValue = _values.getDouble(leftChildIndex);
- double rightChildValue = _values.getDouble(rightChildIndex);
-
- if (compare(leftChildValue, rightChildValue) <= 0) {
- minIndex = leftChildIndex;
- } else {
- minIndex = rightChildIndex;
- }
- }
-
- // One of the children is out of order, need to sift down.
- if (compare(_values.getDouble(index), _values.getDouble(minIndex)) == 1)
{
- swapValues(index, minIndex);
- index = minIndex;
- sifted = true;
- } else {
- break;
- }
- }
- return sifted;
- }
-
- /**
- * Compares the two specified values, and returns:
- * <ul>
- * <li> if v1 < v2, -1 for max, +1 for min mode. </li>
- * <li> if v1 > v2, -1 for max, -1 for min mode. </li>
- * <li> if v1 = v2, 0 for max, 0 for min mode. </li>
- * </ul>
- * @param v1 Value to compare
- * @param v2 Value to compare
- * @return Result of comparison (as described above).
- */
- private int compare(double v1, double v2) {
- int ret = Double.compare(v1, v2);
- return (_minHeap) ? ret : -ret;
- }
-
- /**
- * Helper method that performs all operations required to swap two values.
- * <ul>
- * <li> Swaps the values in the array that backs the heap. </li>
- * <li> Updates the indexToKey and keyToIndex maps due to the swap. </li>
- * </ul>
- * @param index1 Index to swap
- * @param index2 Index to swap
- */
- private void swapValues(int index1, int index2) {
- if (index1 == index2) {
- return;
- }
-
- double tmp = _values.getDouble(index1);
- _values.set(index1, _values.getDouble(index2));
- _values.set(index2, tmp);
- swapKeys(index1, index2);
- }
-
- /**
- * Returns true if the node at specified index has children, false otherwise.
- * Just checking for existence of left child is sufficient (array backed
heap).
- *
- * @param index Index to check
- * @return True if node has children, false otherwise.
- */
- private boolean hasChildren(int index) {
- return (getLeftChildIndex(index) < _values.size());
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueue.java
b/pinot-core/src/main/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueue.java
deleted file mode 100644
index b94c7da9084..00000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueue.java
+++ /dev/null
@@ -1,283 +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.util;
-
-import it.unimi.dsi.fastutil.objects.ObjectArrayList;
-import java.util.Collections;
-import javax.annotation.concurrent.NotThreadSafe;
-import org.apache.pinot.spi.utils.Pairs.IntObjectPair;
-
-
-/**
- * Heap based Indexed priority queue with primitive 'int' key and 'T' value.
- *
- * Allows for the following:
- * <ul>
- * <li> O(1) access to values inserted using their corresponding keys. </li>
- * <li> Dynamic update of values (heap order is maintained after updates).
</li>
- * <li> Min or max ordering, can be specified in the constructor. </li>
- * </ul>
- */
-@NotThreadSafe
-@SuppressWarnings("Duplicates")
-public class IntObjectIndexedPriorityQueue<T extends Comparable> extends
BaseIndexedPriorityQueue {
- ObjectArrayList<T> _values;
- IntObjectPair<T> _reusablePair;
-
- /**
- * Constructor for the class.
- *
- * @param initialCapacity Initial capacity for the priority queue
- * @param minHeap Min order, ie smallest element on top.
- */
- public IntObjectIndexedPriorityQueue(int initialCapacity, boolean minHeap) {
- super(initialCapacity, minHeap);
- _values = new ObjectArrayList<>(initialCapacity);
- _reusablePair = new IntObjectPair<>(0, null);
- }
-
- /**
- * Puts the element into the priority queue.
- * <ul>
- * <li> If key does not exist, it is added to the priority queue. </li>
- * <li> If key exists, then the value is updated, and the priority queue
ordering is maintained. </li>
- * <li> Runtime complexity of {@code O(log(n)}). </li>
- * </ul>
- * @param key Integer key for the value
- * @param value Value of the key
- */
- @SuppressWarnings("unchecked")
- public void put(int key, T value) {
- if (!_keyToIndexMap.containsKey(key)) {
- _values.add(value);
-
- int last = _values.size() - 1;
- updateKeyIndexMap(key, last);
- siftUp(last);
- } else {
- int index = _keyToIndexMap.get(key);
- _values.set(index, value);
-
- // Sift the value up or down, as the case may be.
- if (!siftDown(index)) {
- siftUp(index);
- }
- }
- }
-
- /**
- * Returns the value for the specified key.
- * <ul>
- * <li> Returns null if the specified key does not exist. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @param key Key for which to return the value
- * @return Value for the key
- */
- public IntObjectPair get(int key) {
- if (!_keyToIndexMap.containsKey(key)) {
- return null;
- }
-
- int index = _keyToIndexMap.get(key);
- T value = _values.get(index);
- _reusablePair.setIntValue(index);
- _reusablePair.setObjectValue(value);
-
- return _reusablePair;
- }
-
- /**
- * Returns the key+value pair with the max priority (min for minHeap mode)
- * <ul>
- * <li> key+value pair is removed from the priority queue. </li>
- * <li> Throws runtime exception if the priority queue is empty. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @return Key+Value pair
- */
- public IntObjectPair<T> poll() {
- if (isEmpty()) {
- throw new RuntimeException("Empty collection, nothing to remove");
- } else {
- IntObjectPair<T> poll = peek();
- int lastIndex = _values.size() - 1;
- swapValues(0, lastIndex);
- _values.remove(lastIndex);
-
- _keyToIndexMap.remove(_indexToKeyMap.get(lastIndex));
- _indexToKeyMap.remove(lastIndex);
-
- if (!_values.isEmpty()) {
- siftDown(0);
- }
-
- return poll;
- }
- }
-
- /**
- * Returns the key+value pair with the max priority (min for minHeap mode)
- * <ul>
- * <li> key+value pair is not removed from the priority queue. </li>
- * <li> Returns null if the priority queue is empty. </li>
- * <li> Runtime complexity of O(1). </li>
- * </ul>
- *
- * @return Key+Value pair
- */
- public IntObjectPair<T> peek() {
- if (_values.isEmpty()) {
- return null;
- }
- _reusablePair.setIntValue(_indexToKeyMap.get(0));
- _reusablePair.setObjectValue(_values.get(0));
- return _reusablePair;
- }
-
- /**
- * Returns true if the priority queue is empty, false otherwise.
- *
- * @return True if empty, false otherwise
- */
- public boolean isEmpty() {
- return _values.isEmpty();
- }
-
- /**
- * Helper method that moves the element at the specified index up
- * until the heap ordering is established.
- *
- * @param index Index of element to sift up.
- */
- private void siftUp(int index) {
- // Return if already at root node.
- if (index == 0) {
- return;
- }
-
- while (index != 0) {
- int parentIndex = getParentIndex(index);
- T value = _values.get(index);
- T parentValue = _values.get(parentIndex);
-
- if (compare(parentValue, value) == 1) {
- swapValues(index, parentIndex);
- index = parentIndex;
- } else {
- // No more sifting up required, break
- break;
- }
- }
- }
-
- /**
- * Helper method that moves the element at the specified index down
- * until the heap ordering is established.
- *
- * @param index Index of element to sift down.
- * @return True if sifted, false otherwise.
- */
- private boolean siftDown(int index) {
- boolean hasChildren = hasChildren(index);
- if (!hasChildren) {
- return false;
- }
-
- boolean sifted = false;
- while (true) {
- int leftChildIndex = getLeftChildIndex(index);
- int rightChildIndex = getRightChildIndex(index);
-
- int minIndex;
- int size = _values.size();
- if (leftChildIndex >= size && rightChildIndex >= size) { // This is leaf
node, all done.
- break;
- } else if (rightChildIndex >= size) { // Node only has left child which
will be the minimum.
- minIndex = leftChildIndex;
- } else { // Node has both left and right children, find the minimum of
the two.
- T leftChildValue = _values.get(leftChildIndex);
- T rightChildValue = _values.get(rightChildIndex);
-
- if (compare(leftChildValue, rightChildValue) <= 0) {
- minIndex = leftChildIndex;
- } else {
- minIndex = rightChildIndex;
- }
- }
-
- // One of the children is out of order, need to sift
- if (compare(_values.get(index), _values.get(minIndex)) == 1) {
- swapValues(index, minIndex);
- index = minIndex;
- sifted = true;
- } else {
- break;
- }
- }
- return sifted;
- }
-
- /**
- * Compares the two specified values, and returns:
- * <ul>
- * <li> if v1 < v2, -1 for max, +1 for min mode. </li>
- * <li> if v1 > v2, -1 for max, -1 for min mode. </li>
- * <li> if v1 = v2, 0 for max, 0 for min mode. </li>
- * </ul>
- * @param o1 Value to compare
- * @param o2 Value to compare
- * @return Result of comparison (as described above).
- */
- @SuppressWarnings("unchecked")
- private int compare(T o1, T o2) {
- int ret = o1.compareTo(o2);
- return (_minHeap) ? ret : -ret;
- }
-
- /**
- * Helper method that performs all operations required to swap two values.
- * <ul>
- * <li> Swaps the values in the array that backs the heap. </li>
- * <li> Updates the indexToKey and keyToIndex maps due to the swap. </li>
- * </ul>
- * @param index1 Index to swap
- * @param index2 Index to swap
- */
- private void swapValues(int index1, int index2) {
- if (index1 == index2) {
- return;
- }
- Collections.swap(_values, index1, index2);
- swapKeys(index1, index2);
- }
-
- /**
- * Returns true if the node at specified index has children, false otherwise.
- * Just checking for existence of left child is sufficient (array backed
heap).
- *
- * @param index Index to check
- * @return True if node has children, false otherwise.
- */
- private boolean hasChildren(int index) {
- return (getLeftChildIndex(index) < _values.size());
- }
-}
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/util/SizeUtil.java
b/pinot-core/src/main/java/org/apache/pinot/core/util/SizeUtil.java
deleted file mode 100644
index 7970ef4c6ce..00000000000
--- a/pinot-core/src/main/java/org/apache/pinot/core/util/SizeUtil.java
+++ /dev/null
@@ -1,36 +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.util;
-
-/**
- * Util class to encapsulate all math required to compute storage space.
- */
-public class SizeUtil {
- private SizeUtil() {
- }
-
- public static final int BIT_UNPACK_BATCH_SIZE = 32;
-
- public static int computeBytesRequired(int numValues, int numBits, int
entriesPerBatch) {
- int bitsRequiredPerBatch = entriesPerBatch * numBits;
- //Align to batch boundary to avoid if checks while reading
- int totalBitsRounded = (int) (Math.ceil((numValues * numBits * 1.0) /
bitsRequiredPerBatch) * bitsRequiredPerBatch);
- return totalBitsRounded / 8;
- }
-}
diff --git
a/pinot-core/src/test/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueueTest.java
b/pinot-core/src/test/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueueTest.java
deleted file mode 100644
index 642f44464ba..00000000000
---
a/pinot-core/src/test/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueueTest.java
+++ /dev/null
@@ -1,107 +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.util;
-
-import it.unimi.dsi.fastutil.ints.Int2DoubleMap;
-import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import org.apache.pinot.spi.utils.Pairs;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-
-/**
- * Unit test for {@link IntDoubleIndexedPriorityQueue} class
- */
-public class IntDoubleIndexedPriorityQueueTest {
- private static final int NUM_RECORDS = 1000;
-
- /**
- * Test for max heap mode.
- */
- @Test
- public void testMax() {
- test(false /* minHeap */);
- }
-
- /**
- * Test for min heap mode.
- */
- @Test
- public void testMin() {
- test(true /* minHeap */);
- }
-
- /**
- * Helper method builds the priority queue, randomly updates elements and
- * then asserts the following:
- * <ul>
- * <li> Elements are popped from the priority queue in the expected order.
</li>
- * <li> Size of the priority queue is as expected (after elements are
updated). </li>
- * </ul>
- * @param minHeap Min or max mode
- */
- public void test(boolean minHeap) {
- Random random = new Random(0);
-
- IntDoubleIndexedPriorityQueue pq = new
IntDoubleIndexedPriorityQueue(NUM_RECORDS, minHeap);
- Int2DoubleOpenHashMap map = new Int2DoubleOpenHashMap(NUM_RECORDS);
-
- // Initialize the priority queue.
- for (int i = 0; i < NUM_RECORDS; i++) {
- double value = random.nextDouble();
- pq.put(i, value);
- map.put(i, value);
- }
-
- // Update some records randomly
- for (int i = 0; i < NUM_RECORDS; i++) {
- int key = random.nextInt(NUM_RECORDS);
- double value = random.nextDouble();
- pq.put(key, value);
- map.put(key, value);
- }
-
- // Transfer the map into list so it can be sorted.
- List<Pairs.IntDoublePair> list = new ArrayList<>(NUM_RECORDS);
- for (Int2DoubleMap.Entry entry : map.int2DoubleEntrySet()) {
- list.add(new Pairs.IntDoublePair(entry.getIntKey(),
entry.getDoubleValue()));
- }
-
- // Comparison for min heap is the same as that for ascending order.
- boolean descendingOrder = !minHeap;
- Collections.sort(list, new Pairs.IntDoubleComparator(descendingOrder));
-
- // Ensure that elements are popped from priority queue in the expected
order.
- int i = 0;
- while (!pq.isEmpty()) {
- Pairs.IntDoublePair actual = pq.poll();
- Pairs.IntDoublePair expected = list.get(i++);
-
- Assert.assertEquals(actual.getIntValue(), expected.getIntValue());
- Assert.assertEquals(actual.getDoubleValue(), expected.getDoubleValue());
- }
-
- // Assert that priority queue had expected number of elements.
- Assert.assertEquals(i, list.size());
- }
-}
diff --git
a/pinot-core/src/test/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueueTest.java
b/pinot-core/src/test/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueueTest.java
deleted file mode 100644
index aeb51ff7c10..00000000000
---
a/pinot-core/src/test/java/org/apache/pinot/core/util/IntObjectIndexedPriorityQueueTest.java
+++ /dev/null
@@ -1,118 +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.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import org.apache.pinot.segment.local.customobject.AvgPair;
-import org.apache.pinot.spi.utils.Pairs;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-
-/**
- * Unit test for {@link IntObjectIndexedPriorityQueue} class
- */
-public class IntObjectIndexedPriorityQueueTest {
- private static final int NUM_RECORDS = 1000;
- private static final int INT_VALUE_BOUND = 10000;
-
- /**
- * Test for max heap mode.
- */
- @Test
- public void testMax() {
- test(false /* minHeap */);
- }
-
- /**
- * Test for min heap mode.
- */
- @Test
- public void testMin() {
- test(true /* minHeap */);
- }
-
- /**
- * Helper method builds the priority queue, randomly updates elements and
- * then asserts the following:
- * <ul>
- * <li> Elements are popped from the priority queue in the expected order.
</li>
- * <li> Size of the priority queue is as expected (after elements are
updated). </li>
- * </ul>
- * @param minHeap Min mode
- */
- public void test(boolean minHeap) {
- Random random = new Random(0);
-
- IntObjectIndexedPriorityQueue<AvgPair> pq = new
IntObjectIndexedPriorityQueue<>(NUM_RECORDS, minHeap);
- Map<Integer, AvgPair> map = new HashMap<>(NUM_RECORDS);
-
- // Initialize the priority queue.
- for (int i = 0; i < NUM_RECORDS; i++) {
- // Avoid zeros
- double first = 1 + random.nextInt(INT_VALUE_BOUND);
- Long second = (long) 1 + random.nextInt(INT_VALUE_BOUND);
-
- AvgPair value = new AvgPair(first, second);
- pq.put(i, value);
- map.put(i, value);
- }
-
- // Update some records randomly
- for (int i = 0; i < NUM_RECORDS; i++) {
- int key = random.nextInt(NUM_RECORDS);
-
- // Avoid zeros
- double first = 1 + random.nextInt(INT_VALUE_BOUND);
- Long second = (long) 1 + random.nextInt(INT_VALUE_BOUND);
-
- AvgPair value = new AvgPair(first, second);
- pq.put(key, value);
- map.put(key, value);
- }
-
- // Transfer the map into list so it can be sorted.
- List<Pairs.IntObjectPair<AvgPair>> list = new ArrayList<>(NUM_RECORDS);
- for (Map.Entry<Integer, AvgPair> entry : map.entrySet()) {
- list.add(new Pairs.IntObjectPair<>(entry.getKey(), entry.getValue()));
- }
-
- // Comparison for min heap is the same as that for ascending order.
- boolean descendingOrder = !minHeap;
- Collections.sort(list, new Pairs.IntObjectComparator(descendingOrder));
-
- // Ensure that elements are popped from priority queue in the expected
order.
- int i = 0;
- while (!pq.isEmpty()) {
- Pairs.IntObjectPair<AvgPair> actual = pq.poll();
- Pairs.IntObjectPair<AvgPair> expected = list.get(i++);
-
- Assert.assertEquals(actual.getIntValue(), expected.getIntValue());
- Assert.assertEquals(actual.getObjectValue(), expected.getObjectValue());
- }
-
- // Assert that priority queue had expected number of elements.
- Assert.assertEquals(i, list.size());
- }
-}
diff --git
a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/ParentToChildrenStageCalculator.java
b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/ParentToChildrenStageCalculator.java
deleted file mode 100644
index 5e0fa9fae79..00000000000
---
a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/ParentToChildrenStageCalculator.java
+++ /dev/null
@@ -1,56 +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.query.planner.logical;
-
-import java.util.Collections;
-import java.util.IdentityHashMap;
-import java.util.Set;
-import org.apache.pinot.query.planner.plannode.MailboxSendNode;
-import org.apache.pinot.query.planner.plannode.PlanNodeVisitor;
-
-
-/**
- * Utility class to calculate the parent to children mapping for the stages on
a given plan tree.
- */
-public class ParentToChildrenStageCalculator {
- private ParentToChildrenStageCalculator() {
- }
-
- /**
- * Returns an identity map indexed by the parent node, with the value being
a set of its <strong>direct</strong> child
- * nodes.
- */
- public static IdentityHashMap<MailboxSendNode, Set<MailboxSendNode>>
calculate(MailboxSendNode root) {
- Visitor visitor = new Visitor();
- root.getInputs().forEach(node -> node.visit(visitor, root));
-
- return visitor._parentToChild;
- }
-
- private static class Visitor extends PlanNodeVisitor.DepthFirstVisitor<Void,
MailboxSendNode> {
- private IdentityHashMap<MailboxSendNode, Set<MailboxSendNode>>
_parentToChild = new IdentityHashMap<>();
-
- @Override
- public Void visitMailboxSend(MailboxSendNode node, MailboxSendNode parent)
{
- _parentToChild.computeIfAbsent(parent, k ->
Collections.newSetFromMap(new IdentityHashMap<>())).add(node);
- visitChildren(node, node); // children will be called with the current
node as the parent
- return null;
- }
- }
-}
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/column/NumValuesInfo.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/column/NumValuesInfo.java
deleted file mode 100644
index 4ce85a112b7..00000000000
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/column/NumValuesInfo.java
+++ /dev/null
@@ -1,41 +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.segment.local.segment.index.column;
-
-public class NumValuesInfo {
- volatile int _numValues = 0;
- volatile int _maxNumValuesPerMVEntry = 0;
-
- public void updateSVEntry() {
- _numValues++;
- }
-
- public void updateMVEntry(int numValuesInMVEntry) {
- _numValues += numValuesInMVEntry;
- _maxNumValuesPerMVEntry = Math.max(_maxNumValuesPerMVEntry,
numValuesInMVEntry);
- }
-
- public int getNumValues() {
- return _numValues;
- }
-
- public int getMaxNumValuesPerMVEntry() {
- return _maxNumValuesPerMVEntry;
- }
-}
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/ValidDocIndexReaderImpl.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/ValidDocIndexReaderImpl.java
deleted file mode 100644
index a07b0cad22c..00000000000
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/ValidDocIndexReaderImpl.java
+++ /dev/null
@@ -1,37 +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.segment.local.segment.index.readers;
-
-import
org.apache.pinot.segment.spi.index.mutable.ThreadSafeMutableRoaringBitmap;
-import org.apache.pinot.segment.spi.index.reader.ValidDocIndexReader;
-import org.roaringbitmap.buffer.ImmutableRoaringBitmap;
-
-
-public class ValidDocIndexReaderImpl implements ValidDocIndexReader {
- private final ThreadSafeMutableRoaringBitmap _validDocBitmap;
-
- public ValidDocIndexReaderImpl(ThreadSafeMutableRoaringBitmap
validDocBitmap) {
- _validDocBitmap = validDocBitmap;
- }
-
- @Override
- public ImmutableRoaringBitmap getValidDocBitmap() {
- return _validDocBitmap.getMutableRoaringBitmap();
- }
-}
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/vector/HnswDocIdCollector.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/vector/HnswDocIdCollector.java
deleted file mode 100644
index 358f95af636..00000000000
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/vector/HnswDocIdCollector.java
+++ /dev/null
@@ -1,88 +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.segment.local.segment.index.readers.vector;
-
-import java.io.IOException;
-import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.search.CollectionTerminatedException;
-import org.apache.lucene.search.Collector;
-import org.apache.lucene.search.LeafCollector;
-import org.apache.lucene.search.Scorable;
-import org.apache.lucene.search.ScoreMode;
-import org.apache.pinot.spi.query.QueryThreadContext;
-import org.roaringbitmap.buffer.MutableRoaringBitmap;
-
-
-/**
- * A simple collector created to bypass all the heap heavy process
- * of collecting the results in Lucene. Lucene by default will
- * create a {@link org.apache.lucene.search.TopScoreDocCollector}
- * which internally uses a {@link org.apache.lucene.search.TopDocsCollector}
- * and uses a PriorityQueue to maintain the top results. From the heap usage
- * experiments (please see the design doc), we found out that this was
- * substantially contributing to heap whereas we currently don't need any
- * scoring or top doc collecting.
- * Every time Lucene finds a matching document for the text search query,
- * a callback is invoked into this collector that simply collects the
- * matching doc's docID. We store the docID in a bitmap to be traversed later
- * as part of doc id iteration etc.
- */
-public class HnswDocIdCollector implements Collector {
-
- private final MutableRoaringBitmap _docIds;
- private final HnswVectorIndexReader.DocIdTranslator _docIdTranslator;
-
- public HnswDocIdCollector(MutableRoaringBitmap docIds,
HnswVectorIndexReader.DocIdTranslator docIdTranslator) {
- _docIds = docIds;
- _docIdTranslator = docIdTranslator;
- }
-
- @Override
- public ScoreMode scoreMode() {
- return ScoreMode.COMPLETE_NO_SCORES;
- }
-
- @Override
- public LeafCollector getLeafCollector(LeafReaderContext context) {
- return new LeafCollector() {
- private int _numDocsCollected = 0;
-
- @Override
- public void setScorer(Scorable scorer)
- throws IOException {
- // we don't use scoring, so this is NO-OP
- }
-
- @Override
- public void collect(int doc)
- throws IOException {
- try {
- QueryThreadContext.checkTerminationAndSampleUsagePeriodically(
- _numDocsCollected++, "HnswDocIdCollector");
- } catch (RuntimeException e) {
- throw new CollectionTerminatedException();
- }
-
- // Compute the absolute lucene docID across
- // sub-indexes because that's how the lookup table in docIdTranslator
is built
- _docIds.add(_docIdTranslator.getPinotDocId(context.docBase + doc));
- }
- };
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]