inference_schema/parameter_types/spark_parameter_type.py
def _convert_spark_schema_to_swagger(cls, datatype):
        """
        Converts an spark schema-like type into a swagger valid type

        :param datatype:
        :type datatype: DataType
        :return: the converted swagger type.
        :rtype: dict
        """
        if not isinstance(datatype, DataType):
            raise TypeError("Invalid data type to convert: expected only valid pyspark.sql.types.DataType types")

        if isinstance(datatype, UserDefinedType):
            raise TypeError("Invalid data type to convert: instances of UserDefinedType (e.g. VectorUDT, MatrixUDT)\
             are not supported at this time. Please use ArrayType or MapType if applicable.")

        if type(datatype) is StructType:
            schema = {"type": "object", "properties": {}}
            for field_name in datatype.names:
                field_swagger = cls._convert_spark_schema_to_swagger(datatype[field_name].dataType)
                schema["properties"][field_name] = field_swagger
            return schema
        elif type(datatype) is StructField:
            schema = cls._convert_data_type_to_swagger(datatype.dataType)
        else:
            schema = cls._convert_data_type_to_swagger(datatype)
        return schema

        Converts an spark schema-like type into a swagger valid type

        :param datatype:
        :type datatype: DataType
        :return: the converted swagger type.
        :rtype: dict
        
Converts an spark schema-like type into a swagger valid type
Converts an spark schema - like type into a swagger valid type
def _convert_spark_schema_to_swagger(cls, datatype):
        if not isinstance(datatype, DataType):
            raise TypeError("Invalid data type to convert: expected only valid pyspark.sql.types.DataType types")
        if isinstance(datatype, UserDefinedType):
            raise TypeError("Invalid data type to convert: instances of UserDefinedType (e.g. VectorUDT, MatrixUDT)\
             are not supported at this time. Please use ArrayType or MapType if applicable.")
        if type(datatype) is StructType:
            schema = {"type": "object", "properties": {}}
            for field_name in datatype.names:
                field_swagger = cls._convert_spark_schema_to_swagger(datatype[field_name].dataType)
                schema["properties"][field_name] = field_swagger
            return schema
        elif type(datatype) is StructField:
            schema = cls._convert_data_type_to_swagger(datatype.dataType)
        else:
            schema = cls._convert_data_type_to_swagger(datatype)
        return schema
def _convert_spark_schema_to_swagger ( cls , datatype ) : if not isinstance ( datatype , DataType ) : raise TypeError ( "Invalid data type to convert: expected only valid pyspark.sql.types.DataType types" ) if isinstance ( datatype , UserDefinedType ) : raise TypeError ( "Invalid data type to convert: instances of UserDefinedType (e.g. VectorUDT, MatrixUDT)\
             are not supported at this time. Please use ArrayType or MapType if applicable." ) if type ( datatype ) is StructType : schema = { "type" : "object" , "properties" : { } } for field_name in datatype . names : field_swagger = cls . _convert_spark_schema_to_swagger ( datatype [ field_name ] . dataType ) schema [ "properties" ] [ field_name ] = field_swagger return schema elif type ( datatype ) is StructField : schema = cls . _convert_data_type_to_swagger ( datatype . dataType ) else : schema = cls . _convert_data_type_to_swagger ( datatype ) return schema
Converts an spark schema-like type into a swagger valid type
Converts an spark schema - like type into a swagger valid type
"""
        Converts an spark schema-like type into a swagger valid type

        :param datatype:
        :type datatype: DataType
        :return: the converted swagger type.
        :rtype: dict
        """
the converted swagger type.
the converted swagger type .
dict
cls
datatype
None