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
DISTINCT(X) is considered a function by vtgate #5767
Comments
This is unfortunate:
My interpretation for
@systay: we should amend the parser to convert these to the normalized form. |
My understanding is that something different is happening.
is a valid query, right? It's just the value from column c1 with parens around it - a perfectly normal expression (albeit complex). Adding DISTINCT before makes it look like a function call, but it's not. You can double check this by trying something like:
This is not accepted - DISTINCT must come before the first expression in the SELECT clause. We could (and maybe will) do more expression rewriting and remove unnecessary parens like this one, but we don't at the moment, and that why this doesn't work. |
This should be solved by #5906 |
Schema and vSchema:
Now:
Note the
distinct
with parentheses; which is valid synonym for distinct without parentheses. Without them, the query works as expected:The same happens when using
DISTINCTROW
instead ofDISTINCT
too, of course.The parser doesn't recognize that they are equivalent, and thinks DISTINCT with parentheses is a SQL function to be pushed down, bypassing the special planbuilder handling for DISTINCT.
The text was updated successfully, but these errors were encountered: