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


Java ColumnDefinitions.Definition方法代码示例

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


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

示例1: SchemaStatement

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
                       PreparedStatement statement, Integer thriftId, ConsistencyLevel cl, ValidationType validationType)
{
    super(timer, settings, spec);
    this.statement = statement;
    this.thriftId = thriftId;
    this.cl = cl;
    this.validationType = validationType;
    argumentIndex = new int[statement.getVariables().size()];
    bindBuffer = new Object[argumentIndex.length];
    int i = 0;
    for (ColumnDefinitions.Definition definition : statement.getVariables())
        argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());

    statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SchemaStatement.java

示例2: SchemaStatement

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
                       PreparedStatement statement, Integer thriftId, ConsistencyLevel cl)
{
    super(timer, settings, spec);
    this.statement = statement;
    this.thriftId = thriftId;
    this.cl = cl;
    argumentIndex = new int[statement.getVariables().size()];
    bindBuffer = new Object[argumentIndex.length];
    definitions = statement.getVariables();
    int i = 0;
    for (ColumnDefinitions.Definition definition : definitions)
        argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());

    statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:SchemaStatement.java

示例3: createOutputRowMeta

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
void createOutputRowMeta(RowMetaInterface row, ResultSet rs) {
    row.clear();

    for (ColumnDefinitions.Definition d : rs.getColumnDefinitions()) {
        logDebug(d.getName() + ',' + d.getType().getName() + ',' + d.getType().asFunctionParameterString());

        ValueMetaBase valueMeta = new ValueMetaBase(d.getName(), Utils.convertDataType(d.getType()));
        valueMeta.setTrimType(0);
        row.addValueMeta(valueMeta);
    }
}
 
开发者ID:bcolas,项目名称:pentaho-cassandra-plugin,代码行数:12,代码来源:CassandraInputMeta.java

示例4: findRow

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
 * Find row.
 *
 * @param pk the pk
 * @return the map
 * @throws Exception the exception
 */
public Map<String,Object> findRow( String pk ) throws Exception {
	try {				
		Map<String,Object> map = null;
		String select = String.format("SELECT * FROM actuator_state where login_source_sensor='%s'", pk);
		logger.debug("select={}",select);
		long before = System.currentTimeMillis();
		ResultSet rs = execute(select);
		Iterator<Row> it = rs.iterator();
		Row row = rs.one();
		if( row != null ) {
			map = new HashMap<String,Object>();
			logger.info(">>> elapsed {}",(System.currentTimeMillis()-before));
			ColumnDefinitions columnDefinitions = row.getColumnDefinitions();
			for( ColumnDefinitions.Definition columnDefinition : columnDefinitions) {
				String name = columnDefinition.getName();
				Object value = row.getObject(name);
				map.put( name, value );
			}
		}
		return map;

	} catch( Exception e ) {
		logger.error(e.getLocalizedMessage(), e);
		throw e;
	}
}
 
开发者ID:petezybrick,项目名称:iote2e,代码行数:34,代码来源:LearnCassandra.java

示例5: executeQuery

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public QueryResult executeQuery(String sql)
        throws QueryExecutionException
{
    ensureConnected();

    ResultSet rs = session.execute(sql);
    List<ColumnDefinitions.Definition> definitions = rs.getColumnDefinitions().asList();
    List<JDBCType> types = definitions.stream()
            .map(definition -> getJDBCType(definition.getType()))
            .collect(toList());

    List<String> columnNames = definitions.stream()
            .map(ColumnDefinitions.Definition::getName)
            .collect(toList());

    QueryResult.QueryResultBuilder resultBuilder = new QueryResult.QueryResultBuilder(types, columnNames);

    for (Row row : rs) {
        List<Object> builderRow = newArrayList();
        for (int i = 0; i < types.size(); ++i) {
            builderRow.add(row.getToken(i).getValue());
        }
        resultBuilder.addRow(builderRow);
    }

    return resultBuilder.build();
}
 
开发者ID:prestodb,项目名称:tempto,代码行数:28,代码来源:CassandraQueryExecutor.java

