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

No-op flags #2030

Merged
merged 2 commits into from
Dec 17, 2024
Merged

No-op flags #2030

merged 2 commits into from
Dec 17, 2024

Conversation

Paultagoras
Copy link
Contributor

@Paultagoras Paultagoras commented Dec 17, 2024

Summary

We should obey the no-op flag for unsupported features where possible.

Checklist

Delete items not relevant to your PR:

  • Closes issue
  • 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

@Paultagoras Paultagoras self-assigned this Dec 17, 2024
@@ -118,14 +118,22 @@ public PreparedStatement prepareStatement(String sql) throws SQLException {
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
checkOpen();
throw new SQLFeatureNotSupportedException("CallableStatement not supported", ExceptionUtils.SQL_STATE_FEATURE_NOT_SUPPORTED);
if (!config.isIgnoreUnsupportedRequests()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would think this is totally valid exception because if this is called then NPE will be thrown anyway.
In most cases we can ignore parameters, but not a whole functionality.

throw new SQLFeatureNotSupportedException("nativeSQL not supported", ExceptionUtils.SQL_STATE_FEATURE_NOT_SUPPORTED);
}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

may be return the same sql? + javadoc that it is not implemented according to the spec if flag is true

throw new SQLFeatureNotSupportedException("CallableStatement not supported", ExceptionUtils.SQL_STATE_FEATURE_NOT_SUPPORTED);
}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

the same - this is whole functionality and it will be NPE anyway. so Exception should be thrown all the time

throw new SQLFeatureNotSupportedException("getTypeMap not supported", ExceptionUtils.SQL_STATE_FEATURE_NOT_SUPPORTED);
}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

This kind of missing functionality. I would return an empty map at least to not cause NPE.
But we need to create an issue and fill this properly

}

@Override
public int getNetworkTimeout() throws SQLException {
//TODO: Should this be supported?
throw new SQLFeatureNotSupportedException("getNetworkTimeout not supported", ExceptionUtils.SQL_STATE_FEATURE_NOT_SUPPORTED);
if (!config.isIgnoreUnsupportedRequests()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

seems something missing

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean it may be a useful timeout - we should take it from client.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
7.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@Paultagoras Paultagoras merged commit 19172f6 into main Dec 17, 2024
61 of 62 checks passed
@Paultagoras Paultagoras deleted the add-noop-flags branch December 17, 2024 17:24
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