Reflections are not used if accessed from virtual table

I have a virtual table (call it table_a) that represents a query that is querying other tables with raw and aggregate reflections. If I go into EDIT original SQL for table_a and add:

SELECT COUNT(*) FROM (

rest of table_a query

)

Then it uses the reflections and the query runs quickly. However if I simply run:

SELECT COUNT(*) FROM table_a

then the reflections are not used.

This behavior is totally unexpected.

Can you please provide us profiles for both queries (https://www.dremio.com/tutorials/share-query-profile-dremio/) so we can see what is going on.

I’ll PM you and summarize any resolution here as the metadata may contain sensitive information.

Updating here for posterity, the only proposed solution was to upgrade dremio :confused: