lib/piglet/relation/relation.rb in piglet-0.2.3 vs lib/piglet/relation/relation.rb in piglet-0.2.4
- old
+ new
@@ -118,18 +118,16 @@
Split.new(self, yield(self)).shards
end
# STREAM
#
- # x.stream(x, 'cut -f 3') # => STREAM x THROUGH `cut -f 3`
- # x.stream([x, y], 'cut -f 3') # => STREAM x, y THROUGH `cut -f 3`
- # x.stream(x, 'cut -f 3', :schema => [%w(a int)]) # => STREAM x THROUGH `cut -f 3` AS (a:int)
- #
- #--
- #
- # TODO: how to handle DEFINE'd commands?
- def stream(relations, command, options={})
- raise NotSupportedError
+ # x.stream(:command => 'cut -f 3') # => STREAM x THROUGH `cut -f 3`
+ # x.stream(:cmd) # => STREAM x THROUGH cmd
+ # x.stream(y, :command => 'cut -f 3') # => STREAM x, y THROUGH `cut -f 3`
+ # x.stream(:cmd, :schema => [%w(a int)]) # => STREAM x THROUGH cmd AS (a:int)
+ def stream(*args)
+ fields, options = split_at_options(args)
+ Stream.new(self, fields, options)
end
# UNION
#
# x.union(y) # => UNION x, y
\ No newline at end of file