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

    https://github.com/apache/spark/pull/18926#discussion_r132836871
  
    --- 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 --
    
    > -> startPos: {startPos_t}; length: {length_t}.
    
    I think this suggestion basically includes the same information with the 
current change? I think you should explain why.
    
    > BTW, why we do the type checking here, instead of doing it in the actual 
Scala impl of substr?
    
    Are you saying exposing Java types in the error message is better or 
suggesting method signature in Scala impl of `substr` with the check logic?
    
    > In addition, we do not support the mixed cases? For example, startPos is 
int, length is long.
    
    In Python, it makes sense calling `int` in general I think. `long` and 
`int` are unified in Python 3 and this PR looks targeting only the exception 
message fix.


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