Skip to content

[clickhouse-jdbc] describe SELECT queries to retrieve metadata#1700

Merged
chernser merged 1 commit intoClickHouse:mainfrom
sylph-eu:implement_get_metadata_for_non_executed_query
Jun 25, 2024
Merged

[clickhouse-jdbc] describe SELECT queries to retrieve metadata#1700
chernser merged 1 commit intoClickHouse:mainfrom
sylph-eu:implement_get_metadata_for_non_executed_query

Conversation

@sylph-eu
Copy link
Contributor

@sylph-eu sylph-eu commented Jun 20, 2024

Summary

This is an attempt to reanimate #1434 to enable getMetadata() method to return metadata for a prepared SELECT query that hasn't yet been executed. Also see #1430 .

This functionality is needed (among other use-cases) to support query passthrough for clickhouse-connector inside Trino.

Implementation

DESCRIBE (<select>) is used to retrieve metadata about SELECT query that hasn't yet been executed.

Contrary to #1434 the method requires the query to be "recognized" and be SELECT, thus removing the ambiguity of supporting different query types. Otherwise it wraps the query inside DESCRIBE () clause to build respective metadata object.

Additional unit tests were added to address remarks to the original PR.

Checklist

Delete items not relevant to your PR:

  • [X ] Unit and integration tests covering the common scenarios were added
  • [X ] A human-readable description of the changes was provided to include in CHANGELOG

cc: @zhicwu , @ebyhr

@mshustov mshustov requested a review from chernser June 20, 2024 15:23
@chernser chernser merged commit abe31c6 into ClickHouse:main Jun 25, 2024
@chernser
Copy link
Contributor

@sylph-eu Thank you for the contribution!

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 this pull request may close these issues.

2 participants