Let's say, I can read CSV by the built in CSV parser. like this:
CSV.foreach(file_path, quote_char: '"', col_sep: ',', row_sep: :auto, headers: true) { |line|
#some code here
}
this code reads and parse whole csv from start to end.
So, my question is if it is possible or some no-lame way to read the CSV simultaneously > like one part of script would read csv from start to half and second part of script from half to end just by accesing the file on disk?
! without reading the csv into array/memory/other
ruby pseudo code (with knowing all lines in file)
threads = []
threads << Thread.new do
csvread(startrowindex,halfrowindex)
end
threads << Thread.new do
csvread(halfrowindex+1,endrowindex)
end
threads.each(&:join)