You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/03/27 03:46:44 UTC

[GitHub] [druid] benkrug opened a new issue #11038: sql LOOKUP() failure when filtering on a key value that is not present in the lookup

benkrug opened a new issue #11038:
URL: https://github.com/apache/druid/issues/11038


   LOOKUP() bombs when you add a WHERE on the key, and you specify something that's not in the lookup table.
   
   I have a small lookup, "myLookup", with this map:
   
   ```
   {
     "#ar.wikipedia": "wikipedia lookup value"
   }
   ```
   
   and loaded wikipedia.  This query works:
   
   ```
   SELECT channel, LOOKUP(channel, 'myLookup')
   FROM wikipedia
   WHERE channel = '#ar.wikipedia'
   ```
   
   This gives an error:
   
   ```
   SELECT channel, LOOKUP(channel, 'myLookup')
   FROM wikipedia
   WHERE channel = 'test'
   ```
   
   The error is:
   
   ```
   javax.servlet.ServletException: java.lang.AssertionError: Cannot add expression of different type to set: set type is RecordType(VARCHAR channel, VARCHAR NOT NULL EXPR$1) NOT NULL expression type is RecordType(VARCHAR channel, VARCHAR EXPR$1) NOT NULL set is rel#6110:LogicalProject.NONE.[](input=HepRelVertex#6109,channel=$0,EXPR$1=LOOKUP($0, &apos;myLookup&apos;)) expression is LogicalProject(channel=[CAST(&apos;test&apos;:VARCHAR):VARCHAR], EXPR$1=[null:VARCHAR]) LogicalFilter(condition=[=($0, &apos;test&apos;)]) LogicalProject(channel=[$1]) LogicalTableScan(table=[[druid, wikipedia]])
   ```
   
   The same logic will work as a JOIN, and properly return no results:
   
   ```
   SELECT channel, v
   FROM wikipedia
   JOIN lookup.myLookup
   ON channel = k
   WHERE channel = 'test'
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] clintropolis closed issue #11038: sql LOOKUP() failure when filtering on a key value that is not present in the lookup

Posted by GitBox <gi...@apache.org>.
clintropolis closed issue #11038:
URL: https://github.com/apache/druid/issues/11038


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org