Skip to content
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

Remove non-primitive version of TDigest#valuesAt #1054

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

raunaqmorarka
Copy link
Contributor

Using this API incurrs cost of converting input list to array and output array to list.
There is no reason to use this over the more efficient primitive arrays version.

Using this API incurrs cost of converting input list to array
and output array to list.
There is no reason to use this over the more efficient primitive
arrays version.
@@ -127,11 +126,6 @@ public double valueAt(double quantile)
return digest.valueAt(quantile);
}

public List<Double> valuesAt(List<Double> quantiles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods serve two different purposes. Not always the caller has a fixed list of values, so a list is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a real use case where the caller has a variable list of quantiles ? I couldn't find any actual usage of this particular method.
For the same method on TDigest, I found all the existing usage of it be unnecessary and am proposing to removing it in trinodb/trino#16811
The implementation of this method is just converting the list to an array and then using the primitive version of the implementation. That can be done explicitly by the caller anyway.
If there is a real need for variable input, then there should an implementation that doesn't incur the overheads of List to double[] conversion. Otherwise it's just hiding the cost of conversions from the caller and can lead to callers not thinking about this unnecessary overhead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants