-
Notifications
You must be signed in to change notification settings - Fork 141
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
PPL: Add json_object
command
#3242
base: main
Are you sure you want to change the base?
PPL: Add json_object
command
#3242
Conversation
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
if (paramList.size() % 2 != 0) { | ||
throw new SemanticCheckException( | ||
String.format( | ||
"Expected an even number of arguments but instead got #%d arguments", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the #
do here..? Does this return something like
Expected an even number of arguments but instead got #3 arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove
jsonObjectFunction | ||
: jsonObjectFunctionName LT_PRTHS functionArg COMMA functionArg (COMMA functionArg COMMA functionArg)* RT_PRTHS | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonFunctionsTest
seems to support an empty jsonObject
call, but this doesn't seem to allow that as valid syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point... I suppose an empty object IS valid.
I'll fix the syntax
"source=%s | eval obj=json_object(\"key\", json(json_string)) | fields test_name, obj" | ||
+ " test_name, casted", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there might be some extra fields here..?
"source=%s | eval obj=json_object(\"key\", json(json_string)) | fields test_name, obj" | |
+ " test_name, casted", | |
"source=%s | eval obj=json_object(\"key\", json(json_string)) | fields test_name, casted", |
This PR depends on the
json_valid
command: #3230Description
For OpenSearch-PPL, adds the json_object() functions that takes a even number of varargs (key/value pairs). Returns an expression type that is valid json object (STRUCT).
Related Issues
Resolves #3208
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.