Class: Piglet::Relation::Distinct

Inherits:
Object
  • Object
show all
Includes:
Relation
Defined in:
lib/piglet/relation/distinct.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes included from Relation

#sources

Instance Method Summary collapse

Methods included from Relation

#[], #alias, #cogroup, #cross, #distinct, #eql?, #field, #filter, #foreach, #group, #hash, #join, #limit, #method_missing, #nested_foreach, #next_field_alias, #order, #sample, #schema, #split, #stream, #union

Constructor Details

#initialize(relation, interpreter, options = {}) ⇒ Distinct

Returns a new instance of Distinct.



8
9
10
11
# File 'lib/piglet/relation/distinct.rb', line 8

def initialize(relation, interpreter, options={})
  options ||= {}
  @sources, @interpreter, @parallel = [relation], interpreter, options[:parallel]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Piglet::Relation::Relation

Instance Method Details

#to_sObject



13
14
15
16
17
# File 'lib/piglet/relation/distinct.rb', line 13

def to_s
  str  = "DISTINCT #{@sources.first.alias}"
  str << " PARALLEL #{@parallel}" if @parallel
  str
end