mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Something
This commit is contained in:
parent
04a6107966
commit
c3f42b7bc7
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
set (DEFAULT_LIBS "-nodefaultlibs")
|
set (DEFAULT_LIBS "-nodefaultlibs")
|
||||||
|
|
||||||
# We need builtins from Clang's RT even without libcxx - for ubsan+int128.
|
# We need builtins from Clang
|
||||||
# See https://bugs.llvm.org/show_bug.cgi?id=16404
|
|
||||||
execute_process (COMMAND
|
execute_process (COMMAND
|
||||||
${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET} --print-libgcc-file-name --rtlib=compiler-rt
|
${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET} --print-libgcc-file-name --rtlib=compiler-rt
|
||||||
OUTPUT_VARIABLE BUILTINS_LIBRARY
|
OUTPUT_VARIABLE BUILTINS_LIBRARY
|
||||||
|
@ -276,6 +276,6 @@ private:
|
|||||||
{
|
{
|
||||||
if (OnEmpty == ReservoirSamplerOnEmpty::THROW)
|
if (OnEmpty == ReservoirSamplerOnEmpty::THROW)
|
||||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Quantile of empty ReservoirSampler");
|
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Quantile of empty ReservoirSampler");
|
||||||
return NanLikeValueConstructor<ResultType, std::is_floating_point_v<ResultType>>::getValue();
|
return NanLikeValueConstructor<ResultType, is_floating_point<ResultType>>::getValue();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@ template class ColumnUnique<ColumnInt128>;
|
|||||||
template class ColumnUnique<ColumnUInt128>;
|
template class ColumnUnique<ColumnUInt128>;
|
||||||
template class ColumnUnique<ColumnInt256>;
|
template class ColumnUnique<ColumnInt256>;
|
||||||
template class ColumnUnique<ColumnUInt256>;
|
template class ColumnUnique<ColumnUInt256>;
|
||||||
|
template class ColumnUnique<ColumnBFloat16>;
|
||||||
template class ColumnUnique<ColumnFloat32>;
|
template class ColumnUnique<ColumnFloat32>;
|
||||||
template class ColumnUnique<ColumnFloat64>;
|
template class ColumnUnique<ColumnFloat64>;
|
||||||
template class ColumnUnique<ColumnString>;
|
template class ColumnUnique<ColumnString>;
|
||||||
|
@ -760,6 +760,7 @@ extern template class ColumnUnique<ColumnInt128>;
|
|||||||
extern template class ColumnUnique<ColumnUInt128>;
|
extern template class ColumnUnique<ColumnUInt128>;
|
||||||
extern template class ColumnUnique<ColumnInt256>;
|
extern template class ColumnUnique<ColumnInt256>;
|
||||||
extern template class ColumnUnique<ColumnUInt256>;
|
extern template class ColumnUnique<ColumnUInt256>;
|
||||||
|
extern template class ColumnUnique<ColumnBFloat16>;
|
||||||
extern template class ColumnUnique<ColumnFloat32>;
|
extern template class ColumnUnique<ColumnFloat32>;
|
||||||
extern template class ColumnUnique<ColumnFloat64>;
|
extern template class ColumnUnique<ColumnFloat64>;
|
||||||
extern template class ColumnUnique<ColumnString>;
|
extern template class ColumnUnique<ColumnString>;
|
||||||
|
@ -443,6 +443,7 @@ template class IColumnHelper<ColumnVector<Int32>, ColumnFixedSizeHelper>;
|
|||||||
template class IColumnHelper<ColumnVector<Int64>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<Int64>, ColumnFixedSizeHelper>;
|
||||||
template class IColumnHelper<ColumnVector<Int128>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<Int128>, ColumnFixedSizeHelper>;
|
||||||
template class IColumnHelper<ColumnVector<Int256>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<Int256>, ColumnFixedSizeHelper>;
|
||||||
|
template class IColumnHelper<ColumnVector<BFloat16>, ColumnFixedSizeHelper>;
|
||||||
template class IColumnHelper<ColumnVector<Float32>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<Float32>, ColumnFixedSizeHelper>;
|
||||||
template class IColumnHelper<ColumnVector<Float64>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<Float64>, ColumnFixedSizeHelper>;
|
||||||
template class IColumnHelper<ColumnVector<UUID>, ColumnFixedSizeHelper>;
|
template class IColumnHelper<ColumnVector<UUID>, ColumnFixedSizeHelper>;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <Common/FieldVisitorConvertToNumber.h>
|
#include <Common/FieldVisitorConvertToNumber.h>
|
||||||
#include "base/Decimal.h"
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -17,6 +16,7 @@ template class FieldVisitorConvertToNumber<Int128>;
|
|||||||
template class FieldVisitorConvertToNumber<UInt128>;
|
template class FieldVisitorConvertToNumber<UInt128>;
|
||||||
template class FieldVisitorConvertToNumber<Int256>;
|
template class FieldVisitorConvertToNumber<Int256>;
|
||||||
template class FieldVisitorConvertToNumber<UInt256>;
|
template class FieldVisitorConvertToNumber<UInt256>;
|
||||||
|
//template class FieldVisitorConvertToNumber<BFloat16>;
|
||||||
template class FieldVisitorConvertToNumber<Float32>;
|
template class FieldVisitorConvertToNumber<Float32>;
|
||||||
template class FieldVisitorConvertToNumber<Float64>;
|
template class FieldVisitorConvertToNumber<Float64>;
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ extern template class FieldVisitorConvertToNumber<Int128>;
|
|||||||
extern template class FieldVisitorConvertToNumber<UInt128>;
|
extern template class FieldVisitorConvertToNumber<UInt128>;
|
||||||
extern template class FieldVisitorConvertToNumber<Int256>;
|
extern template class FieldVisitorConvertToNumber<Int256>;
|
||||||
extern template class FieldVisitorConvertToNumber<UInt256>;
|
extern template class FieldVisitorConvertToNumber<UInt256>;
|
||||||
|
//extern template class FieldVisitorConvertToNumber<BFloat16>;
|
||||||
extern template class FieldVisitorConvertToNumber<Float32>;
|
extern template class FieldVisitorConvertToNumber<Float32>;
|
||||||
extern template class FieldVisitorConvertToNumber<Float64>;
|
extern template class FieldVisitorConvertToNumber<Float64>;
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ enum class BinaryTypeIndex : uint8_t
|
|||||||
SimpleAggregateFunction = 0x2E,
|
SimpleAggregateFunction = 0x2E,
|
||||||
Nested = 0x2F,
|
Nested = 0x2F,
|
||||||
JSON = 0x30,
|
JSON = 0x30,
|
||||||
|
BFloat16 = 0x31,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// In future we can introduce more arguments in the JSON data type definition.
|
/// In future we can introduce more arguments in the JSON data type definition.
|
||||||
@ -151,6 +152,8 @@ BinaryTypeIndex getBinaryTypeIndex(const DataTypePtr & type)
|
|||||||
return BinaryTypeIndex::Int128;
|
return BinaryTypeIndex::Int128;
|
||||||
case TypeIndex::Int256:
|
case TypeIndex::Int256:
|
||||||
return BinaryTypeIndex::Int256;
|
return BinaryTypeIndex::Int256;
|
||||||
|
case TypeIndex::BFloat16:
|
||||||
|
return BinaryTypeIndex::BFloat16;
|
||||||
case TypeIndex::Float32:
|
case TypeIndex::Float32:
|
||||||
return BinaryTypeIndex::Float32;
|
return BinaryTypeIndex::Float32;
|
||||||
case TypeIndex::Float64:
|
case TypeIndex::Float64:
|
||||||
@ -565,6 +568,8 @@ DataTypePtr decodeDataType(ReadBuffer & buf)
|
|||||||
return std::make_shared<DataTypeInt128>();
|
return std::make_shared<DataTypeInt128>();
|
||||||
case BinaryTypeIndex::Int256:
|
case BinaryTypeIndex::Int256:
|
||||||
return std::make_shared<DataTypeInt256>();
|
return std::make_shared<DataTypeInt256>();
|
||||||
|
case BinaryTypeIndex::BFloat16:
|
||||||
|
return std::make_shared<DataTypeBFloat16>();
|
||||||
case BinaryTypeIndex::Float32:
|
case BinaryTypeIndex::Float32:
|
||||||
return std::make_shared<DataTypeFloat32>();
|
return std::make_shared<DataTypeFloat32>();
|
||||||
case BinaryTypeIndex::Float64:
|
case BinaryTypeIndex::Float64:
|
||||||
|
@ -112,6 +112,7 @@ template class DataTypeNumber<Int8>;
|
|||||||
template class DataTypeNumber<Int16>;
|
template class DataTypeNumber<Int16>;
|
||||||
template class DataTypeNumber<Int32>;
|
template class DataTypeNumber<Int32>;
|
||||||
template class DataTypeNumber<Int64>;
|
template class DataTypeNumber<Int64>;
|
||||||
|
template class DataTypeNumber<BFloat16>;
|
||||||
template class DataTypeNumber<Float32>;
|
template class DataTypeNumber<Float32>;
|
||||||
template class DataTypeNumber<Float64>;
|
template class DataTypeNumber<Float64>;
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ extern template class DataTypeNumber<Int8>;
|
|||||||
extern template class DataTypeNumber<Int16>;
|
extern template class DataTypeNumber<Int16>;
|
||||||
extern template class DataTypeNumber<Int32>;
|
extern template class DataTypeNumber<Int32>;
|
||||||
extern template class DataTypeNumber<Int64>;
|
extern template class DataTypeNumber<Int64>;
|
||||||
|
extern template class DataTypeNumber<BFloat16>;
|
||||||
extern template class DataTypeNumber<Float32>;
|
extern template class DataTypeNumber<Float32>;
|
||||||
extern template class DataTypeNumber<Float64>;
|
extern template class DataTypeNumber<Float64>;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ bool tryGetNumericValueFromJSONElement(
|
|||||||
switch (element.type())
|
switch (element.type())
|
||||||
{
|
{
|
||||||
case ElementType::DOUBLE:
|
case ElementType::DOUBLE:
|
||||||
if constexpr (std::is_floating_point_v<NumberType>)
|
if constexpr (is_floating_point<NumberType>)
|
||||||
{
|
{
|
||||||
/// We permit inaccurate conversion of double to float.
|
/// We permit inaccurate conversion of double to float.
|
||||||
/// Example: double 0.1 from JSON is not representable in float.
|
/// Example: double 0.1 from JSON is not representable in float.
|
||||||
@ -175,7 +175,7 @@ bool tryGetNumericValueFromJSONElement(
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rb = ReadBufferFromMemory{element.getString()};
|
auto rb = ReadBufferFromMemory{element.getString()};
|
||||||
if constexpr (std::is_floating_point_v<NumberType>)
|
if constexpr (is_floating_point<NumberType>)
|
||||||
{
|
{
|
||||||
if (!tryReadFloatText(value, rb) || !rb.eof())
|
if (!tryReadFloatText(value, rb) || !rb.eof())
|
||||||
{
|
{
|
||||||
|
@ -110,6 +110,7 @@ template <typename DataType> constexpr bool IsIntegralOrExtendedOrDecimal =
|
|||||||
IsDataTypeDecimal<DataType>;
|
IsDataTypeDecimal<DataType>;
|
||||||
|
|
||||||
template <typename DataType> constexpr bool IsFloatingPoint = false;
|
template <typename DataType> constexpr bool IsFloatingPoint = false;
|
||||||
|
template <> inline constexpr bool IsFloatingPoint<DataTypeBFloat16> = true;
|
||||||
template <> inline constexpr bool IsFloatingPoint<DataTypeFloat32> = true;
|
template <> inline constexpr bool IsFloatingPoint<DataTypeFloat32> = true;
|
||||||
template <> inline constexpr bool IsFloatingPoint<DataTypeFloat64> = true;
|
template <> inline constexpr bool IsFloatingPoint<DataTypeFloat64> = true;
|
||||||
|
|
||||||
|
@ -2930,6 +2930,7 @@ template <> struct FunctionTo<DataTypeInt32> { using Type = FunctionToInt32; };
|
|||||||
template <> struct FunctionTo<DataTypeInt64> { using Type = FunctionToInt64; };
|
template <> struct FunctionTo<DataTypeInt64> { using Type = FunctionToInt64; };
|
||||||
template <> struct FunctionTo<DataTypeInt128> { using Type = FunctionToInt128; };
|
template <> struct FunctionTo<DataTypeInt128> { using Type = FunctionToInt128; };
|
||||||
template <> struct FunctionTo<DataTypeInt256> { using Type = FunctionToInt256; };
|
template <> struct FunctionTo<DataTypeInt256> { using Type = FunctionToInt256; };
|
||||||
|
//template <> struct FunctionTo<DataTypeBFloat16> { using Type = FunctionToBFloat16; };
|
||||||
template <> struct FunctionTo<DataTypeFloat32> { using Type = FunctionToFloat32; };
|
template <> struct FunctionTo<DataTypeFloat32> { using Type = FunctionToFloat32; };
|
||||||
template <> struct FunctionTo<DataTypeFloat64> { using Type = FunctionToFloat64; };
|
template <> struct FunctionTo<DataTypeFloat64> { using Type = FunctionToFloat64; };
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ public:
|
|||||||
if (arguments.size() > 1)
|
if (arguments.size() > 1)
|
||||||
{
|
{
|
||||||
const ColumnWithTypeAndName & scale_column = arguments[1];
|
const ColumnWithTypeAndName & scale_column = arguments[1];
|
||||||
res = Dispatcher<DataType, rounding_mode, tie_breaking_mode>::template apply<ScaleType>(value_arg.column.get(), scale_column.column.get());
|
res = Dispatcher<DataType, rounding_mode, tie_breaking_mode>::template apply<int>(value_arg.column.get(), scale_column.column.get());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
res = Dispatcher<DataType, rounding_mode, tie_breaking_mode>::template apply<int>(value_arg.column.get());
|
res = Dispatcher<DataType, rounding_mode, tie_breaking_mode>::template apply<int>(value_arg.column.get());
|
||||||
|
@ -47,26 +47,35 @@ void assertNaN(ReadBuffer & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template void readFloatTextPrecise<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template void readFloatTextPrecise<Float32>(Float32 &, ReadBuffer &);
|
template void readFloatTextPrecise<Float32>(Float32 &, ReadBuffer &);
|
||||||
template void readFloatTextPrecise<Float64>(Float64 &, ReadBuffer &);
|
template void readFloatTextPrecise<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
template bool tryReadFloatTextPrecise<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextPrecise<Float32>(Float32 &, ReadBuffer &);
|
template bool tryReadFloatTextPrecise<Float32>(Float32 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextPrecise<Float64>(Float64 &, ReadBuffer &);
|
template bool tryReadFloatTextPrecise<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
|
||||||
|
template void readFloatTextFast<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template void readFloatTextFast<Float32>(Float32 &, ReadBuffer &);
|
template void readFloatTextFast<Float32>(Float32 &, ReadBuffer &);
|
||||||
template void readFloatTextFast<Float64>(Float64 &, ReadBuffer &);
|
template void readFloatTextFast<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
template bool tryReadFloatTextFast<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextFast<Float32>(Float32 &, ReadBuffer &);
|
template bool tryReadFloatTextFast<Float32>(Float32 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextFast<Float64>(Float64 &, ReadBuffer &);
|
template bool tryReadFloatTextFast<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
|
||||||
|
template void readFloatTextSimple<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template void readFloatTextSimple<Float32>(Float32 &, ReadBuffer &);
|
template void readFloatTextSimple<Float32>(Float32 &, ReadBuffer &);
|
||||||
template void readFloatTextSimple<Float64>(Float64 &, ReadBuffer &);
|
template void readFloatTextSimple<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
template bool tryReadFloatTextSimple<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextSimple<Float32>(Float32 &, ReadBuffer &);
|
template bool tryReadFloatTextSimple<Float32>(Float32 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextSimple<Float64>(Float64 &, ReadBuffer &);
|
template bool tryReadFloatTextSimple<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
|
||||||
|
template void readFloatText<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template void readFloatText<Float32>(Float32 &, ReadBuffer &);
|
template void readFloatText<Float32>(Float32 &, ReadBuffer &);
|
||||||
template void readFloatText<Float64>(Float64 &, ReadBuffer &);
|
template void readFloatText<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
template bool tryReadFloatText<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template bool tryReadFloatText<Float32>(Float32 &, ReadBuffer &);
|
template bool tryReadFloatText<Float32>(Float32 &, ReadBuffer &);
|
||||||
template bool tryReadFloatText<Float64>(Float64 &, ReadBuffer &);
|
template bool tryReadFloatText<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
|
||||||
|
template bool tryReadFloatTextNoExponent<BFloat16>(BFloat16 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextNoExponent<Float32>(Float32 &, ReadBuffer &);
|
template bool tryReadFloatTextNoExponent<Float32>(Float32 &, ReadBuffer &);
|
||||||
template bool tryReadFloatTextNoExponent<Float64>(Float64 &, ReadBuffer &);
|
template bool tryReadFloatTextNoExponent<Float64>(Float64 &, ReadBuffer &);
|
||||||
|
|
||||||
|
@ -222,7 +222,6 @@ ReturnType readFloatTextPreciseImpl(T & x, ReadBuffer & buf)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char tmp_buf[MAX_LENGTH];
|
char tmp_buf[MAX_LENGTH];
|
||||||
int num_copied_chars = 0;
|
int num_copied_chars = 0;
|
||||||
|
|
||||||
@ -597,22 +596,85 @@ ReturnType readFloatTextSimpleImpl(T & x, ReadBuffer & buf)
|
|||||||
return ReturnType(true);
|
return ReturnType(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> void readFloatTextPrecise(T & x, ReadBuffer & in) { readFloatTextPreciseImpl<T, void>(x, in); }
|
template <typename T> void readFloatTextPrecise(T & x, ReadBuffer & in)
|
||||||
template <typename T> bool tryReadFloatTextPrecise(T & x, ReadBuffer & in) { return readFloatTextPreciseImpl<T, bool>(x, in); }
|
{
|
||||||
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
readFloatTextPreciseImpl<Float32, void>(tmp, in);
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
readFloatTextPreciseImpl<T, void>(x, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> bool tryReadFloatTextPrecise(T & x, ReadBuffer & in)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextPreciseImpl<Float32, bool>(tmp, in);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextPreciseImpl<T, bool>(x, in);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> void readFloatTextFast(T & x, ReadBuffer & in)
|
template <typename T> void readFloatTextFast(T & x, ReadBuffer & in)
|
||||||
{
|
{
|
||||||
bool has_fractional;
|
bool has_fractional;
|
||||||
readFloatTextFastImpl<T, void>(x, in, has_fractional);
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
readFloatTextFastImpl<Float32, void>(tmp, in, has_fractional);
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
readFloatTextFastImpl<T, void>(x, in, has_fractional);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> bool tryReadFloatTextFast(T & x, ReadBuffer & in)
|
template <typename T> bool tryReadFloatTextFast(T & x, ReadBuffer & in)
|
||||||
{
|
{
|
||||||
bool has_fractional;
|
bool has_fractional;
|
||||||
return readFloatTextFastImpl<T, bool>(x, in, has_fractional);
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextFastImpl<Float32, bool>(tmp, in, has_fractional);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextFastImpl<T, bool>(x, in, has_fractional);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> void readFloatTextSimple(T & x, ReadBuffer & in) { readFloatTextSimpleImpl<T, void>(x, in); }
|
template <typename T> void readFloatTextSimple(T & x, ReadBuffer & in)
|
||||||
template <typename T> bool tryReadFloatTextSimple(T & x, ReadBuffer & in) { return readFloatTextSimpleImpl<T, bool>(x, in); }
|
{
|
||||||
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
readFloatTextSimpleImpl<Float32, void>(tmp, in);
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
readFloatTextSimpleImpl<T, void>(x, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> bool tryReadFloatTextSimple(T & x, ReadBuffer & in)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextSimpleImpl<Float32, bool>(tmp, in);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextSimpleImpl<T, bool>(x, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Implementation that is selected as default.
|
/// Implementation that is selected as default.
|
||||||
@ -624,18 +686,47 @@ template <typename T> bool tryReadFloatText(T & x, ReadBuffer & in) { return try
|
|||||||
template <typename T> bool tryReadFloatTextNoExponent(T & x, ReadBuffer & in)
|
template <typename T> bool tryReadFloatTextNoExponent(T & x, ReadBuffer & in)
|
||||||
{
|
{
|
||||||
bool has_fractional;
|
bool has_fractional;
|
||||||
return readFloatTextFastImpl<T, bool, false>(x, in, has_fractional);
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextFastImpl<Float32, bool, false>(tmp, in, has_fractional);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextFastImpl<T, bool, false>(x, in, has_fractional);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// With a @has_fractional flag
|
/// With a @has_fractional flag
|
||||||
/// Used for input_format_try_infer_integers
|
/// Used for input_format_try_infer_integers
|
||||||
template <typename T> bool tryReadFloatTextExt(T & x, ReadBuffer & in, bool & has_fractional)
|
template <typename T> bool tryReadFloatTextExt(T & x, ReadBuffer & in, bool & has_fractional)
|
||||||
{
|
{
|
||||||
return readFloatTextFastImpl<T, bool>(x, in, has_fractional);
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextFastImpl<Float32, bool>(tmp, in, has_fractional);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextFastImpl<T, bool>(x, in, has_fractional);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> bool tryReadFloatTextExtNoExponent(T & x, ReadBuffer & in, bool & has_fractional)
|
template <typename T> bool tryReadFloatTextExtNoExponent(T & x, ReadBuffer & in, bool & has_fractional)
|
||||||
{
|
{
|
||||||
return readFloatTextFastImpl<T, bool, false>(x, in, has_fractional);
|
if constexpr (std::is_same_v<T, BFloat16>)
|
||||||
|
{
|
||||||
|
Float32 tmp;
|
||||||
|
bool res = readFloatTextFastImpl<Float32, bool, false>(tmp, in, has_fractional);
|
||||||
|
if (res)
|
||||||
|
x = BFloat16(tmp);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return readFloatTextFastImpl<T, bool, false>(x, in, has_fractional);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -580,6 +580,7 @@ template class ParquetPlainValuesReader<ColumnInt32>;
|
|||||||
template class ParquetPlainValuesReader<ColumnUInt32>;
|
template class ParquetPlainValuesReader<ColumnUInt32>;
|
||||||
template class ParquetPlainValuesReader<ColumnInt64>;
|
template class ParquetPlainValuesReader<ColumnInt64>;
|
||||||
template class ParquetPlainValuesReader<ColumnUInt64>;
|
template class ParquetPlainValuesReader<ColumnUInt64>;
|
||||||
|
template class ParquetPlainValuesReader<ColumnBFloat16>;
|
||||||
template class ParquetPlainValuesReader<ColumnFloat32>;
|
template class ParquetPlainValuesReader<ColumnFloat32>;
|
||||||
template class ParquetPlainValuesReader<ColumnFloat64>;
|
template class ParquetPlainValuesReader<ColumnFloat64>;
|
||||||
template class ParquetPlainValuesReader<ColumnDecimal<Decimal32>>;
|
template class ParquetPlainValuesReader<ColumnDecimal<Decimal32>>;
|
||||||
@ -602,6 +603,7 @@ template class ParquetRleDictReader<ColumnInt32>;
|
|||||||
template class ParquetRleDictReader<ColumnUInt32>;
|
template class ParquetRleDictReader<ColumnUInt32>;
|
||||||
template class ParquetRleDictReader<ColumnInt64>;
|
template class ParquetRleDictReader<ColumnInt64>;
|
||||||
template class ParquetRleDictReader<ColumnUInt64>;
|
template class ParquetRleDictReader<ColumnUInt64>;
|
||||||
|
template class ParquetRleDictReader<ColumnBFloat16>;
|
||||||
template class ParquetRleDictReader<ColumnFloat32>;
|
template class ParquetRleDictReader<ColumnFloat32>;
|
||||||
template class ParquetRleDictReader<ColumnFloat64>;
|
template class ParquetRleDictReader<ColumnFloat64>;
|
||||||
template class ParquetRleDictReader<ColumnDecimal<Decimal32>>;
|
template class ParquetRleDictReader<ColumnDecimal<Decimal32>>;
|
||||||
|
@ -644,6 +644,7 @@ template class ParquetLeafColReader<ColumnInt32>;
|
|||||||
template class ParquetLeafColReader<ColumnUInt32>;
|
template class ParquetLeafColReader<ColumnUInt32>;
|
||||||
template class ParquetLeafColReader<ColumnInt64>;
|
template class ParquetLeafColReader<ColumnInt64>;
|
||||||
template class ParquetLeafColReader<ColumnUInt64>;
|
template class ParquetLeafColReader<ColumnUInt64>;
|
||||||
|
template class ParquetLeafColReader<ColumnBFloat16>;
|
||||||
template class ParquetLeafColReader<ColumnFloat32>;
|
template class ParquetLeafColReader<ColumnFloat32>;
|
||||||
template class ParquetLeafColReader<ColumnFloat64>;
|
template class ParquetLeafColReader<ColumnFloat64>;
|
||||||
template class ParquetLeafColReader<ColumnString>;
|
template class ParquetLeafColReader<ColumnString>;
|
||||||
|
Loading…
Reference in New Issue
Block a user