You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-06-13 16:01:32 +03:00
MCOL-1793 Window functions fail when current row outside of window
This commit is contained in:
@ -187,21 +187,33 @@ void WindowFunction::operator()()
|
||||
prevFrame = w;
|
||||
}
|
||||
|
||||
// UDAnF functions may have a dropValue function implemented.
|
||||
// If they do, we can optimize by calling dropValue() for those
|
||||
// values leaving the window and nextValue for those entering, rather
|
||||
// than a resetData() and then iterating over the entire window.
|
||||
// Built-in functions may have this functionality added in the future.
|
||||
if (fFunctionType->dropValues(prevFrame.first, w.first))
|
||||
// If b > e then the frame is entirely outside of the partition
|
||||
// and there's no values to add
|
||||
if (b <= e)
|
||||
{
|
||||
b = firstTime ? w.first : prevFrame.second + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fFunctionType->resetData();
|
||||
}
|
||||
// UDAnF functions may have a dropValue function implemented.
|
||||
// If they do, we can optimize by calling dropValue() for those
|
||||
// values leaving the window and nextValue for those entering, rather
|
||||
// than a resetData() and then iterating over the entire window.
|
||||
// Built-in functions may have this functionality added in the future.
|
||||
// If b > e, then nothing to drop.
|
||||
if (!firstTime)
|
||||
{
|
||||
if (fFunctionType->dropValues(prevFrame.first, w.first))
|
||||
{
|
||||
// Adjust the beginning of the frame for nextValue
|
||||
// to start where the previous frame left off.
|
||||
b = prevFrame.second + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// dropValues failed so do the entire frame.
|
||||
fFunctionType->resetData();
|
||||
}
|
||||
}
|
||||
|
||||
fFunctionType->operator()(b, e, i);
|
||||
fFunctionType->operator()(b, e, i); // Calls nextValue
|
||||
}
|
||||
prevFrame = w;
|
||||
firstTime = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user