public class IndexServiceImpl extends Object implements IndexService
NOP_PROJECTION| 构造器和说明 |
|---|
IndexServiceImpl(StorageService storageService,
TableDef tableDef,
Comparator<List<Object>> keyComparator) |
| 限定符和类型 | 方法和说明 |
|---|---|
Iterator<GenericRecord> |
getQueryAllIterator(Optional<List<String>> recordProjection)
Return an iterator to query all records of a tablespace.
|
Iterator<GenericRecord> |
getRangeQueryIterator(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
Optional<List<String>> recordProjection)
The implementation is different from the way
queryAll(Optional, Optional) works. |
Index |
loadIndexPage(long pageNumber)
Load index page by page number.
|
List<GenericRecord> |
queryAll(Optional<java.util.function.Predicate<GenericRecord>> recordPredicate,
Optional<List<String>> recordProjection)
Query all records in a tablespace.
|
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,
Optional<List<String>> recordProjection)
Query record by primary key in a tablespace with projection list.
|
List<GenericRecord> |
rangeQueryByPrimaryKey(List<Object> lower,
ComparisonOperator lowerOperator,
List<Object> upper,
ComparisonOperator upperOperator,
Optional<java.util.function.Predicate<GenericRecord>> recordPredicate,
Optional<List<String>> recordProjection)
Range query records by primary key in a tablespace.
|
public IndexServiceImpl(StorageService storageService, TableDef tableDef, Comparator<List<Object>> keyComparator)
public List<GenericRecord> queryByPageNumber(int pageNumber)
queryByPageNumber 在接口中 IndexServicepageNumber - page number (int type), can be leaf or non-leaf pagepublic List<GenericRecord> queryByPageNumber(long pageNumber)
queryByPageNumber 在接口中 IndexServicepageNumber - page number (long type), can be leaf or non-leaf pagepublic List<GenericRecord> queryAll(Optional<java.util.function.Predicate<GenericRecord>> recordPredicate, Optional<List<String>> recordProjection)
Note 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 在接口中 IndexServicerecordPredicate - optional filtering, if predicate returns true upon
record, then it will be added to result setrecordProjection - optional projection of selected column names, if no present, all
fields will be includedpublic GenericRecord queryByPrimaryKey(List<Object> key, Optional<List<String>> recordProjection)
For single key, the the list size should be one, for composite key the size will be more than one.
queryByPrimaryKey 在接口中 IndexServicekey - primary key, single key or a composite keyrecordProjection - optional projection of selected column names, if no present, all
fields will be includedpublic Iterator<GenericRecord> getQueryAllIterator(Optional<List<String>> recordProjection)
Leverage getRangeQueryIterator(List, ComparisonOperator, List, ComparisonOperator, Optional).
This is friendly to memory since only one page is loaded per batch.
getQueryAllIterator 在接口中 IndexServicerecordProjection - optional projection of selected column names, if no present, all
fields will be includedpublic Iterator<GenericRecord> getRangeQueryIterator(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, Optional<List<String>> recordProjection)
queryAll(Optional, Optional) works.
This method will do point query to search the nearest lower and upper bound record, then visit the leaf
page, go through all the level 0 pages by the double-linked pages.
While queryAll(Optional, Optional) traverses b+ tree in a depth-first way.
getRangeQueryIterator 在接口中 IndexServicelower - 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 upperrecordProjection - optional projection of selected column names, if no present, all
fields will be includedpublic List<GenericRecord> rangeQueryByPrimaryKey(List<Object> lower, ComparisonOperator lowerOperator, List<Object> upper, ComparisonOperator upperOperator, Optional<java.util.function.Predicate<GenericRecord>> recordPredicate, Optional<List<String>> recordProjection)
Leverage getRangeQueryIterator(List, ComparisonOperator, List, ComparisonOperator, Optional)
if range is specified, or else fallback to queryAll(Optional, Optional).
rangeQueryByPrimaryKey 在接口中 IndexServicelower - 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. evaluating record, if true then it will be added to
result set, else skip itrecordProjection - optional projection of selected column names, if no present, all
fields will be includedpublic Index loadIndexPage(long pageNumber)
IndexServiceloadIndexPage 在接口中 IndexServicepageNumber - page numberCopyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.