Class: NoSE::Serialize::QueryPlanBuilder

Inherits:
Object
  • Object
show all
Includes:
Uber::Callable
Defined in:
lib/nose/serialize.rb

Overview

Reconstruct the steps of a query plan

Instance Method Summary collapse

Instance Method Details

#call(_, represented:, fragment:) ⇒ Object



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/nose/serialize.rb', line 557

def call(_, represented:, fragment:, **)
  workload = represented.workload

  if fragment['query'].nil?
    query = OpenStruct.new group: fragment['group']
    state = nil
  else
    query = Statement.parse fragment['query'], workload.model,
                            group: fragment['group']
    state = Plans::QueryState.new query, workload
  end

  plan = build_plan query, represented.cost_model, fragment
  add_plan_steps plan, workload, fragment['steps'], represented.indexes,
                 state

  plan
end