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

Re: [PR] Redshift: UNLOAD [datafusion-sqlparser-rs]

yoavcloud commented on code in PR #2013:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2013#discussion_r2313313013


##########
src/parser/mod.rs:
##########
@@ -16477,19 +16569,35 @@ impl<'a> Parser<'a> {
     }
 
     pub fn parse_unload(&mut self) -> Result<Statement, ParserError> {
+        self.expect_keyword(Keyword::UNLOAD)?;
         self.expect_token(&Token::LParen)?;
-        let query = self.parse_query()?;
+        let (query, query_text) = if matches!(self.peek_token().token, Token::SingleQuotedString(_))
+        {
+            (None, Some(self.parse_literal_string()?))
+        } else {
+            (Some(self.parse_query()?), None)
+        };
         self.expect_token(&Token::RParen)?;
 
         self.expect_keyword_is(Keyword::TO)?;
         let to = self.parse_identifier()?;
-
-        let with_options = self.parse_options(Keyword::WITH)?;
-
+        let auth = if self.parse_keyword(Keyword::IAM_ROLE) {
+            Some(self.parse_iam_role_kind()?)
+        } else {
+            None
+        };
+        let with = self.parse_options(Keyword::WITH)?;

Review Comment:
   There's already one test case at the start of the unit test. This statement has two flavours, one for Athena (using WITH) and one for Redshift (not using WITH).



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