use of io.prestosql.sql.planner.plan.TableWriterNode.VacuumTargetReference in project hetu-core by openlookeng.
the class LogicalPlanner method createVacuumTablePlan.
private RelationPlan createVacuumTablePlan(Analysis analysis, VacuumTable vacuumTable) {
TableHandle handle = analysis.getTableHandle(vacuumTable.getTable());
TableMetadata tableMetadata = metadata.getTableMetadata(session, handle);
List<ColumnMetadata> columns = tableMetadata.getColumns();
List<String> columnNames = columns.stream().filter(column -> !column.isHidden()).map(ColumnMetadata::getName).collect(Collectors.toList());
List<Symbol> symbols = columns.stream().filter(column -> !column.isHidden()).map(c -> planSymbolAllocator.newSymbol(c.getName(), c.getType())).collect(Collectors.toList());
ColumnHandle rowIdHandle = metadata.getDeleteRowIdColumnHandle(session, handle);
ColumnMetadata rowIdColumnMetadata = metadata.getColumnMetadata(session, handle, rowIdHandle);
Type rowIdType = rowIdColumnMetadata.getType();
Symbol rowIdSymbol = planSymbolAllocator.newSymbol("$rowId", rowIdType);
symbols.add(rowIdSymbol);
columnNames.add(rowIdHandle.getColumnName());
String catalogName = handle.getCatalogName().getCatalogName();
TableStatisticsMetadata statisticsMetadata = TableStatisticsMetadata.empty();
return createVacuumWriterPlan(analysis, handle, vacuumTable, new VacuumTargetReference(handle, vacuumTable.isFull(), vacuumTable.isUnify(), vacuumTable.getPartition()), symbols, columnNames, statisticsMetadata);
}
Aggregations