Examples of CqlMetadata


Examples of org.apache.cassandra.thrift.CqlMetadata

        result.type = CqlResultType.ROWS;

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
            result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                            Collections.<ByteBuffer, String>emptyMap(),
                                            "AsciiType",
                                            "LongType");
            List<Column> columns = Collections.singletonList(new Column(countColumn).setValue(ByteBufferUtil.bytes((long) rows.size())));
            result.rows = Collections.singletonList(new CqlRow(countColumn, columns));
            return result;
        }
        else
        {
            // otherwise create resultset from query results
            result.schema = new CqlMetadata(new HashMap<ByteBuffer, String>(),
                    new HashMap<ByteBuffer, String>(),
                    TypeParser.getShortName(cfDef.cfm.comparator),
                    TypeParser.getShortName(cfDef.cfm.getDefaultValidator()));
            result.rows = process(rows, result.schema, variables);
            return result;
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

                if (select.isCountOperation())
                {
                    validateCountOperation(select);

                    ByteBuffer countBytes = ByteBufferUtil.bytes("count");
                    result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                                    Collections.<ByteBuffer, String>emptyMap(),
                                                    "AsciiType",
                                                    "LongType");
                    List<Column> columns = Collections.singletonList(new Column(countBytes).setValue(ByteBufferUtil.bytes((long) rows.size())));
                    result.rows = Collections.singletonList(new CqlRow(countBytes, columns));
                    return result;
                }

                // otherwise create resultset from query results
                result.schema = new CqlMetadata(new HashMap<ByteBuffer, String>(),
                                                new HashMap<ByteBuffer, String>(),
                                                TypeParser.getShortName(metadata.comparator),
                                                TypeParser.getShortName(metadata.getDefaultValidator()));
                List<CqlRow> cqlRows = new ArrayList<CqlRow>(rows.size());
                for (org.apache.cassandra.db.Row row : rows)
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

    }

    public CqlResult toThriftResult()
    {
        String UTF8 = "UTF8Type";
        CqlMetadata schema = new CqlMetadata(new HashMap<ByteBuffer, String>(),
                new HashMap<ByteBuffer, String>(),
                // The 2 following ones shouldn't be needed in CQL3
                UTF8, UTF8);

        for (ColumnSpecification name : metadata.names)
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // Even for count, we need to process the result as it'll group some column together in sparse column families
        CqlMetadata schema = createSchema();
        List<CqlRow> cqlRows = process(rows, schema, variables);

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
            result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                            Collections.<ByteBuffer, String>emptyMap(),
                                            "AsciiType",
                                            "LongType");
            List<Column> columns = Collections.singletonList(new Column(countColumn).setValue(ByteBufferUtil.bytes((long) cqlRows.size())));
            result.rows = Collections.singletonList(new CqlRow(countColumn, columns));
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        return process(rows, createSchema(), Collections.<ByteBuffer>emptyList());
    }

    private CqlMetadata createSchema()
    {
        return new CqlMetadata(new HashMap<ByteBuffer, String>(),
                               new HashMap<ByteBuffer, String>(),
                               TypeParser.getShortName(cfDef.cfm.comparator),
                               TypeParser.getShortName(cfDef.cfm.getDefaultValidator()));
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // Even for count, we need to process the result as it'll group some column together in sparse column families
        CqlMetadata schema = createSchema();
        List<CqlRow> cqlRows = process(rows, schema, variables);

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
            result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                            Collections.<ByteBuffer, String>emptyMap(),
                                            "AsciiType",
                                            "LongType");
            List<Column> columns = Collections.singletonList(new Column(countColumn).setValue(ByteBufferUtil.bytes((long) cqlRows.size())));
            result.rows = Collections.singletonList(new CqlRow(countColumn, columns));
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        return process(rows, createSchema(), Collections.<ByteBuffer>emptyList());
    }

    private CqlMetadata createSchema()
    {
        return new CqlMetadata(new HashMap<ByteBuffer, String>(),
                               new HashMap<ByteBuffer, String>(),
                               TypeParser.getShortName(cfDef.cfm.comparator),
                               TypeParser.getShortName(cfDef.cfm.getDefaultValidator()));
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // Even for count, we need to process the result as it'll group some column together in sparse column families
        CqlMetadata schema = createSchema();
        List<CqlRow> cqlRows = process(rows, schema, variables);

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
            result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                            Collections.<ByteBuffer, String>emptyMap(),
                                            "AsciiType",
                                            "LongType");
            List<Column> columns = Collections.singletonList(new Column(countColumn).setValue(ByteBufferUtil.bytes((long) cqlRows.size())));
            result.rows = Collections.singletonList(new CqlRow(countColumn, columns));
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        return TypeParser.getShortName(type);
    }

    private CqlMetadata createSchema()
    {
        return new CqlMetadata(new HashMap<ByteBuffer, String>(),
                               new HashMap<ByteBuffer, String>(),
                               getShortTypeName(cfDef.cfm.comparator),
                               getShortTypeName(cfDef.cfm.getDefaultValidator()));
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.CqlMetadata

        CqlResult result = new CqlResult();
        result.type = CqlResultType.ROWS;

        // Even for count, we need to process the result as it'll group some column together in sparse column families
        CqlMetadata schema = createSchema();
        List<CqlRow> cqlRows = process(rows, schema, variables);

        // count resultset is a single column named "count"
        if (parameters.isCount)
        {
            result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
                                            Collections.<ByteBuffer, String>emptyMap(),
                                            "AsciiType",
                                            "LongType");
            List<Column> columns = Collections.singletonList(new Column(countColumn).setValue(ByteBufferUtil.bytes((long) cqlRows.size())));
            result.rows = Collections.singletonList(new CqlRow(countColumn, columns));
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.