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


Java TRowResult类代码示例

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


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

示例1: scannerGetList

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
@Override
public List<TRowResult> scannerGetList(int id,int nbRows)
    throws IllegalArgument, IOError {
  LOG.debug("scannerGetList: id=" + id);
  ResultScannerWrapper resultScannerWrapper = getScanner(id);
  if (null == resultScannerWrapper) {
    String message = "scanner ID is invalid";
    LOG.warn(message);
    throw new IllegalArgument("scanner ID is invalid");
  }

  Result [] results = null;
  try {
    results = resultScannerWrapper.getScanner().next(nbRows);
    if (null == results) {
      return new ArrayList<TRowResult>();
    }
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(Throwables.getStackTraceAsString(e));
  }
  return ThriftUtilities.rowResultFromHBase(results, resultScannerWrapper.isColumnSorted());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:ThriftServerRunner.java

示例2: doTestCheckAndPut

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
/**
 * Check that checkAndPut fails if the cell does not exist, then put in the cell, then check that
 * the checkAndPut succeeds.
 *
 * @throws Exception
 */
public static void doTestCheckAndPut() throws Exception {
  ThriftServerRunner.HBaseHandler handler =
    new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
      UserProvider.instantiate(UTIL.getConfiguration()));
  handler.createTable(tableAname, getColumnDescriptors());
  try {
    List<Mutation> mutations = new ArrayList<Mutation>(1);
    mutations.add(new Mutation(false, columnAname, valueAname, true));
    Mutation putB = (new Mutation(false, columnBname, valueBname, true));

    assertFalse(handler.checkAndPut(tableAname, rowAname, columnAname, valueAname, putB, null));

    handler.mutateRow(tableAname, rowAname, mutations, null);

    assertTrue(handler.checkAndPut(tableAname, rowAname, columnAname, valueAname, putB, null));

    TRowResult rowResult = handler.getRow(tableAname, rowAname, null).get(0);
    assertEquals(rowAname, rowResult.row);
    assertEquals(valueBname, rowResult.columns.get(columnBname).value);
  } finally {
    handler.disableTable(tableAname);
    handler.deleteTable(tableAname);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestThriftServer.java

示例3: printRow

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的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.TRowResult; //导入依赖的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.TRowResult; //导入依赖的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: scannerGetList

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
@Override
public List<TRowResult> scannerGetList(int id,int nbRows)
    throws IllegalArgument, IOError {
  LOG.debug("scannerGetList: id=" + id);
  ResultScannerWrapper resultScannerWrapper = getScanner(id);
  if (null == resultScannerWrapper) {
    String message = "scanner ID is invalid";
    LOG.warn(message);
    throw new IllegalArgument("scanner ID is invalid");
  }

  Result [] results = null;
  try {
    results = resultScannerWrapper.getScanner().next(nbRows);
    if (null == results) {
      return new ArrayList<TRowResult>();
    }
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw new IOError(e.getMessage());
  }
  return ThriftUtilities.rowResultFromHBase(results, resultScannerWrapper.isColumnSorted());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:ThriftServerRunner.java

示例7: printlnResult

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的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

示例8: get

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
/**
 * get 讀取所有column
 *
 * @throws Exception
 */
@Test
// 483 at mills.
// 492 at mills.
// 495 at mills.
public void get() throws Exception {
	String TABLE_NAME = "UIH_OverallItemInfo";
	String rowKey = "1000|I200|A17P|AUDI15028071";
	//
	Map<ByteBuffer, ByteBuffer> attributes = new LinkedHashMap<ByteBuffer, ByteBuffer>();

	long beg = System.currentTimeMillis();
	List<TRowResult> results = client.getRow(
			ByteBufferHelper.toByteBuffer(TABLE_NAME),
			ByteBufferHelper.toByteBuffer(rowKey), attributes);// 可以attributes=null
	long end = System.currentTimeMillis();
	//
	System.out.println((end - beg) + " at mills.");
	printlnResult(results);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:25,代码来源:HBaseThriftDMLTest.java

示例9: getOneColumn

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
/**
 * get 讀取特定column
 *
 * @throws Exception
 */
@Test
// 301 at mills.
// 303 at mills.
// 302 at mills.
public void getOneColumn() throws Exception {
	String TABLE_NAME = "UIH_OverallItemInfo";
	String rowKey = "1000|I200|A17P|AUDI15028071";
	String cloumn = "CommonInfo:SellerID";
	//
	List<ByteBuffer> columns = new LinkedList<ByteBuffer>();
	columns.add(ByteBufferHelper.toByteBuffer(cloumn));
	//
	Map<ByteBuffer, ByteBuffer> attributes = new LinkedHashMap<ByteBuffer, ByteBuffer>();

	long beg = System.currentTimeMillis();
	List<TRowResult> results = client.getRowWithColumns(
			ByteBufferHelper.toByteBuffer(TABLE_NAME),
			ByteBufferHelper.toByteBuffer(rowKey), columns, attributes);// 可以attributes=null
	long end = System.currentTimeMillis();
	//
	System.out.println((end - beg) + " at mills.");
	//
	printlnResult(results);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:30,代码来源:HBaseThriftDMLTest.java

示例10: scannerGetList

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
@Override
public List<TRowResult> scannerGetList(int id,int nbRows)
    throws IllegalArgument, IOError {
  LOG.debug("scannerGetList: id=" + id);
  ResultScannerWrapper resultScannerWrapper = getScanner(id);
  if (null == resultScannerWrapper) {
    String message = "scanner ID is invalid";
    LOG.warn(message);
    throw new IllegalArgument("scanner ID is invalid");
  }

  Result [] results = null;
  try {
    results = resultScannerWrapper.getScanner().next(nbRows);
    if (null == results) {
      return new ArrayList<>();
    }
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw getIOError(e);
  }
  return ThriftUtilities.rowResultFromHBase(results, resultScannerWrapper.isColumnSorted());
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:ThriftServerRunner.java

示例11: doTestCheckAndPut

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
/**
 * Check that checkAndPut fails if the cell does not exist, then put in the cell, then check that
 * the checkAndPut succeeds.
 */
public static void doTestCheckAndPut() throws Exception {
  ThriftServerRunner.HBaseHandler handler =
    new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
      UserProvider.instantiate(UTIL.getConfiguration()));
  handler.createTable(tableAname, getColumnDescriptors());
  try {
    List<Mutation> mutations = new ArrayList<>(1);
    mutations.add(new Mutation(false, columnAname, valueAname, true));
    Mutation putB = (new Mutation(false, columnBname, valueBname, true));

    assertFalse(handler.checkAndPut(tableAname, rowAname, columnAname, valueAname, putB, null));

    handler.mutateRow(tableAname, rowAname, mutations, null);

    assertTrue(handler.checkAndPut(tableAname, rowAname, columnAname, valueAname, putB, null));

    TRowResult rowResult = handler.getRow(tableAname, rowAname, null).get(0);
    assertEquals(rowAname, rowResult.row);
    assertEquals(valueBname, rowResult.columns.get(columnBname).value);
  } finally {
    handler.disableTable(tableAname);
    handler.deleteTable(tableAname);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:29,代码来源:TestThriftServer.java

示例12: testExceptionType

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
private void testExceptionType(Hbase.Iface handler, ThriftMetrics metrics,
                               ByteBuffer tTableName, String rowkey,
                               ErrorThrowingGetObserver.ErrorType errorType) throws Exception {
  long preGetCounter = metricsHelper.getCounter("getRow_num_ops", metrics.getSource());
  String exceptionKey = errorType.getMetricName();
  long preExceptionCounter = metricsHelper.checkCounterExists(exceptionKey, metrics.getSource()) ?
      metricsHelper.getCounter(exceptionKey, metrics.getSource()) :
      0;
  Map<ByteBuffer, ByteBuffer> attributes = new HashMap<>();
  attributes.put(asByteBuffer(ErrorThrowingGetObserver.SHOULD_ERROR_ATTRIBUTE),
      asByteBuffer(errorType.name()));
  try {
    List<TRowResult> tRowResult = handler.getRow(tTableName, asByteBuffer(rowkey), attributes);
    fail("Get with error attribute should have thrown an exception");
  } catch (IOError e) {
    LOG.info("Received exception: ", e);
    metricsHelper.assertCounter("getRow_num_ops", preGetCounter + 1, metrics.getSource());
    metricsHelper.assertCounter(exceptionKey, preExceptionCounter + 1, metrics.getSource());
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestThriftServer.java

示例13: printRow

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的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.TRowResult; //导入依赖的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: scannerGetList

import org.apache.hadoop.hbase.thrift.generated.TRowResult; //导入依赖的package包/类
@Override
public List<TRowResult> scannerGetList(int id,int nbRows) throws IllegalArgument, IOError {
    LOG.debug("scannerGetList: id=" + id);
    ResultScanner scanner = getScanner(id);
    if (null == scanner) {
        throw new IllegalArgument("scanner ID is invalid");
    }

    Result [] results = null;
    try {
        results = scanner.next(nbRows);
        if (null == results) {
            return new ArrayList<TRowResult>();
        }
    } catch (IOException e) {
        throw new IOError(e.getMessage());
    }
    return ThriftUtilities.rowResultFromHBase(results);
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:20,代码来源:ThriftServer.java


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