alamb commented on code in PR #11577: URL: https://github.com/apache/datafusion/pull/11577#discussion_r1769535649
########## datafusion/expr/src/logical_plan/plan.rs: ########## @@ -3049,17 +3051,54 @@ pub enum Partitioning { DistributeBy(Vec<Expr>), } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ColumnUnnestType { + List(Vec<ColumnUnnestList>), + // for struct, there can only be one unnest performed on one column at a time + Struct, + // Infer the unnest type based on column schema + // If column is a list column, the unnest depth will be 1 + // This value is to support sugar syntax of old api (unnest(columns1,columns2)) + Inferred, +} + +impl fmt::Display for ColumnUnnestType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ColumnUnnestType::List(lists) => { + let list_strs: Vec<String> = + lists.iter().map(|list| list.to_string()).collect(); + write!(f, "List([{}])", list_strs.join(", ")) + } + ColumnUnnestType::Struct => write!(f, "Struct"), + ColumnUnnestType::Inferred => write!(f, "Inferred"), + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] Review Comment: Can we please add documentation to this struct about what it means (what computation it represents)? In the context of this PR it is clear, but once we merge I think the context will be lost ########## datafusion/expr/src/logical_plan/plan.rs: ########## @@ -3049,17 +3051,54 @@ pub enum Partitioning { DistributeBy(Vec<Expr>), } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ColumnUnnestType { + List(Vec<ColumnUnnestList>), Review Comment: Can you please add documentation to `List` about what it is (ideally with an example of when it is used and how it is different to `Inferred`? -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org