-
Notifications
You must be signed in to change notification settings - Fork 59
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
[DAPHNE-#494] SQLParser: Group by without aggregation clause not working #543
Conversation
- The shape inference for GroupOp did indeed have a bug, but this was not the right fix (using inferNumColsFromArgs() was generally wrong). - Simplified the new test case for GROUP BY without aggregation.
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.
Thanks @tomschw, this contribution fixes the bug. I polished it just a bit.
There was indeed also a bug in the shape inference of GroupOp
, but the problem there was not to check if the list of aggregation columns is empty. The actual problem was the use of inferNumColsFromArgs()
, a shape inference helper function not suitable for this case. Instead, one should just take the size()
of the list of key columns and aggregation columns. I adjusted it accordingly.
…teToCallKernelOpPass. - Some DaphneIR operations have variadic operands, i.e., operands which can occur an arbitrary number of times (including zero). - When lowering DaphneIR operations to the DaphneIR CallKernelOp, this poses a problem as the C++ kernels cannot be pre-compiled for any number of operands. - Thus, the kernels expect an array of operands (pointer plus size); in DaphneIR this is represented by a value of type daphne::VariadicPack, which stores all occurrences of a variadic operand. - So RewriteToCallKernelOpPass needs to convert variadic operands of DaphneIR operations to DaphneIR's VariadicPack. - In the past there have been problems in case of variadic operands with zero occurrences. - As GroupOp was the only problematic op so far, a workaround has been provided in PRs #564 and #543. - This commit improves the treatment of variadic operands with zero occurrences in RewriteToCallKernelOpPass: - First, the code is more general now and clearly expresses that this problem is not about GroupOp, but about instances of ops with variadic operands with zero occurrences, in general. - Second, the code for treating individual such ops is significantly simpler and more extensible now, since one only has to provide a default MLIR type for the variadic operand. - Furthermore, a simplified version of the example DaphneDSL code mentioned in issue #562, that failed before PR #564, was added as a test case now.
Fixed problem:
Changes:
Other possible solutions instead of the current workaround:
As the Kernel lowering should be reworked in the future anyway, the current workaround should work fine for the moment.
Fixes #494.