presto-thrift-api/src/main/java/io/prestosql/plugin/thrift/api/datatypes/PrestoThriftDouble.java/PrestoThriftDouble/fromBlock
class PrestoThriftDouble:    public static PrestoThriftBlock fromBlock(Block block)
    {
        int positions = block.getPositionCount();
        if (positions == 0) {
            return booleanData(new PrestoThriftBoolean(null, null));
        }
        boolean[] nulls = null;
        double[] doubles = null;
        for (int position = 0; position < positions; position++) {
            if (block.isNull(position)) {
                if (nulls == null) {
                    nulls = new boolean[positions];
                }
                nulls[position] = true;
            }
            else {
                if (doubles == null) {
                    doubles = new double[positions];
                }
                doubles[position] = DOUBLE.getDouble(block, position);
            }
        }
        return doubleData(new PrestoThriftDouble(nulls, doubles));
    }