Examples of SuperColumn


Examples of org.apache.cassandra.db.SuperColumn

        }
        rm.apply();

        // Check that the second insert did went in
        ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
        SuperColumn sc = (SuperColumn)cf.getColumn(scName);
        assert sc != null;
        assertEquals(10, sc.getColumnCount());
    }
View Full Code Here

Examples of org.apache.cassandra.db.SuperColumn

    @Test
    public void testResolveDeletedSuper()
    {
        // subcolumn is newer than a tombstone on its parent, but not newer than the row deletion
        ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
        SuperColumn sc = superColumn(scf1, "super-foo", column("one", "A", 1));
        sc.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
        scf1.addColumn(sc);

        ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
        scf2.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));
View Full Code Here

Examples of org.apache.cassandra.db.SuperColumn

    @Test
    public void testResolveDeletedSuper()
    {
        // subcolumn is newer than a tombstone on its parent, but not newer than the row deletion
        ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
        SuperColumn sc = superColumn(scf1, "super-foo", column("one", "A", 1));
        sc.markForDeleteAt((int) (System.currentTimeMillis() / 1000), 0);
        scf1.addColumn(sc);

        ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
        scf2.delete((int) (System.currentTimeMillis() / 1000), 2);
View Full Code Here

Examples of org.apache.cassandra.db.SuperColumn

                JsonColumn col = new JsonColumn(c);
                QueryPath path = new QueryPath(cfamily.name(), superName, hexToBytes(col.name));
                cfamily.addColumn(path, hexToBytes(col.value), col.timestamp, col.isDeleted);
            }
           
            SuperColumn superColumn = (SuperColumn)cfamily.getColumn(superName);
            superColumn.markForDeleteAt((int)(System.currentTimeMillis()/1000), deletedAt);
        }
    }
View Full Code Here

Examples of org.apache.cassandra.db.SuperColumn

                } else {
                    cfamily.addColumn(path, ByteBuffer.wrap(hexToBytes(col.value)), col.timestamp);
                }
            }
           
            SuperColumn superColumn = (SuperColumn)cfamily.getColumn(superName);
            superColumn.markForDeleteAt((int)(System.currentTimeMillis()/1000), deletedAt);
        }
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.SuperColumn

        // Print out super columns or columns.
        for (ColumnOrSuperColumn cosc : columns)
        {
            if (cosc.isSetSuper_column())
            {
                SuperColumn superColumn = cosc.super_column;

                css_.out.printf("=> (super_column=%s,", formatSuperColumnName(keyspace, columnFamily, superColumn));
                for (Column col : superColumn.getColumns())
                    css_.out.printf("\n     (column=%s, value=%s, timestamp=%d)", formatSubcolumnName(keyspace, columnFamily, col),
                                    new String(col.value, "UTF-8"), col.timestamp);
               
                css_.out.println(")");
            }
View Full Code Here

Examples of org.apache.cassandra.thrift.SuperColumn

        // Print out super columns or columns.
        for (ColumnOrSuperColumn cosc : columns)
        {
            if (cosc.isSetSuper_column())
            {
                SuperColumn superColumn = cosc.super_column;

                css_.out.printf("=> (super_column=%s,", formatSuperColumnName(keyspace, columnFamily, superColumn));
                for (Column col : superColumn.getColumns())
                    css_.out.printf("\n     (column=%s, value=%s, timestamp=%d)", formatSubcolumnName(keyspace, columnFamily, col),
                                    new String(col.value, "UTF-8"), col.timestamp);
               
                css_.out.println(")");
            }
View Full Code Here

Examples of org.apache.cassandra.thrift.SuperColumn

                    }
                    else
                    {
                        for (ColumnOrSuperColumn col : row)
                        {
                            SuperColumn superColumn = col.getSuper_column();
                            if (superColumn.getColumns().size() != expect.size())
                                return false;
                            for (int i = 0 ; i < expect.size() ; i++)
                                if (!superColumn.getColumns().get(i).bufferForValue().equals(expect.get(i)))
                                    return false;
                        }
                    }
                    return true;
                }
View Full Code Here

Examples of org.apache.cassandra.thrift.SuperColumn

    keyspace.insert(StringSerializer.get().toByteBuffer("testInsertSuper_key"), columnParent, column);

    // get value and assert
    ColumnPath cp2 = new ColumnPath("Super1");
    cp2.setSuper_column(bytes("testInsertSuper_super"));
    SuperColumn sc = keyspace.getSuperColumn("testInsertSuper_key", cp2);
    assertNotNull(sc);
    assertEquals("testInsertSuper_super", string(sc.getName()));
    assertEquals(2, sc.getColumns().size());
    assertEquals("testInsertSuper_value", string(sc.getColumns().get(0).getValue()));

    // remove value
    keyspace.remove("testInsertSuper_super", cp2);
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.SuperColumn

    assertEquals(2, mutationMap.get(StringSerializer.get().toByteBuffer("key1")).get("Standard1").size());
  }

  @Test
  public void testAddSuperInsertion() {
    SuperColumn sc = new SuperColumn(StringSerializer.get().toByteBuffer("c_name"),
        Arrays.asList(new Column(StringSerializer.get().toByteBuffer("c_name"), StringSerializer.get().toByteBuffer("c_val"), System.currentTimeMillis())));
    batchMutate.addSuperInsertion("key1", columnFamilies, sc);
    // assert there is one outter map row with 'key' as the key
    assertEquals(1, batchMutate.getMutationMap().get(StringSerializer.get().toByteBuffer("key1")).size());

    // add again with a different column and verify there is one key and two mutations underneath
    // for "standard1"
    SuperColumn sc2 = new SuperColumn(StringSerializer.get().toByteBuffer("c_name2"),
        Arrays.asList(new Column(StringSerializer.get().toByteBuffer("c_name"), StringSerializer.get().toByteBuffer("c_val"), System.currentTimeMillis())));
    batchMutate.addSuperInsertion("key1", columnFamilies, sc2);
    assertEquals(2, batchMutate.getMutationMap().get(StringSerializer.get().toByteBuffer("key1")).get("Standard1").size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.