This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 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 34500618a8 [spark] Resolve function after all args have been resolved
(#6292)
34500618a8 is described below
commit 34500618a8c15e9cd7ef86ff51421cf311a2605a
Author: Zouxxyy <[email protected]>
AuthorDate: Mon Sep 22 10:01:05 2025 +0800
[spark] Resolve function after all args have been resolved (#6292)
---
.../catalyst/analysis/PaimonFunctionResolver.scala | 2 +-
.../paimon/spark/sql/PaimonV1FunctionTestBase.scala | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git
a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/PaimonFunctionResolver.scala
b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/PaimonFunctionResolver.scala
index 507cbf79de..3fb76fa521 100644
---
a/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/PaimonFunctionResolver.scala
+++
b/paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/PaimonFunctionResolver.scala
@@ -34,7 +34,7 @@ case class PaimonFunctionResolver(spark: SparkSession)
extends Rule[LogicalPlan]
plan.resolveOperatorsUpWithPruning(_.containsAnyPattern(UNRESOLVED_FUNCTION)) {
case l: LogicalPlan =>
l.transformExpressionsWithPruning(_.containsAnyPattern(UNRESOLVED_FUNCTION)) {
- case u: UnResolvedPaimonV1Function =>
+ case u: UnResolvedPaimonV1Function if u.arguments.forall(_.resolved)
=>
u.funcIdent.catalog match {
case Some(catalog) =>
catalogManager.catalog(catalog) match {
diff --git
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonV1FunctionTestBase.scala
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonV1FunctionTestBase.scala
index 61fe87758d..743b36f8dd 100644
---
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonV1FunctionTestBase.scala
+++
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PaimonV1FunctionTestBase.scala
@@ -214,6 +214,23 @@ abstract class PaimonV1FunctionTestBase extends
PaimonSparkTestWithRestCatalogBa
}
}
}
+
+ test("Paimon V1 Function: select with view") {
+ withUserDefinedFunction("udf_add2" -> false) {
+ sql(s"""
+ |CREATE FUNCTION udf_add2 AS '$UDFExampleAdd2Class'
+ |USING JAR '$testUDFJarPath'
+ |""".stripMargin)
+ withTable("t") {
+ withView("v") {
+ sql("CREATE TABLE t (a INT, b INT)")
+ sql("INSERT INTO t VALUES (1, 2), (3, 4)")
+ sql("CREATE VIEW v AS SELECT udf_add2(a, b) AS c1 FROM t")
+ checkAnswer(sql("SELECT * FROM v"), Seq(Row(3), Row(7)))
+ }
+ }
+ }
+ }
}
class DisablePaimonV1FunctionTest extends PaimonSparkTestWithRestCatalogBase {