code: def preprocess_parquet(
      input_dir, output_dir, target_partition_size=None
  ):
      print("Writing to parquet...")
  
      def to_bytes(row):
          row["height"] = row["image"].shape[0]
          row["width"] = row["image"].shape[1]
          row["image"] = row["image"].tobytes()
          return row
  
      if target_partition_size is not None:
          ctx = ray.data.context.DataContext.get_current()
          ctx.target_max_block_size = target_partition_size
  
      ds = ray.data.read_images(input_dir, mode="RGB")
      ds = ds.map(to_bytes)
      ds.write_parquet(output_dir)
  
imports: import os
  import PIL
  import streaming
  import ray
label_desc: Use image node_id 2 for calling a global function with example usage: preprocess_parquet(input_dir, output_dir, target_partition_size) and returns: row