@@ -22,15 +22,15 @@ import scala.collection.mutable
2222
2323import org .apache .spark .annotation .Experimental
2424import org .apache .spark .sql .catalog .v2 .expressions .{LogicalExpressions , Transform }
25- import org .apache .spark .sql .catalyst .analysis .{ NoSuchTableException , TableAlreadyExistsException }
25+ import org .apache .spark .sql .catalyst .analysis .NoSuchTableException
2626import org .apache .spark .sql .catalyst .expressions .{Attribute , Bucket , Days , Hours , Literal , Months , Years }
2727import org .apache .spark .sql .catalyst .plans .logical .{AppendData , CreateTableAsSelect , LogicalPlan , OverwriteByExpression , OverwritePartitionsDynamic , ReplaceTableAsSelect }
2828import org .apache .spark .sql .execution .SQLExecution
2929import org .apache .spark .sql .execution .datasources .v2 .DataSourceV2Relation
3030import org .apache .spark .sql .types .IntegerType
3131
3232/**
33- * Interface used to write a [[Dataset ]] to external storage using the v2 API.
33+ * Interface used to write a [[org.apache.spark.sql. Dataset ]] to external storage using the v2 API.
3434 *
3535 * @since 3.0.0
3636 */
@@ -78,14 +78,6 @@ final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
7878 this
7979 }
8080
81- override def option (key : String , value : Boolean ): DataFrameWriterV2 [T ] =
82- option(key, value.toString)
83-
84- override def option (key : String , value : Long ): DataFrameWriterV2 [T ] = option(key, value.toString)
85-
86- override def option (key : String , value : Double ): DataFrameWriterV2 [T ] =
87- option(key, value.toString)
88-
8981 override def options (options : scala.collection.Map [String , String ]): DataFrameWriterV2 [T ] = {
9082 options.foreach {
9183 case (key, value) =>
@@ -155,11 +147,12 @@ final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
155147 /**
156148 * Append the contents of the data frame to the output table.
157149 *
158- * If the output table does not exist, this operation will fail with [[NoSuchTableException ]]. The
159- * data frame will be validated to ensure it is compatible with the existing table.
150+ * If the output table does not exist, this operation will fail with
151+ * [[org.apache.spark.sql.catalyst.analysis.NoSuchTableException ]]. The data frame will be
152+ * validated to ensure it is compatible with the existing table.
160153 *
161154 *
162- * @throws NoSuchTableException If the table does not exist.
155+ * @throws org.apache.spark.sql.catalyst.analysis. NoSuchTableException If the table does not exist
163156 */
164157 def append (): Unit = {
165158 val append = loadTable(catalog, identifier) match {
@@ -176,10 +169,11 @@ final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
176169 * Overwrite rows matching the given filter condition with the contents of the data frame in
177170 * the output table.
178171 *
179- * If the output table does not exist, this operation will fail with [[NoSuchTableException ]]. The
180- * data frame will be validated to ensure it is compatible with the existing table.
172+ * If the output table does not exist, this operation will fail with
173+ * [[org.apache.spark.sql.catalyst.analysis.NoSuchTableException ]].
174+ * The data frame will be validated to ensure it is compatible with the existing table.
181175 *
182- * @throws NoSuchTableException If the table does not exist.
176+ * @throws org.apache.spark.sql.catalyst.analysis. NoSuchTableException If the table does not exist
183177 */
184178 def overwrite (condition : Column ): Unit = {
185179 val overwrite = loadTable(catalog, identifier) match {
@@ -200,10 +194,11 @@ final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
200194 * This operation is equivalent to Hive's `INSERT OVERWRITE ... PARTITION`, which replaces
201195 * partitions dynamically depending on the contents of the data frame.
202196 *
203- * If the output table does not exist, this operation will fail with [[NoSuchTableException ]]. The
204- * data frame will be validated to ensure it is compatible with the existing table.
197+ * If the output table does not exist, this operation will fail with
198+ * [[org.apache.spark.sql.catalyst.analysis.NoSuchTableException ]]. The data frame will be
199+ * validated to ensure it is compatible with the existing table.
205200 *
206- * @throws NoSuchTableException If the table does not exist.
201+ * @throws org.apache.spark.sql.catalyst.analysis. NoSuchTableException If the table does not exist
207202 */
208203 def overwritePartitions (): Unit = {
209204 val dynamicOverwrite = loadTable(catalog, identifier) match {
@@ -220,10 +215,8 @@ final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
220215 /**
221216 * Wrap an action to track the QueryExecution and time cost, then report to the user-registered
222217 * callback functions.
223- *
224- * Visible for testing.
225218 */
226- private [sql] def runCommand (name : String )(command : LogicalPlan ): Unit = {
219+ private def runCommand (name : String )(command : LogicalPlan ): Unit = {
227220 val qe = sparkSession.sessionState.executePlan(command)
228221 // call `QueryExecution.toRDD` to trigger the execution of commands.
229222 SQLExecution .withNewExecutionId(sparkSession, qe, Some (name))(qe.toRdd)
@@ -260,21 +253,21 @@ trait WriteConfigMethods[R] {
260253 *
261254 * @since 3.0.0
262255 */
263- def option (key : String , value : Boolean ): R
256+ def option (key : String , value : Boolean ): R = option(key, value.toString)
264257
265258 /**
266259 * Add a long output option.
267260 *
268261 * @since 3.0.0
269262 */
270- def option (key : String , value : Long ): R
263+ def option (key : String , value : Long ): R = option(key, value.toString)
271264
272265 /**
273266 * Add a double output option.
274267 *
275268 * @since 3.0.0
276269 */
277- def option (key : String , value : Double ): R
270+ def option (key : String , value : Double ): R = option(key, value.toString)
278271
279272 /**
280273 * Add write options from a Scala Map.
@@ -301,9 +294,11 @@ trait CreateTableWriter[T] extends WriteConfigMethods[CreateTableWriter[T]] {
301294 * The new table's schema, partition layout, properties, and other configuration will be
302295 * based on the configuration set on this writer.
303296 *
304- * If the output table exists, this operation will fail with [[TableAlreadyExistsException ]].
297+ * If the output table exists, this operation will fail with
298+ * [[org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException ]].
305299 *
306- * @throws TableAlreadyExistsException If the table already exists.
300+ * @throws org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
301+ * If the table already exists
307302 */
308303 def create (): Unit
309304
@@ -313,9 +308,11 @@ trait CreateTableWriter[T] extends WriteConfigMethods[CreateTableWriter[T]] {
313308 * The existing table's schema, partition layout, properties, and other configuration will be
314309 * replaced with the contents of the data frame and the configuration set on this writer.
315310 *
316- * If the output table exists, this operation will fail with [[TableAlreadyExistsException ]].
311+ * If the output table exists, this operation will fail with
312+ * [[org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException ]].
317313 *
318- * @throws TableAlreadyExistsException If the table already exists.
314+ * @throws org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
315+ * If the table already exists
319316 */
320317 def replace (): Unit
321318
@@ -326,14 +323,16 @@ trait CreateTableWriter[T] extends WriteConfigMethods[CreateTableWriter[T]] {
326323 * on the contents of the data frame and the configuration set on this writer. If the table
327324 * exists, its configuration and data will be replaced.
328325 *
329- * If the output table exists, this operation will fail with [[TableAlreadyExistsException ]].
326+ * If the output table exists, this operation will fail with
327+ * [[org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException ]].
330328 *
331- * @throws TableAlreadyExistsException If the table already exists.
329+ * @throws org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
330+ * If the table already exists
332331 */
333332 def createOrReplace (): Unit
334333
335334 /**
336- * Partition the output table created by [[ create ]], [[ createOrReplace ]] , or [[ replace ]] using
335+ * Partition the output table created by ` create`, ` createOrReplace` , or ` replace` using
337336 * the given columns or transforms.
338337 *
339338 * When specified, the table data will be stored by these values for efficient reads.
0 commit comments