yifan-c commented on code in PR #20:
URL:
https://github.com/apache/cassandra-analytics/pull/20#discussion_r1419958662
##########
cassandra-analytics-core/src/test/java/org/apache/cassandra/spark/bulkwriter/TableSchemaTest.java:
##########
@@ -231,4 +234,10 @@ private TableSchemaTestCommon.MockTableSchemaBuilder
getValidSchemaBuilder()
.withWriteMode(WriteMode.INSERT)
.withDataFrameSchema(validDataFrameSchema);
}
+
+ // Removes the unique table name to make validation consistent
+ private static String replaceTableName(String statement)
Review Comment:
nit: how about rename to `trimTestTableId`?
##########
cassandra-analytics-integration-tests/src/test/java/org/apache/cassandra/analytics/QuoteIdentifiersWriteTest.java:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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.analytics;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+
+import com.google.common.collect.ImmutableMap;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import io.vertx.junit5.VertxExtension;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.sidecar.testing.QualifiedName;
+import org.apache.cassandra.testing.CassandraIntegrationTest;
+import org.apache.spark.SparkContext;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.Function2;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.RowFactory;
+import org.apache.spark.sql.SQLContext;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.types.StructType;
+
+import static org.apache.spark.sql.types.DataTypes.BinaryType;
+import static org.apache.spark.sql.types.DataTypes.LongType;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests the bulk writer behavior when requiring quoted identifiers for
keyspace, table name, and column names.
+ *
+ * <p>These tests exercise a full integration test, which includes testing
Sidecar behavior when dealing with quoted
+ * identifiers.
+ */
+@ExtendWith(VertxExtension.class)
+class QuoteIdentifiersWriteTest extends SparkIntegrationTestBase
+{
+ static final int ROW_COUNT = 10_000;
+
+ @CassandraIntegrationTest(nodesPerDc = 3, gossip = true)
Review Comment:
Does the test quire 3 nodes? If not, let's use 1 node to consume less
resources.
##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraClusterInfo.java:
##########
@@ -535,6 +548,15 @@ protected boolean isReplacement(RingEntry ringEntry)
return false;
}
+ protected CassandraBridge bridge()
+ {
+ if (bridge == null)
+ {
+ bridge = CassandraBridgeFactory.get(getLowestCassandraVersion());
Review Comment:
In that case, why not just call
`CassandraBridgeFactory.get(getLowestCassandraVersion())`? Given the value
effectively cached already.
--
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]