@Test public void testSimpleSymbolIndex() throws Exception { TestUtils.assertMemoryLeak(() -> { int N = 1000000; int S = 128; Rnd rnd = new Rnd(); SymbolGroup sg = new SymbolGroup(rnd, S, N, PartitionBy.NONE, true); final MyWorkScheduler workScheduler = new MyWorkScheduler(new MPSequence(1024) { private boolean flap = false; @Override public long next() { boolean flap = this.flap; this.flap = !this.flap; return flap ? -1 : -2; } }, null); long timestamp = 0; try (TableWriter writer = new TableWriter(configuration, "ABC", workScheduler)) { for (int i = 0; i < N; i++) { TableWriter.Row r = writer.newRow(timestamp); r.putSym(0, sg.symA[rnd.nextPositiveInt() % S]); r.putSym(1, sg.symB[rnd.nextPositiveInt() % S]); r.putSym(2, sg.symC[rnd.nextPositiveInt() % S]); r.putDouble(3, rnd.nextDouble()); r.append(); } writer.commit(); } try (TableReader reader = new TableReader(configuration, "ABC")) { Assert.assertTrue(reader.getPartitionCount() > 0); FullFwdDataFrameCursor cursor = new FullFwdDataFrameCursor(); TableReaderRecord record = new TableReaderRecord(); cursor.of(reader); record.of(reader); assertIndexRowsMatchSymbol(cursor, record, 0, N); cursor.toTop(); assertIndexRowsMatchSymbol(cursor, record, 1, N); cursor.toTop(); assertIndexRowsMatchSymbol(cursor, record, 2, N); } }); }
@Override public void toTop() { this.partitionIndex = 0; }
FullFwdDataFrameCursor extends AbstractFullDataFrameCursor { @Override public void toTop() { this.partitionIndex = 0; } }
FullFwdDataFrameCursor extends AbstractFullDataFrameCursor { @Override public void toTop() { this.partitionIndex = 0; }  }
FullFwdDataFrameCursor extends AbstractFullDataFrameCursor { @Override public void toTop() { this.partitionIndex = 0; }  @Override @Nullable DataFrame next(); @Override void toTop(); }
FullFwdDataFrameCursor extends AbstractFullDataFrameCursor { @Override public void toTop() { this.partitionIndex = 0; }  @Override @Nullable DataFrame next(); @Override void toTop();  }