GitHub user aokolnychyi opened a pull request:

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

    [SPARK-21102][SQL] Make refresh resource command less aggressive in p…

    ### Idea
    
    This PR adds validation to REFRESH sql statements. Currently, users can 
specify whatever they want as resource path. For example, spark.sql("REFRESH ! 
$ !") will be executed without any exceptions.
    
    ### Implementation 
    
    I am not sure that my current implementation is the most optimal, so any 
feedback is appreciated. My first idea was to make the grammar as strict as 
possible. Unfortunately, there were some problems. I tried the approach below:
    
    SqlBase.g4
    ```
    ...
        | REFRESH TABLE tableIdentifier                                    
#refreshTable
        | REFRESH resourcePath                                             
#refreshResource
    ...
    
    resourcePath
        : STRING
        | (IDENTIFIER | number | nonReserved | '/' | '-')+ // other symbols can 
be added if needed
        ;
    ```
    It is not flexible enough and requires to explicitly mention all possible 
symbols. Therefore, I came up with the current approach that is implemented in 
the code.
    
    Let me know your opinion on which one is better.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aokolnychyi/spark spark-21102

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

    https://github.com/apache/spark/pull/18368.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 #18368
    
----
commit fc2b7c02fab7f570ae3ca080ae1c2c9502300de7
Author: aokolnychyi <anton.okolnyc...@sap.com>
Date:   2017-06-19T18:17:18Z

    [SPARK-21102][SQL] Make refresh resource command less aggressive in parsing

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to