Search in sources :

Example 21 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getDataverse.

@Override
public Dataverse getDataverse(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName);
        DataverseTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getDataverseTupleTranslator(false);
        IValueExtractor<Dataverse> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Dataverse> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.DATAVERSE_DATASET, searchKey, valueExtractor, results);
        if (results.isEmpty()) {
            return null;
        }
        return results.get(0);
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) DataverseTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.DataverseTupleTranslator) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) Dataverse(org.apache.asterix.metadata.entities.Dataverse) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 22 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getDatasetIndexes.

@Override
public List<Index> getDatasetIndexes(JobId jobId, String dataverseName, String datasetName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, datasetName);
        IndexTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getIndexTupleTranslator(jobId, this, false);
        IValueExtractor<Index> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Index> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.INDEX_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) IndexTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.IndexTupleTranslator) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) IMetadataIndex(org.apache.asterix.metadata.api.IMetadataIndex) Index(org.apache.asterix.metadata.entities.Index) AbstractLSMIndex(org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndex) ILSMIndex(org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex) IIndex(org.apache.hyracks.storage.common.IIndex) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 23 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getFeed.

@Override
public Feed getFeed(JobId jobId, String dataverse, String feedName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverse, feedName);
        FeedTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getFeedTupleTranslator(false);
        List<Feed> results = new ArrayList<>();
        IValueExtractor<Feed> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_DATASET, searchKey, valueExtractor, results);
        if (!results.isEmpty()) {
            return results.get(0);
        }
        return null;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FeedTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) Feed(org.apache.asterix.metadata.entities.Feed)

Example 24 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getNodeGroup.

@Override
public NodeGroup getNodeGroup(JobId jobId, String nodeGroupName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(nodeGroupName);
        NodeGroupTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getNodeGroupTupleTranslator(false);
        IValueExtractor<NodeGroup> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<NodeGroup> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.NODEGROUP_DATASET, searchKey, valueExtractor, results);
        if (results.isEmpty()) {
            return null;
        }
        return results.get(0);
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) NodeGroupTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.NodeGroupTupleTranslator) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) NodeGroup(org.apache.asterix.metadata.entities.NodeGroup)

Example 25 with MetadataEntityValueExtractor

use of org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor in project asterixdb by apache.

the class MetadataNode method getDataverseFunctions.

@Override
public List<Function> getDataverseFunctions(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName);
        FunctionTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getFunctionTupleTranslator(false);
        IValueExtractor<Function> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Function> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.FUNCTION_DATASET, searchKey, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : Function(org.apache.asterix.metadata.entities.Function) MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FunctionTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FunctionTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

MetadataEntityValueExtractor (org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor)27 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)27 ArrayList (java.util.ArrayList)26 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)26 ExtensionMetadataDataset (org.apache.asterix.metadata.api.ExtensionMetadataDataset)4 Dataset (org.apache.asterix.metadata.entities.Dataset)4 DatasetTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.DatasetTupleTranslator)4 Datatype (org.apache.asterix.metadata.entities.Datatype)3 DatatypeTupleTranslator (org.apache.asterix.metadata.entitytupletranslators.DatatypeTupleTranslator)3 IIndex (org.apache.hyracks.storage.common.IIndex)3 ExternalFile (org.apache.asterix.external.indexing.ExternalFile)2 IMetadataIndex (org.apache.asterix.metadata.api.IMetadataIndex)2 DatasourceAdapter (org.apache.asterix.metadata.entities.DatasourceAdapter)2 Dataverse (org.apache.asterix.metadata.entities.Dataverse)2 Feed (org.apache.asterix.metadata.entities.Feed)2 FeedConnection (org.apache.asterix.metadata.entities.FeedConnection)2 FeedPolicyEntity (org.apache.asterix.metadata.entities.FeedPolicyEntity)2 Function (org.apache.asterix.metadata.entities.Function)2 Index (org.apache.asterix.metadata.entities.Index)2 Library (org.apache.asterix.metadata.entities.Library)2