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());
}
Aggregations