Search in sources :

Example 1 with IResourceFactory

use of org.apache.hyracks.storage.common.IResourceFactory in project asterixdb by apache.

the class SecondaryTreeIndexOperationsHelper method buildCreationJobSpec.

@Override
public JobSpecification buildCreationJobSpec() throws AlgebricksException {
    JobSpecification spec = RuntimeUtils.createJobSpecification(metadataProvider.getApplicationContext());
    IStorageComponentProvider storageComponentProvider = metadataProvider.getStorageComponentProvider();
    IResourceFactory resourceFactory = dataset.getResourceFactory(metadataProvider, index, itemType, metaType, mergePolicyFactory, mergePolicyProperties);
    IIndexBuilderFactory indexBuilderFactory = new IndexBuilderFactory(storageComponentProvider.getStorageManager(), secondaryFileSplitProvider, resourceFactory, !dataset.isTemp());
    IndexCreateOperatorDescriptor secondaryIndexCreateOp = new IndexCreateOperatorDescriptor(spec, indexBuilderFactory);
    AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, secondaryIndexCreateOp, secondaryPartitionConstraint);
    spec.addRoot(secondaryIndexCreateOp);
    spec.setConnectorPolicyAssignmentPolicy(new ConnectorPolicyAssignmentPolicy());
    return spec;
}
Also used : IStorageComponentProvider(org.apache.asterix.common.context.IStorageComponentProvider) ConnectorPolicyAssignmentPolicy(org.apache.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy) IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) IndexBuilderFactory(org.apache.hyracks.storage.am.common.build.IndexBuilderFactory) IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) JobSpecification(org.apache.hyracks.api.job.JobSpecification) IResourceFactory(org.apache.hyracks.storage.common.IResourceFactory) IndexCreateOperatorDescriptor(org.apache.hyracks.storage.am.common.dataflow.IndexCreateOperatorDescriptor)

Example 2 with IResourceFactory

use of org.apache.hyracks.storage.common.IResourceFactory in project asterixdb by apache.

the class AbstractBTreeOperatorTest method createSecondaryIndex.

public void createSecondaryIndex() throws Exception {
    JobSpecification spec = new JobSpecification();
    IResourceFactory secondaryResourceFactory = createSecondaryResourceFactory();
    IIndexBuilderFactory indexBuilderFactory = new IndexBuilderFactory(storageManager, secondarySplitProvider, secondaryResourceFactory, false);
    IndexCreateOperatorDescriptor secondaryCreateOp = new IndexCreateOperatorDescriptor(spec, indexBuilderFactory);
    PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, secondaryCreateOp, NC1_ID);
    spec.addRoot(secondaryCreateOp);
    runTest(spec);
}
Also used : IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) IndexBuilderFactory(org.apache.hyracks.storage.am.common.build.IndexBuilderFactory) JobSpecification(org.apache.hyracks.api.job.JobSpecification) IResourceFactory(org.apache.hyracks.storage.common.IResourceFactory) IndexCreateOperatorDescriptor(org.apache.hyracks.storage.am.common.dataflow.IndexCreateOperatorDescriptor)

Example 3 with IResourceFactory

use of org.apache.hyracks.storage.common.IResourceFactory in project asterixdb by apache.

the class AbstractBTreeOperatorTest method createPrimaryIndex.

public void createPrimaryIndex() throws Exception {
    JobSpecification spec = new JobSpecification();
    IResourceFactory primaryResourceFactory = createPrimaryResourceFactory();
    IIndexBuilderFactory indexBuilderFactory = new IndexBuilderFactory(storageManager, primarySplitProvider, primaryResourceFactory, false);
    IndexCreateOperatorDescriptor primaryCreateOp = new IndexCreateOperatorDescriptor(spec, indexBuilderFactory);
    PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, primaryCreateOp, NC1_ID);
    spec.addRoot(primaryCreateOp);
    runTest(spec);
}
Also used : IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) IIndexBuilderFactory(org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory) IndexBuilderFactory(org.apache.hyracks.storage.am.common.build.IndexBuilderFactory) JobSpecification(org.apache.hyracks.api.job.JobSpecification) IResourceFactory(org.apache.hyracks.storage.common.IResourceFactory) IndexCreateOperatorDescriptor(org.apache.hyracks.storage.am.common.dataflow.IndexCreateOperatorDescriptor)

Example 4 with IResourceFactory

use of org.apache.hyracks.storage.common.IResourceFactory in project asterixdb by apache.

the class TestNodeController method createPrimaryIndex.

