Skip to content

Commit 362e8b8

Browse files
committed
Check that insert into the existing partition does not fail
1 parent ff0f1f8 commit 362e8b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,11 +2469,15 @@ class DataSourceV2SQLSuite
24692469
|CREATE TABLE $t (id bigint, city string, data string)
24702470
|USING foo
24712471
|PARTITIONED BY (id, city)""".stripMargin)
2472-
sql(s"INSERT INTO $t PARTITION(id = 1, city = 'NY') SELECT 'abc'")
2473-
24742472
val partTable = catalog("testpart").asTableCatalog
24752473
.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")).asInstanceOf[InMemoryPartitionTable]
2476-
assert(partTable.partitionExists(InternalRow.fromSeq(Seq(1, UTF8String.fromString("NY")))))
2474+
val expectedPartitionIdent = InternalRow.fromSeq(Seq(1, UTF8String.fromString("NY")))
2475+
assert(!partTable.partitionExists(expectedPartitionIdent))
2476+
sql(s"INSERT INTO $t PARTITION(id = 1, city = 'NY') SELECT 'abc'")
2477+
assert(partTable.partitionExists(expectedPartitionIdent))
2478+
// Insert into the existing partition must not fail
2479+
sql(s"INSERT INTO $t PARTITION(id = 1, city = 'NY') SELECT 'def'")
2480+
assert(partTable.partitionExists(expectedPartitionIdent))
24772481
}
24782482
}
24792483

0 commit comments

Comments
 (0)