import org.apache.paimon.catalog.Catalog;
import org.apache.paimon.catalog.FileSystemCatalog;
import org.apache.paimon.catalog.Identifier;
import org.apache.paimon.schema.TableSchema;
import org.apache.paimon.table.Table;
public class GetTable {
public static Table getTable() {
Identifier identifier = Identifier.create("my_db", "my_table");
try {
FileSystemCatalog catalog = CreateCatalog.createFilesystemCatalog();
catalog.getDataTableSchema(identifier);
return catalog.getTable(identifier);
} catch (Catalog.TableNotExistException e) {
// do something
throw new RuntimeException("table not exist");
}
}
public static TableSchema getTableSchema() {
Identifier identifier = Identifier.create("my_db", "my_table");
try {
FileSystemCatalog catalog = CreateCatalog.createFilesystemCatalog();
return catalog.getDataTableSchema(identifier);
} catch (Catalog.TableNotExistException e) {
// do something
throw new RuntimeException("table not exist");
}
}
}
java api获取paimon表的schema
最新推荐文章于 2025-03-10 10:10:25 发布