This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-1.3
in repository https://gitbox.apache.org/repos/asf/paimon.git

commit 673471f3209fa7513512d0c76b8d46cfef1cbceb
Author: Zouxxyy <[email protected]>
AuthorDate: Sat Oct 11 10:37:30 2025 +0800

    [spark] Improve the exception msg for unsupported type (#6379)
---
 .../paimon/spark/sql/InsertOverwriteTableTestBase.scala | 17 ++++++++++++++++-
 .../org/apache/spark/sql/paimon/shims/Spark3Shim.scala  |  3 +--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/InsertOverwriteTableTestBase.scala
 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/InsertOverwriteTableTestBase.scala
index 467cd72f77..92e2c3ee19 100644
--- 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/InsertOverwriteTableTestBase.scala
+++ 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/InsertOverwriteTableTestBase.scala
@@ -20,13 +20,16 @@ package org.apache.paimon.spark.sql
 
 import org.apache.paimon.spark.PaimonSparkTestBase
 
-import org.apache.spark.sql.Row
+import org.apache.spark.sql.{Row, SaveMode}
+import org.apache.spark.sql.functions.lit
 import org.apache.spark.sql.types._
 
 import java.sql.{Date, Timestamp}
 
 abstract class InsertOverwriteTableTestBase extends PaimonSparkTestBase {
 
+  import testImplicits._
+
   fileFormats.foreach {
     fileFormat =>
       Seq(true, false).foreach {
@@ -639,4 +642,16 @@ abstract class InsertOverwriteTableTestBase extends 
PaimonSparkTestBase {
       }
     }
   }
+
+  test("Paimon Insert: insert unsupported type") {
+    val rows = Seq(("1", "2")).toDF("f1", "f2")
+    assert(intercept[Exception] {
+      rows
+        .withColumn("bad", lit(null))
+        .write
+        .format("paimon")
+        .mode(SaveMode.Overwrite)
+        .saveAsTable("badTable")
+    }.getMessage.contains("Not a supported type: void"))
+  }
 }
diff --git 
a/paimon-spark/paimon-spark3-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark3Shim.scala
 
b/paimon-spark/paimon-spark3-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark3Shim.scala
index 74803626d6..b9eafe0544 100644
--- 
a/paimon-spark/paimon-spark3-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark3Shim.scala
+++ 
b/paimon-spark/paimon-spark3-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark3Shim.scala
@@ -103,8 +103,7 @@ class Spark3Shim extends SparkShim {
 
   override def toPaimonVariant(o: Object): Variant = throw new 
UnsupportedOperationException()
 
-  override def isSparkVariantType(dataType: 
org.apache.spark.sql.types.DataType): Boolean =
-    throw new UnsupportedOperationException()
+  override def isSparkVariantType(dataType: 
org.apache.spark.sql.types.DataType): Boolean = false
 
   override def SparkVariantType(): org.apache.spark.sql.types.DataType =
     throw new UnsupportedOperationException()

Reply via email to