This is due to the fact that for each primitive measure, we always prefetch their values for the scope of the query (done during the build of the query plan). What could be done instead but it would require some changes and might introduce more bugs is to never prefetch anything automatically and make primitive measures behave like computed measures. In MeasureEvaluator, instead of throwing an IllegalStateException, we might recopy the prefetch values in the final table result but we would need to pay attention to the conditions in the original query and apply them here, in AITM instead of letting the DB evaluating the conditions to give us the shape of the final result.
Related to #16.
Indeed, when trying to compute a comparison
Theoretically, the measure
m
only requires to prefetch this scope:Measure
sales
.However, the way the query plan is build currently leads to:
Measures: count, sales.
Measure
sales
.This is due to the fact that for each primitive measure, we always prefetch their values for the scope of the query (done during the build of the query plan). What could be done instead but it would require some changes and might introduce more bugs is to never prefetch anything automatically and make primitive measures behave like computed measures. In
MeasureEvaluator
, instead of throwing an IllegalStateException, we might recopy the prefetch values in the final table result but we would need to pay attention to the conditions in the original query and apply them here, in AITM instead of letting the DB evaluating the conditions to give us the shape of the final result.