Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/17435#discussion_r108078597
--- 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 --
It seems this problem only applies to `StructField`. Could we just
overwrite `typeName` with simply throwing an exception? I think users are not
supposed to call `typeName` against `StructField` but `simpleString` against
the type instance.
BTW, It apparently seems a bit odd that it extends `DataType` though.. I
guess probably some tests are broken if we change the parent as it seems it is
dependent on the parent assuming from
https://github.com/apache/spark/pull/1598. So, I guess minimised fix would be
just to overwrite.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]