Skip to content

Commit

Permalink
Migrate TpchIndexResolver.java to use lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Oct 13, 2015
1 parent 1df6221 commit 77f327e
Showing 1 changed file with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,11 @@ public ConnectorIndex getIndex(ConnectorSession session, ConnectorIndexHandle in

// Compute how to map from the final lookup schema to the table index key order
final List<Integer> keyRemap = computeRemap(handleToNames(finalLookupSchema), table.getKeyColumns());
Function<RecordSet, RecordSet> keyFormatter = new Function<RecordSet, RecordSet>()
{
@Override
public RecordSet apply(RecordSet key)
{
return new MappedRecordSet(new AppendingRecordSet(key, rawFixedValues, rawFixedTypes), keyRemap);
}
};
Function<RecordSet, RecordSet> keyFormatter = key -> new MappedRecordSet(new AppendingRecordSet(key, rawFixedValues, rawFixedTypes), keyRemap);

// Compute how to map from the output of the indexed data to the expected output schema
final List<Integer> outputRemap = computeRemap(table.getOutputColumns(), handleToNames(outputSchema));
Function<RecordSet, RecordSet> outputFormatter = new Function<RecordSet, RecordSet>()
{
@Override
public RecordSet apply(RecordSet output)
{
return new MappedRecordSet(output, outputRemap);
}
};
Function<RecordSet, RecordSet> outputFormatter = output -> new MappedRecordSet(output, outputRemap);

return new TpchConnectorIndex(keyFormatter, outputFormatter, table);
}
Expand All @@ -163,13 +149,6 @@ private static List<String> handleToNames(List<ColumnHandle> columnHandles)

private static Function<ColumnHandle, String> columnNameGetter()
{
return new Function<ColumnHandle, String>()
{
@Override
public String apply(ColumnHandle columnHandle)
{
return checkType(columnHandle, TpchColumnHandle.class, "columnHandle").getColumnName();
}
};
return columnHandle -> checkType(columnHandle, TpchColumnHandle.class, "columnHandle").getColumnName();
}
}

0 comments on commit 77f327e

Please sign in to comment.