Fix crash in largestTriangleThreeBuckets

This commit is contained in:
Raúl Marín 2024-04-15 09:58:33 +00:00
parent e3c09e9703
commit 0474beceab
3 changed files with 6 additions and 0 deletions

View File

@ -40,12 +40,16 @@ struct LargestTriangleThreeBucketsData : public StatisticalSample<Float64, Float
{
void add(const Float64 xval, const Float64 yval, Arena * arena)
{
/// We need to ensure either both or neither coordinates are saved (StatisticalSample ignores NaNs)
if (isNaN(xval) || isNaN(yval))
return;
this->addX(xval, arena);
this->addY(yval, arena);
}
void sort(Arena * arena)
{
chassert(this->x.size() == this->y.size());
// sort the this->x and this->y in ascending order of this->x using index
std::vector<size_t> index(this->x.size());

View File

@ -0,0 +1 @@
SELECT largestTriangleThreeBuckets(1)(1, nan);