Search in sources :

Example 1 with Results

use of io.trino.tpcds.Results in project trino by trinodb.

the class TpcdsRecordSetProvider method getRecordSet.

@Override
public RecordSet getRecordSet(ConnectorTransactionHandle transaction, ConnectorSession connectorSession, ConnectorSplit split, ConnectorTableHandle tableHandle, List<? extends ColumnHandle> columns) {
    TpcdsSplit tpcdsSplit = (TpcdsSplit) split;
    TpcdsTableHandle tpcdsTable = (TpcdsTableHandle) tableHandle;
    Table table = getTable(tpcdsTable.getTableName());
    double scaleFactor = tpcdsTable.getScaleFactor();
    int partNumber = tpcdsSplit.getPartNumber();
    int totalParts = tpcdsSplit.getTotalParts();
    boolean noSexism = tpcdsSplit.isNoSexism();
    ImmutableList.Builder<Column> builder = ImmutableList.builder();
    for (ColumnHandle column : columns) {
        String columnName = ((TpcdsColumnHandle) column).getColumnName();
        builder.add(table.getColumn(columnName));
    }
    Session session = Session.getDefaultSession().withScale(scaleFactor).withParallelism(totalParts).withChunkNumber(partNumber + 1).withTable(table).withNoSexism(noSexism);
    Results results = constructResults(table, session);
    return new TpcdsRecordSet(results, builder.build());
}
Also used : ColumnHandle(io.trino.spi.connector.ColumnHandle) Table.getTable(io.trino.tpcds.Table.getTable) Table(io.trino.tpcds.Table) ImmutableList(com.google.common.collect.ImmutableList) Column(io.trino.tpcds.column.Column) Results.constructResults(io.trino.tpcds.Results.constructResults) Results(io.trino.tpcds.Results) Session(io.trino.tpcds.Session) ConnectorSession(io.trino.spi.connector.ConnectorSession)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ColumnHandle (io.trino.spi.connector.ColumnHandle)1 ConnectorSession (io.trino.spi.connector.ConnectorSession)1 Results (io.trino.tpcds.Results)1 Results.constructResults (io.trino.tpcds.Results.constructResults)1 Session (io.trino.tpcds.Session)1 Table (io.trino.tpcds.Table)1 Table.getTable (io.trino.tpcds.Table.getTable)1 Column (io.trino.tpcds.column.Column)1