MaxGekk commented on code in PR #47873:
URL: https://github.com/apache/spark/pull/47873#discussion_r1732463099
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/SaveIntoDataSourceCommand.scala:
##########
@@ -44,8 +45,23 @@ case class SaveIntoDataSourceCommand(
override def innerChildren: Seq[QueryPlan[_]] = Seq(query)
override def run(sparkSession: SparkSession): Seq[Row] = {
- val relation = dataSource.createRelation(
- sparkSession.sqlContext, mode, options, Dataset.ofRows(sparkSession,
query))
+ var relation: BaseRelation = null
Review Comment:
I didn't get why do you this trick. Why cannot you just assign the result of
`try {} ..` to `val BaseRelation = `
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -3982,6 +3982,14 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase with Compilat
messageParameters = Map("provider" -> name))
}
+ def externalDataSourceException(cause: Option[Throwable]): Throwable = {
+ new AnalysisException(
+ errorClass = "DATA_SOURCE_EXTERNAL_ERROR",
+ messageParameters = Map("error" ->
cause.getOrElse("unknown").getClass.toString),
Review Comment:
You already added `cause` as a parameter to `AnalysisException`. Let's don't
1. duplicate error message; 2. avoid embedding a random uncontrolled text to
error messages.
--
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]