org.apache.hadoop.hbase.client.Put.toString()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(200)

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

Put.toString介绍

暂无

代码示例

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

static void putData(HRegion region, Durability durability,
  int startRow, int numRows, byte[] qf, byte[]... families) throws IOException {
 for (int i = startRow; i < startRow + numRows; i++) {
  Put put = new Put(Bytes.toBytes("" + i));
  put.setDurability(durability);
  for (byte[] family : families) {
   put.addColumn(family, qf, null);
  }
  region.put(put);
  LOG.info(put.toString());
 }
}

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

table.put(put);
if (LOG.isTraceEnabled()) {
 LOG.trace("PUT " + put.toString());

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

LOG.trace("PUT " + put.toString());

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

LOG.trace("CHECK-AND-PUT " + put.toString() + ", returns " + retValue);

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

private void deserializeAndSerializeHBaseCompositeKey(HBaseSerDe serDe, Result r, Put p)
  throws SerDeException, IOException {
 StructObjectInspector soi = (StructObjectInspector) serDe.getObjectInspector();
 List<? extends StructField> fieldRefs = soi.getAllStructFieldRefs();
 Object row = serDe.deserialize(new ResultWritable(r));
 for (int j = 0; j < fieldRefs.size(); j++) {
  Object fieldData = soi.getStructFieldData(row, fieldRefs.get(j));
  assertNotNull(fieldData);
 }
 assertEquals(
   "{\"key\":{\"col1\":\"A\",\"col2\":\"B\",\"col3\":\"C\"},\"astring\":\"This is a test data\"}",
   SerDeUtils.getJSONString(row, soi));
 // Now serialize
 Put put = ((PutWritable) serDe.serialize(row, soi)).getPut();
 assertEquals("Serialized put:", p.toString(), put.toString());
}

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

private void deserializeAndSerializeHBaseValueStruct(HBaseSerDe serDe, Result r, Put p)
  throws SerDeException, IOException {
 StructObjectInspector soi = (StructObjectInspector) serDe.getObjectInspector();
 List<? extends StructField> fieldRefs = soi.getAllStructFieldRefs();
 Object row = serDe.deserialize(new ResultWritable(r));
 Object fieldData = null;
 for (int j = 0; j < fieldRefs.size(); j++) {
  fieldData = soi.getStructFieldData(row, fieldRefs.get(j));
  assertNotNull(fieldData);
  if (fieldData instanceof LazyStruct) {
   assertEquals(((LazyStruct) fieldData).getField(0).toString(), "A");
   assertEquals(((LazyStruct) fieldData).getField(1).toString(), "B");
   assertEquals(((LazyStruct) fieldData).getField(2).toString(), "C");
  } else {
   Assert.fail("fieldData should be an instance of LazyStruct");
  }
 }
 assertEquals(
   "{\"key\":{\"col1\":\"A\",\"col2\":\"B\",\"col3\":\"C\"},\"astring\":{\"col1\":\"A\",\"col2\":\"B\",\"col3\":\"C\"}}",
   SerDeUtils.getJSONString(row, soi));
 // Now serialize
 Put put = ((PutWritable) serDe.serialize(row, soi)).getPut();
 assertEquals("Serialized put:", p.toString(), put.toString());
}

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

private void deserializeAndSerialize(
  HBaseSerDe serDe, Result r, Put p,
  Object[] expectedFieldsData) throws SerDeException {
 // Get the row structure
 StructObjectInspector oi = (StructObjectInspector)
  serDe.getObjectInspector();
 List<? extends StructField> fieldRefs = oi.getAllStructFieldRefs();
 assertEquals(9, fieldRefs.size());
 // Deserialize
 Object row = serDe.deserialize(new ResultWritable(r));
 for (int i = 0; i < fieldRefs.size(); i++) {
  Object fieldData = oi.getStructFieldData(row, fieldRefs.get(i));
  if (fieldData != null) {
   fieldData = ((LazyPrimitive<?, ?>)fieldData).getWritableObject();
  }
  assertEquals("Field " + i, expectedFieldsData[i], fieldData);
 }
 // Serialize
 assertEquals(PutWritable.class, serDe.getSerializedClass());
 PutWritable serializedPut = (PutWritable) serDe.serialize(row, oi);
 assertEquals("Serialized data", p.toString(),String.valueOf(serializedPut.getPut()));
}

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

assertEquals("Serialized put:", p.toString(), put.toString());

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

private void deserializeAndSerializeHiveMapHBaseColumnFamilyII(
  HBaseSerDe hbaseSerDe,
  Result r,
  Put p,
  Object [] expectedData,
  byte [][] columnFamilies,
  byte [][] columnQualifiersAndValues) throws SerDeException {
 StructObjectInspector soi = (StructObjectInspector) hbaseSerDe.getObjectInspector();
 List<? extends StructField> fieldRefs = soi.getAllStructFieldRefs();
 assertEquals(9, fieldRefs.size());
 // Deserialize
 Object row = hbaseSerDe.deserialize(new ResultWritable(r));
 for (int j = 0; j < fieldRefs.size(); j++) {
  Object fieldData = soi.getStructFieldData(row, fieldRefs.get(j));
  assertNotNull(fieldData);
  if (fieldData instanceof LazyPrimitive<?, ?>) {
   assertEquals(expectedData[j], ((LazyPrimitive<?, ?>) fieldData).getWritableObject());
  } else if (fieldData instanceof LazyHBaseCellMap) {
   LazyPrimitive<?, ?> lazyPrimitive = (LazyPrimitive<?, ?>)
    ((LazyHBaseCellMap) fieldData).getMapValueElement(expectedData[j]);
   assertEquals(expectedData[j], lazyPrimitive.getWritableObject());
  } else {
   fail("Error: field data not an instance of LazyPrimitive<?, ?> or LazyHBaseCellMap");
  }
 }
 // Serialize
 Put serializedPut = ((PutWritable) hbaseSerDe.serialize(row, soi)).getPut();
 assertEquals("Serialized data: ", p.toString(), serializedPut.toString());
}

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws Exception {
  // vv FingerprintExample
  Put put = new Put(Bytes.toBytes("testrow"));
  put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-1"),
   Bytes.toBytes("val-1"));
  put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-2"),
   Bytes.toBytes("val-2"));
  put.addColumn(Bytes.toBytes("fam-2"), Bytes.toBytes("qual-3"),
   Bytes.toBytes("val-3"));

  String id = String.format("Hostname: %s, App: %s",
   InetAddress.getLocalHost().getHostName(),
   System.getProperty("sun.java.command"));
  put.setId(id);

  System.out.println("Put.size: " + put.size());
  System.out.println("Put.id: " + put.getId());
  System.out.println("Put.fingerprint: " + put.getFingerprint());
  System.out.println("Put.toMap: " + put.toMap());
  System.out.println("Put.toJSON: " + put.toJSON());
  System.out.println("Put.toString: " + put.toString());
  // ^^ FingerprintExample
 }
}

