use of com.questdb.parser.plaintext.PlainTextParser in project questdb by bluestreak01.
the class CsvTest method testHeaders.
@Test
public void testHeaders() throws Exception {
final List<String> names = new ArrayList<>();
final List<String> expected = new ArrayList<String>() {
{
add("type");
add("value");
add("active");
add("desc");
add("grp");
}
};
ImportManager.parse(new File(this.getClass().getResource("/csv/test-headers.csv").getFile()), new PlainTextLexer(env).of(','), 1024 * 1024, true, new PlainTextParser() {
@Override
public void onError(int line) {
}
@Override
public void onFieldCount(int count) {
}
@Override
public void onFields(int line, ObjList<DirectByteCharSequence> values, int hi) {
}
@Override
public void onHeader(ObjList<DirectByteCharSequence> values, int hi) {
for (int i = 0; i < hi; i++) {
names.add(values.getQuick(i).toString());
}
}
@Override
public void onLineCount(int count) {
}
});
TestUtils.assertEquals(expected.iterator(), names.iterator());
}
Aggregations