-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.2][Kernel] Handle
KernelEngineException
when reading the `_last_…
…checkpoint` file (#3086) There is an issue with the `CloseableIterator` interface that Kernel is using. Currently, it extends Java's `iterator`, which doesn't throw any exceptions. We use `CloseableIterator` when returning data read from a file or any incremental data access. Any `IOException` in `hasNext` or `next` is wrapped in a `UncheckedIOException` or `RuntimeException`. Users of the `CloseableIterator` need to catch for `UncheckedIOException` or `RuntimeException` explicitly and look at the cause if they are interested in the `IOException`. This is not consistent and causes problems for the code that want to handle exceptions like `FileNotFoundException` (subclass of `IOException`) and take further actions. * Change the `CloseableIterator.{next, hasNext}` contract to expect `KernelEngineException` for any exceptions that occur while executing in the `Engine`. * Update the `DefaultParquetHandler` and `DefaultJsonHandler` to throw `KernelEngineException` instead of `UncheckedIOException` or `RuntimeException`. * In the checkpoint metadata loading method, catch `KernelEngineException` and see if the cause is `FileNotFoundException.` If yes, don't retry loading.
- Loading branch information
1 parent
a7e65c9
commit 2c444a2
Showing
8 changed files
with
185 additions
and
43 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
kernel/kernel-api/src/main/java/io/delta/kernel/exceptions/KernelEngineException.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,30 @@ | ||
/* | ||
* Copyright (2024) The Delta Lake Project Authors. | ||
* | ||
* Licensed 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 io.delta.kernel.exceptions; | ||
|
||
import io.delta.kernel.engine.Engine; | ||
|
||
/** | ||
* Throws when the {@link Engine} encountered an error while executing an operation. | ||
*/ | ||
public class KernelEngineException extends RuntimeException { | ||
private static final String msgTemplate = "Encountered an error from the underlying engine " + | ||
"implementation while trying to %s: %s"; | ||
|
||
public KernelEngineException(String attemptedOperation, Throwable cause) { | ||
super(String.format(msgTemplate, attemptedOperation, cause.getMessage()), cause); | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.