Package com.facebook.presto.spi

Examples of com.facebook.presto.spi.ColumnHandle


            }
            node = normalizeSimpleComparison(node);

            Symbol symbol = Symbol.fromQualifiedName(((QualifiedNameReference) node.getLeft()).getName());
            ColumnType columnType = checkedTypeLookup(symbol);
            ColumnHandle columnHandle = checkedColumnHandleLookup(symbol);
            Object value = LiteralInterpreter.evaluate(node.getRight());

            // Handle the cases where implicit coercions can happen in comparisons
            // TODO: how to abstract this out
            if (value instanceof Double && columnType == ColumnType.LONG) {
View Full Code Here


                return super.visitIsNullPredicate(node, complement);
            }

            Symbol symbol = Symbol.fromQualifiedName(((QualifiedNameReference) node.getValue()).getName());
            ColumnType columnType = checkedTypeLookup(symbol);
            ColumnHandle columnHandle = checkedColumnHandleLookup(symbol);

            Domain domain = complementIfNecessary(Domain.onlyNull(columnType.getNativeType()), complement);
            return new ExtractionResult(
                    TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(columnHandle, domain)),
                    TRUE_LITERAL);
View Full Code Here

                return super.visitIsNotNullPredicate(node, complement);
            }

            Symbol symbol = Symbol.fromQualifiedName(((QualifiedNameReference) node.getValue()).getName());
            ColumnType columnType = checkedTypeLookup(symbol);
            ColumnHandle columnHandle = checkedColumnHandleLookup(symbol);

            Domain domain = complementIfNecessary(Domain.notNull(columnType.getNativeType()), complement);
            return new ExtractionResult(
                    TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(columnHandle, domain)),
                    TRUE_LITERAL);
View Full Code Here

            ImmutableMap.Builder<Symbol, ColumnHandle> newAssignmentsBuilder = ImmutableMap.builder();
            for (Map.Entry<Symbol, ColumnHandle> assignmentEntry : assignments.entrySet()) {
                ColumnMetadata originalColumn = metadata.getColumnMetadata(tableHandle, assignmentEntry.getValue());

                ColumnHandle aliasedColumnHandle = lookupColumns.get(originalColumn.getName());
                checkState(aliasedColumnHandle != null, "no matching column for original column %s found!", originalColumn);
                newAssignmentsBuilder.put(assignmentEntry.getKey(), aliasedColumnHandle);
            }

            return new TableScanNode(node.getId(), aliasTableHandle.get(), node.getOutputSymbols(), newAssignmentsBuilder.build(), node.getOriginalConstraint(), node.getGeneratedPartitions());
View Full Code Here

        for (ComparisonExpression comparison : comparisons) {
            // Record binding if condition is an equality comparison over a partition key
            QualifiedNameReference reference = extractReference(comparison);
            Symbol symbol = Symbol.fromQualifiedName(reference.getName());

            ColumnHandle column = symbolToColumnName.get(symbol);
            if (column != null) {
                Literal literal = extractLiteral(comparison);

                Object value;
                if (literal instanceof DoubleLiteral) {
View Full Code Here

        Map<ColumnHandle, String> columnHandles = ImmutableBiMap.copyOf(metadata.getColumnHandles(tableHandle.get())).inverse();
        PartitionResult partitionResult = splitManager.getPartitions(tableHandle.get(), Optional.<TupleDomain>absent());

        for (Partition partition : partitionResult.getPartitions()) {
            for (Entry<ColumnHandle, Comparable<?>> entry : partition.getTupleDomain().extractFixedValues().entrySet()) {
                ColumnHandle columnHandle = entry.getKey();
                String columnName = columnHandles.get(columnHandle);
                String value = entry.getValue() != null ? String.valueOf(entry.getValue()) : null;
                table.add(table.getTupleInfo().builder()
                        .append(catalogName)
                        .append(tableName.getSchemaName())
View Full Code Here

    {
        String partitionName = tablePartition.getPartitionName();

        ImmutableMap.Builder<ColumnHandle, Domain> builder = ImmutableMap.builder();
        for (PartitionKey partitionKey : allPartitionKeys.get(partitionName)) {
            ColumnHandle columnHandle = columnHandles.get(partitionKey.getName());
            checkArgument(columnHandles != null, "Invalid partition key for column %s in partition %s", partitionKey.getName(), tablePartition.getPartitionName());

            String value = partitionKey.getValue();
            switch (partitionKey.getType()) {
                case BOOLEAN:
View Full Code Here

    {
        DualMetadata dualMetadata = new DualMetadata();
        TableHandle tableHandle = dualMetadata.getTableHandle(new SchemaTableName("default", DualMetadata.NAME));
        assertNotNull(tableHandle, "tableHandle is null");

        ColumnHandle columnHandle = dualMetadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME);
        assertNotNull(columnHandle, "columnHandle is null");
        Symbol symbol = new Symbol(DualMetadata.COLUMN_NAME);

        MetadataManager metadata = new MetadataManager();
        metadata.addInternalSchemaMetadata(MetadataManager.INTERNAL_CONNECTOR_ID, dualMetadata);
View Full Code Here

    }

    private StageExecutionPlan createTableScanPlan(String planId, MetadataManager metadata, int splitCount)
    {
        TableHandle tableHandle = metadata.getTableHandle(new QualifiedTableName("default", "default", DualMetadata.NAME)).get();
        ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME).get();
        Symbol symbol = new Symbol(DualMetadata.COLUMN_NAME);

        // table scan with splitCount splits
        Split split = new DualSplit(HostAddress.fromString("127.0.0.1"));
        PlanNodeId tableScanNodeId = new PlanNodeId(planId);
View Full Code Here

        // lookup the columns
        ImmutableList.Builder<ColumnHandle> columnHandlesBuilder = ImmutableList.builder();
        ImmutableList.Builder<TupleInfo> columnTypesBuilder = ImmutableList.builder();
        for (String columnName : columnNames) {
            ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, columnName).orNull();
            checkArgument(columnHandle != null, "Table %s does not have a column %s", tableName, columnName);
            columnHandlesBuilder.add(columnHandle);
            ColumnMetadata columnMetadata = metadata.getColumnMetadata(tableHandle, columnHandle);
            columnTypesBuilder.add(new TupleInfo(fromColumnType(columnMetadata.getType())));
        }
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.ColumnHandle

Copyright © 2018 www.massapicom. 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.