lukasz-antoniak commented on code in PR #131:
URL: 
https://github.com/apache/cassandra-analytics/pull/131#discussion_r2251435501


##########
cassandra-five-zero-bridge/src/main/java/org/apache/cassandra/spark/reader/CompactionStreamScanner.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.cassandra.spark.reader;
+
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.function.LongPredicate;
+import java.util.stream.Collectors;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import org.apache.cassandra.db.AbstractCompactionController;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.DecoratedKey;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
+import org.apache.cassandra.db.compaction.CompactionIterator;
+import org.apache.cassandra.db.compaction.OperationType;
+import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
+import org.apache.cassandra.db.rows.Cell;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.db.rows.UnfilteredRowIterator;
+import org.apache.cassandra.io.sstable.ISSTableScanner;
+import org.apache.cassandra.schema.CompactionParams;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.spark.data.partitioner.Partitioner;
+import org.apache.cassandra.spark.utils.IOUtils;
+import org.apache.cassandra.spark.utils.TimeProvider;
+import org.apache.cassandra.utils.TimeUUID;
+import org.jetbrains.annotations.NotNull;
+
+public class CompactionStreamScanner extends AbstractStreamScanner
+{
+    private final Collection<? extends Scannable> toCompact;
+    private final TimeUUID taskId;
+
+    private PurgingCompactionController controller;
+    private AbstractCompactionStrategy.ScannerList scanners;
+    private CompactionIterator ci;
+
+    @VisibleForTesting
+    CompactionStreamScanner(@NotNull TableMetadata cfMetaData,
+                            @NotNull Partitioner partitionerType,
+                            @NotNull Collection<? extends Scannable> toCompact)
+    {
+        this(cfMetaData, partitionerType, TimeProvider.DEFAULT, toCompact);
+    }
+
+    public CompactionStreamScanner(@NotNull TableMetadata cfMetaData,
+                                   @NotNull Partitioner partitionerType,
+                                   @NotNull TimeProvider timeProvider,
+                                   @NotNull Collection<? extends Scannable> 
toCompact)
+    {
+        super(cfMetaData, partitionerType, timeProvider);
+        this.toCompact = toCompact;
+        this.taskId = TimeUUID.Generator.nextTimeUUID(); // Cassandra 4.x vs 
5.x

Review Comment:
   Change to `TimeUUID` was needed by `ci = new 
CompactionIterator(OperationType.COMPACTION, scanners.scanners, controller, 
nowInSec, taskId);`.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to