Skip to content

Commit

Permalink
Add test case for reading non-pandas parquet file (#870)
Browse files Browse the repository at this point in the history
* Add test case for reading non-pandas parquet file

* daskver

* update pandas build flag

* also dep

* move dep to conda

* another dep

* localserver too

---------

Co-authored-by: Martin Durant <martin.durant@alumni.utoronto.ca>
  • Loading branch information
piotrb5e3 and martindurant committed Jul 1, 2023
1 parent f747fe6 commit 83a24a6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Setup conda
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ci/environment-py38.yml
environment-file: ci/environment-py39.yml

- name: pip-install
shell: bash -l {0}
Expand Down Expand Up @@ -122,12 +122,12 @@ jobs:
run: |
pip install Cython
pip install hypothesis
pip install pytest-xdist pytest-asyncio # Needed for a pandas test, also runs tests in parallel
pip install pytest-httpserver pytest-localserver pytest-xdist pytest-asyncio
pip install -e . --no-deps # Install fastparquet
git clone https://github.com/pandas-dev/pandas
cd pandas
python setup.py build_ext -j 4
pip install -e . --no-build-isolation --no-use-pep517
pip install -e . --no-build-isolation
- name: Run Tests
shell: bash -l {0}
Expand Down
2 changes: 2 additions & 0 deletions ci/environment-py310.yml
Expand Up @@ -19,3 +19,5 @@ dependencies:
- ujson
- python-rapidjson
- versioneer
- meson-python
- pyarrow
1 change: 1 addition & 0 deletions ci/environment-py38.yml
Expand Up @@ -17,3 +17,4 @@ dependencies:
- orjson
- ujson
- python-rapidjson
- pyarrow
1 change: 1 addition & 0 deletions ci/environment-py38win.yml
Expand Up @@ -17,3 +17,4 @@ dependencies:
- orjson
- ujson
- python-rapidjson
- pyarrow
1 change: 1 addition & 0 deletions ci/environment-py39.yml
Expand Up @@ -18,3 +18,4 @@ dependencies:
- orjson
- ujson
- python-rapidjson
- pyarrow
14 changes: 14 additions & 0 deletions fastparquet/test/test_api.py
Expand Up @@ -1525,3 +1525,17 @@ def test_select_or_iter():

assert df1["id"].tolist() == dfs[0]["id"].tolist() == list(range(32))


def test_read_a_non_pandas_parquet_file(tempdir):
pa = pytest.importorskip("pyarrow")
pq = pytest.importorskip("pyarrow.parquet")

fn = os.path.join(tempdir, "test.parquet")

test_table = pa.table({"foo": [0, 1], "bar": ["a", "b"]})
pq.write_table(test_table, fn)

parquet_file = ParquetFile(fn)

assert parquet_file.count() == 2
assert parquet_file.head(1).equals(pd.DataFrame({"foo": [0], "bar": ["a"]}))

0 comments on commit 83a24a6

Please sign in to comment.