1#include "ComplexKeyCacheDictionary.h"
2
3namespace DB
4{
5void ComplexKeyCacheDictionary::setDefaultAttributeValue(Attribute & attribute, const size_t idx) const
6{
7 switch (attribute.type)
8 {
9 case AttributeUnderlyingType::utUInt8:
10 std::get<ContainerPtrType<UInt8>>(attribute.arrays)[idx] = std::get<UInt8>(attribute.null_values);
11 break;
12 case AttributeUnderlyingType::utUInt16:
13 std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values);
14 break;
15 case AttributeUnderlyingType::utUInt32:
16 std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values);
17 break;
18 case AttributeUnderlyingType::utUInt64:
19 std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values);
20 break;
21 case AttributeUnderlyingType::utUInt128:
22 std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = std::get<UInt128>(attribute.null_values);
23 break;
24 case AttributeUnderlyingType::utInt8:
25 std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values);
26 break;
27 case AttributeUnderlyingType::utInt16:
28 std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values);
29 break;
30 case AttributeUnderlyingType::utInt32:
31 std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values);
32 break;
33 case AttributeUnderlyingType::utInt64:
34 std::get<ContainerPtrType<Int64>>(attribute.arrays)[idx] = std::get<Int64>(attribute.null_values);
35 break;
36 case AttributeUnderlyingType::utFloat32:
37 std::get<ContainerPtrType<Float32>>(attribute.arrays)[idx] = std::get<Float32>(attribute.null_values);
38 break;
39 case AttributeUnderlyingType::utFloat64:
40 std::get<ContainerPtrType<Float64>>(attribute.arrays)[idx] = std::get<Float64>(attribute.null_values);
41 break;
42
43 case AttributeUnderlyingType::utDecimal32:
44 std::get<ContainerPtrType<Decimal32>>(attribute.arrays)[idx] = std::get<Decimal32>(attribute.null_values);
45 break;
46 case AttributeUnderlyingType::utDecimal64:
47 std::get<ContainerPtrType<Decimal64>>(attribute.arrays)[idx] = std::get<Decimal64>(attribute.null_values);
48 break;
49 case AttributeUnderlyingType::utDecimal128:
50 std::get<ContainerPtrType<Decimal128>>(attribute.arrays)[idx] = std::get<Decimal128>(attribute.null_values);
51 break;
52
53 case AttributeUnderlyingType::utString:
54 {
55 const auto & null_value_ref = std::get<String>(attribute.null_values);
56 auto & string_ref = std::get<ContainerPtrType<StringRef>>(attribute.arrays)[idx];
57
58 if (string_ref.data != null_value_ref.data())
59 {
60 if (string_ref.data)
61 string_arena->free(const_cast<char *>(string_ref.data), string_ref.size);
62
63 string_ref = StringRef{null_value_ref};
64 }
65
66 break;
67 }
68 }
69}
70
71}
72