diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializers.java b/src/main/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializers.java index a8a74706d9..f6c4732057 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializers.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializers.java @@ -5,6 +5,7 @@ import io.stargate.sgv2.jsonapi.service.shredding.JsonPath; import io.stargate.sgv2.jsonapi.service.shredding.model.DocumentId; import java.math.BigDecimal; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -61,6 +62,15 @@ public static Map getDoubleMapValu return to; } + public static Map getTimestampMapValues( + Map from) { + final Map to = new HashMap<>(from.size()); + for (Map.Entry entry : from.entrySet()) { + to.put(Values.of(entry.getKey().toString()), Values.of(entry.getValue().getTime())); + } + return to; + } + public static List getDocumentIdValue(DocumentId documentId) { // Temporary implementation until we convert it to Tuple in DB List tupleValues = diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperation.java b/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperation.java index d0c1d07006..59e0cc95cd 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperation.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperation.java @@ -141,9 +141,9 @@ private static Uni insertDocument( private QueryOuterClass.Query buildInsertQuery() { String insert = "INSERT INTO \"%s\".\"%s\"" - + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values)" + + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values, query_timestamp_values)" + " VALUES" - + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; + + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; return QueryOuterClass.Query.newBuilder() .setCql(String.format(insert, commandContext.namespace(), commandContext.collection())) @@ -167,7 +167,10 @@ private static QueryOuterClass.Query bindInsertValues( .addValues( Values.of(CustomValueSerializers.getDoubleMapValues(doc.queryNumberValues()))) .addValues(Values.of(CustomValueSerializers.getStringMapValues(doc.queryTextValues()))) - .addValues(Values.of(CustomValueSerializers.getSetValue(doc.queryNullValues()))); + .addValues(Values.of(CustomValueSerializers.getSetValue(doc.queryNullValues()))) + .addValues( + Values.of( + CustomValueSerializers.getTimestampMapValues(doc.queryTimestampValues()))); return QueryOuterClass.Query.newBuilder(builtQuery).setValues(values).build(); } diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperation.java b/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperation.java index 4e65e306af..e9dd939528 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperation.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperation.java @@ -228,6 +228,7 @@ private QueryOuterClass.Query buildUpdateQuery() { + " query_dbl_values = ?," + " query_text_values = ?," + " query_null_values = ?," + + " query_timestamp_values = ?," + " doc_json = ?" + " WHERE " + " key = ?" @@ -253,6 +254,8 @@ protected static QueryOuterClass.Query bindUpdateValues( Values.of(CustomValueSerializers.getDoubleMapValues(doc.queryNumberValues()))) .addValues(Values.of(CustomValueSerializers.getStringMapValues(doc.queryTextValues()))) .addValues(Values.of(CustomValueSerializers.getSetValue(doc.queryNullValues()))) + .addValues( + Values.of(CustomValueSerializers.getTimestampMapValues(doc.queryTimestampValues()))) .addValues(Values.of(doc.docJson())) .addValues(Values.of(CustomValueSerializers.getDocumentIdValue(doc.id()))) .addValues(doc.txID() == null ? Values.NULL : Values.of(doc.txID())); diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java index 9cd015436a..cf1af000a9 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java @@ -91,6 +91,63 @@ public void insertDocument() { .body("errors", is(nullValue())); } + @Test + public void insertDocumentWithDate() { + String json = + """ + { + "insertOne": { + "document": { + "_id": "doc_date", + "username": "doc_date_user3", + "date_created": {"$date": 1672531200000} + } + } + } + """; + + given() + .header(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME, getAuthToken()) + .contentType(ContentType.JSON) + .body(json) + .when() + .post(CollectionResource.BASE_PATH, namespaceName, collectionName) + .then() + .statusCode(200) + .body("status.insertedIds[0]", is("doc_date")) + .body("data", is(nullValue())) + .body("errors", is(nullValue())); + + String expected = + """ + { + "_id": "doc_date", + "username": "doc_date_user3", + "date_created": {"$date": 1672531200000} + } + """; + + String query_json = + """ + { + "find": { + "filter" : {"_id" : "doc_date"} + } + } + """; + + given() + .header(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME, getAuthToken()) + .contentType(ContentType.JSON) + .body(query_json) + .when() + .post(CollectionResource.BASE_PATH, namespaceName, collectionName) + .then() + .statusCode(200) + .body("data.docs[0]", jsonEquals(expected)) + .body("errors", is(nullValue())); + } + @Test public void insertDocumentWithNumberId() { String json = diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/UpdateOneIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/UpdateOneIntegrationTest.java index 2e572b27e9..97db4020b2 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/UpdateOneIntegrationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/UpdateOneIntegrationTest.java @@ -34,6 +34,7 @@ public void byIdAndSet() { "document": { "_id": "update_doc1", "username": "update_user3", + "date_col": {"$date" : 1672531200000}, "active_user" : true } } @@ -76,6 +77,7 @@ public void byIdAndSet() { { "_id":"update_doc1", "username":"update_user3", + "date_col": {"$date" : 1672531200000}, "active_user":false } """; diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializersTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializersTest.java index f65b37d868..0846b6a8cf 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializersTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/bridge/serializer/CustomValueSerializersTest.java @@ -6,6 +6,7 @@ import io.stargate.bridge.proto.QueryOuterClass; import io.stargate.sgv2.jsonapi.service.shredding.JsonPath; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; @@ -83,5 +84,16 @@ public void getListValue() { final QueryOuterClass.Value next = to.get(0); assertThat(Values.string(next)).isEqualTo("field1"); } + + @Test + public void getTimestampMapValues() { + Map from = Map.of(JsonPath.from("field1"), new Date(10L)); + final Map to = + CustomValueSerializers.getTimestampMapValues(from); + final Map.Entry next = + to.entrySet().iterator().next(); + assertThat(Values.string(next.getKey())).isEqualTo("field1"); + assertThat(Values.bigint(next.getValue())).isEqualTo(10L); + } } } diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperationTest.java index 78051940c9..80a01d7eba 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/InsertOperationTest.java @@ -47,9 +47,9 @@ class Execute { static final String INSERT_CQL = "INSERT INTO \"%s\".\"%s\"" - + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values)" + + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values, query_timestamp_values)" + " VALUES" - + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; + + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; @Test public void insertOne() throws Exception { @@ -62,7 +62,8 @@ public void insertOne() throws Exception { "boolean": true, "nullval" : null, "array" : ["a", "b"], - "sub_doc" : {"col": "val"} + "sub_doc" : {"col": "val"}, + "date_val" : {"$date": 1672531200000 } } """; @@ -88,7 +89,10 @@ public void insertOne() throws Exception { CustomValueSerializers.getDoubleMapValues(shredDocument.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -155,7 +159,10 @@ public void insertDuplicate() throws Exception { CustomValueSerializers.getDoubleMapValues(shredDocument.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -247,7 +254,10 @@ public void insertManyOrdered() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -276,7 +286,10 @@ public void insertManyOrdered() throws Exception { shredDocument2.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument2.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument2.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -364,7 +377,10 @@ public void insertManyUnordered() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -393,7 +409,10 @@ public void insertManyUnordered() throws Exception { shredDocument2.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument2.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument2.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -484,7 +503,10 @@ public void failureOrdered() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -576,7 +598,10 @@ public void failureOrderedLastFails() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -605,7 +630,10 @@ public void failureOrderedLastFails() throws Exception { shredDocument2.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument2.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument2.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -701,7 +729,10 @@ public void failureUnorderedPartial() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -730,7 +761,10 @@ public void failureUnorderedPartial() throws Exception { shredDocument2.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument2.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument2.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -825,7 +859,10 @@ public void failureUnorderedAll() throws Exception { shredDocument1.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument1.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument1.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument1.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -854,7 +891,10 @@ public void failureUnorderedAll() throws Exception { shredDocument2.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument2.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument2.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument2.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationRetryTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationRetryTest.java index 969a0ea41d..b18ae0076b 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationRetryTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationRetryTest.java @@ -51,6 +51,25 @@ public class ReadAndUpdateOperationRetryTest extends AbstractValidatingStargateB // TODO: as part of https://github.com/stargate/jsonapi/issues/214 // - non-lwt failure partial, full // - non-lwt failure on retry + private static String UPDATE = + "UPDATE \"%s\".\"%s\" " + + " SET" + + " tx_id = now()," + + " exist_keys = ?," + + " sub_doc_equals = ?," + + " array_size = ?," + + " array_equals = ?," + + " array_contains = ?," + + " query_bool_values = ?," + + " query_dbl_values = ?," + + " query_text_values = ?," + + " query_null_values = ?," + + " query_timestamp_values = ?," + + " doc_json = ?" + + " WHERE " + + " key = ?" + + " IF " + + " tx_id = ?"; @Test public void findOneAndUpdateWithRetry() throws Exception { @@ -137,25 +156,7 @@ public void findOneAndUpdateWithRetry() throws Exception { Values.of(tx_id2), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -174,6 +175,9 @@ public void findOneAndUpdateWithRetry() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -202,6 +206,9 @@ public void findOneAndUpdateWithRetry() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -354,25 +361,7 @@ public void findAndUpdateWithRetryFailure() throws Exception { Values.of(tx_id2), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -391,6 +380,9 @@ public void findAndUpdateWithRetryFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -419,6 +411,9 @@ public void findAndUpdateWithRetryFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -580,25 +575,7 @@ public void findAndUpdateWithRetryFailureWithUpsert() throws Exception { Values.of(tx_id2), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -617,6 +594,9 @@ public void findAndUpdateWithRetryFailureWithUpsert() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -645,6 +625,9 @@ public void findAndUpdateWithRetryFailureWithUpsert() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -833,25 +816,7 @@ public void findAndUpdateWithRetryPartialFailure() throws Exception { Values.of(tx_id2), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -870,6 +835,9 @@ public void findAndUpdateWithRetryPartialFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -898,6 +866,9 @@ public void findAndUpdateWithRetryPartialFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -929,6 +900,9 @@ public void findAndUpdateWithRetryPartialFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id3)) @@ -1148,25 +1122,7 @@ public void findOneAndUpdateWithRetryMultipleFailure() throws Exception { Values.of(tx_id4), Values.of(doc2)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -1185,6 +1141,9 @@ public void findOneAndUpdateWithRetryMultipleFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -1213,6 +1172,9 @@ public void findOneAndUpdateWithRetryMultipleFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -1244,6 +1206,9 @@ public void findOneAndUpdateWithRetryMultipleFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id3)) @@ -1271,6 +1236,9 @@ public void findOneAndUpdateWithRetryMultipleFailure() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id4)) diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationTest.java index ccefa8af6a..3f3939da19 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/ReadAndUpdateOperationTest.java @@ -18,6 +18,7 @@ import io.stargate.sgv2.jsonapi.api.model.command.CommandContext; import io.stargate.sgv2.jsonapi.api.model.command.CommandResult; import io.stargate.sgv2.jsonapi.api.model.command.CommandStatus; +import io.stargate.sgv2.jsonapi.api.model.command.clause.update.UpdateClause; import io.stargate.sgv2.jsonapi.api.model.command.clause.update.UpdateOperator; import io.stargate.sgv2.jsonapi.service.bridge.executor.QueryExecutor; import io.stargate.sgv2.jsonapi.service.bridge.serializer.CustomValueSerializers; @@ -50,9 +51,28 @@ public class ReadAndUpdateOperationTest extends AbstractValidatingStargateBridge @Inject QueryExecutor queryExecutor; @Inject QueriesConfig queriesConfig; + private static String UPDATE = + "UPDATE \"%s\".\"%s\" " + + " SET" + + " tx_id = now()," + + " exist_keys = ?," + + " sub_doc_equals = ?," + + " array_size = ?," + + " array_equals = ?," + + " array_contains = ?," + + " query_bool_values = ?," + + " query_dbl_values = ?," + + " query_text_values = ?," + + " query_null_values = ?," + + " query_timestamp_values = ?," + + " doc_json = ?" + + " WHERE " + + " key = ?" + + " IF " + + " tx_id = ?"; + @Nested class UpdateOne { - @Test public void happyPath() throws Exception { String collectionReadCql = @@ -73,6 +93,7 @@ public void happyPath() throws Exception { { "_id": "doc1", "username": "user1", + "date_val" : {"$date": 1672531200000 }, "name" : "test" } """; @@ -105,25 +126,7 @@ public void happyPath() throws Exception { Values.of(tx_id), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -144,6 +147,9 @@ public void happyPath() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id)) @@ -172,10 +178,12 @@ public void happyPath() throws Exception { null, 0, 0); + String updateClause = + """ + { "$set" : { "name" : "test", "date_val" : {"$date": 1672531200000 } }} + """; DocumentUpdater documentUpdater = - DocumentUpdater.construct( - DocumentUpdaterUtils.updateClause( - UpdateOperator.SET, objectMapper.createObjectNode().put("name", "test"))); + DocumentUpdater.construct(objectMapper.readValue(updateClause, UpdateClause.class)); ReadAndUpdateOperation operation = new ReadAndUpdateOperation( COMMAND_CONTEXT, @@ -303,25 +311,7 @@ public void happyPathWithSort() throws Exception { Values.NULL, Values.NULL))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -342,6 +332,9 @@ public void happyPathWithSort() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id)) @@ -463,25 +456,7 @@ public void happyPathReplace() throws Exception { Values.of(tx_id), Values.of(doc1)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -502,6 +477,9 @@ public void happyPathReplace() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id)) @@ -607,25 +585,7 @@ public void happyPathReplaceUpsert() throws Exception { .build())) .returning(List.of()); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -646,6 +606,9 @@ public void happyPathReplaceUpsert() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.NULL) @@ -813,25 +776,7 @@ public void happyPathReplaceWithSort() throws Exception { Values.NULL, Values.NULL))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -852,6 +797,9 @@ public void happyPathReplaceWithSort() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id)) @@ -1008,25 +956,7 @@ public void happyPathWithSortDescending() throws Exception { Values.NULL, Values.NULL))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc2Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -1047,6 +977,9 @@ public void happyPathWithSortDescending() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -1147,25 +1080,7 @@ public void withUpsert() throws Exception { .build())) .returning(List.of()); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -1186,6 +1101,9 @@ public void withUpsert() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.NULL) @@ -1416,25 +1334,7 @@ public void happyPath() throws Exception { Values.of(tx_id2), Values.of(doc2)))); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -1455,6 +1355,9 @@ public void happyPath() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id1)) @@ -1487,6 +1390,9 @@ public void happyPath() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id2)) @@ -1588,25 +1494,7 @@ public void withUpsert() throws Exception { .build())) .returning(List.of()); - String update = - "UPDATE \"%s\".\"%s\" " - + " SET" - + " tx_id = now()," - + " exist_keys = ?," - + " sub_doc_equals = ?," - + " array_size = ?," - + " array_equals = ?," - + " array_contains = ?," - + " query_bool_values = ?," - + " query_dbl_values = ?," - + " query_text_values = ?," - + " query_null_values = ?," - + " doc_json = ?" - + " WHERE " - + " key = ?" - + " IF " - + " tx_id = ?"; - String collectionUpdateCql = update.formatted(KEYSPACE_NAME, COLLECTION_NAME); + String collectionUpdateCql = UPDATE.formatted(KEYSPACE_NAME, COLLECTION_NAME); JsonNode jsonNode = objectMapper.readTree(doc1Updated); WritableShreddedDocument shredDocument = shredder.shred(jsonNode); @@ -1627,6 +1515,9 @@ public void withUpsert() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.NULL) diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/SerialConsistencyOverrideOperationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/SerialConsistencyOverrideOperationTest.java index 0c605266c5..72d547bfe8 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/SerialConsistencyOverrideOperationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/operation/model/impl/SerialConsistencyOverrideOperationTest.java @@ -144,9 +144,9 @@ public void delete() { class Insert { static final String INSERT_CQL = "INSERT INTO \"%s\".\"%s\"" - + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values)" + + " (key, tx_id, doc_json, exist_keys, sub_doc_equals, array_size, array_equals, array_contains, query_bool_values, query_dbl_values , query_text_values, query_null_values, query_timestamp_values)" + " VALUES" - + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; + + " (?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS"; @Test public void insert() throws Exception { @@ -185,7 +185,10 @@ public void insert() throws Exception { CustomValueSerializers.getDoubleMapValues(shredDocument.queryNumberValues())), Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), - Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues()))) + Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues()))) .withColumnSpec( List.of( QueryOuterClass.ColumnSpec.newBuilder() @@ -284,6 +287,7 @@ public void readAndUpdate() throws Exception { + " query_dbl_values = ?," + " query_text_values = ?," + " query_null_values = ?," + + " query_timestamp_values = ?," + " doc_json = ?" + " WHERE " + " key = ?" @@ -310,6 +314,9 @@ public void readAndUpdate() throws Exception { Values.of( CustomValueSerializers.getStringMapValues(shredDocument.queryTextValues())), Values.of(CustomValueSerializers.getSetValue(shredDocument.queryNullValues())), + Values.of( + CustomValueSerializers.getTimestampMapValues( + shredDocument.queryTimestampValues())), Values.of(shredDocument.docJson()), Values.of(CustomValueSerializers.getDocumentIdValue(shredDocument.id())), Values.of(tx_id))