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

    https://github.com/apache/spark/pull/18926#discussion_r132856119
  
    --- Diff: python/pyspark/sql/column.py ---
    @@ -406,7 +406,13 @@ def substr(self, startPos, length):
             [Row(col=u'Ali'), Row(col=u'Bob')]
             """
             if type(startPos) != type(length):
    -            raise TypeError("Can not mix the type")
    +            raise TypeError(
    +                "startPos and length must be the same type. "
    +                "Got {startPos_t} and {length_t}, respectively."
    --- End diff --
    
    It needs to check the types in general and we need to hide the error 
message related with Java types. It is also true that we also need to make such 
logics in to Scala one to deduplicate this logic if they are duplicated. R has 
also a similar problem in some places. I don't think we should change this case 
anyway.
    
    It looks we should ...
    
    ```
    py4j.Py4JException: Method substr([class java.lang.Long ...
    ```
    
    or we should introduce bridge methods in Scala side and implement this 
checking logic IIRC.



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