code: def test_some_processing_functions(synthetic_dataset, reader_factory):
      """Try several ``tf.data.Dataset`` dataset operations on make_petastorm_dataset"""
  
      # reader1 will have a single row with id=1, reader2: a single row with id=2
  
      # Using functools.partial(_eq, 1)) which is equivalent to lambda x: x==1 because standard python pickle
      # can not pickle this lambda
      with reader_factory(
          synthetic_dataset.url,
          predicate=in_lambda(
              ["id"], functools.partial(operator.eq, 1)
          ),
      ) as reader1:
          with reader_factory(
              synthetic_dataset.url,
              predicate=in_lambda(
                  ["id"], functools.partial(operator.eq, 2)
              ),
          ) as reader2:
              dataset = (
                  make_petastorm_dataset(reader1)
                  .prefetch(10)
                  .concatenate(make_petastorm_dataset(reader2))
                  .map(lambda x: x.id)
                  .batch(2)
              )
  
              next_sample = dataset.make_one_shot_iterator().get_next()
  
              with tf.Session() as sess:
                  # 'actual' is expected to be content of id column of a concatenated dataset
                  actual = sess.run(next_sample)
                  np.testing.assert_array_equal(actual, [1, 2])
  
file_path: petastorm/petastorm/tests/test_tf_dataset.py
imports: import functools
  import operator
  from copy import copy
  import numpy
  import pytest
  import tensorflow.compat.v1
  from petastorm import make_reader, make_batch_reader
  from petastorm.ngram import NGram
  from petastorm.predicates import in_lambda
  from petastorm.tests.test_common import TestSchema
  from petastorm.tests.test_tf_utils import create_tf_graph
  from petastorm.tf_utils import make_petastorm_dataset
label_desc: Use image node_id 5 for calling a global function with example usage: test_some_processing_functions(synthetic_dataset, reader_factory) without return types