Skip to content

Commit 7ef44b6

Browse files
committed
fix failed tests
1 parent aaf7fff commit 7ef44b6

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

core/src/main/java/com/datastax/oss/driver/internal/core/type/DefaultVectorType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public String getClassName() {
6161
@Override
6262
public String asCql(boolean includeFrozen, boolean pretty) {
6363
return String.format(
64-
"VECTOR<%s, %d>", this.subtype.asCql(includeFrozen, pretty).toLowerCase(), getDimensions());
64+
"vector<%s, %d>", this.subtype.asCql(includeFrozen, pretty).toLowerCase(), getDimensions());
6565
}
6666

6767
/* ============== General class implementation ============== */

core/src/test/java/com/datastax/oss/driver/api/core/data/CqlVectorTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public void should_throw_when_building_with_nulls() {
133133

134134
@Test
135135
public void should_build_empty_vector() {
136-
137136
CqlVector<Float> vector = CqlVector.newInstance();
138137
assertThat(vector.isEmpty()).isTrue();
139138
assertThat(vector.size()).isEqualTo(0);
@@ -142,15 +141,16 @@ public void should_build_empty_vector() {
142141
@Test
143142
@UseDataProvider("dataProvider")
144143
public <T> void should_behave_mostly_like_a_list(T[] vals) {
145-
CqlVector<T> vector = CqlVector.newInstance(vals);
146-
assertThat(vector.get(0)).isEqualTo(vals[0]);
147-
vector.set(0, vals[1]);
148-
assertThat(vector.get(0)).isEqualTo(vals[1]);
144+
T[] theArray = Arrays.copyOf(vals, vals.length);
145+
CqlVector<T> vector = CqlVector.newInstance(theArray);
146+
assertThat(vector.get(0)).isEqualTo(theArray[0]);
147+
vector.set(0, theArray[1]);
148+
assertThat(vector.get(0)).isEqualTo(theArray[1]);
149149
assertThat(vector.isEmpty()).isFalse();
150150
assertThat(vector.size()).isEqualTo(2);
151151
Iterator<?> iterator = vector.iterator();
152-
assertThat(iterator.next()).isEqualTo(vals[1]);
153-
assertThat(iterator.next()).isEqualTo(vals[1]);
152+
assertThat(iterator.next()).isEqualTo(theArray[1]);
153+
assertThat(iterator.next()).isEqualTo(theArray[1]);
154154
}
155155

156156
@Test
@@ -182,7 +182,8 @@ public <T> void should_reflect_changes_to_mutable_list(T[] vals) {
182182

183183
@Test
184184
@UseDataProvider("dataProvider")
185-
public <T> void should_reflect_changes_to_array(T[] theArray) {
185+
public <T> void should_reflect_changes_to_array(T[] vals) {
186+
T[] theArray = Arrays.copyOf(vals, vals.length);
186187
CqlVector<T> vector = CqlVector.newInstance(theArray);
187188
assertThat(vector.size()).isEqualTo(2);
188189
assertThat(vector.get(1)).isEqualTo(theArray[1]);

query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/AlterTableTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ public void should_generate_alter_table_with_vector() {
117117
"v",
118118
DataTypes.custom(
119119
"org.apache.cassandra.db.marshal.VectorType(org.apache.cassandra.db.marshal.FloatType,3)")))
120-
.hasCql("ALTER TABLE bar ALTER v TYPE VECTOR<FLOAT, 3>");
120+
.hasCql("ALTER TABLE bar ALTER v TYPE vector<float, 3>");
121121
}
122122
}

query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/AlterTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ public void should_generate_alter_table_with_rename_three_columns() {
5858
@Test
5959
public void should_generate_alter_type_with_vector() {
6060
assertThat(alterType("foo", "bar").alterField("vec", new DefaultVectorType(DataTypes.FLOAT, 3)))
61-
.hasCql("ALTER TYPE foo.bar ALTER vec TYPE VECTOR<FLOAT, 3>");
61+
.hasCql("ALTER TYPE foo.bar ALTER vec TYPE vector<float, 3>");
6262
}
6363
}

query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTableTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,6 @@ public void should_generate_vector_column() {
315315
createTable("foo")
316316
.withPartitionKey("k", DataTypes.INT)
317317
.withColumn("v", new DefaultVectorType(DataTypes.FLOAT, 3)))
318-
.hasCql("CREATE TABLE foo (k int PRIMARY KEY,v VECTOR<FLOAT, 3>)");
318+
.hasCql("CREATE TABLE foo (k int PRIMARY KEY,v vector<float, 3>)");
319319
}
320320
}

query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ public void should_create_type_with_vector() {
9191
createType("ks1", "type")
9292
.withField("c1", DataTypes.INT)
9393
.withField("vec", new DefaultVectorType(DataTypes.FLOAT, 3)))
94-
.hasCql("CREATE TYPE ks1.type (c1 int,vec VECTOR<FLOAT, 3>)");
94+
.hasCql("CREATE TYPE ks1.type (c1 int,vec vector<float, 3>)");
9595
}
9696
}

0 commit comments

Comments
 (0)