org.apache.cassandra.cql3.QueryProcessor.validateKey()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.apache.cassandra.cql3.QueryProcessor.validateKey方法的一些代码示例,展示了QueryProcessor.validateKey的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryProcessor.validateKey方法的具体详情如下:
包路径:org.apache.cassandra.cql3.QueryProcessor
类名称:QueryProcessor
方法名:validateKey

QueryProcessor.validateKey介绍

暂无

代码示例

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public List<ByteBuffer> buildPartitionKeyNames(QueryOptions options)
throws InvalidRequestException
{
  List<ByteBuffer> partitionKeys = restrictions.getPartitionKeys(options);
  for (ByteBuffer key : partitionKeys)
    QueryProcessor.validateKey(key);
  return partitionKeys;
}

代码示例来源:origin: jsevellec/cassandra-unit

public List<ByteBuffer> buildPartitionKeyNames(QueryOptions options)
throws InvalidRequestException
{
  List<ByteBuffer> partitionKeys = restrictions.getPartitionKeys(options);
  for (ByteBuffer key : partitionKeys)
    QueryProcessor.validateKey(key);
  return partitionKeys;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public List<ByteBuffer> buildPartitionKeyNames(QueryOptions options)
throws InvalidRequestException
{
  List<ByteBuffer> partitionKeys = restrictions.getPartitionKeys(options);
  for (ByteBuffer key : partitionKeys)
    QueryProcessor.validateKey(key);
  return partitionKeys;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

private void validate(Collection<Mutation> tmutations) throws InvalidRequestException
{
  for (Mutation mutation : tmutations)
  {
    QueryProcessor.validateKey(mutation.key().getKey());
    for (PartitionUpdate update : mutation.getPartitionUpdates())
      update.validate();
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

private void validate(Collection<Mutation> tmutations) throws InvalidRequestException
{
  for (Mutation mutation : tmutations)
  {
    QueryProcessor.validateKey(mutation.key().getKey());
    for (PartitionUpdate update : mutation.getPartitionUpdates())
      update.validate();
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

private void validate(Collection<Mutation> tmutations) throws InvalidRequestException
{
  for (Mutation mutation : tmutations)
  {
    QueryProcessor.validateKey(mutation.key().getKey());
    for (PartitionUpdate update : mutation.getPartitionUpdates())
      update.validate();
  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

private List<ReadCommand> getSliceCommands(QueryOptions options, int limit, long now) throws RequestValidationException
{
  Collection<ByteBuffer> keys = getKeys(options);
  if (keys.isEmpty()) // in case of IN () for (the last column of) the partition key.
    return null;
  List<ReadCommand> commands = new ArrayList<>(keys.size());
  IDiskAtomFilter filter = makeFilter(options, limit);
  if (filter == null)
    return null;
  // Note that we use the total limit for every key, which is potentially inefficient.
  // However, IN + LIMIT is not a very sensible choice.
  for (ByteBuffer key : keys)
  {
    QueryProcessor.validateKey(key);
    // We should not share the slice filter amongst the commands (hence the cloneShallow), due to
    // SliceQueryFilter not being immutable due to its columnCounter used by the lastCounted() method
    // (this is fairly ugly and we should change that but that's probably not a tiny refactor to do that cleanly)
    commands.add(ReadCommand.create(keyspace(), ByteBufferUtil.clone(key), columnFamily(), now, filter.cloneShallow()));
  }
  return commands;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

private void validate(Collection<Mutation> tmutations) throws InvalidRequestException
{
  for (Mutation mutation : tmutations)
  {
    QueryProcessor.validateKey(mutation.key());
    for (ColumnFamily tcf : mutation.getColumnFamilies())
      for (Cell cell : tcf)
        cell.validateFields(tcf.metadata());
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

private ReadQuery getSliceCommands(QueryOptions options, DataLimits limit, int nowInSec) throws RequestValidationException
{
  Collection<ByteBuffer> keys = restrictions.getPartitionKeys(options);
  if (keys.isEmpty())
    return ReadQuery.EMPTY;
  ClusteringIndexFilter filter = makeClusteringIndexFilter(options);
  if (filter == null)
    return ReadQuery.EMPTY;
  RowFilter rowFilter = getRowFilter(options);
  // Note that we use the total limit for every key, which is potentially inefficient.
  // However, IN + LIMIT is not a very sensible choice.
  List<SinglePartitionReadCommand> commands = new ArrayList<>(keys.size());
  for (ByteBuffer key : keys)
  {
    QueryProcessor.validateKey(key);
    DecoratedKey dk = cfm.decorateKey(ByteBufferUtil.clone(key));
    ColumnFilter cf = (cfm.isSuper() && cfm.isDense()) ? SuperColumnCompatibility.getColumnFilter(cfm, options, restrictions.getSuperColumnRestrictions()) : queriedColumns;
    commands.add(SinglePartitionReadCommand.create(cfm, nowInSec, cf, rowFilter, limit, dk, filter));
  }
  return new SinglePartitionReadCommand.Group(commands, limit);
}

代码示例来源:origin: jsevellec/cassandra-unit

private ReadQuery getSliceCommands(QueryOptions options, DataLimits limit, int nowInSec) throws RequestValidationException
{
  Collection<ByteBuffer> keys = restrictions.getPartitionKeys(options);
  if (keys.isEmpty())
    return ReadQuery.EMPTY;
  ClusteringIndexFilter filter = makeClusteringIndexFilter(options);
  if (filter == null)
    return ReadQuery.EMPTY;
  RowFilter rowFilter = getRowFilter(options);
  // Note that we use the total limit for every key, which is potentially inefficient.
  // However, IN + LIMIT is not a very sensible choice.
  List<SinglePartitionReadCommand> commands = new ArrayList<>(keys.size());
  for (ByteBuffer key : keys)
  {
    QueryProcessor.validateKey(key);
    DecoratedKey dk = cfm.decorateKey(ByteBufferUtil.clone(key));
    ColumnFilter cf = (cfm.isSuper() && cfm.isDense()) ? SuperColumnCompatibility.getColumnFilter(cfm, options, restrictions.getSuperColumnRestrictions()) : queriedColumns;
    commands.add(SinglePartitionReadCommand.create(cfm, nowInSec, cf, rowFilter, limit, dk, filter));
  }
  return new SinglePartitionReadCommand.Group(commands, limit);
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

private ReadQuery getSliceCommands(QueryOptions options, DataLimits limit, int nowInSec) throws RequestValidationException
{
  Collection<ByteBuffer> keys = restrictions.getPartitionKeys(options);
  if (keys.isEmpty())
    return ReadQuery.EMPTY;
  ClusteringIndexFilter filter = makeClusteringIndexFilter(options);
  if (filter == null)
    return ReadQuery.EMPTY;
  RowFilter rowFilter = getRowFilter(options);
  // Note that we use the total limit for every key, which is potentially inefficient.
  // However, IN + LIMIT is not a very sensible choice.
  List<SinglePartitionReadCommand> commands = new ArrayList<>(keys.size());
  for (ByteBuffer key : keys)
  {
    QueryProcessor.validateKey(key);
    DecoratedKey dk = cfm.decorateKey(ByteBufferUtil.clone(key));
    ColumnFilter cf = (cfm.isSuper() && cfm.isDense()) ? SuperColumnCompatibility.getColumnFilter(cfm, options, restrictions.getSuperColumnRestrictions()) : queriedColumns;
    commands.add(SinglePartitionReadCommand.create(cfm, nowInSec, cf, rowFilter, limit, dk, filter));
  }
  return new SinglePartitionReadCommand.Group(commands, limit);
}

相关文章

微信公众号

最新文章

更多