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


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkWriterContext.java:
##########
@@ -135,12 +135,11 @@ private void publishInitialJobStats(String sparkVersion)
     {
         Map<String, String> initialJobStats = new HashMap<String, String>() // 
type declaration required to compile with java8
         {{
-            put("jobId", jobInfo.getId().toString());
             put("sparkVersion", sparkVersion);
-            put("keyspace", jobInfo.getId().toString());
-            put("table", jobInfo.getId().toString());
+            put("keyspace", jobInfo.getId());

Review Comment:
   is the `jobInfo.getId()` the keyspace? shouldn't we use 
`qualifiedTableName().keyspace()` here instead?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkSourceRelation.java:
##########
@@ -61,6 +61,14 @@ public CassandraBulkSourceRelation(BulkWriterContext 
writerContext, SQLContext s
         this.sqlContext = sqlContext;
         this.sparkContext = 
JavaSparkContext.fromSparkContext(sqlContext.sparkContext());
         this.broadcastContext = 
sparkContext.<BulkWriterContext>broadcast(writerContext);
+        this.jobStatsListener = new JobStatsListener((jobEventDetail) -> {
+            if 
(writerContext.job().getId().toString().equals(jobEventDetail.internalJobID()))

Review Comment:
   can we add a comment in code mentioning why we need this condition here?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkSourceRelation.java:
##########
@@ -217,16 +228,15 @@ private void persist(@NotNull JavaPairRDD<DecoratedKey, 
Object[]> sortedRDD, Str
                 markRestoreJobAsSucceeded(context);
             });
 
-            LOGGER.info("Bulk writer job complete. rows={} bytes={} 
cluster_resized={}",
+            LOGGER.info("Bulk writer job complete. rows={} bytes={} 
cluster_resize={}",
                         rowCount,
                         totalBytesWritten,
                         hasClusterTopologyChanged);
             publishSuccessfulJobStats(rowCount, totalBytesWritten, 
hasClusterTopologyChanged);
         }
         catch (Throwable throwable)
         {
-            publishFailureJobStats(throwable.getMessage());

Review Comment:
   not sure what happens here, do we no longer publish failure stats?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/JobEventDetail.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+public class JobEventDetail

Review Comment:
   can we add a javadoc here?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkWriterContext.java:
##########
@@ -135,12 +135,11 @@ private void publishInitialJobStats(String sparkVersion)
     {
         Map<String, String> initialJobStats = new HashMap<String, String>() // 
type declaration required to compile with java8
         {{
-            put("jobId", jobInfo.getId().toString());
             put("sparkVersion", sparkVersion);
-            put("keyspace", jobInfo.getId().toString());
-            put("table", jobInfo.getId().toString());
+            put("keyspace", jobInfo.getId());
+            put("table", jobInfo.qualifiedTableName().toString());

Review Comment:
   should this be `qualifiedTableName().table()` instead?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/common/stats/JobStatsPublisher.java:
##########
@@ -30,8 +30,9 @@ public interface JobStatsPublisher
 {
     /**
      * Publish the job attributes to be persisted and summarized
-     *
-     * @param stats the stats to publish
+     * @param stats mapping of the metric names and their values
      */
     void publish(Map<String, String> stats);
+
+    Map<String, String> stats();

Review Comment:
   javadocs?



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/data/CassandraDataSourceHelper.java:
##########
@@ -129,6 +129,7 @@ protected static CassandraDataLayer 
createAndInitCassandraDataLayer(
 
         dataLayer.startupValidate();
 
+

Review Comment:
   NIT: unnecessary extra line?



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