Search in sources :

Example 6 with AccumuloTableHandle

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);
}
Also used : PrestoException(com.facebook.presto.spi.PrestoException) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle)

Example 7 with AccumuloTableHandle

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);
}
Also used : AccumuloTable(com.facebook.presto.accumulo.metadata.AccumuloTable) TableNotFoundException(com.facebook.presto.spi.TableNotFoundException) AccumuloColumnHandle(com.facebook.presto.accumulo.model.AccumuloColumnHandle) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle) SchemaTableName(com.facebook.presto.spi.SchemaTableName)

Example 8 with AccumuloTableHandle

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);
    }
}
Also used : AccumuloTable(com.facebook.presto.accumulo.metadata.AccumuloTable) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle)

Example 9 with AccumuloTableHandle

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();
}
Also used : AccumuloTable(com.facebook.presto.accumulo.metadata.AccumuloTable) TableNotFoundException(com.facebook.presto.spi.TableNotFoundException) AccumuloColumnHandle(com.facebook.presto.accumulo.model.AccumuloColumnHandle) ColumnHandle(com.facebook.presto.spi.ColumnHandle) AccumuloColumnHandle(com.facebook.presto.accumulo.model.AccumuloColumnHandle) AccumuloTableHandle(com.facebook.presto.accumulo.model.AccumuloTableHandle) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

AccumuloTableHandle (com.facebook.presto.accumulo.model.AccumuloTableHandle)9 AccumuloTable (com.facebook.presto.accumulo.metadata.AccumuloTable)4 SchemaTableName (com.facebook.presto.spi.SchemaTableName)3 TableNotFoundException (com.facebook.presto.spi.TableNotFoundException)3 AccumuloColumnHandle (com.facebook.presto.accumulo.model.AccumuloColumnHandle)2 AccumuloTableLayoutHandle (com.facebook.presto.accumulo.model.AccumuloTableLayoutHandle)2 AccumuloColumnConstraint (com.facebook.presto.accumulo.model.AccumuloColumnConstraint)1 AccumuloSplit (com.facebook.presto.accumulo.model.AccumuloSplit)1 TabletSplitMetadata (com.facebook.presto.accumulo.model.TabletSplitMetadata)1 WrappedRange (com.facebook.presto.accumulo.model.WrappedRange)1 ColumnHandle (com.facebook.presto.spi.ColumnHandle)1 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)1 ConnectorTableLayout (com.facebook.presto.spi.ConnectorTableLayout)1 ConnectorTableLayoutResult (com.facebook.presto.spi.ConnectorTableLayoutResult)1 ConnectorTableMetadata (com.facebook.presto.spi.ConnectorTableMetadata)1 FixedSplitSource (com.facebook.presto.spi.FixedSplitSource)1 PrestoException (com.facebook.presto.spi.PrestoException)1 Domain (com.facebook.presto.spi.predicate.Domain)1 TupleDomain (com.facebook.presto.spi.predicate.TupleDomain)1 ColumnDomain (com.facebook.presto.spi.predicate.TupleDomain.ColumnDomain)1