-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE]Add PPL JSON
extended functions support
#667
Comments
@YANG-DB These features look awesome. Can we add support to access elements within an array using index too? |
@A-Gray-Cat yes that is possible - can you please suggest the syntax and we can discuss it further |
Thanks! E.g.
Users can access the first element of the array by using syntax like |
Hello @YANG-DB , can we also add support to filter a json object using either the key or the value, or both? E.g. ... | eval person = json_object("name", "John", "age", 30), all_match = filter(person, k,v -> k = "name") |
With #780 , you can access the first element by
|
@qianheng-aws #864 introduces array filter, seems map_filter is another lambda function we need either. |
@LantaoJin @A-Gray-Cat For your purpose of performing filter on a field of json(i.e StructType in Spark), you can do it directly, like:
Or if you want to filter it directly, write query like:
|
Is your feature request related to a problem?
We need to enhance OpenSearch PPL (Piped Processing Language) by adding support for JSON-based operations. This extension will provide users with powerful tools to manipulate and analyze JSON data within PPL queries.
Proposed New Functions
json_object()
: Creates a JSON object from existing key/value pairs.json()
: Evaluates whether a value can be parsed as JSON. Returns the value if valid, null otherwise.json_append()
: Appends elements to the contents of a valid JSON object.json_array()
: Creates a JSON array using a list of values.json_array_to_mv()
: Maps the elements of a JSON array to a multivalued field.json_delete()
: Removes one or more keys and their corresponding values from the specified JSON object.json_extend()
: Extends the contents of a valid JSON object with the values of an array.json_extract()
: Returns either a JSON array or a native type value from a field and zero or more paths.json_keys()
: Returns the keys from the key-value pairs in a JSON object as a JSON array.json_set()
: Inserts or overwrites values for a JSON node with provided values and returns an updated JSON object.json_valid()
: Evaluates whether a JSON object uses valid JSON syntax and returns TRUE or FALSE.all()
: Iterates over JSON array values and returns true if every value matches the provided predicate.any()
: Iterates over JSON array values and returns true if any value matches the provided predicate.filter()
: Iterates over JSON array values and performs an operation on each value.map()
: Iterates over JSON array values and performs an operation on each value.reduce()
: Iterates over a JSON array in a field or a literal array and performs an accumulation operation.Technical Considerations
The text was updated successfully, but these errors were encountered: