Class: ArrowDataset::FileFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow-dataset/file-format.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resolve(format) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/arrow-dataset/file-format.rb', line 21

def resolve(format)
  case format
  when :arrow, :arrow_file, :arrow_streaming
    IPCFileFormat.new
  when :parquet
    ParquetFileFormat.new
  when :csv
    CSVFileFormat.new
  else
    available_formats = [
      :arrow,
      :arrow_file,
      :arrow_streaming,
      :parquet,
      :csv,
    ]
    message = "Arrow::Table load format must be one of ["
    message << available_formats.join(", ")
    message << "]: #{@options[:format].inspect}"
    raise ArgumentError, message
  end
end

Instance Method Details

#open_writer(destination, file_system, path, schema, options) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/arrow-dataset/file-format.rb', line 46

def open_writer(destination, file_system, path, schema, options)
  writer = open_writer_raw(destination, file_system, path, schema, options)
  if block_given?
    begin
      yield(writer)
    ensure
      writer.finish
    end
  else
    writer
  end
end

#open_writer_rawObject



45
# File 'lib/arrow-dataset/file-format.rb', line 45

alias_method :open_writer_raw, :open_writer