-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Remove unused code and exception declarations #5461
Conversation
Thanks @leventov this is great housekeeping! I was surprised to learn that DataSegmentPuller isn't used anywhere 🌈⭐️ I don't see a reason to remove "redundant throws" in extension point interfaces. For example, this patch removes "throws Exception" in FirehoseV2's start method. Why? What's wrong with letting extensions throw exceptions there if they want to? I think this patch could be done in a non-incompatible way and it might even be better off like that. |
Okay, nevermind, it must be incompatible because of the removal of DataSegmentPuller. But I still am skeptical of the removal of |
@gianm this PR is going to be incompatible even if I return Exceptions to throws clauses at some places, because it removes |
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 didn't read the entire diff, but I skimmed around and noticed a couple issues. Please double-check to see if there are any similar issues to the @JsonProperty
one in RequestLogLine.
@JsonProperty("timestamp") | ||
public DateTime getCreatedTime() | ||
{ | ||
return request.getTimestamp(); |
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.
This method should stay, since it's part of the serialized JSON (same goes for anything @JsonProperty
).
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.
Reverted the method. There are no other occurrences when @JsonProperty
is removed in this PR
@@ -161,7 +161,7 @@ public ExecuteResult prepareAndExecute( | |||
final String sql, | |||
final long maxRowCount, | |||
final PrepareCallback callback | |||
) throws NoSuchStatementException |
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.
Instead of deleting the throws NoSuchStatementException
, probably getDruidStatement
should be changed to throw NoSuchStatementException instead of IllegalStateException when the statement is not found.
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.
Made this change. Also note that authConfig
is unused in DruidMeta
, that might be a sign of some problem.
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.
Thanks. I guess don't worry about authConfig in this PR. I'll double check what's going on there separately.
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.
It turns out they weren't necessary. #5483
@@ -1,3 +1,7 @@ | |||
<component name="DependencyValidationManager"> | |||
<scope name="UnusedInspectionsScope" pattern="src[druid-processing]:*..*" /> | |||
<scope name="UnusedInspectionsScope" pattern="src[java-util]:*..*" /> |
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.
this will need to changes if we merge #5490 first
@@ -41,5 +39,5 @@ | |||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") | |||
public interface FirehoseFactoryV2<T extends InputRowParser> | |||
{ | |||
FirehoseV2 connect(T parser, Object lastCommit) throws IOException, ParseException; | |||
FirehoseV2 connect(T parser, Object lastCommit) throws ParseException; |
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.
am wondering why we are removing IOException, seems reasonable that such method will throw IOException?
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.
Because nobody actually throwing it
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.
But it is legitimate kind of exception that maybe in the future or other external implementations will need it, FirehoseFactoryV2.java
is an extension point, IMO we should keep it.
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.
Reverted
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.
@leventov no further comments; I am good with this.
👍 after tests. |
Thanks for reviews |
I was using |
was also using some of the methods in |
And MapUtils. getLong |
This PR will need a special callout in the release notes that a lot of java-util functions were removed. |
Removes a lot, but still not all unused code in the project.
Labelled
Incompatible
because removes some exceptions from throws clauses of some methods in@ExtensionPoint
interfaces.