2018-11-28 11:37:12 +00:00
|
|
|
#include "ComplexKeyCacheDictionary.h"
|
2017-10-20 14:03:59 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
void ComplexKeyCacheDictionary::setDefaultAttributeValue(Attribute & attribute, const size_t idx) const
|
|
|
|
{
|
|
|
|
switch (attribute.type)
|
|
|
|
{
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utUInt8:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<UInt8>>(attribute.arrays)[idx] = std::get<UInt8>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utUInt16:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utUInt32:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utUInt64:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utUInt128:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = std::get<UInt128>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utInt8:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utInt16:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utInt32:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utInt64:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Int64>>(attribute.arrays)[idx] = std::get<Int64>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utFloat32:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Float32>>(attribute.arrays)[idx] = std::get<Float32>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utFloat64:
|
2018-12-10 15:25:45 +00:00
|
|
|
std::get<ContainerPtrType<Float64>>(attribute.arrays)[idx] = std::get<Float64>(attribute.null_values);
|
|
|
|
break;
|
2018-10-08 19:45:17 +00:00
|
|
|
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utDecimal32:
|
2018-10-08 19:45:17 +00:00
|
|
|
std::get<ContainerPtrType<Decimal32>>(attribute.arrays)[idx] = std::get<Decimal32>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utDecimal64:
|
2018-10-08 19:45:17 +00:00
|
|
|
std::get<ContainerPtrType<Decimal64>>(attribute.arrays)[idx] = std::get<Decimal64>(attribute.null_values);
|
|
|
|
break;
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utDecimal128:
|
2018-10-08 19:45:17 +00:00
|
|
|
std::get<ContainerPtrType<Decimal128>>(attribute.arrays)[idx] = std::get<Decimal128>(attribute.null_values);
|
|
|
|
break;
|
|
|
|
|
2019-08-03 11:02:40 +00:00
|
|
|
case AttributeUnderlyingType::utString:
|
2017-10-20 14:03:59 +00:00
|
|
|
{
|
|
|
|
const auto & null_value_ref = std::get<String>(attribute.null_values);
|
|
|
|
auto & string_ref = std::get<ContainerPtrType<StringRef>>(attribute.arrays)[idx];
|
|
|
|
|
|
|
|
if (string_ref.data != null_value_ref.data())
|
|
|
|
{
|
|
|
|
if (string_ref.data)
|
|
|
|
string_arena->free(const_cast<char *>(string_ref.data), string_ref.size);
|
|
|
|
|
|
|
|
string_ref = StringRef{null_value_ref};
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|