docstr: Read subset of dataset fields into spark rdd. Collects and makes sure they all return as expected
docstr_tok: ["Read","subset","of","dataset","fields","into","spark","rdd",".","Collects","and","makes","sure","they","all","return","as","expected"]
code: def test_reading_subset_of_columns(self):
      """Read subset of dataset fields into spark rdd. Collects and makes sure they all return as expected"""
      spark = self._get_spark_session()
      rows = dataset_as_rdd(
          self._dataset_url,
          spark,
          schema_fields=[TestSchema.id2, TestSchema.id],
      ).collect()
  
      for row in rows:
          actual = dict(row._asdict())
          expected = next(
              d for d in self._dataset_dicts if d["id"] == actual["id"]
          )
          np.testing.assert_equal(expected["id2"], actual["id2"])
  
      spark.stop()
  
file_path: petastorm/petastorm/tests/test_spark_utils.py
imports: import glob
  import os
  import unittest
  from shutil import rmtree
  from tempfile import mkdtemp
  import numpy
  from pyspark.sql import SparkSession
  from petastorm.spark_utils import dataset_as_rdd
  from petastorm.tests.test_common import create_test_dataset, TestSchema
label_desc: Use image node_id 5 for calling the TestSparkUtils obj's underlying member method code with example usage: obj.test_reading_subset_of_columns() without return types