-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Parentheses are incorrectly removed for type arrays in default expressions #63097
Comments
Eric points out that the problem is that we drop all parents in type checking:
Unfortunately this seems too simplistic. It seems like any
In short, it does seem like these parens are meaningful in this case. I wonder if there are other cases we haven't thought of? For now, one thing we can do is look and see if the outermost expression is a cast and retain the parens. |
Another option is to let the |
63103: sql: wrap CastExpr within IndirectionExpr in a ParenExpr r=ajwerner,rafiss a=the-ericwang35 Fixes #63097. When we type check ParenExpr, we remove the parentheses. This can cause issues for IndirectionExprs. For example, something like `('{a}'::_typ)[1]` would turn into `'{a}'::_typ[1]` after type checking, resulting in the `[1]` being interpreted as part of the type. This would result in errors when trying to use these expressions in default expressions. This patch checks for this specific case, and if it finds that there is a CastExpr within an IndirecionExpr, it will wrap it in a ParenExpr. Release note: None 63108: colexec: wrap DrainMeta with panic-catcher and protect columnarizer r=yuzefovich a=yuzefovich **colexec: wrap DrainMeta with panic-catcher and protect columnarizer** Previously, in some edge cases (like when a panic is encountered during `Operator.Init`) the metadata sources could have been uninitialized, so when we tried to drain them, we'd encounter a crash. In order to avoid that in the future, now all root components will wrap the draining with the panic-catcher. Additionally, we now protect the columnarizer in this case explicitly - if it wasn't initialized, it won't drain the wrapped processor in `DrainMeta`. Fixes: #62514. Release note: None **rowexec: remove redundant implementations of MetadataSource interface** Previously, some row-by-row processors implemented `execinfra.MetadataSource` interface. The idea behind that originally was to allow for wrapped processors to return their metadata in the vectorized flow, but nothing explicit is actually needed because every wrapped processor has a columnarizer after it which will drain the processor according to row-by-row model (by moving into draining state and exhausting the trailing meta). This commit removes those redundant implementations. This allows us to move the interface into `colexecop` package where it belongs. Release note: None 63169: README.md: fix indentation for Deployment section r=ajwerner a=ajwerner It was formatted as preformatted as opposed to the list it was trying to be. Release note: None Co-authored-by: Eric Wang <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Andrew Werner <[email protected]>
Describe the problem
The way we currently serialize type arrays in default expressions removes parentheses in the expression. As a result, the expressions becomes invalid and results in an error.
To Reproduce
Expected behavior
This syntax should be valid and not result in an error.
The expression should instead be serialized as
('{a}':::STRING::@100060)[1:::INT8]::STRING
(notice the parentheses around'{a}':::STRING::@100060
, which are currently being dropped).The text was updated successfully, but these errors were encountered: