You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2015/12/03 11:16:11 UTC

[jira] [Updated] (CALCITE-1003) Add Utility to convert RelNode to SqlNode

     [ https://issues.apache.org/jira/browse/CALCITE-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde updated CALCITE-1003:
---------------------------------
    Description: 
To track progress on Rel2Sql Converter.
Following is the email conversation that lead to this JIRA:

{quote}
On Wed, Dec 2, 2015 at 3:13 AM, Julian Hyde <jh...@apache.org> wrote:

    Yes, this would definitely be useful in Calcite. Thanks for offering.

    I would like to reduce the amount of code copy-pasted from the JdbcXxx relational expressions, but we can work on that after it is committed in and when there are some unit tests.

    Can you please create a JIRA case with an initial pull-request?

    I think the unit tests could be of the following form:

{code}
      @Test public void testScan() {
        final String sql = “select * from emp”;
        final String after = "SELECT *\n”
            + "FROM \”EMP\””;
        check(sql, after);
      }
{code}

    where “after” is the result of the round trip SQL => SqlNode => RelNode => SqlNode => SQL, and your utility is performing the 3rd “=>”.

    Julian

    > On Dec 1, 2015, at 12:28 AM, Amogh Margoor <am...@qubole.com> wrote:
    >
    > Hi,
    > We have an usecase where we need to just send back optimized query as SQL,
    > without executing it. So we needed an utility to convert RelNode back to
    > SQL, and found most of the logic to be in JDBCRel. As we needed it for non
    > JDBC source, we created an utility to do so:
    > https://github.com/amoghmargoor/incubator-calcite/blob/NEZ-52/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
    >
    > Utility is almost completely copy-pasted from JDBCRels with few fixes from
    > our side to make it work. If such utility will be useful in Calcite then
    > let us know, we can plan raising PRs with required UTs.
    >
    > Regards,
    > Amogh
{quote}

  was:
To track progress on Rel2Sql Converter.
Following is the email conversation that lead to this JIRA:

On Wed, Dec 2, 2015 at 3:13 AM, Julian Hyde <jh...@apache.org> wrote:

    Yes, this would definitely be useful in Calcite. Thanks for offering.

    I would like to reduce the amount of code copy-pasted from the JdbcXxx relational expressions, but we can work on that after it is committed in and when there are some unit tests.

    Can you please create a JIRA case with an initial pull-request?

    I think the unit tests could be of the following form:

      @Test public void testScan() {
        final String sql = “select * from emp”;
        final String after = "SELECT *\n”
            + "FROM \”EMP\””;
        check(sql, after);
      }

    where “after” is the result of the round trip SQL -> SqlNode -> RelNode -> SqlNode -> SQL, and your utility is performing the 3rd “->”.

    Julian

    > On Dec 1, 2015, at 12:28 AM, Amogh Margoor <am...@qubole.com> wrote:
    >
    > Hi,
    > We have an usecase where we need to just send back optimized query as SQL,
    > without executing it. So we needed an utility to convert RelNode back to
    > SQL, and found most of the logic to be in JDBCRel. As we needed it for non
    > JDBC source, we created an utility to do so:
    > https://github.com/amoghmargoor/incubator-calcite/blob/NEZ-52/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
    >
    > Utility is almost completely copy-pasted from JDBCRels with few fixes from
    > our side to make it work. If such utility will be useful in Calcite then
    > let us know, we can plan raising PRs with required UTs.
    >
    > Regards,
    > Amogh



> Add Utility to convert RelNode to SqlNode
> -----------------------------------------
>
>                 Key: CALCITE-1003
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1003
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Amogh Margoor
>            Assignee: Julian Hyde
>            Priority: Minor
>             Fix For: next
>
>
> To track progress on Rel2Sql Converter.
> Following is the email conversation that lead to this JIRA:
> {quote}
> On Wed, Dec 2, 2015 at 3:13 AM, Julian Hyde <jh...@apache.org> wrote:
>     Yes, this would definitely be useful in Calcite. Thanks for offering.
>     I would like to reduce the amount of code copy-pasted from the JdbcXxx relational expressions, but we can work on that after it is committed in and when there are some unit tests.
>     Can you please create a JIRA case with an initial pull-request?
>     I think the unit tests could be of the following form:
> {code}
>       @Test public void testScan() {
>         final String sql = “select * from emp”;
>         final String after = "SELECT *\n”
>             + "FROM \”EMP\””;
>         check(sql, after);
>       }
> {code}
>     where “after” is the result of the round trip SQL => SqlNode => RelNode => SqlNode => SQL, and your utility is performing the 3rd “=>”.
>     Julian
>     > On Dec 1, 2015, at 12:28 AM, Amogh Margoor <am...@qubole.com> wrote:
>     >
>     > Hi,
>     > We have an usecase where we need to just send back optimized query as SQL,
>     > without executing it. So we needed an utility to convert RelNode back to
>     > SQL, and found most of the logic to be in JDBCRel. As we needed it for non
>     > JDBC source, we created an utility to do so:
>     > https://github.com/amoghmargoor/incubator-calcite/blob/NEZ-52/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
>     >
>     > Utility is almost completely copy-pasted from JDBCRels with few fixes from
>     > our side to make it work. If such utility will be useful in Calcite then
>     > let us know, we can plan raising PRs with required UTs.
>     >
>     > Regards,
>     > Amogh
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)