GitHub user nchammas opened a pull request:
https://github.com/apache/spark/pull/18926
[SPARK-21712] [PySpark] Clarify type error for Column.substr()
Proposed changes:
* Clarify the type error that `Column.substr()` gives.
Test plan:
* Tested this manually.
* Test code:
```python
from pyspark.sql.functions import col, lit
spark.createDataFrame([['nick']],
schema=['name']).select(col('name').substr(0, lit(1)))
```
* Before:
```
TypeError: Can not mix the type
```
* After:
```
TypeError: startPos and length must be the same type. Got <class 'int'>
and
<class 'pyspark.sql.column.Column'>, respectively.
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nchammas/spark SPARK-21712-substr-type-error
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18926.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #18926
----
commit 753dbe1743f552fe7b4867d3e4d24cdcc2ca1669
Author: Nicholas Chammas <[email protected]>
Date: 2017-08-11T18:39:59Z
clarify type error for Column.substr()
----
---
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]