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

[FLINK-34111][table] Add support for json_quote, json_unquote, address PR feedback #24156 #24967

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

anupamaggarwal
Copy link
Contributor

What is the purpose of the change

Adds implementation of json_quote and json_unquote functions.
PR is a continuation of #24156 and addresses feedback received on the original PR.

Brief change log / changes compared to PR 24156

  • Update implementation for json_quote with escaping logic
  • Update implementation for json_unquote to unescape special characters
    • Delegates valid json checking to SqlJsonUtils#isJsonValue
  • Add/ update some additional tests
  • Updates documentation to remove reference to MySql utf8mb4 encoding

Open questions

  • High level behavior for invalid json in json_unquote (pass original input as is, Vs throwing exception)
  • To check for JSON_VALIDITY for json_unquote logic for IS JSON is used but in certain cases IS JSON behaviour does not seem to be consistent with Json spec as documented here https://www.json.org/json-en.html
    • According to json spec """" should not be a valid json (which is also flagged by JsonLint) but select '""""' IS JSON returns true
      • In case of invalid json string for json_unquote an exception is thrown in case of Mysql (However we won't do the same)

References

  • postgres implementation for escape

Verifying this change

  • Added ITs in JsonFunctionsITCase

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (docs)

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 20, 2024

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@anupamaggarwal
Copy link
Contributor Author

@flinkbot run azure

@anupamaggarwal anupamaggarwal marked this pull request as ready for review June 21, 2024 02:38
@anupamaggarwal anupamaggarwal changed the title [FLINK-34111] [table] Add support for json_quote, json_unquote, address PR feedback #24156 [FLINK-34111][table] Add support for json_quote, json_unquote, address PR feedback #24156 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants