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

Add parsing support for JSON Utility Functions #9850

Merged
merged 8 commits into from Mar 24, 2022

Conversation

K-Kumar-01
Copy link
Contributor

@K-Kumar-01 K-Kumar-01 commented Mar 9, 2022

Description

Adds the parsing support for JSON Utility functions. More information here

Changes made

  • Parsing of utility functions.
  • Addition of test cases.

Related Issue(s)

#8604
#4099

Related PR: #9352

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
go/vt/sqlparser/ast.go Outdated Show resolved Hide resolved
go/vt/sqlparser/ast.go Outdated Show resolved Hide resolved
go/vt/sqlparser/parse_test.go Outdated Show resolved Hide resolved
…tility struct

Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
@K-Kumar-01 K-Kumar-01 force-pushed the json-utility-function-support branch from ef0a39a to abf9a53 Compare March 19, 2022 16:02
Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
Comment on lines 2226 to 2231
// JSONUtilityExpr represents set of JSON utility functions
// More information on https://dev.mysql.com/doc/refman/8.0/en/json-utility-functions.html
JSONUtilityExpr struct {
Name ColIdent
StringArg Expr
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @GuptaManan100 is right. Even though the three different utility functions (JSON_PRETTY, JSON_STORAGE_SIZE, JSON_STORAGE_FREE) have the same signature, it would be more readable/debuggable to have them as separate AST nodes or have an identifiable name (such as an enum).

K-Kumar-01 and others added 4 commits March 23, 2022 12:52
Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
Create separate structs and format function for each struct
Update parser to use corresponding structs
Remove previously used JSONUtilityExpr struct

Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
Signed-off-by: Kushal Kumar <kushalkumargupta4@gmail.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@GuptaManan100 GuptaManan100 merged commit b93679f into vitessio:main Mar 24, 2022
@GuptaManan100 GuptaManan100 mentioned this pull request Jul 10, 2022
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants