Instead of directly joining the comments table, there should be a comment provider method equivalent to \core_rating\privacy\provider::get_sql_join, which allows this to be fetched.
Examples of affected methods are provider::get_contexts_for_userid methods for mod_data and mod_glossary.
Once created, affected provider::get_contexts_for_userid methods will need to be found and corrected.
There are also some provider::get_contexts_for_userid methods that join the rating table directly, instead of using the rating provider's get_sql_join method, which should be fixed at the same time (for example, mod_data).