This is an automated email from the ASF dual-hosted git repository.
wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 47ca1f0613c [SQL][MINOR] Re-generate equals/hashCode of IdentifierImpl
with non-null optimization
47ca1f0613c is described below
commit 47ca1f0613c1817cd356c56649de4c7a8de3081b
Author: Wenchen Fan <[email protected]>
AuthorDate: Wed Sep 21 10:50:17 2022 +0800
[SQL][MINOR] Re-generate equals/hashCode of IdentifierImpl with non-null
optimization
### What changes were proposed in this pull request?
This is a very minor PR. I re-generated the `equals/hashCode` methods of
`IdentifierImpl` with Intellij, marking the fields as non-nullable. This
generates more efficient implementation.
### Why are the changes needed?
small improvement.
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
existing tests
Closes #37944 from cloud-fan/minor.
Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
---
.../apache/spark/sql/connector/catalog/IdentifierImpl.java | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/IdentifierImpl.java
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/IdentifierImpl.java
index d9c696ab811..c7aceecabac 100644
---
a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/IdentifierImpl.java
+++
b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/IdentifierImpl.java
@@ -64,20 +64,16 @@ class IdentifierImpl implements Identifier {
@Override
public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
+ if (this == o) return true;
+ if (!(o instanceof IdentifierImpl)) return false;
IdentifierImpl that = (IdentifierImpl) o;
return Arrays.equals(namespace, that.namespace) && name.equals(that.name);
}
@Override
public int hashCode() {
- return Objects.hash(Arrays.hashCode(namespace), name);
+ int result = Objects.hash(name);
+ result = 31 * result + Arrays.hashCode(namespace);
+ return result;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]