grundprinzip commented on code in PR #38270:
URL: https://github.com/apache/spark/pull/38270#discussion_r998350192
##########
connector/connect/src/test/scala/org/apache/spark/sql/connect/planner/SparkConnectProtoSuite.scala:
##########
@@ -50,6 +50,34 @@ class SparkConnectProtoSuite extends PlanTest with
SparkConnectPlanTest {
comparePlans(connectPlan.analyze, sparkPlan.analyze, false)
}
+ test("UnresolvedFunction resolution.") {
+ {
+ import org.apache.spark.sql.connect.dsl.expressions._
+ import org.apache.spark.sql.connect.dsl.plans._
+ assertThrows[IllegalArgumentException] {
+ transform(connectTestRelation.select(callFunction("default.hex",
Seq("id".protoAttr))))
+ }
+ }
+
+ val connectPlan = {
+ import org.apache.spark.sql.connect.dsl.expressions._
+ import org.apache.spark.sql.connect.dsl.plans._
+ transform(
+ connectTestRelation.select(callFunction(Seq("default", "hex"),
Seq("id".protoAttr))))
+ }
+
+ assertThrows[UnsupportedOperationException] {
+ connectPlan.analyze
+ }
+
+ val validPlan = {
+ import org.apache.spark.sql.connect.dsl.expressions._
+ import org.apache.spark.sql.connect.dsl.plans._
+ transform(connectTestRelation.select(callFunction(Seq("hex"),
Seq("id".protoAttr))))
+ }
+ assert(validPlan.analyze != null)
Review Comment:
This is not to validate that the catalyst plan exists, but really just that
existing functions are actually resolved. The `!=null` is mostly to have any
assertion and not throw.
--
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]