Skip to content

Indexing

niranda perera edited this page Sep 22, 2021 · 1 revision

Types

  • Range
  • Linear
  • Hash

Loc on Index

Loc(table: Table, start_idx, end_idx, columns: List[int]) semantic

output table -->

if table.index.col_id is in columns: 
 return table.select_columns(columns).slice(start_idx, end_idx + 1)
else:
 return table.select_columns([columns, table.index.col_id]).slice(start_idx, end_idx + 1)

input index --> output index

  1. Range --> Range [start_idx, end_idx]
  2. Linear --> Linear (set on the corresponding index column)
  3. Hash --> Hash (set on the corresponding index column)

Loc(table: Table, indices: List[int], columns: List[int]) semantic

output table -->

if table.index.col_id is in columns: 
 return table.select_columns(columns).take(indices)
else:
 return table.select_columns([columns, table.index.col_id]).take(indices)

input index --> output index

  1. Range --> Linear index from indices
  2. Linear --> Linear (set on the corresponding index column)
  3. Hash --> Hash (set on the corresponding index column)