Skip to content

Commit f12be86

Browse files
committed
Be explicit in that Index and CTableIndex are essentially the same concept
1 parent 1d5f22a commit f12be86

4 files changed

Lines changed: 19 additions & 11 deletions

File tree

doc/reference/ctable.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,12 @@ Indexes
265265
-------
266266

267267
CTable indexes are created with :meth:`CTable.create_index` and returned as
268-
:class:`blosc2.ctable.CTableIndex` handles. A ``CTableIndex`` is the table
269-
counterpart to :class:`blosc2.Index`: it refers to an index stored in the table
270-
index catalog, and delegates maintenance operations such as ``drop()``,
271-
``rebuild()``, and ``compact()`` back to the owning table.
268+
:class:`blosc2.ctable.CTableIndex` handles. ``CTableIndex`` has the same
269+
user-facing role as :class:`blosc2.Index`, but for tables instead of arrays:
270+
it refers to an index stored in the table index catalog, and delegates
271+
maintenance operations such as ``drop()``, ``rebuild()``, and ``compact()``
272+
back to the owning table. Users normally only receive these handles from the
273+
CTable API; they do not instantiate them directly.
272274

273275
Indexes can target stored columns or **direct expressions** over stored columns
274276
via ``create_index(expression=...)``. This lets queries reuse indexes for

doc/reference/index_class.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ Handle for an index attached to a :class:`~blosc2.NDArray`.
1111
storage usage, or to drop, rebuild, and compact the index. Users normally do
1212
not instantiate ``Index`` directly.
1313

14-
For table indexes, see :class:`blosc2.ctable.CTableIndex`, documented in the
15-
:ref:`CTable` reference.
14+
For table indexes, :class:`blosc2.ctable.CTableIndex` plays the same
15+
user-facing role for :class:`~blosc2.CTable` objects. It is documented in the
16+
:ref:`CTable` reference because table indexes can target columns and table
17+
expressions.
1618

1719
.. currentmodule:: blosc2
1820

src/blosc2/ctable.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,13 @@ def __getitem__(self, key):
240240

241241

242242
class CTableIndex:
243-
"""A handle on an index attached to a :class:`CTable` target.
243+
"""Handle for an index attached to a :class:`CTable` target.
244244
245-
Returned by :meth:`CTable.index` and items of :attr:`CTable.indexes`.
246-
Provides :meth:`drop`, :meth:`rebuild`, and :meth:`compact` convenience
247-
methods that delegate back to the owning table.
245+
This has the same user-facing role as :class:`blosc2.Index`, but for
246+
tables instead of arrays. It is returned by :meth:`CTable.create_index`,
247+
:meth:`CTable.index`, and items of :attr:`CTable.indexes`, and provides
248+
the same core convenience operations: :meth:`drop`, :meth:`rebuild`, and
249+
:meth:`compact`. Users should not instantiate this class directly.
248250
"""
249251

250252
def __init__(self, table: CTable, col_name: str, descriptor: dict) -> None:

src/blosc2/indexing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4040,7 +4040,9 @@ class Index(Mapping):
40404040
:meth:`blosc2.NDArray.create_index`, :meth:`blosc2.NDArray.index`, and
40414041
:attr:`blosc2.NDArray.indexes`. They expose descriptor metadata and
40424042
convenience methods for dropping, rebuilding, or compacting the underlying
4043-
index. Users should not instantiate this class directly.
4043+
index. :class:`blosc2.ctable.CTableIndex` plays the same user-facing role
4044+
for :class:`blosc2.CTable` indexes. Users should not instantiate either
4045+
class directly.
40444046
"""
40454047

40464048
def __init__(self, array: blosc2.NDArray, token: str):

0 commit comments

Comments
 (0)