You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "MartinSahlen (via GitHub)" <gi...@apache.org> on 2025/01/21 12:04:47 UTC

[I] Fails to parse TypedString expressions in BigQuery with triple quoted strings [datafusion-sqlparser-rs]

MartinSahlen opened a new issue, #1673:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1673

   i.e 
   
   `select JSON """{"name": "Alice", "age": 30}"""`
   
   fails. More examples can also be found here. 
   
   I also tried to do things like `SELECT timestamp """{"name": "Alice", "age": 30}"""` which also fails. 
   
   Error message is:
   
   ```
   called `Result::unwrap()` on an `Err` value: ParserError("Expected: end of statement, found: \"\"\"{\"name\": \"Alice\", \"age\": 30}\"\"\" at Line: 7, Column: 13")
   ```


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Fails to parse TypedString expressions in BigQuery with triple quoted strings [datafusion-sqlparser-rs]

Posted by "graup (via GitHub)" <gi...@apache.org>.
graup commented on issue #1673:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1673#issuecomment-2609359758

   The issue here is that `parse_literal_string` which is used by `TypedString` doesn't support quote styles other than single or double quoted strings.
   
   Trying to fix this I came across two related issues:
   
   - currently `TypedString` doesn't retain any knowledge about the used quote style, so it doesn't roundtrip properly. It always formats as a single quoted string.
     - We can fix this by making `TypedString` contain a `Value` instead of a `String`. This also gives us support for other quote styles, addressing the issue reported here.
   - `fmt::Display for EscapeQuotedString` doesn't take into account the dialect, producing strings like `'foo''bar'` which is invalid in BQ (should be `'foo\'bar'`). So something like this `SELECT JSON "{\"foo\":\"bar's\"}"` currently also doesn't get formatted correctly
     - Not sure how to fix this one, seems a bit more involved. 
   
   I'll push a PR addressing this in a moment.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Fails to parse TypedString expressions in BigQuery with triple quoted strings [datafusion-sqlparser-rs]

Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio closed issue #1673: Fails to parse TypedString expressions in BigQuery with triple quoted strings
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1673


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org