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

fix: do not allow GROUP BY and PARTITION BY on boolean expressions #4940

Conversation

big-andy-coates
Copy link
Contributor

Description

fixes: #4939

Change to SQL syntax to not allow GROUP BY and PARTITION BY on boolean expressions. Only value expressions will be allowed.

Testing done

usual

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

fixes: confluentinc#4939

Change to SQL syntax to not allow GROUP BY and PARTITION BY on boolean expressions. Only value expressions will be allowed.
@big-andy-coates big-andy-coates requested a review from a team as a code owner March 30, 2020 19:53
@big-andy-coates big-andy-coates merged commit d84d2d1 into confluentinc:master Mar 30, 2020
@big-andy-coates big-andy-coates deleted the group_partition_by_value_expression branch March 30, 2020 23:26
@blueedgenick
Copy link
Contributor

oh this is an interesting one - i had to go do some digging to figure out what i expect to happen. Seems like the answer is that it's not the boolean expresson per se which is the problem, but "only" that we don't have a proper datatype for it's return value or a way to cast it to a 0/1 or "true"/"false" or other truthy value, right ? If we did then the output of the group by, for example, should have two groups: one for true and one for false.
Experiments suggest that mysql does some odd auto-casting thing and allows this to work (which i'm not a big fan of) whereas systems like postgres have a proper datatype they will automatically use, and so it works there too.
Perhaps, similar to Almog's suggestion on 4942, it might actually be better ux to leave the grammar as-is and throw a super-specific message from the analyzer instead until such time as we play nicer with bool types ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CodeGen error on GROUP BY or PARTITION BY boolean expression
3 participants