Examples of TupleDomain


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

                    return new ExtractionResult(
                            leftResult.getTupleDomain().intersect(rightResult.getTupleDomain()),
                            combineConjuncts(leftResult.getRemainingExpression(), rightResult.getRemainingExpression()));

                case OR:
                    TupleDomain columnUnionedTupleDomain = leftResult.getTupleDomain().columnWiseUnion(rightResult.getTupleDomain());

                    // In most cases, the columnUnionedTupleDomain is only a superset of the actual strict union
                    // and so we can return the current node as the remainingExpression so that all bounds will be double checked again at execution time.
                    Expression remainingExpression = complementIfNecessary(node, complement);
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 {
                    Iterables.size(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 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

        @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 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

        // 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());
        Expression partitionPredicate = DomainTranslator.toPredicate(tupleDomain, ImmutableBiMap.copyOf(node.getAssignments()).inverse());
        return pullExpressionThroughSymbols(partitionPredicate, node.getOutputSymbols());
    }
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

        }

        @Override
        public Void visitTableScan(TableScanNode node, Void context)
        {
            TupleDomain partitionsDomainSummary = node.getPartitionsDomainSummary();
            TableMetadata tableMetadata = metadata.getTableMetadata(node.getTable());

            ImmutableList.Builder<Column> columnBuilder = ImmutableList.builder();

            for (Map.Entry<Symbol, ColumnHandle> entry : node.getAssignments().entrySet()) {
                ColumnMetadata columnMetadata = metadata.getColumnMetadata(node.getTable(), entry.getValue());
                Domain domain = null;
                if (!partitionsDomainSummary.isNone() && partitionsDomainSummary.getDomains().keySet().contains(entry.getValue())) {
                    domain = partitionsDomainSummary.getDomains().get(entry.getValue());
                }
                else if (partitionsDomainSummary.isNone()) {
                    domain = Domain.none(columnMetadata.getType().getNativeType());
                }
                Column column = new Column(
                        columnMetadata.getName(),
                        columnMetadata.getType().toString(),
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.