本文整理汇总了Java中org.apache.cassandra.config.CFMetaData.compile方法的典型用法代码示例。如果您正苦于以下问题:Java CFMetaData.compile方法的具体用法?Java CFMetaData.compile怎么用?Java CFMetaData.compile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.config.CFMetaData
的用法示例。
在下文中一共展示了CFMetaData.compile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowCount
import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
private int getRowCount(final String inputSSTableFullPathFileName, String cql,
boolean isThriftTable) throws IOException {
LOGGER.info("Input file name: " + inputSSTableFullPathFileName);
int counter = 0;
CFMetaData cfMetaData = CFMetaData.compile(cql, "casspactor2");
final SSTableSingleReader sstableSingleReader =
new SSTableSingleReader(inputSSTableFullPathFileName, cfMetaData, TestBaseSSTableFunSuite.HADOOP_CONF);
final ISSTableScanner currentScanner =
sstableSingleReader.getSSTableScanner(Long.MIN_VALUE, Long.MAX_VALUE);
final int nowInSecs = (int) (System.currentTimeMillis() / 1000);
final List<ISSTableScanner> scanners = new ArrayList<>();
scanners.add(currentScanner);
try (SSTableIterator ci = new SSTableIterator(scanners, cfMetaData, nowInSecs)) {
while (ci.hasNext()) {
final RowIterator rowIterator = ci.next();
counter += printRowDetails(cfMetaData, rowIterator, isThriftTable);
}
}
return counter;
}
示例2: TestMixedFormatRead
import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
@Test
public void TestMixedFormatRead() throws IOException {
String inputCql = "CREATE TABLE keyspace1.auditlogsbyid (\n " +
"auditlogid timeuuid PRIMARY KEY,\n createddate text,\n " +
"payload text\n) WITH " +
"compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}\n " +
"AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'};";
final CFMetaData cfMetaData = CFMetaData.compile(inputCql,
"casspactor",
"org.apache.cassandra.dht.RandomPartitioner");
final SSTableSingleReader cass21Reader0 =
new SSTableSingleReader(CASS21_DATA_DIR +
"keyspace1/auditlogsbyid/keyspace1-auditlogsbyid-ka-1-Data.db",
cfMetaData, TestBaseSSTableFunSuite.HADOOP_CONF);
final SSTableSingleReader cass21Reader1 =
new SSTableSingleReader(CASS21_DATA_DIR +
"keyspace1/auditlogsbyid/keyspace1-auditlogsbyid-ka-3-Data.db",
cfMetaData, TestBaseSSTableFunSuite.HADOOP_CONF);
final SSTableSingleReader cass3Reader =
new SSTableSingleReader(CASS3_DATA_DIR + "keyspace1/auditlogsbyid/mc-1-big-Data.db ",
TestBaseSSTableFunSuite.HADOOP_CONF);
final List<ISSTableScanner> scanners = new ArrayList<>();
final int nowInSecs = (int) (System.currentTimeMillis() / 1000);
scanners.add(cass21Reader0.getSSTableScanner());
scanners.add(cass21Reader1.getSSTableScanner());
scanners.add(cass3Reader.getSSTableScanner());
int counter = 0;
try (SSTableIterator ci = new SSTableIterator(scanners, cass21Reader0.getCfMetaData(), nowInSecs)) {
while (ci.hasNext()) {
final RowIterator rowIterator = ci.next();
counter += printRowDetails(cfMetaData, rowIterator, false);
}
}
Assert.assertEquals(5, counter);
}