use of com.facebook.presto.atop.AtopTable.AtopColumn in project presto by prestodb.
the class AtopMetadata method getColumnHandles.
@Override
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle) {
AtopTableHandle atopTableHandle = (AtopTableHandle) tableHandle;
ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();
for (AtopColumn column : atopTableHandle.getTable().getColumns()) {
columnHandles.put(column.getName(), new AtopColumnHandle(column.getName()));
}
return columnHandles.build();
}
use of com.facebook.presto.atop.AtopTable.AtopColumn in project presto by prestodb.
the class AtopMetadata method getTableMetadata.
@Override
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle) {
AtopTableHandle atopTableHandle = (AtopTableHandle) tableHandle;
ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder();
for (AtopColumn column : atopTableHandle.getTable().getColumns()) {
columns.add(new ColumnMetadata(column.getName(), typeManager.getType(column.getType())));
}
SchemaTableName schemaTableName = new SchemaTableName(atopTableHandle.getSchema(), atopTableHandle.getTable().getName());
return new ConnectorTableMetadata(schemaTableName, columns.build());
}
use of com.facebook.presto.atop.AtopTable.AtopColumn in project presto by prestodb.
the class AtopPageSourceProvider method createPageSource.
@Override
public ConnectorPageSource createPageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns) {
AtopSplit atopSplit = (AtopSplit) split;
ImmutableList.Builder<Type> types = ImmutableList.builder();
ImmutableList.Builder<AtopColumn> atopColumns = ImmutableList.builder();
for (ColumnHandle column : columns) {
AtopColumnHandle atopColumnHandle = (AtopColumnHandle) column;
AtopColumn atopColumn = atopSplit.getTable().getColumn(atopColumnHandle.getName());
atopColumns.add(atopColumn);
types.add(typeManager.getType(atopColumn.getType()));
}
ZonedDateTime date = atopSplit.getDate();
checkArgument(date.equals(date.withHour(0).withMinute(0).withSecond(0).withNano(0)), "Expected date to be at beginning of day");
return new AtopPageSource(readerPermits, atopFactory, session, utf8Slice(atopSplit.getHost().getHostText()), atopSplit.getTable(), date, atopColumns.build(), types.build());
}
Aggregations