Search in sources :

Example 1 with AbstractScanOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator in project asterixdb by apache.

the class ExternalDataLookupPOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) throws AlgebricksException {
    DataSource ds = new DatasetDataSource(datasetId, dataset, recordType, null, /*external dataset doesn't have meta records.*/
    Type.EXTERNAL_DATASET, dataset.getDatasetDetails(), context.getComputationNodeDomain());
    IDataSourcePropertiesProvider dspp = ds.getPropertiesProvider();
    AbstractScanOperator as = (AbstractScanOperator) op;
    deliveredProperties = dspp.computePropertiesVector(as.getVariables());
}
Also used : AbstractScanOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator) DatasetDataSource(org.apache.asterix.metadata.declared.DatasetDataSource) DataSource(org.apache.asterix.metadata.declared.DataSource) DatasetDataSource(org.apache.asterix.metadata.declared.DatasetDataSource) IDataSourcePropertiesProvider(org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider)

Example 2 with AbstractScanOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator in project asterixdb by apache.

the class IndexSearchPOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
    IDataSource<?> ds = idx.getDataSource();
    IDataSourcePropertiesProvider dspp = ds.getPropertiesProvider();
    AbstractScanOperator as = (AbstractScanOperator) op;
    deliveredProperties = dspp.computePropertiesVector(as.getVariables());
}
Also used : AbstractScanOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator) IDataSourcePropertiesProvider(org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider)

Example 3 with AbstractScanOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator in project asterixdb by apache.

the class ComplexJoinInferenceRule method rewritePost.

@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
    ILogicalOperator op = opRef.getValue();
    if (!(op instanceof AbstractScanOperator)) {
        return false;
    }
    Mutable<ILogicalOperator> opRef2 = op.getInputs().get(0);
    AbstractLogicalOperator op2 = (AbstractLogicalOperator) opRef2.getValue();
    if (op2.getOperatorTag() != LogicalOperatorTag.SUBPLAN) {
        return false;
    }
    SubplanOperator subplan = (SubplanOperator) op2;
    Mutable<ILogicalOperator> opRef3 = subplan.getInputs().get(0);
    AbstractLogicalOperator op3 = (AbstractLogicalOperator) opRef3.getValue();
    if (op3.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE || op3.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) {
        return false;
    }
    if (subplanHasFreeVariables(subplan)) {
        return false;
    }
    HashSet<LogicalVariable> varsUsedInUnnest = new HashSet<LogicalVariable>();
    VariableUtilities.getUsedVariables(op, varsUsedInUnnest);
    HashSet<LogicalVariable> producedInSubplan = new HashSet<LogicalVariable>();
    VariableUtilities.getProducedVariables(subplan, producedInSubplan);
    if (!producedInSubplan.containsAll(varsUsedInUnnest)) {
        return false;
    }
    ntsToEtsInSubplan(subplan, context);
    cleanupJoins(subplan);
    InnerJoinOperator join = new InnerJoinOperator(new MutableObject<ILogicalExpression>(ConstantExpression.TRUE));
    join.getInputs().add(opRef3);
    opRef2.setValue(OperatorManipulationUtil.eliminateSingleSubplanOverEts(subplan));
    join.getInputs().add(new MutableObject<ILogicalOperator>(op));
    opRef.setValue(join);
    context.computeAndSetTypeEnvironmentForOperator(join);
    return true;
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) SubplanOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator) ILogicalExpression(org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression) AbstractScanOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator) AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) InnerJoinOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator) HashSet(java.util.HashSet)

Aggregations

AbstractScanOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator)3 IDataSourcePropertiesProvider (org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider)2 HashSet (java.util.HashSet)1 DataSource (org.apache.asterix.metadata.declared.DataSource)1 DatasetDataSource (org.apache.asterix.metadata.declared.DatasetDataSource)1 ILogicalExpression (org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression)1 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)1 AbstractLogicalOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator)1 InnerJoinOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator)1 SubplanOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator)1