1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-1793-regr_* functions get wrong answer. Pretty up some code.

This commit is contained in:
David Hall
2018-11-06 10:30:38 -06:00
parent e58c4c3381
commit 1426b4d99b

View File

@ -187,17 +187,14 @@ void WindowFunction::operator()()
prevFrame = w; prevFrame = w;
} }
// If b > e then the frame is entirely outside of the partition
// and there's no values to drop
if (b <= e)
{
// UDAnF functions may have a dropValue function implemented. // UDAnF functions may have a dropValue function implemented.
// If they do, we can optimize by calling dropValue() for those // If they do, we can optimize by calling dropValue() for those
// values leaving the window and nextValue for those entering, rather // values leaving the window and nextValue for those entering, rather
// than a resetData() and then iterating over the entire window. // than a resetData() and then iterating over the entire window.
// Built-in functions may have this functionality added in the future. // Built-in functions may have this functionality added in the future.
// If b > e, then nothing to drop. // If b > e then the frame is entirely outside of the partition
if (!firstTime) // and there's no values to drop
if (!firstTime && b <= e)
{ {
if (fFunctionType->dropValues(prevFrame.first, w.first)) if (fFunctionType->dropValues(prevFrame.first, w.first))
{ {
@ -208,11 +205,10 @@ void WindowFunction::operator()()
else else
{ {
// dropValues failed or doesn't exist // dropValues failed or doesn't exist
// so do the entire frame. // so calculate the entire frame.
fFunctionType->resetData(); fFunctionType->resetData();
} }
} }
}
fFunctionType->operator()(b, e, i); // UDAnF: Calls nextValue and evaluate fFunctionType->operator()(b, e, i); // UDAnF: Calls nextValue and evaluate
firstTime = false; firstTime = false;
prevFrame = w; prevFrame = w;
@ -230,7 +226,7 @@ void WindowFunction::operator()()
} }
catch (...) catch (...)
{ {
fStep->handleException("unknow exception", logging::ERR_EXECUTE_WINDOW_FUNCTION); fStep->handleException("unknown exception", logging::ERR_EXECUTE_WINDOW_FUNCTION);
} }
} }