Skip to content

Conversation

@HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

This PR wraps the asNondeterministic attribute in the wrapped UDF function to set the docstring properly.

from pyspark.sql.functions import udf
help(udf(lambda x: x).asNondeterministic)

Before:

Help on function <lambda> in module pyspark.sql.udf:

<lambda> lambda
(END

After:

Help on function asNondeterministic in module pyspark.sql.udf:

asNondeterministic()
    Updates UserDefinedFunction to nondeterministic.

    .. versionadded:: 2.3
(END)

How was this patch tested?

Manually tested and a simple test was added.

@SparkQA
Copy link

SparkQA commented Jan 6, 2018

Test build #85749 has finished for PR 20173 at commit d92dac3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@gatorsmile gatorsmile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks! Merged to master/2.3

@asfgit asfgit closed this in 993f215 Jan 6, 2018
asfgit pushed a commit that referenced this pull request Jan 6, 2018
…or wrapped UDF function

## What changes were proposed in this pull request?

This PR wraps the `asNondeterministic` attribute in the wrapped UDF function to set the docstring properly.

```python
from pyspark.sql.functions import udf
help(udf(lambda x: x).asNondeterministic)
```

Before:

```
Help on function <lambda> in module pyspark.sql.udf:

<lambda> lambda
(END
```

After:

```
Help on function asNondeterministic in module pyspark.sql.udf:

asNondeterministic()
    Updates UserDefinedFunction to nondeterministic.

    .. versionadded:: 2.3
(END)
```

## How was this patch tested?

Manually tested and a simple test was added.

Author: hyukjinkwon <[email protected]>

Closes #20173 from HyukjinKwon/SPARK-22901-followup.
@HyukjinKwon HyukjinKwon deleted the SPARK-22901-followup branch October 16, 2018 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants