cloud-fan commented on code in PR #51098:
URL: https://github.com/apache/spark/pull/51098#discussion_r2130128163


##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala:
##########
@@ -138,6 +140,61 @@ private[v2] trait V2JDBCTest extends SharedSparkSession 
with DockerIntegrationFu
     )
   }
 
+  case class PartitioningInfo(
+    numPartitions: String,
+    lowerBound: String,
+    upperBound: String,
+    partitionColumn: String
+  )
+  val tableNameToPartinioningOptions: Map[String, PartitioningInfo] = Map(
+    "employee" -> PartitioningInfo("4", "1", "8", "dept"),
+    // new_table is used in "SPARK-37038: Test TABLESAMPLE" test
+    "new_table" -> PartitioningInfo("4", "1", "20", "col1")
+  )
+
+  protected def getPartitioningInfo(testTableName: String): (String, 
Option[PartitioningInfo]) = {
+    tableNameToPartinioningOptions.get(testTableName) match {
+      case Some(partitionInfo) =>
+        val partitioningInfoString = Seq(
+          s"'numPartitions' '${partitionInfo.numPartitions}'",
+          s"'lowerBound' '${partitionInfo.lowerBound}'",
+          s"'upperBound' '${partitionInfo.upperBound}'",
+          s"'partitionColumn' '${partitionInfo.partitionColumn}'"
+        ).mkString(",")
+        (s"WITH ($partitioningInfoString)", Some(partitionInfo))
+      case _ => ("", None)
+    }
+  }
+
+  private def getTableOptions(
+    tableName: String,

Review Comment:
   ditto, 4 spaces indentation



##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/V2JDBCTest.scala:
##########
@@ -138,6 +140,61 @@ private[v2] trait V2JDBCTest extends SharedSparkSession 
with DockerIntegrationFu
     )
   }
 
+  case class PartitioningInfo(
+    numPartitions: String,
+    lowerBound: String,
+    upperBound: String,
+    partitionColumn: String
+  )
+  val tableNameToPartinioningOptions: Map[String, PartitioningInfo] = Map(
+    "employee" -> PartitioningInfo("4", "1", "8", "dept"),
+    // new_table is used in "SPARK-37038: Test TABLESAMPLE" test
+    "new_table" -> PartitioningInfo("4", "1", "20", "col1")
+  )
+
+  protected def getPartitioningInfo(testTableName: String): (String, 
Option[PartitioningInfo]) = {
+    tableNameToPartinioningOptions.get(testTableName) match {
+      case Some(partitionInfo) =>
+        val partitioningInfoString = Seq(
+          s"'numPartitions' '${partitionInfo.numPartitions}'",
+          s"'lowerBound' '${partitionInfo.lowerBound}'",
+          s"'upperBound' '${partitionInfo.upperBound}'",
+          s"'partitionColumn' '${partitionInfo.partitionColumn}'"
+        ).mkString(",")
+        (s"WITH ($partitioningInfoString)", Some(partitionInfo))
+      case _ => ("", None)
+    }
+  }
+
+  private def getTableOptions(
+    tableName: String,
+    partitioningEnabled: Boolean): (String, Option[PartitioningInfo]) = {
+    if (partitioningEnabled) {
+      getPartitioningInfo(tableName)
+    } else {
+      ("", None)
+    }
+  }
+
+  // This method is used to verify that the number of JDBCRDD partitions is
+  // equal to numPartitions
+  def multiplePartitionAdditionalCheck(
+    df: DataFrame,

Review Comment:
   ditto



-- 
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]

Reply via email to