Sha256: 2350f0fd760d203e1cf65760c9758e622599b4ae72bf3fbf94586ef32ff63633

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module Embulk
  module Input
    class Presto < InputPlugin
      class ExplainParser
        def self.parse(explain_result)
          explain_text = explain_result.flatten.last.lines.first
          column_name_raw, column_type_raw = explain_text.split(' => ')
          names = column_name_raw.split('[').last.split(']').first.split(',').map{ |name| name.strip }
          types = column_type_raw.split('[').last.split(']').first.split(',').map{ |info| info.split(':').last }
          Hash[*names.zip(types).flatten]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
embulk-input-presto-0.2.0 lib/embulk/input/presto/explain_parser.rb