Github user szalai1 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17435#discussion_r108100937
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -57,7 +57,25 @@ def __ne__(self, other):
     
         @classmethod
         def typeName(cls):
    -        return cls.__name__[:-4].lower()
    +        typeTypeNameMap = {"DataType": "data",
    +                           "NullType": "null",
    +                           "StringType": "string",
    +                           "BinaryType": "binary",
    +                           "BooleanType": "boolean",
    +                           "DateType": "date",
    +                           "TimestampType": "timestamp",
    +                           "DecimalType": "decimal",
    +                           "DoubleType": "double",
    +                           "FloatType": "float",
    +                           "ByteType": "byte",
    +                           "IntegerType": "integer",
    +                           "LongType": "long",
    +                           "ShortType": "short",
    +                           "ArrayType": "array",
    +                           "MapType": "map",
    +                           "StructField": "struct",
    --- End diff --
    
    @viirya The way I found this bug: 
    I wanted to figure out the schema of a dataset. I loaded it into a data 
frame  and asked its schema. Then I called the `typeName` on each column. I do 
not know this is/was best way to do this, but I think it is valid to call 
`typeName` against a `dataType` to get its real type. 
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to