class_docstr: Describes a schema of a data structure which can be rendered as native schema/data-types objects
  in several different python libraries. Currently supported are pyspark, tensorflow, and numpy.
docstr: Returns an object derived from the unischema as spark schema.
  
  Example:
  
  >>> spark.createDataFrame(dataset_rows,
  >>>                       SomeSchema.as_spark_schema())
docstr_tok: ["Returns","an","object","derived","from","the","unischema","as","spark","schema",".","Example",":",">",">",">","spark.createDataFrame","(","dataset_rows",",",">",">",">","SomeSchema.as_spark_schema","(",")",")"]
code: def as_spark_schema(self):
      """Returns an object derived from the unischema as spark schema.
  
      Example:
  
      >>> spark.createDataFrame(dataset_rows,
      >>>                       SomeSchema.as_spark_schema())
      """
      # Lazy loading pyspark to avoid creating pyspark dependency on data reading code path
      # (currently works only with make_batch_reader)
      import pyspark.sql.types as sql_types
  
      schema_entries = []
      for field in self._fields.values():
          spark_type = _field_spark_dtype(field)
          schema_entries.append(
              sql_types.StructField(
                  field.name, spark_type, field.nullable
              )
          )
  
      return sql_types.StructType(schema_entries)
  
imports: import copy
  import re
  import sys
  import warnings
  from collections import namedtuple, OrderedDict
  from decimal import Decimal
  from typing import Dict, Any, Tuple, Optional, NamedTuple
  import numpy
  import pyarrow
  import six
  from pyarrow.lib import ListType
  from pyarrow.lib import StructType
  from six import string_types
label_desc: Use image node_id 6 for calling the Unischema obj's underlying member method code with example usage: obj.as_spark_schema() and returns: sql_types