cloud-fan commented on code in PR #40126: URL: https://github.com/apache/spark/pull/40126#discussion_r1129378877
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala: ########## @@ -465,7 +465,23 @@ class Analyzer(override val catalogManager: CatalogManager) extends RuleExecutor } /** - * Replaces [[UnresolvedAlias]]s with concrete aliases. + * Replaces [[UnresolvedAlias]]s with concrete aliases by applying the following rules: + * 1. Use the specified name of named expressions; + * 2. Derive stable aliases from the lexer tree of the original SQL text by concatenating of + * terms via a single space, and applying the additional rules: + * 2.0. Don't add a space between terms if at least one of them contains a char which is not + * a letter and a digit. + * 2.1. Normalize SQL string literals when ANSI mode is enabled and the SQL config + * `spark.sql.ansi.doubleQuotedIdentifiers` is set to `true`. + * For example: "abc" => 'abc' + * 2.2. A multipart identifier (column, field, mapkey, ...) -> the right most identifier. + * For example: a.b.c => c + * 2.3. A CAST, or try_cast -> the argument of the cast. + * For example: CAST(c1 AS INT) => c1 + * 2.4. A map lookup with a literal -> the map key. + * For example: map[5] => 5 Review Comment: is this really what we want? what was the previous behavior? -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
