[
https://issues.apache.org/jira/browse/BEAM-9169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17020681#comment-17020681
]
Kirill Kozlov edited comment on BEAM-9169 at 1/24/20 10:00 PM:
---------------------------------------------------------------
[~robinyqiu] This might be the cause:
[https://github.com/11moon11/beam/blob/d7ef497b2360ea68f2bad9fb695a539b12cb1ddd/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BeamSqlUnparseContext.java#L52]
Edit:
This was added to ensure that strings with special characters (like:
{noformat}
SELECT 'abc\\n'{noformat}
) get escaped.
It looks like `StringEscapeUtils.escapeJava` method escapes characters ZetaSQL
does not expect to be escaped.
was (Author: kirillkozlov):
[~robinyqiu] This might be the cause:
[https://github.com/11moon11/beam/blob/d7ef497b2360ea68f2bad9fb695a539b12cb1ddd/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BeamSqlUnparseContext.java#L52]
Edit:
This was added to insure that strings with special characters (like:
{noformat}
SELECT 'abc\\n'{noformat}
) get escaped.
It looks like `StringEscapeUtils.escapeJava` method escapes characters ZetaSQL
does not expect to be escaped.
> Extra character introduced during Calcite unparsing
> ---------------------------------------------------
>
> Key: BEAM-9169
> URL: https://issues.apache.org/jira/browse/BEAM-9169
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql-zetasql
> Reporter: Yueyang Qiu
> Assignee: Kirill Kozlov
> Priority: Minor
> Fix For: 2.20.0
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> When I am testing query string
> {code:java}
> "SELECT STRING(TIMESTAMP \"2008-12-25 15:30:00\",
> \"America/Los_Angeles\")"{code}
> on BeamZetaSqlCalcRel I found that the second string parameter to the
> function is unparsed to
> {code:java}
> America\/Los_Angeles{code}
> (note an extra backslash character is added).
> This breaks the ZetaSQL evaluator with error
> {code:java}
> Syntax error: Illegal escape sequence: \/{code}
> From what I can see now this character is introduced during the Calcite
> unparsing step.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)