code: def test_vector_to_array(spark_test_ctx):
      from pyspark.ml.linalg import Vectors
      from pyspark.mllib.linalg import Vectors as OldVectors
  
      df = spark_test_ctx.spark.createDataFrame(
          [
              (
                  Vectors.dense(1.0, 2.0, 3.0),
                  OldVectors.dense(10.0, 20.0, 30.0),
              ),
              (
                  Vectors.dense(5.0, 6.0, 7.0),
                  OldVectors.dense(50.0, 60.0, 70.0),
              ),
          ],
          ["vec", "oldVec"],
      )
      converter1 = make_spark_converter(df)
      with converter1.make_tf_dataset(num_epochs=1) as dataset:
          iterator = dataset.make_one_shot_iterator()
          tensor = iterator.get_next()
          with tf.Session() as sess:
              ts = sess.run(tensor)
      assert np.float32 == ts.vec.dtype.type
      assert np.float32 == ts.oldVec.dtype.type
      vec_col = ts.vec[ts.vec[:, 0].argsort()]
      old_vec_col = ts.oldVec[ts.oldVec[:, 0].argsort()]
      assert (2, 3) == ts.vec.shape
      assert (2, 3) == ts.oldVec.shape
      assert ([1.0, 2.0, 3.0] == vec_col[0]).all() and (
          [5.0, 6.0, 7.0] == vec_col[1]
      ).all()
      assert ([10.0, 20.0, 30.0] == old_vec_col[0]).all() and (
          [50.0, 60.0, 70] == old_vec_col[1]
      ).all()
  
imports: import os
  import subprocess
  import sys
  import tempfile
  import threading
  import time
  from distutils.version import LooseVersion
  import numpy
  import pyspark
  import pytest
  import py4j
  import tensorflow.compat.v1
  from pyspark.sql.functions import pandas_udf
  from pyspark.sql.types import ArrayType, BinaryType, BooleanType, ByteType, DoubleType, FloatType, IntegerType, LongType, ShortType, StringType, StructField, StructType
  from six.moves.urllib.parse import urlparse
  from petastorm import make_batch_reader
  from petastorm.fs_utils import FilesystemResolver
  from petastorm.spark import SparkDatasetConverter, make_spark_converter, spark_dataset_converter
  from petastorm.spark.spark_dataset_converter import _check_dataset_file_median_size, _check_parent_cache_dir_url, _check_rank_and_size_consistent_with_horovod, _check_url, _get_horovod_rank_and_size, _get_spark_session, _make_sub_dir_url, register_delete_dir_handler, _wait_file_available, _normalize_databricks_dbfs_url
  from unittest import mock
  from petastorm.tests.test_tf_utils import create_tf_graph
label_desc: Use image node_id 18 for calling a global function with example usage: test_vector_to_array(spark_test_ctx) without return types