Package org.apache.druid.segment.nested
Class NestedPathFinder
java.lang.Object
org.apache.druid.segment.nested.NestedPathFinder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Objectfind(Object data, List<NestedPathPart> path) Dig through a thing to find stuffstatic Object[]findKeys(Object data, List<NestedPathPart> path) find the list of 'keys' at some path.static List<NestedPathPart>parseBadJsonPath(String path) Split a JSONPath expression into a series ofNestedPathPartrepresenting the structure of the path expression.static List<NestedPathPart>parseJqPath(String path) split a jq path into a series of extractors to find things in stuffstatic List<NestedPathPart>parseJsonPath(String path) Split a JSONPath expression into a series ofNestedPathPartrepresenting the structure of the path expression.static StringtoNormalizedJqPath(List<NestedPathPart> paths) Given a list of part finders, convert it to a "normalized" 'jq' path format that is consistent with howStructuredDataProcessorconstructs field path namesstatic StringtoNormalizedJsonPath(List<NestedPathPart> paths)
-
Field Details
-
VERSION
public static final byte VERSION- See Also:
-
JSON_PATH_ROOT
- See Also:
-
JQ_PATH_ROOT
- See Also:
-
-
Constructor Details
-
NestedPathFinder
public NestedPathFinder()
-
-
Method Details
-
find
Dig through a thing to find stuff -
findKeys
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
-
parseJsonPath
Split a JSONPath expression into a series ofNestedPathPartrepresenting the structure of the path expression. This allows using withfind(Object, List)in order to extract values from json objects represented as javaMapandList. -
parseBadJsonPath
Split a JSONPath expression into a series ofNestedPathPartrepresenting the structure of the path expression. This method is a variant ofparseJsonPath(String)which allows fixing up any illegal expressions encountered from a previously bugged version oftoNormalizedJsonPath(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
Given a list of part finders, convert it to a "normalized" 'jq' path format that is consistent with howStructuredDataProcessorconstructs field path names -
parseJqPath
split a jq path into a series of extractors to find things in stuff
-