Fixed incorrect array_diff handling in query builder caching mechanism

Fixes #2697

Signed-off-by: Kakysha <ezhikvdele@gmail.com>