cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [cassandra] emolsson commented on a change in pull request #246: Abstract Virtual Table for very large result sets for CASSANDRA-14629
Date Mon, 07 Oct 2019 14:27:17 GMT
emolsson commented on a change in pull request #246: Abstract Virtual Table for very large
result sets for CASSANDRA-14629

 File path: src/java/org/apache/cassandra/db/virtual/
 @@ -0,0 +1,281 @@
+ * 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
+ *
+ *
+ *
+ * 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.cassandra.db.virtual;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
+import org.apache.cassandra.db.Clustering;
+import org.apache.cassandra.db.DataRange;
+import org.apache.cassandra.db.DecoratedKey;
+import org.apache.cassandra.db.DeletionTime;
+import org.apache.cassandra.db.EmptyIterators;
+import org.apache.cassandra.db.PartitionPosition;
+import org.apache.cassandra.db.RegularAndStaticColumns;
+import org.apache.cassandra.db.filter.ClusteringIndexFilter;
+import org.apache.cassandra.db.filter.ColumnFilter;
+import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.marshal.CompositeType;
+import org.apache.cassandra.db.partitions.AbstractUnfilteredPartitionIterator;
+import org.apache.cassandra.db.partitions.PartitionUpdate;
+import org.apache.cassandra.db.partitions.SingletonUnfilteredPartitionIterator;
+import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
+import org.apache.cassandra.db.rows.AbstractUnfilteredRowIterator;
+import org.apache.cassandra.db.rows.BTreeRow;
+import org.apache.cassandra.db.rows.BufferCell;
+import org.apache.cassandra.db.rows.EncodingStats;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.db.rows.Rows;
+import org.apache.cassandra.db.rows.Unfiltered;
+import org.apache.cassandra.db.rows.UnfilteredRowIterator;
+import org.apache.cassandra.dht.AbstractBounds;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.schema.ColumnMetadata;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+ * An abstract virtual table that will iteratively build its rows. This is
+ * for when the data set is too large to fit in memory. It requires that the partition
+ * keys are provided in the order of the partitioner of the table metadata.
+ */
+public abstract class AbstractIteratingTable implements VirtualTable
+    final protected TableMetadata metadata;
+    protected AbstractIteratingTable(TableMetadata metadata)
+    {
+        this.metadata = metadata;
+    }
+    /**
+     * @param partitionKey
+     * @return boolean if the partition key would exist in this table
+     */
+    protected abstract boolean hasKey(DecoratedKey partitionKey);
+    /**
+     * Returns an in order iterator (metadata.partitioner) of decorated partition keys for
this table. A DataRange is
+     * provided and all the keys for that range must be provided, but it is not required
that the keys fall in this
+     * range. If your partition key set is small enough it is Ok to provide entire set.
+     * 
+     * @param dataRange
+     *            optional range of keys to return
+     * @return Iterator of keys in token order
+     */
+    protected abstract Iterator<DecoratedKey> getPartitionKeys(DataRange dataRange);
+    /**
+     * @param isReversed if orderby reverse requested
+     * @param key partition key
+     * @param columns queried columns
+     * @return iterator of rows in order for a given partition key
+     */
+    protected abstract Iterator<Row> getRows(boolean isReversed, DecoratedKey key,
RegularAndStaticColumns columns);
 Review comment:
   Instead of sending `boolean isReversed/RegularAndStaticColumns columns` it could help the
sub-classes to instead send in ClusteringIndexFilter and ColumnFilter. This makes it possible
for the sub-class to filter out unnecessary rows earlier.
   Both should be available in single key select/range select already.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message