This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 89c86286b4 [core] Do not throw exception of fall back branch is not
exist (#5376)
89c86286b4 is described below
commit 89c86286b46182a53543ceb7996e9fd9c1ac629d
Author: YeJunHao <[email protected]>
AuthorDate: Mon Mar 31 19:06:41 2025 +0800
[core] Do not throw exception of fall back branch is not exist (#5376)
---
.../apache/paimon/table/FileStoreTableFactory.java | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java
b/paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java
index afd6ce7da9..afa7a5f3b0 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java
@@ -27,16 +27,20 @@ import org.apache.paimon.schema.SchemaManager;
import org.apache.paimon.schema.TableSchema;
import org.apache.paimon.utils.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Optional;
import static org.apache.paimon.CoreOptions.PATH;
-import static org.apache.paimon.utils.Preconditions.checkArgument;
/** Factory to create {@link FileStoreTable}. */
public class FileStoreTableFactory {
+ private static final Logger LOG =
LoggerFactory.getLogger(FileStoreTableFactory.class);
+
public static FileStoreTable create(CatalogContext context) {
FileIO fileIO;
try {
@@ -98,16 +102,14 @@ public class FileStoreTableFactory {
branchOptions.set(CoreOptions.BRANCH, fallbackBranch);
Optional<TableSchema> schema =
new SchemaManager(fileIO, tablePath,
fallbackBranch).latest();
- checkArgument(
- schema.isPresent(),
- "Cannot set '%s' = '%s' because the branch '%s' isn't
existed.",
- CoreOptions.SCAN_FALLBACK_BRANCH.key(),
- fallbackBranch,
- fallbackBranch);
- FileStoreTable fallbackTable =
- createWithoutFallbackBranch(
- fileIO, tablePath, schema.get(), branchOptions,
catalogEnvironment);
- table = new FallbackReadFileStoreTable(table, fallbackTable);
+ if (schema.isPresent()) {
+ FileStoreTable fallbackTable =
+ createWithoutFallbackBranch(
+ fileIO, tablePath, schema.get(),
branchOptions, catalogEnvironment);
+ table = new FallbackReadFileStoreTable(table, fallbackTable);
+ } else {
+ LOG.error("Fallback branch {} not found for table {}",
fallbackBranch, tablePath);
+ }
}
return table;