@Test public void testReadFromSimpleCsvFile() throws Exception { prepareTest("csv/simple.csv", false); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("1,a,b", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("2,c,d", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("3,e,f", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); } }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); }  }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite(); }
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite();  }