Skip to content
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

How to get ResultSetMetaData in ClickHousePreparedStatement #1430

Open
suhli opened this issue Aug 28, 2023 · 3 comments · May be fixed by #1434
Open

How to get ResultSetMetaData in ClickHousePreparedStatement #1430

suhli opened this issue Aug 28, 2023 · 3 comments · May be fixed by #1434
Assignees

Comments

@suhli
Copy link

suhli commented Aug 28, 2023

Is there any way to get the result set metadata without execution like issue #235 ?
I check codes main branch, seems like the reference file change ClickHousePreparedStatementImpl.java with PR #288 has been deprecated

@zhicwu
Copy link
Contributor

zhicwu commented Aug 28, 2023

Hi @suhli, could you share the use case? Did you mean ParameterMetaData?

@suhli
Copy link
Author

suhli commented Aug 28, 2023

Hi @suhli, could you share the use case? Did you mean ParameterMetaData?

I'm using Trino as middleware provides the ability to query across different databases.
Yet in some cases, I need to pass the original sql to downstream databases. eg: some json query(Trino will not pushdown filter in some case)
I found the following comments in Trino clickhouse plugin testcase that describe the reason(it has been delete in main branch,yet still not support):

// table function disabled for ClickHouse, because it doesn't provide ResultSetMetaData, so the result relation type cannot be determined

support native

reason


To be exact,what they need is ResultSetMetaData in PrepareStatement before query execution.
source

@zhicwu
Copy link
Contributor

zhicwu commented Aug 28, 2023

Thank you for the additional context. Since this is for a push-down query, it would not be ideal to execute the full query just to retrieve the ResultSetMetaData for type inference. Actually I'm also concerned about when to release ResultSet in the original fix. Anyway, as an optimization, we could usedesc (<original query>) instead. I'll fix this tonight along with other minor issues.

@zhicwu zhicwu linked a pull request Aug 28, 2023 that will close this issue
3 tasks
@zhicwu zhicwu self-assigned this Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants