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

    https://github.com/apache/spark/pull/18444#discussion_r128138629
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -938,12 +1016,17 @@ def _infer_type(obj):
                     return MapType(_infer_type(key), _infer_type(value), True)
             else:
                 return MapType(NullType(), NullType(), True)
    -    elif isinstance(obj, (list, array)):
    +    elif isinstance(obj, list):
             for v in obj:
                 if v is not None:
                     return ArrayType(_infer_type(obj[0]), True)
             else:
                 return ArrayType(NullType(), True)
    +    elif isinstance(obj, array):
    +        if obj.typecode in _array_type_mappings:
    +            return ArrayType(_array_type_mappings[obj.typecode](), False)
    +        else:
    +            raise TypeError("not supported type: array(%s)" % obj.typecode)
    --- End diff --
    
    If we fall back to `_infer_type`, then there should be some dirty changes 
in test cases to make it pass: Consider the following question:
    1. Should we add 'L' as exception for python2 in unsupported types tests, 
or do we just completely remove unsupported tests?
    2. Should we test 'L' for python 2?
    
    I really like how the tests now are organized and these changes above will 
makes the test very messy. My opinion is, we are not changing the status of 'L' 
from "supported" to "unsupported", but from "undefined support status" to 
"unsupported". If changing from "undefined support status" to "unsupported" 
sounds bad, instead of making these changes to the test cases, I would rather 
to solve this problem now and keep the test cases clean.


---
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