Skip to content

Commit b6e511e

Browse files
committed
Use Stream* classes for jackson features
Signed-off-by: Mohit Godwani <[email protected]>
1 parent c4872d6 commit b6e511e

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6868
- Change `com.amazonaws.sdk.stsEndpointOverride` to `aws.stsEndpointOverride` ([7372](https://github.com/opensearch-project/OpenSearch/pull/7372/))
6969
- Align range and default value for deletes_pct_allowed in merge policy ([#7730](https://github.com/opensearch-project/OpenSearch/pull/7730))
7070
- Rename QueryPhase actors like Suggest, Rescore to be processors rather than phase ([#8025](https://github.com/opensearch-project/OpenSearch/pull/8025))
71+
- Improved performance of parsing floating point numbers ([#7909](https://github.com/opensearch-project/OpenSearch/pull/7909))
7172

7273
### Deprecated
7374

libs/x-content/src/main/java/org/opensearch/common/xcontent/cbor/CborXContent.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232

3333
package org.opensearch.common.xcontent.cbor;
3434

35-
import com.fasterxml.jackson.core.JsonEncoding;
36-
import com.fasterxml.jackson.core.JsonGenerator;
37-
import com.fasterxml.jackson.core.JsonParser;
38-
import com.fasterxml.jackson.core.StreamReadConstraints;
35+
import com.fasterxml.jackson.core.*;
3936
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
4037
import org.opensearch.core.xcontent.DeprecationHandler;
4138
import org.opensearch.core.xcontent.MediaType;
@@ -75,6 +72,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7572
cborFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7673
cborFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7774
cborFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
75+
cborFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
7876
cborXContent = new CborXContent();
7977
}
8078

libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import com.fasterxml.jackson.core.JsonGenerator;
3838
import com.fasterxml.jackson.core.JsonParser;
3939
import com.fasterxml.jackson.core.StreamReadConstraints;
40-
import com.fasterxml.jackson.core.StreamWriteFeature;
40+
import com.fasterxml.jackson.core.StreamReadFeature;
4141
import org.opensearch.core.xcontent.DeprecationHandler;
4242
import org.opensearch.core.xcontent.MediaType;
4343
import org.opensearch.core.xcontent.NamedXContentRegistry;
@@ -78,8 +78,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7878
jsonFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7979
jsonFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
8080
jsonFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
81-
jsonFactory.configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true);
82-
jsonFactory.configure(StreamWriteFeature.USE_FAST_DOUBLE_WRITER.mappedFeature(), true);
81+
jsonFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
8382
jsonXContent = new JsonXContent();
8483
}
8584

libs/x-content/src/main/java/org/opensearch/common/xcontent/smile/SmileXContent.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232

3333
package org.opensearch.common.xcontent.smile;
3434

35-
import com.fasterxml.jackson.core.JsonEncoding;
36-
import com.fasterxml.jackson.core.JsonGenerator;
37-
import com.fasterxml.jackson.core.JsonParser;
38-
import com.fasterxml.jackson.core.StreamReadConstraints;
35+
import com.fasterxml.jackson.core.*;
3936
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
4037
import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
4138
import org.opensearch.core.xcontent.DeprecationHandler;
@@ -77,6 +74,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7774
smileFactory.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, false);
7875
smileFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7976
smileFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
77+
smileFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
8078
smileXContent = new SmileXContent();
8179
}
8280

libs/x-content/src/main/java/org/opensearch/common/xcontent/yaml/YamlXContent.java

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.fasterxml.jackson.core.JsonEncoding;
3636
import com.fasterxml.jackson.core.JsonParser;
3737
import com.fasterxml.jackson.core.StreamReadConstraints;
38+
import com.fasterxml.jackson.core.StreamReadFeature;
3839
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
3940
import org.opensearch.core.xcontent.DeprecationHandler;
4041
import org.opensearch.core.xcontent.NamedXContentRegistry;
@@ -70,6 +71,7 @@ public static XContentBuilder contentBuilder() throws IOException {
7071
yamlFactory = new YAMLFactory();
7172
yamlFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
7273
yamlFactory.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
74+
yamlFactory.configure(StreamReadFeature.USE_FAST_DOUBLE_PARSER.mappedFeature(), true);
7375
yamlXContent = new YamlXContent();
7476
}
7577

0 commit comments

Comments
 (0)