@Test public void testSymbolIndex() throws Exception { String expected = "{\"columnCount\":3,\"columns\":[{\"index\":0,\"name\":\"a\",\"type\":\"SYMBOL\",\"indexed\":true,\"indexValueBlockCapacity\":2},{\"index\":1,\"name\":\"b\",\"type\":\"INT\"},{\"index\":2,\"name\":\"timestamp\",\"type\":\"TIMESTAMP\"}],\"timestampIndex\":2}"; TestUtils.assertMemoryLeak(() -> { try (TableModel model = new TableModel(configuration, "x", PartitionBy.DAY) .col("a", ColumnType.SYMBOL).indexed(true, 2) .col("b", ColumnType.INT) .timestamp()) { CairoTestUtils.create(model); } int N = 1000; long ts = TimestampFormatUtils.parseDateTime("2018-01-06T10:00:00.000Z"); final Rnd rnd = new Rnd(); try (TableWriter writer = new TableWriter(configuration, "x")) { sink.clear(); writer.getMetadata().toJson(sink); TestUtils.assertEquals(expected, sink); for (int i = 0; i < N; i++) { TableWriter.Row row = writer.newRow(ts + ((long) i) * 2 * 360000000L); row.putSym(0, rnd.nextChars(3)); row.putInt(1, rnd.nextInt()); row.append(); writer.commit(); } } try (TableReader reader = new TableReader(configuration, "x")) { sink.clear(); reader.getMetadata().toJson(sink); TestUtils.assertEquals(expected, sink); } }); }
public RecordMetadata getMetadata() { return metadata; }
TableReader implements Closeable { public RecordMetadata getMetadata() { return metadata; } }
TableReader implements Closeable { public RecordMetadata getMetadata() { return metadata; } TableReader(CairoConfiguration configuration, CharSequence tableName); }
TableReader implements Closeable { public RecordMetadata getMetadata() { return metadata; } TableReader(CairoConfiguration configuration, CharSequence tableName); static int getPrimaryColumnIndex(int base, int index); double avgDouble(int columnIndex); @Override void close(); void closeColumnForRemove(int columnIndex); void closeColumnForRemove(CharSequence columnName); long floorToPartitionTimestamp(long timestamp); BitmapIndexReader getBitmapIndexReader(int columnBase, int columnIndex, int direction); int getColumnBase(int partitionIndex); TableReaderRecordCursor getCursor(); long getDataVersion(); long getMaxTimestamp(); RecordMetadata getMetadata(); long getMinTimestamp(); long getPageAddressAt(int partitionIndex, long row, int columnIndex); long getPageValueCount(int partitionIndex, long rowLo, long rowHi, int columnIndex); int getPartitionCount(); int getPartitionCountBetweenTimestamps(long partitionTimestamp1, long partitionTimestamp2); int getPartitionedBy(); SymbolMapReader getSymbolMapReader(int columnIndex); String getTableName(); long getVersion(); boolean isOpen(); double maxDouble(int columnIndex); double minDouble(int columnIndex); boolean reload(); void reshuffleSymbolMapReaders(long pTransitionIndex); long size(); double sumDouble(int columnIndex); ReadOnlyColumn getColumn(int absoluteIndex); long getColumnTop(int base, int columnIndex); long openPartition(int partitionIndex); }
TableReader implements Closeable { public RecordMetadata getMetadata() { return metadata; } TableReader(CairoConfiguration configuration, CharSequence tableName); static int getPrimaryColumnIndex(int base, int index); double avgDouble(int columnIndex); @Override void close(); void closeColumnForRemove(int columnIndex); void closeColumnForRemove(CharSequence columnName); long floorToPartitionTimestamp(long timestamp); BitmapIndexReader getBitmapIndexReader(int columnBase, int columnIndex, int direction); int getColumnBase(int partitionIndex); TableReaderRecordCursor getCursor(); long getDataVersion(); long getMaxTimestamp(); RecordMetadata getMetadata(); long getMinTimestamp(); long getPageAddressAt(int partitionIndex, long row, int columnIndex); long getPageValueCount(int partitionIndex, long rowLo, long rowHi, int columnIndex); int getPartitionCount(); int getPartitionCountBetweenTimestamps(long partitionTimestamp1, long partitionTimestamp2); int getPartitionedBy(); SymbolMapReader getSymbolMapReader(int columnIndex); String getTableName(); long getVersion(); boolean isOpen(); double maxDouble(int columnIndex); double minDouble(int columnIndex); boolean reload(); void reshuffleSymbolMapReaders(long pTransitionIndex); long size(); double sumDouble(int columnIndex); ReadOnlyColumn getColumn(int absoluteIndex); long getColumnTop(int base, int columnIndex); long openPartition(int partitionIndex);  }