Skip to content

Conversation

@panbingkun
Copy link
Contributor

@panbingkun panbingkun commented Jan 2, 2024

What changes were proposed in this pull request?

The pr aims to refine docstring of reverse/map_contains_key.

Why are the changes needed?

To improve PySpark documentation.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Manually test.

Was this patch authored or co-authored using generative AI tooling?

No.

@panbingkun panbingkun marked this pull request as ready for review January 2, 2024 09:20
Examples
--------
Example 1: Reverse a string

Copy link
Contributor

@LuciferYang LuciferYang Jan 2, 2024

Choose a reason for hiding this comment

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

Let's standardize the format:

  1. import functions as sf and import other necessaries
  2. try not to use .alias
  3. perhaps show is clearer than collect when displaying results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


Example 2: Reverse an array

>>> df = spark.createDataFrame([([2, 1, 3],) ,([1],) ,([],)], ['data'])
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, is this line duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For self-contained, the data is also repeated once in each example.

Copy link
Contributor

@zhengruifeng zhengruifeng Jan 5, 2024

Choose a reason for hiding this comment

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

I mean df is defined twice in this example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I made a mistake. It was defined twice in this example and let me to remove it.
Done.

vinodkc pushed a commit to vinodkc/spark that referenced this pull request Jan 5, 2024
### What changes were proposed in this pull request?
The pr aims to refine docstring of `reverse/map_contains_key`.

### Why are the changes needed?
To improve PySpark documentation.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Manually test.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#44561 from panbingkun/SPARK-46560.

Lead-authored-by: panbingkun <[email protected]>
Co-authored-by: panbingkun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants