yaooqinn opened a new pull request #26715: [SPARK-29034][SQL] PostgreSQL dialect conformance for string constants with C-style escapes URL: https://github.com/apache/spark/pull/26715 ### What changes were proposed in this pull request? On one hand, we now use `spark.sql.parser.escapedStringLiterals` to control whether to escape string literal or not. On the other hand, we use `spark.sql.dialect` to choose spark or PostgreSQL dialect. When we use the PostgreSQL dialect, we should obey the C-style escape behavior of PostgreSQL. #### Supported > An escape string constant is specified by writing the letter E (upper or lower case) just before the opening single quote, e.g., E'foo'. #### Not supported > When continuing an escape string constant across lines, write E only before the first opening quote. Because PostgreSQL follows the SQL standard that is > Two string constants that are only separated by whitespace with at least one **newline** are concatenated and effectively treated as if the string had been written as one constant. , which is hard to follow in Spark's Parser. ### Why are the changes needed? PostgreSQL dialect conformance ### Does this PR introduce any user-facing change? <!-- If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible. If no, write 'No'. --> yes, when we use the PostgreSQL dialect, we use 'E' to define an escape string constant ### How was this patch tested? <!-- If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> add ut.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
