def test_sample_frac(nyc):
    t = symbol('t', discover(nyc))
    result = compute(t.sample(frac=0.5), nyc, return_type=pd.DataFrame)
    num_rows = compute(t.nrows, nyc, return_type=int)
    # *Sigh* have to do proper rounding manually; Python's round() builtin is
    # borked.
    fractional, integral = math.modf(num_rows * 0.5)
    assert int(integral + (0 if fractional < 0.5 else 1)) == len(result)
dataset/ETHPy150Open blaze/blaze/blaze/compute/tests/test_postgresql_compute.py/test_sample_frac/original