Skip to content

Conversation

yoavcloud
Copy link
Contributor

Added support for the Redshift variant of UNLOAD

src/ast/mod.rs Outdated
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
pub struct PartitionBy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub struct PartitionBy {
pub struct UnloadPartitionBy {

Thinking since partitionby has meaning in other contexts?

/// NULL \[ AS \] 'null_string'
Null(String),
/// PARALLEL
Parallel(Option<bool>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a description here to mention the behavior of on/off?

Some(Keyword::GB) => Some(FileSizeUnit::GB),
_ => None,
};
CopyLegacyOption::RowGroupSize(FileSize { size, unit })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pull this out to a function like parse_file_size_unit() so that it can be reused?

} else {
None
};
let with = self.parse_options(Keyword::WITH)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test case that uses the WITH keyword in the syntax?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@yoavcloud yoavcloud force-pushed the redshift_unload_stmt branch from 3b2bb45 to dcecedf Compare September 1, 2025 08:51
@yoavcloud yoavcloud requested a review from iffyio September 1, 2025 08:51
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @yoavcloud!
cc @alamb

@iffyio iffyio merged commit eca6574 into apache:main Sep 2, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants