Skip to content

Commit

Permalink
Merge pull request OSGeo#10994 from rouault/arrow_gdalvsi
Browse files Browse the repository at this point in the history
Use 'gdalvsi://' protocol prefix (instead of 'vsi://') for Arrow VSI file system
  • Loading branch information
rouault authored Oct 12, 2024
2 parents 8a65aaf + ef76bb1 commit 8d9a397
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def test_ogr_arrow_vsi_arrow_file_system():
if version < 16:
pytest.skip("requires Arrow >= 16.0.0")

ogr.Open("vsi://data/arrow/test.feather")
ogr.Open("gdalvsi://data/arrow/test.feather")


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion autotest/ogr/ogr_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4108,7 +4108,7 @@ def test_ogr_parquet_vsi_arrow_file_system():
if version < 16:
pytest.skip("requires Arrow >= 16.0.0")

ds = ogr.Open("PARQUET:vsi://data/parquet/test.parquet")
ds = ogr.Open("PARQUET:gdalvsi://data/parquet/test.parquet")
lyr = ds.GetLayer(0)
assert lyr.GetFeatureCount() > 0

Expand Down
4 changes: 2 additions & 2 deletions doc/source/drivers/vector/arrow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ particular outside of the context of the OGR Arrow driver, by:
GetGDALDriverManager()->GetDriverByName("ARROW")->GetMetadata(), the Arrow VSI
file system will be also registered.

- Prefixing any GDAL file name with the ``vsi://`` URI scheme prefix. In addition
- Prefixing any GDAL file name with the ``gdalvsi://`` URI scheme prefix. In addition
to any potential vsi prefix in the GDAL file name. So the ``/vsicurl/http://example.com``
GDAL file name becomes the ``vsi:///vsicurl/http://example.com`` Arrow URI.
GDAL file name becomes the ``gdalvsi:///vsicurl/http://example.com`` Arrow URI.

Links
-----
Expand Down
7 changes: 4 additions & 3 deletions ogr/ogrsf_frmts/arrow/ogrfeatherdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ static GDALDataset *OGRFeatherDriverOpen(GDALOpenInfo *poOpenInfo)

GDALOpenInfo *poOpenInfoForIdentify = poOpenInfo;
std::unique_ptr<GDALOpenInfo> poOpenInfoTmp;
if (STARTS_WITH(poOpenInfo->pszFilename, "vsi://"))
if (STARTS_WITH(poOpenInfo->pszFilename, "gdalvsi://"))
{
poOpenInfoTmp = std::make_unique<GDALOpenInfo>(
poOpenInfo->pszFilename + strlen("vsi://"), poOpenInfo->nOpenFlags);
poOpenInfoTmp = std::make_unique<GDALOpenInfo>(poOpenInfo->pszFilename +
strlen("gdalvsi://"),
poOpenInfo->nOpenFlags);
poOpenInfoForIdentify = poOpenInfoTmp.get();
}

Expand Down
4 changes: 2 additions & 2 deletions ogr/ogrsf_frmts/arrow/ogrfeatherdrivercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ bool OGRFeatherDriverIsArrowFileFormat(GDALOpenInfo *poOpenInfo)

int OGRFeatherDriverIdentify(GDALOpenInfo *poOpenInfo)
{
if (STARTS_WITH(poOpenInfo->pszFilename, "vsi://"))
if (STARTS_WITH(poOpenInfo->pszFilename, "gdalvsi://"))
{
GDALOpenInfo oOpenInfo(poOpenInfo->pszFilename + strlen("vsi://"),
GDALOpenInfo oOpenInfo(poOpenInfo->pszFilename + strlen("gdalvsi://"),
poOpenInfo->nOpenFlags);
return OGRFeatherDriverIdentify(&oOpenInfo);
}
Expand Down
4 changes: 2 additions & 2 deletions ogr/ogrsf_frmts/arrow/vsifilesystemregistrar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ auto kVSIFileSystemModule = ARROW_REGISTER_FILESYSTEM(
[]()
{
CPLDebugOnly("ARROW", "Register VSI Arrow file system");
return "vsi";
return "gdalvsi";
}(),
[](const arrow::fs::Uri &uri, const arrow::io::IOContext & /* io_context */,
std::string *out_path)
-> arrow::Result<std::shared_ptr<arrow::fs::FileSystem>>
{
constexpr std::string_view kScheme = "vsi://";
constexpr std::string_view kScheme = "gdalvsi://";
if (out_path)
*out_path = uri.ToString().substr(kScheme.size());
return std::make_shared<VSIArrowFileSystem>("ARROW", std::string());
Expand Down

0 comments on commit 8d9a397

Please sign in to comment.