1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-02-11 12:24:40 +00:00
parent 509f005be7
commit 7c808317dc
1367 changed files with 394342 additions and 413129 deletions

View File

@@ -18,7 +18,6 @@
// $Id: wf_min_max.cpp 3932 2013-06-25 16:08:10Z xlou $
//#define NDEBUG
#include <cassert>
#include <cmath>
@@ -46,154 +45,144 @@ using namespace joblist;
#include "wf_min_max.h"
namespace windowfunction
{
template<typename T>
boost::shared_ptr<WindowFunctionType> WF_min_max<T>::makeFunction(int id, const string& name, int ct, WindowFunctionColumn* wc)
template <typename T>
boost::shared_ptr<WindowFunctionType> WF_min_max<T>::makeFunction(int id, const string& name, int ct,
WindowFunctionColumn* wc)
{
boost::shared_ptr<WindowFunctionType> func;
boost::shared_ptr<WindowFunctionType> func;
switch (ct)
switch (ct)
{
case CalpontSystemCatalog::TINYINT:
case CalpontSystemCatalog::SMALLINT:
case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::BIGINT:
{
case CalpontSystemCatalog::TINYINT:
case CalpontSystemCatalog::SMALLINT:
case CalpontSystemCatalog::MEDINT:
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::BIGINT:
{
func.reset(new WF_min_max<int64_t>(id, name));
break;
}
case CalpontSystemCatalog::UTINYINT:
case CalpontSystemCatalog::USMALLINT:
case CalpontSystemCatalog::UMEDINT:
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UBIGINT:
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
{
func.reset(new WF_min_max<uint64_t>(id, name));
break;
}
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
decltype(datatypes::MAXDECIMALWIDTH) width =
wc->functionParms()[0]->resultType().colWidth;
if (width < datatypes::MAXDECIMALWIDTH)
{
if (ct == CalpontSystemCatalog::UDECIMAL)
func.reset(new WF_min_max<uint64_t>(id, name));
else
func.reset(new WF_min_max<int64_t>(id, name));
}
else
{
func.reset(new WF_min_max<int128_t>(id, name));
}
break;
}
case CalpontSystemCatalog::DOUBLE:
case CalpontSystemCatalog::UDOUBLE:
{
func.reset(new WF_min_max<double>(id, name));
break;
}
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
{
func.reset(new WF_min_max<float>(id, name));
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
{
func.reset(new WF_min_max<long double>(id, name));
break;
}
default:
{
func.reset(new WF_min_max<string>(id, name));
break;
}
func.reset(new WF_min_max<int64_t>(id, name));
break;
}
return func;
case CalpontSystemCatalog::UTINYINT:
case CalpontSystemCatalog::USMALLINT:
case CalpontSystemCatalog::UMEDINT:
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UBIGINT:
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIMESTAMP:
case CalpontSystemCatalog::TIME:
{
func.reset(new WF_min_max<uint64_t>(id, name));
break;
}
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
decltype(datatypes::MAXDECIMALWIDTH) width = wc->functionParms()[0]->resultType().colWidth;
if (width < datatypes::MAXDECIMALWIDTH)
{
if (ct == CalpontSystemCatalog::UDECIMAL)
func.reset(new WF_min_max<uint64_t>(id, name));
else
func.reset(new WF_min_max<int64_t>(id, name));
}
else
{
func.reset(new WF_min_max<int128_t>(id, name));
}
break;
}
case CalpontSystemCatalog::DOUBLE:
case CalpontSystemCatalog::UDOUBLE:
{
func.reset(new WF_min_max<double>(id, name));
break;
}
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
{
func.reset(new WF_min_max<float>(id, name));
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
{
func.reset(new WF_min_max<long double>(id, name));
break;
}
default:
{
func.reset(new WF_min_max<string>(id, name));
break;
}
}
return func;
}
template<typename T>
template <typename T>
WindowFunctionType* WF_min_max<T>::clone() const
{
return new WF_min_max<T>(*this);
return new WF_min_max<T>(*this);
}
template<typename T>
template <typename T>
void WF_min_max<T>::resetData()
{
fCount = 0;
fCount = 0;
WindowFunctionType::resetData();
WindowFunctionType::resetData();
}
template<typename T>
template <typename T>
void WF_min_max<T>::operator()(int64_t b, int64_t e, int64_t c)
{
// for unbounded - current row special handling
if (fPrev >= b && fPrev < c)
b = c;
else if (fPrev <= e && fPrev > c)
e = c;
// for unbounded - current row special handling
if (fPrev >= b && fPrev < c)
b = c;
else if (fPrev <= e && fPrev > c)
e = c;
uint64_t colIn = fFieldIndex[1];
uint64_t colIn = fFieldIndex[1];
for (int64_t i = b; i <= e; i++)
for (int64_t i = b; i <= e; i++)
{
if (i % 1000 == 0 && fStep->cancelled())
break;
fRow.setData(getPointer(fRowData->at(i)));
if (fRow.isNullValue(colIn) == true)
continue;
T valIn;
getValue(colIn, valIn);
if ((fCount == 0) || (valIn < fValue && fFunctionId == WF__MIN) ||
(valIn > fValue && fFunctionId == WF__MAX))
{
if (i % 1000 == 0 && fStep->cancelled())
break;
fRow.setData(getPointer(fRowData->at(i)));
if (fRow.isNullValue(colIn) == true)
continue;
T valIn;
getValue(colIn, valIn);
if ((fCount == 0) ||
(valIn < fValue && fFunctionId == WF__MIN) ||
(valIn > fValue && fFunctionId == WF__MAX))
{
fValue = valIn;
}
fCount++;
fValue = valIn;
}
T* v = ((fCount > 0) ? &fValue : NULL);
setValue(fRow.getColType(fFieldIndex[0]), b, e, c, v);
fCount++;
}
fPrev = c;
T* v = ((fCount > 0) ? &fValue : NULL);
setValue(fRow.getColType(fFieldIndex[0]), b, e, c, v);
fPrev = c;
}
template boost::shared_ptr<WindowFunctionType> WF_min_max<int64_t>::makeFunction(int, const string&, int,
WindowFunctionColumn*);
template
boost::shared_ptr<WindowFunctionType> WF_min_max<int64_t>::makeFunction(int, const string&, int, WindowFunctionColumn*);
} //namespace
} // namespace windowfunction
// vim:ts=4 sw=4: