You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cube_query.rb
    path of file: ./repos/activecube/lib/activecube/query
    
    the code of the file until where you have to start completion: require 'activecube/query/chain_appender'
require 'activecube/query/item'
require 'activecube/query/limit'
require 'activecube/query/limit_by'
require 'activecube/query/measure'
require 'activecube/query/ordering'
require 'activecube/query/option'
require 'activecube/query/selector'
require 'activecube/query/slice'

require 'activecube/processor/composer'

module Activecube::Query
  class CubeQuery
    include ChainAppender

    attr_reader :cube, :slices, :measures, :selectors, :options, :tables, :sql
    attr_accessor :stats

    def initialize(cube, slices = [], measures = [], selectors = [], options = []
    
    def column_names_required(measures = self.measures)
      (measures + slices + selectors.select do |s|
                             !s.is_a?(Selector::CombineSelector)
                           end).map(&:required_column_names).flatten.uniq
    end

    def selector_column_names(measures = self.measures)
      (measures.map(&:selectors) + slices.map(&:selectors) + selectors).flatten.select(&:is_indexed?).map(&:required_column_names).flatten.uniq
    end

    def join_fields
      slices.map(&:group_by_columns).flatten.uniq
    end

    def orderings
      options.select { |s| s.is_a? Ordering }
    end

    private

    def clear_sql
      @composed = nil
    end
  end