Skip to content

Positional arguments in group by not being properly inferred in subqueries with select * #56466

Closed

Description

@priera

Describe the issue
A GROUP BY clause with positional arguments will report error when it is nested within a subquery.

How to reproduce
Extract from this fiddle:

SELECT *
FROM
(
	SELECT *
	FROM
	(
    	SELECT
        	name,
        	age
    	FROM users
	)
	GROUP BY
    	1,
    	2
)

reports the following error:
DB::Exception: Illegal value for positional argument in GROUP BY: While processing SELECT * FROM (SELECT name, age FROM users) GROUP BY 1, 2. (ILLEGAL_TYPE_OF_ARGUMENT)

Expected behavior:

Alice	50
John	33
Ksenia	48

Additional context

  • This functionality worked in versions prior to 22.12. Appears to be broken since then.
  • Replacing the positional arguments with the column names works as expected
  • It also works when enabling the experimental analyzer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions