com.datastax.driver.core.Row.getBytesUnsafe()方法的使用及代码示例

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

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

Row.getBytesUnsafe介绍

[英]Returns the ith value of this row as a ByteBuffer. Note: this method always return the bytes composing the value, even if the column is not of type BLOB. That is, this method never throw an InvalidTypeException. However, if the type is not BLOB, it is up to the caller to handle the returned value correctly.
[中]以字节缓冲格式返回此行的第i个值。注意:此方法始终返回组成值的字节,即使列不是BLOB类型。也就是说,此方法从不抛出InvalidTypeException。但是,如果类型不是BLOB,则由调用方正确处理返回值。

代码示例

代码示例来源:origin: prestodb/presto

stringBuilder.setLength(0);
for (int i = 0; i < partitionKeyColumns.size(); i++) {
  ByteBuffer component = row.getBytesUnsafe(i);
  if (isComposite) {

代码示例来源:origin: prestodb/presto

case BLOB:
case CUSTOM:
  return Bytes.toHexString(row.getBytesUnsafe(i));
default:
  throw new IllegalStateException("Handling of type " + cassandraType

代码示例来源:origin: brianfrankcooper/YCSB

ByteBuffer val = row.getBytesUnsafe(def.getName());
if (val != null) {
 tuple.put(def.getName(), new ByteArrayByteIterator(val.array()));

代码示例来源:origin: brianfrankcooper/YCSB

ByteBuffer val = row.getBytesUnsafe(def.getName());
if (val != null) {
 result.put(def.getName(), new ByteArrayByteIterator(val.array()));

代码示例来源:origin: apache/usergrid

ByteBuffer column = unique.getBytesUnsafe("column1");

代码示例来源:origin: prestodb/presto

case BLOB:
case CUSTOM:
  return NullableValue.of(nativeType, wrappedBuffer(row.getBytesUnsafe(i)));
case SET:
  checkTypeArguments(cassandraType, 1, typeArguments);

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

@Override
public ByteBuffer getBytesUnsafe(int i)
{
  return row.getBytesUnsafe(i);
}

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

@Override
public ByteBuffer getBytesUnsafe(int i)
{
  return row.getBytesUnsafe(i);
}

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

@Override
public ByteBuffer getBytesUnsafe(int i)
{
  return row.getBytesUnsafe(i);
}

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

@Override
public ByteBuffer getBytesUnsafe(String name)
{
  return row.getBytesUnsafe(name);
}

代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor

@Override
  protected ByteBuffer getValue(Row row) {
    return row.getBytesUnsafe(_contentIndex);
  }
}

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

@Override
public ByteBuffer getBytesUnsafe(String name)
{
  return row.getBytesUnsafe(name);
}

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

@Override
public ByteBuffer getBytesUnsafe(String name)
{
  return row.getBytesUnsafe(name);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

Object queriedValue = codec.deserialize(row.getBytesUnsafe("v"), protocolVersion);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(r.getBytesUnsafe("c1")).isEqualTo(serializeForDynamicCompositeType(12, 3));
assertThat(r.getBytesUnsafe("c2")).isEqualTo(serializeForCompositeType("foo"));
assertThat(r.getInt("c3")).isEqualTo(3);
assertThat(r.getBytesUnsafe("c1")).isEqualTo(serializeForDynamicCompositeType(42));
assertThat(r.getBytesUnsafe("c2")).isEqualTo(serializeForCompositeType("", 42));
assertThat(r.getInt("c3")).isEqualTo(2);
assertThat(r.getBytesUnsafe("c1")).isEqualTo(serializeForDynamicCompositeType("foo", 32));
assertThat(r.getBytesUnsafe("c2")).isEqualTo(serializeForCompositeType("foo", 32));
assertThat(r.getInt("c3")).isEqualTo(1);

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
  protected K computeNext() {
    if (rowIterator.hasNext()) {
      return _keySerializer.deserialize(rowIterator.next().getBytesUnsafe(0));
    } else {
      return endOfData();
    }
  }
};

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

/**
  * Reads timestamp binary value directly (getBytesUnsafe) to avoid allocating java.util.Date, and
  * converts to microseconds.
  */
 public long deserialize(Row row, String name) {
  return 1000L * TypeCodec.bigint().deserialize(row.getBytesUnsafe(name), protocolVersion);
 }
}

代码示例来源:origin: net.oneandone.troilus/troilus-core-java7

private String toString(String name, DataType dataType) {
  
  if (isNull(name)) {
    return "";
    
  } else {
    final StringBuilder builder = new StringBuilder();
    builder.append(ctx.getUDTValueMapper().deserialize(dataType, getRow().getBytesUnsafe(name)));
    
    return builder.toString();
  }
}

代码示例来源:origin: net.oneandone/troilus-core-java7

private String toString(String name, DataType dataType) {
  if (isNull(name)) {
    return "";
  } else {
    StringBuilder builder = new StringBuilder();
    builder.append(dataType.deserialize(getRow().getBytesUnsafe(name), ctx.getDbSession().getProtocolVersion()));
    return builder.toString();
  }
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public V get(final K key) {
  BoundStatement getValueStatement = _getValueStatement.bind();
  getValueStatement.setBytesUnsafe(0, _keySerializer.serialize(key));
  ByteBuffer result = _session.execute(getValueStatement).one().getBytesUnsafe(0);
  if (result != null) {
    return _valueSerializer.deserialize(result);
  } else {
    return null;
  }
}

相关文章