class Trinamo::HdfsConverter

Public Instance Methods

convert() click to toggle source
# 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
        <<-DDL.unindent
          -- #{Trinamo::Converter.remove_head_underscore(h[:name])}_hdfs
          CREATE TABLE #{Trinamo::Converter.remove_head_underscore(h[:name])}_hdfs (
            #{fields.map { |attr| "#{attr[:name]} #{attr[:type].upcase}" }.join(',')}
          );
        DDL
      end

      ddl_body.join("\n")
    end