Search in sources :

Example 1 with ILSMComponentFilterReference

use of org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterReference in project asterixdb by apache.

the class LSMComponentFilterManager method writeFilter.

@Override
public void writeFilter(ILSMComponentFilter filter, ITreeIndex treeIndex) throws HyracksDataException {
    IMetadataPageManager treeMetaManager = (IMetadataPageManager) treeIndex.getPageManager();
    ILSMComponentFilterReference filterFrame = filterFrameFactory.createFrame();
    try {
        if (filter.getMinTuple() != null) {
            filterFrame.writeMinTuple(filter.getMinTuple());
        }
        if (filter.getMaxTuple() != null) {
            filterFrame.writeMaxTuple(filter.getMaxTuple());
        }
    } finally {
        treeMetaManager.put(treeMetaManager.createMetadataFrame(), FILTER_KEY, filterFrame);
    }
}
Also used : IMetadataPageManager(org.apache.hyracks.storage.am.common.api.IMetadataPageManager) ILSMComponentFilterReference(org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterReference)

Example 2 with ILSMComponentFilterReference

use of org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterReference in project asterixdb by apache.

the class LSMComponentFilterManager method readFilter.

@Override
public boolean readFilter(ILSMComponentFilter filter, ITreeIndex treeIndex) throws HyracksDataException {
    IMetadataPageManager treeMetaManager = (IMetadataPageManager) treeIndex.getPageManager();
    ILSMComponentFilterReference filterFrame = filterFrameFactory.createFrame();
    treeMetaManager.get(treeMetaManager.createMetadataFrame(), FILTER_KEY, filterFrame);
    // TODO: Filters never have one of min/max set and the other not
    if (!filterFrame.isMinTupleSet() || !filterFrame.isMaxTupleSet()) {
        return false;
    }
    List<ITupleReference> filterTuples = new ArrayList<>();
    filterTuples.add(filterFrame.getMinTuple());
    filterTuples.add(filterFrame.getMaxTuple());
    updateFilter(filter, filterTuples);
    return true;
}
Also used : ArrayList(java.util.ArrayList) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) IMetadataPageManager(org.apache.hyracks.storage.am.common.api.IMetadataPageManager) ILSMComponentFilterReference(org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterReference)

Aggregations

IMetadataPageManager (org.apache.hyracks.storage.am.common.api.IMetadataPageManager)2 ILSMComponentFilterReference (org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterReference)2 ArrayList (java.util.ArrayList)1 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)1