Skip to content

Commit 57fae9d

Browse files
authored
Merge pull request #2 from tatu-at-datastax/main
Fix #1: enable fast(er) FP reads/writes
2 parents c68d093 + 970dd7b commit 57fae9d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

REALEASE.MD renamed to RELEASE.MD

File renamed without changes.

astra-db-java/src/main/java/com/datastax/astra/internal/utils/JsonUtils.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@
4141
import com.datastax.astra.client.model.UUIDv6;
4242
import com.datastax.astra.client.model.UUIDv7;
4343
import com.fasterxml.jackson.annotation.JsonInclude.Include;
44+
import com.fasterxml.jackson.core.JsonFactory;
4445
import com.fasterxml.jackson.core.JsonParser;
4546
import com.fasterxml.jackson.core.JsonProcessingException;
47+
import com.fasterxml.jackson.core.StreamReadFeature;
48+
import com.fasterxml.jackson.core.StreamWriteFeature;
49+
import com.fasterxml.jackson.core.json.JsonReadFeature;
4650
import com.fasterxml.jackson.databind.DeserializationFeature;
4751
import com.fasterxml.jackson.databind.MapperFeature;
4852
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -79,9 +83,14 @@ public class JsonUtils {
7983
*/
8084
public static synchronized ObjectMapper getDataApiObjectMapper() {
8185
if (dataApiObjectMapper == null) {
82-
dataApiObjectMapper = new ObjectMapper()
83-
.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true)
84-
.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
86+
JsonFactory jsonFactory = JsonFactory.builder()
87+
.enable(JsonReadFeature.ALLOW_SINGLE_QUOTES)
88+
.enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES)
89+
.enable(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER)
90+
.enable(StreamReadFeature.USE_FAST_DOUBLE_PARSER)
91+
.enable(StreamWriteFeature.USE_FAST_DOUBLE_WRITER)
92+
.build();
93+
dataApiObjectMapper = new ObjectMapper(jsonFactory)
8594
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
8695
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
8796
.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false)

0 commit comments

Comments
 (0)