skoppu22 commented on code in PR #144:
URL: 
https://github.com/apache/cassandra-analytics/pull/144#discussion_r3413517598


##########
cassandra-analytics-integration-tests/src/test/java/org/apache/cassandra/analytics/BulkWriteVectorTest.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * 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 org.junit.jupiter.api.Test;
+
+import com.vdurmont.semver4j.Semver;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.distributed.api.ICoordinator;
+import org.apache.cassandra.sidecar.testing.QualifiedName;
+import org.apache.cassandra.testing.ClusterBuilderConfiguration;
+import org.apache.cassandra.testing.TestUtils;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+
+import static org.apache.cassandra.testing.TestUtils.DC1_RF3;
+import static org.apache.cassandra.testing.TestUtils.ROW_COUNT;
+import static org.apache.cassandra.testing.TestUtils.TEST_KEYSPACE;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assumptions.assumeThat;
+
+public class BulkWriteVectorTest extends SharedClusterSparkIntegrationTestBase
+{
+    static final QualifiedName VECTOR_TABLE_NAME = new 
QualifiedName(TEST_KEYSPACE, "test_vector");
+    public static final String VECTOR_TABLE_CREATE = "CREATE TABLE " + 
VECTOR_TABLE_NAME + " (\n"
+                                                     + "          id BIGINT 
PRIMARY KEY,\n"
+                                                     + "          value 
vector<FLOAT, 3>);";
+
+    private ICoordinator coordinator;
+
+    @Test
+    void testVectorOfFloats()
+    {
+        int numRowsInserted = populateVectorOfFloats();
+        // Create a spark frame with the data inserted during the setup
+        Dataset<Row> sourceData = 
bulkReaderDataFrame(VECTOR_TABLE_NAME).load();
+        assertThat(sourceData.count()).isEqualTo(numRowsInserted);
+
+        // Insert the dataset containing vectors
+        bulkWriterDataFrameWriter(sourceData, VECTOR_TABLE_NAME).save();
+
+        // Count rows because Java driver 3.x cannot read vector type
+        
assertThat(countDataWithDriver(VECTOR_TABLE_NAME)).isEqualTo(numRowsInserted);

Review Comment:
   As the data was inserted before the bulk write, it may be possible for this 
assertion to succeed even if bulk write fails silently. Can we please insert 
into a empty table instead, to ensure bulk write indeed inserted the data?



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

Reply via email to