Skip to content

Get ResultSet meta data before execution#1434

Closed
zhicwu wants to merge 1 commit intomainfrom
meta-data
Closed

Get ResultSet meta data before execution#1434
zhicwu wants to merge 1 commit intomainfrom
meta-data

Conversation

@zhicwu
Copy link
Contributor

@zhicwu zhicwu commented Aug 28, 2023

Summary

Get ResultSet meta data before execution

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@zhicwu zhicwu marked this pull request as draft August 28, 2023 14:19
@zhicwu zhicwu linked an issue Aug 28, 2023 that may be closed by this pull request
public void testGetMetaData() throws SQLException {
try (Connection conn = newConnection(new Properties());
PreparedStatement ps = conn.prepareStatement("select ? a, ? b")) {
ResultSetMetaData md = ps.getMetaData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we pass DDL (e.g. CREATE TABLE) to conn.prepareStatement? It would be nice to add a test in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking your time to review the PR!

What happens if we pass DDL (e.g. CREATE TABLE) to conn.prepareStatement?

null will be returned at this point. Below is the check in SqlBasedPreparedStatement.java. However, in ClickHouse, create table on cluster will actually return ResultSet, but I guess we don't need that as it's not helping for push-down implementation.

if (parsedStmt.isRecognized() && !parsedStmt.isQuery()) {
    return null;
}

It would be nice to add a test in my opinion.

Yes, the implementation is incomplete and I'll add more tests for sure.

@sylph-eu
Copy link
Contributor

Hi, any plans to complete this PR?

@sylph-eu
Copy link
Contributor

JFYI #1700

@github-actions
Copy link

github-actions bot commented Jan 8, 2025

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jan 8, 2025
@github-actions
Copy link

This pull request has been automatically closed because it has not had any further activity in the last 2 weeks. Thank you for your contributions!

@github-actions github-actions bot closed this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to get ResultSetMetaData in ClickHousePreparedStatement

3 participants