当前位置: 首页>>代码示例>>Java>>正文


Java TCell类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.thrift.generated.TCell的典型用法代码示例。如果您正苦于以下问题:Java TCell类的具体用法?Java TCell怎么用?Java TCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TCell类属于org.apache.hadoop.hbase.thrift.generated包,在下文中一共展示了TCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVer

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this public interface is slightly different from public Java APIs in regard to
 * handling of the qualifier. Here we differ from the public Java API in that null != byte[0].
 * Rather, we respect qual == null as a request for the entire column family. If you want to
 * access the entire column family, use
 * {@link #getVer(ByteBuffer, ByteBuffer, ByteBuffer, int, Map)} with a {@code column} value
 * that lacks a {@code ':'}.
 */
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {

  Table table = null;
  try {
    table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(Throwables.getStackTraceAsString(e));
  } finally{
    closeTable(table);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:ThriftServerRunner.java

示例2: getVerTs

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this internal interface is slightly different from public APIs in regard to handling
 * of the qualifier. Here we differ from the public Java API in that null != byte[0]. Rather,
 * we respect qual == null as a request for the entire column family. The caller (
 * {@link #getVerTs(ByteBuffer, ByteBuffer, ByteBuffer, long, int, Map)}) interface IS
 * consistent in that the column is parse like normal.
 */
protected List<TCell> getVerTs(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, long timestamp, int numVersions, Map<ByteBuffer, ByteBuffer> attributes)
    throws IOError {

  Table table = null;
  try {
    table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setTimeRange(0, timestamp);
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(Throwables.getStackTraceAsString(e));
  } finally{
    closeTable(table);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:ThriftServerRunner.java

示例3: printRow

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
private void printRow(TRowResult rowResult) {
  // copy values into a TreeMap to get them in sorted order

  TreeMap<String, TCell> sorted = new TreeMap<String, TCell>();
  for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
    sorted.put(utf8(column.getKey().array()), column.getValue());
  }

  StringBuilder rowStr = new StringBuilder();
  for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
    rowStr.append(entry.getKey());
    rowStr.append(" => ");
    rowStr.append(utf8(entry.getValue().value.array()));
    rowStr.append("; ");
  }
  System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:HttpDoAsClient.java

示例4: printRow

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
private void printRow(TRowResult rowResult) {
    // copy values into a TreeMap to get them in sorted order

    TreeMap<String, TCell> sorted = new TreeMap<String, TCell>();
    for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
        sorted.put(utf8(column.getKey().array()), column.getValue());
    }

    StringBuilder rowStr = new StringBuilder();
    for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
        rowStr.append(entry.getKey());
        rowStr.append(" => ");
        rowStr.append(utf8(entry.getValue().value.array()));
        rowStr.append("; ");
    }
    System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:DemoClient.java

示例5: printRow

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
private final void printRow(TRowResult rowResult) {
    // copy values into a TreeMap to get them in sorted order

    TreeMap<String, TCell> sorted = new TreeMap<String, TCell>();
    for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
        sorted.put(utf8(column.getKey().array()), column.getValue());
    }

    StringBuilder rowStr = new StringBuilder();
    for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
        rowStr.append(entry.getKey());
        rowStr.append(" => ");
        rowStr.append(utf8(entry.getValue().value.array()));
        rowStr.append("; ");
    }
    System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:DemoClient.java

示例6: getVer

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row,
                          byte[] family,
    byte[] qualifier, int numVersions,
    Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
  try {
    HTable table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    get.addColumn(family, qualifier);
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.raw());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(e.getMessage());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:ThriftServerRunner.java

示例7: getVerTs

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
@Deprecated
@Override
public List<TCell> getVerTs(ByteBuffer tableName,
                               ByteBuffer row,
    ByteBuffer column,
    long timestamp,
    int numVersions,
    Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
  byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
  if(famAndQf.length == 1) {
    return getVerTs(tableName, row, famAndQf[0], new byte[0], timestamp,
        numVersions, attributes);
  }
  return getVerTs(tableName, row, famAndQf[0], famAndQf[1], timestamp,
      numVersions, attributes);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:ThriftServerRunner.java

示例8: getVer

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this public interface is slightly different from public Java APIs in regard to
 * handling of the qualifier. Here we differ from the public Java API in that null != byte[0].
 * Rather, we respect qual == null as a request for the entire column family. If you want to
 * access the entire column family, use
 * {@link #getVer(ByteBuffer, ByteBuffer, ByteBuffer, int, Map)} with a {@code column} value
 * that lacks a {@code ':'}.
 */
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
  try {
    HTable table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(e.getMessage());
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:28,代码来源:ThriftServerRunner.java

示例9: getVerTs

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this internal interface is slightly different from public APIs in regard to handling
 * of the qualifier. Here we differ from the public Java API in that null != byte[0]. Rather,
 * we respect qual == null as a request for the entire column family. The caller (
 * {@link #getVerTs(ByteBuffer, ByteBuffer, ByteBuffer, long, int, Map)}) interface IS
 * consistent in that the column is parse like normal.
 */
protected List<TCell> getVerTs(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, long timestamp, int numVersions, Map<ByteBuffer, ByteBuffer> attributes)
    throws IOError {
  try {
    HTable table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setTimeRange(0, timestamp);
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(e.getMessage());
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:29,代码来源:ThriftServerRunner.java

示例10: printlnResult

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * 列印TRowResult
 *
 * @param result
 */
public static void printlnResult(TRowResult result) {
	StringBuilder buff = new StringBuilder();
	Map<ByteBuffer, TCell> columns = result.getColumns();
	int size = columns.size();
	//
	buff.append(ByteHelper.toString(result.getRow()) + ", ");// rowKey
	int i = 0;
	for (Map.Entry<ByteBuffer, TCell> entry : columns.entrySet()) {
		buff.append(ByteBufferHelper.toString(entry.getKey()));
		buff.append("=");
		buff.append(ByteHelper.toString((entry.getValue().getValue())));
		//
		if (i < size - 1) {
			buff.append(", ");
		}
		i++;
	}
	System.out.println(buff);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:25,代码来源:HBaseThriftDMLTest.java

示例11: getVer

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this public interface is slightly different from public Java APIs in regard to
 * handling of the qualifier. Here we differ from the public Java API in that null != byte[0].
 * Rather, we respect qual == null as a request for the entire column family. If you want to
 * access the entire column family, use
 * {@link #getVer(ByteBuffer, ByteBuffer, ByteBuffer, int, Map)} with a {@code column} value
 * that lacks a {@code ':'}.
 */
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {

  Table table = null;
  try {
    table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw getIOError(e);
  } finally{
    closeTable(table);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:32,代码来源:ThriftServerRunner.java

示例12: getVerTs

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * Note: this internal interface is slightly different from public APIs in regard to handling
 * of the qualifier. Here we differ from the public Java API in that null != byte[0]. Rather,
 * we respect qual == null as a request for the entire column family. The caller (
 * {@link #getVerTs(ByteBuffer, ByteBuffer, ByteBuffer, long, int, Map)}) interface IS
 * consistent in that the column is parse like normal.
 */
protected List<TCell> getVerTs(ByteBuffer tableName, ByteBuffer row, byte[] family,
    byte[] qualifier, long timestamp, int numVersions, Map<ByteBuffer, ByteBuffer> attributes)
    throws IOError {

  Table table = null;
  try {
    table = getTable(tableName);
    Get get = new Get(getBytes(row));
    addAttributes(get, attributes);
    if (null == qualifier) {
      get.addFamily(family);
    } else {
      get.addColumn(family, qualifier);
    }
    get.setTimeRange(0, timestamp);
    get.setMaxVersions(numVersions);
    Result result = table.get(get);
    return ThriftUtilities.cellFromHBase(result.rawCells());
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw getIOError(e);
  } finally{
    closeTable(table);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:33,代码来源:ThriftServerRunner.java

示例13: printRow

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
private void printRow(TRowResult rowResult) {
  // copy values into a TreeMap to get them in sorted order

  TreeMap<String, TCell> sorted = new TreeMap<>();
  for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
    sorted.put(utf8(column.getKey().array()), column.getValue());
  }

  StringBuilder rowStr = new StringBuilder();
  for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
    rowStr.append(entry.getKey());
    rowStr.append(" => ");
    rowStr.append(utf8(entry.getValue().value.array()));
    rowStr.append("; ");
  }
  System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:HttpDoAsClient.java

示例14: printRow

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
private void printRow(TRowResult rowResult) {
    // copy values into a TreeMap to get them in sorted order

    TreeMap<String, TCell> sorted = new TreeMap<>();
    for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
        sorted.put(utf8(column.getKey().array()), column.getValue());
    }

    StringBuilder rowStr = new StringBuilder();
    for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
        rowStr.append(entry.getKey());
        rowStr.append(" => ");
        rowStr.append(utf8(entry.getValue().value.array()));
        rowStr.append("; ");
    }
    System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:DemoClient.java

示例15: rowResultFromHBase

import org.apache.hadoop.hbase.thrift.generated.TCell; //导入依赖的package包/类
/**
 * This utility method creates a list of Thrift TRowResult "struct" based on
 * an Hbase RowResult object. The empty list is returned if the input is
 * null.
 *
 * @param in
 *          Hbase RowResult object
 * @return Thrift TRowResult array
 */
static public List<TRowResult> rowResultFromHBase(Result[] in) {
  List<TRowResult> results = new ArrayList<TRowResult>();
  for ( Result result_ : in) {
      if(result_ == null || result_.isEmpty()) {
          continue;
      }
      TRowResult result = new TRowResult();
      result.row = ByteBuffer.wrap(result_.getRow());
      result.columns = new TreeMap<ByteBuffer, TCell>();
      for(KeyValue kv : result_.raw()) {
        result.columns.put(
            ByteBuffer.wrap(KeyValue.makeColumn(kv.getFamily(),
                kv.getQualifier())),
            new TCell(ByteBuffer.wrap(kv.getValue()), kv.getTimestamp()));
      }
    results.add(result);
  }
  return results;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:29,代码来源:ThriftUtilities.java


注:本文中的org.apache.hadoop.hbase.thrift.generated.TCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。