You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/14 11:56:27 UTC

[GitHub] [spark] oliverw1 commented on a change in pull request #26884: [SPARK-30257] [PySpark] Add simpleString map

oliverw1 commented on a change in pull request #26884: [SPARK-30257] [PySpark] Add simpleString map
URL: https://github.com/apache/spark/pull/26884#discussion_r357913657
 
 

 ##########
 File path: python/pyspark/sql/types.py
 ##########
 @@ -1043,6 +1057,14 @@ def _infer_type(obj):
             raise TypeError("not supported type: %s" % type(obj))
 
 
+def _type_from_simple_string(simple_str):
+    """Map simpleString to Spark SQL type
+    """
+    found_type = _simple_type_map.get(simple_str, None)
 
 Review comment:
   How about the more Pythonic
   ```
   try: 
       found_type = _simple_type_map[simple_str]
   except KeyError:
       raise TypeError("Unsupported type: %s" % simple_str)
   ```
   Although I'm wondering if simply having the KeyError surfacing isn't enough.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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