cudf: [BUG] Orc test failure (test_orc_write_statistics)
The following tests fail reliably for me:
FAILED cudf/tests/test_orc.py::test_orc_write_statistics[100] - AssertionError: assert False
FAILED cudf/tests/test_orc.py::test_orc_write_statistics[6000000] - AssertionError: assert False
Stack trace:
============================= test session starts ==============================
platform linux -- Python 3.7.9, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=1 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=0)
rapids_pytest_benchmark: 0.0.13
rootdir: /home/ashwin/workspace/rapids/cudf/python/cudf, configfile: setup.cfg
plugins: benchmark-3.2.3, rapids-pytest-benchmark-0.0.13, xdist-2.2.0, hypothesis-6.1.1, forked-1.3.0
collected 92 items / 89 deselected / 3 selected
cudf/tests/test_orc.py .FF [100%]
=================================== FAILURES ===================================
________________________ test_orc_write_statistics[100] ________________________
tmpdir = local('/tmp/pytest-of-rapids/pytest-1/test_orc_write_statistics_100_0')
datadir = PosixPath('/home/ashwin/workspace/rapids/cudf/python/cudf/cudf/tests/data/orc')
nrows = 100
@pytest.mark.parametrize("nrows", [1, 100, 6000000])
def test_orc_write_statistics(tmpdir, datadir, nrows):
supported_stat_types = supported_numpy_dtypes + ["str"]
# Make a dataframe
gdf = cudf.DataFrame(
{
"col_" + str(dtype): gen_rand_series(dtype, nrows, has_nulls=True)
for dtype in supported_stat_types
}
)
fname = tmpdir.join("gdf.orc")
# Write said dataframe to ORC with cuDF
gdf.to_orc(fname.strpath)
# Read back written ORC's statistics
orc_file = pa.orc.ORCFile(fname)
(file_stats, stripes_stats,) = cudf.io.orc.read_orc_statistics(fname)
# check file stats
for col in gdf:
if "minimum" in file_stats[col]:
stats_min = file_stats[col]["minimum"]
actual_min = gdf[col].min()
assert normalized_equals(actual_min, stats_min)
if "maximum" in file_stats[col]:
stats_max = file_stats[col]["maximum"]
actual_max = gdf[col].max()
assert normalized_equals(actual_max, stats_max)
# compare stripe statistics with actual min/max
for stripe_idx in range(0, orc_file.nstripes):
stripe = orc_file.read_stripe(stripe_idx)
# pandas is unable to handle min/max of string col with nulls
stripe_df = cudf.DataFrame(stripe.to_pandas())
for col in stripe_df:
if "minimum" in stripes_stats[stripe_idx][col]:
actual_min = stripe_df[col].min()
stats_min = stripes_stats[stripe_idx][col]["minimum"]
> assert normalized_equals(actual_min, stats_min)
E AssertionError: assert False
E + where False = normalized_equals(numpy.datetime64('1970-05-30T18:27:14.488000000'), datetime.datetime(1970, 5, 30, 17, 27, 14, 488000, tzinfo=datetime.timezone.utc))
cudf/tests/test_orc.py:611: AssertionError
______________________ test_orc_write_statistics[6000000] ______________________
tmpdir = local('/tmp/pytest-of-rapids/pytest-1/test_orc_write_statistics_60000')
datadir = PosixPath('/home/ashwin/workspace/rapids/cudf/python/cudf/cudf/tests/data/orc')
nrows = 6000000
@pytest.mark.parametrize("nrows", [1, 100, 6000000])
def test_orc_write_statistics(tmpdir, datadir, nrows):
supported_stat_types = supported_numpy_dtypes + ["str"]
# Make a dataframe
gdf = cudf.DataFrame(
{
"col_" + str(dtype): gen_rand_series(dtype, nrows, has_nulls=True)
for dtype in supported_stat_types
}
)
fname = tmpdir.join("gdf.orc")
# Write said dataframe to ORC with cuDF
gdf.to_orc(fname.strpath)
# Read back written ORC's statistics
orc_file = pa.orc.ORCFile(fname)
(file_stats, stripes_stats,) = cudf.io.orc.read_orc_statistics(fname)
# check file stats
for col in gdf:
if "minimum" in file_stats[col]:
stats_min = file_stats[col]["minimum"]
actual_min = gdf[col].min()
assert normalized_equals(actual_min, stats_min)
if "maximum" in file_stats[col]:
stats_max = file_stats[col]["maximum"]
actual_max = gdf[col].max()
assert normalized_equals(actual_max, stats_max)
# compare stripe statistics with actual min/max
for stripe_idx in range(0, orc_file.nstripes):
stripe = orc_file.read_stripe(stripe_idx)
# pandas is unable to handle min/max of string col with nulls
stripe_df = cudf.DataFrame(stripe.to_pandas())
for col in stripe_df:
if "minimum" in stripes_stats[stripe_idx][col]:
actual_min = stripe_df[col].min()
stats_min = stripes_stats[stripe_idx][col]["minimum"]
assert normalized_equals(actual_min, stats_min)
if "maximum" in stripes_stats[stripe_idx][col]:
actual_max = stripe_df[col].max()
stats_max = stripes_stats[stripe_idx][col]["maximum"]
> assert normalized_equals(actual_max, stats_max)
E AssertionError: assert False
E + where False = normalized_equals(numpy.datetime64('2001-09-09T01:25:37.291000000'), datetime.datetime(2001, 9, 9, 0, 25, 37, 291000, tzinfo=datetime.timezone.utc))
cudf/tests/test_orc.py:616: AssertionError
=============================== warnings summary ===============================
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/core/types/__init__.py:108
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/core/types/__init__.py:108: DeprecationWarning: `np.long` is a deprecated alias for `np.compat.long`. To silence this warning, use `np.compat.long` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `int` for which `np.compat.long` is itself an alias. Doing this will not modify any behaviour and is safe. When replacing `np.long`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
long_ = _make_signed(np.long)
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/core/types/__init__.py:109
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/core/types/__init__.py:109: DeprecationWarning: `np.long` is a deprecated alias for `np.compat.long`. To silence this warning, use `np.compat.long` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `int` for which `np.compat.long` is itself an alias. Doing this will not modify any behaviour and is safe. When replacing `np.long`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
ulong = _make_unsigned(np.long)
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:112
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:112: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def device_array(shape, dtype=np.float, strides=None, order='C', stream=0):
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:124
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:124: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def managed_array(shape, dtype=np.float, strides=None, order='C', stream=0,
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:154
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:154: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def pinned_array(shape, dtype=np.float, strides=None, order='C'):
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:170
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/api.py:170: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def mapped_array(shape, dtype=np.float, strides=None, order='C', stream=0,
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/simulator/cudadrv/devicearray.py:313
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/simulator/cudadrv/devicearray.py:313: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def pinned_array(shape, dtype=np.float, strides=None, order='C'):
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/simulator/cudadrv/devicearray.py:317
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/numba/cuda/simulator/cudadrv/devicearray.py:317: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def managed_array(shape, dtype=np.float, strides=None, order='C'):
../../../rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/cupyx/scipy/sparse/_index.py:22
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/cupyx/scipy/sparse/_index.py:22: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
_bool_scalar_types = (bool, numpy.bool, numpy.bool_)
cudf/utils/utils.py:196
/home/ashwin/workspace/rapids/cudf/python/cudf/cudf/utils/utils.py:196: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def get_null_series(size, dtype=np.bool):
cudf/tests/test_orc.py::test_orc_write_statistics[1]
cudf/tests/test_orc.py::test_orc_write_statistics[100]
cudf/tests/test_orc.py::test_orc_write_statistics[6000000]
/home/ashwin/workspace/rapids/cudf/python/cudf/cudf/tests/utils.py:262: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
return np.random.randint(low=low, high=high, size=size).astype(np.bool)
cudf/tests/test_orc.py::test_orc_write_statistics[1]
/home/ashwin/workspace/rapids/rapids-compose/etc/conda/cuda_10.1/envs/rapids/lib/python3.7/site-packages/pandas/util/__init__.py:12: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
import pandas.util.testing
cudf/tests/test_orc.py: 15 warnings
/home/ashwin/workspace/rapids/cudf/python/cudf/cudf/tests/test_orc.py:562: DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future
value2 = np.datetime64(value2, "ms")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED cudf/tests/test_orc.py::test_orc_write_statistics[100] - AssertionErro...
FAILED cudf/tests/test_orc.py::test_orc_write_statistics[6000000] - Assertion...
=========== 2 failed, 1 passed, 89 deselected, 29 warnings in 5.52s ============
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (15 by maintainers)
I discussed this with @vuule today. I have produced a minimal test case that disagrees between PyArrow’s file reader and
cudf.read_orc. This uses cudf 95909982d2, pandas 1.3.5, and pyarrow 5.0.0.Output:
From this, we can narrow it down to a specific case: PyArrow does not read the correct data from a file written by cuDF.
I have a hypothesis about the reason for this, from earlier discussion with @vuule. Using the ORC tools, I get the following:
The above snippet shows that the
orc-contents(reference?) reader sees the same timestamp in both files. But the metadata differs:Notably, the file written by pyarrow says
"writer version": "ORC-135"while the file written by cuDF says"writer version": "original".The ORCv1 spec is here and notes,
Here’s the issue for ORC-135.
I hope this is helpful diagnostic information - I am not yet sure where to look next. I am also unsure about whether to treat this as a bug in cuDF’s metadata writing, or a bug in pyarrow’s metadata reading.
I can confirm that all the timestamps that pass the equality check are before 1918 OR (after 1918 AND in months when DST is not active). The timestamps that fail the equality check are all (after 1918 AND in months when DST is active).
Passing:
Failing (ignore the
NaTrows becauseNaT != NaT):One possible exception:
1943-11-21 00:31:30.609587072seems weird, right? Well, the United States observed DST all of 1943.cc: @vuule @devavret