Skip to content
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 TO_JSON_STRING and ARRAY_LENGHT functions and refactor the JSON function #869

Closed
LantaoJin opened this issue Nov 5, 2024 · 0 comments · Fixed by #870
Closed
Labels
enhancement New feature or request Lang:PPL Pipe Processing Language support

Comments

@LantaoJin
Copy link
Member

Is your feature request related to a problem?
A followup of #667

  1. Refactor JSON: Currently the JSON evaluates STRING/JSON_ARRAY/JSON_OBJECT. It brings many confusions. In Splunk, the data could be stored as JSON object, JSON function evaluates JSON object. But in Spark, there is no JSON object, but it contains STRING, StructType and ArrayType. So the JSON function can only evaluate STRING types.

  2. Add ARRAY_LENGHT: for the same reason above, we separate JSON_ARRAY_LENGHT to JSON_ARRAY_LENGHT and ARRAY_LENGHT. JSON_ARRAY_LENGHT only accepts STRING type, ARRAY_LENGHT only accepts ArrayType.

  3. Add TO_JSON_STRING: After the refactor of (1), we still need a method to convert JSON_ARRAY/JSON_OBJECT to valid JSON STRING. TO_JSON_STRING accepts both StructType and ArrayType as input and returns JSON formatted string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Lang:PPL Pipe Processing Language support
Projects
None yet
1 participant