-
Notifications
You must be signed in to change notification settings - Fork 28k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-31584][WEBUI] Fix NullPointerException when parsing event log …
…with InMemoryStore ### What changes were proposed in this pull request? #27716 introduced parent index for InMemoryStore. When the method "deleteParentIndex(Object key)" in InMemoryStore.java is called and the key is not contained in "NaturalKeys v", A java.lang.NullPointerException will be thrown. This patch fixed the issue by updating the if condition. ### Why are the changes needed? Fixed a minor bug. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Added a unit test for deleteParentIndex. Closes #28378 from baohe-zhang/SPARK-31584. Authored-by: Baohe Zhang <baohe.zhang@verizonmedia.com> Signed-off-by: Gengliang Wang <gengliang.wang@databricks.com> (cherry picked from commit 3808014) Signed-off-by: Gengliang Wang <gengliang.wang@databricks.com>
- Loading branch information
1 parent
da8c7b8
commit 0058212
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
common/kvstore/src/test/java/org/apache/spark/util/kvstore/CustomType2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.util.kvstore; | ||
|
||
public class CustomType2 { | ||
|
||
@KVIndex(parent = "parentId") | ||
public String key; | ||
|
||
@KVIndex("id") | ||
public String id; | ||
|
||
@KVIndex("parentId") | ||
public String parentId; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (o instanceof CustomType2) { | ||
CustomType2 other = (CustomType2) o; | ||
return id.equals(other.id) && parentId.equals(other.parentId); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return id.hashCode() ^ parentId.hashCode(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CustomType2[key=" + key + ",id=" + id + ",parentId=" + parentId; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters