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 a890c0cc97 [pvfs] Support inline endpoint in pvfs uri, like
pvfs://catalog.endpoint/ (#6003)
a890c0cc97 is described below
commit a890c0cc97d52710970bb6cf370d2ae764cb1037
Author: timmyyao <[email protected]>
AuthorDate: Fri Aug 1 10:06:57 2025 +0800
[pvfs] Support inline endpoint in pvfs uri, like pvfs://catalog.endpoint/
(#6003)
---
.../paimon/vfs/hadoop/PaimonVirtualFileSystem.java | 20 ++++++++++++++++++--
.../hadoop/MockRestNoCacheVirtualFileSystemTest.java | 13 +++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git
a/paimon-vfs/paimon-vfs-hadoop/src/main/java/org/apache/paimon/vfs/hadoop/PaimonVirtualFileSystem.java
b/paimon-vfs/paimon-vfs-hadoop/src/main/java/org/apache/paimon/vfs/hadoop/PaimonVirtualFileSystem.java
index 5cac693539..3687460d2c 100644
---
a/paimon-vfs/paimon-vfs-hadoop/src/main/java/org/apache/paimon/vfs/hadoop/PaimonVirtualFileSystem.java
+++
b/paimon-vfs/paimon-vfs-hadoop/src/main/java/org/apache/paimon/vfs/hadoop/PaimonVirtualFileSystem.java
@@ -67,6 +67,9 @@ public class PaimonVirtualFileSystem extends FileSystem {
super.initialize(uri, conf);
this.workingDirectory = new Path(uri);
+ if (uri.getAuthority() == null || uri.getAuthority().isEmpty()) {
+ throw new IllegalArgumentException("URI authority is empty: " +
uri);
+ }
this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority() +
"/");
initVFSOperations();
@@ -74,8 +77,21 @@ public class PaimonVirtualFileSystem extends FileSystem {
private void initVFSOperations() {
Options options =
PaimonVirtualFileSystemConfiguration.convertToCatalogOptions(conf);
- // pvfs://catalog_name/database_name/table_name/file, so uri authority
is catalog name
- options.set(CatalogOptions.WAREHOUSE, uri.getAuthority());
+ String authority = uri.getAuthority();
+ int delimiterIndex = authority.indexOf(".");
+ if (delimiterIndex == 0 || delimiterIndex == authority.length() - 1) {
+ throw new IllegalArgumentException("Invalid URI authority: " +
uri);
+ }
+ if (delimiterIndex < 0) {
+ // pvfs://catalog_name/database_name/table_name/file, so uri
authority is catalog name
+ options.set(CatalogOptions.WAREHOUSE, authority);
+ } else {
+ // pvfs://catalog_name.endpoint/database_name/table_name/file
+ String catalogName = authority.substring(0, delimiterIndex);
+ String endpoint = authority.substring(delimiterIndex + 1);
+ options.set(CatalogOptions.WAREHOUSE, catalogName);
+ options.set(RESTCatalogOptions.URI, endpoint);
+ }
// Set user agent
options.set(RESTCatalogOptions.HTTP_USER_AGENT, USER_AGENT);
diff --git
a/paimon-vfs/paimon-vfs-hadoop/src/test/java/org/apache/paimon/vfs/hadoop/MockRestNoCacheVirtualFileSystemTest.java
b/paimon-vfs/paimon-vfs-hadoop/src/test/java/org/apache/paimon/vfs/hadoop/MockRestNoCacheVirtualFileSystemTest.java
index 28d0a02335..c1d8ec3a78 100644
---
a/paimon-vfs/paimon-vfs-hadoop/src/test/java/org/apache/paimon/vfs/hadoop/MockRestNoCacheVirtualFileSystemTest.java
+++
b/paimon-vfs/paimon-vfs-hadoop/src/test/java/org/apache/paimon/vfs/hadoop/MockRestNoCacheVirtualFileSystemTest.java
@@ -30,12 +30,21 @@ public class MockRestNoCacheVirtualFileSystemTest extends
MockRestVirtualFileSys
@Override
protected void initFs() throws Exception {
Configuration conf = new Configuration();
- conf.set("fs.pvfs.uri", restCatalogServer.getUrl());
+ // With inline endpoint in uri
+ String endpoint = restCatalogServer.getUrl();
+ if (endpoint.startsWith("http://")) {
+ endpoint = endpoint.substring("http://".length());
+ }
+ if (endpoint.endsWith("/")) {
+ endpoint = endpoint.substring(0, endpoint.length() - 1);
+ }
+
conf.set("fs.pvfs.token.provider", AuthProviderEnum.BEAR.identifier());
conf.set("fs.pvfs.token", initToken);
+ // Disable table cache
conf.setBoolean("fs.pvfs.cache-enabled", false);
this.vfs = new PaimonVirtualFileSystem();
- this.vfsRoot = new Path("pvfs://" + restWarehouse + "/");
+ this.vfsRoot = new Path("pvfs://" + restWarehouse + "." + endpoint +
"/");
this.vfs.initialize(vfsRoot.toUri(), conf);
Assert.assertFalse(((PaimonVirtualFileSystem) vfs).isCacheEnabled());