Package org.apache.cassandra.cql.common

Examples of org.apache.cassandra.cql.common.ConstantOperand


        CommonTree columnFamilySpec = (CommonTree)ast.getChild(0);
        assert(columnFamilySpec.getType() == CqlParser.A_COLUMN_ACCESS);

        CFMetaData cfMetaData = getColumnFamilyInfo(columnFamilySpec);
        ConstantOperand rowKey = new ConstantOperand(getRowKey(columnFamilySpec));
        int dimensionCnt = numColumnDimensions(columnFamilySpec);

        RowSourceDef rwsDef;
        if ("Super".equals(cfMetaData.columnType))
        {
            if (dimensionCnt > 2)
            {
                // We don't expect this case to arise, since Cql.g grammar disallows this.
                // therefore, raise this case as an "internal error".
                throw new SemanticException(CompilerErrorMsg.INTERNAL_ERROR.getMsg(columnFamilySpec));
            }

            if (dimensionCnt == 2)
            {
                // Case: table.super_cf[<rowKey>][<superColumnKey>][<columnKey>]
                ConstantOperand superColumnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));               
                ConstantOperand columnKey = new ConstantOperand(getColumn(columnFamilySpec, 1));
                rwsDef = new UniqueKeyQueryRSD(cfMetaData, rowKey, superColumnKey, columnKey);
            }
            else if (dimensionCnt == 1)
            {
                // Case: table.super_cf[<rowKey>][<superColumnKey>]
                ConstantOperand superColumnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));               
                rwsDef = new ColumnRangeQueryRSD(cfMetaData, rowKey, superColumnKey, -1, Integer.MAX_VALUE);
            }
            else
            {
                // Case: table.super_cf[<rowKey>]            
                rwsDef = new SuperColumnRangeQueryRSD(cfMetaData, rowKey, -1, Integer.MAX_VALUE);
            }
        }
        else  // Standard Column Family
        {
            if (dimensionCnt == 1)
            {
                // Case: table.standard_cf[<rowKey>][<columnKey>]
                ConstantOperand columnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));
                rwsDef = new UniqueKeyQueryRSD(cfMetaData, rowKey, columnKey);
            }
            else
            {
                // Case: table.standard_cf[<rowKey>]
View Full Code Here


        // for now, the only simple expressions support are of string type
        if (type != CqlParser.StringLiteral)
        {
            throw new SemanticException(CompilerErrorMsg.INVALID_TYPE.getMsg(ast));
        }
        return new ConstantOperand(Utils.unescapeSQLString(ast.getText()));
    }
View Full Code Here

        CommonTree columnFamilySpec = (CommonTree)ast.getChild(0);
        assert(columnFamilySpec.getType() == CqlParser.A_COLUMN_ACCESS);

        CFMetaData cfMetaData = getColumnFamilyInfo(columnFamilySpec);
        ConstantOperand rowKey = new ConstantOperand(getRowKey(columnFamilySpec));
        int dimensionCnt = numColumnDimensions(columnFamilySpec);

        CommonTree  valueNode = (CommonTree)(ast.getChild(1));

        Plan plan = null;
        if ("Super".equals(cfMetaData.columnType))
        {
            if (dimensionCnt == 2)
            {
                // Case: set table.super_cf['key']['supercolumn']['column'] = 'value'
                OperandDef value = getSimpleExpr(valueNode);
                ConstantOperand superColumnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));
                ConstantOperand columnKey = new ConstantOperand(getColumn(columnFamilySpec, 1));
                plan = new SetUniqueKey(cfMetaData, rowKey, superColumnKey, columnKey, value);
            }
            else if (dimensionCnt == 1)
            {
                // Case: set table.super_cf['key']['supercolumn'] = <column_map>;
                ColumnMapExpr columnMapExpr = getColumnMapExpr(valueNode);               
                ConstantOperand superColumnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));
                plan = new SetColumnMap(cfMetaData, rowKey, superColumnKey, columnMapExpr);
            }
            else
            {
                // Case: set table.super_cf['key'] = <super_column_map>;
                logger_.assertLog(dimensionCnt == 0, "invalid dimensionCnt: " + dimensionCnt);
                SuperColumnMapExpr superColumnMapExpr = getSuperColumnMapExpr(valueNode);               
                plan = new SetSuperColumnMap(cfMetaData, rowKey, superColumnMapExpr);
            }
        }
        else  // Standard column family
        {
            if (dimensionCnt == 1)
            {
                // Case: set table.standard_cf['key']['column'] = 'value'
                OperandDef value = getSimpleExpr(valueNode);               
                ConstantOperand columnKey = new ConstantOperand(getColumn(columnFamilySpec, 0));
                plan = new SetUniqueKey(cfMetaData, rowKey, columnKey, value);
            }
            else
            {
                // Case: set table.standard_cf['key'] = <column_map>;
View Full Code Here

TOP

Related Classes of org.apache.cassandra.cql.common.ConstantOperand

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.