use of com.facebook.presto.accumulo.model.AccumuloTableHandle in project presto by prestodb.
the class AccumuloMetadata method renameTable.
@Override
public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTableName) {
if (client.getTable(newTableName) != null) {
throw new PrestoException(ACCUMULO_TABLE_EXISTS, "Table " + newTableName + " already exists");
}
AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
client.renameTable(handle.toSchemaTableName(), newTableName);
}
use of com.facebook.presto.accumulo.model.AccumuloTableHandle in project presto by prestodb.
the class AccumuloMetadata method renameColumn.
@Override
public void renameColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle source, String target) {
AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
AccumuloColumnHandle columnHandle = (AccumuloColumnHandle) source;
AccumuloTable table = client.getTable(handle.toSchemaTableName());
if (table == null) {
throw new TableNotFoundException(new SchemaTableName(handle.getSchema(), handle.getTable()));
}
client.renameColumn(table, columnHandle.getName(), target);
}
use of com.facebook.presto.accumulo.model.AccumuloTableHandle in project presto by prestodb.
the class AccumuloMetadata method dropTable.
@Override
public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle) {
AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
AccumuloTable table = client.getTable(handle.toSchemaTableName());
if (table != null) {
client.dropTable(table);
}
}
use of com.facebook.presto.accumulo.model.AccumuloTableHandle in project presto by prestodb.
the class AccumuloMetadata method getColumnHandles.
@Override
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle) {
AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
checkArgument(handle.getConnectorId().equals(connectorId), "tableHandle is not for this connector");
AccumuloTable table = client.getTable(handle.toSchemaTableName());
if (table == null) {
throw new TableNotFoundException(handle.toSchemaTableName());
}
ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();
for (AccumuloColumnHandle column : table.getColumns()) {
columnHandles.put(column.getName(), column);
}
return columnHandles.build();
}
Aggregations