'Test the dump function by outputting to a json file.
Given the parquet_file and csv_file representation, converts the parquet_file to json using
the dump utility and then compares the result to the csv_file using column agnostic ordering.'

def _test_file_json(self, parquet_file, csv_file):

    expected_data = []
    with io.open(csv_file, u'r', encoding=u'utf-8') as f:
        expected_data = list(csv.reader(f, delimiter=PIPE_DELIM))
    actual_raw_data = io.StringIO()
    parquet.dump(parquet_file, Options(format=u'json'), out=actual_raw_data)
    actual_raw_data.seek(0, 0)
    actual_data = [json.loads(x.rstrip()) for x in actual_raw_data.read().split(u'\n') if (len(x) > 0)]
    assert (len(expected_data) == len(actual_data))
    footer = parquet.read_footer(parquet_file)
    cols = [s.name for s in footer.schema]
    for (expected, actual) in zip(expected_data, actual_raw_data):
        assert (len(expected) == len(actual))
        for (i, c) in enumerate(cols):
            if (c in actual):
                assert (expected[i] == actual[c])
