original_docstring: 
      Query a pyarrow Table to extract the subtable that correspond to the given key.
      
docstring: Query a pyarrow Table to extract the subtable that correspond to the given key.
docstring_tokens: Query a pyarrow Table to extract the subtable that correspond to the given key .
code: def _query_table(table: Table, key: Union[int, slice, range, str, Iterable]) -> pa.Table:
      """
      Query a pyarrow Table to extract the subtable that correspond to the given key.
      """
      if isinstance(key, int):
          return table.fast_slice(key % table.num_rows, 1)
      if isinstance(key, slice):
          key = range(*key.indices(table.num_rows))
      if isinstance(key, range):
          if _is_range_contiguous(key) and key.start >= 0:
              return table.fast_slice(key.start, key.stop - key.start)
          else:
              pass  # treat as an iterable
      if isinstance(key, str):
          return table.table.drop([column for column in table.column_names if column != key])
      if isinstance(key, Iterable):
          key = np.fromiter(key, np.int64)
          if len(key) == 0:
              return table.table.slice(0, 0)
          # don't use pyarrow.Table.take even for pyarrow >=1.0 (see https://issues.apache.org/jira/browse/ARROW-9773)
          return table.fast_gather(key % table.num_rows)
  
      _raise_bad_key_type(key)
code_tokens: def _query_table ( table : Table , key : Union [ int , slice , range , str , Iterable ] ) -> pa . Table : if isinstance ( key , int ) : return table . fast_slice ( key % table . num_rows , 1 ) if isinstance ( key , slice ) : key = range ( * key . indices ( table . num_rows ) ) if isinstance ( key , range ) : if _is_range_contiguous ( key ) and key . start >= 0 : return table . fast_slice ( key . start , key . stop - key . start ) else : pass if isinstance ( key , str ) : return table . table . drop ( [ column for column in table . column_names if column != key ] ) if isinstance ( key , Iterable ) : key = np . fromiter ( key , np . int64 ) if len ( key ) == 0 : return table . table . slice ( 0 , 0 ) return table . fast_gather ( key % table . num_rows ) _raise_bad_key_type ( key )
short_docstring: Query a pyarrow Table to extract the subtable that correspond to the given key.
short_docstring_tokens: Query a pyarrow Table to extract the subtable that correspond to the given key .
comment: """
      Query a pyarrow Table to extract the subtable that correspond to the given key.
      """$SEP$# treat as an iterable$SEP$# don't use pyarrow.Table.take even for pyarrow >=1.0 (see https://issues.apache.org/jira/browse/ARROW-9773)