Slim Bouguerra created SAMZA-2554:
-------------------------------------

             Summary: SQL Join Filter Handling is Broken when Table is remote 
and the condition has more than one expression
                 Key: SAMZA-2554
                 URL: https://issues.apache.org/jira/browse/SAMZA-2554
             Project: Samza
          Issue Type: Bug
          Components: sql
            Reporter: Slim Bouguerra


The current implementation of remote table join can not handle more than one 
condition.

Currently this will return wrong results silently by ignoring the filter 
expression.

As a first step we need to fail such query to start with and then add the 
support of 2 or more filter expression as part of the join condition.

Here is the test case 
org.apache.samza.test.samzasql.TestSamzaSqlRemoteTable#testSourceEndToEndWithKeyWithNullForeignKeysRightOuterJoin
{code:java}
String sql =
        "Insert into testavro.enrichedPageViewTopic "
            + "select pv.pageKey as __key__, pv.pageKey as pageKey, 
coalesce(null, 'N/A') as companyName,"
            + "       p.name as profileName, p.address as profileAddress "
            + " from  "
            + " testavro.PAGEVIEW as pv left outer join 
testRemoteStore.Profile.`$table` as p"
            + " on p.__key__ = pv.profileId and p.__key__ = pv.profileId + 1 
and  p.__key__ = pv.profileId - 1 ";

 String sql =
        "Insert into testavro.enrichedPageViewTopic "
            + "select pv.pageKey as __key__, pv.pageKey as pageKey, 
coalesce(null, 'N/A') as companyName,"
            + "       p.name as profileName, p.address as profileAddress "
            + " from  "
            + " testavro.PAGEVIEW as pv left outer join 
testRemoteStore.Profile.`$table` as p"
            + " on p.__key__ = pv.profileId  ";

{code}
Both queries will return the same result and that is wrong



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to