Examples of ColumnFamily


Examples of org.apache.cassandra.db.ColumnFamily

        SSTableImport.importJson(jsonUrl, "Keyspace1", "Super4", tempSS.getPath());
       
        // Verify results
        SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Super4", null, null), ByteBufferUtil.bytes("superA"));
        ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
        IColumn superCol = cf.getColumn(ByteBufferUtil.bytes("superA"));
        assert superCol != null;
        assert superCol.getSubColumns().size() > 0;
        IColumn subColumn = superCol.getSubColumn(ByteBufferUtil.bytes("colAA"));
        assert subColumn.value().equals(hexToBytes("76616c75654141"));
    }
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

    public void testImportUnsortedMode() throws IOException
    {
        String jsonUrl = getClass().getClassLoader().getResource("UnsortedSuperCF.json").getPath();
        File tempSS = tempSSTableFile("Keyspace1", "Super4");

        ColumnFamily columnFamily = ColumnFamily.create("Keyspace1", "Super4");
        IPartitioner<?> partitioner = DatabaseDescriptor.getPartitioner();

        SSTableImport.setKeyCountToImport(3);
        int result = SSTableImport.importSorted(jsonUrl, columnFamily, tempSS.getPath(), partitioner);
        assert result == -1;
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        // anyway, so the odds of a "tombstones consuming memory indefinitely" problem are minimal.
        // See https://issues.apache.org/jira/browse/CASSANDRA-3921 for more discussion.
        if (CacheService.instance.rowCache.isPutCopying())
            return;

        ColumnFamily cachedRow = cfs.getRawCachedRow(key);
        if (cachedRow != null)
            ColumnFamilyStore.removeDeleted(cachedRow, gcBefore);
    }
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        String queryFor = sColumnFamily;
        if(sColumn != null && !"*".equals(sColumn))
        {
          queryFor += ":" + sColumn;
        }
          ColumnFamily cf = table.get(sKey, queryFor);

          if (cf == null)
          {
              sRetVal = "Key [" + sKey + "], column family [" + sColumnFamily + "] not found.";
          }
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        Map<String, ColumnFamily> columnFamilies = diffRow.getColumnFamilyMap();
          Set<String> cfNames = columnFamilies.keySet();
         
          for ( String cfName : cfNames )
          {
              ColumnFamily cf = columnFamilies.get(cfName);
              rowMutation.add(cf);
          }
            RowMutationMessage rowMutationMessage = new RowMutationMessage(rowMutation);
          // schedule the read repair
          ReadRepairManager.instance().schedule(endPoints.get(i),rowMutationMessage);
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

                versionSources.add(current.right);
            }

            protected Row getReduced()
            {
                ColumnFamily resolved = versions.size() > 1
                                      ? RowRepairResolver.resolveSuperset(versions)
                                      : versions.get(0);
                if (versions.size() < sources.size())
                {
                    // add placeholder rows for sources that didn't have any data, so maybeScheduleRepairs sees them
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        }
    }

    public static Message createMessage(String keyspace, byte[] key, String columnFamily, List<ColumnFamily> columnFamilies)
    {
        ColumnFamily baseColumnFamily;
        DataOutputBuffer bufOut = new DataOutputBuffer();
        RowMutation rm;
        Message message;
        Column column;

        /* Get the first column family from list, this is just to get past validation */
        baseColumnFamily = new ColumnFamily(ColumnFamilyType.Standard,
                                            DatabaseDescriptor.getComparator(keyspace, columnFamily),
                                            DatabaseDescriptor.getSubComparator(keyspace, columnFamily),
                                            CFMetaData.getId(keyspace, columnFamily));
       
        for(ColumnFamily cf : columnFamilies) {
            bufOut.reset();
            ColumnFamily.serializer().serializeWithIndexes(cf, bufOut);
            byte[] data = new byte[bufOut.getLength()];
            System.arraycopy(bufOut.getData(), 0, data, 0, bufOut.getLength());

            column = new Column(FBUtilities.toByteBuffer(cf.id()), ByteBuffer.wrap(data), 0);
            baseColumnFamily.addColumn(column);
        }
        rm = new RowMutation(keyspace, ByteBuffer.wrap(key));
        rm.add(baseColumnFamily);

        try
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

            StorageService.instance.stopClient();
        }

        public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException
        {
            ColumnFamily columnFamily;
            String keyspace = "Keyspace1";
            String cfName = "Super1";
            Message message;
            List<ColumnFamily> columnFamilies;
            columnFamilies = new LinkedList<ColumnFamily>();
            String line;

            /* Create a column family */
            columnFamily = ColumnFamily.create(keyspace, cfName);
            while (values.hasNext()) {
                // Split the value (line based on your own delimiter)
                line = values.next().toString();
                String[] fields = line.split("\1");
                String SuperColumnName = fields[1];
                String ColumnName = fields[2];
                String ColumnValue = fields[3];
                int timestamp = 0;
                columnFamily.addColumn(new QueryPath(cfName,
                                                     ByteBufferUtil.bytes(SuperColumnName),
                                                     ByteBufferUtil.bytes(ColumnName)),
                                       ByteBufferUtil.bytes(ColumnValue),
                                       timestamp);
            }
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        Set<SSTable> sstables = new HashSet<SSTable>();
        for (SSTableIdentityIterator row : rows)
        {
            sstables.add(row.sstable);
            ColumnFamily cf = row.getColumnFamily();

            if (emptyColumnFamily == null)
                emptyColumnFamily = cf;
            else
                emptyColumnFamily.delete(cf);
View Full Code Here

Examples of org.apache.cassandra.db.ColumnFamily

        protected IColumn getReduced()
        {
            assert container != null;
            IColumn reduced = container.iterator().next();
            ColumnFamily purged = shouldPurge ? ColumnFamilyStore.removeDeleted(container, gcBefore) : container;
            if (purged == null || !purged.iterator().hasNext())
            {
                container.clear();
                return null;
            }
            container.clear();
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.