the8thC commented on code in PR #40236: URL: https://github.com/apache/spark/pull/40236#discussion_r1125670340
########## sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala: ########## @@ -765,6 +770,58 @@ class QueryExecutionErrorsSuite ) } } + + test("INTERNAL_ERROR: Calling eval on Unevaluable expression") { + val e = intercept[SparkException] { + Parameter("foo").eval() + } + checkError( + exception = e, + errorClass = "INTERNAL_ERROR", + parameters = Map("message" -> "Cannot evaluate expression: parameter(foo)"), + sqlState = "XX000") + } + + test("INTERNAL_ERROR: Calling doGenCode on unresolved") { + val e = intercept[SparkException] { + val ctx = new CodegenContext + Grouping(Parameter("foo")).genCode(ctx) + } + checkError( + exception = e, + errorClass = "INTERNAL_ERROR", + parameters = Map( + "message" -> ("Cannot generate code for expression: " + + "grouping(parameter(foo))")), + sqlState = "XX000") + } + + test("INTERNAL_ERROR: Calling terminate on UnresolvedGenerator") { + val e = intercept[SparkException] { + UnresolvedGenerator(FunctionIdentifier("foo"), Seq.empty).terminate() + } + checkError( + exception = e, + errorClass = "INTERNAL_ERROR", + parameters = Map("message" -> "Cannot terminate expression: 'foo()"), + sqlState = "XX000") + } + + test("INTERNAL_ERROR: Initializing JavaBean with non existing method") { + val e = intercept[SparkException] { + val initializeWithNonexistingMethod = InitializeJavaBean( + Literal.fromObject(new java.util.LinkedList[Int]), + Map("nonexistent" -> Literal(1))) + initializeWithNonexistingMethod.eval() + } + checkError( + exception = e, + errorClass = "INTERNAL_ERROR", + parameters = Map( + "message" -> ("""A method named "nonexistent" is not declared in """ + + "any enclosing class nor any supertype")), + sqlState = "XX000") Review Comment: @itholic Yes, thank you. I actually noticed that there's already a test present for this error in RateStreamProviderSuite.scala: https://github.com/apache/spark/blob/edafe266144c5c70852491fef9bb6907a001b286/sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/sources/RateStreamProviderSuite.scala#L217-L237 I'm not sure if it makes sense to move it or do anything more at all with this error, what do you think? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org