-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++][Compute] Add FunctionOptions::Validate #45760
Comments
@zanmato1984 @WillAyd @kou Does this sound useful to you? |
In some cases, validation could require the input types, though. |
+1 |
+1. Having a unified interface of input option validation could be very useful - I think many functions are doing this kind of checking in either the resolution or the function body. Just that, as you mentioned, the validation may depend on the input types, so where to call it could be subtle. Perhaps near arrow/cpp/src/arrow/compute/function.cc Line 199 in c3e399a
? |
Actually, the part that depends on input types might be done in the kernel's output resolver? |
True. But that may make some checking of the function option (I can't name one though) that depends on the input types have to be separated into the output resolver. And this might weaken the meaning of having an unified interface of validating the function option? |
Agreed. So perhaps it's not that useful? (we can of course already check options in the output resolver) |
I would say it's a "nice to have". It's not necessary in terms of functionality. But it surely helps on better code structure and readability - as long as enough context (input types e.g.) are given so we can do all kinds of validation here rather than having to do it in output resolver. |
My original idea was to be able to validate options independent of their usage. For example, this would raise an exception in Python because quantiles must be between 0 and 1: >>> pc.QuantileOptions(q=[2.0])
QuantileOptions(q=[2], interpolation=LINEAR, skip_nulls=true, min_count=0) |
Oh, that's a different use case than what I've been imagining. Sorry I don't use Python that much so I would stand neutral on this. |
Describe the enhancement requested
Compute function options can have validity constraints, for example a quantile should be between 0.0 and 1.0.
By exposing a
Status Validate()
virtual method onFunctionOptions
, we would allow easier debugging and integration with higher-level languages.Component(s)
C++
The text was updated successfully, but these errors were encountered: