forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataTypeDecimalBase.cpp
47 lines (38 loc) · 1.05 KB
/
DataTypeDecimalBase.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <DataTypes/DataTypeDecimalBase.h>
#include <Interpreters/Context.h>
#include <type_traits>
namespace DB
{
namespace ErrorCodes
{
}
bool decimalCheckComparisonOverflow(ContextPtr context)
{
return context->getSettingsRef().decimal_check_overflow;
}
bool decimalCheckArithmeticOverflow(ContextPtr context)
{
return context->getSettingsRef().decimal_check_overflow;
}
template <is_decimal T>
Field DataTypeDecimalBase<T>::getDefault() const
{
return DecimalField(T(0), scale);
}
template <is_decimal T>
MutableColumnPtr DataTypeDecimalBase<T>::createColumn() const
{
return ColumnType::create(0, scale);
}
template <is_decimal T>
T DataTypeDecimalBase<T>::getScaleMultiplier(UInt32 scale_)
{
return DecimalUtils::scaleMultiplier<typename T::NativeType>(scale_);
}
/// Explicit template instantiations.
template class DataTypeDecimalBase<Decimal32>;
template class DataTypeDecimalBase<Decimal64>;
template class DataTypeDecimalBase<Decimal128>;
template class DataTypeDecimalBase<Decimal256>;
template class DataTypeDecimalBase<DateTime64>;
}