DATACASS-712 - Adapt to query builder API for set at list index.

This commit is contained in:
Mark Paluch
2020-03-10 10:05:21 +01:00
parent 238eb5f771
commit 699e4ca168
2 changed files with 4 additions and 5 deletions

View File

@@ -793,8 +793,9 @@ public class StatementFactory {
private static Assignment getAssignment(SetOp updateOp, TermFactory termFactory) {
if (updateOp instanceof SetAtIndexOp) {
// return Assignment.setE(op.getColumnName().toCql(), op.getIndex(), op.getValue());
throw new UnsupportedOperationException("Set at index currently not supported");
return Assignment.setListValue(updateOp.toCqlIdentifier(),
termFactory.create(((SetAtIndexOp) updateOp).getIndex()), termFactory.create(updateOp.getValue()));
}
if (updateOp instanceof SetAtKeyOp) {

View File

@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.annotation.Id;
@@ -306,8 +305,7 @@ public class StatementFactoryUnitTests {
.isEqualTo("UPDATE person USING TIMESTAMP 1234 SET first_name='baz' WHERE foo='bar'");
}
@Test // DATACASS-343
@Ignore("No operator for set at index yet")
@Test // DATACASS-343, DATACASS-712
public void shouldCreateSetAtIndexUpdate() {
StatementBuilder<com.datastax.oss.driver.api.querybuilder.update.Update> update = statementFactory