Class: Locomotive::RelationalAlgebra::QueryInformationNode
- Inherits:
-
Object
- Object
- Locomotive::RelationalAlgebra::QueryInformationNode
- Defined in:
- lib/locomotive/relational_algebra/query_information.rb,
lib/locomotive/relational_algebra/query_information.rb
Overview
Forward declaration
Instance Attribute Summary collapse
-
#column_structure ⇒ Object
Returns the value of attribute column_structure.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#plan ⇒ Object
Returns the value of attribute plan.
-
#side_effects ⇒ Object
Returns the value of attribute side_effects.
-
#surrogates ⇒ Object
Returns the value of attribute surrogates.
Instance Method Summary collapse
- #clone ⇒ Object
- #frag ⇒ Object
-
#initialize(plan, cs_structure, surrogates = nil, side_effects = nil, methods = {}) ⇒ QueryInformationNode
constructor
A new instance of QueryInformationNode.
Constructor Details
#initialize(plan, cs_structure, surrogates = nil, side_effects = nil, methods = {}) ⇒ QueryInformationNode
Returns a new instance of QueryInformationNode.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 478 def initialize(plan, cs_structure, surrogates=nil, side_effects=nil, methods={}) self.plan, self.column_structure, self.surrogates, self.side_effects = plan, to_cs_structure(cs_structure), to_surrogates(surrogates), to_side_effects(side_effects) unless self.plan.schema.attributes?(self.column_structure.items) then raise StandardError, "Queryplan doesn't contain all attributes of" \ " #{self.column_structure.items.inspect}" end self.methods = methods end |
Instance Attribute Details
#column_structure ⇒ Object
Returns the value of attribute column_structure.
466 467 468 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 466 def column_structure @column_structure end |
#methods ⇒ Object
Returns the value of attribute methods.
466 467 468 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 466 def methods @methods end |
#plan ⇒ Object
Returns the value of attribute plan.
466 467 468 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 466 def plan @plan end |
#side_effects ⇒ Object
Returns the value of attribute side_effects.
466 467 468 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 466 def side_effects @side_effects end |
#surrogates ⇒ Object
Returns the value of attribute surrogates.
466 467 468 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 466 def surrogates @surrogates end |
Instance Method Details
#clone ⇒ Object
520 521 522 523 524 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 520 def clone QueryInformationNode.new(plan, column_structure.clone, surrogates.clone) end |
#frag ⇒ Object
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/locomotive/relational_algebra/query_information.rb', line 493 def frag itbls_hash = {} column_structure. zip(1..column_structure.count).each do |c, i| cols_c = column_structure[i-1].column_structure.adapt itbls_c = surrogates.filter_and_adapt(c.items) q_c = plan.project({ Iter.new(1) => [Iter.new(1)], Pos.new(1) => [Pos.new(1)] }. merge( c.items.zip(cols_c.items). map do |old,new| [old,[new]] end.to_hash)) itbls_hash = itbls_hash.merge( { Item.new(i) => QueryInformationNode.new( q_c, cols_c, itbls_c) }) end SurrogateList.new( itbls_hash ) end |