dongjoon-hyun commented on a change in pull request #25807: [SPARK-25153][SQL]
Improve error messages for columns with dots/periods
URL: https://github.com/apache/spark/pull/25807#discussion_r326844486
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
##########
@@ -256,8 +256,13 @@ class Dataset[T] private[sql](
private[sql] def resolve(colName: String): NamedExpression = {
queryExecution.analyzed.resolveQuoted(colName,
sparkSession.sessionState.analyzer.resolver)
.getOrElse {
- throw new AnalysisException(
- s"""Cannot resolve column name "$colName" among
(${schema.fieldNames.mkString(", ")})""")
+ val fields = schema.fieldNames
+ val extraMsg = if
(fields.exists(sparkSession.sessionState.analyzer.resolver(_, colName))) {
+ s"; did you mean to quote the `${colName}` column?"
Review comment:
nit. `${colName}` -> `$colName`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]