jonahgao commented on issue #14112: URL: https://github.com/apache/datafusion/issues/14112#issuecomment-2589171284
This is disallowed by #12608, because its output schema contains duplicate names and can lead to ambiguous references. Postgres also does not allow self-join unless a different table alias is specified. ```sh psql (16.6 (Ubuntu 16.6-0ubuntu0.24.04.1)) Type "help" for help. psql=> select * from t1 cross join t1; ERROR: table name "t1" specified more than once psql=> select * from t1 cross join t1 t2; a | b | a | b ---+---+---+--- 1 | 1 | 1 | 1 (1 row) ``` I think we can add an `alias()` method for `DataFrame`. Similar to [pyspark.sql.DataFrame.alias](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.alias.html#) ```rust impl DataFrame { pub fn alias(self, alias: impl Into<TableReference>) -> Result<DataFrame> { let plan = LogicalPlanBuilder::from(self.plan).alias(alias)?.build()?; Ok(DataFrame { session_state: self.session_state, plan, }) } } ``` -- 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