class_docstr: Reads a dataset from a Petastorm dataset.
  
  :ivar last_row_consumed: True if the last row was already returned by the Reader.
class_docstr_tok: ["Reads","a","dataset","from","a","Petastorm","dataset",".",":","ivar","last_row_consumed",":","True","if","the","last","row","was","already","returned","by","the","Reader","."]
docstr: Filters the list of row group indexes using rowgroup selector object. Returns a modified list of rowgroup
  indexes and a list of worker_predicate: predicates that could not be applied at this level
  (parquet partitioning).
docstr_tok: ["Filters","the","list","of","row","group","indexes","using","rowgroup","selector","object",".","Returns","a","modified","list","of","rowgroup","indexes","and","a","list","of","worker_predicate",":","predicates","that","could","not","be","applied","at","this","level","(","parquet","partitioning",")","."]
code: def _apply_predicate_to_row_groups(
      self, dataset, row_groups, predicate
  ):
      """Filters the list of row group indexes using rowgroup selector object. Returns a modified list of rowgroup
      indexes and a list of worker_predicate: predicates that could not be applied at this level
      (parquet partitioning)."""
  
      if predicate:
          if not isinstance(predicate, PredicateBase):
              raise ValueError(
                  "predicate parameter is expected to be derived from PredicateBase"
              )
          predicate_fields = predicate.get_fields()
  
          partition_names = (
              dataset.partitions.partition_names
              if dataset.partitions
              else set()
          )
          if set(predicate_fields) == partition_names:
              assert (
                  len(partition_names) == 1
              ), "Datasets with only a single partition level supported at the moment"
  
              filtered_row_group_indexes = []
              for piece_index, piece in enumerate(row_groups):
                  (
                      partition_name,
                      partition_index,
                  ) = piece.partition_keys[0]
                  partition_value = dataset.partitions[0].keys[
                      partition_index
                  ]
  
                  # Convert partition value to correct type per the schema
                  partition_value = self.schema.fields[
                      partition_name
                  ].numpy_dtype(partition_value)
                  if predicate.do_include(
                      {partition_name: partition_value}
                  ):
                      filtered_row_group_indexes.append(piece_index)
              worker_predicate = None
          else:
              filtered_row_group_indexes = list(range(len(row_groups)))
              worker_predicate = predicate
  
      else:
          filtered_row_group_indexes = list(range(len(row_groups)))
          worker_predicate = None
      return filtered_row_group_indexes, worker_predicate
  
imports: import collections.abc
  import logging
  import warnings
  import six
  from pyarrow import parquet
  from petastorm.arrow_reader_worker import ArrowReaderWorker
  from petastorm.cache import NullCache
  from petastorm.errors import NoDataAvailableError
  from petastorm.etl import dataset_metadata, rowgroup_indexing
  from petastorm.etl.dataset_metadata import PetastormMetadataError, infer_or_load_unischema
  from petastorm.fs_utils import get_filesystem_and_path_or_paths, normalize_dir_url
  from petastorm.local_disk_cache import LocalDiskCache
  from petastorm.ngram import NGram
  from petastorm.predicates import PredicateBase
  from petastorm.py_dict_reader_worker import PyDictReaderWorker
  from petastorm.reader_impl.arrow_table_serializer import ArrowTableSerializer
  from petastorm.reader_impl.pickle_serializer import PickleSerializer
  from petastorm.selectors import RowGroupSelectorBase
  from petastorm.transform import transform_schema
  from petastorm.workers_pool.dummy_pool import DummyPool
  from petastorm.workers_pool.process_pool import ProcessPool
  from petastorm.workers_pool.thread_pool import ThreadPool
  from petastorm.workers_pool.ventilator import ConcurrentVentilator
label_desc: Use image node_id 7 for calling the Reader obj's underlying member method code with example usage: obj._apply_predicate_to_row_groups(dataset, row_groups, predicate) and returns: filtered_row_group_indexes,  worker_predicate