Class NestedPathFinder

java.lang.Object
org.apache.druid.segment.nested.NestedPathFinder

public class NestedPathFinder extends Object
  • Field Details

  • Constructor Details

    • NestedPathFinder

      public NestedPathFinder()
  • Method Details

    • find

      @Nullable public static Object find(@Nullable Object data, List<NestedPathPart> path)
      Dig through a thing to find stuff
    • findKeys

      @Nullable public static Object[] findKeys(@Nullable Object data, List<NestedPathPart> path)
      find the list of 'keys' at some path. - if the thing at a path is an object (map), return the fields - if the thing at a path is an array (list or array), return the 0 based element numbers - if the thing is a simple value, return null
    • toNormalizedJsonPath

      public static String toNormalizedJsonPath(List<NestedPathPart> paths)
    • parseJsonPath

      public static List<NestedPathPart> parseJsonPath(@Nullable String path)
      Split a JSONPath expression into a series of NestedPathPart representing the structure of the path expression. This allows using with find(Object, List) in order to extract values from json objects represented as java Map and List.
    • parseBadJsonPath

      public static List<NestedPathPart> parseBadJsonPath(@Nullable String path)
      Split a JSONPath expression into a series of NestedPathPart representing the structure of the path expression. This method is a variant of parseJsonPath(String) which allows fixing up any illegal expressions encountered from a previously bugged version of toNormalizedJsonPath(List), which incorrectly created path expressions like '$..a' or '$.[0].a' when encountering empty fields instead of the correct '$[''].a' and '$[''][0].a'. This method should only be used for converting field dictionaries stored in columns to fix the incorrectly stored paths, and never for parsing user input expressions.
    • toNormalizedJqPath

      public static String toNormalizedJqPath(List<NestedPathPart> paths)
      Given a list of part finders, convert it to a "normalized" 'jq' path format that is consistent with how StructuredDataProcessor constructs field path names
    • parseJqPath

      public static List<NestedPathPart> parseJqPath(@Nullable String path)
      split a jq path into a series of extractors to find things in stuff