@Test public void testReduceLinesForStats() throws Exception { final TextConfiguration textConfiguration = new DefaultTextConfiguration() { @Override public int getTextAnalysisMaxLines() { return 3; } }; final CairoConfiguration configuration = new DefaultCairoConfiguration(root) { @Override public TextConfiguration getTextConfiguration() { return textConfiguration; } }; try (CairoEngine engine = new CairoEngine(configuration)) { assertNoLeak( engine, textLoader -> { String expected = "StrSym\tIntSym\tIntCol\tDoubleCol\tIsoDate\tFmt1Date\tFmt2Date\tPhone\tboolean\tlong\n" + "CMP1\t7\t8284\t3.2045788760297\t2015-01-13T19:15:09.000Z\t2015-01-13T19:15:09.000Z\t2015-01-13T00:00:00.000Z\t8284\ttrue\t10239799\n" + "CMP2\t3\t1066\t7.5186683377251\t2015-01-14T19:15:09.000Z\t2015-01-14T19:15:09.000Z\t2015-01-14T00:00:00.000Z\t1066\tfalse\t23331405\n" + "CMP1\t4\t6938\t5.11407712241635\t2015-01-15T19:15:09.000Z\t2015-01-15T19:15:09.000Z\t2015-01-15T00:00:00.000Z\t(099)889-776\ttrue\t55296137\n" + "CMP1\t7\t6460\t6.39910243218765\t2015-01-17T19:15:09.000Z\t2015-01-17T19:15:09.000Z\t2015-01-17T00:00:00.000Z\t5142\ttrue\t69744070\n"; String csv = "StrSym,Int Sym,Int_Col,DoubleCol,IsoDate,Fmt1Date,Fmt2Date,Phone,boolean,long\n" + "CMP1,7,8284,3.2045788760297,2015-01-13T19:15:09.000Z,2015-01-13 19:15:09,01/13/2015,8284,TRUE,10239799\n" + "CMP2,3,1066,7.5186683377251,2015-01-14T19:15:09.000Z,2015-01-14 19:15:09,01/14/2015,1066,FALSE,23331405\n" + "CMP1,4,6938,5.11407712241635,2015-01-15T19:15:09.000Z,2015-01-15 19:15:09,01/15/2015,(099)889-776,TRUE,55296137\n" + ",6.2,4527,2.48986426275223,2015-01-16T19:15:09.000Z,2015-01-16 19:15:09,01/16/2015,2719,FALSE,67489936\n" + "CMP1,7,6460,6.39910243218765,2015-01-17T19:15:09.000Z,2015-01-17 19:15:09,01/17/2015,5142,TRUE,69744070\n"; configureLoaderDefaults(textLoader, (byte) ','); textLoader.setForceHeaders(false); playText( engine, textLoader, csv, 1024, expected, "{\"columnCount\":10,\"columns\":[{\"index\":0,\"name\":\"StrSym\",\"type\":\"STRING\"},{\"index\":1,\"name\":\"IntSym\",\"type\":\"INT\"},{\"index\":2,\"name\":\"IntCol\",\"type\":\"INT\"},{\"index\":3,\"name\":\"DoubleCol\",\"type\":\"DOUBLE\"},{\"index\":4,\"name\":\"IsoDate\",\"type\":\"DATE\"},{\"index\":5,\"name\":\"Fmt1Date\",\"type\":\"DATE\"},{\"index\":6,\"name\":\"Fmt2Date\",\"type\":\"DATE\"},{\"index\":7,\"name\":\"Phone\",\"type\":\"STRING\"},{\"index\":8,\"name\":\"boolean\",\"type\":\"BOOLEAN\"},{\"index\":9,\"name\":\"long\",\"type\":\"INT\"}],\"timestampIndex\":-1}", 5, 4 ); }); } }
public void setForceHeaders(boolean forceHeaders) { this.forceHeaders = forceHeaders; }
TextLoader implements Closeable, Mutable { public void setForceHeaders(boolean forceHeaders) { this.forceHeaders = forceHeaders; } }
TextLoader implements Closeable, Mutable { public void setForceHeaders(boolean forceHeaders) { this.forceHeaders = forceHeaders; } TextLoader(CairoEngine engine); }
TextLoader implements Closeable, Mutable { public void setForceHeaders(boolean forceHeaders) { this.forceHeaders = forceHeaders; } TextLoader(CairoEngine engine); @Override void clear(); @Override void close(); void configureColumnDelimiter(byte columnDelimiter); void configureDestination(CharSequence tableName, boolean overwrite, boolean durable, int atomicity, int partitionBy, CharSequence timestampIndexCol); byte getColumnDelimiter(); LongList getColumnErrorCounts(); RecordMetadata getMetadata(); long getParsedLineCount(); long getErrorLineCount(); int getPartitionBy(); CharSequence getTableName(); long getWrittenLineCount(); boolean hasHeader(); boolean isForceHeaders(); void setForceHeaders(boolean forceHeaders); void setSkipRowsWithExtraValues(boolean skipRowsWithExtraValues); void parse(long lo, long hi, CairoSecurityContext cairoSecurityContext); void setState(int state); void wrapUp(); }
TextLoader implements Closeable, Mutable { public void setForceHeaders(boolean forceHeaders) { this.forceHeaders = forceHeaders; } TextLoader(CairoEngine engine); @Override void clear(); @Override void close(); void configureColumnDelimiter(byte columnDelimiter); void configureDestination(CharSequence tableName, boolean overwrite, boolean durable, int atomicity, int partitionBy, CharSequence timestampIndexCol); byte getColumnDelimiter(); LongList getColumnErrorCounts(); RecordMetadata getMetadata(); long getParsedLineCount(); long getErrorLineCount(); int getPartitionBy(); CharSequence getTableName(); long getWrittenLineCount(); boolean hasHeader(); boolean isForceHeaders(); void setForceHeaders(boolean forceHeaders); void setSkipRowsWithExtraValues(boolean skipRowsWithExtraValues); void parse(long lo, long hi, CairoSecurityContext cairoSecurityContext); void setState(int state); void wrapUp(); static final int LOAD_JSON_METADATA; static final int ANALYZE_STRUCTURE; static final int LOAD_DATA; }