frankgh commented on code in PR #44:
URL: 
https://github.com/apache/cassandra-analytics/pull/44#discussion_r1509746490


##########
cassandra-bridge/src/main/java/org/apache/cassandra/spark/utils/ReaderTimeProvider.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.utils;
+
+/**
+ * A {@link TimeProvider} used by reader. It decides the reference epoch on 
instantiation and distribute to executors
+ */
+public class ReaderTimeProvider implements TimeProvider
+{
+    private static final long serialVersionUID = 880314923071431541L;
+
+    private final int referenceEpoch;

Review Comment:
   Explicitly define this variable
   ```suggestion
       private final int referenceEpochInSeconds;
   ```



##########
cassandra-bridge/src/main/java/org/apache/cassandra/spark/utils/ReaderTimeProvider.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.utils;
+
+/**
+ * A {@link TimeProvider} used by reader. It decides the reference epoch on 
instantiation and distribute to executors
+ */
+public class ReaderTimeProvider implements TimeProvider
+{
+    private static final long serialVersionUID = 880314923071431541L;

Review Comment:
   probably not needed since we only serialize the int



##########
cassandra-bridge/src/main/java/org/apache/cassandra/spark/utils/TimeProvider.java:
##########
@@ -19,16 +19,37 @@
 
 package org.apache.cassandra.spark.utils;
 
+import java.util.concurrent.TimeUnit;
+
 /**
  * Provides current time
   */
-@FunctionalInterface
 public interface TimeProvider
 {
-    TimeProvider INSTANCE = () -> (int) 
Math.floorDiv(System.currentTimeMillis(), 1000L);
+    TimeProvider DEFAULT = new TimeProvider()
+    {
+        private final int referenceEpoch = nowInSeconds();

Review Comment:
   maybe we can preserve existing behavior by returning the current seconds 
every time.
   
   ```
           @Override
            public int referenceEpochInSeconds()
            {
                return nowInSeconds();
            }
   ```
   
   One clarification, SBR when running with the CassandraDataLayer, reads a 
snapshot. The same is not true for when you are using the `LocalDataLayer` for 
example.



-- 
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: commits-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to