All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flipkart.hbaseobjectmapper.Records Maven / Gradle / Ivy

Go to download

HBase ORM is a light-weight, thread-safe and performant library that enables: [1] object-oriented access of HBase rows (Data Access Object) with minimal code and good testability [2] reading from and/or writing to HBase tables in Hadoop MapReduce jobs

There is a newer version: 1.19
Show newest version
package com.flipkart.hbaseobjectmapper;

import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;

import java.io.*;
import java.util.Iterator;

/**
 * This class is the return type of all 'records' methods of {@link AbstractHBDAO} class, which enable you to iterate over large number of records (e.g. {@link AbstractHBDAO#records(Serializable, Serializable) AbstractHBDAO.records(R, R)})
 * 

* Users of this library are not expected to instantiate this class on their own. *

* Note: This class is not thread-safe. If you intend to scan records across multiple threads, keep different filter criteria for each thread. * * @param record type */ @SuppressWarnings("rawtypes") public class Records implements Closeable, Iterable { private final HBObjectMapper hbObjectMapper; private final Class clazz; private final Table table; private final ResultScanner scanner; Records(Connection connection, HBObjectMapper hbObjectMapper, Class clazz, TableName tableName, Scan scan) throws IOException { this.hbObjectMapper = hbObjectMapper; this.clazz = clazz; this.table = connection.getTable(tableName); this.scanner = table.getScanner(scan); } @Override public void close() throws IOException { scanner.close(); table.close(); } @SuppressWarnings("NullableProblems") @Override public Iterator iterator() { return new RecordsIterator<>(hbObjectMapper, clazz, scanner.iterator()); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy