docs: private Query computeQuery()
    {
      if (dataSource instanceof QueryDataSource) {
        // If there is a subquery then the outer query must be a groupBy.
        final GroupByQuery outerQuery = toGroupByQuery();
  
        if (outerQuery == null) {
          // Bug in the planner rules. They shouldn't allow this to happen.
          throw new IllegalStateException("Can't use QueryDataSource without an outer groupBy query!");
        }
  
        return outerQuery;
      }
  
      final TimeseriesQuery tsQuery = toTimeseriesQuery();
      if (tsQuery != null) {
        return tsQuery;
      }
  
      final TopNQuery topNQuery = toTopNQuery();
      if (topNQuery != null) {
        return topNQuery;
      }
  
      final GroupByQuery groupByQuery = toGroupByQuery();
      if (groupByQuery != null) {
        return groupByQuery;
      }
  
      final ScanQuery scanQuery = toScanQuery();
      if (scanQuery != null) {
        return scanQuery;
      }
  
      throw new CannotBuildQueryException("Cannot convert query parts into an actual query");
    }