提交 48636ac6 编写于 作者: И Иванов Евгений 提交者: alexey-milovidov

Added support UUID type for dictionaries

上级 c07b4807
...@@ -228,6 +228,7 @@ DECLARE(UInt8) ...@@ -228,6 +228,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -266,6 +267,7 @@ DECLARE(UInt8) ...@@ -266,6 +267,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -303,6 +305,7 @@ DECLARE(UInt8) ...@@ -303,6 +305,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -480,6 +483,11 @@ CacheDictionary::Attribute CacheDictionary::createAttributeWithType(const Attrib ...@@ -480,6 +483,11 @@ CacheDictionary::Attribute CacheDictionary::createAttributeWithType(const Attrib
std::get<ContainerPtrType<UInt64>>(attr.arrays) = std::make_unique<ContainerType<UInt64>>(size); std::get<ContainerPtrType<UInt64>>(attr.arrays) = std::make_unique<ContainerType<UInt64>>(size);
bytes_allocated += size * sizeof(UInt64); bytes_allocated += size * sizeof(UInt64);
break; break;
case AttributeUnderlyingType::UInt128:
std::get<UInt128>(attr.null_values) = null_value.get<UInt128>();
std::get<ContainerPtrType<UInt128>>(attr.arrays) = std::make_unique<ContainerType<UInt128>>(size);
bytes_allocated += size * sizeof(UInt128);
break;
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
std::get<Int8>(attr.null_values) = null_value.get<Int64>(); std::get<Int8>(attr.null_values) = null_value.get<Int64>();
std::get<ContainerPtrType<Int8>>(attr.arrays) = std::make_unique<ContainerType<Int8>>(size); std::get<ContainerPtrType<Int8>>(attr.arrays) = std::make_unique<ContainerType<Int8>>(size);
...@@ -538,6 +546,7 @@ void CacheDictionary::getItemsNumber( ...@@ -538,6 +546,7 @@ void CacheDictionary::getItemsNumber(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -591,7 +600,7 @@ void CacheDictionary::getItemsNumberImpl( ...@@ -591,7 +600,7 @@ void CacheDictionary::getItemsNumberImpl(
++cache_hit; ++cache_hit;
const auto & cell_idx = find_result.cell_idx; const auto & cell_idx = find_result.cell_idx;
const auto & cell = cells[cell_idx]; const auto & cell = cells[cell_idx];
out[row] = cell.isDefault() ? get_default(row) : attribute_array[cell_idx]; out[row] = cell.isDefault() ? get_default(row) : static_cast<OutputType>(attribute_array[cell_idx]);
} }
} }
} }
...@@ -617,7 +626,7 @@ void CacheDictionary::getItemsNumberImpl( ...@@ -617,7 +626,7 @@ void CacheDictionary::getItemsNumberImpl(
const auto attribute_value = attribute_array[cell_idx]; const auto attribute_value = attribute_array[cell_idx];
for (const auto row : outdated_ids[id]) for (const auto row : outdated_ids[id])
out[row] = attribute_value; out[row] = static_cast<OutputType>(attribute_value);
}, },
[&] (const auto id, const auto cell_idx) [&] (const auto id, const auto cell_idx)
{ {
...@@ -896,6 +905,7 @@ void CacheDictionary::setDefaultAttributeValue(Attribute & attribute, const Key ...@@ -896,6 +905,7 @@ void CacheDictionary::setDefaultAttributeValue(Attribute & attribute, const Key
case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values); break; case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values); break;
case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values); break; case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values); break;
case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values); break; case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values); break;
case AttributeUnderlyingType::UInt128: std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = std::get<UInt128>(attribute.null_values); break;
case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values); break; case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values); break;
case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values); break; case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values); break;
case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values); break; case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values); break;
...@@ -928,6 +938,7 @@ void CacheDictionary::setAttributeValue(Attribute & attribute, const Key idx, co ...@@ -928,6 +938,7 @@ void CacheDictionary::setAttributeValue(Attribute & attribute, const Key idx, co
case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt128: std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = value.get<UInt128>(); break;
case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = value.get<Int64>(); break;
case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = value.get<Int64>(); break;
case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = value.get<Int64>(); break;
......
...@@ -86,6 +86,7 @@ public: ...@@ -86,6 +86,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -104,6 +105,7 @@ public: ...@@ -104,6 +105,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -123,6 +125,7 @@ public: ...@@ -123,6 +125,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -169,11 +172,13 @@ private: ...@@ -169,11 +172,13 @@ private:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple< std::tuple<
UInt8, UInt16, UInt32, UInt64, UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
String> null_values; String> null_values;
std::tuple< std::tuple<
ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>, ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>,
ContainerPtrType<UInt128>,
ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>, ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>,
ContainerPtrType<Float32>, ContainerPtrType<Float64>, ContainerPtrType<Float32>, ContainerPtrType<Float64>,
ContainerPtrType<StringRef>> arrays; ContainerPtrType<StringRef>> arrays;
......
...@@ -137,6 +137,7 @@ public: ...@@ -137,6 +137,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -157,6 +158,7 @@ public: ...@@ -157,6 +158,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -181,6 +183,7 @@ public: ...@@ -181,6 +183,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -244,11 +247,12 @@ private: ...@@ -244,11 +247,12 @@ private:
struct Attribute final struct Attribute final
{ {
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple<UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, Float64, String> null_values; std::tuple<UInt8, UInt16, UInt32, UInt64, UInt128, Int8, Int16, Int32, Int64, Float32, Float64, String> null_values;
std::tuple<ContainerPtrType<UInt8>, std::tuple<ContainerPtrType<UInt8>,
ContainerPtrType<UInt16>, ContainerPtrType<UInt16>,
ContainerPtrType<UInt32>, ContainerPtrType<UInt32>,
ContainerPtrType<UInt64>, ContainerPtrType<UInt64>,
ContainerPtrType<UInt128>,
ContainerPtrType<Int8>, ContainerPtrType<Int8>,
ContainerPtrType<Int16>, ContainerPtrType<Int16>,
ContainerPtrType<Int32>, ContainerPtrType<Int32>,
...@@ -277,6 +281,7 @@ private: ...@@ -277,6 +281,7 @@ private:
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -331,7 +336,7 @@ private: ...@@ -331,7 +336,7 @@ private:
++cache_hit; ++cache_hit;
const auto & cell_idx = find_result.cell_idx; const auto & cell_idx = find_result.cell_idx;
const auto & cell = cells[cell_idx]; const auto & cell = cells[cell_idx];
out[row] = cell.isDefault() ? get_default(row) : attribute_array[cell_idx]; out[row] = cell.isDefault() ? get_default(row) : static_cast<OutputType>(attribute_array[cell_idx]);
} }
} }
} }
...@@ -355,7 +360,7 @@ private: ...@@ -355,7 +360,7 @@ private:
[&](const StringRef key, const size_t cell_idx) [&](const StringRef key, const size_t cell_idx)
{ {
for (const auto row : outdated_keys[key]) for (const auto row : outdated_keys[key])
out[row] = attribute_array[cell_idx]; out[row] = static_cast<OutputType>(attribute_array[cell_idx]);
}, },
[&](const StringRef key, const size_t cell_idx) [&](const StringRef key, const size_t cell_idx)
{ {
......
...@@ -29,6 +29,11 @@ ComplexKeyCacheDictionary::Attribute ComplexKeyCacheDictionary::createAttributeW ...@@ -29,6 +29,11 @@ ComplexKeyCacheDictionary::Attribute ComplexKeyCacheDictionary::createAttributeW
std::get<ContainerPtrType<UInt64>>(attr.arrays) = std::make_unique<ContainerType<UInt64>>(size); std::get<ContainerPtrType<UInt64>>(attr.arrays) = std::make_unique<ContainerType<UInt64>>(size);
bytes_allocated += size * sizeof(UInt64); bytes_allocated += size * sizeof(UInt64);
break; break;
case AttributeUnderlyingType::UInt128:
std::get<UInt128>(attr.null_values) = null_value.get<UInt128>();
std::get<ContainerPtrType<UInt128>>(attr.arrays) = std::make_unique<ContainerType<UInt128>>(size);
bytes_allocated += size * sizeof(UInt128);
break;
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
std::get<Int8>(attr.null_values) = null_value.get<Int64>(); std::get<Int8>(attr.null_values) = null_value.get<Int64>();
std::get<ContainerPtrType<Int8>>(attr.arrays) = std::make_unique<ContainerType<Int8>>(size); std::get<ContainerPtrType<Int8>>(attr.arrays) = std::make_unique<ContainerType<Int8>>(size);
......
...@@ -26,6 +26,7 @@ DECLARE(UInt8) ...@@ -26,6 +26,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
......
...@@ -27,6 +27,7 @@ DECLARE(UInt8) ...@@ -27,6 +27,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
......
...@@ -27,6 +27,7 @@ DECLARE(UInt8) ...@@ -27,6 +27,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
......
...@@ -11,6 +11,7 @@ void ComplexKeyCacheDictionary::setAttributeValue(Attribute & attribute, const s ...@@ -11,6 +11,7 @@ void ComplexKeyCacheDictionary::setAttributeValue(Attribute & attribute, const s
case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = value.get<UInt64>(); break; case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = value.get<UInt64>(); break;
case AttributeUnderlyingType::UInt128: std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = value.get<UInt128>(); break;
case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = value.get<Int64>(); break;
case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = value.get<Int64>(); break;
case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = value.get<Int64>(); break; case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = value.get<Int64>(); break;
......
...@@ -11,6 +11,7 @@ void ComplexKeyCacheDictionary::setDefaultAttributeValue(Attribute & attribute, ...@@ -11,6 +11,7 @@ void ComplexKeyCacheDictionary::setDefaultAttributeValue(Attribute & attribute,
case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values); break; case AttributeUnderlyingType::UInt16: std::get<ContainerPtrType<UInt16>>(attribute.arrays)[idx] = std::get<UInt16>(attribute.null_values); break;
case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values); break; case AttributeUnderlyingType::UInt32: std::get<ContainerPtrType<UInt32>>(attribute.arrays)[idx] = std::get<UInt32>(attribute.null_values); break;
case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values); break; case AttributeUnderlyingType::UInt64: std::get<ContainerPtrType<UInt64>>(attribute.arrays)[idx] = std::get<UInt64>(attribute.null_values); break;
case AttributeUnderlyingType::UInt128: std::get<ContainerPtrType<UInt128>>(attribute.arrays)[idx] = std::get<UInt128>(attribute.null_values); break;
case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values); break; case AttributeUnderlyingType::Int8: std::get<ContainerPtrType<Int8>>(attribute.arrays)[idx] = std::get<Int8>(attribute.null_values); break;
case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values); break; case AttributeUnderlyingType::Int16: std::get<ContainerPtrType<Int16>>(attribute.arrays)[idx] = std::get<Int16>(attribute.null_values); break;
case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values); break; case AttributeUnderlyingType::Int32: std::get<ContainerPtrType<Int32>>(attribute.arrays)[idx] = std::get<Int32>(attribute.null_values); break;
......
...@@ -65,6 +65,7 @@ DECLARE(UInt8) ...@@ -65,6 +65,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -113,6 +114,7 @@ DECLARE(UInt8) ...@@ -113,6 +114,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -159,6 +161,7 @@ DECLARE(UInt8) ...@@ -159,6 +161,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -196,6 +199,7 @@ void ComplexKeyHashedDictionary::has(const Columns & key_columns, const DataType ...@@ -196,6 +199,7 @@ void ComplexKeyHashedDictionary::has(const Columns & key_columns, const DataType
case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt128: has<UInt128>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int8: has<Int8>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int8: has<Int8>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int16: has<Int16>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int16: has<Int16>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int32: has<Int32>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int32: has<Int32>(attribute, key_columns, out); break;
...@@ -300,6 +304,7 @@ void ComplexKeyHashedDictionary::calculateBytesAllocated() ...@@ -300,6 +304,7 @@ void ComplexKeyHashedDictionary::calculateBytesAllocated()
case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: addAttributeSize<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break; case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break; case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break; case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break;
...@@ -336,6 +341,7 @@ ComplexKeyHashedDictionary::Attribute ComplexKeyHashedDictionary::createAttribut ...@@ -336,6 +341,7 @@ ComplexKeyHashedDictionary::Attribute ComplexKeyHashedDictionary::createAttribut
case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break; case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break;
case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break; case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break;
case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break; case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break;
case AttributeUnderlyingType::UInt128: createAttributeImpl<UInt128>(attr, null_value); break;
case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break; case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break;
case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break; case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break;
case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break; case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break;
...@@ -370,6 +376,7 @@ void ComplexKeyHashedDictionary::getItemsNumber( ...@@ -370,6 +376,7 @@ void ComplexKeyHashedDictionary::getItemsNumber(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -401,7 +408,7 @@ void ComplexKeyHashedDictionary::getItemsImpl( ...@@ -401,7 +408,7 @@ void ComplexKeyHashedDictionary::getItemsImpl(
const auto key = placeKeysInPool(i, key_columns, keys, temporary_keys_pool); const auto key = placeKeysInPool(i, key_columns, keys, temporary_keys_pool);
const auto it = attr.find(key); const auto it = attr.find(key);
set_value(i, it != attr.end() ? it->second : get_default(i)); set_value(i, it != attr.end() ? static_cast<OutputType>(it->second) : get_default(i));
/// free memory allocated for the key /// free memory allocated for the key
temporary_keys_pool.rollback(key.size); temporary_keys_pool.rollback(key.size);
...@@ -427,6 +434,7 @@ bool ComplexKeyHashedDictionary::setAttributeValue(Attribute & attribute, const ...@@ -427,6 +434,7 @@ bool ComplexKeyHashedDictionary::setAttributeValue(Attribute & attribute, const
case AttributeUnderlyingType::UInt16: return setAttributeValueImpl<UInt16>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt16: return setAttributeValueImpl<UInt16>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt32: return setAttributeValueImpl<UInt32>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt32: return setAttributeValueImpl<UInt32>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt64: return setAttributeValueImpl<UInt64>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt64: return setAttributeValueImpl<UInt64>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt128: return setAttributeValueImpl<UInt128>(attribute, key, value.get<UInt128>());
case AttributeUnderlyingType::Int8: return setAttributeValueImpl<Int8>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int8: return setAttributeValueImpl<Int8>(attribute, key, value.get<Int64>());
case AttributeUnderlyingType::Int16: return setAttributeValueImpl<Int16>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int16: return setAttributeValueImpl<Int16>(attribute, key, value.get<Int64>());
case AttributeUnderlyingType::Int32: return setAttributeValueImpl<Int32>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int32: return setAttributeValueImpl<Int32>(attribute, key, value.get<Int64>());
...@@ -514,6 +522,7 @@ std::vector<StringRef> ComplexKeyHashedDictionary::getKeys() const ...@@ -514,6 +522,7 @@ std::vector<StringRef> ComplexKeyHashedDictionary::getKeys() const
case AttributeUnderlyingType::UInt16: return getKeys<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: return getKeys<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: return getKeys<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: return getKeys<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: return getKeys<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: return getKeys<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: return getKeys<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: return getKeys<Int8>(attribute); break; case AttributeUnderlyingType::Int8: return getKeys<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: return getKeys<Int16>(attribute); break; case AttributeUnderlyingType::Int16: return getKeys<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: return getKeys<Int32>(attribute); break; case AttributeUnderlyingType::Int32: return getKeys<Int32>(attribute); break;
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -92,6 +93,7 @@ public: ...@@ -92,6 +93,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -112,6 +114,7 @@ public: ...@@ -112,6 +114,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -137,11 +140,13 @@ private: ...@@ -137,11 +140,13 @@ private:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple< std::tuple<
UInt8, UInt16, UInt32, UInt64, UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
String> null_values; String> null_values;
std::tuple< std::tuple<
ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>, ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>,
ContainerPtrType<UInt128>,
ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>, ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>,
ContainerPtrType<Float32>, ContainerPtrType<Float64>, ContainerPtrType<Float32>, ContainerPtrType<Float64>,
ContainerPtrType<StringRef>> maps; ContainerPtrType<StringRef>> maps;
......
...@@ -285,6 +285,9 @@ Block DictionaryBlockInputStream<DictionaryType, Key>::fillBlock( ...@@ -285,6 +285,9 @@ Block DictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
case AttributeUnderlyingType::UInt64: case AttributeUnderlyingType::UInt64:
GET_COLUMN_FORM_ATTRIBUTE(UInt64); GET_COLUMN_FORM_ATTRIBUTE(UInt64);
break; break;
case AttributeUnderlyingType::UInt128:
GET_COLUMN_FORM_ATTRIBUTE(UInt128);
break;
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
GET_COLUMN_FORM_ATTRIBUTE(Int8); GET_COLUMN_FORM_ATTRIBUTE(Int8);
break; break;
...@@ -380,6 +383,9 @@ void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns( ...@@ -380,6 +383,9 @@ void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns(
case AttributeUnderlyingType::UInt64: case AttributeUnderlyingType::UInt64:
ADD_COLUMN(UInt64); ADD_COLUMN(UInt64);
break; break;
case AttributeUnderlyingType::UInt128:
ADD_COLUMN(UInt128);
break;
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
ADD_COLUMN(Int8); ADD_COLUMN(Int8);
break; break;
......
...@@ -61,6 +61,7 @@ AttributeUnderlyingType getAttributeUnderlyingType(const std::string & type) ...@@ -61,6 +61,7 @@ AttributeUnderlyingType getAttributeUnderlyingType(const std::string & type)
{ "UInt16", AttributeUnderlyingType::UInt16 }, { "UInt16", AttributeUnderlyingType::UInt16 },
{ "UInt32", AttributeUnderlyingType::UInt32 }, { "UInt32", AttributeUnderlyingType::UInt32 },
{ "UInt64", AttributeUnderlyingType::UInt64 }, { "UInt64", AttributeUnderlyingType::UInt64 },
{ "UUID", AttributeUnderlyingType::UInt128 },
{ "Int8", AttributeUnderlyingType::Int8 }, { "Int8", AttributeUnderlyingType::Int8 },
{ "Int16", AttributeUnderlyingType::Int16 }, { "Int16", AttributeUnderlyingType::Int16 },
{ "Int32", AttributeUnderlyingType::Int32 }, { "Int32", AttributeUnderlyingType::Int32 },
...@@ -90,6 +91,7 @@ std::string toString(const AttributeUnderlyingType type) ...@@ -90,6 +91,7 @@ std::string toString(const AttributeUnderlyingType type)
case AttributeUnderlyingType::UInt16: return "UInt16"; case AttributeUnderlyingType::UInt16: return "UInt16";
case AttributeUnderlyingType::UInt32: return "UInt32"; case AttributeUnderlyingType::UInt32: return "UInt32";
case AttributeUnderlyingType::UInt64: return "UInt64"; case AttributeUnderlyingType::UInt64: return "UInt64";
case AttributeUnderlyingType::UInt128: return "UUID";
case AttributeUnderlyingType::Int8: return "Int8"; case AttributeUnderlyingType::Int8: return "Int8";
case AttributeUnderlyingType::Int16: return "Int16"; case AttributeUnderlyingType::Int16: return "Int16";
case AttributeUnderlyingType::Int32: return "Int32"; case AttributeUnderlyingType::Int32: return "Int32";
......
...@@ -23,6 +23,7 @@ enum class AttributeUnderlyingType ...@@ -23,6 +23,7 @@ enum class AttributeUnderlyingType
UInt16, UInt16,
UInt32, UInt32,
UInt64, UInt64,
UInt128,
Int8, Int8,
Int16, Int16,
Int32, Int32,
......
...@@ -131,6 +131,7 @@ DECLARE(UInt8) ...@@ -131,6 +131,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -173,6 +174,7 @@ DECLARE(UInt8) ...@@ -173,6 +174,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -215,6 +217,7 @@ DECLARE(UInt8) ...@@ -215,6 +217,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -249,6 +252,7 @@ void FlatDictionary::has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8> ...@@ -249,6 +252,7 @@ void FlatDictionary::has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8>
case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, ids, out); break; case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, ids, out); break; case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, ids, out); break; case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt128: has<UInt128>(attribute, ids, out); break;
case AttributeUnderlyingType::Int8: has<Int8>(attribute, ids, out); break; case AttributeUnderlyingType::Int8: has<Int8>(attribute, ids, out); break;
case AttributeUnderlyingType::Int16: has<Int16>(attribute, ids, out); break; case AttributeUnderlyingType::Int16: has<Int16>(attribute, ids, out); break;
case AttributeUnderlyingType::Int32: has<Int32>(attribute, ids, out); break; case AttributeUnderlyingType::Int32: has<Int32>(attribute, ids, out); break;
...@@ -334,6 +338,7 @@ void FlatDictionary::calculateBytesAllocated() ...@@ -334,6 +338,7 @@ void FlatDictionary::calculateBytesAllocated()
case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: addAttributeSize<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break; case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break; case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break; case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break;
...@@ -384,6 +389,7 @@ FlatDictionary::Attribute FlatDictionary::createAttributeWithType(const Attribut ...@@ -384,6 +389,7 @@ FlatDictionary::Attribute FlatDictionary::createAttributeWithType(const Attribut
case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break; case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break;
case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break; case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break;
case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break; case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break;
case AttributeUnderlyingType::UInt128: createAttributeImpl<UInt128>(attr, null_value); break;
case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break; case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break;
case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break; case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break;
case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break; case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break;
...@@ -412,6 +418,7 @@ void FlatDictionary::getItemsNumber( ...@@ -412,6 +418,7 @@ void FlatDictionary::getItemsNumber(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -437,7 +444,7 @@ void FlatDictionary::getItemsImpl( ...@@ -437,7 +444,7 @@ void FlatDictionary::getItemsImpl(
for (const auto row : ext::range(0, rows)) for (const auto row : ext::range(0, rows))
{ {
const auto id = ids[row]; const auto id = ids[row];
set_value(row, id < ext::size(attr) && loaded_ids[id] ? attr[id] : get_default(row)); set_value(row, id < ext::size(attr) && loaded_ids[id] ? static_cast<OutputType>(attr[id]) : get_default(row));
} }
query_count.fetch_add(rows, std::memory_order_relaxed); query_count.fetch_add(rows, std::memory_order_relaxed);
...@@ -487,6 +494,7 @@ void FlatDictionary::setAttributeValue(Attribute & attribute, const Key id, cons ...@@ -487,6 +494,7 @@ void FlatDictionary::setAttributeValue(Attribute & attribute, const Key id, cons
case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt128: setAttributeValueImpl<UInt128>(attribute, id, value.get<UInt128>()); break;
case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, value.get<Int64>()); break;
case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, value.get<Int64>()); break;
case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, value.get<Int64>()); break;
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -91,6 +92,7 @@ public: ...@@ -91,6 +92,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -111,6 +113,7 @@ public: ...@@ -111,6 +113,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -136,11 +139,13 @@ private: ...@@ -136,11 +139,13 @@ private:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple< std::tuple<
UInt8, UInt16, UInt32, UInt64, UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
StringRef> null_values; StringRef> null_values;
std::tuple< std::tuple<
ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>, ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>,
ContainerPtrType<UInt128>,
ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>, ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>,
ContainerPtrType<Float32>, ContainerPtrType<Float64>, ContainerPtrType<Float32>, ContainerPtrType<Float64>,
ContainerPtrType<StringRef>> arrays; ContainerPtrType<StringRef>> arrays;
......
...@@ -128,6 +128,7 @@ DECLARE(UInt8) ...@@ -128,6 +128,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -170,6 +171,7 @@ DECLARE(UInt8) ...@@ -170,6 +171,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -211,6 +213,7 @@ DECLARE(UInt8) ...@@ -211,6 +213,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -244,6 +247,7 @@ void HashedDictionary::has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8 ...@@ -244,6 +247,7 @@ void HashedDictionary::has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8
case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, ids, out); break; case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, ids, out); break; case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, ids, out); break; case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, ids, out); break;
case AttributeUnderlyingType::UInt128: has<UInt128>(attribute, ids, out); break;
case AttributeUnderlyingType::Int8: has<Int8>(attribute, ids, out); break; case AttributeUnderlyingType::Int8: has<Int8>(attribute, ids, out); break;
case AttributeUnderlyingType::Int16: has<Int16>(attribute, ids, out); break; case AttributeUnderlyingType::Int16: has<Int16>(attribute, ids, out); break;
case AttributeUnderlyingType::Int32: has<Int32>(attribute, ids, out); break; case AttributeUnderlyingType::Int32: has<Int32>(attribute, ids, out); break;
...@@ -325,6 +329,7 @@ void HashedDictionary::calculateBytesAllocated() ...@@ -325,6 +329,7 @@ void HashedDictionary::calculateBytesAllocated()
case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: addAttributeSize<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break; case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break; case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break; case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break;
...@@ -359,6 +364,7 @@ HashedDictionary::Attribute HashedDictionary::createAttributeWithType(const Attr ...@@ -359,6 +364,7 @@ HashedDictionary::Attribute HashedDictionary::createAttributeWithType(const Attr
case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break; case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break;
case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break; case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break;
case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break; case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break;
case AttributeUnderlyingType::UInt128: createAttributeImpl<UInt128>(attr, null_value); break;
case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break; case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break;
case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break; case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break;
case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break; case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break;
...@@ -393,6 +399,7 @@ void HashedDictionary::getItemsNumber( ...@@ -393,6 +399,7 @@ void HashedDictionary::getItemsNumber(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -417,7 +424,7 @@ void HashedDictionary::getItemsImpl( ...@@ -417,7 +424,7 @@ void HashedDictionary::getItemsImpl(
for (const auto i : ext::range(0, rows)) for (const auto i : ext::range(0, rows))
{ {
const auto it = attr.find(ids[i]); const auto it = attr.find(ids[i]);
set_value(i, it != attr.end() ? it->second : get_default(i)); set_value(i, it != attr.end() ? static_cast<OutputType>(it->second) : get_default(i));
} }
query_count.fetch_add(rows, std::memory_order_relaxed); query_count.fetch_add(rows, std::memory_order_relaxed);
...@@ -439,6 +446,7 @@ void HashedDictionary::setAttributeValue(Attribute & attribute, const Key id, co ...@@ -439,6 +446,7 @@ void HashedDictionary::setAttributeValue(Attribute & attribute, const Key id, co
case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt128: setAttributeValueImpl<UInt128>(attribute, id, value.get<UInt128>()); break;
case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, value.get<Int64>()); break;
case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, value.get<Int64>()); break;
case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, value.get<Int64>()); break; case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, value.get<Int64>()); break;
...@@ -502,6 +510,7 @@ PaddedPODArray<HashedDictionary::Key> HashedDictionary::getIds() const ...@@ -502,6 +510,7 @@ PaddedPODArray<HashedDictionary::Key> HashedDictionary::getIds() const
case AttributeUnderlyingType::UInt16: return getIds<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: return getIds<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: return getIds<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: return getIds<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: return getIds<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: return getIds<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: return getIds<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: return getIds<Int8>(attribute); break; case AttributeUnderlyingType::Int8: return getIds<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: return getIds<Int16>(attribute); break; case AttributeUnderlyingType::Int16: return getIds<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: return getIds<Int32>(attribute); break; case AttributeUnderlyingType::Int32: return getIds<Int32>(attribute); break;
......
...@@ -68,6 +68,7 @@ public: ...@@ -68,6 +68,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -86,6 +87,7 @@ public: ...@@ -86,6 +87,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -105,6 +107,7 @@ public: ...@@ -105,6 +107,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -134,11 +137,13 @@ private: ...@@ -134,11 +137,13 @@ private:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple< std::tuple<
UInt8, UInt16, UInt32, UInt64, UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
String> null_values; String> null_values;
std::tuple< std::tuple<
CollectionPtrType<UInt8>, CollectionPtrType<UInt16>, CollectionPtrType<UInt32>, CollectionPtrType<UInt64>, CollectionPtrType<UInt8>, CollectionPtrType<UInt16>, CollectionPtrType<UInt32>, CollectionPtrType<UInt64>,
CollectionPtrType<UInt128>,
CollectionPtrType<Int8>, CollectionPtrType<Int16>, CollectionPtrType<Int32>, CollectionPtrType<Int64>, CollectionPtrType<Int8>, CollectionPtrType<Int16>, CollectionPtrType<Int32>, CollectionPtrType<Int64>,
CollectionPtrType<Float32>, CollectionPtrType<Float64>, CollectionPtrType<Float32>, CollectionPtrType<Float64>,
CollectionPtrType<StringRef>> maps; CollectionPtrType<StringRef>> maps;
......
...@@ -241,6 +241,7 @@ BlockInputStreamPtr MongoDBDictionarySource::loadKeys( ...@@ -241,6 +241,7 @@ BlockInputStreamPtr MongoDBDictionarySource::loadKeys(
case AttributeUnderlyingType::UInt16: case AttributeUnderlyingType::UInt16:
case AttributeUnderlyingType::UInt32: case AttributeUnderlyingType::UInt32:
case AttributeUnderlyingType::UInt64: case AttributeUnderlyingType::UInt64:
case AttributeUnderlyingType::UInt128:
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
case AttributeUnderlyingType::Int16: case AttributeUnderlyingType::Int16:
case AttributeUnderlyingType::Int32: case AttributeUnderlyingType::Int32:
......
...@@ -182,6 +182,9 @@ Block RangeDictionaryBlockInputStream<DictionaryType, Key>::fillBlock( ...@@ -182,6 +182,9 @@ Block RangeDictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
case AttributeUnderlyingType::UInt64: case AttributeUnderlyingType::UInt64:
GET_COLUMN_FORM_ATTRIBUTE(UInt64); GET_COLUMN_FORM_ATTRIBUTE(UInt64);
break; break;
case AttributeUnderlyingType::UInt128:
GET_COLUMN_FORM_ATTRIBUTE(UInt128);
break;
case AttributeUnderlyingType::Int8: case AttributeUnderlyingType::Int8:
GET_COLUMN_FORM_ATTRIBUTE(Int8); GET_COLUMN_FORM_ATTRIBUTE(Int8);
break; break;
......
...@@ -53,6 +53,7 @@ DECLARE_MULTIPLE_GETTER(UInt8) ...@@ -53,6 +53,7 @@ DECLARE_MULTIPLE_GETTER(UInt8)
DECLARE_MULTIPLE_GETTER(UInt16) DECLARE_MULTIPLE_GETTER(UInt16)
DECLARE_MULTIPLE_GETTER(UInt32) DECLARE_MULTIPLE_GETTER(UInt32)
DECLARE_MULTIPLE_GETTER(UInt64) DECLARE_MULTIPLE_GETTER(UInt64)
DECLARE_MULTIPLE_GETTER(UInt128)
DECLARE_MULTIPLE_GETTER(Int8) DECLARE_MULTIPLE_GETTER(Int8)
DECLARE_MULTIPLE_GETTER(Int16) DECLARE_MULTIPLE_GETTER(Int16)
DECLARE_MULTIPLE_GETTER(Int32) DECLARE_MULTIPLE_GETTER(Int32)
...@@ -160,6 +161,7 @@ void RangeHashedDictionary::calculateBytesAllocated() ...@@ -160,6 +161,7 @@ void RangeHashedDictionary::calculateBytesAllocated()
case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: addAttributeSize<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break; case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break; case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break; case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break;
...@@ -194,6 +196,7 @@ RangeHashedDictionary::Attribute RangeHashedDictionary::createAttributeWithType( ...@@ -194,6 +196,7 @@ RangeHashedDictionary::Attribute RangeHashedDictionary::createAttributeWithType(
case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break; case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break;
case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break; case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break;
case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break; case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break;
case AttributeUnderlyingType::UInt128: createAttributeImpl<UInt128>(attr, null_value); break;
case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break; case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break;
case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break; case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break;
case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break; case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break;
...@@ -228,6 +231,7 @@ void RangeHashedDictionary::getItems( ...@@ -228,6 +231,7 @@ void RangeHashedDictionary::getItems(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -259,10 +263,10 @@ void RangeHashedDictionary::getItemsImpl( ...@@ -259,10 +263,10 @@ void RangeHashedDictionary::getItemsImpl(
const auto val_it = std::find_if(std::begin(ranges_and_values), std::end(ranges_and_values), const auto val_it = std::find_if(std::begin(ranges_and_values), std::end(ranges_and_values),
[date] (const Value<AttributeType> & v) { return v.range.contains(date); }); [date] (const Value<AttributeType> & v) { return v.range.contains(date); });
out[i] = val_it != std::end(ranges_and_values) ? val_it->value : null_value; out[i] = static_cast<OutputType>(val_it != std::end(ranges_and_values) ? val_it->value : null_value);
} }
else else
out[i] = null_value; out[i] = static_cast<OutputType>(null_value);
} }
query_count.fetch_add(ids.size(), std::memory_order_relaxed); query_count.fetch_add(ids.size(), std::memory_order_relaxed);
...@@ -298,6 +302,7 @@ void RangeHashedDictionary::setAttributeValue(Attribute & attribute, const Key i ...@@ -298,6 +302,7 @@ void RangeHashedDictionary::setAttributeValue(Attribute & attribute, const Key i
case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, range, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt16: setAttributeValueImpl<UInt16>(attribute, id, range, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, range, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt32: setAttributeValueImpl<UInt32>(attribute, id, range, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, range, value.get<UInt64>()); break; case AttributeUnderlyingType::UInt64: setAttributeValueImpl<UInt64>(attribute, id, range, value.get<UInt64>()); break;
case AttributeUnderlyingType::UInt128: setAttributeValueImpl<UInt128>(attribute, id, range, value.get<UInt128>()); break;
case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, range, value.get<Int64>()); break; case AttributeUnderlyingType::Int8: setAttributeValueImpl<Int8>(attribute, id, range, value.get<Int64>()); break;
case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, range, value.get<Int64>()); break; case AttributeUnderlyingType::Int16: setAttributeValueImpl<Int16>(attribute, id, range, value.get<Int64>()); break;
case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, range, value.get<Int64>()); break; case AttributeUnderlyingType::Int32: setAttributeValueImpl<Int32>(attribute, id, range, value.get<Int64>()); break;
...@@ -365,6 +370,7 @@ void RangeHashedDictionary::getIdsAndDates(PaddedPODArray<Key> & ids, ...@@ -365,6 +370,7 @@ void RangeHashedDictionary::getIdsAndDates(PaddedPODArray<Key> & ids,
case AttributeUnderlyingType::UInt16: getIdsAndDates<UInt16>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::UInt16: getIdsAndDates<UInt16>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::UInt32: getIdsAndDates<UInt32>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::UInt32: getIdsAndDates<UInt32>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::UInt64: getIdsAndDates<UInt64>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::UInt64: getIdsAndDates<UInt64>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::UInt128: getIdsAndDates<UInt128>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::Int8: getIdsAndDates<Int8>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::Int8: getIdsAndDates<Int8>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::Int16: getIdsAndDates<Int16>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::Int16: getIdsAndDates<Int16>(attribute, ids, start_dates, end_dates); break;
case AttributeUnderlyingType::Int32: getIdsAndDates<Int32>(attribute, ids, start_dates, end_dates); break; case AttributeUnderlyingType::Int32: getIdsAndDates<Int32>(attribute, ids, start_dates, end_dates); break;
......
...@@ -67,6 +67,7 @@ public: ...@@ -67,6 +67,7 @@ public:
DECLARE_MULTIPLE_GETTER(UInt16) DECLARE_MULTIPLE_GETTER(UInt16)
DECLARE_MULTIPLE_GETTER(UInt32) DECLARE_MULTIPLE_GETTER(UInt32)
DECLARE_MULTIPLE_GETTER(UInt64) DECLARE_MULTIPLE_GETTER(UInt64)
DECLARE_MULTIPLE_GETTER(UInt128)
DECLARE_MULTIPLE_GETTER(Int8) DECLARE_MULTIPLE_GETTER(Int8)
DECLARE_MULTIPLE_GETTER(Int16) DECLARE_MULTIPLE_GETTER(Int16)
DECLARE_MULTIPLE_GETTER(Int32) DECLARE_MULTIPLE_GETTER(Int32)
...@@ -120,10 +121,12 @@ private: ...@@ -120,10 +121,12 @@ private:
public: public:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple<UInt8, UInt16, UInt32, UInt64, std::tuple<UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
String> null_values; String> null_values;
std::tuple<Ptr<UInt8>, Ptr<UInt16>, Ptr<UInt32>, Ptr<UInt64>, std::tuple<Ptr<UInt8>, Ptr<UInt16>, Ptr<UInt32>, Ptr<UInt64>,
Ptr<UInt128>,
Ptr<Int8>, Ptr<Int16>, Ptr<Int32>, Ptr<Int64>, Ptr<Int8>, Ptr<Int16>, Ptr<Int32>, Ptr<Int64>,
Ptr<Float32>, Ptr<Float64>, Ptr<StringRef>> maps; Ptr<Float32>, Ptr<Float64>, Ptr<StringRef>> maps;
std::unique_ptr<Arena> string_arena; std::unique_ptr<Arena> string_arena;
......
...@@ -82,6 +82,7 @@ DECLARE(UInt8) ...@@ -82,6 +82,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -130,6 +131,7 @@ DECLARE(UInt8) ...@@ -130,6 +131,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -176,6 +178,7 @@ DECLARE(UInt8) ...@@ -176,6 +178,7 @@ DECLARE(UInt8)
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -213,6 +216,7 @@ void TrieDictionary::has(const Columns & key_columns, const DataTypes & key_type ...@@ -213,6 +216,7 @@ void TrieDictionary::has(const Columns & key_columns, const DataTypes & key_type
case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt16: has<UInt16>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt32: has<UInt32>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, key_columns, out); break; case AttributeUnderlyingType::UInt64: has<UInt64>(attribute, key_columns, out); break;
case AttributeUnderlyingType::UInt128: has<UInt128>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int8: has<Int8>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int8: has<Int8>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int16: has<Int16>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int16: has<Int16>(attribute, key_columns, out); break;
case AttributeUnderlyingType::Int32: has<Int32>(attribute, key_columns, out); break; case AttributeUnderlyingType::Int32: has<Int32>(attribute, key_columns, out); break;
...@@ -311,6 +315,7 @@ void TrieDictionary::calculateBytesAllocated() ...@@ -311,6 +315,7 @@ void TrieDictionary::calculateBytesAllocated()
case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break; case AttributeUnderlyingType::UInt16: addAttributeSize<UInt16>(attribute); break;
case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break; case AttributeUnderlyingType::UInt32: addAttributeSize<UInt32>(attribute); break;
case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break; case AttributeUnderlyingType::UInt64: addAttributeSize<UInt64>(attribute); break;
case AttributeUnderlyingType::UInt128: addAttributeSize<UInt128>(attribute); break;
case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break; case AttributeUnderlyingType::Int8: addAttributeSize<Int8>(attribute); break;
case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break; case AttributeUnderlyingType::Int16: addAttributeSize<Int16>(attribute); break;
case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break; case AttributeUnderlyingType::Int32: addAttributeSize<Int32>(attribute); break;
...@@ -363,6 +368,7 @@ TrieDictionary::Attribute TrieDictionary::createAttributeWithType(const Attribut ...@@ -363,6 +368,7 @@ TrieDictionary::Attribute TrieDictionary::createAttributeWithType(const Attribut
case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break; case AttributeUnderlyingType::UInt16: createAttributeImpl<UInt16>(attr, null_value); break;
case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break; case AttributeUnderlyingType::UInt32: createAttributeImpl<UInt32>(attr, null_value); break;
case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break; case AttributeUnderlyingType::UInt64: createAttributeImpl<UInt64>(attr, null_value); break;
case AttributeUnderlyingType::UInt128: createAttributeImpl<UInt128>(attr, null_value); break;
case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break; case AttributeUnderlyingType::Int8: createAttributeImpl<Int8>(attr, null_value); break;
case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break; case AttributeUnderlyingType::Int16: createAttributeImpl<Int16>(attr, null_value); break;
case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break; case AttributeUnderlyingType::Int32: createAttributeImpl<Int32>(attr, null_value); break;
...@@ -397,6 +403,7 @@ void TrieDictionary::getItemsNumber( ...@@ -397,6 +403,7 @@ void TrieDictionary::getItemsNumber(
DISPATCH(UInt16) DISPATCH(UInt16)
DISPATCH(UInt32) DISPATCH(UInt32)
DISPATCH(UInt64) DISPATCH(UInt64)
DISPATCH(UInt128)
DISPATCH(Int8) DISPATCH(Int8)
DISPATCH(Int16) DISPATCH(Int16)
DISPATCH(Int32) DISPATCH(Int32)
...@@ -425,7 +432,7 @@ void TrieDictionary::getItemsImpl( ...@@ -425,7 +432,7 @@ void TrieDictionary::getItemsImpl(
{ {
auto addr = Int32(first_column->get64(i)); auto addr = Int32(first_column->get64(i));
uintptr_t slot = btrie_find(trie, addr); uintptr_t slot = btrie_find(trie, addr);
set_value(i, slot != BTRIE_NULL ? vec[slot] : get_default(i)); set_value(i, slot != BTRIE_NULL ? static_cast<OutputType>(vec[slot]) : get_default(i));
} }
} }
else else
...@@ -437,7 +444,7 @@ void TrieDictionary::getItemsImpl( ...@@ -437,7 +444,7 @@ void TrieDictionary::getItemsImpl(
throw Exception("Expected key to be FixedString(16)", ErrorCodes::LOGICAL_ERROR); throw Exception("Expected key to be FixedString(16)", ErrorCodes::LOGICAL_ERROR);
uintptr_t slot = btrie_find_a6(trie, reinterpret_cast<const UInt8*>(addr.data)); uintptr_t slot = btrie_find_a6(trie, reinterpret_cast<const UInt8*>(addr.data));
set_value(i, slot != BTRIE_NULL ? vec[slot] : get_default(i)); set_value(i, slot != BTRIE_NULL ? static_cast<OutputType>(vec[slot]) : get_default(i));
} }
} }
...@@ -496,6 +503,7 @@ bool TrieDictionary::setAttributeValue(Attribute & attribute, const StringRef ke ...@@ -496,6 +503,7 @@ bool TrieDictionary::setAttributeValue(Attribute & attribute, const StringRef ke
case AttributeUnderlyingType::UInt16: return setAttributeValueImpl<UInt16>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt16: return setAttributeValueImpl<UInt16>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt32: return setAttributeValueImpl<UInt32>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt32: return setAttributeValueImpl<UInt32>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt64: return setAttributeValueImpl<UInt64>(attribute, key, value.get<UInt64>()); case AttributeUnderlyingType::UInt64: return setAttributeValueImpl<UInt64>(attribute, key, value.get<UInt64>());
case AttributeUnderlyingType::UInt128: return setAttributeValueImpl<UInt128>(attribute, key, value.get<UInt128>());
case AttributeUnderlyingType::Int8: return setAttributeValueImpl<Int8>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int8: return setAttributeValueImpl<Int8>(attribute, key, value.get<Int64>());
case AttributeUnderlyingType::Int16: return setAttributeValueImpl<Int16>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int16: return setAttributeValueImpl<Int16>(attribute, key, value.get<Int64>());
case AttributeUnderlyingType::Int32: return setAttributeValueImpl<Int32>(attribute, key, value.get<Int64>()); case AttributeUnderlyingType::Int32: return setAttributeValueImpl<Int32>(attribute, key, value.get<Int64>());
......
...@@ -76,6 +76,7 @@ public: ...@@ -76,6 +76,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -96,6 +97,7 @@ public: ...@@ -96,6 +97,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -116,6 +118,7 @@ public: ...@@ -116,6 +118,7 @@ public:
DECLARE(UInt16) DECLARE(UInt16)
DECLARE(UInt32) DECLARE(UInt32)
DECLARE(UInt64) DECLARE(UInt64)
DECLARE(UInt128)
DECLARE(Int8) DECLARE(Int8)
DECLARE(Int16) DECLARE(Int16)
DECLARE(Int32) DECLARE(Int32)
...@@ -141,11 +144,13 @@ private: ...@@ -141,11 +144,13 @@ private:
AttributeUnderlyingType type; AttributeUnderlyingType type;
std::tuple< std::tuple<
UInt8, UInt16, UInt32, UInt64, UInt8, UInt16, UInt32, UInt64,
UInt128,
Int8, Int16, Int32, Int64, Int8, Int16, Int32, Int64,
Float32, Float64, Float32, Float64,
String> null_values; String> null_values;
std::tuple< std::tuple<
ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>, ContainerPtrType<UInt8>, ContainerPtrType<UInt16>, ContainerPtrType<UInt32>, ContainerPtrType<UInt64>,
ContainerPtrType<UInt128>,
ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>, ContainerPtrType<Int8>, ContainerPtrType<Int16>, ContainerPtrType<Int32>, ContainerPtrType<Int64>,
ContainerPtrType<Float32>, ContainerPtrType<Float64>, ContainerPtrType<Float32>, ContainerPtrType<Float64>,
ContainerPtrType<StringRef>> maps; ContainerPtrType<StringRef>> maps;
......
...@@ -19,6 +19,7 @@ void registerFunctionsExternalDictionaries(FunctionFactory & factory) ...@@ -19,6 +19,7 @@ void registerFunctionsExternalDictionaries(FunctionFactory & factory)
factory.registerFunction<FunctionDictGetFloat64>(); factory.registerFunction<FunctionDictGetFloat64>();
factory.registerFunction<FunctionDictGetDate>(); factory.registerFunction<FunctionDictGetDate>();
factory.registerFunction<FunctionDictGetDateTime>(); factory.registerFunction<FunctionDictGetDateTime>();
factory.registerFunction<FunctionDictGetUUID>();
factory.registerFunction<FunctionDictGetString>(); factory.registerFunction<FunctionDictGetString>();
factory.registerFunction<FunctionDictGetHierarchy>(); factory.registerFunction<FunctionDictGetHierarchy>();
factory.registerFunction<FunctionDictIsIn>(); factory.registerFunction<FunctionDictIsIn>();
...@@ -34,6 +35,7 @@ void registerFunctionsExternalDictionaries(FunctionFactory & factory) ...@@ -34,6 +35,7 @@ void registerFunctionsExternalDictionaries(FunctionFactory & factory)
factory.registerFunction<FunctionDictGetFloat64OrDefault>(); factory.registerFunction<FunctionDictGetFloat64OrDefault>();
factory.registerFunction<FunctionDictGetDateOrDefault>(); factory.registerFunction<FunctionDictGetDateOrDefault>();
factory.registerFunction<FunctionDictGetDateTimeOrDefault>(); factory.registerFunction<FunctionDictGetDateTimeOrDefault>();
factory.registerFunction<FunctionDictGetUUIDOrDefault>();
factory.registerFunction<FunctionDictGetStringOrDefault>(); factory.registerFunction<FunctionDictGetStringOrDefault>();
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <DataTypes/DataTypeDate.h> #include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h> #include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeTuple.h> #include <DataTypes/DataTypeTuple.h>
#include <DataTypes/DataTypeUUID.h>
#include <Common/typeid_cast.h> #include <Common/typeid_cast.h>
...@@ -757,6 +758,7 @@ DECLARE_DICT_GET_TRAITS(Float32, DataTypeFloat32) ...@@ -757,6 +758,7 @@ DECLARE_DICT_GET_TRAITS(Float32, DataTypeFloat32)
DECLARE_DICT_GET_TRAITS(Float64, DataTypeFloat64) DECLARE_DICT_GET_TRAITS(Float64, DataTypeFloat64)
DECLARE_DICT_GET_TRAITS(UInt16, DataTypeDate) DECLARE_DICT_GET_TRAITS(UInt16, DataTypeDate)
DECLARE_DICT_GET_TRAITS(UInt32, DataTypeDateTime) DECLARE_DICT_GET_TRAITS(UInt32, DataTypeDateTime)
DECLARE_DICT_GET_TRAITS(UInt128, DataTypeUUID)
#undef DECLARE_DICT_GET_TRAITS #undef DECLARE_DICT_GET_TRAITS
template <typename DataType> template <typename DataType>
...@@ -1074,6 +1076,7 @@ using FunctionDictGetFloat32 = FunctionDictGet<DataTypeFloat32>; ...@@ -1074,6 +1076,7 @@ using FunctionDictGetFloat32 = FunctionDictGet<DataTypeFloat32>;
using FunctionDictGetFloat64 = FunctionDictGet<DataTypeFloat64>; using FunctionDictGetFloat64 = FunctionDictGet<DataTypeFloat64>;
using FunctionDictGetDate = FunctionDictGet<DataTypeDate>; using FunctionDictGetDate = FunctionDictGet<DataTypeDate>;
using FunctionDictGetDateTime = FunctionDictGet<DataTypeDateTime>; using FunctionDictGetDateTime = FunctionDictGet<DataTypeDateTime>;
using FunctionDictGetUUID = FunctionDictGet<DataTypeUUID>;
template <typename DataType> template <typename DataType>
...@@ -1331,6 +1334,7 @@ using FunctionDictGetFloat32OrDefault = FunctionDictGetOrDefault<DataTypeFloat32 ...@@ -1331,6 +1334,7 @@ using FunctionDictGetFloat32OrDefault = FunctionDictGetOrDefault<DataTypeFloat32
using FunctionDictGetFloat64OrDefault = FunctionDictGetOrDefault<DataTypeFloat64>; using FunctionDictGetFloat64OrDefault = FunctionDictGetOrDefault<DataTypeFloat64>;
using FunctionDictGetDateOrDefault = FunctionDictGetOrDefault<DataTypeDate>; using FunctionDictGetDateOrDefault = FunctionDictGetOrDefault<DataTypeDate>;
using FunctionDictGetDateTimeOrDefault = FunctionDictGetOrDefault<DataTypeDateTime>; using FunctionDictGetDateTimeOrDefault = FunctionDictGetOrDefault<DataTypeDateTime>;
using FunctionDictGetUUIDOrDefault = FunctionDictGetOrDefault<DataTypeUUID>;
/// Functions to work with hierarchies. /// Functions to work with hierarchies.
......
...@@ -14,6 +14,9 @@ dictGetFloat32, dictGetFloat64 ...@@ -14,6 +14,9 @@ dictGetFloat32, dictGetFloat64
dictGetDate, dictGetDateTime dictGetDate, dictGetDateTime
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dictGetUUID
~~~~~~~~~~~
dictGetString dictGetString
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
``dictGetT('dict_name', 'attr_name', id)`` ``dictGetT('dict_name', 'attr_name', id)``
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
### dictGetDate, dictGetDateTime ### dictGetDate, dictGetDateTime
### dictGetUUID
### dictGetString ### dictGetString
`dictGetT('dict_name', 'attr_name', id)` `dictGetT('dict_name', 'attr_name', id)`
- получить из словаря dict_name значение атрибута attr_name по ключу id. - получить из словаря dict_name значение атрибута attr_name по ключу id.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册