You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2025/11/21 20:36:19 UTC

(asterixdb) 08/17: [NO ISSUE][*DB][EXT] Avoid serialization of JsonFactory

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit f2ab5ab0138b96004755ddc2c1d77647fbf20244
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Thu Sep 4 16:47:44 2025 -0400

    [NO ISSUE][*DB][EXT] Avoid serialization of JsonFactory
    
    Use a static JsonFactory in JSONDataParserFactory to avoid
    serialization overhead and binary compatibility complications in the
    future.
    
    (cherry picked from commit 8a15298fb6)
    
    Ext-ref: MB-68387
    Change-Id: I5b855538fff6530ae3ae6ce45e2b8d68801d1e94
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20343
    Reviewed-by: Michael Blow <mb...@apache.org>
    Tested-by: Michael Blow <mb...@apache.org>
---
 .../asterix/external/parser/factory/JSONDataParserFactory.java     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/JSONDataParserFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/JSONDataParserFactory.java
index f9d50d39ec..b672b20fcc 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/JSONDataParserFactory.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/JSONDataParserFactory.java
@@ -41,16 +41,15 @@ import com.fasterxml.jackson.core.JsonParser;
 
 public class JSONDataParserFactory extends AbstractRecordStreamParserFactory<char[]> {
 
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
     private static final List<String> PARSER_FORMAT = Collections.unmodifiableList(
             Arrays.asList(ExternalDataConstants.FORMAT_JSON_LOWER_CASE, ExternalDataConstants.FORMAT_JSON_UPPER_CASE));
     private static final List<ATypeTag> UNSUPPORTED_TYPES = Collections
             .unmodifiableList(Arrays.asList(ATypeTag.MULTISET, ATypeTag.POINT3D, ATypeTag.CIRCLE, ATypeTag.RECTANGLE,
                     ATypeTag.INTERVAL, ATypeTag.DAYTIMEDURATION, ATypeTag.DURATION, ATypeTag.BINARY));
+    private static final JsonFactory jsonFactory;
 
-    private final JsonFactory jsonFactory;
-
-    public JSONDataParserFactory() {
+    static {
         jsonFactory = new JsonFactory();
         jsonFactory.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true);
         jsonFactory.configure(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES, true);