devinjdangelo commented on code in PR #9240:
URL: https://github.com/apache/arrow-datafusion/pull/9240#discussion_r1493043907
##########
datafusion/common/src/file_options/mod.rs:
##########
@@ -97,6 +97,20 @@ impl StatementOptions {
maybe_option.map(|(_, v)| v)
}
+ /// Finds partition_by option if exists and parses into a `Vec<String>`.
+ /// If option doesn't exist, returns empty `vec![]`.
+ /// E.g. (partition_by 'colA, colB, colC') -> `vec!['colA','colB','colC']`
+ pub fn take_partition_by(&mut self) -> Vec<String> {
+ let partition_by = self.take_str_option("partition_by");
+ match partition_by {
+ Some(part_cols) => part_cols
+ .split(',')
+ .map(|s| s.trim().replace('\'', ""))
Review Comment:
Yes the current parsing logic will not work for columns with single
quotes... e.g.
```sql
create table test ("'test'" varchar, "'test2'" varchar);
```
I'll see if I can generalize the parsing a bit. It seems standard convention
in SQL and postgres is to use double single quotes to escape within a string
literal.
--
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]