rdblue commented on code in PR #9510: URL: https://github.com/apache/iceberg/pull/9510#discussion_r1468933314
########## spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckViews.scala: ########## @@ -36,6 +38,9 @@ object CheckViews extends (LogicalPlan => Unit) { verifyColumnCount(ident, columnAliases, query) SchemaUtils.checkColumnNameDuplication(query.schema.fieldNames, SQLConf.get.resolver) + case AlterViewAs(ResolvedV2View(_, _, _), _, query) => + SchemaUtils.checkColumnNameDuplication(query.schema.fieldNames, SQLConf.get.resolver) Review Comment: This worries me. Are the aliases from the original create expected to be applied to the new view version? I don't think that the expected behavior is for the column comments and aliases to go away. For example, if I ran these two statements, what should happen? ```sql -- original create command CREATE VIEW daily_signups ( signup_count COMMENT 'Number of signups', day COMMENT 'Signup date') AS SELECT count(1), day FROM signups GROUP BY day -- updated view with DISTINCT to deduplicate ALTER VIEW daily_signups AS SELECT count(distinct email), day FROM signups GROUP BY day ``` To me, it seems like this should work and result in the same view schema, with `signup_count` as the first column and the column docs preserved. That probably means that we need to store the column names and comments separately after all, or at least flag that they were set somewhere (view properties?). Also, it looks like the indentation is inconsistent between this and other cases. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org