示例6: asList

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
protected List<Object> asList(Row row) {
    if (row == null)
        return null;
    List<ColumnDefinitions.Definition> columns = row.getColumnDefinitions().asList();
    List<Object> list = Lists.newArrayListWithCapacity(columns.size());
    for (ColumnDefinitions.Definition column : columns)
        list.add(getObject(row, column.getName(), column.getType()));
    return list;
}
 
开发者ID:kernel164,项目名称:hive-cassandra-dsc,代码行数:10,代码来源:HiveCassandraUtils.java

示例7: asMap

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
 * row as map.
 */
protected Map<String, Object> asMap(Row row) {
    if (row == null)
        return null;
    List<ColumnDefinitions.Definition> columns = row.getColumnDefinitions().asList();
    Map<String, Object> map = Maps.newHashMapWithExpectedSize(columns.size());
    for (ColumnDefinitions.Definition column : columns) {
        String name = column.getName();
        map.put(name, getObject(row, name, column.getType()));
    }
    return map;
}
 
开发者ID:kernel164,项目名称:hive-cassandra-dsc,代码行数:15,代码来源:HiveCassandraUtils.java

示例8: SchemaStatement

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, PartitionGenerator generator, StressSettings settings, Distribution partitionCount,
                       PreparedStatement statement, Integer thriftId, ConsistencyLevel cl, ValidationType validationType)
{
    super(timer, generator, settings, partitionCount);
    this.generator = generator;
    this.statement = statement;
    this.thriftId = thriftId;
    this.cl = cl;
    this.validationType = validationType;
    argumentIndex = new int[statement.getVariables().size()];
    bindBuffer = new Object[argumentIndex.length];
    int i = 0;
    for (ColumnDefinitions.Definition definition : statement.getVariables())
        argumentIndex[i++] = generator.indexOf(definition.getName());
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:16,代码来源:SchemaStatement.java

示例9: transform

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
/**
 * Extract name of columndefinions
 * @param definition Definition Objetc
 * @return name of definition
 */
@Override
public String transform(ColumnDefinitions.Definition definition) {
    String name = definition.getName();
    if (name==null)
        name="";
    return name;
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:13,代码来源:DefinitionToNameFunction.java

示例10: mockResultSet

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ResultSet mockResultSet(List<Row> rows,ColumnDefinitions columDefiniton){
    ResultSet resultSet = mock(ResultSet.class);
    ColumnDefinitions.Definition mockDefinition = new DoubleDefinition().buildDefinitionWithName("");
    expect(resultSet.getColumnDefinitions()).andStubReturn(columDefiniton);
    expect(resultSet.all()).andStubReturn(rows);
    replay(resultSet);
    return resultSet;
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:9,代码来源:DoubleSession.java

示例11: mockColumnDefinions

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ColumnDefinitions mockColumnDefinions(){
    ColumnDefinitions columnDefinions = mock(ColumnDefinitions.class);
    List<ColumnDefinitions.Definition> columnDefinitions = new ArrayList<>();
    columnDefinitions.add(new DoubleDefinition().buildDefinitionWithName(""));
    expect(columnDefinions.asList()).andStubReturn(columnDefinitions);
    replay(columnDefinions);
    return columnDefinions;
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:9,代码来源:DoubleSession.java

示例12: mockColumnDefinionsWithoutData

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private ColumnDefinitions mockColumnDefinionsWithoutData(){
    ColumnDefinitions columnDefinions = mock(ColumnDefinitions.class);
    List<ColumnDefinitions.Definition> columnDefinitions = new ArrayList<>();
    expect(columnDefinions.asList()).andStubReturn(columnDefinitions);
    replay(columnDefinions);
    return columnDefinions;
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:8,代码来源:DoubleSession.java

示例13: buildDefinitionWithName

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public  ColumnDefinitions.Definition buildDefinitionWithName(String nameHeader) {
    ColumnDefinitions.Definition definition = mock(ColumnDefinitions.Definition.class);
    return definition;
}
 
开发者ID:Stratio,项目名称:Explorer,代码行数:5,代码来源:DoubleDefinition.java


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