Skip to content

Commit

Permalink
Remove unused catalog name from global system connector
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed May 10, 2019
1 parent 4d6325b commit 2446e6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,19 @@ public class GlobalSystemConnector
{
public static final String NAME = "system";

private final String connectorId;
private final Set<SystemTable> systemTables;
private final Set<Procedure> procedures;

public GlobalSystemConnector(String connectorId, Set<SystemTable> systemTables, Set<Procedure> procedures)
public GlobalSystemConnector(Set<SystemTable> systemTables, Set<Procedure> procedures)
{
this.connectorId = requireNonNull(connectorId, "connectorId is null");
this.systemTables = ImmutableSet.copyOf(requireNonNull(systemTables, "systemTables is null"));
this.procedures = ImmutableSet.copyOf(requireNonNull(procedures, "procedures is null"));
}

@Override
public ConnectorTransactionHandle beginTransaction(TransactionId transactionId, IsolationLevel isolationLevel, boolean readOnly)
{
return new GlobalSystemTransactionHandle(connectorId, transactionId);
return new GlobalSystemTransactionHandle(transactionId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ public ConnectorHandleResolver getHandleResolver()
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
return new GlobalSystemConnector(catalogName, tables, procedures);
return new GlobalSystemConnector(tables, procedures);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,21 @@
import io.prestosql.spi.connector.ConnectorTransactionHandle;
import io.prestosql.transaction.TransactionId;

import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;

public class GlobalSystemTransactionHandle
implements ConnectorTransactionHandle
{
private final String connectorId;
private final TransactionId transactionId;

@JsonCreator
public GlobalSystemTransactionHandle(
@JsonProperty("connectorId") String connectorId,
@JsonProperty("transactionId") TransactionId transactionId)
{
this.connectorId = requireNonNull(connectorId, "connectorId is null");
this.transactionId = requireNonNull(transactionId, "transactionId is null");
}

@JsonProperty
public String getConnectorId()
{
return connectorId;
}

@JsonProperty
public TransactionId getTransactionId()
{
Expand All @@ -53,7 +42,7 @@ public TransactionId getTransactionId()
@Override
public int hashCode()
{
return Objects.hash(connectorId, transactionId);
return transactionId.hashCode();
}

@Override
Expand All @@ -65,16 +54,14 @@ public boolean equals(Object obj)
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final GlobalSystemTransactionHandle other = (GlobalSystemTransactionHandle) obj;
return Objects.equals(this.connectorId, other.connectorId) &&
Objects.equals(this.transactionId, other.transactionId);
GlobalSystemTransactionHandle other = (GlobalSystemTransactionHandle) obj;
return transactionId.equals(other.transactionId);
}

@Override
public String toString()
{
return toStringHelper(this)
.add("connectorId", connectorId)
.add("transactionId", transactionId)
.toString();
}
Expand Down

0 comments on commit 2446e6b

Please sign in to comment.