jzhuge commented on code in PR #35636: URL: https://github.com/apache/spark/pull/35636#discussion_r843244976
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/NoSuchItemException.scala: ########## @@ -37,8 +37,12 @@ case class NoSuchNamespaceException( override val cause: Option[Throwable] = None) extends AnalysisException(message, cause = cause) { + def this(namespace: Array[String], cause: Option[Throwable]) = { + this(s"Namespace '${namespace.quoted}' not found", cause = cause) + } + def this(namespace: Array[String]) = { - this(s"Namespace '${namespace.quoted}' not found") + this(namespace, cause = None) Review Comment: Actually, this is necessary for Java code to call `new NoSuchNamespaceException(namespace)` without a cause. The following constructor (default value `None` to `cause`) will not work for Java: ``` def this(namespace: Array[String], cause: Option[Throwable] = None) ``` How about having these 2 constructors? ``` def this(namespace: Array[String], cause: Throwable) def this(namespace: Array[String]) ``` -- 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