Add back unary single column expression check#10514
Merged
deepthi merged 1 commit intovitessio:mainfrom Jun 15, 2022
Merged
Conversation
This was accidentally removed in vitessio#10512 but it shouldn't have been. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
GuptaManan100
pushed a commit
to planetscale/vitess
that referenced
this pull request
Jun 16, 2022
This was accidentally removed in vitessio#10512 but it shouldn't have been. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
3 tasks
GuptaManan100
added a commit
that referenced
this pull request
Jun 16, 2022
…10514 (#10517) * Fix parsing of CAST() statements (#10512) * Fix parsing of CAST() statements CAST() was treated as an alias for CONVERT() but with slightly different syntax. This is also described in the documentation at https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html, specifically: With CAST(expr AS type syntax, the CAST() function takes an expression of any type and produces a result value of the specified type. This operation may also be expressed as CONVERT(expr, type), which is equivalent. If expr is NULL, CAST() returns NULL. This is wrong sadly. CAST() is not equivalent to CONVERT(), specifically in the context of a CREATE TABLE. For JSON keys, the ARRAY attribute is possible on a CAST(), but that is not accepted for a CONVERT(). The difference in parsing also shows in MySQL: ``` mysql> select convert(json_keys(c), char(64) array) from t; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'array) from t' at line 1 mysql> select cast(json_keys(c) as char(64) array) from t; ERROR 1235 (42000): This version of MySQL doesn't yet support 'Use of CAST( .. AS .. ARRAY) outside of functional index in CREATE(non-SELECT)/ALTER TABLE or in general expressions' ``` Here the first statement can't be parsed at all. The second is properly parsed, but ARRAY is not allowed in the context of CAST() in this situation (and only in a CREATE TABLE). This means we should really treat these as two separate expressions and don't store them both in the same structure. The change here creates a separate CAST structure, removes the ARRAY option from CONVERT and updates the grammar and all tests accordingly. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> * Handle new cast expression in evalengine and planbuilder Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> * evalengine: do not duplicate CAST/CONVERT translation Signed-off-by: Vicent Marti <vmg@strn.cat> Co-authored-by: Vicent Marti <vmg@strn.cat> Signed-off-by: Manan Gupta <manan@planetscale.com> * Add back unary single column expression check (#10514) This was accidentally removed in #10512 but it shouldn't have been. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: Vicent Marti <vmg@strn.cat>
rsajwani
pushed a commit
to planetscale/vitess
that referenced
this pull request
Jun 27, 2022
…sio#772) This was accidentally removed in vitessio#10512 but it shouldn't have been. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was accidentally removed in #10512 but it shouldn't have
been.
It also updates the usage of a
type_variable which the linters on older releases that use Go 1.17 will complain about (but the linter was disabled for Go 1.18).Related Issue(s)
#10512
Checklist