JSON Path 2.3.0 conflicts with hadoop 2.7 Environment JSON-smart1.2.0.jar

前端 未结 2 523
旧巷少年郎
旧巷少年郎 2021-01-25 18:58
  1. Have a Input of JSON inside HDFS location
  2. It is required to parse the JSON and to aggregate results
  3. To do am using the PIG UDF which are using JSON-path
2条回答
  •  情深已故
    2021-01-25 19:34

    Provide the custom implementation to load/parse the JSON so that we can avoid using Json-smart-2.x/1.x of Hadoop/lib

      public static void changeJsonPathConfig() {
    
        if (!configChanged) {
    
            Configuration.setDefaults(new Configuration.Defaults() {
    
    
    
                private final JsonProvider jsonProvider = new GsonJsonProvider(
    
                        new GsonBuilder().serializeNulls().create());
    
                private final MappingProvider mappingProvider = new GsonMappingProvider();
    
    
    
                @Override
    
                public JsonProvider jsonProvider() {
    
                    return jsonProvider;
    
                }
    
    
    
                @Override
    
                public MappingProvider mappingProvider() {
    
                    return mappingProvider;
    
                }
    
    
    
                @Override
    
                public Set

提交回复
热议问题