def METHOD_NAME(self):
    """
    Resume a query using foreach.
    """
    records = 0
    resumed_records = 0
    def callback(part_id, input_tuple):
        nonlocal records
        if records == 5:
            return False
        records += 1
    query_obj = self.as_connection.query(self.test_ns, self.test_set)
    query_obj.foreach(callback, {"partition_filter": {"begin": 1001, "count": 1}})
    assert records == 5
    partition_status = query_obj.get_partitions_status()
    def resume_callback(part_id, input_tuple):
        nonlocal resumed_records
        resumed_records += 1
    query_obj2 = self.as_connection.query(self.test_ns, self.test_set)
    policy = {
        "partition_filter": {"begin": 1001, "count": 1, "partition_status": partition_status},
    }
    query_obj2.foreach(resume_callback, policy)
    assert records + resumed_records == self.partition_1001_count