code: def test_dataframe_to_xshards(self):
      rdd = self.sc.range(0, 100)
      df = rdd.map(
          lambda x: (
              [float(x)] * 50,
              [int(np.random.randint(0, 2, size=()))],
          )
      ).toDF(["feature", "label"])
      num_partitions = df.rdd.getNumPartitions()
      # test shard_size = None
      shards = _dataframe_to_xshards(
          df, feature_cols=["feature"], label_cols=["label"]
      )
      num_shards = shards.rdd.count()
      assert num_shards == num_partitions
  
      from bigdl.orca import OrcaContext
  
      OrcaContext._shard_size = 1
      shards = _dataframe_to_xshards(
          df,
          feature_cols=["feature"],
          label_cols=["label"],
          shard_size=OrcaContext._shard_size,
      )
      num_shards = shards.rdd.count()
      assert num_shards == df.rdd.count()
      OrcaContext._shard_size = None
  
imports: from unittest import TestCase
  import os
  import pytest
  import numpy
  from pyspark.sql.types import ArrayType, DoubleType
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.data import SparkXShards
  from bigdl.orca.data.image.utils import chunks
  from bigdl.orca.learn.utils import convert_predict_rdd_to_dataframe, _dataframe_to_xshards, convert_predict_xshards_to_dataframe, convert_predict_rdd_to_xshard, update_predict_xshards
label_desc: Use image node_id 13 for calling the TestUtil obj's underlying member method code with example usage: obj.test_dataframe_to_xshards() without return types