Module: Alf::Algebra::Operand

Included in:
Fake, Named, Proxy, Operator, Relation, Relvar
Defined in:
lib/alf/algebra/operand.rb,
lib/alf/algebra/operand/fake.rb,
lib/alf/algebra/operand/named.rb,
lib/alf/algebra/operand/proxy.rb

Defined Under Namespace

Classes: Fake, Named, Proxy

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.coerce(op) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/alf/algebra/operand.rb', line 5

def self.coerce(op)
  case op
  when Operand     then op
  when Symbol      then Operand::Named.new(op)
  when Reader      then Proxy.new(op)
  when Array       then Proxy.new(op)
  when Engine::Cog then Proxy.new(op)
  when TupleLike   then Proxy.new([op])
  else
    who = op.inspect
    who = "#{who[0..20]}..." if who.size>20
    raise TypeError, "Invalid relational operand `#{who}`"
  end
end

Instance Method Details

#attr_listObject


26
27
28
# File 'lib/alf/algebra/operand.rb', line 26

def attr_list
  heading.to_attr_list
end

#headingObject

Static analysis & inference

Raises:


22
23
24
# File 'lib/alf/algebra/operand.rb', line 22

def heading
  raise NotSupportedError, "Heading inference unsupported on `#{self}`"
end

#keysObject

Raises:


30
31
32
# File 'lib/alf/algebra/operand.rb', line 30

def keys
  raise NotSupportedError, "Key inference unsupported on `#{self}`"
end

#resulting_typeObject


38
39
40
# File 'lib/alf/algebra/operand.rb', line 38

def resulting_type
  Relation[heading]
end

#to_ascii_tree(buffer = "") ⇒ Object


52
53
54
# File 'lib/alf/algebra/operand.rb', line 52

def to_ascii_tree(buffer = "")
  Support::Tree.new(self).to_text(buffer)
end

#to_cog(plan = nil) ⇒ Object

to_xxx

Raises:


44
45
46
# File 'lib/alf/algebra/operand.rb', line 44

def to_cog(plan = nil)
  raise NotSupportedError, "Compilation unsupported on `#{self}`"
end

#to_relationObject


48
49
50
# File 'lib/alf/algebra/operand.rb', line 48

def to_relation
  to_cog.to_relation
end

#type_check(options = {strict: false}) ⇒ Object


34
35
36
# File 'lib/alf/algebra/operand.rb', line 34

def type_check(options = {strict: false})
  heading
end