Repository navigation
Closed
Description
Describe the bug
read_parquet reads incorrect values when skiprows and num_rows are set.
Steps/Code to reproduce bug
- Download and unzip this parquet file: test.parquet.zip
- Run this reproducer:
import cudf
x = cudf.read_parquet("test.parquet")
y = cudf.read_parquet("test.parquet", skiprows=45000, num_rows=45000)
for column in x.columns:
print(f"##### Testing {column} (dtype: {x.dtypes[column]}) #####")
assert x[45000:90000][column].equals(y[column])
The code should pass all assertions, but fails on a column with float32 type (and it would fail on column imp_end_date with float64 type if I let it pass this one):
##### Testing imp_sk (dtype: int64) #####
##### Testing imp_item_sk (dtype: int64) #####
##### Testing imp_competitor (dtype: object) #####
##### Testing imp_competitor_price (dtype: float32) #####
Traceback (most recent call last):
File "reproducer.py", line 8, in <module>
assert x[45000:90000][column].equals(y[column])
AssertionError
Expected behavior
The reproducer should pass all the assertions.
Environment overview (please complete the following information)
- Environment location: Bare-metal
- Method of cuDF install: conda (using this recipe: https://github.com/rapidsai/gpu-bdb/blob/main/conda/rapids-tpcx-bb.yml)
Environment details
print_env.sh.log
Reacted by Devavret Makkar and Vukasin Milovanovic
Activity
kkraus14 commentedon Jan 11, 2021
cc @vuule @devavret
devavret commentedon Jan 11, 2021
The data for
imp_competitor_priceseems to be shifted by 15 indices. Looking...devavret commentedon Jan 12, 2021
I think I know what's going on. Parquet stores data without nulls. It assumes that the nulls will be indicated by the definition levels. So a column containing
[1, null, 3]is stored asdata=[1,3], def_level=[1,0,1]. There are nulls in the float32 column.That means skipping the rows till after e.g. 4537 would mean that the reader doesn't know about the nulls that came before it. That's why reading after 4537 would cause a shift by 1 in the data.
And the shifts add up the more nulls we skip.
devavret commentedon Jan 15, 2021
Tracked this down to the fact that the logic to find the rows to skip due to the presence of nulls is only active for lists. (
gpuUpdatePageSizesis only called byPreprocessColumnData, which is only called for lists).Updated @nvdbaranec offline and passing this to him.
github-actions commentedon Feb 16, 2021
This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.
nvdbaranec commentedon Feb 16, 2021
This is still being addressed. Haven't had time to switch back to it, but it needs to be fixed.
nvdbaranec commentedon Mar 17, 2021
PR with the fix is up if anyone is up for testing with your original repro case.
#7627
Parquet reader: Fix issue when using skip_rows on non-nested columns …