You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Sameh Samra <sa...@gmail.com> on 2015/11/27 14:45:09 UTC

change SQL after parsing

Hi,
Calcite parser parses select statement to SqlSelect class which gives
ability to set (selectList/ from/ where) clauses. While I was looking for
examples I found this message (Parsing SQL) by Renato Marroquín Mogrovejo
in February 2015 archive
<http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/browser>.
Moreover, your reply was there are multiple ways to modify sql after
parsing.

Actually, I want to edit sql queries by:
  1- adding some conditions in where clause.
  2- adding a table to from clause.

Our queries have some little bit complication; that means nested,
sub-queries and union. Further, we want to add the modifications in a
certain parts.

Are there other methods better than using SqlSelect class?

Thank you in advance
SSamra

Re: change SQL after parsing

Posted by Julian Hyde <jh...@apache.org>.
As I said in http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/%3CAD859A7F-5F9E-4998-A749-7216674A8EA7%40hydromatic.net%3E the best approach is not to work on the AST (SqlSelect) but instead work on the algebra (RelNode) using planner rules.

Julian

> On Nov 27, 2015, at 5:45 AM, Sameh Samra <sa...@gmail.com> wrote:
> 
> Hi,
> Calcite parser parses select statement to SqlSelect class which gives
> ability to set (selectList/ from/ where) clauses. While I was looking for
> examples I found this message (Parsing SQL) by Renato Marroquín Mogrovejo
> in February 2015 archive
> <http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/browser>.
> Moreover, your reply was there are multiple ways to modify sql after
> parsing.
> 
> Actually, I want to edit sql queries by:
>  1- adding some conditions in where clause.
>  2- adding a table to from clause.
> 
> Our queries have some little bit complication; that means nested,
> sub-queries and union. Further, we want to add the modifications in a
> certain parts.
> 
> Are there other methods better than using SqlSelect class?
> 
> Thank you in advance
> SSamra


Re: change SQL after parsing

Posted by Julian Hyde <jh...@apache.org>.
Which email did you think was lost? I can see your email of 11/27, my reply of 11/28, and the 2/23 previous message.

By the way, your emails get stuck in moderation for a while because you have not joined the dev list. Please join the list.

Julian

[1] http://mail-archives.apache.org/mod_mbox/calcite-dev/201511.mbox/%3CCAAXgtx%3DssDE%3D%2BYtqSzRkV7pDxZ%2BVeG4XZdo98Dk9-NM7y_tJ%2BQ%40mail.gmail.com%3E

[2] http://mail-archives.apache.org/mod_mbox/calcite-dev/201511.mbox/%3CE372D458-A954-46F4-9DAF-96B8DE3B52C4@apache.org%3E

[3] http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/%3CAD859A7F-5F9E-4998-A749-7216674A8EA7%40hydromatic.net%3E

> On Dec 3, 2015, at 3:19 AM, Sameh Samra <sa...@gmail.com> wrote:
> 
> Was this email  lost?
> I can't find it in your archive
> Thanks
> 
> 
> From: Sameh Samra <sa...@gmail.com>
> Date: Fri, Nov 27, 2015 at 3:45 PM
> Subject: change SQL after parsing
> To: dev@calcite.apache.org
> 
> 
> Hi,
> Calcite parser parses select statement to SqlSelect class which gives
> ability to set (selectList/ from/ where) clauses. While I was looking for
> examples I found this message (Parsing SQL) by Renato Marroquín Mogrovejo
> in February 2015 archive
> <http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/browser>.
> Moreover, your reply was there are multiple ways to modify sql after
> parsing.
> 
> Actually, I want to edit sql queries by:
>  1- adding some conditions in where clause.
>  2- adding a table to from clause.
> 
> Our queries have some little bit complication; that means nested,
> sub-queries and union. Further, we want to add the modifications in a
> certain parts.
> 
> Are there other methods better than using SqlSelect class?
> 
> Thank you in advance
> SSamra
> 
> 
> 
> -- 
> 
> -------------------------------------------
> ENG : Sameh Aly Abo Samra
> Computer & System Engineer


Fwd: change SQL after parsing

Posted by Sameh Samra <sa...@gmail.com>.
Was this email  lost?
I can't find it in your archive
Thanks


From: Sameh Samra <sa...@gmail.com>
Date: Fri, Nov 27, 2015 at 3:45 PM
Subject: change SQL after parsing
To: dev@calcite.apache.org


Hi,
Calcite parser parses select statement to SqlSelect class which gives
ability to set (selectList/ from/ where) clauses. While I was looking for
examples I found this message (Parsing SQL) by Renato Marroquín Mogrovejo
in February 2015 archive
<http://mail-archives.apache.org/mod_mbox/calcite-dev/201502.mbox/browser>.
Moreover, your reply was there are multiple ways to modify sql after
parsing.

Actually, I want to edit sql queries by:
  1- adding some conditions in where clause.
  2- adding a table to from clause.

Our queries have some little bit complication; that means nested,
sub-queries and union. Further, we want to add the modifications in a
certain parts.

Are there other methods better than using SqlSelect class?

Thank you in advance
SSamra



-- 

-------------------------------------------
ENG : Sameh Aly Abo Samra
Computer & System Engineer