skoppu22 commented on code in PR #183:
URL: 
https://github.com/apache/cassandra-analytics/pull/183#discussion_r2959546967


##########
cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/spark/reader/CompactionStreamScanner.java:
##########
@@ -117,15 +118,16 @@ protected void handleCellTombstoneInComplex(BigInteger 
token, Cell<?> cell)
     @Override
     UnfilteredPartitionIterator initializePartitions()
     {
-        int nowInSec = timeProvider.referenceEpochInSeconds();
+        long nowInSec = timeProvider.referenceEpochInSeconds();
         Keyspace keyspace = Keyspace.openWithoutSSTables(metadata.keyspace);
         ColumnFamilyStore cfStore = 
keyspace.getColumnFamilyStore(metadata.name);
         controller = new PurgingCompactionController(cfStore, 
CompactionParams.TombstoneOption.NONE);
         List<ISSTableScanner> scannerList = toCompact.stream()
                                                      .map(Scannable::scanner)
                                                      
.collect(Collectors.toList());
         scanners = new AbstractCompactionStrategy.ScannerList(scannerList);
-        ci = new CompactionIterator(OperationType.COMPACTION, 
scanners.scanners, controller, nowInSec, taskId);
+        // C* 4.0 CompactionIterator requires int for nowInSec; checked cast 
will throw after Y2038
+        ci = new CompactionIterator(OperationType.COMPACTION, 
scanners.scanners, controller, Ints.checkedCast(nowInSec), taskId);

Review Comment:
   checkedCast throws exception when a long cannot fit in int, and we need to 
know when that happens. Simple `(int) nowInSec` conversion will silently 
truncate the value. It will happen after Jan 19, 2038 if we don't remove C* 4.x 
support by then.



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