Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Jul 17, 2019

What changes were proposed in this pull request?

In the PR, I propose to convert options values to strings by using to_str() for the following functions: from_csv(), to_csv(), from_json(), to_json(), schema_of_csv() and schema_of_json(). This will make handling of function options consistent to option handling in DataFrameReader/DataFrameWriter.

For example:

df.select(from_csv(df.value, "s string", {'ignoreLeadingWhiteSpace': True})

How was this patch tested?

Added an example for from_csv() which was tested by:

./python/run-tests --testnames pyspark.sql.functions

@SparkQA
Copy link

SparkQA commented Jul 17, 2019

Test build #107796 has finished for PR 25182 at commit 8e6dc27.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Jul 17, 2019

@HyukjinKwon Please, review the PR.

@HyukjinKwon
Copy link
Member

Merged to master.

vinodkc pushed a commit to vinodkc/spark that referenced this pull request Jul 18, 2019
## What changes were proposed in this pull request?

In the PR, I propose to convert options values to strings by using `to_str()` for the following functions:  `from_csv()`, `to_csv()`, `from_json()`, `to_json()`, `schema_of_csv()` and `schema_of_json()`. This will make handling of function options consistent to option handling in `DataFrameReader`/`DataFrameWriter`.

For example:
```Python
df.select(from_csv(df.value, "s string", {'ignoreLeadingWhiteSpace': True})
```

## How was this patch tested?

Added an example for `from_csv()` which was tested by:
```Shell
./python/run-tests --testnames pyspark.sql.functions
```

Closes apache#25182 from MaxGekk/options_to_str.

Authored-by: Maxim Gekk <[email protected]>
Signed-off-by: HyukjinKwon <[email protected]>
@MaxGekk MaxGekk deleted the options_to_str branch September 18, 2019 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants