Repository: ClickHouse/ClickHouse
File: src/Storages/StorageMergeTreeTextIndex.cpp (C++)

Code before:
        dictionary_buf.reset();
        sparse_index = {};
        matching_blocks.clear();
        next_matching_block = 0;

        while (true)
        {
            size_t idx = part_index->fetch_add(1, std::memory_order_relaxed);
            if (idx >= data_parts->size())
                return false;

            const auto & part = (*data_parts)[idx];
            const auto & storage = part->getDataPartStorage();

            if (token_key_condition)
            {
                auto [stream_name, extension] = index_streams.at(MergeTreeIndexSubstream::Type::Regular);

                /// Skip part if index is not materialized in the part.
                /// Check for both original and hashed filenames (hashed if the index name is too long).
                auto actual_sparse_index_name = IMergeTreeDataPart::getStreamNameOrHash(stream_name, extension, part->checksums);
                if (!actual_sparse_index_name)
                    continue;

                auto sparse_file_name = *actual_sparse_index_name + extension;
                auto idx_file = storage.readFile(sparse_file_name, read_settings, storage.getFileSize(sparse_file_name));

                CompressedReadBufferFromFile idx_buf(std::move(idx_file));
                sparse_index = TextIndexSerialization::deserializeSparseIndex(idx_buf);

                if (sparse_index.empty())
                    continue;

                computeMatchingBlocks();
                if (matching_blocks.empty())
                    continue;
            }

            auto [stream_name, extension] = index_streams.at(MergeTreeIndexSubstream::Type::TextIndexDictionary);

            /// Skip part if index is not materialized in the part.
            /// Check for both original and hashed filenames (hashed if the index name is too long).
            auto actual_dict_name = IMergeTreeDataPart::getStreamNameOrHash(stream_name, extension, part->checksums);
            if (!actual_dict_name)
                continue;

            auto dict_file_name = *actual_dict_name + extension;
            auto dict_file = storage.readFile(dict_file_name, read_settings, storage.getFileSize(dict_file_name));

            dictionary_buf = std::make_unique<CompressedReadBufferFromFile>(std::move(dict_file));
            current_part_name = part->name;

Review comment (suggestion):
```suggestion
                auto idx_file = storage.readFile(sparse_file_name, read_settings, part->checksums.files.at(sparse_file_name).file_size);
```

Code after:
        dictionary_buf.reset();
        sparse_index = {};
        matching_blocks.clear();
        next_matching_block = 0;

        while (true)
        {
            size_t idx = part_index->fetch_add(1, std::memory_order_relaxed);
            if (idx >= data_parts->size())
                return false;

            const auto & part = (*data_parts)[idx];
            const auto & storage = part->getDataPartStorage();

            if (token_key_condition)
            {
                auto [stream_name, extension] = index_streams.at(MergeTreeIndexSubstream::Type::Regular);

                /// Skip part if index is not materialized in the part.
                /// Check for both original and hashed filenames (hashed if the index name is too long).
                auto actual_sparse_index_name = IMergeTreeDataPart::getStreamNameOrHash(stream_name, extension, part->checksums);
                if (!actual_sparse_index_name)
                    continue;

                auto sparse_file_name = *actual_sparse_index_name + extension;
                auto idx_file = storage.readFile(sparse_file_name, read_settings, part->checksums.files.at(sparse_file_name).file_size);

                CompressedReadBufferFromFile idx_buf(std::move(idx_file));
                sparse_index = TextIndexSerialization::deserializeSparseIndex(idx_buf);

                if (sparse_index.empty())
                    continue;

                computeMatchingBlocks();
                if (matching_blocks.empty())
                    continue;
            }

            auto [stream_name, extension] = index_streams.at(MergeTreeIndexSubstream::Type::TextIndexDictionary);

            /// Skip part if index is not materialized in the part.
            /// Check for both original and hashed filenames (hashed if the index name is too long).
            auto actual_dict_name = IMergeTreeDataPart::getStreamNameOrHash(stream_name, extension, part->checksums);
            if (!actual_dict_name)
                continue;

            auto dict_file_name = *actual_dict_name + extension;
            auto dict_file = storage.readFile(dict_file_name, read_settings, part->checksums.files.at(dict_file_name).file_size);

            dictionary_buf = std::make_unique<CompressedReadBufferFromFile>(std::move(dict_file));
            current_part_name = part->name;