Search in sources :

Example 1 with FileRemoveOperatorDescriptor

use of org.apache.hyracks.dataflow.std.file.FileRemoveOperatorDescriptor in project asterixdb by apache.

the class FeedOperations method buildRemoveFeedStorageJob.

public static JobSpecification buildRemoveFeedStorageJob(MetadataProvider metadataProvider, Feed feed) throws AsterixException {
    JobSpecification spec = RuntimeUtils.createJobSpecification(metadataProvider.getApplicationContext());
    AlgebricksAbsolutePartitionConstraint allCluster = ClusterStateManager.INSTANCE.getClusterLocations();
    Set<String> nodes = new TreeSet<>();
    for (String node : allCluster.getLocations()) {
        nodes.add(node);
    }
    AlgebricksAbsolutePartitionConstraint locations = new AlgebricksAbsolutePartitionConstraint(nodes.toArray(new String[nodes.size()]));
    FileSplit[] feedLogFileSplits = FeedUtils.splitsForAdapter(feed.getDataverseName(), feed.getFeedName(), locations);
    org.apache.hyracks.algebricks.common.utils.Pair<IFileSplitProvider, AlgebricksPartitionConstraint> spC = StoragePathUtil.splitProviderAndPartitionConstraints(feedLogFileSplits);
    FileRemoveOperatorDescriptor frod = new FileRemoveOperatorDescriptor(spec, spC.first, true);
    AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, frod, spC.second);
    spec.addRoot(frod);
    return spec;
}
Also used : IFileSplitProvider(org.apache.hyracks.dataflow.std.file.IFileSplitProvider) FileSplit(org.apache.hyracks.api.io.FileSplit) FileRemoveOperatorDescriptor(org.apache.hyracks.dataflow.std.file.FileRemoveOperatorDescriptor) AlgebricksAbsolutePartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint) TreeSet(java.util.TreeSet) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) JobSpecification(org.apache.hyracks.api.job.JobSpecification)

Example 2 with FileRemoveOperatorDescriptor

use of org.apache.hyracks.dataflow.std.file.FileRemoveOperatorDescriptor in project asterixdb by apache.

the class DataverseUtil method dropDataverseJobSpec.

public static JobSpecification dropDataverseJobSpec(Dataverse dataverse, MetadataProvider metadata) {
    JobSpecification jobSpec = RuntimeUtils.createJobSpecification(metadata.getApplicationContext());
    Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = metadata.splitAndConstraints(dataverse.getDataverseName());
    FileRemoveOperatorDescriptor frod = new FileRemoveOperatorDescriptor(jobSpec, splitsAndConstraint.first, false);
    AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(jobSpec, frod, splitsAndConstraint.second);
    jobSpec.addRoot(frod);
    return jobSpec;
}
Also used : IFileSplitProvider(org.apache.hyracks.dataflow.std.file.IFileSplitProvider) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) JobSpecification(org.apache.hyracks.api.job.JobSpecification) FileRemoveOperatorDescriptor(org.apache.hyracks.dataflow.std.file.FileRemoveOperatorDescriptor)

Aggregations

AlgebricksPartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)2 JobSpecification (org.apache.hyracks.api.job.JobSpecification)2 FileRemoveOperatorDescriptor (org.apache.hyracks.dataflow.std.file.FileRemoveOperatorDescriptor)2 IFileSplitProvider (org.apache.hyracks.dataflow.std.file.IFileSplitProvider)2 TreeSet (java.util.TreeSet)1 AlgebricksAbsolutePartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint)1 FileSplit (org.apache.hyracks.api.io.FileSplit)1