代码示例来源:origin: co.cask.cdap/cdap-hbase-compat-base

@Override
 public String toString() {
  return put.toString();
 }
}

代码示例来源:origin: cdapio/cdap

@Override
 public String toString() {
  return put.toString();
 }
}

代码示例来源:origin: jrkinley/storm-hbase

/**
 * Updates the latest txid for the counter
 * @param row The row key
 * @param fam The column family
 * @param qual The column qualifier of the txid (e.g. the counters qualifier + "_txid")
 */
private void putLatestTxid(byte[] row, byte[] fam, byte[] qual) {
 Put txidPut = new Put(row);
 txidPut.add(fam, qual, attempt.getTransactionId().toByteArray());
 try {
  connector.getTable().put(txidPut);
 } catch (IOException e) {
  throw new RuntimeException("Unable to update txid for " + txidPut.toString(), e);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

static void putData(HRegion region, Durability durability,
  int startRow, int numRows, byte[] qf, byte[]... families) throws IOException {
 for (int i = startRow; i < startRow + numRows; i++) {
  Put put = new Put(Bytes.toBytes("" + i));
  put.setDurability(durability);
  for (byte[] family : families) {
   put.addColumn(family, qf, null);
  }
  region.put(put);
  LOG.info(put.toString());
 }
}

代码示例来源:origin: co.cask.hbase/hbase

valueToPutParts[1], valueToCheckCell.getValue(), put);
if (LOG.isDebugEnabled()) {
 LOG.debug("CHECK-AND-PUT " + put.toString() + ", returns " + retValue);

代码示例来源:origin: co.cask.hbase/hbase

table.put(put);
if (LOG.isDebugEnabled()) {
 LOG.debug("PUT " + put.toString());

代码示例来源:origin: co.cask.hbase/hbase

LOG.debug("PUT " + put.toString());

代码示例来源:origin: org.apache.hbase/hbase-rest

table.put(put);
if (LOG.isTraceEnabled()) {
 LOG.trace("PUT " + put.toString());

代码示例来源:origin: com.aliyun.hbase/alihbase-rest

table.put(put);
if (LOG.isTraceEnabled()) {
 LOG.trace("PUT " + put.toString());

代码示例来源:origin: com.aliyun.hbase/alihbase-rest

LOG.trace("PUT " + put.toString());

相关文章