yifan-c commented on code in PR #7:
URL: https://github.com/apache/cassandra-analytics/pull/7#discussion_r1235716701


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/TimestampOption.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * 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.bulkwriter;
+
+import java.io.Serializable;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+
+public final class TimestampOption implements Serializable
+{
+    private static final TimestampOption NOW = new 
TimestampOption(System.nanoTime() / 1000);

Review Comment:
   I do not think you should use it to get the absolute time `now`. See the 
comment of the method. 
   
   > This method can only be used to measure elapsed time and is not related to 
any other notion of system or wall-clock time. 
   
   It should use `System#currentTimeMillis()`, which is used in C* codebase to 
generate timestamp for cells too. 



##########
cassandra-analytics-core-example/src/main/java/org/apache/cassandra/spark/example/SampleCassandraJob.java:
##########
@@ -140,6 +141,10 @@ private static Dataset<Row> write(long rowCount, SparkConf 
sparkConf, SQLContext
           .option("local_dc", "datacenter1")
           .option("bulk_writer_cl", "LOCAL_QUORUM")
           .option("number_splits", "-1")
+//          .option(WriterOptions.TTL.name(), TTLOption.constant(20))

Review Comment:
   Should the comments (and the one below) be removed? If not, can you add 
comments for the commented code to explain why they are commented.  



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkSourceRelation.java:
##########
@@ -168,18 +169,9 @@ private void persist(@NotNull JavaPairRDD<DecoratedKey, 
Object[]> sortedRDD)
         }
     }
 
-    private static class WriteIterator implements Serializable
+    private static VoidFunction<Iterator<Tuple2<DecoratedKey, Object[]>>> 
writeRowsInPartition(Broadcast<BulkWriterContext> broadcastContext,

Review Comment:
   Can you add a comment of declaring `static`? It is to ensure that the lambda 
does not capture `this` reference, which is not serializable. The comment is 
useful for maintainers. 
   (I think it works w/o `static`, but it is more explicit to have it in the 
method signature)



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