bud 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.9.4 / 2012-09-06
2
+
3
+ * Optimize grouping performance
4
+ * Fix regression in dbm-backed collections with MRI 1.8
5
+ * Fix regression in grouping operator with MRI 1.8 (#280)
6
+ * Fix bug in programs that applied non-monotonic operators to scratch
7
+ collections under certain circumstances (#281)
8
+ * Fix bug in "notin" with multiple qualifiers (#282)
9
+
1
10
  == 0.9.3 / 2012-08-20
2
11
 
3
12
  * Change behavior of accum() aggregate to return a Set, rather than an Array in
data/lib/bud.rb CHANGED
@@ -466,16 +466,13 @@ module Bud
466
466
  rescan_invalidate_tc(stratum, rescan, invalidate)
467
467
  end
468
468
 
469
- puts "(PRE) Default rescan: #{rescan.inspect}" if $BUD_DEBUG
470
- puts "(PRE) Default inval: #{invalidate.inspect}" if $BUD_DEBUG
471
-
472
469
  prune_rescan_invalidate(rescan, invalidate)
473
470
  # transitive closure
474
471
  @default_rescan = rescan.to_a
475
472
  @default_invalidate = invalidate.to_a
476
473
 
477
- puts "(POST) Default rescan: #{rescan.inspect}" if $BUD_DEBUG
478
- puts "(POST) Default inval: #{invalidate.inspect}" if $BUD_DEBUG
474
+ puts "Default rescan: #{rescan.inspect}" if $BUD_DEBUG
475
+ puts "Default inval: #{invalidate.inspect}" if $BUD_DEBUG
479
476
 
480
477
  # Now compute for each table that is to be scanned, the set of dependent
481
478
  # tables and elements that will be invalidated if that table were to be
@@ -254,6 +254,11 @@ module Bud
254
254
  @storage.each_value(&block)
255
255
  end
256
256
 
257
+ public
258
+ def each_tick_delta(&block)
259
+ @tick_delta.each(&block)
260
+ end
261
+
257
262
  public
258
263
  def invalidate_at_tick
259
264
  true # being conservative here as a default.
@@ -566,16 +571,16 @@ module Bud
566
571
  public
567
572
  def tick_deltas # :nodoc: all
568
573
  unless @delta.empty?
569
- puts "#{qualified_tabname}.tick_delta delta --> storage (#{@delta.size} elems)" if $BUD_DEBUG
574
+ puts "#{qualified_tabname}.tick_deltas delta --> storage (#{@delta.size} elems)" if $BUD_DEBUG
570
575
  @storage.merge!(@delta)
571
576
  @tick_delta.concat(@delta.values) if accumulate_tick_deltas
572
577
  @delta.clear
573
578
  end
574
579
 
575
580
  unless @new_delta.empty?
576
- puts "#{qualified_tabname}.tick_delta new_delta --> delta (#{@new_delta.size} elems)" if $BUD_DEBUG
581
+ puts "#{qualified_tabname}.tick_deltas new_delta --> delta (#{@new_delta.size} elems)" if $BUD_DEBUG
577
582
 
578
- # NB: key conflicts between different new_delta tuples are detected in
583
+ # NB: key conflicts between two new_delta tuples are detected in
579
584
  # do_insert().
580
585
  @new_delta.each_pair do |key, tup|
581
586
  merge_to_buf(@delta, key, tup, @storage[key])
@@ -713,10 +718,18 @@ module Bud
713
718
  end
714
719
 
715
720
  class BudScratch < BudCollection # :nodoc: all
721
+ # We don't need to accumulate @tick_delta separately from @storage for
722
+ # scratch collections, since @storage for scratches doesn't persistent
723
+ # across ticks (semantics-wise, at least).
716
724
  def accumulate_tick_deltas
717
725
  false
718
726
  end
719
727
 
728
+ public
729
+ def each_tick_delta(&block)
730
+ @storage.each_value(&block)
731
+ end
732
+
720
733
  public
721
734
  def tick # :nodoc: all
722
735
  @delta.clear
@@ -808,10 +821,9 @@ module Bud
808
821
  end
809
822
 
810
823
  def bootstrap
811
- # override BudCollection; pending should not be moved into delta.
824
+ # override BudCollection; pending should not be moved into delta.
812
825
  end
813
826
 
814
-
815
827
  private
816
828
  def remove_at_sign!(cols)
817
829
  i = cols.find_index {|c| c.to_s.start_with? "@"}
@@ -492,7 +492,7 @@ module Bud
492
492
  else
493
493
  # In the first iteration, tick_delta would be non-null IFF the
494
494
  # collection has grown in an earlier stratum
495
- @collection.tick_delta.each {|item| push_out(item)}
495
+ @collection.each_tick_delta {|item| push_out(item)}
496
496
  end
497
497
  end
498
498
 
@@ -35,7 +35,7 @@ module Bud
35
35
  end
36
36
 
37
37
  @seen_new_data = true
38
- key = @keys.map{|k| item[k]}
38
+ key = item.values_at(*@keys)
39
39
  group_state = @groups[key]
40
40
  if group_state.nil?
41
41
  @groups[key] = @aggpairs.map do |ap|
@@ -71,14 +71,12 @@ module Bud
71
71
  return unless @seen_new_data
72
72
  @seen_new_data = false
73
73
 
74
- @groups.each do |g, grps|
75
- grp = @keys == $EMPTY ? [[]] : [g]
74
+ @groups.each do |key, group_state|
75
+ rv = key.clone
76
76
  @aggpairs.each_with_index do |ap, agg_ix|
77
- grp << ap[0].final(grps[agg_ix])
77
+ rv << ap[0].final(group_state[agg_ix])
78
78
  end
79
- outval = grp[0].flatten
80
- (1..grp.length-1).each {|i| outval << grp[i]}
81
- push_out(outval)
79
+ push_out(rv)
82
80
  end
83
81
  end
84
82
  end
@@ -552,10 +552,10 @@ module Bud
552
552
  # the tables.
553
553
  @lhs_keycols, @rhs_keycols = preds.reduce([[], []]) do |memo, item|
554
554
  # each item is a hash
555
- l = item.keys[0]
556
- r = item.values[0]
557
- memo[0] << find_col(l, @lhs)
558
- memo[1] << find_col(r, @rhs)
555
+ item.each_pair do |l, r|
556
+ memo[0] << find_col(l, @lhs)
557
+ memo[1] << find_col(r, @rhs)
558
+ end
559
559
  memo
560
560
  end
561
561
  end
@@ -147,7 +147,7 @@ module Bud
147
147
  # We allow @new_delta to contain duplicates but eliminate them here. We
148
148
  # can't just allow duplicate delta tuples because that might cause
149
149
  # spurious infinite delta processing loops.
150
- @new_delta.reject! {|key| self[key] == @new_delta[key]}
150
+ @new_delta.reject! {|key, val| self[key] == val}
151
151
 
152
152
  @delta = @new_delta
153
153
  @new_delta = {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-08-20 00:00:00.000000000 Z
16
+ date: 2012-09-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: eventmachine