-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle corrupted Delta Lake tables with explicit table handle
Previously, a corrupted table handle was represented with a `DeltaLakeTableHandle` missing a `MetadataEntry`. When drop support for corrupted tables was implemented, a connector could have only one table handle class. This commit improves the distinction by introducing a dedicated table handle class to represent corrupted tables. As a necessity, this class is explicitly handled in multiple `DeltaLakeMetadata` methods. This sets viable example to follow for implementing drop support for corrupted Iceberg tables as a follow-up. Note: `testGetInsertLayoutTableNotFound` test was removed, instead of being updated, since `ConnectorMetadata.getInsertLayout` cannot be reached for a corrupted table, as getting column list will fail earlier.
- Loading branch information
Showing
14 changed files
with
144 additions
and
98 deletions.
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
38 changes: 38 additions & 0 deletions
38
...ino-delta-lake/src/main/java/io/trino/plugin/deltalake/CorruptedDeltaLakeTableHandle.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,38 @@ | ||
/* | ||
* 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.trino.plugin.deltalake; | ||
|
||
import io.trino.spi.TrinoException; | ||
import io.trino.spi.connector.ConnectorTableHandle; | ||
import io.trino.spi.connector.SchemaTableName; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public record CorruptedDeltaLakeTableHandle( | ||
SchemaTableName schemaTableName, | ||
TrinoException originalException) | ||
implements ConnectorTableHandle | ||
{ | ||
public CorruptedDeltaLakeTableHandle | ||
{ | ||
requireNonNull(schemaTableName, "schemaTableName is null"); | ||
requireNonNull(originalException, "originalException is null"); | ||
} | ||
|
||
public TrinoException createException() | ||
{ | ||
// Original exception originates from a different place. Create a new exception not to confuse reader with a stacktrace not matching call site. | ||
return new TrinoException(originalException.getErrorCode(), originalException.getMessage(), originalException); | ||
} | ||
} |
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.