Package com.datastax.driver.core

Examples of com.datastax.driver.core.Row


   
    ResultSetFuture rs = session.executeAsync(query);

    int size = 0;
    try {
      Row row = rs.getUninterruptibly(1000000, TimeUnit.MILLISECONDS).one();
      size = row != null ? row.getBytesUnsafe(colName.toString()).capacity() : 0;
    }
    catch (TimeoutException e) {
      e.printStackTrace();
      throw new OperationException(e);
    }
View Full Code Here


        .and(QueryBuilder.eq(clusteredKey, clusteredValue)).limit(1000000));
   
    int size = 0;
   
    try {
      Row row = rs.getUninterruptibly(1000000, TimeUnit.MILLISECONDS).one();
      size = row != null ? row.getBytesUnsafe(colName.toString()).capacity() : 0;
    }

    catch (TimeoutException e) {
      e.printStackTrace();
      throw new OperationException(e);
View Full Code Here

        return rowIterator.hasNext();
    }

    @Override
    public IndexEntry next() {
        Row row = rowIterator.next();
        lastScheduleId = row.getInt(0);
        IndexEntry indexEntry = new IndexEntry(bucket, partition, time.getMillis(), lastScheduleId);
        if (!rowIterator.hasNext()) {
            loadPage();
        }
        return indexEntry;
View Full Code Here

    protected int queryReplicationFactor() {
        int replicationFactor = 1;
        try {
            ResultSet resultSet = execute(
                "SELECT strategy_options FROM system.schema_keyspaces where keyspace_name='rhq'");
            Row row = resultSet.one();

            String replicationFactorString = "replication_factor\"";
            String resultString = row.getString(0);
            resultString = resultString.substring(resultString.indexOf(replicationFactorString)
                + replicationFactorString.length());
            resultString = resultString.substring(resultString.indexOf('"') + 1);
            resultString = resultString.substring(0, resultString.indexOf('"'));
View Full Code Here

        DateTime previousHour = current1HourTimeSlice();
        DateTime oldestRawTime = previousHour.minus(Days.days(7));

        ResultSet resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
        Row row = resultSet.one();
        while (row == null && previousHour.compareTo(oldestRawTime) > 0) {
            previousHour = previousHour.minusHours(1);
            resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
            row = resultSet.one();
        }

        if (row == null) {
            log.info("No data found in metrics_index table");
            return null;
        } else {
            Date date = row.getDate(0);
            log.info("The latest hour with raw data is " + date);
            return date;
        }
    }
View Full Code Here

                    List<Row> rows = result.all();

                    ByteBuffer[][] r = new ByteBuffer[rows.size()][];
                    for (int i = 0 ; i < r.length ; i++)
                    {
                        Row row = rows.get(i);
                        r[i] = new ByteBuffer[row.getColumnDefinitions().size()];
                        for (int j = 0 ; j < row.getColumnDefinitions().size() ; j++)
                            r[i][j] = row.getBytes(j);
                    }
                    return r;
                }
            };
        }
View Full Code Here

        protected Pair<Long, Row> computeNext()
        {
            if (rows == null || !rows.hasNext())
                return endOfData();

            Row row = rows.next();
            Map<String, ByteBuffer> keyColumns = new HashMap<String, ByteBuffer>();
            for (String column : partitionBoundColumns.keySet())
                keyColumns.put(column, row.getBytesUnsafe(column));

            // increase total CF row read
            if (previousRowKey.isEmpty() && !keyColumns.isEmpty())
            {
                previousRowKey = keyColumns;
View Full Code Here

            if (!reader.nextKeyValue())
                return null;

            CfInfo cfInfo = getCfInfo(loadSignature);
            CfDef cfDef = cfInfo.cfDef;
            Row row = reader.getCurrentValue();
            Tuple tuple = TupleFactory.getInstance().newTuple(cfDef.column_metadata.size());
            Iterator<ColumnDef> itera = cfDef.column_metadata.iterator();
            int i = 0;
            while (itera.hasNext())
            {
                ColumnDef cdef = itera.next();
                ByteBuffer columnValue = row.getBytesUnsafe(ByteBufferUtil.string(cdef.name.duplicate()));
                if (columnValue != null)
                {
                    Cell cell = new BufferCell(CellNames.simpleDense(cdef.name), columnValue);
                    AbstractType<?> validator = getValidatorMap(cfDef).get(cdef.name);
                    setTupleValue(tuple, i, cqlColumnToObj(cell, cfDef), validator);
View Full Code Here

    final Iterator<Row> it = cassandraResultList.iterator();
    // Iterate over all results and create fresh EventBean for all
    // data results from the database query.
    while (it.hasNext()) {
      final Map<Object, Object> resultData = new HashMap<Object, Object>();
      final Row cassandraRow = it.next();
      for (String key : _propertyNames) {
        resultData.put(key, cassandraRow.getString(key));
      }
      esperResultSet.add(_eventFactory.wrap(resultData));
    }

    return esperResultSet;
View Full Code Here

                    List<Row> rows = result.all();

                    ByteBuffer[][] r = new ByteBuffer[rows.size()][];
                    for (int i = 0 ; i < r.length ; i++)
                    {
                        Row row = rows.get(i);
                        r[i] = new ByteBuffer[row.getColumnDefinitions().size() - 1];
                        for (int j = 1 ; j < row.getColumnDefinitions().size() ; j++)
                            r[i][j - 1] = row.getBytes(j);
                    }
                    return r;
                }
            };
        }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.