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 @@ -19,6 +19,7 @@
import com.google.common.base.VerifyException;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.DoNotCall;
import com.google.errorprone.annotations.Immutable;
import io.trino.cost.PlanNodeStatsEstimate;
import io.trino.metadata.TableHandle;
Expand Down Expand Up @@ -75,19 +76,32 @@ public static TableScanNode newInstance(
return new TableScanNode(id, table, outputs, assignments, TupleDomain.all(), Optional.empty(), updateTarget, useConnectorNodePartitioning);
}

/*
* This constructor is for JSON deserialization only. Do not use.
* It's marked as @Deprecated to help avoid usage, and not because we plan to remove it.
*/
/* TODO @DoNotCall once it's applicable to constructors */
@DoNotCall // For JSON serialization only
@JsonCreator
public TableScanNode(
public static TableScanNode fromJson(
@JsonProperty("id") PlanNodeId id,
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.

Do we still need to annotate parameters, if the parameter names match the JSON? I know that records are handled automatically.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am eager to believe we do not. I think it would applied to many other classes, so i will keep this as-is in this pr

@JsonProperty("table") TableHandle table,
@JsonProperty("outputSymbols") List<Symbol> outputs,
@JsonProperty("assignments") Map<Symbol, ColumnHandle> assignments,
@JsonProperty("updateTarget") boolean updateTarget,
@JsonProperty("useConnectorNodePartitioning") Optional<Boolean> useConnectorNodePartitioning)
{
return new TableScanNode(
id,
table,
outputs,
assignments,
updateTarget,
useConnectorNodePartitioning);
}

private TableScanNode(
PlanNodeId id,
TableHandle table,
List<Symbol> outputs,
Map<Symbol, ColumnHandle> assignments,
boolean updateTarget,
Optional<Boolean> useConnectorNodePartitioning)
{
super(id);
this.table = requireNonNull(table, "table is null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ private PlanFragment createFragment(TableHandle firstTableHandle, TableHandle se
Symbol symbol = new Symbol("column");
Symbol buildSymbol = new Symbol("buildColumn");

TableScanNode tableScanOne = new TableScanNode(
TableScanNode tableScanOne = TableScanNode.newInstance(
TABLE_SCAN_1_NODE_ID,
firstTableHandle,
ImmutableList.of(symbol),
Expand All @@ -534,7 +534,7 @@ private PlanFragment createFragment(TableHandle firstTableHandle, TableHandle se
new PlanNodeId("filter_node_id"),
tableScanOne,
createDynamicFilterExpression(createTestMetadataManager(), DYNAMIC_FILTER_ID, VARCHAR, symbol.toSymbolReference()));
TableScanNode tableScanTwo = new TableScanNode(
TableScanNode tableScanTwo = TableScanNode.newInstance(
TABLE_SCAN_2_NODE_ID,
secondTableHandle,
ImmutableList.of(symbol),
Expand Down