From a23b014b80462862dfd0c5eec16d4c8066099d9a Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 26 Nov 2020 11:09:56 +0300 Subject: [PATCH 1/3] Re-implement partitionExists() --- .../sql/connector/catalog/SupportsPartitionManagement.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java index 380717d2e0e9b..a7dd33e8e1bf2 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java @@ -17,6 +17,7 @@ package org.apache.spark.sql.connector.catalog; +import java.util.Arrays; import java.util.Map; import org.apache.spark.annotation.Experimental; @@ -79,7 +80,9 @@ void createPartition( * @return true if the partition exists, false otherwise */ default boolean partitionExists(InternalRow ident) { - return listPartitionIdentifiers(ident).length > 0; + String[] partitionNames = partitionSchema().names(); + String[] requiredNames = Arrays.copyOfRange(partitionNames, 0, ident.numFields()); + return listPartitionByNames(requiredNames, ident).length > 0; } /** From 29519bbc211c0a9593767a67c195f99e5bc042dd Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 26 Nov 2020 11:27:18 +0300 Subject: [PATCH 2/3] Remove listPartitionIdentifiers() --- .../catalog/SupportsPartitionManagement.java | 8 ---- .../connector/InMemoryPartitionTable.scala | 8 ---- ...pportsAtomicPartitionManagementSuite.scala | 28 +++++++----- .../SupportsPartitionManagementSuite.scala | 44 ++++++++++--------- .../AlterTablePartitionV2SQLSuite.scala | 4 +- 5 files changed, 42 insertions(+), 50 deletions(-) diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java index a7dd33e8e1bf2..1d934d2798840 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java @@ -108,14 +108,6 @@ void replacePartitionMetadata( Map loadPartitionMetadata(InternalRow ident) throws UnsupportedOperationException; - /** - * List the identifiers of all partitions that have the ident prefix in a table. - * - * @param ident a prefix of partition identifier - * @return an array of Identifiers for the partitions - */ - InternalRow[] listPartitionIdentifiers(InternalRow ident); - /** * List the identifiers of all partitions that match to the ident by names. * diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala index ba762a58b1e52..b0d133a44bc57 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala @@ -83,14 +83,6 @@ class InMemoryPartitionTable( } } - def listPartitionIdentifiers(ident: InternalRow): Array[InternalRow] = { - val prefixPartCols = - new StructType(partitionSchema.dropRight(partitionSchema.length - ident.numFields).toArray) - val prefixPart = ident.toSeq(prefixPartCols) - memoryTablePartitions.keySet().asScala - .filter(_.toSeq(partitionSchema).startsWith(prefixPart)).toArray - } - override def partitionExists(ident: InternalRow): Boolean = memoryTablePartitions.containsKey(ident) diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala index 6f7c30653110b..4257d7402dad4 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala @@ -47,34 +47,38 @@ class SupportsAtomicPartitionManagementSuite extends SparkFunSuite { newCatalog } + private def hasPartitions(table: SupportsPartitionManagement): Boolean = { + !table.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty + } + test("createPartitions") { val table = catalog.loadTable(ident) val partTable = new InMemoryAtomicPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdents = Array(InternalRow.apply("3"), InternalRow.apply("4")) partTable.createPartitions( partIdents, Array(new util.HashMap[String, String](), new util.HashMap[String, String]())) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(InternalRow.apply("3"))) assert(partTable.partitionExists(InternalRow.apply("4"))) partTable.dropPartition(InternalRow.apply("3")) partTable.dropPartition(InternalRow.apply("4")) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("createPartitions failed if partition already exists") { val table = catalog.loadTable(ident) val partTable = new InMemoryAtomicPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("4") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(partIdent)) val partIdents = Array(InternalRow.apply("3"), InternalRow.apply("4")) @@ -85,42 +89,42 @@ class SupportsAtomicPartitionManagementSuite extends SparkFunSuite { assert(!partTable.partitionExists(InternalRow.apply("3"))) partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("dropPartitions") { val table = catalog.loadTable(ident) val partTable = new InMemoryAtomicPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdents = Array(InternalRow.apply("3"), InternalRow.apply("4")) partTable.createPartitions( partIdents, Array(new util.HashMap[String, String](), new util.HashMap[String, String]())) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(InternalRow.apply("3"))) assert(partTable.partitionExists(InternalRow.apply("4"))) partTable.dropPartitions(partIdents) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("dropPartitions failed if partition not exists") { val table = catalog.loadTable(ident) val partTable = new InMemoryAtomicPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("4") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 1) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) val partIdents = Array(InternalRow.apply("3"), InternalRow.apply("4")) assert(!partTable.dropPartitions(partIdents)) assert(partTable.partitionExists(partIdent)) partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } } diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala index caf7e91612563..a720221e8b2b3 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala @@ -48,97 +48,101 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { newCatalog } + private def hasPartitions(table: SupportsPartitionManagement): Boolean = { + !table.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty + } + test("createPartition") { val table = catalog.loadTable(ident) val partTable = new InMemoryPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("3") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(partIdent)) partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("dropPartition") { val table = catalog.loadTable(ident) val partTable = new InMemoryPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("3") val partIdent1 = InternalRow.apply("4") partTable.createPartition(partIdent, new util.HashMap[String, String]()) partTable.createPartition(partIdent1, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 2) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 2) partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 1) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) partTable.dropPartition(partIdent1) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("replacePartitionMetadata") { val table = catalog.loadTable(ident) val partTable = new InMemoryPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("3") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(partIdent)) assert(partTable.loadPartitionMetadata(partIdent).isEmpty) partTable.replacePartitionMetadata(partIdent, Map("paramKey" -> "paramValue").asJava) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(partIdent)) assert(!partTable.loadPartitionMetadata(partIdent).isEmpty) assert(partTable.loadPartitionMetadata(partIdent).get("paramKey") == "paramValue") partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("loadPartitionMetadata") { val table = catalog.loadTable(ident) val partTable = new InMemoryPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("3") partTable.createPartition(partIdent, Map("paramKey" -> "paramValue").asJava) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).nonEmpty) + assert(hasPartitions(partTable)) assert(partTable.partitionExists(partIdent)) assert(!partTable.loadPartitionMetadata(partIdent).isEmpty) assert(partTable.loadPartitionMetadata(partIdent).get("paramKey") == "paramValue") partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("listPartitionIdentifiers") { val table = catalog.loadTable(ident) val partTable = new InMemoryPartitionTable( table.name(), table.schema(), table.partitioning(), table.properties()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) val partIdent = InternalRow.apply("3") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 1) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) val partIdent1 = InternalRow.apply("4") partTable.createPartition(partIdent1, new util.HashMap[String, String]()) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 2) - assert(partTable.listPartitionIdentifiers(partIdent1).length == 1) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 2) + assert(partTable.listPartitionByNames(Array("dt"), partIdent1).length == 1) partTable.dropPartition(partIdent) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).length == 1) + assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) partTable.dropPartition(partIdent1) - assert(partTable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(!hasPartitions(partTable)) } test("listPartitionByNames") { diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala index 4cacd5ec2b49e..fb7186ea97a63 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala @@ -141,7 +141,7 @@ class AlterTablePartitionV2SQLSuite extends DatasourceV2SQLBase { catalog("testpart").asTableCatalog.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(2)))) - assert(partTable.asPartitionable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(partTable.asPartitionable.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty) } } @@ -161,7 +161,7 @@ class AlterTablePartitionV2SQLSuite extends DatasourceV2SQLBase { spark.sql(s"ALTER TABLE $t DROP IF EXISTS PARTITION (id=1), PARTITION (id=2)") assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(2)))) - assert(partTable.asPartitionable.listPartitionIdentifiers(InternalRow.empty).isEmpty) + assert(partTable.asPartitionable.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty) } } From 99cd1c229c4a1ca3d414f9b639c30492c634c24a Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Thu, 26 Nov 2020 11:38:03 +0300 Subject: [PATCH 3/3] listPartitionByNames() -> listPartitionIdentifiers() --- .../catalog/SupportsPartitionManagement.java | 4 ++-- .../sql/connector/InMemoryPartitionTable.scala | 2 +- ...upportsAtomicPartitionManagementSuite.scala | 4 ++-- .../SupportsPartitionManagementSuite.scala | 18 +++++++++--------- .../AlterTablePartitionV2SQLSuite.scala | 6 ++++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java index 1d934d2798840..9d898f2f477e1 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java @@ -82,7 +82,7 @@ void createPartition( default boolean partitionExists(InternalRow ident) { String[] partitionNames = partitionSchema().names(); String[] requiredNames = Arrays.copyOfRange(partitionNames, 0, ident.numFields()); - return listPartitionByNames(requiredNames, ident).length > 0; + return listPartitionIdentifiers(requiredNames, ident).length > 0; } /** @@ -115,5 +115,5 @@ Map loadPartitionMetadata(InternalRow ident) * @param ident a partition identifier values. * @return an array of Identifiers for the partitions */ - InternalRow[] listPartitionByNames(String[] names, InternalRow ident); + InternalRow[] listPartitionIdentifiers(String[] names, InternalRow ident); } diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala index b0d133a44bc57..6a8432e635310 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryPartitionTable.scala @@ -90,7 +90,7 @@ class InMemoryPartitionTable( memoryTablePartitions.put(InternalRow.fromSeq(key), Map.empty[String, String].asJava) } - override def listPartitionByNames( + override def listPartitionIdentifiers( names: Array[String], ident: InternalRow): Array[InternalRow] = { assert(names.length == ident.numFields, diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala index 4257d7402dad4..ad2631650b7ef 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsAtomicPartitionManagementSuite.scala @@ -48,7 +48,7 @@ class SupportsAtomicPartitionManagementSuite extends SparkFunSuite { } private def hasPartitions(table: SupportsPartitionManagement): Boolean = { - !table.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty + !table.listPartitionIdentifiers(Array.empty, InternalRow.empty).isEmpty } test("createPartitions") { @@ -118,7 +118,7 @@ class SupportsAtomicPartitionManagementSuite extends SparkFunSuite { val partIdent = InternalRow.apply("4") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 1) val partIdents = Array(InternalRow.apply("3"), InternalRow.apply("4")) assert(!partTable.dropPartitions(partIdents)) diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala index a720221e8b2b3..9de0fe6108c99 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/SupportsPartitionManagementSuite.scala @@ -49,7 +49,7 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { } private def hasPartitions(table: SupportsPartitionManagement): Boolean = { - !table.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty + !table.listPartitionIdentifiers(Array.empty, InternalRow.empty).isEmpty } test("createPartition") { @@ -77,10 +77,10 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { val partIdent1 = InternalRow.apply("4") partTable.createPartition(partIdent, new util.HashMap[String, String]()) partTable.createPartition(partIdent1, new util.HashMap[String, String]()) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 2) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 2) partTable.dropPartition(partIdent) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 1) partTable.dropPartition(partIdent1) assert(!hasPartitions(partTable)) } @@ -132,15 +132,15 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { val partIdent = InternalRow.apply("3") partTable.createPartition(partIdent, new util.HashMap[String, String]()) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 1) val partIdent1 = InternalRow.apply("4") partTable.createPartition(partIdent1, new util.HashMap[String, String]()) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 2) - assert(partTable.listPartitionByNames(Array("dt"), partIdent1).length == 1) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 2) + assert(partTable.listPartitionIdentifiers(Array("dt"), partIdent1).length == 1) partTable.dropPartition(partIdent) - assert(partTable.listPartitionByNames(Array.empty, InternalRow.empty).length == 1) + assert(partTable.listPartitionIdentifiers(Array.empty, InternalRow.empty).length == 1) partTable.dropPartition(partIdent1) assert(!hasPartitions(partTable)) } @@ -174,7 +174,7 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { (Array("part0", "part1"), InternalRow(3, "xyz")) -> Set(), (Array("part1"), InternalRow(3.14f)) -> Set() ).foreach { case ((names, idents), expected) => - assert(partTable.listPartitionByNames(names, idents).toSet === expected) + assert(partTable.listPartitionIdentifiers(names, idents).toSet === expected) } // Check invalid parameters Seq( @@ -182,7 +182,7 @@ class SupportsPartitionManagementSuite extends SparkFunSuite { (Array("col0", "part1"), InternalRow(0, 1)), (Array("wrong"), InternalRow("invalid")) ).foreach { case (names, idents) => - intercept[AssertionError](partTable.listPartitionByNames(names, idents)) + intercept[AssertionError](partTable.listPartitionIdentifiers(names, idents)) } } } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala index fb7186ea97a63..3583eceec7559 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala @@ -141,7 +141,8 @@ class AlterTablePartitionV2SQLSuite extends DatasourceV2SQLBase { catalog("testpart").asTableCatalog.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(2)))) - assert(partTable.asPartitionable.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty) + assert( + partTable.asPartitionable.listPartitionIdentifiers(Array.empty, InternalRow.empty).isEmpty) } } @@ -161,7 +162,8 @@ class AlterTablePartitionV2SQLSuite extends DatasourceV2SQLBase { spark.sql(s"ALTER TABLE $t DROP IF EXISTS PARTITION (id=1), PARTITION (id=2)") assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(2)))) - assert(partTable.asPartitionable.listPartitionByNames(Array.empty, InternalRow.empty).isEmpty) + assert( + partTable.asPartitionable.listPartitionIdentifiers(Array.empty, InternalRow.empty).isEmpty) } }