Package com.facebook.presto.spi

Examples of com.facebook.presto.spi.ColumnMetadata


        checkArgument(columnHandle instanceof NativeColumnHandle, "columnHandle is not an instance of NativeColumnHandle");

        long tableId = ((NativeTableHandle) tableHandle).getTableId();
        long columnId = ((NativeColumnHandle) columnHandle).getColumnId();

        ColumnMetadata columnMetadata = dao.getColumnMetadata(tableId, columnId);
        checkState(columnMetadata != null, "no column with id %s exists", columnId);
        return columnMetadata;
    }
View Full Code Here


    {
        checkNotNull(prefix, "prefix is null");

        ImmutableListMultimap.Builder<SchemaTableName, ColumnMetadata> columns = ImmutableListMultimap.builder();
        for (TableColumn tableColumn : dao.listTableColumns(catalogName, prefix.getSchemaName(), prefix.getTableName())) {
            ColumnMetadata columnMetadata = new ColumnMetadata(tableColumn.getColumnName(), tableColumn.getDataType().toColumnType(), tableColumn.getOrdinalPosition(), false);
            columns.put(tableColumn.getTable().asSchemaTableName(), columnMetadata);
        }
        return Multimaps.asMap(columns.build());
    }
View Full Code Here

        ConnectorTableMetadata tableMetadata = tables.get(systemTableHandle.getSchemaTableName());

        checkArgument(columnHandle instanceof SystemColumnHandle, "columnHandle is not an instance of SystemColumnHandle");
        String columnName = ((SystemColumnHandle) columnHandle).getColumnName();

        ColumnMetadata columnMetadata = findColumnMetadata(tableMetadata, columnName);
        checkArgument(columnMetadata != null, "Column %s on table %s does not exist", columnName, tableMetadata.getTable());
        return columnMetadata;
    }
View Full Code Here

            // Create the destination table
            ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder();
            for (int i = 0; i < plan.getDescriptor().getFields().size(); i++) {
                Field field = plan.getDescriptor().getFields().get(i);
                String name = field.getName().or("_field" + i);
                ColumnMetadata columnMetadata = new ColumnMetadata(name, field.getType().getColumnType(), i, false);
                columns.add(columnMetadata);
            }

            TableMetadata tableMetadata = createTableMetadata(destination, columns.build());
            targetTable = metadata.createTable(destination.getCatalogName(), tableMetadata);
View Full Code Here

        List<Field> fields = plan.getDescriptor().getFields();
        for (int i = 0; i < fields.size(); i++) {
            Field field = fields.get(i);
            String name = field.getName().get();
            ColumnType type = field.getType().getColumnType();
            columns.add(new ColumnMetadata(name, type, i, false));
        }
        return columns.build();
    }
View Full Code Here

        ConnectorTableMetadata tableMetadata = TABLES.get(informationSchemaTableHandle.getSchemaTableName());

        checkArgument(columnHandle instanceof InformationSchemaColumnHandle, "columnHandle is not an instance of InformationSchemaColumnHandle");
        String columnName = ((InformationSchemaColumnHandle) columnHandle).getColumnName();

        ColumnMetadata columnMetadata = findColumnMetadata(tableMetadata, columnName);
        checkArgument(columnMetadata != null, "Column %s on table %s does not exist", columnName, tableMetadata.getTable());
        return columnMetadata;
    }
View Full Code Here

        ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> tableColumns = ImmutableMap.builder();
        for (SchemaTableName tableName : listTables(prefix.getSchemaName())) {
            int position = 1;
            ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder();
            for (ColumnMetadata column : tables.get(tableName.getTableName()).getColumns()) {
                columns.add(new ColumnMetadata(column.getName(), column.getType(), position, false));
                position++;
            }
            tableColumns.put(tableName, columns.build());
        }
        return tableColumns.build();
View Full Code Here

            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(),
                        Optional.fromNullable(SimpleDomain.fromDomain(domain)));
                columnBuilder.add(column);
            }
            Input input = new Input(
                    tableMetadata.getConnectorId(),
View Full Code Here

        ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> tableColumns = ImmutableMap.builder();
        for (SchemaTableName tableName : listTables(prefix.getSchemaName())) {
            int position = 1;
            ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder();
            for (ColumnMetadata column : tables.get(tableName).getColumns()) {
                columns.add(new ColumnMetadata(column.getName(), column.getType(), position, false));
                position++;
            }
            tableColumns.put(tableName, columns.build());
        }
        return tableColumns.build();
View Full Code Here

            this.tableName = tableName;
        }

        public TableMetadataBuilder column(String columnName, ColumnType type)
        {
            columns.add(new ColumnMetadata(columnName, type, ordinalPosition++, false));
            return this;
        }
View Full Code Here

TOP

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

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.