Examples of TupleDomain


Examples of com.facebook.presto.spi.TupleDomain

        }

        @Override
        public Void visitTableScan(TableScanNode node, Integer indent)
        {
            TupleDomain partitionsDomainSummary = node.getPartitionsDomainSummary();
            print(indent, "- TableScan[%s, original constraint=%s] => [%s]", node.getTable(), node.getOriginalConstraint(), formatOutputs(node.getOutputSymbols()));
            for (Map.Entry<Symbol, ColumnHandle> entry : node.getAssignments().entrySet()) {
                boolean isOutputSymbol = node.getOutputSymbols().contains(entry.getKey());
                boolean isInOriginalConstraint = DependencyExtractor.extractUnique(node.getOriginalConstraint()).contains(entry.getKey());
                boolean isInDomainSummary = !partitionsDomainSummary.isNone() && partitionsDomainSummary.getDomains().keySet().contains(entry.getValue());

                if (isOutputSymbol || isInOriginalConstraint || isInDomainSummary) {
                    print(indent + 2, "%s := %s", entry.getKey(), entry.getValue());
                    if (isInDomainSummary) {
                        print(indent + 3, ":: %s", simplifyDomain(partitionsDomainSummary.getDomains().get(entry.getValue())));
                    }
                    else if (partitionsDomainSummary.isNone()) {
                        print(indent + 3, ":: NONE");
                    }
                }
            }
            return null;
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        checkArgument(table instanceof SystemTableHandle, "TableHandle must be an SystemTableHandle");
        SystemTableHandle systemTableHandle = (SystemTableHandle) table;

        Map<ColumnHandle, Comparable<?>> bindings = tupleDomain.extractFixedValues();

        TupleDomain unusedTupleDomain = TupleDomain.none();
        if (!tupleDomain.isNone()) {
            unusedTupleDomain = TupleDomain.withColumnDomains(Maps.filterKeys(tupleDomain.getDomains(), not(in(bindings.keySet()))));
        }

        ImmutableList<Partition> partitions = ImmutableList.<Partition>of(new SystemPartition(systemTableHandle, bindings));
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

    {
        if (!generatedPartitions.isPresent()) {
            return TupleDomain.all();
        }

        TupleDomain tupleDomain = TupleDomain.none();
        for (Partition partition : generatedPartitions.get().getPartitions()) {
            tupleDomain = tupleDomain.columnWiseUnion(partition.getTupleDomain());
        }
        return tupleDomain;
    }
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        // The effective predicate can be computed from the intersection of the aggregate partition TupleDomain summary (generated from Partitions)
        // and the TupleDomain that was initially used to generate those Partitions. We do this because we need to select the more restrictive of the two.
        // Note: the TupleDomain used to generate the partitions may contain columns/predicates that are unknown to the partition TupleDomain summary,
        // but those are guaranteed to be part of a FilterNode directly above this table scan, so it's ok to include.
        TupleDomain tupleDomain = node.getPartitionsDomainSummary().intersect(node.getGeneratedPartitions().get().getTupleDomainInput());

        // A TupleDomain that has too many disjunctions will produce an Expression that will be very expensive to evaluate at runtime.
        // For the time being, we will just summarize the TupleDomain by the span over each of its columns (which is ok since we only need to generate
        // an effective predicate here).
        // In the future, we can do further optimizations here that will simplify the TupleDomain, but still improve the specificity compared to just a simple span (e.g. range clustering).
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        @Override
        public PlanNode rewriteTableScan(TableScanNode node, Expression inheritedPredicate, PlanRewriter<Expression> planRewriter)
        {
            DomainTranslator.ExtractionResult extractionResult = DomainTranslator.fromPredicate(inheritedPredicate, symbolAllocator.getTypes(), node.getAssignments());
            Expression extractionRemainingExpression = extractionResult.getRemainingExpression();
            TupleDomain tupleDomain = extractionResult.getTupleDomain();

            if (node.getGeneratedPartitions().isPresent()) {
                // Add back in the TupleDomain that was used to generate the previous set of Partitions if present
                // And just for kicks, throw in the domain summary too (as that can only help prune down the ranges)
                // The domains should never widen between each pass.
                tupleDomain = tupleDomain.intersect(node.getGeneratedPartitions().get().getTupleDomainInput()).intersect(node.getPartitionsDomainSummary());
            }

            Stopwatch partitionTimer = Stopwatch.createStarted();
            PartitionResult matchingPartitions = splitManager.getPartitions(node.getTable(), Optional.of(tupleDomain));
            List<Partition> partitions = matchingPartitions.getPartitions();
            TupleDomain undeterminedTupleDomain = matchingPartitions.getUndeterminedTupleDomain();
            log.debug("Partition retrieval, table %s (%d partitions): %dms", node.getTable(), partitions.size(), partitionTimer.elapsed(TimeUnit.MILLISECONDS));

            Expression unevaluatedDomainPredicate = DomainTranslator.toPredicate(undeterminedTupleDomain, ImmutableBiMap.copyOf(node.getAssignments()).inverse());

            // Construct the post scan predicate. Add the unevaluated TupleDomain back first since those are generally cheaper to evaluate than anything we can't extract
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        assertNotNull(tableHandle);

        ColumnHandle dsColumn = metadata.getColumnHandle(tableHandle, "ds");
        assertNotNull(dsColumn);

        TupleDomain tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(dsColumn, Domain.singleValue("2012-12-30")));
        PartitionResult partitionResult = splitManager.getPartitions(tableHandle, tupleDomain);
        for (Partition partition : partitionResult.getPartitions()) {
            if (Domain.singleValue("2012-12-30").equals(partition.getTupleDomain().getDomains().get(dsColumn))) {
                try {
                    getSplitCount(splitManager.getPartitionSplits(tableHandle, ImmutableList.of(partition)));
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

                .filter(partitionMatches(tupleDomain))
                .filter(Partition.class)
                .toList();

        // All partition key domains will be fully evaluated, so we don't need to include those
        TupleDomain remainingTupleDomain = TupleDomain.none();
        if (!tupleDomain.isNone()) {
            remainingTupleDomain = TupleDomain.withColumnDomains(Maps.filterKeys(tupleDomain.getDomains(), not(in(partitionKeysByName.values()))));
        }

        return new PartitionResult(partitions, remainingTupleDomain);
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        @Override
        public PlanNode rewriteTableScan(TableScanNode node, Expression inheritedPredicate, PlanRewriter<Expression> planRewriter)
        {
            DomainTranslator.ExtractionResult extractionResult = DomainTranslator.fromPredicate(inheritedPredicate, symbolAllocator.getTypes(), node.getAssignments());
            Expression extractionRemainingExpression = extractionResult.getRemainingExpression();
            TupleDomain tupleDomain = extractionResult.getTupleDomain();

            if (node.getGeneratedPartitions().isPresent()) {
                // Add back in the TupleDomain that was used to generate the previous set of Partitions if present
                // And just for kicks, throw in the domain summary too (as that can only help prune down the ranges)
                // The domains should never widen between each pass.
                tupleDomain = tupleDomain.intersect(node.getGeneratedPartitions().get().getTupleDomainInput()).intersect(node.getPartitionsDomainSummary());
            }

            Stopwatch partitionTimer = Stopwatch.createStarted();
            PartitionResult matchingPartitions = splitManager.getPartitions(node.getTable(), Optional.of(tupleDomain));
            List<Partition> partitions = matchingPartitions.getPartitions();
            TupleDomain undeterminedTupleDomain = matchingPartitions.getUndeterminedTupleDomain();
            log.debug("Partition retrieval, table %s (%d partitions): %dms", node.getTable(), partitions.size(), partitionTimer.elapsed(TimeUnit.MILLISECONDS));

            Expression unevaluatedDomainPredicate = DomainTranslator.toPredicate(undeterminedTupleDomain, ImmutableBiMap.copyOf(node.getAssignments()).inverse());

            // Construct the post scan predicate. Add the unevaluated TupleDomain back first since those are generally cheaper to evaluate than anything we can't extract
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

        }

        @Override
        public Void visitTableScan(TableScanNode node, Integer indent)
        {
            TupleDomain partitionsDomainSummary = node.getPartitionsDomainSummary();
            print(indent, "- TableScan[%s, original constraint=%s] => [%s]", node.getTable(), node.getOriginalConstraint(), formatOutputs(node.getOutputSymbols()));
            for (Map.Entry<Symbol, ColumnHandle> entry : node.getAssignments().entrySet()) {
                boolean isOutputSymbol = node.getOutputSymbols().contains(entry.getKey());
                boolean isInOriginalConstraint = DependencyExtractor.extractUnique(node.getOriginalConstraint()).contains(entry.getKey());
                boolean isInDomainSummary = !partitionsDomainSummary.isNone() && partitionsDomainSummary.getDomains().keySet().contains(entry.getValue());

                if (isOutputSymbol || isInOriginalConstraint || isInDomainSummary) {
                    print(indent + 2, "%s := %s", entry.getKey(), entry.getValue());
                    if (isInDomainSummary) {
                        print(indent + 3, ":: %s", simplifyDomain(partitionsDomainSummary.getDomains().get(entry.getValue())));
                    }
                    else if (partitionsDomainSummary.isNone()) {
                        print(indent + 3, ":: NONE");
                    }
                }
            }
            return null;
View Full Code Here

Examples of com.facebook.presto.spi.TupleDomain

                .filter(partitionMatches(tupleDomain))
                .filter(Partition.class)
                .toList();

        // All partition key domains will be fully evaluated, so we don't need to include those
        TupleDomain remainingTupleDomain = TupleDomain.none();
        if (!tupleDomain.isNone()) {
            remainingTupleDomain = TupleDomain.withColumnDomains(Maps.filterKeys(tupleDomain.getDomains(), not(in(partitionKeysByName.values()))));
        }

        return new PartitionResult(partitions, remainingTupleDomain);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.