-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Support IF EXISTS keyword on DROP CONNECTOR #6067
Conversation
|
||
@Override | ||
public String toString() { | ||
return "ErrorEntity{" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean WarningEntity here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, could you also post a sample CLI output in the PR description of what the warning response would look like?
return "DropConnector{" | ||
+ "connectorName='" + connectorName + '\'' | ||
+ '}'; | ||
return toStringHelper(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we're switching to using this toStringHelper function now? There seems to be a mix of using this method vs defining out manually what the string representation looks like for different AstNodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not particularly, just thought it looked neater especially now that there is more than one field.
final ConnectResponse<String> response = | ||
serviceContext.getConnectClient().delete(connectorName); | ||
|
||
if (response.error().isPresent()) { | ||
return Optional.of(new ErrorEntity(statement.getStatementText(), response.error().get())); | ||
if (ifExists && response.httpCode() == 404) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use HttpStatus.SC_NOT_FOUND
instead of just 404
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, LGTM. I just left a minor comment.
* feat: Support IF EXISTS keyword on DROP CONNECTOR * fix: review comments Co-authored-by: Zara Lim <[email protected]>
Description
Fixes #5988
Added
IF EXISTS
keyword to theDROP CONNECTOR
command.Previously, this error message would have shown if the connector does not exist:
With this change, if the
IF EXISTS
keyword is used, the response is:If the
IF EXISTS
keyword is not used, the response is the original error response.I added a new
Entity
class calledWarningEntity
that prints a message without the Error header. It could also be used in other similar situations, such as #5992.Testing done
Added tests to
DropConnectorExecutorTest.java
Reviewer checklist