Class: Locomotive::RelationalAlgebra::RowNum
- Inherits:
-
Numbering
- Object
- RelAlgAstNode
- Operator
- Unary
- Numbering
- Locomotive::RelationalAlgebra::RowNum
- Defined in:
- lib/locomotive/relational_algebra/operators/ranking/row_number.rb
Instance Attribute Summary collapse
-
#part ⇒ Object
Returns the value of attribute part.
Attributes inherited from Numbering
Attributes inherited from Operator
Attributes included from AstHelpers::AstNode
#kind, #left_child, #owner, #right_child, #value
Instance Method Summary collapse
- #child=(op) ⇒ Object
- #clone ⇒ Object
-
#initialize(op, res, part, sortby) ⇒ RowNum
constructor
A new instance of RowNum.
- #set(var, plan) ⇒ Object
- #xml_content ⇒ Object
Methods inherited from Operator
#bound, #free, #to_xml, #xml_kind, #xml_schema
Methods included from XML
Methods included from AstHelpers::Annotations
Methods included from AstHelpers::AstNode
#has_left_child?, #has_right_child?, #is_leaf?, #traverse, #traverse_strategy=
Constructor Details
#initialize(op, res, part, sortby) ⇒ RowNum
Returns a new instance of RowNum.
11 12 13 14 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 11 def initialize(op, res, part, sortby) self.part = part super(op,res,sortby) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::AstHelpers::Annotations
Instance Attribute Details
#part ⇒ Object
Returns the value of attribute part.
8 9 10 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 8 def part @part end |
Instance Method Details
#child=(op) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 16 def child=(op) unless op.schema.attributes?(part) raise CorruptedSchema, "Schema #{op.schema.attributes} does not " \ "contain all attributes of #{part}." end super(op) end |
#clone ⇒ Object
39 40 41 42 43 44 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 39 def clone RowNum.new(child.clone, res.clone, part.clone, sort_by.clone) end |
#set(var, plan) ⇒ Object
46 47 48 49 50 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 46 def set(var,plan) RowNum.new( child.set(var,plan), res.clone, part.clone, sort_by.clone) end |
#xml_content ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/locomotive/relational_algebra/operators/ranking/row_number.rb', line 25 def xml_content pos = -1 content do [column(:name => res.to_xml, :new => true), sort_by.to_xml, part.collect do |p| column :name => p.to_xml, :function => :partition, :position => pos += 1, :new => false end.join].join end end |