当前位置: 首页>>代码示例>>Java>>正文


Java ColumnMetadata.getIndex方法代码示例

本文整理汇总了Java中com.datastax.driver.core.ColumnMetadata.getIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnMetadata.getIndex方法的具体用法?Java ColumnMetadata.getIndex怎么用?Java ColumnMetadata.getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.ColumnMetadata的用法示例。


在下文中一共展示了ColumnMetadata.getIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildColumnHandle

import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
private CassandraColumnHandle buildColumnHandle(ColumnMetadata columnMeta, boolean partitionKey, boolean clusteringKey, int ordinalPosition, boolean hidden)
{
    CassandraType cassandraType = CassandraType.getCassandraType(columnMeta.getType().getName());
    List<CassandraType> typeArguments = null;
    if (cassandraType != null && cassandraType.getTypeArgumentSize() > 0) {
        List<DataType> typeArgs = columnMeta.getType().getTypeArguments();
        switch (cassandraType.getTypeArgumentSize()) {
            case 1:
                typeArguments = ImmutableList.of(CassandraType.getCassandraType(typeArgs.get(0).getName()));
                break;
            case 2:
                typeArguments = ImmutableList.of(CassandraType.getCassandraType(typeArgs.get(0).getName()), CassandraType.getCassandraType(typeArgs.get(1).getName()));
                break;
            default:
                throw new IllegalArgumentException("Invalid type arguments: " + typeArgs);
        }
    }
    boolean indexed = columnMeta.getIndex() != null;
    return new CassandraColumnHandle(connectorId, columnMeta.getName(), ordinalPosition, cassandraType, typeArguments, partitionKey, clusteringKey, indexed, hidden);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:CassandraSession.java

示例2: addColumnsToTable

import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
/**
 * Adds all columns of column family.
 * @param table			Teiid table
 * @param columnFamily	Column family
 */
private void addColumnsToTable(MetadataFactory factory, Table table, TableMetadata columnFamily) {
	for (ColumnMetadata column : columnFamily.getColumns()){

		Class<?> cqlTypeToJavaClass = column.getType().asJavaClass();
		Class<?> teiidRuntimeTypeFromJavaClass = TypeFacility.getRuntimeType(cqlTypeToJavaClass);
		String type = TypeFacility.getDataTypeName(teiidRuntimeTypeFromJavaClass);
		
		if (column.getType().getName().equals(com.datastax.driver.core.DataType.Name.TIMESTAMP)) {
			type = TypeFacility.RUNTIME_NAMES.TIMESTAMP;
		} else if (column.getType().getName().equals(com.datastax.driver.core.DataType.Name.CUSTOM)
				|| column.getType().getName().equals(com.datastax.driver.core.DataType.Name.BLOB)) {
			type = TypeFacility.RUNTIME_NAMES.VARBINARY;
		}
		
		Column c = factory.addColumn(column.getName(), type, table);
		c.setUpdatable(true);
		if (column.getIndex() != null) {
			c.setSearchType(SearchType.Searchable);
		}
		else {
			c.setSearchType(SearchType.Unsearchable);
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:30,代码来源:CassandraMetadataProcessor.java

示例3: validateAdditionalFilters

import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
private void validateAdditionalFilters(TableMetadata tableMetadata) {
    for (Map.Entry<String, Serializable> entry : additionalFilters.entrySet()) {
        /* check if there's an index specified on the provided column */
        ColumnMetadata columnMetadata = tableMetadata.getColumn(entry.getKey());

        if (columnMetadata == null) {
            throw new DeepNoSuchFieldException("No column with name " + entry.getKey() + " has been found on " +
                    "table " + this.catalog + "." + this.table);
        }

        if (columnMetadata.getIndex() == null) {
            throw new DeepIndexNotFoundException("No index has been found on column " + columnMetadata.getName()
                    + " on table " + this.catalog + "." + this.table);
        }
    }
}
 
开发者ID:Stratio,项目名称:deep-spark,代码行数:17,代码来源:CassandraDeepJobConfig.java

示例4: getLuceneIndex

import com.datastax.driver.core.ColumnMetadata; //导入方法依赖的package包/类
/**
 * Retrieve the column name for the lucene indexes. Null if there is no lucene index.
 *
 * @return Lucene index; null, if doesn't exist.
 */
private String getLuceneIndex() {
    String indexName = "";

    TableMetadata tableMetadata = config.fetchTableMetadata();
    List<ColumnMetadata> columns = tableMetadata.getColumns();
    for (ColumnMetadata column : columns) {
        if (column.getIndex() != null) {
            if (column.getIndex().isCustomIndex()) {
                indexName = column.getName();
            }
        }
    }
    return indexName;
}
 
开发者ID:Stratio,项目名称:deep-spark,代码行数:20,代码来源:DeepRecordReader.java


注:本文中的com.datastax.driver.core.ColumnMetadata.getIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。