You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Emmanuel Bastien <os...@ebastien.name> on 2016/05/13 08:09:47 UTC

Limit without order_by badly unparsed

Hello,

I would like to open a Jira issue to contribute a very simple fix on how to
unparse order_by clause with an empty column list.

The context of the problem is the validation of queries with a limit clause
but no order_by (e.g. "SELECT c FROM t LIMIT 2").

The problem does not show up at parsing time but when running a validator.
It seems that the generated AST includes an order_by operand with an empty
column list. My assumption when fixing the unparsing is that this AST is
legit but one might argue otherwise.

The fix and associated test case is available here:
https://github.com/ebastien/calcite/commit/c47e9da09bd7305d310af5650a378ca1301053a8

I would be happy to create a PR but it seems that I am not allowed to open
a Jira issue (username ebastien). What is the procedure to do so?

Kind regards,
Emmanuel

Re: Limit without order_by badly unparsed

Posted by Julian Hyde <jh...@apache.org>.
JIRA is locked down because of a spam storm. Only registered
contributors/committers can log JIRA cases or even comment on existing
cases. It's a pain, but necessary I'm afraid. Hopefully it won't last
long.

I've made you a contributor, so you should be able to log that JIRA case.

If anyone wants to be made a contributor, just ask. (Unless you're a spambot!)

By the way, I agree that you have found a bug, and the patch looks
good. Can you also add test cases for (1) a query with OFFSET but no
ORDER BY or FETCH, and (2) a query with UNION ALL and FETCH but no
ORDER BY. They should just work, but they're corner cases worth
checking.

On Fri, May 13, 2016 at 1:09 AM, Emmanuel Bastien <os...@ebastien.name> wrote:
> Hello,
>
> I would like to open a Jira issue to contribute a very simple fix on how to
> unparse order_by clause with an empty column list.
>
> The context of the problem is the validation of queries with a limit clause
> but no order_by (e.g. "SELECT c FROM t LIMIT 2").
>
> The problem does not show up at parsing time but when running a validator.
> It seems that the generated AST includes an order_by operand with an empty
> column list. My assumption when fixing the unparsing is that this AST is
> legit but one might argue otherwise.
>
> The fix and associated test case is available here:
> https://github.com/ebastien/calcite/commit/c47e9da09bd7305d310af5650a378ca1301053a8
>
> I would be happy to create a PR but it seems that I am not allowed to open
> a Jira issue (username ebastien). What is the procedure to do so?
>
> Kind regards,
> Emmanuel