Skip to content

unexpected physical and logical schema error caused by count() #18052

@fionwi

Description

@fionwi

Describe the bug

I am using Flight SQL to query data in Grafana and am now receiving an error code for a query that has been running without problems for several weeks.

This is what happens in the last select statement:

SELECT                                                                        
selector_first("ID_filled", time)['time'] AS time,                      
"ID_filled" AS "ID", 
COUNT("ProductionTime") AS "ProductionTimeCount"                     
FROM FilteredData
GROUP BY "ID_filled"
ORDER BY  time;

With this select statement I am receiving this error:

flightsql: rpc error: code = Internal desc = Error while planning query: Internal error: Physical input schema should be the same as the one converted from logical input schema. Differences: . This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues

The bug seems to be caused by the column "ProductionTime" that should be counted in the last select. If I adjust the query and just change COUNT("ProductionTime") to COUNT("PreviousProductionTime"), I get a suitable output. I make sure that the column data has the right datatype and I already tried to cast directly in the count function. Also "PreviousProductionTime" has the same datatype and same amount of datapoints as "ProductionTime".

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions