Class: Piglet::Inout::Load

Inherits:
Object
  • Object
show all
Includes:
StorageTypes, Relation::Relation
Defined in:
lib/piglet/inout/load.rb

Overview

:nodoc:

Constant Summary

Constants included from StorageTypes

StorageTypes::LOAD_STORE_FUNCTIONS

Instance Attribute Summary

Attributes included from Relation::Relation

#sources

Instance Method Summary collapse

Methods included from StorageTypes

#resolve_load_store_function

Methods included from Relation::Relation

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

Constructor Details

#initialize(path, options = {}) ⇒ Load

Returns a new instance of Load.



9
10
11
12
# File 'lib/piglet/inout/load.rb', line 9

def initialize(path, options={})
  options ||= {}
  @path, @using, @schema = path, options[:using], options[:schema]
end

Dynamic Method Handling

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

Instance Method Details

#schemaObject



14
15
16
# File 'lib/piglet/inout/load.rb', line 14

def schema
  Piglet::Schema::Tuple.parse(@schema) if @schema
end

#to_sObject



18
19
20
21
22
23
# File 'lib/piglet/inout/load.rb', line 18

def to_s
  str  = "LOAD '#{@path}'"
  str << " USING #{resolve_load_store_function(@using)}" if @using
  str << " AS (#{schema_string})" if @schema
  str
end