diff --git a/src/AggregateFunctions/AggregateFunctionSumMap.h b/src/AggregateFunctions/AggregateFunctionSumMap.h index faac2f14e6c..90c73b826b2 100644 --- a/src/AggregateFunctions/AggregateFunctionSumMap.h +++ b/src/AggregateFunctions/AggregateFunctionSumMap.h @@ -519,7 +519,7 @@ private: template bool compareImpl(FieldType & x) const { - auto val = get(rhs); + auto val = rhs.get(); if (val > x) { x = val; @@ -554,7 +554,7 @@ private: template bool compareImpl(FieldType & x) const { - auto val = get(rhs); + auto val = rhs.get(); if (val < x) { x = val; diff --git a/src/Columns/ColumnArray.cpp b/src/Columns/ColumnArray.cpp index fabdc03ace9..7bddfc14707 100644 --- a/src/Columns/ColumnArray.cpp +++ b/src/Columns/ColumnArray.cpp @@ -141,7 +141,7 @@ void ColumnArray::get(size_t n, Field & res) const size, max_array_size_as_field); res = Array(); - Array & res_arr = DB::get(res); + Array & res_arr = res.get(); res_arr.reserve(size); for (size_t i = 0; i < size; ++i) @@ -296,7 +296,7 @@ void ColumnArray::updateHashFast(SipHash & hash) const void ColumnArray::insert(const Field & x) { - const Array & array = DB::get(x); + const Array & array = x.get(); size_t size = array.size(); for (size_t i = 0; i < size; ++i) getData().insert(array[i]); diff --git a/src/Columns/ColumnDecimal.h b/src/Columns/ColumnDecimal.h index afae2cd641a..5634b9064bf 100644 --- a/src/Columns/ColumnDecimal.h +++ b/src/Columns/ColumnDecimal.h @@ -63,7 +63,7 @@ public: { data.resize_fill(data.size() + length); } - void insert(const Field & x) override { data.push_back(DB::get(x)); } + void insert(const Field & x) override { data.push_back(x.get()); } void insertRangeFrom(const IColumn & src, size_t start, size_t length) override; void popBack(size_t n) override diff --git a/src/Columns/ColumnFixedString.cpp b/src/Columns/ColumnFixedString.cpp index 158d154f3f8..7038579d436 100644 --- a/src/Columns/ColumnFixedString.cpp +++ b/src/Columns/ColumnFixedString.cpp @@ -59,7 +59,7 @@ bool ColumnFixedString::isDefaultAt(size_t index) const void ColumnFixedString::insert(const Field & x) { - const String & s = DB::get(x); + const String & s = x.get(); if (s.size() > n) throw Exception("Too large string '" + s + "' for FixedString column", ErrorCodes::TOO_LARGE_STRING_SIZE); diff --git a/src/Columns/ColumnMap.cpp b/src/Columns/ColumnMap.cpp index 06851f992ac..9956ba19455 100644 --- a/src/Columns/ColumnMap.cpp +++ b/src/Columns/ColumnMap.cpp @@ -74,7 +74,7 @@ void ColumnMap::get(size_t n, Field & res) const size_t size = offsets[n] - offsets[n - 1]; res = Map(); - auto & map = DB::get(res); + auto & map = res.get(); map.reserve(size); for (size_t i = 0; i < size; ++i) @@ -98,7 +98,7 @@ void ColumnMap::insertData(const char *, size_t) void ColumnMap::insert(const Field & x) { - const auto & map = DB::get(x); + const auto & map = x.get(); nested->insert(Array(map.begin(), map.end())); } diff --git a/src/Columns/ColumnString.h b/src/Columns/ColumnString.h index 905b8a7ebef..361b792df55 100644 --- a/src/Columns/ColumnString.h +++ b/src/Columns/ColumnString.h @@ -128,7 +128,7 @@ public: void insert(const Field & x) override { - const String & s = DB::get(x); + const String & s = x.get(); const size_t old_size = chars.size(); const size_t size_to_append = s.size() + 1; const size_t new_size = old_size + size_to_append; diff --git a/src/Columns/ColumnTuple.cpp b/src/Columns/ColumnTuple.cpp index 6763c11bb9a..f023798e589 100644 --- a/src/Columns/ColumnTuple.cpp +++ b/src/Columns/ColumnTuple.cpp @@ -109,7 +109,7 @@ void ColumnTuple::get(size_t n, Field & res) const const size_t tuple_size = columns.size(); res = Tuple(); - Tuple & res_tuple = DB::get(res); + Tuple & res_tuple = res.get(); res_tuple.reserve(tuple_size); for (size_t i = 0; i < tuple_size; ++i) @@ -137,7 +137,7 @@ void ColumnTuple::insertData(const char *, size_t) void ColumnTuple::insert(const Field & x) { - const auto & tuple = DB::get(x); + const auto & tuple = x.get(); const size_t tuple_size = columns.size(); if (tuple.size() != tuple_size) diff --git a/src/Columns/ColumnVector.cpp b/src/Columns/ColumnVector.cpp index d89917fc6c2..2db7fad2a50 100644 --- a/src/Columns/ColumnVector.cpp +++ b/src/Columns/ColumnVector.cpp @@ -918,7 +918,7 @@ ColumnPtr ColumnVector::createWithOffsets(const IColumn::Offsets & offsets, c auto res = this->create(); auto & res_data = res->getData(); - T default_value = safeGet(default_field); + T default_value = default_field.safeGet(); res_data.resize_fill(total_rows, default_value); for (size_t i = 0; i < offsets.size(); ++i) res_data[offsets[i]] = data[i + shift]; diff --git a/src/Columns/ColumnVector.h b/src/Columns/ColumnVector.h index 88e953891cc..ce480448713 100644 --- a/src/Columns/ColumnVector.h +++ b/src/Columns/ColumnVector.h @@ -301,7 +301,7 @@ public: void insert(const Field & x) override { - data.push_back(DB::get(x)); + data.push_back(x.get()); } void insertRangeFrom(const IColumn & src, size_t start, size_t length) override; diff --git a/src/Common/FieldVisitorSum.cpp b/src/Common/FieldVisitorSum.cpp index a8cb694d930..bc996ae2298 100644 --- a/src/Common/FieldVisitorSum.cpp +++ b/src/Common/FieldVisitorSum.cpp @@ -19,7 +19,7 @@ bool FieldVisitorSum::operator() (UInt64 & x) const return x != 0; } -bool FieldVisitorSum::operator() (Float64 & x) const { x += get(rhs); return x != 0; } +bool FieldVisitorSum::operator() (Float64 & x) const { x += rhs.get(); return x != 0; } bool FieldVisitorSum::operator() (Null &) const { throw Exception("Cannot sum Nulls", ErrorCodes::LOGICAL_ERROR); } bool FieldVisitorSum::operator() (String &) const { throw Exception("Cannot sum Strings", ErrorCodes::LOGICAL_ERROR); } @@ -37,4 +37,3 @@ bool FieldVisitorSum::operator() (AggregateFunctionStateData &) const bool FieldVisitorSum::operator() (bool &) const { throw Exception("Cannot sum Bools", ErrorCodes::LOGICAL_ERROR); } } - diff --git a/src/Common/FieldVisitorSum.h b/src/Common/FieldVisitorSum.h index 247ef5b43da..cd8777e7bfb 100644 --- a/src/Common/FieldVisitorSum.h +++ b/src/Common/FieldVisitorSum.h @@ -33,7 +33,7 @@ public: template bool operator() (DecimalField & x) const { - x += get>(rhs); + x += rhs.get>(); return x.getValue() != T(0); } @@ -47,4 +47,3 @@ public: }; } - diff --git a/src/Core/Field.h b/src/Core/Field.h index f60b7e4902e..a0945b8315a 100644 --- a/src/Core/Field.h +++ b/src/Core/Field.h @@ -882,30 +882,6 @@ inline char & Field::reinterpret() return *reinterpret_cast(&storage); } -template -T get(const Field & field) -{ - return field.template get(); -} - -template -T get(Field & field) -{ - return field.template get(); -} - -template -T safeGet(const Field & field) -{ - return field.template safeGet(); -} - -template -T safeGet(Field & field) -{ - return field.template safeGet(); -} - template Field::Field(T && rhs, enable_if_not_field_or_bool_or_stringlike_t) //-V730 { @@ -1036,4 +1012,3 @@ struct fmt::formatter return format_to(ctx.out(), "{}", toString(x)); } }; - diff --git a/src/DataTypes/Serializations/JSONDataParser.cpp b/src/DataTypes/Serializations/JSONDataParser.cpp index 598ba475697..e84197534a0 100644 --- a/src/DataTypes/Serializations/JSONDataParser.cpp +++ b/src/DataTypes/Serializations/JSONDataParser.cpp @@ -131,7 +131,7 @@ void JSONDataParser::traverseArrayElement(const Element & element, P auto nested_key = getNameOfNested(paths[i], values[i]); if (!nested_key.empty()) { - size_t array_size = get(values[i]).size(); + size_t array_size = values[i].template get().size(); auto & current_nested_sizes = ctx.nested_sizes_by_key[nested_key]; if (current_nested_sizes.size() == ctx.current_size) @@ -154,7 +154,7 @@ void JSONDataParser::traverseArrayElement(const Element & element, P auto nested_key = getNameOfNested(paths[i], values[i]); if (!nested_key.empty()) { - size_t array_size = get(values[i]).size(); + size_t array_size = values[i].template get().size(); auto & current_nested_sizes = ctx.nested_sizes_by_key[nested_key]; if (current_nested_sizes.empty()) diff --git a/src/DataTypes/Serializations/SerializationAggregateFunction.cpp b/src/DataTypes/Serializations/SerializationAggregateFunction.cpp index 442df47a773..c8db1a56ed0 100644 --- a/src/DataTypes/Serializations/SerializationAggregateFunction.cpp +++ b/src/DataTypes/Serializations/SerializationAggregateFunction.cpp @@ -19,14 +19,14 @@ namespace DB void SerializationAggregateFunction::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const AggregateFunctionStateData & state = get(field); + const AggregateFunctionStateData & state = field.get(); writeBinary(state.data, ostr); } void SerializationAggregateFunction::deserializeBinary(Field & field, ReadBuffer & istr) const { field = AggregateFunctionStateData(); - AggregateFunctionStateData & s = get(field); + AggregateFunctionStateData & s = field.get(); readBinary(s.data, istr); s.name = type_name; } diff --git a/src/DataTypes/Serializations/SerializationArray.cpp b/src/DataTypes/Serializations/SerializationArray.cpp index 48980febd9d..abd99038e98 100644 --- a/src/DataTypes/Serializations/SerializationArray.cpp +++ b/src/DataTypes/Serializations/SerializationArray.cpp @@ -24,7 +24,7 @@ namespace ErrorCodes void SerializationArray::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const Array & a = get(field); + const Array & a = field.get(); writeVarUInt(a.size(), ostr); for (size_t i = 0; i < a.size(); ++i) { @@ -38,7 +38,7 @@ void SerializationArray::deserializeBinary(Field & field, ReadBuffer & istr) con size_t size; readVarUInt(size, istr); field = Array(); - Array & arr = get(field); + Array & arr = field.get(); arr.reserve(size); for (size_t i = 0; i < size; ++i) nested->deserializeBinary(arr.emplace_back(), istr); diff --git a/src/DataTypes/Serializations/SerializationDecimalBase.cpp b/src/DataTypes/Serializations/SerializationDecimalBase.cpp index 8557c9ff719..00ffd607664 100644 --- a/src/DataTypes/Serializations/SerializationDecimalBase.cpp +++ b/src/DataTypes/Serializations/SerializationDecimalBase.cpp @@ -14,7 +14,7 @@ namespace DB template void SerializationDecimalBase::serializeBinary(const Field & field, WriteBuffer & ostr) const { - FieldType x = get>(field); + FieldType x = field.get>(); writeBinary(x, ostr); } diff --git a/src/DataTypes/Serializations/SerializationFixedString.cpp b/src/DataTypes/Serializations/SerializationFixedString.cpp index 972313a564f..9baaf95cb52 100644 --- a/src/DataTypes/Serializations/SerializationFixedString.cpp +++ b/src/DataTypes/Serializations/SerializationFixedString.cpp @@ -26,7 +26,7 @@ namespace ErrorCodes void SerializationFixedString::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const String & s = get(field); + const String & s = field.get(); ostr.write(s.data(), std::min(s.size(), n)); if (s.size() < n) for (size_t i = s.size(); i < n; ++i) @@ -37,7 +37,7 @@ void SerializationFixedString::serializeBinary(const Field & field, WriteBuffer void SerializationFixedString::deserializeBinary(Field & field, ReadBuffer & istr) const { field = String(); - String & s = get(field); + String & s = field.get(); s.resize(n); istr.readStrict(s.data(), n); } diff --git a/src/DataTypes/Serializations/SerializationMap.cpp b/src/DataTypes/Serializations/SerializationMap.cpp index e46bb480d14..958e33fbaf4 100644 --- a/src/DataTypes/Serializations/SerializationMap.cpp +++ b/src/DataTypes/Serializations/SerializationMap.cpp @@ -38,7 +38,7 @@ static IColumn & extractNestedColumn(IColumn & column) void SerializationMap::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const auto & map = get(field); + const auto & map = field.get(); writeVarUInt(map.size(), ostr); for (const auto & elem : map) { diff --git a/src/DataTypes/Serializations/SerializationNumber.cpp b/src/DataTypes/Serializations/SerializationNumber.cpp index 14c53dd5956..f1845fe9c80 100644 --- a/src/DataTypes/Serializations/SerializationNumber.cpp +++ b/src/DataTypes/Serializations/SerializationNumber.cpp @@ -105,7 +105,7 @@ template void SerializationNumber::serializeBinary(const Field & field, WriteBuffer & ostr) const { /// ColumnVector::ValueType is a narrower type. For example, UInt8, when the Field type is UInt64 - typename ColumnVector::ValueType x = get(field); + typename ColumnVector::ValueType x = field.get(); writeBinary(x, ostr); } diff --git a/src/DataTypes/Serializations/SerializationString.cpp b/src/DataTypes/Serializations/SerializationString.cpp index e07fd4f26cf..61fcff35c92 100644 --- a/src/DataTypes/Serializations/SerializationString.cpp +++ b/src/DataTypes/Serializations/SerializationString.cpp @@ -22,7 +22,7 @@ namespace DB void SerializationString::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const String & s = get(field); + const String & s = field.get(); writeVarUInt(s.size(), ostr); writeString(s, ostr); } @@ -33,7 +33,7 @@ void SerializationString::deserializeBinary(Field & field, ReadBuffer & istr) co UInt64 size; readVarUInt(size, istr); field = String(); - String & s = get(field); + String & s = field.get(); s.resize(size); istr.readStrict(s.data(), size); } diff --git a/src/DataTypes/Serializations/SerializationTuple.cpp b/src/DataTypes/Serializations/SerializationTuple.cpp index 5663ff86dd6..c2c40cbb507 100644 --- a/src/DataTypes/Serializations/SerializationTuple.cpp +++ b/src/DataTypes/Serializations/SerializationTuple.cpp @@ -31,7 +31,7 @@ static inline const IColumn & extractElementColumn(const IColumn & column, size_ void SerializationTuple::serializeBinary(const Field & field, WriteBuffer & ostr) const { - const auto & tuple = get(field); + const auto & tuple = field.get(); for (size_t element_index = 0; element_index < elems.size(); ++element_index) { const auto & serialization = elems[element_index]; @@ -44,7 +44,7 @@ void SerializationTuple::deserializeBinary(Field & field, ReadBuffer & istr) con const size_t size = elems.size(); field = Tuple(); - Tuple & tuple = get(field); + Tuple & tuple = field.get(); tuple.reserve(size); for (size_t i = 0; i < size; ++i) elems[i]->deserializeBinary(tuple.emplace_back(), istr); diff --git a/src/DataTypes/Serializations/SerializationUUID.cpp b/src/DataTypes/Serializations/SerializationUUID.cpp index 36a060f2048..1fa9219a643 100644 --- a/src/DataTypes/Serializations/SerializationUUID.cpp +++ b/src/DataTypes/Serializations/SerializationUUID.cpp @@ -84,7 +84,7 @@ void SerializationUUID::deserializeTextCSV(IColumn & column, ReadBuffer & istr, void SerializationUUID::serializeBinary(const Field & field, WriteBuffer & ostr) const { - UUID x = get(field); + UUID x = field.get(); writeBinary(x, ostr); } diff --git a/src/Databases/MySQL/MaterializedMySQLSyncThread.cpp b/src/Databases/MySQL/MaterializedMySQLSyncThread.cpp index 230b158b231..29f86a05016 100644 --- a/src/Databases/MySQL/MaterializedMySQLSyncThread.cpp +++ b/src/Databases/MySQL/MaterializedMySQLSyncThread.cpp @@ -633,7 +633,7 @@ static void writeFieldsToColumn( { for (size_t index = 0; index < rows_data.size(); ++index) { - const Tuple & row_data = DB::get(rows_data[index]); + const Tuple & row_data = rows_data[index].get(); const Field & value = row_data[column_index]; if (write_data_to_null_map(value, index)) @@ -673,7 +673,7 @@ static void writeFieldsToColumn( { for (size_t index = 0; index < rows_data.size(); ++index) { - const Tuple & row_data = DB::get(rows_data[index]); + const Tuple & row_data = rows_data[index].get(); const Field & value = row_data[column_index]; if (write_data_to_null_map(value, index)) @@ -695,7 +695,7 @@ static void writeFieldsToColumn( { for (size_t index = 0; index < rows_data.size(); ++index) { - const Tuple & row_data = DB::get(rows_data[index]); + const Tuple & row_data = rows_data[index].get(); const Field & value = row_data[column_index]; if (write_data_to_null_map(value, index)) @@ -709,7 +709,7 @@ static void writeFieldsToColumn( { for (size_t index = 0; index < rows_data.size(); ++index) { - const Tuple & row_data = DB::get(rows_data[index]); + const Tuple & row_data = rows_data[index].get(); const Field & value = row_data[column_index]; if (write_data_to_null_map(value, index)) @@ -761,7 +761,7 @@ static inline size_t onUpdateData(const Row & rows_data, Block & buffer, size_t { writeable_rows_mask[index + 1] = true; writeable_rows_mask[index] = differenceSortingKeys( - DB::get(rows_data[index]), DB::get(rows_data[index + 1]), sorting_columns_index); + rows_data[index].get(), rows_data[index + 1].get(), sorting_columns_index); } for (size_t column = 0; column < buffer.columns() - 2; ++column) diff --git a/src/Dictionaries/MongoDBDictionarySource.cpp b/src/Dictionaries/MongoDBDictionarySource.cpp index a735f426ec7..0a8d632efcb 100644 --- a/src/Dictionaries/MongoDBDictionarySource.cpp +++ b/src/Dictionaries/MongoDBDictionarySource.cpp @@ -232,7 +232,7 @@ QueryPipeline MongoDBDictionarySource::loadKeys(const Columns & key_columns, con } case AttributeUnderlyingType::String: { - String loaded_str(get((*key_columns[attribute_index])[row_idx])); + String loaded_str((*key_columns[attribute_index])[row_idx].get()); /// Convert string to ObjectID if (key_attribute.is_object_id) { @@ -259,7 +259,7 @@ QueryPipeline MongoDBDictionarySource::loadKeys(const Columns & key_columns, con std::string MongoDBDictionarySource::toString() const { - return "MongoDB: " + db + '.' + collection + ',' + (user.empty() ? " " : " " + user + '@') + host + ':' + DB::toString(port); + return fmt::format("MongoDB: {}.{},{}{}:{}", db, collection, (user.empty() ? " " : " " + user + '@'), host, port); } } diff --git a/src/Dictionaries/RedisDictionarySource.cpp b/src/Dictionaries/RedisDictionarySource.cpp index ab5c758848a..b7aa72b253a 100644 --- a/src/Dictionaries/RedisDictionarySource.cpp +++ b/src/Dictionaries/RedisDictionarySource.cpp @@ -220,7 +220,7 @@ namespace DB if (isInteger(type)) key << DB::toString(key_columns[i]->get64(row)); else if (isString(type)) - key << get((*key_columns[i])[row]); + key << (*key_columns[i])[row].get(); else throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected type of key in Redis dictionary"); } diff --git a/src/Functions/array/arrayElement.cpp b/src/Functions/array/arrayElement.cpp index 7ffe71a7e5a..acd8f89ffe5 100644 --- a/src/Functions/array/arrayElement.cpp +++ b/src/Functions/array/arrayElement.cpp @@ -476,10 +476,10 @@ ColumnPtr FunctionArrayElement::executeNumberConst( auto col_res = ColumnVector::create(); if (index.getType() == Field::Types::UInt64 - || (index.getType() == Field::Types::Int64 && get(index) >= 0)) + || (index.getType() == Field::Types::Int64 && index.get() >= 0)) { ArrayElementNumImpl::template vectorConst( - col_nested->getData(), col_array->getOffsets(), get(index) - 1, col_res->getData(), builder); + col_nested->getData(), col_array->getOffsets(), index.get() - 1, col_res->getData(), builder); } else if (index.getType() == Field::Types::Int64) { @@ -493,7 +493,7 @@ ColumnPtr FunctionArrayElement::executeNumberConst( /// arr[-2] is the element at offset 1 from the last and so on. ArrayElementNumImpl::template vectorConst( - col_nested->getData(), col_array->getOffsets(), -(static_cast(safeGet(index)) + 1), col_res->getData(), builder); + col_nested->getData(), col_array->getOffsets(), -(static_cast(index.safeGet()) + 1), col_res->getData(), builder); } else throw Exception("Illegal type of array index", ErrorCodes::LOGICAL_ERROR); @@ -539,12 +539,12 @@ FunctionArrayElement::executeStringConst(const ColumnsWithTypeAndName & argument auto col_res = ColumnString::create(); if (index.getType() == Field::Types::UInt64 - || (index.getType() == Field::Types::Int64 && get(index) >= 0)) + || (index.getType() == Field::Types::Int64 && index.get() >= 0)) ArrayElementStringImpl::vectorConst( col_nested->getChars(), col_array->getOffsets(), col_nested->getOffsets(), - get(index) - 1, + index.get() - 1, col_res->getChars(), col_res->getOffsets(), builder); @@ -553,7 +553,7 @@ FunctionArrayElement::executeStringConst(const ColumnsWithTypeAndName & argument col_nested->getChars(), col_array->getOffsets(), col_nested->getOffsets(), - -(UInt64(get(index)) + 1), + -(UInt64(index.get()) + 1), col_res->getChars(), col_res->getOffsets(), builder); @@ -603,12 +603,12 @@ ColumnPtr FunctionArrayElement::executeGenericConst( auto col_res = col_nested.cloneEmpty(); if (index.getType() == Field::Types::UInt64 - || (index.getType() == Field::Types::Int64 && get(index) >= 0)) + || (index.getType() == Field::Types::Int64 && index.get() >= 0)) ArrayElementGenericImpl::vectorConst( - col_nested, col_array->getOffsets(), get(index) - 1, *col_res, builder); + col_nested, col_array->getOffsets(), index.get() - 1, *col_res, builder); else if (index.getType() == Field::Types::Int64) ArrayElementGenericImpl::vectorConst( - col_nested, col_array->getOffsets(), -(static_cast(get(index) + 1)), *col_res, builder); + col_nested, col_array->getOffsets(), -(static_cast(index.get() + 1)), *col_res, builder); else throw Exception("Illegal type of array index", ErrorCodes::LOGICAL_ERROR); @@ -877,7 +877,7 @@ bool FunctionArrayElement::matchKeyToIndexStringConst( using DataColumn = std::decay_t; if (index.getType() != Field::Types::String) return false; - MatcherStringConst matcher{data_column, get(index)}; + MatcherStringConst matcher{data_column, index.get()}; executeMatchKeyToIndex(offsets, matched_idxs, matcher); return true; }); diff --git a/src/Interpreters/ActionsVisitor.cpp b/src/Interpreters/ActionsVisitor.cpp index 6c9e54a966d..f10510fadae 100644 --- a/src/Interpreters/ActionsVisitor.cpp +++ b/src/Interpreters/ActionsVisitor.cpp @@ -114,7 +114,7 @@ static Block createBlockFromCollection(const Collection & collection, const Data throw Exception("Invalid type in set. Expected tuple, got " + String(value.getTypeName()), ErrorCodes::INCORRECT_ELEMENT_OF_SET); - const auto & tuple = DB::get(value); + const auto & tuple = value.template get(); size_t tuple_size = tuple.size(); if (tuple_size != columns_num) @@ -306,9 +306,9 @@ Block createBlockForSet( { auto type_index = right_arg_type->getTypeId(); if (type_index == TypeIndex::Tuple) - block = createBlockFromCollection(DB::get(right_arg_value), set_element_types, tranform_null_in); + block = createBlockFromCollection(right_arg_value.get(), set_element_types, tranform_null_in); else if (type_index == TypeIndex::Array) - block = createBlockFromCollection(DB::get(right_arg_value), set_element_types, tranform_null_in); + block = createBlockFromCollection(right_arg_value.get(), set_element_types, tranform_null_in); else throw_unsupported_type(right_arg_type); } diff --git a/src/Interpreters/InterpreterKillQueryQuery.cpp b/src/Interpreters/InterpreterKillQueryQuery.cpp index f279244d769..1b4364351df 100644 --- a/src/Interpreters/InterpreterKillQueryQuery.cpp +++ b/src/Interpreters/InterpreterKillQueryQuery.cpp @@ -327,7 +327,7 @@ BlockIO InterpreterKillQueryQuery::execute() for (size_t i = 0; i < moves_block.rows(); ++i) { table_id = StorageID{database_col.getDataAt(i).toString(), table_col.getDataAt(i).toString()}; - auto task_uuid = get(task_uuid_col[i]); + auto task_uuid = task_uuid_col[i].get(); CancellationCode code = CancellationCode::Unknown; diff --git a/src/Interpreters/RewriteFunctionToSubcolumnVisitor.cpp b/src/Interpreters/RewriteFunctionToSubcolumnVisitor.cpp index a34c81d52e2..506fa13b7ba 100644 --- a/src/Interpreters/RewriteFunctionToSubcolumnVisitor.cpp +++ b/src/Interpreters/RewriteFunctionToSubcolumnVisitor.cpp @@ -111,11 +111,11 @@ void RewriteFunctionToSubcolumnData::visit(ASTFunction & function, ASTPtr & ast) if (value_type == Field::Types::UInt64) { const auto & type_tuple = assert_cast(*column_type); - auto index = get(literal->value); + auto index = literal->value.get(); subcolumn_name = type_tuple.getNameByPosition(index); } else if (value_type == Field::Types::String) - subcolumn_name = get(literal->value); + subcolumn_name = literal->value.get(); else return; diff --git a/src/Interpreters/tests/gtest_comparison_graph.cpp b/src/Interpreters/tests/gtest_comparison_graph.cpp index 6348bd13b8e..72e72b4b802 100644 --- a/src/Interpreters/tests/gtest_comparison_graph.cpp +++ b/src/Interpreters/tests/gtest_comparison_graph.cpp @@ -29,7 +29,7 @@ TEST(ComparisonGraph, Bounds) const auto & [lower, strict] = *res; - ASSERT_EQ(get(lower), 3); + ASSERT_EQ(lower.get(), 3); ASSERT_TRUE(strict); } @@ -39,7 +39,7 @@ TEST(ComparisonGraph, Bounds) const auto & [upper, strict] = *res; - ASSERT_EQ(get(upper), 7); + ASSERT_EQ(upper.get(), 7); ASSERT_TRUE(strict); } diff --git a/src/Parsers/ParserShowTablesQuery.cpp b/src/Parsers/ParserShowTablesQuery.cpp index 46c783b8271..858aafce847 100644 --- a/src/Parsers/ParserShowTablesQuery.cpp +++ b/src/Parsers/ParserShowTablesQuery.cpp @@ -177,12 +177,11 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec tryGetIdentifierNameInto(database, query->from); if (like) - query->like = safeGet(like->as().value); + query->like = like->as().value.safeGet(); node = query; return true; } - } diff --git a/src/Processors/Transforms/FillingTransform.cpp b/src/Processors/Transforms/FillingTransform.cpp index 311c88e46e8..786b28dc02e 100644 --- a/src/Processors/Transforms/FillingTransform.cpp +++ b/src/Processors/Transforms/FillingTransform.cpp @@ -40,7 +40,7 @@ static FillColumnDescription::StepFunction getStepFunction( { #define DECLARE_CASE(NAME) \ case IntervalKind::NAME: \ - return [step, scale, &date_lut](Field & field) { field = Add##NAME##sImpl::execute(get(field), step, date_lut, scale); }; + return [step, scale, &date_lut](Field & field) { field = Add##NAME##sImpl::execute(static_cast(field.get()), step, date_lut, scale); }; FOR_EACH_INTERVAL_KIND(DECLARE_CASE) #undef DECLARE_CASE @@ -106,21 +106,21 @@ static bool tryConvertFields(FillColumnDescription & descr, const DataTypePtr & { if (which.isDate() || which.isDate32()) { - Int64 avg_seconds = get(descr.fill_step) * descr.step_kind->toAvgSeconds(); + Int64 avg_seconds = descr.fill_step.get() * descr.step_kind->toAvgSeconds(); if (std::abs(avg_seconds) < 86400) throw Exception(ErrorCodes::INVALID_WITH_FILL_EXPRESSION, "Value of step is to low ({} seconds). Must be >= 1 day", std::abs(avg_seconds)); } if (which.isDate()) - descr.step_func = getStepFunction(*descr.step_kind, get(descr.fill_step), DateLUT::instance()); + descr.step_func = getStepFunction(*descr.step_kind, descr.fill_step.get(), DateLUT::instance()); else if (which.isDate32()) - descr.step_func = getStepFunction(*descr.step_kind, get(descr.fill_step), DateLUT::instance()); + descr.step_func = getStepFunction(*descr.step_kind, descr.fill_step.get(), DateLUT::instance()); else if (const auto * date_time = checkAndGetDataType(type.get())) - descr.step_func = getStepFunction(*descr.step_kind, get(descr.fill_step), date_time->getTimeZone()); + descr.step_func = getStepFunction(*descr.step_kind, descr.fill_step.get(), date_time->getTimeZone()); else if (const auto * date_time64 = checkAndGetDataType(type.get())) { - const auto & step_dec = get &>(descr.fill_step); + const auto & step_dec = descr.fill_step.get &>(); Int64 step = DecimalUtils::convertTo(step_dec.getValue(), step_dec.getScale()); switch (*descr.step_kind) @@ -129,7 +129,7 @@ static bool tryConvertFields(FillColumnDescription & descr, const DataTypePtr & case IntervalKind::NAME: \ descr.step_func = [step, &time_zone = date_time64->getTimeZone()](Field & field) \ { \ - auto field_decimal = get>(field); \ + auto field_decimal = field.get>(); \ auto res = Add##NAME##sImpl::execute(field_decimal.getValue(), step, time_zone, field_decimal.getScale()); \ field = DecimalField(res, field_decimal.getScale()); \ }; \ diff --git a/src/Storages/LiveView/StorageLiveView.cpp b/src/Storages/LiveView/StorageLiveView.cpp index b37dec6cbf1..4f52267a7fe 100644 --- a/src/Storages/LiveView/StorageLiveView.cpp +++ b/src/Storages/LiveView/StorageLiveView.cpp @@ -582,7 +582,7 @@ Pipe StorageLiveView::watch( if (query.limit_length) { has_limit = true; - limit = safeGet(typeid_cast(*query.limit_length).value); + limit = typeid_cast(*query.limit_length).value.safeGet(); } if (query.is_watch_events) diff --git a/src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp b/src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp index a80f7093775..9d1a075a63f 100644 --- a/src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp +++ b/src/Storages/MergeTree/MergeTreeIndexConditionBloomFilter.cpp @@ -613,7 +613,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals( if (which.isTuple() && function->name == "tuple") { - const Tuple & tuple = get(value_field); + const Tuple & tuple = value_field.get(); const auto * value_tuple_data_type = typeid_cast(value_type.get()); const ASTs & arguments = typeid_cast(*function->arguments).children; diff --git a/src/Storages/MergeTree/registerStorageMergeTree.cpp b/src/Storages/MergeTree/registerStorageMergeTree.cpp index e52a0fed674..0e27f108cec 100644 --- a/src/Storages/MergeTree/registerStorageMergeTree.cpp +++ b/src/Storages/MergeTree/registerStorageMergeTree.cpp @@ -333,7 +333,7 @@ static StoragePtr create(const StorageFactory::Arguments & args) /// Get path and name from engine arguments ast_zk_path = engine_args[arg_num]->as(); if (ast_zk_path && ast_zk_path->value.getType() == Field::Types::String) - zookeeper_path = safeGet(ast_zk_path->value); + zookeeper_path = ast_zk_path->value.safeGet(); else throw Exception( "Path in ZooKeeper must be a string literal" + getMergeTreeVerboseHelp(is_extended_storage_def), @@ -342,7 +342,7 @@ static StoragePtr create(const StorageFactory::Arguments & args) ast_replica_name = engine_args[arg_num]->as(); if (ast_replica_name && ast_replica_name->value.getType() == Field::Types::String) - replica_name = safeGet(ast_replica_name->value); + replica_name = ast_replica_name->value.safeGet(); else throw Exception( "Replica name must be a string literal" + getMergeTreeVerboseHelp(is_extended_storage_def), ErrorCodes::BAD_ARGUMENTS); @@ -654,7 +654,7 @@ static StoragePtr create(const StorageFactory::Arguments & args) const auto * ast = engine_args[arg_num]->as(); if (ast && ast->value.getType() == Field::Types::UInt64) - storage_settings->index_granularity = safeGet(ast->value); + storage_settings->index_granularity = ast->value.safeGet(); else throw Exception( "Index granularity must be a positive integer" + getMergeTreeVerboseHelp(is_extended_storage_def), diff --git a/src/Storages/WindowView/StorageWindowView.cpp b/src/Storages/WindowView/StorageWindowView.cpp index 76833b3e19a..7e0194ffd30 100644 --- a/src/Storages/WindowView/StorageWindowView.cpp +++ b/src/Storages/WindowView/StorageWindowView.cpp @@ -1127,7 +1127,7 @@ Pipe StorageWindowView::watch( if (query.limit_length) { has_limit = true; - limit = safeGet(typeid_cast(*query.limit_length).value); + limit = typeid_cast(*query.limit_length).value.safeGet(); } auto reader = std::make_shared( diff --git a/src/Storages/getStructureOfRemoteTable.cpp b/src/Storages/getStructureOfRemoteTable.cpp index 8acd7434d51..3d104ada0b6 100644 --- a/src/Storages/getStructureOfRemoteTable.cpp +++ b/src/Storages/getStructureOfRemoteTable.cpp @@ -196,8 +196,8 @@ ColumnsDescriptionByShardNum getExtendedObjectsOfRemoteTables( size_t size = name_col.size(); for (size_t i = 0; i < size; ++i) { - auto name = get(name_col[i]); - auto type_name = get(type_col[i]); + auto name = name_col[i].get(); + auto type_name = type_col[i].get(); auto storage_column = storage_columns.tryGetPhysical(name); if (storage_column && isObject(storage_column->type)) diff --git a/src/TableFunctions/TableFunctionRemote.cpp b/src/TableFunctions/TableFunctionRemote.cpp index 098756bcd7c..097a239ccae 100644 --- a/src/TableFunctions/TableFunctionRemote.cpp +++ b/src/TableFunctions/TableFunctionRemote.cpp @@ -107,7 +107,7 @@ void TableFunctionRemote::parseArguments(const ASTPtr & ast_function, ContextPtr if (lit->value.getType() != Field::Types::String) return false; - res = safeGet(lit->value); + res = lit->value.safeGet(); return true; };