vegarsti commented on PR #16985: URL: https://github.com/apache/datafusion/pull/16985#issuecomment-3148597782
> I discovered [`EquivalenceProperties.project`](https://github.com/apache/datafusion/blob/b4e7147c85b52addd687e5524e6ebbc5ad7d675d/datafusion/physical-expr/src/equivalence/properties/mod.rs#L1127-L1144), which seems to do what we need: We can get the unnest plan's equivalence properties by doing `input_eq_properties.project(unnested_columns, schema)`, i.e. discarding the properties of the columns that are being unnested. > > I have updated the PR doing that. > > Equivalence properties are > > 1. equivalence groups (expressions with the same value) > 2. ordering equivalence classes (expressions that define the same ordering) > 3. table constraints - these can be primary key or unique > > I am pretty sure that this takes care of 1 and 2, since we now have no equivalence properties for the columns. I am not yet sure about 3, though - if the original expression uses a column that is a primary key, after the unnest we will have multiple rows with the same column. Does that mean we need to remove that constraint from the eq properties? It kinda sounds like yes, but I need to see exactly what it's being used for. After reading some more I have now updated it so that we remove any constraint from the properties. I've updated the PR with a lengthy description. I am fairly convinced this is semantically sound now. FYI @alamb and @asubiotto -- 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