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

前端 未结 2 435
旧巷少年郎
旧巷少年郎 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:29

    As hadoop environment(Pig, hdfs, Hive & etc) is using json-path-2.3.0, Its better user Mapper logic should use another version "jsonpath-1.0.jar" will solve the problem

    0 讨论(0)
  • 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<Option> options() {
    
                    return EnumSet.noneOf(Option.class);
    
                }
    
            });
    
            configChanged = true;
    
        }
    
    }
    
    0 讨论(0)
提交回复
热议问题