public void createPrimaryIndex(Dataset dataset, IAType[] primaryKeyTypes, ARecordType recordType, ARecordType metaType, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, int[] filterFields, IStorageComponentProvider storageComponentProvider, int[] primaryKeyIndexes, List<Integer> primaryKeyIndicators) throws AlgebricksException, HyracksDataException {
    PrimaryIndexInfo primaryIndexInfo = new PrimaryIndexInfo(dataset, primaryKeyTypes, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterFields, primaryKeyIndexes, primaryKeyIndicators, storageComponentProvider);
    Dataverse dataverse = new Dataverse(dataset.getDataverseName(), NonTaggedDataFormat.class.getName(), MetadataUtil.PENDING_NO_OP);
    MetadataProvider mdProvider = new MetadataProvider((ICcApplicationContext) ExecutionTestUtil.integrationUtil.cc.getApplicationContext(), dataverse, storageComponentProvider);
    try {
        IResourceFactory resourceFactory = dataset.getResourceFactory(mdProvider, primaryIndexInfo.index, recordType, metaType, mergePolicyFactory, mergePolicyProperties);
        IndexBuilderFactory indexBuilderFactory = new IndexBuilderFactory(storageComponentProvider.getStorageManager(), primaryIndexInfo.fileSplitProvider, resourceFactory, !dataset.isTemp());
        IHyracksTaskContext ctx = createTestContext(false);
        IIndexBuilder indexBuilder = indexBuilderFactory.create(ctx, 0);
        indexBuilder.build();
    } finally {
        mdProvider.getLocks().unlock();
    }
}
Also used : IIndexBuilder(org.apache.hyracks.storage.am.common.api.IIndexBuilder) MetadataProvider(org.apache.asterix.metadata.declared.MetadataProvider) IHyracksTaskContext(org.apache.hyracks.api.context.IHyracksTaskContext) IndexBuilderFactory(org.apache.hyracks.storage.am.common.build.IndexBuilderFactory) NonTaggedDataFormat(org.apache.asterix.runtime.formats.NonTaggedDataFormat) Dataverse(org.apache.asterix.metadata.entities.Dataverse) IResourceFactory(org.apache.hyracks.storage.common.IResourceFactory)

Example 5 with IResourceFactory

use of org.apache.hyracks.storage.common.IResourceFactory in project asterixdb by apache.

the class Dataset method getResourceFactory.

/**
     * Create the index dataflow helper factory for a particular index on the dataset
     *
     * @param mdProvider
     *            metadata provider to get metadata information, components, and runtimes
     * @param index
     *            the index to get the dataflow helper factory for
     * @param recordType
     *            the record type for the dataset
     * @param metaType
     *            the meta type for the dataset
     * @param mergePolicyFactory
     *            the merge policy factory of the dataset
     * @param mergePolicyProperties
     *            the merge policy properties for the dataset
     * @return indexDataflowHelperFactory
     *         an instance of {@link org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory}
     * @throws AlgebricksException
     *             if dataflow helper factory could not be created
     */
public IResourceFactory getResourceFactory(MetadataProvider mdProvider, Index index, ARecordType recordType, ARecordType metaType, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties) throws AlgebricksException {
    ITypeTraits[] filterTypeTraits = DatasetUtil.computeFilterTypeTraits(this, recordType);
    IBinaryComparatorFactory[] filterCmpFactories = DatasetUtil.computeFilterBinaryComparatorFactories(this, recordType, mdProvider.getStorageComponentProvider().getComparatorFactoryProvider());
    IResourceFactory resourceFactory;
    switch(index.getIndexType()) {
        case BTREE:
            resourceFactory = bTreeResourceFactoryProvider.getResourceFactory(mdProvider, this, index, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterTypeTraits, filterCmpFactories);
            break;
        case RTREE:
            resourceFactory = rTreeResourceFactoryProvider.getResourceFactory(mdProvider, this, index, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterTypeTraits, filterCmpFactories);
            break;
        case LENGTH_PARTITIONED_NGRAM_INVIX:
        case LENGTH_PARTITIONED_WORD_INVIX:
        case SINGLE_PARTITION_NGRAM_INVIX:
        case SINGLE_PARTITION_WORD_INVIX:
            resourceFactory = invertedIndexResourceFactoryProvider.getResourceFactory(mdProvider, this, index, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterTypeTraits, filterCmpFactories);
            break;
        default:
            throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_INDEX_TYPE, index.getIndexType().toString());
    }
    return new DatasetLocalResourceFactory(datasetId, resourceFactory);
}
Also used : CompilationException(org.apache.asterix.common.exceptions.CompilationException) DatasetLocalResourceFactory(org.apache.asterix.transaction.management.resource.DatasetLocalResourceFactory) ITypeTraits(org.apache.hyracks.api.dataflow.value.ITypeTraits) IBinaryComparatorFactory(org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory) IResourceFactory(org.apache.hyracks.storage.common.IResourceFactory)

Aggregations

IResourceFactory (org.apache.hyracks.storage.common.IResourceFactory)7 IndexBuilderFactory (org.apache.hyracks.storage.am.common.build.IndexBuilderFactory)6 JobSpecification (org.apache.hyracks.api.job.JobSpecification)5 IIndexBuilderFactory (org.apache.hyracks.storage.am.common.api.IIndexBuilderFactory)4 IndexCreateOperatorDescriptor (org.apache.hyracks.storage.am.common.dataflow.IndexCreateOperatorDescriptor)4 Map (java.util.Map)2 IStorageComponentProvider (org.apache.asterix.common.context.IStorageComponentProvider)2 Index (org.apache.asterix.metadata.entities.Index)2 ARecordType (org.apache.asterix.om.types.ARecordType)2 AlgebricksPartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)2 ConnectorPolicyAssignmentPolicy (org.apache.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy)2 IFileSplitProvider (org.apache.hyracks.dataflow.std.file.IFileSplitProvider)2 ILSMMergePolicyFactory (org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory)2 CompilationException (org.apache.asterix.common.exceptions.CompilationException)1 ExternalFilesIndexCreateOperatorDescriptor (org.apache.asterix.external.operators.ExternalFilesIndexCreateOperatorDescriptor)1 MetadataProvider (org.apache.asterix.metadata.declared.MetadataProvider)1 Dataverse (org.apache.asterix.metadata.entities.Dataverse)1 NonTaggedDataFormat (org.apache.asterix.runtime.formats.NonTaggedDataFormat)1 DatasetLocalResourceFactory (org.apache.asterix.transaction.management.resource.DatasetLocalResourceFactory)1 IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)1