Skip to content

Commit

Permalink
Merge pull request #9529 from rouault/minimum_support_tiledb_2_21
Browse files Browse the repository at this point in the history
Minimal support for TileDB 2.21 to avoid build & test issues
  • Loading branch information
rouault authored Mar 22, 2024
2 parents 7b43d55 + be080dc commit c3360b3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autotest/ogr/ogr_tiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,15 +1069,15 @@ def test_ogr_tiledb_create_group():

ds = ogr.Open("tmp/test.tiledb", update=1)
assert ds.TestCapability(ogr.ODsCCreateLayer)
lyr = ds.CreateLayer("test/3", options=["BOUNDS=-1e4,-1e4,1e4,1e4"])
lyr = ds.CreateLayer("test3", options=["BOUNDS=-1e4,-1e4,1e4,1e4"])
assert lyr
ds = None

assert os.path.exists("tmp/test.tiledb/layers/test/3")
assert os.path.exists("tmp/test.tiledb/layers/test3")

ds = ogr.Open("tmp/test.tiledb")
assert ds.GetLayerCount() == 3
lyr = ds.GetLayerByName("test/3")
lyr = ds.GetLayerByName("test3")
assert lyr
ds = None

Expand Down
5 changes: 5 additions & 0 deletions frmts/tiledb/include_tiledb.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,9 @@
#define HAS_TILEDB_MULTIDIM
#endif

#if TILEDB_VERSION_MAJOR > 2 || \
(TILEDB_VERSION_MAJOR == 2 && TILEDB_VERSION_MINOR >= 21)
#define HAS_TILEDB_GEOM_WKB_WKT
#endif

#endif // INCLUDE_TILEDB_H
4 changes: 4 additions & 0 deletions frmts/tiledb/tiledbmultidimarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ TileDBArray::TileDBDataTypeToGDALDataType(tiledb_datatype_t tiledb_dt)
case TILEDB_TIME_AS:
case TILEDB_BLOB:
case TILEDB_BOOL:
#ifdef HAS_TILEDB_GEOM_WKB_WKT
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
#endif
{
break;
}
Expand Down
16 changes: 16 additions & 0 deletions frmts/tiledb/tiledbsparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,18 @@ OGRTileDBDataset::ICreateLayer(const char *pszName,
return nullptr;
}

#ifdef HAS_TILEDB_GROUP
if (!m_osGroupName.empty() && strchr(pszName, '/'))
{
// Otherwise a layer name wit ha slash when groups are enabled causes
// a "[TileDB::Array] Error: FragmentID: input URI is invalid. Provided URI does not contain a fragment name."
// exception on re-opening starting with TileDB 2.21
CPLError(CE_Failure, CPLE_NotSupported,
"Slash is not supported in layer name");
return nullptr;
}
#endif

const auto eGType = poGeomFieldDefn ? poGeomFieldDefn->GetType() : wkbNone;
const auto poSpatialRef =
poGeomFieldDefn ? poGeomFieldDefn->GetSpatialRef() : nullptr;
Expand Down Expand Up @@ -832,6 +844,10 @@ bool OGRTileDBLayer::InitFromStorage(tiledb::Context *poCtx,
case TILEDB_TIME_FS:
case TILEDB_TIME_AS:
case TILEDB_ANY:
#ifdef HAS_TILEDB_GEOM_WKB_WKT
case TILEDB_GEOM_WKB: // TODO: take that into account
case TILEDB_GEOM_WKT:
#endif
{
// TODO ?
const char *pszTypeName = "";
Expand Down

0 comments on commit c3360b3

Please sign in to comment.