You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2018/12/12 06:23:17 UTC

[GitHub] gatorsmile commented on issue #23276: [SPARK-26321][SQL] Split a SQL in correct way

gatorsmile commented on issue #23276: [SPARK-26321][SQL] Split a SQL in correct way
URL: https://github.com/apache/spark/pull/23276#issuecomment-446476683
 
 
   Let us first update the PR description to explain the problem we want to resolve. Regarding comments, our SQL parser follows PostgreSQL. You can read SqlBase.g4 to confirm it. 
   
   ```
   SIMPLE_COMMENT
       : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
       ;
   
   BRACKETED_EMPTY_COMMENT
       : '/**/' -> channel(HIDDEN)
       ;
   
   BRACKETED_COMMENT
       : '/*' ~[+] .*? '*/' -> channel(HIDDEN)
       ;
   ```
   
   In PostgreSQL doc: https://www.postgresql.org/docs/9.4/sql-syntax-lexical.html
   
   > A comment is a sequence of characters beginning with double dashes and extending to the end of the line, e.g.:
   ```
   -- This is a standard SQL comment
   ```
   > Alternatively, C-style block comments can be used:
   ```
   /* multiline comment
    * with nesting: /* nested block comment */
    */
   ```
   > where the comment begins with /* and extends to the matching occurrence of */. These block comments nest, as specified in the SQL standard but unlike C, so that one can comment out larger blocks of code that might contain existing block comments.
   
   > A comment is removed from the input stream before further syntax analysis and is effectively replaced by whitespace.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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