code: def test_parquet_sample():
      """Test case for read_parquet."""
      parquet = tfio.IOTensor.from_parquet(filename)
      columns = [
          "boolean_field",
          "int32_field",
          "int64_field",
          "int96_field",
          "float_field",
          "double_field",
          "ba_field",
          "flba_field",
      ]
      assert parquet.columns == columns
      p0 = parquet("boolean_field")
      p1 = parquet("int32_field")
      p2 = parquet("int64_field")
      p4 = parquet("float_field")
      p5 = parquet("double_field")
      p6 = parquet("ba_field")
      p7 = parquet("flba_field")
      assert p0.dtype == tf.bool
      assert p1.dtype == tf.int32
      assert p2.dtype == tf.int64
      assert p4.dtype == tf.float32
      assert p5.dtype == tf.float64
      assert p6.dtype == tf.string
      assert p7.dtype == tf.string
      for i in range(500):  # 500 rows.
          v0 = (i % 2) == 0
          v1 = i
          v2 = i * 1000 * 1000 * 1000 * 1000
          v4 = 1.1 * i
          v5 = 1.1111111 * i
          v6 = b"parquet%03d" % i
          v7 = bytearray(b"").join(
              [bytearray((i % 256,)) for _ in range(10)]
          )
          assert v0 == p0[i].numpy()
          assert v1 == p1[i].numpy()
          assert v2 == p2[i].numpy()
          assert np.isclose(v4, p4[i].numpy())
          assert np.isclose(v5, p5[i].numpy())
          assert v6 == p6[i].numpy()
          assert v7 == p7[i].numpy()
  
      # test parquet dataset
      columns = [
          "boolean_field",
          "int32_field",
          "int64_field",
          "float_field",
          "double_field",
          "ba_field",
          "flba_field",
      ]
      dataset = tfio.IODataset.from_parquet(filename, columns)
      i = 0
      for v in dataset:
          v0 = (i % 2) == 0
          v1 = i
          v2 = i * 1000 * 1000 * 1000 * 1000
          v4 = 1.1 * i
          v5 = 1.1111111 * i
          v6 = b"parquet%03d" % i
          v7 = bytearray(b"").join(
              [bytearray((i % 256,)) for _ in range(10)]
          )
          p0 = v["boolean_field"]
          p1 = v["int32_field"]
          p2 = v["int64_field"]
          p4 = v["float_field"]
          p5 = v["double_field"]
          p6 = v["ba_field"]
          p7 = v["flba_field"]
          assert v0 == p0.numpy()
          assert v1 == p1.numpy()
          assert v2 == p2.numpy()
          assert np.isclose(v4, p4.numpy())
          assert np.isclose(v5, p5.numpy())
          assert v6 == p6.numpy()
          assert v7 == p7.numpy()
          i += 1
  
file_path: io/tests/test_parquet.py
imports: import os
  import collections
  import numpy
  import tensorflow
  import tensorflow_io
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: test_parquet_sample() without return types