glynnbailey opened a new issue #14131:
URL: https://github.com/apache/superset/issues/14131


   Hello,
   
   We have Superset connected to our Druid database and appear to be 
encountering a bug when creating a filter against a calculated column which is 
generated from a lookup.
   
   We have created a calculated column using a lookup like so, which links IDs 
to their associated names:
   ![Screenshot 2021-04-14 at 12 23 
14](https://user-images.githubusercontent.com/4014618/114704523-9c317a00-9d1e-11eb-9941-444e960f4914.png)
   
   We would then like to be able to filter using the names, so we have created 
a filter like so:
   ![Screenshot 2021-04-14 at 12 30 
26](https://user-images.githubusercontent.com/4014618/114704643-bec39300-9d1e-11eb-80fc-dc91ac836c2f.png)
   
   We can use the dropdown to view the first 1000 entries from the column 
(there is a hard coded limit) but as our lookup has over 1000 entries searching 
is required to find them. When running a search the request fails to load:
   ![Screenshot 2021-04-14 at 12 22 
38](https://user-images.githubusercontent.com/4014618/114704696-d00c9f80-9d1e-11eb-9478-e741f7253c82.png)
   
   The browser receives 400 error with the exception:
   Unknown exception (org.apache.calcite.tools.ValidationException): 
org.apache.calcite.runtime.CalciteContextException: From line 3, column 15 to 
line 3, column 27: Column 'campaign_name' not found in any table
   
   From the request details it appears that superset is searching as if 
campaign_name is a column in our dataset when it is not, it is a lookup so this 
query fails.
   <img width="837" alt="Screenshot 2021-04-14 at 12 22 59" 
src="https://user-images.githubusercontent.com/4014618/114706124-81600500-9d20-11eb-829f-dd626873e78c.png";>
   
   For these searches the generated query should be using the sql expression 
provided in the calculated column configuration and not just the column name 
from the filter configuration, such as this:
   
   SELECT $EXPRESSION
   FROM $DATASET
   WHERE $EXPRESSION LIKE '%$FILTER%'
   GROUP BY $EXPRESSION
   
   This query when ran against our druid data does return results we expect.
   
   
   ### Environment
   
   - superset version: Superset 1.0.1
   - python version: Python 3.7.9
   - node.js version: n/a
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [y] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [y] I have reproduced the issue with at least the latest released version 
of superset.
   - [y] I have checked the issue tracker for the same issue and I haven't 
found one similar.


-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to