absurdfarce commented on code in PR #1952:
URL:
https://github.com/apache/cassandra-java-driver/pull/1952#discussion_r1928119776
##########
core/src/main/java/com/datastax/oss/driver/api/core/data/CqlVector.java:
##########
@@ -194,6 +227,11 @@ public int hashCode() {
return Objects.hash(list);
}
+ /**
+ * Only works if the inner type of the vector is a Number. Will throw
otherwise.
+ *
+ * @return the string representation
+ */
Review Comment:
Do we... still think this is true? This test passed out of the gate for me:
```
@Test
public void should_generate_string_with_to_string() {
// Numbers don't throw
assertThat(CqlVector.newInstance(123,456,789).toString()).isInstanceOf(String.class);
// How about String?
assertThat(CqlVector.newInstance("123","456","789").toString()).isInstanceOf(String.class);
// How about LocalDate?
LocalDate now = LocalDate.now();
assertThat(CqlVector.newInstance(now, now.plus(1, ChronoUnit.DAYS),
now.plus(2, ChronoUnit.DAYS)).toString()).isInstanceOf(String.class);
// How about InetAddress?
try {
assertThat(CqlVector.newInstance(
InetAddress.getByName("localhost"),
InetAddress.getByName("1.2.3.4"),
InetAddress.getByName("4.3.2.1")).toString()).isInstanceOf(String.class);
}
catch (Exception e) { fail("Exception while resolving addresses"); }
}
```
Given how Iterables.toString() works this method should work just fine for
any subtype which has a valid toString()
--
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]