Search in sources :

Example 1 with CreateReference

use of io.prestosql.sql.planner.plan.TableWriterNode.CreateReference in project hetu-core by openlookeng.

the class LogicalPlanner method createTableCreationPlan.

private RelationPlan createTableCreationPlan(Analysis analysis, Query query) {
    QualifiedObjectName destination = analysis.getCreateTableDestination().get();
    RelationPlan plan = createRelationPlan(analysis, query);
    ConnectorTableMetadata tableMetadata = createTableMetadata(destination, getOutputTableColumns(plan, analysis.getColumnAliases()), analysis.getCreateTableProperties(), analysis.getParameters(), analysis.getCreateTableComment());
    analysis.setCreateTableMetadata(tableMetadata);
    Optional<NewTableLayout> newTableLayout = metadata.getNewTableLayout(session, destination.getCatalogName(), tableMetadata);
    List<String> columnNames = tableMetadata.getColumns().stream().filter(column -> !column.isHidden()).map(ColumnMetadata::getName).collect(toImmutableList());
    TableStatisticsMetadata statisticsMetadata = metadata.getStatisticsCollectionMetadataForWrite(session, destination.getCatalogName(), tableMetadata);
    return createTableWriterPlan(analysis, plan, new CreateReference(destination.getCatalogName(), tableMetadata, newTableLayout), columnNames, newTableLayout, statisticsMetadata);
}
Also used : TableStatisticsMetadata(io.prestosql.spi.statistics.TableStatisticsMetadata) NewTableLayout(io.prestosql.metadata.NewTableLayout) CreateReference(io.prestosql.sql.planner.plan.TableWriterNode.CreateReference) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) ConnectorTableMetadata(io.prestosql.spi.connector.ConnectorTableMetadata)

Aggregations

NewTableLayout (io.prestosql.metadata.NewTableLayout)1 ConnectorTableMetadata (io.prestosql.spi.connector.ConnectorTableMetadata)1 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)1 TableStatisticsMetadata (io.prestosql.spi.statistics.TableStatisticsMetadata)1 CreateReference (io.prestosql.sql.planner.plan.TableWriterNode.CreateReference)1