inference_schema/parameter_types/spark_parameter_type.py
def _convert_data_type_to_swagger(cls, basic_type):
        """
        Converts pyspark.sql.types.DataType into a swagger valid type

        :param basic_type:
        :type basic_type: pyspark.sql.types.DataType
        :return: the converted swagger type.
        :rtype: dict
        """

        _switcher = {
            'byte': {'type': 'integer', 'format': 'int8'},
            'short': {'type': 'integer', 'format': 'int16'},
            'integer': {'type': 'integer', 'format': 'int32'},
            'long': {'type': 'integer', 'format': 'int64'},
            'boolean': {'type': 'boolean'},
            'float': {'type': 'number', 'format': 'float'},
            'double': {'type': 'number', 'format': 'double'},
            'decimal': {'type': 'number', 'format': 'decimal'},
            'string': {'type': 'string'},
            'binary': {'type': 'string', 'format': 'binary'},
            'date': {'type': 'string', 'format': 'date'},
            'timestamp': {'type': 'string', 'format': 'date-time'},
            'null': {'type': 'object'}
        }
        if not isinstance(basic_type, DataType):
            raise TypeError("Invalid data type to convert: expected only valid pyspark.sql.types.DataType types")

        type_name = basic_type.typeName()
        if type_name in _switcher.keys():
            return _switcher.get(type_name)
        elif type_name == 'array':
            return cls._convert_ArrayType_to_swagger(basic_type)
        elif type_name == 'map':
            return cls._convert_MapType_to_swagger(basic_type)
        else:
            raise TypeError("We currently do not support extracting schema from data of type {}".format(basic_type))

        Converts pyspark.sql.types.DataType into a swagger valid type

        :param basic_type:
        :type basic_type: pyspark.sql.types.DataType
        :return: the converted swagger type.
        :rtype: dict
        
Converts pyspark.sql.types.DataType into a swagger valid type
Converts pyspark . sql . types . DataType into a swagger valid type
def _convert_data_type_to_swagger(cls, basic_type):
        _switcher = {
            'byte': {'type': 'integer', 'format': 'int8'},
            'short': {'type': 'integer', 'format': 'int16'},
            'integer': {'type': 'integer', 'format': 'int32'},
            'long': {'type': 'integer', 'format': 'int64'},
            'boolean': {'type': 'boolean'},
            'float': {'type': 'number', 'format': 'float'},
            'double': {'type': 'number', 'format': 'double'},
            'decimal': {'type': 'number', 'format': 'decimal'},
            'string': {'type': 'string'},
            'binary': {'type': 'string', 'format': 'binary'},
            'date': {'type': 'string', 'format': 'date'},
            'timestamp': {'type': 'string', 'format': 'date-time'},
            'null': {'type': 'object'}
        }
        if not isinstance(basic_type, DataType):
            raise TypeError("Invalid data type to convert: expected only valid pyspark.sql.types.DataType types")
        type_name = basic_type.typeName()
        if type_name in _switcher.keys():
            return _switcher.get(type_name)
        elif type_name == 'array':
            return cls._convert_ArrayType_to_swagger(basic_type)
        elif type_name == 'map':
            return cls._convert_MapType_to_swagger(basic_type)
        else:
            raise TypeError("We currently do not support extracting schema from data of type {}".format(basic_type))
def _convert_data_type_to_swagger ( cls , basic_type ) : _switcher = { 'byte' : { 'type' : 'integer' , 'format' : 'int8' } , 'short' : { 'type' : 'integer' , 'format' : 'int16' } , 'integer' : { 'type' : 'integer' , 'format' : 'int32' } , 'long' : { 'type' : 'integer' , 'format' : 'int64' } , 'boolean' : { 'type' : 'boolean' } , 'float' : { 'type' : 'number' , 'format' : 'float' } , 'double' : { 'type' : 'number' , 'format' : 'double' } , 'decimal' : { 'type' : 'number' , 'format' : 'decimal' } , 'string' : { 'type' : 'string' } , 'binary' : { 'type' : 'string' , 'format' : 'binary' } , 'date' : { 'type' : 'string' , 'format' : 'date' } , 'timestamp' : { 'type' : 'string' , 'format' : 'date-time' } , 'null' : { 'type' : 'object' } } if not isinstance ( basic_type , DataType ) : raise TypeError ( "Invalid data type to convert: expected only valid pyspark.sql.types.DataType types" ) type_name = basic_type . typeName ( ) if type_name in _switcher . keys ( ) : return _switcher . get ( type_name ) elif type_name == 'array' : return cls . _convert_ArrayType_to_swagger ( basic_type ) elif type_name == 'map' : return cls . _convert_MapType_to_swagger ( basic_type ) else : raise TypeError ( "We currently do not support extracting schema from data of type {}" . format ( basic_type ) )
Converts pyspark.sql.types.DataType into a swagger valid type
Converts pyspark . sql . types . DataType into a swagger valid type
"""
        Converts pyspark.sql.types.DataType into a swagger valid type

        :param basic_type:
        :type basic_type: pyspark.sql.types.DataType
        :return: the converted swagger type.
        :rtype: dict
        """
the converted swagger type.
the converted swagger type .
dict
cls
basic_type
None