beliefer commented on a change in pull request #30717:
URL: https://github.com/apache/spark/pull/30717#discussion_r540765114



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryCompilationErrors.scala
##########
@@ -326,4 +340,170 @@ object QueryCompilationErrors {
       "of rows, therefore they are currently not supported.", t.origin.line, 
t.origin.startPosition)
   }
 
+  def viewOutputNumberMismatchQueryColumnNamesError(
+      output: Seq[Attribute], queryColumnNames: Seq[String]): Throwable = {
+    new AnalysisException(
+      s"The view output ${output.mkString("[", ",", "]")} doesn't have the 
same" +
+        "number of columns with the query column names " +
+        s"${queryColumnNames.mkString("[", ",", "]")}")
+  }
+
+  def attributeNotFoundError(colName: String, child: LogicalPlan): Throwable = 
{
+    new AnalysisException(
+      s"Attribute with name '$colName' is not found in " +
+        s"'${child.output.map(_.name).mkString("(", ",", ")")}'")
+  }
+
+  def cannotUpCastAsAttributeTruncateError(
+      originAttr: Attribute, catalogString: String): Throwable = {
+    new AnalysisException(s"Cannot up cast ${originAttr.sql} from " +
+      s"${originAttr.dataType.catalogString} to $catalogString as it may 
truncate\n")
+  }
+
+  def functionUndefinedError(name: FunctionIdentifier): Throwable = {
+    new AnalysisException(s"undefined function $name")
+  }
+
+  def invalidFunctionArgumentsError(
+      validParametersCount: Seq[Int], name: String, params: 
Seq[Class[Expression]]): Throwable = {
+    val invalidArgumentsMsg = if (validParametersCount.length == 0) {
+      s"Invalid arguments for function $name"
+    } else {
+      val expectedNumberOfParameters = if (validParametersCount.length == 1) {
+        validParametersCount.head.toString
+      } else {
+        validParametersCount.init.mkString("one of ", ", ", " and ") +
+          validParametersCount.last
+      }
+      s"Invalid number of arguments for function $name. " +
+        s"Expected: $expectedNumberOfParameters; Found: ${params.length}"
+    }
+    new AnalysisException(invalidArgumentsMsg)
+  }
+
+  def functionAcceptsOnlyOneArgumentError(name: String): Throwable = {
+    new AnalysisException(s"Function $name accepts only one argument")
+  }
+
+  def alterV2TableSetLocationWithPartitionNotSupportedError(): Throwable = {
+    new AnalysisException("ALTER TABLE SET LOCATION does not support partition 
for v2 tables.")
+  }
+
+  def joinStrategyHintParameterNotExpectedError(unsupported: Any): Throwable = 
{
+    new AnalysisException("Join strategy hint parameter " +
+      s"should be an identifier or string but was $unsupported 
(${unsupported.getClass}")
+  }
+
+  def hintParameterNotIncludeColumnsError(
+      hintName: String, invalidParams: Seq[Any]): Throwable = {
+    new AnalysisException(s"$hintName Hint parameter should include columns, 
but " +
+      s"${invalidParams.mkString(", ")} found")
+  }
+
+  def hintParameterNotExpectedError(hintName: String): Throwable = {
+    new AnalysisException(s"$hintName Hint expects a partition number as a 
parameter")
+  }
+
+  def attributeNameSyntaxError(name: String): Throwable = {
+    new AnalysisException(s"syntax error in attribute name: $name")
+  }
+
+  def onlyStarExpandStructDataTypesError(target: Option[Seq[String]]): 
Throwable = {
+    new AnalysisException("Can only star expand struct data types. Attribute: 
`" +
+      target.get + "`")

Review comment:
       OK




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to