Skip to content

Commit 31ce720

Browse files
committed
address comments
1 parent d00bd85 commit 31ce720

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/NamedRelation.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
2222
trait NamedRelation extends LogicalPlan {
2323
def name: String
2424

25-
// When true, the schema of input data must match the schema of this relation, during write.
26-
def requireSchemaMatch: Boolean = true
25+
// When false, the schema of input data must match the schema of this relation, during write.
26+
def skipSchemaResolution: Boolean = false
2727
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ trait V2WriteCommand extends Command {
394394

395395
def outputResolved: Boolean = {
396396
// If the table doesn't require schema match, we don't need to resolve the output columns.
397-
!table.requireSchemaMatch || {
397+
table.skipSchemaResolution || {
398398
table.resolved && query.resolved && query.output.size == table.output.size &&
399399
query.output.zip(table.output).forall {
400400
case (inAttr, outAttr) =>

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/DataSourceV2AnalysisSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ case class TestRelation(output: Seq[AttributeReference]) extends LeafNode with N
107107
case class TestRelationAcceptAnySchema(output: Seq[AttributeReference])
108108
extends LeafNode with NamedRelation {
109109
override def name: String = "test-name"
110-
override def requireSchemaMatch: Boolean = false
110+
override def skipSchemaResolution: Boolean = true
111111
}
112112

113113
abstract class DataSourceV2AnalysisSuite extends AnalysisTest {

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Relation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ case class DataSourceV2Relation(
4444

4545
override def name: String = table.name()
4646

47-
override def requireSchemaMatch: Boolean = !table.supports(TableCapability.ACCEPT_ANY_SCHEMA)
47+
override def skipSchemaResolution: Boolean = table.supports(TableCapability.ACCEPT_ANY_SCHEMA)
4848

4949
override def simpleString(maxFields: Int): String = {
5050
s"RelationV2${truncatedString(output, "[", ", ", "]", maxFields)} $name"

0 commit comments

Comments
 (0)