public class IndexServiceImpl extends Object implements IndexService, Constants
Only work for clustered index currently.
Constants.SymbolCONST_UNSIGNED_LOWER, CONST_UNSIGNED_UPPER, DEFAULT_JAVA_CHARSET, DEFAULT_MYSQL_CHARSET, ROOT_PAGE_NUMBER| 构造器和说明 |
|---|
IndexServiceImpl(StorageService storageService,
Schema schema) |
| 限定符和类型 | 方法和说明 |
|---|---|
Iterator<GenericRecord> |
getQueryAllIterator()
|
Iterator<GenericRecord> |
getRangeQueryIterator(Object lowerInclusiveKey,
Object upperExclusiveKey)
The implementation is different from the way
queryAll(Optional) works. |
List<GenericRecord> |
queryAll(Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
query all records of a tablespace
Note this will cause out-of-memory if the table is too big
|
List<GenericRecord> |
queryByPageNumber(int pageNumber)
query all records by single page
|
List<GenericRecord> |
queryByPageNumber(long pageNumber)
query all records by single page
|
GenericRecord |
queryByPrimaryKey(Object key)
query record by primary key in a tablespace
|
List<GenericRecord> |
rangeQueryByPrimaryKey(Object lowerInclusiveKey,
Object upperExclusiveKey,
Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
range query records by primary key in a tablespace
Note this will cause out-of-memory if there are too many records within the range
|
void |
traverseBPlusTree(long pageNumber,
List<GenericRecord> recordList,
Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
Traverse b+ tree from root page recursively in depth-first way.
|
public IndexServiceImpl(StorageService storageService, Schema schema)
public List<GenericRecord> queryByPageNumber(int pageNumber)
IndexServicequeryByPageNumber 在接口中 IndexServicepageNumber - page number (int type), can be leaf or non-leaf pagepublic List<GenericRecord> queryByPageNumber(long pageNumber)
IndexServicequeryByPageNumber 在接口中 IndexServicepageNumber - page number (long type), can be leaf or non-leaf pagepublic GenericRecord queryByPrimaryKey(Object key)
IndexServicequeryByPrimaryKey 在接口中 IndexServicekey - primary keypublic List<GenericRecord> queryAll(Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
IndexServiceNote this will cause out-of-memory if the table is too big
queryAll 在接口中 IndexServicerecordPredicate - optional. evaluating record, if true then it will be added to result set, else skip itpublic Iterator<GenericRecord> getQueryAllIterator()
getQueryAllIterator 在接口中 IndexServicepublic Iterator<GenericRecord> getRangeQueryIterator(Object lowerInclusiveKey, Object upperExclusiveKey)
queryAll(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) traverses b+ tree in a depth-first way.getRangeQueryIterator 在接口中 IndexServicelowerInclusiveKey - lower bound, inclusive, if set to null means no limit for lowerupperExclusiveKey - upper bound, exclusive, if set to null means no limit for upperpublic List<GenericRecord> rangeQueryByPrimaryKey(Object lowerInclusiveKey, Object upperExclusiveKey, Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
IndexServiceNote this will cause out-of-memory if there are too many records within the range
rangeQueryByPrimaryKey 在接口中 IndexServicelowerInclusiveKey - lower bound, inclusive, if set to null means no limit for lowerupperExclusiveKey - upper bound, exclusive, if set to null means no limit for upperrecordPredicate - optional. evaluating record, if true then it will be added to result set, else skip itpublic void traverseBPlusTree(long pageNumber,
List<GenericRecord> recordList,
Optional<java.util.function.Predicate<GenericRecord>> recordPredicate)
pageNumber - page numberrecordList - where record will be add torecordPredicate - evaluating record, if true then it will be added to result set, else skip itCopyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.