Maxwell-Guo commented on code in PR #2957:
URL: https://github.com/apache/cassandra/pull/2957#discussion_r1415860902
##########
test/unit/org/apache/cassandra/cql3/validation/operations/CQLVectorTest.java:
##########
@@ -554,4 +562,97 @@ public void udf() throws Throwable
// make sure the function referencing the UDT is dropped before
dropping the UDT at cleanup
execute("DROP FUNCTION " + f);
}
+
+ @Test
+ public void testCopyFloatVectorFromFile() throws IOException
+ {
+ assertCopyOfVectorLiteralsFromFileSucceeds("float", 6, new Object[][] {
+ row(1, vector(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f)),
+ row(2, vector(-0.1f, -0.2f, -0.3f, -0.4f, -0.5f, -0.6f)),
+ row(3, vector(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f))
+ });
+
+ assertCopyOfVectorLiteralsFromFileSucceeds("float", 3, new Object[][] {
+ row(1, vector(0.1f, 0.2f, 0.3f)),
+ row(2, vector(-0.4f, -0.5f, -0.6f)),
+ row(3, vector(0.7f, 0.8f, 0.9f))
+ });
+ }
+
+ @Test
+ public void testCopyIntVectorFromFile() throws IOException
+ {
+ assertCopyOfVectorLiteralsFromFileSucceeds("int", 6, new Object[][] {
+ row(1, vector(1, 2, 3, 4, 5, 6)),
+ row(2, vector(-1, -2, -3, -4, -5, -6)),
+ row(3, vector(9, 8, 7, 6, 5, 4))
+ });
+
+ assertCopyOfVectorLiteralsFromFileSucceeds("int", 3, new Object[][] {
+ row(1, vector(1, 2, 3)),
+ row(2, vector(-4, -5, -6)),
+ row(3, vector(7, 8, 9))
+ });
+ }
+
+ private void assertCopyOfVectorLiteralsFromFileSucceeds(String vectorType,
int vectorSize, Object[][] rows) throws IOException
Review Comment:
I actually want to state here that my original intention was that there was
no need to test different dimensions for me. A single dimension is enough like
testCopyOnlyThoseRowsThatMatchVectorTypeSize has done, The different numbers
may be endless. For example, why does match no longer test a 3, and just 6 is
left ? And then I can create two tables at once in the beforeclass for
testing,and the code will look simpler. That's why I say this, but if you can
give more tests, why not? I am happy with that.
##########
test/unit/org/apache/cassandra/cql3/validation/operations/CQLVectorTest.java:
##########
@@ -554,4 +562,97 @@ public void udf() throws Throwable
// make sure the function referencing the UDT is dropped before
dropping the UDT at cleanup
execute("DROP FUNCTION " + f);
}
+
+ @Test
+ public void testCopyFloatVectorFromFile() throws IOException
+ {
+ assertCopyOfVectorLiteralsFromFileSucceeds("float", 6, new Object[][] {
+ row(1, vector(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f)),
+ row(2, vector(-0.1f, -0.2f, -0.3f, -0.4f, -0.5f, -0.6f)),
+ row(3, vector(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f))
+ });
+
+ assertCopyOfVectorLiteralsFromFileSucceeds("float", 3, new Object[][] {
+ row(1, vector(0.1f, 0.2f, 0.3f)),
+ row(2, vector(-0.4f, -0.5f, -0.6f)),
+ row(3, vector(0.7f, 0.8f, 0.9f))
+ });
+ }
+
+ @Test
+ public void testCopyIntVectorFromFile() throws IOException
+ {
+ assertCopyOfVectorLiteralsFromFileSucceeds("int", 6, new Object[][] {
+ row(1, vector(1, 2, 3, 4, 5, 6)),
+ row(2, vector(-1, -2, -3, -4, -5, -6)),
+ row(3, vector(9, 8, 7, 6, 5, 4))
+ });
+
+ assertCopyOfVectorLiteralsFromFileSucceeds("int", 3, new Object[][] {
+ row(1, vector(1, 2, 3)),
+ row(2, vector(-4, -5, -6)),
+ row(3, vector(7, 8, 9))
+ });
+ }
+
+ private void assertCopyOfVectorLiteralsFromFileSucceeds(String vectorType,
int vectorSize, Object[][] rows) throws IOException
Review Comment:
I actually want to state here that my original intention was that there was
no need to test different dimensions for me. A single dimension is enough like
testCopyOnlyThoseRowsThatMatchVectorTypeSize has done, The different numbers
may be endless. For example, why does match no longer test a 3, and just 6 is
left ? And then I can create two tables at once in the beforeclass for
testing,and the code will look simpler. That's why I say this, but if you can
give more tests, why not? I am happy with that.
--
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]