Gwildor opened a new issue, #36676:
URL: https://github.com/apache/superset/issues/36676

   ### Bug description
   
   We use Google BigQuery, and have enabled the setting to require partition 
filters (on a date column) on our tables, as our tables have multiple years of 
data, with billions of rows. Generally, users only want to see the last few 
weeks or months, and scanning the full table is both costly and can actually 
cause Superset to freeze as the queries take too long to execute.
   
   Requiring the partition filter works, and we get a nice error screen when 
the user has not added this filter on this chart. We have set the default 
datetime column, and also enabled the `DEFAULT_TIME_FILTER` setting. This all 
works really well.
   
   Unfortunately though, filtering on text columns now doesn't give a nice UI 
with the available values in the filter box. This is because the query that 
Superset generates to retrieve those values does not use the date filter set by 
the user or the `DEFAULT_TIME_FILTER` setting, and thus BigQuery rejects it 
because it is missing the partition filter. Users can still manually enter the 
values they want to see, but this is hard if you don't know beforehand which 
values are available. Without the required partition filter, the queries to 
retrieve these values would often take way too long, and would cause Superset 
to become unstable.
   
   Likewise such filters break on dashboard filter sets. However, here you can 
configure the filter to be dependent on the other time filter (if configured), 
and this works pretty well. This is something we just need to explain to our 
users, although the error message if you don't do this could be nicer.
   
   I think that when creating charts, the filter box should adhere to the other 
filters that are already configured on the chart, so you can really narrow down 
on the values that you want to select. Especially if they are time filters. 
That would solve both the required partition filter, as well as the case that 
the query would timeout because a full scan of the table would take too long.
   
   ### Screenshots/recordings
   
   <img width="383" height="383" alt="Image" 
src="https://github.com/user-attachments/assets/4e63b4e6-efda-4006-882a-9f26f32f7c7d";
 />
   
   Generated query:
   
   ```sql
   SELECT DISTINCT `readable_brand_name` AS `column_values` 
   FROM (SELECT * FROM `clicks`
   ) AS `virtual_table`
    LIMIT 10000
   ```
   
   BigQuery error (UI doesn't show it, it just shows no values to select):
   
   > Cannot query over table 'clicks' without a filter over column(s) 
'event_date_cet' that can be used for partition elimination
   
   On dashboards:
   
   <img width="261" height="219" alt="Image" 
src="https://github.com/user-attachments/assets/736b9a95-3bc5-4835-8dfa-79fdc436db80";
 />
   
   With the generic error:
   
   > Network error: Network error while attempting to fetch resource
   
   But this works really well if you make the filter dependent on the time 
filter:
   
   <img width="879" height="592" alt="Image" 
src="https://github.com/user-attachments/assets/9a4ec492-abd5-4ebe-b829-416bd8aa7ad1";
 />
   
   Generated query:
   
   ```sql
   SELECT `readable_brand_name` AS `readable_brand_name` 
   FROM (SELECT * FROM `clicks`
   ) AS `virtual_table` 
   WHERE `event_date_cet` >= CAST('2025-09-16' AS DATE) AND `event_date_cet` < 
CAST('2025-12-16' AS DATE) GROUP BY `readable_brand_name` ORDER BY 
`readable_brand_name` ASC
    LIMIT 1000
   ```
   
   Something like this would be nice for when creating a chart as well.
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   16
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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.

To unsubscribe, e-mail: [email protected]

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