Examples of InvalidRequestException


Examples of org.apache.cassandra.thrift.InvalidRequestException

            if (cfDef != null)
                break;
        }

        if (cfDef == null)
            throw new InvalidRequestException("Index '" + index + "' could not be found in any of the column families of keyspace '" + keyspace() + "'");

        return new UpdateColumnFamily(cfDef);
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

    {

        // Check key
        List<Term> keys = processedKeys.get(cfDef.key.name);
        if (keys == null || keys.isEmpty())
            throw new InvalidRequestException(String.format("Missing mandatory PRIMARY KEY part %s", cfDef.key.name));

        ColumnNameBuilder builder = cfDef.getColumnNameBuilder();
        CFDefinition.Name firstEmpty = null;
        for (CFDefinition.Name name : cfDef.columns.values())
        {
            List<Term> values = processedKeys.get(name.name);
            if (values == null || values.isEmpty())
            {
                firstEmpty = name;
                // For sparse, we must either have all component or none
                if (cfDef.isComposite && !cfDef.isCompact && builder.componentCount() != 0)
                    throw new InvalidRequestException(String.format("Missing mandatory PRIMARY KEY part %s", name));
            }
            else if (firstEmpty != null)
            {
                throw new InvalidRequestException(String.format("Missing PRIMARY KEY part %s since %s is set", firstEmpty, name));
            }
            else
            {
                assert values.size() == 1; // We only allow IN for keys so far
                builder.add(values.get(0), Relation.Type.EQ, variables);
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

        {
            for (ColumnIdentifier column : columns)
            {
                CFDefinition.Name name = cfDef.get(column);
                if (name == null)
                    throw new InvalidRequestException(String.format("Unknown identifier %s", column));

                // For compact, we only have one value except the key, so the only form of DELETE that make sense is without a column
                // list. However, we support having the value name for coherence with the static/sparse case
                if (name.kind != CFDefinition.Name.Kind.COLUMN_METADATA && name.kind != CFDefinition.Name.Kind.VALUE_ALIAS)
                    throw new InvalidRequestException(String.format("Invalid identifier %s for deletion (should not be a PRIMARY KEY part)", column));
            }

            if (cfDef.isCompact)
            {
                    ByteBuffer columnName = builder.build();
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

        {
            if (!column.getValue().isUnary())
                hasCommutativeOperation = true;

            if (hasCommutativeOperation && column.getValue().isUnary())
                throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
        }

        CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
        if (hasCommutativeOperation)
            validateCommutativeForWrite(metadata, cLevel);
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

            Operation op = column.getValue();

            if (op.isUnary())
            {
                if (hasCounterColumn)
                    throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");

                ByteBuffer colValue = op.a.getByteBuffer(getValueValidator(keyspace, colName),variables);

                validateColumn(metadata, colName, colValue);
                rm.add(new QueryPath(columnFamily, null, colName),
                       colValue,
                       (timestamp == null) ? getTimestamp(clientState) : timestamp,
                       getTimeToLive());
            }
            else
            {
                hasCounterColumn = true;

                if (!column.getKey().getText().equals(op.a.getText()))
                    throw new InvalidRequestException("Only expressions like X = X + <long> are supported.");

                long value;

                try
                {
                    value = Long.parseLong(op.b.getText());
                }
                catch (NumberFormatException e)
                {
                    throw new InvalidRequestException(String.format("'%s' is an invalid value, should be a long.",
                                                      op.b.getText()));
                }

                rm.addCounter(new QueryPath(columnFamily, null, colName), value);
            }
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

       
        // Created from an INSERT
       
        // Don't hate, validate.
        if (columnNames.size() != columnValues.size())
            throw new InvalidRequestException("unmatched column names/values");
        if (columnNames.size() < 1)
            throw new InvalidRequestException("no columns specified for INSERT");
       
        columns = new HashMap<Term, Operation>();
       
        for (int i = 0; i < columnNames.size(); i++)
            columns.put(columnNames.get(i), new Operation(columnValues.get(i)));
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

            for (ColumnDef cd : cf_def.column_metadata)
            {
                if (cd.name.equals(columnName.key))
                {
                    if (cd.index_type != null)
                        throw new InvalidRequestException("Index already exists");
                    if (logger.isDebugEnabled())
                        logger.debug("Updating column {} definition for index {}", columnName, indexName);
                    cd.setIndex_type(IndexType.KEYS);
                    cd.setIndex_name(indexName);
                    columnExists = true;
                    break;
                }
            }
            if (!columnExists)
            {
                CFDefinition cfDef = oldCfm.getCfDef();
                CFDefinition.Name name = cfDef.get(columnName);
                if (name != null)
                {
                    switch (name.kind)
                    {
                        case KEY_ALIAS:
                        case COLUMN_ALIAS:
                            throw new InvalidRequestException(String.format("Cannot create index on PRIMARY KEY part %s", columnName));
                        case VALUE_ALIAS:
                            throw new InvalidRequestException(String.format("Cannot create index on column %s of compact CF", columnName));
                    }
                }
                throw new InvalidRequestException("No column definition found for column " + columnName);
            }

            CFMetaData.addDefaultIndexNames(cf_def);
            ThriftValidation.validateCfDef(cf_def, oldCfm);
            return new UpdateColumnFamily(cf_def);
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

    {
        cfProps.validate();

        // Column family name
        if (!name.matches("\\w+"))
            throw new InvalidRequestException(String.format("\"%s\" is not a valid column family name", name));
        if (name.length() > 32)
            throw new InvalidRequestException(String.format("Column family names shouldn't be more than 32 character long (got \"%s\")", name));
       
        // Ensure that exactly one key has been specified.
        if (keyValidator.size() < 1)
            throw new InvalidRequestException("You must specify a PRIMARY KEY");
        else if (keyValidator.size() > 1)
            throw new InvalidRequestException("You may only specify one PRIMARY KEY");

        AbstractType<?> comparator;

        try
        {
            comparator = cfProps.getComparator();
        }
        catch (ConfigurationException e)
        {
            throw new InvalidRequestException(e.toString());
        }

        for (Map.Entry<Term, String> column : columns.entrySet())
        {
            ByteBuffer name = column.getKey().getByteBuffer(comparator, variables);

            if (keyAlias != null && keyAlias.equals(name))
                throw new InvalidRequestException("Invalid column name: "
                                                  + column.getKey().getText()
                                                  + ", because it equals to the key_alias.");

        }
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.InvalidRequestException

                AbstractType<?> validator = TypeParser.parse(validatorClassName);
                columnDefs.put(columnName, new ColumnDefinition(columnName, validator, null, null, null));
            }
            catch (ConfigurationException e)
            {
                InvalidRequestException ex = new InvalidRequestException(e.toString());
                ex.initCause(e);
                throw ex;
            }
        }
       
        return columnDefs;
View Full Code Here

Examples of org.apache.hadoop.fs.InvalidRequestException

      throw new UnsupportedOperationException();
    }
    ShmId shmId = slotId.getShmId();
    RegisteredShm shm = segments.get(shmId);
    if (shm == null) {
      throw new InvalidRequestException("there is no shared memory segment " +
          "registered with shmId " + shmId);
    }
    Slot slot = shm.registerSlot(slotId.getSlotIdx(), blockId);
    if (isCached) {
      slot.makeAnchorable();
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.