本文整理汇总了Java中org.apache.cassandra.cql3.CFDefinition类的典型用法代码示例。如果您正苦于以下问题:Java CFDefinition类的具体用法?Java CFDefinition怎么用?Java CFDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CFDefinition类属于org.apache.cassandra.cql3包,在下文中一共展示了CFDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCfDefinition
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
/** get CFDefinition of a column family */
protected CFDefinition getCfDefinition(String ks, String cf, Cassandra.Client client)
throws NotFoundException,
InvalidRequestException,
TException,
org.apache.cassandra.exceptions.InvalidRequestException,
ConfigurationException
{
KsDef ksDef = client.describe_keyspace(ks);
for (CfDef cfDef : ksDef.cf_defs)
{
if (cfDef.name.equalsIgnoreCase(cf))
return new CFDefinition(CFMetaData.fromThrift(cfDef));
}
return null;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:AbstractCassandraStorage.java
示例2: retrieveKeysForThriftTables
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
/**
* retrieve the fake partition keys and cluster keys for classic thrift table
* use CFDefinition to get keys and columns
* */
private void retrieveKeysForThriftTables() throws Exception
{
KsDef ksDef = client.describe_keyspace(keyspace);
for (CfDef cfDef : ksDef.cf_defs)
{
if (cfDef.name.equalsIgnoreCase(cfName))
{
CFMetaData cfMeta = CFMetaData.fromThrift(cfDef);
CFDefinition cfDefinition = new CFDefinition(cfMeta);
for (ColumnIdentifier columnIdentifier : cfDefinition.keys.keySet())
partitionBoundColumns.add(new BoundColumn(columnIdentifier.toString()));
parseKeyValidators(cfDef.key_validation_class);
return;
}
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:21,代码来源:CqlPagingRecordReader.java
示例3: retrieveKeysForThriftTables
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
/**
* retrieve the fake partition keys and cluster keys for classic thrift table
* use CFDefinition to get keys and columns
* */
private void retrieveKeysForThriftTables(Cassandra.Client client) throws Exception
{
String keyspace = ConfigHelper.getOutputKeyspace(conf);
String cfName = ConfigHelper.getOutputColumnFamily(conf);
KsDef ksDef = client.describe_keyspace(keyspace);
for (CfDef cfDef : ksDef.cf_defs)
{
if (cfDef.name.equalsIgnoreCase(cfName))
{
CFMetaData cfMeta = CFMetaData.fromThrift(cfDef);
CFDefinition cfDefinition = new CFDefinition(cfMeta);
int i = 0;
for (ColumnIdentifier column : cfDefinition.keys.keySet())
{
partitionKeyColumns[i] = column.toString();
i++;
}
return;
}
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:26,代码来源:CqlRecordWriter.java
示例4: validateFields
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
public void validateFields(CFMetaData metadata) throws MarshalException
{
validateName(metadata);
CFDefinition cfdef = metadata.getCfDef();
// If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
// (Note that COMPACT composites are handled by validateName, above.)
ByteBuffer internalName;
internalName = (cfdef.isComposite && !cfdef.isCompact)
? ((CompositeType) metadata.comparator).extractLastComponent(name)
: name;
AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
if (valueValidator != null)
valueValidator.validate(value());
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:Column.java
示例5: HiveRowIterator
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
public HiveRowIterator(RowPosition startPosition, RowPosition endPosition, IPartitioner<?> partitioner, Text[] keyAliasNames, Text[] columnAliasNames,
ColumnFamilyMetadata metadata, List<String> columnNames, RateLimiter rateLimiter) {
this.startPosition = startPosition;
this.endPosition = endPosition;
this.partitioner = partitioner;
this.keyAliasNames = keyAliasNames;
this.columnAliasNames = columnAliasNames;
this.metadata = metadata;
this.rateLimiter = rateLimiter;
// these are all the columns we will send back
// columns that aren't here aren't required
for (final String columnName : columnNames) {
final ByteBuffer bb = CFDefinition.definitionType.fromString(columnName);
final Text text = new Text(columnName);
columnNamesMap.put(bb, text);
}
}
开发者ID:richardalow,项目名称:cassowary,代码行数:19,代码来源:HiveRowIterator.java
示例6: getKeyTypes
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
private static AbstractType[] getKeyTypes(CFMetaData cfm)
{
AbstractType[] types = new AbstractType[cfm.getCfDef().keys.size()];
int i = 0;
for (CFDefinition.Name name : cfm.getCfDef().keys.values())
types[i++] = name.type;
return types;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:9,代码来源:TokenFct.java
示例7: validateFields
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
public void validateFields(CFMetaData metadata) throws MarshalException
{
validateName(metadata);
CFDefinition cfdef = metadata.getCfDef();
// If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
// (Note that COMPACT composites are handled by validateName, above.)
ByteBuffer internalName = (cfdef.isComposite && !cfdef.isCompact)
? ((CompositeType) metadata.comparator).extractLastComponent(name)
: name;
AbstractType<?> valueValidator = metadata.getValueValidator(internalName);
if (valueValidator != null)
valueValidator.validate(value());
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:16,代码来源:Column.java
示例8: rebuild
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
public CFMetaData rebuild()
{
/*
* TODO: There is definitively some repetition between the CQL3 metadata stored in this
* object (partitionKeyColumns, ...) and the one stored in CFDefinition.
* Ultimately, we should probably merge both. However, there is enough details to fix that
* it's worth doing that in a separate issue.
*/
rebuildCQL3Metadata();
cqlCfDef = new CFDefinition(this);
return this;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:CFMetaData.java
示例9: getColumnValueConvertor
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
private AbstractType getColumnValueConvertor(final String columnName, final AbstractType defaultType) {
final ColumnIdentifier colId = new ColumnIdentifier(columnName, false);
final CFDefinition.Name name = cfd.get(colId);
if (name == null) {
return defaultType;
}
final AbstractType<?> type = name.type;
return type != null ? type : defaultType;
}
开发者ID:fullcontact,项目名称:hadoop-sstable,代码行数:12,代码来源:JsonColumnParser.java
示例10: addValue
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
private void addValue(GenericRecord record, CFDefinition.Name name, ColumnGroupMap group) {
if (name.type.isCollection()) {
// TODO(danchia): support collections
throw new RuntimeException("Collections not supported yet.");
} else {
Column c = group.getSimple(name.name.key);
addCqlValueToRecord(record, name, (c == null) ? null : c.value());
}
}
开发者ID:Netflix,项目名称:aegisthus,代码行数:10,代码来源:CQLMapper.java
示例11: addCqlValueToRecord
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
private void addCqlValueToRecord(GenericRecord record, CFDefinition.Name name, ByteBuffer value) {
if (value == null) {
record.put(name.name.toString(), null);
return;
}
AbstractType<?> type = name.type;
Object valueDeserialized = type.compose(value);
AbstractType<?> baseType = (type instanceof ReversedType<?>)
? ((ReversedType<?>) type).baseType
: type;
/* special case some unsupported CQL3 types to Hive types. */
if (baseType instanceof UUIDType || baseType instanceof TimeUUIDType) {
valueDeserialized = ((UUID) valueDeserialized).toString();
} else if (baseType instanceof BytesType) {
ByteBuffer buffer = (ByteBuffer) valueDeserialized;
byte[] data = new byte[buffer.remaining()];
buffer.get(data);
valueDeserialized = data;
} else if (baseType instanceof TimestampType) {
Date date = (Date) valueDeserialized;
valueDeserialized = date.getTime();
}
//LOG.info("Setting {} type {} to class {}", name.name.toString(), type, valueDeserialized.getClass());
record.put(name.name.toString(), valueDeserialized);
}
开发者ID:Netflix,项目名称:aegisthus,代码行数:32,代码来源:CQLMapper.java
示例12: getCfDef
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
/** return the CfDef for the column family */
protected CfDef getCfDef(Cassandra.Client client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException,
CharacterCodingException,
NotFoundException,
org.apache.cassandra.exceptions.InvalidRequestException,
ConfigurationException
{
// get CF meta data
String query = "SELECT type," +
" comparator," +
" subcomparator," +
" default_validator," +
" key_validator," +
" key_aliases " +
"FROM system.schema_columnfamilies " +
"WHERE keyspace_name = '%s' " +
" AND columnfamily_name = '%s' ";
CqlResult result = client.execute_cql3_query(
ByteBufferUtil.bytes(String.format(query, keyspace, column_family)),
Compression.NONE,
ConsistencyLevel.ONE);
if (result == null || result.rows == null || result.rows.isEmpty())
return null;
Iterator<CqlRow> iteraRow = result.rows.iterator();
CfDef cfDef = new CfDef();
cfDef.keyspace = keyspace;
cfDef.name = column_family;
boolean cql3Table = false;
if (iteraRow.hasNext())
{
CqlRow cqlRow = iteraRow.next();
cfDef.column_type = ByteBufferUtil.string(cqlRow.columns.get(0).value);
cfDef.comparator_type = ByteBufferUtil.string(cqlRow.columns.get(1).value);
ByteBuffer subComparator = cqlRow.columns.get(2).value;
if (subComparator != null)
cfDef.subcomparator_type = ByteBufferUtil.string(subComparator);
cfDef.default_validation_class = ByteBufferUtil.string(cqlRow.columns.get(3).value);
cfDef.key_validation_class = ByteBufferUtil.string(cqlRow.columns.get(4).value);
String keyAliases = ByteBufferUtil.string(cqlRow.columns.get(5).value);
List<String> keys = FBUtilities.fromJsonList(keyAliases);
// classis thrift tables
if (keys.size() == 0)
{
CFDefinition cfDefinition = getCfDefinition(keyspace, column_family, client);
for (ColumnIdentifier column : cfDefinition.keys.keySet())
{
String key = column.toString();
String type = cfDefinition.keys.get(column).type.toString();
logger.debug("name: {}, type: {} ", key, type);
keys.add(key);
}
}
else
cql3Table = true;
}
cfDef.column_metadata = getColumnMetadata(client, cql3Table);
return cfDef;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:68,代码来源:AbstractCassandraStorage.java
示例13: getCfDef
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
public CFDefinition getCfDef()
{
assert cqlCfDef != null;
return cqlCfDef;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:6,代码来源:CFMetaData.java
示例14: updateCfDef
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
private CFMetaData updateCfDef()
{
cqlCfDef = new CFDefinition(this);
return this;
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:6,代码来源:CFMetaData.java
示例15: getCfInfo
import org.apache.cassandra.cql3.CFDefinition; //导入依赖的package包/类
/** return the CfInf for the column family */
protected CfInfo getCfInfo(Cassandra.Client client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException,
NotFoundException,
org.apache.cassandra.exceptions.InvalidRequestException,
ConfigurationException,
IOException
{
// get CF meta data
String query = "SELECT type," +
" comparator," +
" subcomparator," +
" default_validator," +
" key_validator," +
" key_aliases " +
"FROM system.schema_columnfamilies " +
"WHERE keyspace_name = '%s' " +
" AND columnfamily_name = '%s' ";
CqlResult result = client.execute_cql3_query(
ByteBufferUtil.bytes(String.format(query, keyspace, column_family)),
Compression.NONE,
ConsistencyLevel.ONE);
if (result == null || result.rows == null || result.rows.isEmpty())
return null;
Iterator<CqlRow> iteraRow = result.rows.iterator();
CfDef cfDef = new CfDef();
cfDef.keyspace = keyspace;
cfDef.name = column_family;
boolean cql3Table = false;
if (iteraRow.hasNext())
{
CqlRow cqlRow = iteraRow.next();
cfDef.column_type = ByteBufferUtil.string(cqlRow.columns.get(0).value);
cfDef.comparator_type = ByteBufferUtil.string(cqlRow.columns.get(1).value);
ByteBuffer subComparator = cqlRow.columns.get(2).value;
if (subComparator != null)
cfDef.subcomparator_type = ByteBufferUtil.string(subComparator);
cfDef.default_validation_class = ByteBufferUtil.string(cqlRow.columns.get(3).value);
cfDef.key_validation_class = ByteBufferUtil.string(cqlRow.columns.get(4).value);
String keyAliases = ByteBufferUtil.string(cqlRow.columns.get(5).value);
List<String> keys = FBUtilities.fromJsonList(keyAliases);
// classis thrift tables
if (keys.size() == 0)
{
CFDefinition cfDefinition = getCfDefinition(keyspace, column_family, client);
for (ColumnIdentifier column : cfDefinition.keys.keySet())
{
String key = column.toString();
String type = cfDefinition.keys.get(column).type.toString();
logger.debug("name: {}, type: {} ", key, type);
keys.add(key);
}
}
else
cql3Table = true;
}
cfDef.column_metadata = getColumnMetadata(client);
CfInfo cfInfo = new CfInfo();
cfInfo.cfDef = cfDef;
if (cql3Table && !(parseType(cfDef.comparator_type) instanceof AbstractCompositeType))
cfInfo.compactCqlTable = true;
if (cql3Table)
cfInfo.cql3Table = true;
return cfInfo;
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:75,代码来源:AbstractCassandraStorage.java
注:本文中的org.apache.cassandra.cql3.CFDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论