HF RL Explorer

Strip unused annotations from count queries Description

Strip unused annotations from count queries Description: a task in Lego-RL-SWE-Bench-Verified (Harbor dataset). The query below produces a SQL statement that includes the Count('chapters'), despite not not being used in any filter operations. Book.objects.annotate(Count('chapters')).count() It…

The task

The query below produces a SQL statement that includes the Count('chapters'), despite not not being used in any filter operations. Book.objects.annotate(Count('chapters')).count() It produces the same results as: Book.objects.count() Django could be more intelligent about what annotations to include in the query…

Part of Lego-X/Lego-RL-SWE-Bench-Verified.