Search in sources :

Example 6 with MetadataEntityValueExtractor

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

the class MetadataNode method getDataverseDatasets.

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

Example 7 with MetadataEntityValueExtractor

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

the class MetadataNode method getFunction.

@Override
public Function getFunction(JobId jobId, FunctionSignature functionSignature) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(functionSignature.getNamespace(), functionSignature.getName(), "" + functionSignature.getArity());
        FunctionTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getFunctionTupleTranslator(false);
        List<Function> results = new ArrayList<>();
        IValueExtractor<Function> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FUNCTION_DATASET, searchKey, valueExtractor, results);
        if (results.isEmpty()) {
            return null;
        }
        return results.get(0);
    } 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)

Example 8 with MetadataEntityValueExtractor

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

the class MetadataNode method getFeedConnection.

@Override
public FeedConnection getFeedConnection(JobId jobId, String dataverseName, String feedName, String datasetName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName, feedName, datasetName);
        FeedConnectionTupleTranslator tupleReaderWriter = new FeedConnectionTupleTranslator(false);
        List<FeedConnection> results = new ArrayList<>();
        IValueExtractor<FeedConnection> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_CONNECTION_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) FeedConnection(org.apache.asterix.metadata.entities.FeedConnection) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayList(java.util.ArrayList) FeedConnectionTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.FeedConnectionTupleTranslator) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 9 with MetadataEntityValueExtractor

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

the class MetadataNode method getDataverseFeeds.

@Override
public List<Feed> getDataverseFeeds(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
    try {
        ITupleReference searchKey = createTuple(dataverseName);
        FeedTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getFeedTupleTranslator(false);
        IValueExtractor<Feed> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Feed> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.FEED_DATASET, searchKey, valueExtractor, results);
        return results;
    } 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 10 with MetadataEntityValueExtractor

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

the class MetadataNode method getDataverses.

@Override
public List<Dataverse> getDataverses(JobId jobId) throws MetadataException, RemoteException {
    try {
        DataverseTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getDataverseTupleTranslator(false);
        IValueExtractor<Dataverse> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
        List<Dataverse> results = new ArrayList<>();
        searchIndex(jobId, MetadataPrimaryIndexes.DATAVERSE_DATASET, null, valueExtractor, results);
        return results;
    } catch (HyracksDataException e) {
        throw new MetadataException(e);
    }
}
Also used : MetadataEntityValueExtractor(org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor) DataverseTupleTranslator(org.apache.asterix.metadata.entitytupletranslators.DataverseTupleTranslator) ArrayList(java.util.ArrayList) Dataverse(org.apache.asterix.metadata.entities.Dataverse) 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