Class: Bud::BudCollExpr

Inherits:
BudReadOnly show all
Defined in:
lib/bud/collections.rb

Overview

:nodoc: all

Instance Attribute Summary

Attributes inherited from BudCollection

#accumulate_tick_deltas, #bud_instance, #cols, #invalidated, #is_source, #key_cols, #new_delta, #pending, #rescan, #scanner_cnt, #struct, #tabname, #wired_by

Instance Method Summary collapse

Methods inherited from BudReadOnly

#invalidate_at_tick, #invalidate_cache, #merge

Methods inherited from BudCollection

#*, #<<, #<=, #[], #add_rescan_invalidate, #argagg, #argmax, #argmin, #bootstrap, #canonicalize_col, #close, #do_insert, #each_delta, #each_tick_delta, #each_with_index, #empty?, #exists?, #flat_map, #flush, #flush_deltas, #group, #has_key?, #include?, #init_schema, #insert, #inspect, #inspected, #invalidate_at_tick, #keys, #length, #merge, #non_temporal_predecessors, #notin, #null_tuple, #pending_merge, #positive_predecessors, #prep_aggpairs, #pro, #qualified_tabname, #reduce, #register_coll_expr, #rename, #schema, #sort, #tick_deltas, #tick_metrics, #to_push_elem, #uniquify_tabname, #val_cols, #values

Methods included from Enumerable

#pro

Constructor Details

#initialize(name, bud_instance, expr, given_schema = nil, defer_schema = false) ⇒ BudCollExpr



1354
1355
1356
1357
1358
# File 'lib/bud/collections.rb', line 1354

def initialize(name, bud_instance, expr, given_schema=nil, defer_schema=false)
  super(name, bud_instance, given_schema, defer_schema)
  @expr = expr
  @invalidated = true
end

Instance Method Details

#each(&block) ⇒ Object



1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
# File 'lib/bud/collections.rb', line 1365

def each(&block)
  v = @expr.call
  return if v.nil? or v == [nil]

  # XXX: Gross hack. We want to support RHS expressions that do not
  # necessarily return BudCollections (they might instead return lattice
  # values or hashes). Since it isn't easy to distinguish between these two
  # cases statically, instead we just always use CollExpr; at runtime, if
  # the value doesn't look like a traditional Bloom collection, we don't try
  # to break it up into tuples.
  if v.class <= Array || v.class <= BudCollection
    v.each(&block)
  else
    yield v
  end
end

#each_raw(&block) ⇒ Object



1383
1384
1385
# File 'lib/bud/collections.rb', line 1383

def each_raw(&block)
  each(&block)
end

#tickObject



1360
1361
1362
# File 'lib/bud/collections.rb', line 1360

def tick
  @invalidated = true
end