You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jin xing (JIRA)" <ji...@apache.org> on 2019/07/22 14:15:00 UTC

[jira] [Commented] (CALCITE-3207) Bug of 'JoinRelNode Convert SqlStatement'

    [ https://issues.apache.org/jira/browse/CALCITE-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890195#comment-16890195 ] 

jin xing commented on CALCITE-3207:
-----------------------------------

Hi [~wojustme]
I create a test like below

 
{code:java}
// RelToSqlConverterTest.java
@Test public void testSelectQueryWithGroupByHaving2() {
  String query = " select \"product\".\"product_id\"\n"
      + "    from \"product\"\n"
      + "    inner join \"sales_fact_1997\"\n"
      + "    on \"product\".\"product_id\" = \"sales_fact_1997\".\"product_id\""
      + "    and \"product\".\"product_name\" like 'apple'\n";
  sql(query);
}
{code}
 

The output is like below:

 
{code:java}
SELECT "t"."product_id"
FROM (SELECT "product_class_id", "product_id", "brand_name", "product_name", "SKU", "SRP", "gross_weight", "net_weight", "recyclable_package", "low_fat", "units_per_case", "cases_per_pallet", "shelf_width", "shelf_height", "shelf_depth", "product_name" LIKE 'apple' AS "$f15"
FROM "foodmart"."product") AS "t"
INNER JOIN "foodmart"."sales_fact_1997" ON "t"."product_id" = "sales_fact_1997"."product_id" AND "t"."$f15"

{code}
 

Seems different from your description. Could you please create a test case in RelToSqlConverterTest.java to illustrate your issue ?

 

> Bug of 'JoinRelNode Convert SqlStatement'
> -----------------------------------------
>
>                 Key: CALCITE-3207
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3207
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Xurenhe
>            Priority: Minor
>
> Hi all
> I have a problem when using calcite, which is 'relnode convert sql statement'
> example:
> ```
> Input relNode: 
> LogicalProject(name=[$1], score=[$4])
>  LogicalJoin(condition=[AND(=($0, $3), LIKE($0, 'lucy'))], joinType=[left])
>  LogicalTableScan(table=[[db0, user_table]])
>  LogicalTableScan(table=[[db0, score_table]])
> Expect output sql statement: 
> select name, score
> from user_table
> left join on score_table
> and name like 'lucy'
> ```
> this relNode cannot convert sql statement.
> I try to debug it, `org.apache.calcite.rel.rel2sql.SqlImplementor#convertConditionToSqlNode` may forgot to handle this case, which sqlKind is SqlKind.LIKE.
> If it is a bug, I am willing to fix it.
> Thanks.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)