public class TableReaderImpl extends Object implements TableReader
| 构造器和说明 |
|---|
TableReaderImpl(String ibdFilePath,
String createTableSql) |
TableReaderImpl(String ibdFilePath,
String createTableSql,
KeyComparator keyComparator) |
TableReaderImpl(String ibdFilePath,
TableDef tableDef) |
TableReaderImpl(String ibdFilePath,
TableDef tableDef,
KeyComparator keyComparator) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Close.
|
double |
getAllIndexPageFillingRate()
Get all index page filling rate, use iterator pattern to avoid OutOfMemory.
|
double |
getIndexPageFillingRate(int pageNumber)
Get single index page filling rate.
|
long |
getNumOfPages()
Return total page count.
|
Iterator<AbstractPage> |
getPageIterator()
Get page iterator.
|
Iterator<GenericRecord> |
getQueryAllIterator()
Return an iterator to query all records of a tablespace.
|
Iterator<GenericRecord> |
getQueryAllIterator(boolean ascOrder)
Return an iterator to query all records of a tablespace.
|
Iterator<GenericRecord> |
getQueryAllIterator(List<String> projection)
Return an iterator to query all records of a tablespace.
|
Iterator<GenericRecord> |
getQueryAllIterator(List<String> projection,
boolean ascOrder)
Return an iterator to query all records of a tablespace.
|
Iterator<GenericRecord> |
getRangeQueryIterator(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator)
Return an iterator to do range query records by primary key in a tablespace.
|
Iterator<GenericRecord> |
getRangeQueryIterator(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
boolean ascOrder)
Return an iterator to do range query records by primary key in a tablespace.
|
Iterator<GenericRecord> |
getRangeQueryIterator(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
List<String> projection)
Return an iterator to do range query records by primary key in a tablespace.
|
Iterator<GenericRecord> |
getRangeQueryIterator(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
List<String> projection,
boolean ascOrder)
Return an iterator to do range query records by primary key in a tablespace.
|
Iterator<GenericRecord> |
getRecordIteratorBySk(String skName,
List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator)
Return record iterator by secondary key (SK) in a tablespace.
|
Iterator<GenericRecord> |
getRecordIteratorBySk(String skName,
List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
boolean ascOrder)
Return record iterator by secondary key (SK) in a tablespace.
|
Iterator<GenericRecord> |
getRecordIteratorBySk(String skName,
List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
List<String> projection)
Return record iterator by secondary key (SK) in a tablespace.
|
Iterator<GenericRecord> |
getRecordIteratorBySk(String skName,
List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
List<String> projection,
boolean ascOrder)
Return record iterator by secondary key (SK) in a tablespace.
|
TableDef |
getTableDef()
Return table definition.
|
void |
open()
Open table.
|
List<GenericRecord> |
queryAll()
Query all records in a tablespace.
|
List<GenericRecord> |
queryAll(List<String> projection)
Query all records in a tablespace with a filter and projection.
|
List<GenericRecord> |
queryAll(java.util.function.Predicate<GenericRecord> recordPredicate)
Query all records in a tablespace with a filter.
|
List<GenericRecord> |
queryAll(java.util.function.Predicate<GenericRecord> recordPredicate,
List<String> projection)
Query all records in a tablespace with a filter and projection.
|
List<GenericRecord> |
queryByPageNumber(int pageNumber)
Query all records by single index page.
|
List<GenericRecord> |
queryByPageNumber(long pageNumber)
Query all records by single index page.
|
GenericRecord |
queryByPrimaryKey(List<Object> key)
Query record by primary key in a tablespace.
|
GenericRecord |
queryByPrimaryKey(List<Object> key,
List<String> projection)
Query record by primary key in a tablespace with projection.
|
List<GenericRecord> |
rangeQueryByPrimaryKey(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator)
Range query records by primary key in a tablespace.
|
List<GenericRecord> |
rangeQueryByPrimaryKey(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
List<String> projection)
Range query records by primary key in a tablespace with a filter.
|
List<GenericRecord> |
rangeQueryByPrimaryKey(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
java.util.function.Predicate<GenericRecord> recordPredicate)
Range query records by primary key in a tablespace with a filter.
|
List<GenericRecord> |
rangeQueryByPrimaryKey(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
java.util.function.Predicate<GenericRecord> recordPredicate,
List<String> projection)
Range query records by primary key in a tablespace with a filter.
|
List<FilHeader> |
readAllPageHeaders()
Read all page headers into memory.
|
List<AbstractPage> |
readAllPages()
Read all pages into memory which may cause OutOfMemory when tablespace file size is too big.
|
AbstractPage |
readPage(long pageNumber)
Read one page as
AbstractPage. |
public TableReaderImpl(String ibdFilePath, String createTableSql, KeyComparator keyComparator)
public TableReaderImpl(String ibdFilePath, TableDef tableDef, KeyComparator keyComparator)
public void open()
TableReaderopen 在接口中 TableReaderpublic long getNumOfPages()
TableReadergetNumOfPages 在接口中 TableReaderpublic List<AbstractPage> readAllPages()
TableReaderTableReader.getPageIterator() if file size is too big.readAllPages 在接口中 TableReaderpublic Iterator<AbstractPage> getPageIterator()
TableReadergetPageIterator 在接口中 TableReaderpublic List<FilHeader> readAllPageHeaders()
TableReaderreadAllPageHeaders 在接口中 TableReaderpublic AbstractPage readPage(long pageNumber)
TableReaderAbstractPage.readPage 在接口中 TableReaderpageNumber - page numberpublic double getAllIndexPageFillingRate()
TableReadergetAllIndexPageFillingRate 在接口中 TableReaderpublic double getIndexPageFillingRate(int pageNumber)
TableReadergetIndexPageFillingRate 在接口中 TableReaderpageNumber - page numberpublic List<GenericRecord> queryByPageNumber(int pageNumber)
TableReaderqueryByPageNumber 在接口中 TableReaderpageNumber - page number (int type), can be leaf or non-leaf pagepublic List<GenericRecord> queryByPageNumber(long pageNumber)
TableReaderqueryByPageNumber 在接口中 TableReaderpageNumber - page number (long type), can be leaf or non-leaf pagepublic GenericRecord queryByPrimaryKey(List<Object> key)
TableReaderFor single key the list size should be one, for composite key the size will be more than one.
queryByPrimaryKey 在接口中 TableReaderkey - primary key, single key or a composite keypublic GenericRecord queryByPrimaryKey(List<Object> key, List<String> projection)
TableReaderFor single key the list size should be one, for composite key the size will be more than one.
queryByPrimaryKey 在接口中 TableReaderkey - primary key, single key or a composite keyprojection - projection of selected column namespublic List<GenericRecord> queryAll()
TableReaderNote this will cause out-of-memory if the table size is too big.
queryAll 在接口中 TableReaderpublic List<GenericRecord> queryAll(java.util.function.Predicate<GenericRecord> recordPredicate)
TableReaderNote this will cause out-of-memory if the table size is too big.
queryAll 在接口中 TableReaderrecordPredicate - optional filtering, if predicate returns true upon
record, then it will be added to result setpublic List<GenericRecord> queryAll(List<String> projection)
TableReaderNote this will cause out-of-memory if the table size is too big.
queryAll 在接口中 TableReaderprojection - projection of selected column namespublic List<GenericRecord> queryAll(java.util.function.Predicate<GenericRecord> recordPredicate, List<String> projection)
TableReaderNote this will cause out-of-memory if the table size is too big. Make sure fields are included in projection for predicate to use.
queryAll 在接口中 TableReaderrecordPredicate - optional filtering, if predicate returns true upon
record, then it will be added to result setprojection - projection of selected column namespublic List<GenericRecord> rangeQueryByPrimaryKey(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator)
TableReaderrangeQueryByPrimaryKey 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperpublic List<GenericRecord> rangeQueryByPrimaryKey(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, java.util.function.Predicate<GenericRecord> recordPredicate)
TableReaderrangeQueryByPrimaryKey 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperrecordPredicate - optional filtering, if predicate returns true upon
record, then it will be added to result setpublic List<GenericRecord> rangeQueryByPrimaryKey(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, List<String> projection)
TableReaderrangeQueryByPrimaryKey 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperprojection - projection of selected column namespublic List<GenericRecord> rangeQueryByPrimaryKey(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, java.util.function.Predicate<GenericRecord> recordPredicate, List<String> projection)
TableReaderrangeQueryByPrimaryKey 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperrecordPredicate - optional filtering, if predicate returns true upon
record, then it will be added to result setprojection - projection of selected column namespublic Iterator<GenericRecord> getQueryAllIterator()
TableReaderThis is friendly to memory since only one page is loaded per batch.
getQueryAllIterator 在接口中 TableReaderpublic Iterator<GenericRecord> getQueryAllIterator(List<String> projection)
TableReaderThis is friendly to memory since only one page is loaded per batch.
getQueryAllIterator 在接口中 TableReaderprojection - projection of selected column namespublic Iterator<GenericRecord> getQueryAllIterator(boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
getQueryAllIterator 在接口中 TableReaderascOrder - if set result records in ascending orderpublic Iterator<GenericRecord> getQueryAllIterator(List<String> projection, boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
getQueryAllIterator 在接口中 TableReaderprojection - projection of selected column namesascOrder - if set result records in ascending orderpublic Iterator<GenericRecord> getRangeQueryIterator(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the list size should be one, for composite key the size will be more than one.
getRangeQueryIterator 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperpublic Iterator<GenericRecord> getRangeQueryIterator(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, List<String> projection)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the list size should be one, for composite key the size will be more than one.
getRangeQueryIterator 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperprojection - projection of selected column namespublic Iterator<GenericRecord> getRangeQueryIterator(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the list size should be one, for composite key the size will be more than one.
getRangeQueryIterator 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperascOrder - if set result records in ascending orderpublic Iterator<GenericRecord> getRangeQueryIterator(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, List<String> projection, boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the list size should be one, for composite key the size will be more than one.
getRangeQueryIterator 在接口中 TableReaderlower - if rangeQuery is true, then this is the lower boundlowerOperator - if rangeQuery is true, then this is the comparison operator for lowerupper - if rangeQuery is true, then this is the upper boundupperOperator - if rangeQuery is true, then this is the comparison operator for upperprojection - projection of selected column namesascOrder - if set result records in ascending orderpublic Iterator<GenericRecord> getRecordIteratorBySk(String skName, List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the lower or upper list size should be one, for composite key the size will be more than one.
getRecordIteratorBySk 在接口中 TableReaderskName - secondary key name in SHOW CREATE TABLE commandlower - lower boundlowerOperator - comparison operator for lowerupper - upper boundupperOperator - comparison operator for upperpublic Iterator<GenericRecord> getRecordIteratorBySk(String skName, List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, List<String> projection)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the lower or upper list size should be one, for composite key the size will be more than one.
getRecordIteratorBySk 在接口中 TableReaderskName - secondary key name in SHOW CREATE TABLE commandlower - lower boundlowerOperator - comparison operator for lowerupper - upper boundupperOperator - comparison operator for upperprojection - projection of selected column namespublic Iterator<GenericRecord> getRecordIteratorBySk(String skName, List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the lower or upper list size should be one, for composite key the size will be more than one.
getRecordIteratorBySk 在接口中 TableReaderskName - secondary key name in SHOW CREATE TABLE commandlower - lower boundlowerOperator - comparison operator for lowerupper - upper boundupperOperator - comparison operator for upperascOrder - if set result records in ascending orderpublic Iterator<GenericRecord> getRecordIteratorBySk(String skName, List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, List<String> projection, boolean ascOrder)
TableReaderThis is friendly to memory since only one page is loaded per batch.
For single key the lower or upper list size should be one, for composite key the size will be more than one.
getRecordIteratorBySk 在接口中 TableReaderskName - secondary key name in SHOW CREATE TABLE commandlower - lower boundlowerOperator - comparison operator for lowerupper - upper boundupperOperator - comparison operator for upperprojection - projection of selected column namesascOrder - if set result records in ascending orderpublic TableDef getTableDef()
TableReadergetTableDef 在接口中 TableReaderpublic void close()
TableReaderclose 在接口中 TableReaderclose 在接口中 Closeableclose 在接口中 AutoCloseableCopyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.