GitHub user gengliangwang opened a pull request:

    https://github.com/apache/spark/pull/22890

    [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 revise_from_to_avro

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/22890.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 #22890
    
----
commit 0393510c2e06eb78d21e6113454047dba7316c6e
Author: Gengliang Wang <gengliang.wang@...>
Date:   2018-10-30T07:08:47Z

    overriding prettyName

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to