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


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkWriterContext.java:
##########
@@ -87,11 +87,21 @@ private CassandraBulkWriterContext(@NotNull BulkSparkConf 
conf,
         Set<String> udts = CqlUtils.extractUdts(keyspaceSchema, keyspace);
         ReplicationFactor replicationFactor = 
CqlUtils.extractReplicationFactor(keyspaceSchema, keyspace);
         int indexCount = CqlUtils.extractIndexCount(keyspaceSchema, keyspace, 
table);
-        CqlTable cqlTable = bridge.buildSchema(createTableSchema, keyspace, 
replicationFactor, partitioner, udts, null, indexCount);
+        CqlTable cqlTable = bridge().buildSchema(createTableSchema, keyspace, 
replicationFactor, partitioner, udts, null, indexCount);
 
         TableInfoProvider tableInfoProvider = new 
CqlTableInfoProvider(createTableSchema, cqlTable);
         TableSchema tableSchema = initializeTableSchema(conf, dfSchema, 
tableInfoProvider, lowestCassandraVersion);
-        schemaInfo = new CassandraSchemaInfo(tableSchema);
+        schemaInfo = new CassandraSchemaInfo(tableSchema, udts, cqlTable);
+    }
+
+    @Override
+    public synchronized CassandraBridge bridge()
+    {
+        if (this.bridge == null)
+        {
+            this.bridge = 
CassandraBridgeFactory.get(this.clusterInfo.getLowestCassandraVersion());

Review Comment:
   It is safe (or safer) to use the low version among the entire job runtime, 
which is essential the low version when the job starts. 
   Cassandra can take the sstable written with low version. 
   There could be a risk that a node has to downgrade and the written sstables 
are in the new version. The scenario is rare, but you get my point. 



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