This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new b360d1436f [spark] Merge into query fails for is non null condition
(#9252)
b360d1436f is described below
commit b360d1436ffafe0ce94e09e59da8336dd72071cc
Author: Arnav Balyan <[email protected]>
AuthorDate: Mon Aug 17 09:48:14 2026 +0530
[spark] Merge into query fails for is non null condition (#9252)
---
.../spark/catalyst/analysis/RowLevelHelper.scala | 1 +
.../paimon/spark/sql/MergeIntoAlignmentTest.scala | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git
a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/RowLevelHelper.scala
b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/RowLevelHelper.scala
index da43948676..b38b3aada6 100644
---
a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/RowLevelHelper.scala
+++
b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/RowLevelHelper.scala
@@ -66,6 +66,7 @@ trait RowLevelHelper extends SQLConfHelper {
.filterNot {
case BinaryExpression(left, right) => left == right
case Assignment(key, value) => key == value
+ case _ => false
}
.exists {
case EqualTo(left: AttributeReference, right: AttributeReference) =>
diff --git
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/MergeIntoAlignmentTest.scala
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/MergeIntoAlignmentTest.scala
index 6dd00cc7c1..3890a5bc52 100644
---
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/MergeIntoAlignmentTest.scala
+++
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/MergeIntoAlignmentTest.scala
@@ -24,6 +24,29 @@ import org.apache.spark.sql.Row
class MergeIntoAlignmentTest extends PaimonSparkTestBase {
+ test("merge into with is not null in condition") {
+ withTable("t") {
+ sql("""CREATE TABLE t (id INT, b INT, v STRING)
+ | USING paimon
+ | TBLPROPERTIES ('primary-key' = 'id', 'bucket' =
'1')""".stripMargin)
+ sql("INSERT INTO t VALUES (1, 10, 'old-1'), (2, NULL, 'old-2')")
+
+ spark
+ .sql("SELECT 1 AS id, 'new-1' AS v")
+ .createOrReplaceTempView("s")
+
+ sql("""MERGE INTO t
+ | USING s
+ | ON t.id = s.id AND t.b IS NOT NULL
+ | WHEN MATCHED THEN UPDATE SET v = s.v""".stripMargin)
+
+ checkAnswer(
+ sql("SELECT id, b, v FROM t ORDER BY id"),
+ Seq(Row(1, 10, "new-1"), Row(2, null, "old-2"))
+ )
+ }
+ }
+
test("basic merge: matched UPDATE *, not-matched INSERT *") {
withTable("t") {
sql("""CREATE TABLE t (id INT, name STRING)