To successfully perform a union-based SQL injection, an attacker needs to know the number of columns in the original query.
Source: SQL Injection/MySQL Injection.md in PayloadsAllTheThings. From PayloadsAllTheThings by Swissky and contributors. MIT License, Copyright (c) 2019 Swissky.