Skip to content

ParserError when "WITHIN GROUP" is specified in SELECT #528

@crescendo-medix

Description

@crescendo-medix

Describe the bug
The following SQL will result in a parser error.
SELECT MODE() WITHIN GROUP (ORDER BY median_house_value) FROM california_table.

WITHIN GROUP not supported ?

To Reproduce

import datafusion
ctx = datafusion.SessionContext()
datafusion.__version__

32.0.0

ctx.register_csv('california_table', 'california_housing_train.csv')
ctx.table('california_table').schema()

longitude: double
latitude: double
housing_median_age: double
total_rooms: double
total_bedrooms: double
population: double
households: double
median_income: double
median_house_value: double

sql = 'SELECT MODE() WITHIN GROUP (ORDER BY median_house_value) FROM california_table'
ctx.sql(sql)

Exception           Traceback (most recent call last)
Input In [3], in
          1 sql = 'SELECT MODE() WITHIN GROUP (ORDER BY median_house_value) FROM california_table'
----> 2 ctx.sql(sql)

Exception: DataFusion error: SQL(ParserError("Expected end of statement, found: GROUP"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions