Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.ColumnParent


  public Select addSuperColumnAll(String superColumnFamily) {
    return addColumnAll(superColumnFamily);
  }

  public Select addAllColumnsForSuperColumn(String superColumnFamily, String superColumnName) {
    ColumnParent parent = new ColumnParent(superColumnFamily);
    parent.setSuper_column(ByteUtils.toBytes(superColumnName));
    predicateMap.put(parent, ALL_PREDICATE);
    return this;
  }
View Full Code Here


    predicateMap.put(parent, ALL_PREDICATE);
    return this;
  }

  public Select addColumnAll(String columnFamily) {
    predicateMap.put(new ColumnParent(columnFamily), ALL_PREDICATE);
    return this;
  }
View Full Code Here

        pair = f.get();
      } catch (Exception e1) {
        throw new IOException(e1);
      }
      for (ColumnOrSuperColumn csc : pair.getSecond()) {
        ColumnParent parent = pair.getFirst();
        row.addColumnOrSuperColumn(parent.column_family, parent.super_column, csc);
      }
    }
    return row;
  }
View Full Code Here

        for (int nRows = minRow; nRows < maxRow; nRows++)
        {
            ByteBuffer row = ByteBufferUtil.bytes((rowPrefix + nRows));
            ColumnPath col = new ColumnPath("Standard1").setSuper_column((ByteBuffer)null).setColumn("col1".getBytes());
            ColumnParent parent = new ColumnParent("Standard1").setSuper_column((ByteBuffer)null);

            Collection<InetAddress> endpoints = tester.ringCache.getEndpoint(row);
            InetAddress firstEndpoint = endpoints.iterator().next();
            System.out.printf("hosts with key %s : %s; choose %s%n",
                              new String(row.array()), StringUtils.join(endpoints, ","), firstEndpoint);
View Full Code Here

            this.settings = settings;
            this.keyGen = settings.keys.newKeyGen();
            this.rowGen = settings.columns.newRowGen();
            this.metrics = metrics;
            if (!settings.columns.useSuperColumns)
                columnParents = Collections.singletonList(new ColumnParent(settings.schema.columnFamily));
            else
            {
                ColumnParent[] cp = new ColumnParent[settings.columns.superColumns];
                for (int i = 0 ; i < cp.length ; i++)
                    cp[i] = new ColumnParent("Super1").setSuper_column(ByteBufferUtil.bytes("S" + i));
                columnParents = Arrays.asList(cp);
            }
        }
View Full Code Here

        // to make sure we have SSTable
        cfs.forceBlockingFlush();

        // reads to cache key position
        cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        assert CacheService.instance.keyCache.size() == 2;

        Util.compactAll(cfs).get();
        keyCacheSize = CacheService.instance.keyCache.size();
        // after compaction cache should have entries for
        // new SSTables, if we had 2 keys in cache previously it should become 4
        assert keyCacheSize == 4 : keyCacheSize;

        // re-read same keys to verify that key cache didn't grow further
        cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));

        cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
                                                       new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                       false,
                                                       10));
View Full Code Here

        }

        private List<ColumnParent> columnParents(Command type, StressSettings settings)
        {
            if (!settings.columns.useSuperColumns)
                return Collections.singletonList(new ColumnParent(type.table));
            else
            {
                ColumnParent[] cp = new ColumnParent[settings.columns.superColumns];
                for (int i = 0 ; i < cp.length ; i++)
                    cp[i] = new ColumnParent(type.supertable).setSuper_column(ByteBufferUtil.bytes("S" + i));
                return Arrays.asList(cp);
            }
        }
View Full Code Here

        // insert data
        Column nameColumn = new Column(ByteBuffer.wrap("name".getBytes()));
        nameColumn.setValue("John Dow".getBytes());
        nameColumn.setTimestamp(System.currentTimeMillis());

        ColumnParent columnParent = new ColumnParent(columnFamily);
        try {
            client.insert(ByteBuffer.wrap(key_user_id.getBytes()), columnParent, nameColumn, ConsistencyLevel.ALL);
        } catch (Exception e) {
            System.err.println("testInsert: " + e.getClass().getSimpleName() + ": " + e.getMessage());
        }
View Full Code Here

        Cassandra.Client client = getClient();

        //record id
        String key_user_id = "1";
        String columnFamily = "Standard1";
        ColumnParent columnParent = new ColumnParent(columnFamily);

        //Gets column by key
        SlicePredicate predicate = new SlicePredicate();
        predicate.setSlice_range(new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new byte[0]), false, 100));
        List<ColumnOrSuperColumn> columnsByKey = client.get_slice(ByteBuffer.wrap(key_user_id.getBytes()), columnParent, predicate, ConsistencyLevel.ALL);
View Full Code Here

        byte[] key_user_id = "1".getBytes();

        long timestamp = System.currentTimeMillis();
        ColumnPath cp = new ColumnPath("Standard1");
        ColumnParent par = new ColumnParent("Standard1");
        cp.setColumn("name".getBytes("utf-8"));

        // insert
        Clock clock = new Clock();
        clock.setTimestamp(timestamp);
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.ColumnParent

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.