Class: Trinamo::HdfsConverter

Inherits:
BaseConverter show all
Defined in:
lib/trinamo/converter/hdfs_converter.rb

Instance Attribute Summary

Attributes inherited from BaseConverter

#ddl, #ddl_yaml_path

Instance Method Summary collapse

Methods inherited from BaseConverter

#initialize

Constructor Details

This class inherits a constructor from Trinamo::BaseConverter

Instance Method Details

#convertObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/trinamo/converter/hdfs_converter.rb', line 5

def convert
  ddl_body = @ddl[:tables].map do |h|
    fields = ([h[:hash_key]] + [h[:range_key]] + [h[:attributes]]).flatten.compact
    "      -- \#{h[:name]}_hdfs\n      CREATE TABLE \#{h[:name]}_hdfs (\n        \#{fields.map { |attr| \"\#{attr[:name]} \#{attr[:type].upcase}\" }.join(',')}\n      );\n    DDL\n  end\n\n  ddl_body.join(\"\\n\")\nend\n".unindent