ibis icon indicating copy to clipboard operation
ibis copied to clipboard

feat: warn when limit reached in expr.execute()

Open scottcode opened this issue 5 years ago • 5 comments

When executing an expression a limit is silently applied to what is returned (unless you pass limit=None). A user could accidentally continue with local analysis on an arbitrary subset without realizing it's a subset. I'd like an optional parameter/setting that causes it to write a warning to stderr or raise an exception if the limit was exceeded.

Since the limit is currently implemented by adding a limit expression to the original query, it may be difficult to know whether the limit would have been exceeded. In that case, maybe it could just check to see if the number of returned records equals the limit and issue the warning then. It might not definitively mean that the limit would've been exceeded, but would still be useful to get a warning that the limit was potentially exceeded.

scottcode avatar Oct 30 '19 16:10 scottcode

I very much agree with this.

ian-r-rose avatar Oct 30 '19 16:10 ian-r-rose

Is there a reason to keep this? IIRC we removed that for omniscidb backend

xmnlab avatar Oct 30 '19 16:10 xmnlab

To keep what, @xmnlab ?

scottcode avatar Oct 30 '19 17:10 scottcode

Do you mean the application of a (default) limit in the execute method?

scottcode avatar Oct 30 '19 17:10 scottcode

sorry I was not clear ... I mean .. is there a reason to keep a default limit != None?

we are setting that to None inside omniscidb because it was generating conflict with sql method at at that time ... after that we change the algorithm related to this method .. and probably it wouldn't be a problem now .. but we kept it as None.

xmnlab avatar Oct 30 '19 18:10 xmnlab

I agree with the arguments to change the default limit to None. We'll keep the mechanism for a default limit around in case people want to enable an extra guard rail, but by default it seems safer to have no limit (to avoid silent truncation) than to enable an arbitrary limit. There's a PR up implementing this change at #4650.

jcrist avatar Oct 14 '22 18:10 jcrist