-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return column structure in case of empty resultset #257
Comments
There is no easy way to do this using the HTTP interface, as ClickHouse doesn't return the column name or types in Native Format when the result set is empty. The driver would have to use a different format (such as JSONEachRow) for the query in order to be able to build the column structure. Note that the native interface used in If you know ahead of time that the query result will be empty (for example, with your LIMIT 0 example), maybe there could be something like a "structure only" query that would use the JSONEachRow format over HTTP. |
Hi @genzgd , Thanks for the reply. I have tagged the part of code which is returning the empty dataframe and would require an update here #119 |
Eventually it may make sense to switch the Pandas code to use Arrow instead of the ClickHouse Native format, in particular for Pandas 2.x, which is now backed by Arrow, but that's a pretty significant change. In the meantime I've opened a feature request ClickHouse/ClickHouse#55939 that would make this possible without major code changes, but I don't know if and when the ClickHouse team will get to it. |
Describe the bug
Return column structure in case of empty resultset
Steps to reproduce
Expected behaviour
Have a new setting, which will change behaviour in case of an empty result set being returned.
In case of pandas,
driver.query_df(ch_query)
should returnpd.DataFrame({'column1' : [] })
This was resolved in the previous driver here ClickHouse/ClickHouse#33522
The text was updated successfully, but these errors were encountered: