bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

Join bug with explicit column refs #181

Closed neilconway closed 13 years ago

neilconway commented 13 years ago

Test case:

require "rubygems"
require "bud"

class TestJoinExplicitPreds
  include Bud

  state do
    table :t1
    table :t2
    table :t3
  end

  bootstrap do
    t1 << [1,2]
    t2 << [3,4]
  end

  bloom do
    t3 <= (t1 * t2).pairs(t2.key => t2.val)
  end
end

TestJoinExplicitPreds.new.tick

Result:

/Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:678:in `stratum_fixpoint': Exception during Bud evaluation. (Bud::BudError)
Exception: #<Bud::BudError: join predicates don't match tables being joined: [[[:t2, 0, :key], [:t2, 1, :val]]]>.
Rule: t3 <= ((t1 * t2).pairs(t2.key => (t2.val)))
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:155:in `each_with_index'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:662:in `each'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:662:in `each_with_index'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:662:in `stratum_fixpoint'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:580:in `tick'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:155:in `each_with_index'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:580:in `each'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:580:in `each_with_index'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p334/gems/bud-0.0.4/lib/bud.rb:580:in `tick'
    from /Users/neilc/t.rb:23
jhellerstein commented 13 years ago

working on it

jhellerstein commented 13 years ago

fixed in 4e2485e9a170909db4414525603d76efe4483d86 and test checked into tc_joins.rb