class_docstr: Mock dataset schema to generate fake data for testing purpose.
  This schema is configured to mimic the Movielens dataset
  
  https://files.grouplens.org/datasets/movielens/ml-100k/
  
  Dataset schema and generation is configured using pandera.
  Please see https://pandera.readthedocs.io/en/latest/schema_models.html
  for more information.
docstr: Return fake movielens dataset as a Spark Dataframe with specified rows
  
  Args:
      spark (SparkSession): spark session to load the dataframe into
      size (int): number of rows to generate
      seed (int): seeding the pseudo-number generation. Defaults to 100.
      keep_title_col (bool): remove the title column if False. Defaults to False.
      keep_genre_col (bool): remove the genre column if False. Defaults to False.
      tmp_path (str, optional): path to store files for serialization purpose
          when transferring data from python to java.
          If None, a temporal path is used instead
  
  Returns:
      pyspark.sql.DataFrame: a mock dataset
docstr_tok: ["Return","fake","movielens","dataset","as","a","Spark","Dataframe","with","specified","rows","Args",":","spark","(","SparkSession",")",":","spark","session","to","load","the","dataframe","into","size","(","int",")",":","number","of","rows","to","generate","seed","(","int",")",":","seeding","the","pseudo-number","generation",".","Defaults","to","100.","keep_title_col","(","bool",")",":","remove","the","title","column","if","False",".","Defaults","to","False",".","keep_genre_col","(","bool",")",":","remove","the","genre","column","if","False",".","Defaults","to","False",".","tmp_path","(","str",",","optional",")",":","path","to","store","files","for","serialization","purpose","when","transferring","data","from","python","to","java",".","If","None",",","a","temporal","path","is","used","instead","Returns",":","pyspark.sql.DataFrame",":","a","mock","dataset"]
code: def get_spark_df(
      cls,
      spark,
      size: int = 3,
      seed: int = 100,
      keep_title_col: bool = False,
      keep_genre_col: bool = False,
      tmp_path: Optional[str] = None,
  ):
      """Return fake movielens dataset as a Spark Dataframe with specified rows
  
      Args:
          spark (SparkSession): spark session to load the dataframe into
          size (int): number of rows to generate
          seed (int): seeding the pseudo-number generation. Defaults to 100.
          keep_title_col (bool): remove the title column if False. Defaults to False.
          keep_genre_col (bool): remove the genre column if False. Defaults to False.
          tmp_path (str, optional): path to store files for serialization purpose
              when transferring data from python to java.
              If None, a temporal path is used instead
  
      Returns:
          pyspark.sql.DataFrame: a mock dataset
      """
      pandas_df = cls.get_df(
          size=size, seed=seed, keep_title_col=True, keep_genre_col=True
      )
  
      # generate temp folder
      with download_path(tmp_path) as tmp_folder:
          filepath = os.path.join(
              tmp_folder, f"mock_movielens_{size}.csv"
          )
          # serialize the pandas.df as a csv to avoid the expensive java <-> python communication
          pandas_df.to_csv(filepath, header=False, index=False)
          spark_df = spark.read.csv(
              filepath, schema=cls._get_spark_deserialization_schema()
          )
          # Cache and force trigger action since data-file might be removed.
          spark_df.cache()
          spark_df.count()
  
      if not keep_title_col:
          spark_df = spark_df.drop(DEFAULT_TITLE_COL)
      if not keep_genre_col:
          spark_df = spark_df.drop(DEFAULT_GENRE_COL)
      return spark_df
  
imports: import os
  import re
  import random
  import shutil
  import warnings
  import pandas
  from typing import Optional
  from zipfile import ZipFile
  from recommenders.datasets.download_utils import maybe_download, download_path
  from recommenders.utils.notebook_utils import is_databricks
  from recommenders.utils.constants import DEFAULT_HEADER, DEFAULT_ITEM_COL, DEFAULT_USER_COL, DEFAULT_RATING_COL, DEFAULT_TIMESTAMP_COL, DEFAULT_TITLE_COL, DEFAULT_GENRE_COL
  import pandera
  import pandera.extensions
  from pandera import Field
  from pandera.typing import Series
label_desc: Use image node_id 2 for calling the MockMovielensSchema obj's underlying member method code with example usage: obj.get_spark_df(cls, spark, size, seed, keep_title_col, keep_genre_col, tmp_path) and returns: spark_df