soda-core
soda-core copied to clipboard
Getting ValueError for DRO query that returns 0 rows
I have a DRO query that returns 0 rows. I get the following error in a case like this. Wouldn't it be better to skip DRO generation for queries with 0 rows and then fail those checks that have their dro files marked as
Soda Core 3.0.10
Traceback (most recent call last):
update_dro_func(
File "/usr/local/lib/python3.8/site-packages/soda/cli/cli.py", line 346, in update_dro
dro = DROGenerator(RefDataCfg(distribution_type=distribution_type), column_values).generate()
File "/usr/local/lib/python3.8/site-packages/soda/scientific/distribution/generate_dro.py", line 121, in generate
return self.generate_continuous_dro()
File "/usr/local/lib/python3.8/site-packages/soda/scientific/distribution/generate_dro.py", line 70, in generate_continuous_dro
n_bins = self._compute_n_bins(data)
File "/usr/local/lib/python3.8/site-packages/soda/scientific/distribution/generate_dro.py", line 32, in _compute_n_bins
_range = (data.min(), data.max())
File "/usr/local/lib/python3.8/site-packages/numpy/core/_methods.py", line 44, in _amin
return umr_minimum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation minimum which has no identity
SODA-1205
Hi @mrafayaleem,
Thanks lot for reporting the issue. I created a PR to handle tables having 0 rows :)