-
Notifications
You must be signed in to change notification settings - Fork 284
Adding :: cast. #22836
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
base: main
Are you sure you want to change the base?
Adding :: cast. #22836
Conversation
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||
iamlinjunhong
left a comment
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.
有语法冲突
➜ parsers git:(fengttt-greatest) ✗ make
go run github.com/matrixorigin/matrixone/pkg/sql/parsers/goyacc -o mysql_sql.go mysql_sql.y
conflicts: 14 shift/reduce
gofmt -w mysql_sql.go
rm -f y.output
go run github.com/matrixorigin/matrixone/pkg/sql/parsers/goyacc -o postgresql_sql.go postgresql_sql.y
gofmt -w postgresql_sql.go
rm -f y.output
We will leave all shift/reduce to later work. |
35e3895 to
99c9050
Compare
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #3335
What this PR does / why we need it:
Adding :: cast.
PR Type
Enhancement
Description
Add support for PostgreSQL-style
::cast operator in MySQL dialectConvert
::cast syntax to standard SQLCAST()function during parsingImplement scanner token
COLON_COLONfor double colon recognitionAdd comprehensive test cases for various cast scenarios
Diagram Walkthrough
File Walkthrough
scanner.go
Add COLON_COLON token recognitionpkg/sql/parsers/dialect/mysql/scanner.go
::operator in scannerCOLON_COLONtoken when double colon is encounteredmysql_sql.y
Add :: cast operator grammar rulepkg/sql/parsers/dialect/mysql/mysql_sql.y
COLON_COLONtoken to grammar with right associativitysimple_expr COLON_COLON mo_cast_type::cast syntax totree.NewCastExpr()function callmysql_sql_test.go
Add comprehensive :: cast operator testspkg/sql/parsers/dialect/mysql/mysql_sql_test.go
::cast scenariostypes
CAST()syntaxmysql_sql.go
Update generated parser codepkg/sql/parsers/dialect/mysql/mysql_sql.go
COLON_COLONtoken and cast rule