package com.facebook.presto.cli;

import com.facebook.presto.block.BlockIterable;
import com.facebook.presto.metadata.ColumnMetadata;
import com.facebook.presto.metadata.Metadata;
import com.facebook.presto.metadata.StorageManager;
import com.facebook.presto.metadata.TableMetadata;
import com.facebook.presto.operator.ConsolePrinter;
import com.facebook.presto.operator.Operator;
import io.airlift.units.Duration;

public class Utils
{
    public static BlockIterable getColumn(StorageManager storageManager, Metadata metadata, final String tableName, String columnName)
    {
        TableMetadata tableMetadata = metadata.getTable("default", "default", tableName);
        int index = 0;
        for (ColumnMetadata columnMetadata : tableMetadata.getColumns()) {
            if (columnName.equals(columnMetadata.getName())) {
                break;
            }
            ++index;
        }
        final int columnIndex = index;
        return storageManager.getBlocks("default", tableName, columnIndex);
    }

    public static void printResults(long start, Operator aggregation)
    {
        long rows = ConsolePrinter.print(aggregation);
        Duration duration = Duration.nanosSince(start);
        System.out.printf("%d rows in %4.2f ms\n", rows, duration.toMillis());
    }
}

@@ -58,965 +58,134 @@
 sto.
-block.BlockIterable;%0Aimport com.facebook.presto.metadata.ColumnMetadata;%0Aimport com.facebook.presto.metadata.Metadata;%0Aimport com.facebook.presto.metadata.StorageManager;%0Aimport com.facebook.presto.metadata.TableMetadata;%0Aimport com.facebook.presto.operator.ConsolePrinter;%0Aimport com.facebook.presto.operator.Operator;%0Aimport io.airlift.units.Duration;%0A%0Apublic class Utils%0A%7B%0A    public static BlockIterable getColumn(StorageManager storageManager, Metadata metadata, final String tableName, String columnName)%0A    %7B%0A        TableMetadata tableMetadata = metadata.getTable(%22default%22, %22default%22, tableName);%0A        int index = 0;%0A        for (ColumnMetadata columnMetadata : tableMetadata.getColumns()) %7B%0A            if (columnName.equals(columnMetadata.getName())) %7B%0A                break;%0A            %7D%0A            ++index;%0A        %7D%0A        final int columnIndex = index;%0A        return storageManager.getBlocks(%22default%22, tableName, columnIndex);%0A    %7D%0A
+operator.ConsolePrinter;%0Aimport com.facebook.presto.operator.Operator;%0Aimport io.airlift.units.Duration;%0A%0Apublic class Utils%0A%7B
 %0A   

Remove unused function