GitHub user gengliangwang opened a pull request:
https://github.com/apache/spark/pull/23047
[SPARK-25883][SQL][MINOR] Override method `prettyName` in
`from_avro`/`to_avro`
## What changes were proposed in this pull request?
Previously in from_avro/to_avro, we override the method `simpleString` and
`sql` for the string output. However, the override only affects the alias
naming:
```
Project [from_avro('col,
...
, (mode,PERMISSIVE)) AS from_avro(col, struct<col1:bigint,col2:double>,
Map(mode -> PERMISSIVE))#11]
```
It only makes the alias name quite long: `from_avro(col,
struct<col1:bigint,col2:double>, Map(mode -> PERMISSIVE))`).
We should follow `from_csv`/`from_json` here, to override the method
prettyName only, and we will get a clean alias name
```
... AS from_avro(col)#11
```
## How was this patch tested?
Manual check
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gengliangwang/spark backport_avro_pretty_name
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/23047.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 #23047
----
commit 3323fdb87120b8783a17728dee26dcb738451231
Author: Gengliang Wang <gengliang.wang@...>
Date: 2018-10-31T06:59:37Z
[SPARK-25883][SQL][MINOR] Override method `prettyName` in
`from_avro`/`to_avro`
Previously in from_avro/to_avro, we override the method `simpleString` and
`sql` for the string output. However, the override only affects the alias
naming:
```
Project [from_avro('col,
...
, (mode,PERMISSIVE)) AS from_avro(col, struct<col1:bigint,col2:double>,
Map(mode -> PERMISSIVE))#11]
```
It only makes the alias name quite long: `from_avro(col,
struct<col1:bigint,col2:double>, Map(mode -> PERMISSIVE))`).
We should follow `from_csv`/`from_json` here, to override the method
prettyName only, and we will get a clean alias name
```
... AS from_avro(col)#11
```
Manual check
Closes #22890 from gengliangwang/revise_from_to_avro.
Authored-by: Gengliang Wang <[email protected]>
Signed-off-by: gatorsmile <[email protected]>
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]