cloud-fan commented on a change in pull request #30806:
URL: https://github.com/apache/spark/pull/30806#discussion_r546734400
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -195,33 +196,42 @@ class DataSourceV2Strategy(session: SparkSession) extends
Strategy with Predicat
orCreate = orCreate) :: Nil
}
- case AppendData(r: DataSourceV2Relation, query, writeOptions, _) =>
- r.table.asWritable match {
- case v1 if v1.supports(TableCapability.V1_BATCH_WRITE) =>
- AppendDataExecV1(v1, writeOptions.asOptions, query, refreshCache(r))
:: Nil
- case v2 =>
- AppendDataExec(v2, writeOptions.asOptions, planLater(query),
refreshCache(r)) :: Nil
+ case AppendData(r @ DataSourceV2Relation(v1: SupportsWrite, _, _, _, _),
query, writeOptions,
+ _, Some(write)) if v1.supports(TableCapability.V1_BATCH_WRITE) =>
+ write match {
+ case v1Write: V1Write =>
+ AppendDataExecV1(v1, writeOptions.asOptions, query, refreshCache(r),
v1Write) :: Nil
+ case v2Write =>
+ throw new AnalysisException(
+ s"Table ${v1.name} declares ${TableCapability.V1_BATCH_WRITE}
capability but " +
+ s"${v2Write.getClass} is not an instance of ${classOf[V1Write]}")
Review comment:
`classOf[V1Write].getName`
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]