Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ private RelationPlan createRefreshMaterializedViewPlan(Analysis analysis)
Query query = viewAnalysis.getQuery();
Optional<TableLayout> newTableLayout = metadata.getInsertLayout(session, viewAnalysis.getTarget());
TableWriterNode.RefreshMaterializedViewReference writerTarget = new TableWriterNode.RefreshMaterializedViewReference(
viewAnalysis.getTable(),
viewAnalysis.getTable().toString(),
tableHandle,
new ArrayList<>(analysis.getTables()));
return getInsertPlan(analysis, viewAnalysis.getTable(), query, tableHandle, viewAnalysis.getColumns(), newTableLayout, Optional.of(writerTarget));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import io.trino.spi.type.Type;
import io.trino.sql.planner.PartitioningScheme;
import io.trino.sql.planner.Symbol;
import io.trino.sql.tree.Table;

import javax.annotation.concurrent.Immutable;

Expand Down Expand Up @@ -437,22 +436,17 @@ public boolean supportsMultipleWritersPerPartition(Metadata metadata, Session se
public static class RefreshMaterializedViewReference
extends WriterTarget
{
private final Table table;
private final String table;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should name this variable tableToStringRepresentation to stress that it is only used for toString() method. Otherwise one could try to use it to something else in future.

Another idea is to remove this field completely and maybe use TableHandle in toString()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's obvious that a raw name shouldn't be used for something else. Do you have something in mind where this would be used and the author wouldn't quickly discover that it's wrong?

private final TableHandle storageTableHandle;
private final List<TableHandle> sourceTableHandles;

public RefreshMaterializedViewReference(Table table, TableHandle storageTableHandle, List<TableHandle> sourceTableHandles)
public RefreshMaterializedViewReference(String table, TableHandle storageTableHandle, List<TableHandle> sourceTableHandles)
{
this.table = requireNonNull(table, "table is null");
this.storageTableHandle = requireNonNull(storageTableHandle, "storageTableHandle is null");
this.sourceTableHandles = ImmutableList.copyOf(sourceTableHandles);
}

public Table getTable()
{
return table;
}

public TableHandle getStorageTableHandle()
{
return storageTableHandle;
Expand All @@ -466,7 +460,7 @@ public List<TableHandle> getSourceTableHandles()
@Override
public String toString()
{
return table.toString();
return table;
}

@Override
Expand Down