arina-ielchiieva commented on a change in pull request #2010: DRILL-7620: Fix
plugin mutability issues
URL: https://github.com/apache/drill/pull/2010#discussion_r391470413
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileFormatConfig.java
##########
@@ -20,35 +20,42 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList;
-
+import org.apache.drill.common.PlanStringBuilder;
import org.apache.drill.common.logical.FormatPluginConfig;
import java.util.List;
+import java.util.Objects;
@JsonTypeName("sequencefile") @JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class SequenceFileFormatConfig implements FormatPluginConfig {
public List<String> extensions = ImmutableList.of();
- @Override
- public int hashCode() {
- return (extensions == null)? 0 : extensions.hashCode();
- }
-
public List<String> getExtensions() {
return extensions;
}
+ @Override
+ public int hashCode() {
+ return Objects.hash(extensions);
+ }
+
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
- } else if (obj == null) {
+ }
+ if (obj == null || getClass() != obj.getClass()) {
return false;
- } else if (getClass() == obj.getClass()) {
- SequenceFileFormatConfig other = (SequenceFileFormatConfig) obj;
- return (extensions == null)? (other.extensions == null) :
extensions.equals(other.extensions);
}
- return false;
+ SequenceFileFormatConfig other = (SequenceFileFormatConfig) obj;
+ return Objects.equals(extensions, other.extensions);
+ }
+
+ @Override
+ public String toString() {
+ return new PlanStringBuilder(this)
+ .field("extensions", extensions)
+ .toString();
}
}
Review comment:
Please add new line
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services