use of com.facebook.presto.spi.InMemoryRecordSet.Builder in project presto by prestodb.
the class ColumnJdbcTable method cursor.
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) {
Session session = toSession(transactionHandle, connectorSession);
Optional<String> catalogFilter = stringFilter(constraint, 0);
Optional<String> schemaFilter = stringFilter(constraint, 1);
Optional<String> tableFilter = stringFilter(constraint, 2);
Builder table = InMemoryRecordSet.builder(METADATA);
for (String catalog : filter(listCatalogs(session, metadata, accessControl).keySet(), catalogFilter)) {
QualifiedTablePrefix prefix = FilterUtil.tablePrefix(catalog, schemaFilter, tableFilter);
for (Entry<SchemaTableName, List<ColumnMetadata>> entry : listTableColumns(session, metadata, accessControl, prefix).entrySet()) {
addColumnRows(table, catalog, entry.getKey(), entry.getValue());
}
}
return table.build().cursor();
}
use of com.facebook.presto.spi.InMemoryRecordSet.Builder in project presto by prestodb.
the class SchemaJdbcTable method cursor.
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) {
Session session = toSession(transactionHandle, connectorSession);
Optional<String> catalogFilter = FilterUtil.stringFilter(constraint, 1);
Builder table = InMemoryRecordSet.builder(METADATA);
for (String catalog : filter(listCatalogs(session, metadata, accessControl).keySet(), catalogFilter)) {
for (String schema : listSchemas(session, metadata, accessControl, catalog)) {
table.addRow(schema, catalog);
}
}
return table.build().cursor();
}
use of com.facebook.presto.spi.InMemoryRecordSet.Builder in project presto by prestodb.
the class CatalogSystemTable method cursor.
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) {
Session session = toSession(transactionHandle, connectorSession);
Builder table = InMemoryRecordSet.builder(CATALOG_TABLE);
for (Map.Entry<String, ConnectorId> entry : listCatalogs(session, metadata, accessControl).entrySet()) {
table.addRow(entry.getKey(), entry.getValue().toString());
}
return table.build().cursor();
}
use of com.facebook.presto.spi.InMemoryRecordSet.Builder in project presto by prestodb.
the class QuerySystemTable method cursor.
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) {
Builder table = InMemoryRecordSet.builder(QUERY_TABLE);
for (QueryInfo queryInfo : queryManager.getAllQueryInfo()) {
QueryStats queryStats = queryInfo.getQueryStats();
table.addRow(nodeId, queryInfo.getQueryId().toString(), queryInfo.getState().toString(), queryInfo.getSession().getUser(), queryInfo.getSession().getSource().orElse(null), queryInfo.getQuery(), toMillis(queryStats.getQueuedTime()), toMillis(queryStats.getAnalysisTime()), toMillis(queryStats.getDistributedPlanningTime()), toTimeStamp(queryStats.getCreateTime()), toTimeStamp(queryStats.getExecutionStartTime()), toTimeStamp(queryStats.getLastHeartbeat()), toTimeStamp(queryStats.getEndTime()));
}
return table.build().cursor();
}
use of com.facebook.presto.spi.InMemoryRecordSet.Builder in project presto by prestodb.
the class CatalogJdbcTable method cursor.
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) {
Session session = toSession(transactionHandle, connectorSession);
Builder table = InMemoryRecordSet.builder(METADATA);
for (String name : listCatalogs(session, metadata, accessControl).keySet()) {
table.addRow(name);
}
return table.build().cursor();
}
Aggregations