ozankabak commented on code in PR #9604:
URL: https://github.com/apache/arrow-datafusion/pull/9604#discussion_r1527213333
##########
datafusion/sql/src/parser.rs:
##########
@@ -111,15 +116,28 @@ impl fmt::Display for CopyToStatement {
let Self {
source,
target,
+ partitioned_by,
+ stored_as,
options,
+ ..
} = self;
write!(f, "COPY {source} TO {target}")?;
+ if let Some(file_type) = stored_as {
+ write!(f, " STORED AS {}", file_type)?;
+ }
+ if !partitioned_by.is_empty() {
+ write!(f, " PARTITIONED BY ({})", partitioned_by.join(", "))?;
+ }
+
+ if self.has_header {
+ write!(f, " WITH HEADER ROW")?;
+ }
if !options.is_empty() {
let opts: Vec<_> = options.iter().map(|(k, v)| format!("{k}
{v}")).collect();
// print them in sorted order
Review Comment:
Is this comment accurate? I don't see an explicit sort here, is the `opts`
vector somehow constructed in a sorted way?
##########
datafusion/common/src/config.rs:
##########
@@ -1628,38 +1616,15 @@ mod tests {
);
}
- #[test]
- fn parquet_table_options() {
- let mut table_config = TableOptions::new();
- table_config
- .set("parquet.bloom_filter_enabled::col1", "true")
- .unwrap();
- assert_eq!(
-
table_config.parquet.column_specific_options["col1"].bloom_filter_enabled,
- Some(true)
- );
- }
-
#[test]
fn csv_u8_table_options() {
let mut table_config = TableOptions::new();
- table_config.set("csv.delimiter", ";").unwrap();
+ table_config.set_file_format(FileType::CSV);
+ table_config.set("format.delimiter", ";").unwrap();
assert_eq!(table_config.csv.delimiter as char, ';');
- table_config.set("csv.escape", "\"").unwrap();
+ table_config.set("format.escape", "\"").unwrap();
assert_eq!(table_config.csv.escape.unwrap() as char, '"');
- table_config.set("csv.escape", "\'").unwrap();
+ table_config.set("format.escape", "\'").unwrap();
assert_eq!(table_config.csv.escape.unwrap() as char, '\'');
}
-
- #[test]
- fn parquet_table_options_config_entry() {
- let mut table_config = TableOptions::new();
- table_config
- .set("parquet.bloom_filter_enabled::col1", "true")
- .unwrap();
- let entries = table_config.entries();
- assert!(entries
- .iter()
- .any(|item| item.key == "parquet.bloom_filter_enabled::col1"))
- }
Review Comment:
Similar to my comment above
##########
datafusion/common/src/config.rs:
##########
@@ -1628,38 +1616,15 @@ mod tests {
);
}
- #[test]
- fn parquet_table_options() {
- let mut table_config = TableOptions::new();
- table_config
- .set("parquet.bloom_filter_enabled::col1", "true")
- .unwrap();
- assert_eq!(
-
table_config.parquet.column_specific_options["col1"].bloom_filter_enabled,
- Some(true)
- );
- }
-
Review Comment:
It is not obvious to me why this is removed and not its CSV counterpart. It
seems this could be adapted like the CSV test too, as in:
```rust
#[cfg(feature = "parquet")]
#[test]
fn parquet_table_options() {
let mut table_config = TableOptions::new();
table_config.set_file_format(FileType::PARQUET);
table_config
.set("format.bloom_filter_enabled::col1", "true")
.unwrap();
assert_eq!(
table_config.parquet.column_specific_options["col1"].bloom_filter_enabled,
Some(true)
);
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]