You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Max Gekk (Jira)" <ji...@apache.org> on 2022/03/31 18:05:00 UTC

[jira] [Updated] (SPARK-38737) Test the error classes: INVALID_FIELD_NAME

     [ https://issues.apache.org/jira/browse/SPARK-38737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Gekk updated SPARK-38737:
-----------------------------
    Description: 
Add tests for the error class *INVALID_FIELD_NAME* to QueryCompilationErrorsSuite. The test should cover the exception throw in QueryCompilationErrors:

{code:scala}
  def invalidFieldName(fieldName: Seq[String], path: Seq[String], context: Origin): Throwable = {
    new AnalysisException(
      errorClass = "INVALID_FIELD_NAME",
      messageParameters = Array(fieldName.quoted, path.quoted),
      origin = context)
  }
{code}

For example, here is a test for the error class *UNSUPPORTED_FEATURE*: https://github.com/apache/spark/blob/34e3029a43d2a8241f70f2343be8285cb7f231b9/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala#L151-L170

+The test must have a check of:+
# the entire error message
# sqlState if it is defined in the error-classes.json file
# the error class

  was:
Add tests for the error classes *INVALID_ARRAY_INDEX* to QueryExecutionErrorsSuite. The test should cover the exception throw in QueryExecutionErrors:

{code:scala}
  private def invalidArrayIndexErrorInternal(
      index: Int,
      numElements: Int,
      key: String): ArrayIndexOutOfBoundsException = {
    new SparkArrayIndexOutOfBoundsException(errorClass = "INVALID_ARRAY_INDEX",
      messageParameters = Array(index.toString, numElements.toString, key))
  }

  def invalidElementAtIndexError(
       index: Int,
       numElements: Int): ArrayIndexOutOfBoundsException = {
    new SparkArrayIndexOutOfBoundsException(errorClass = "INVALID_ARRAY_INDEX_IN_ELEMENT_AT",
      messageParameters = Array(index.toString, numElements.toString, SQLConf.ANSI_ENABLED.key))
  }
{code}

For example, here is a test for the error class *UNSUPPORTED_FEATURE*: https://github.com/apache/spark/blob/34e3029a43d2a8241f70f2343be8285cb7f231b9/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala#L151-L170

+The test must have a check of:+
# the entire error message
# sqlState if it is defined in the error-classes.json file
# the error class


> Test the error classes: INVALID_FIELD_NAME
> ------------------------------------------
>
>                 Key: SPARK-38737
>                 URL: https://issues.apache.org/jira/browse/SPARK-38737
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Max Gekk
>            Priority: Minor
>              Labels: starter
>
> Add tests for the error class *INVALID_FIELD_NAME* to QueryCompilationErrorsSuite. The test should cover the exception throw in QueryCompilationErrors:
> {code:scala}
>   def invalidFieldName(fieldName: Seq[String], path: Seq[String], context: Origin): Throwable = {
>     new AnalysisException(
>       errorClass = "INVALID_FIELD_NAME",
>       messageParameters = Array(fieldName.quoted, path.quoted),
>       origin = context)
>   }
> {code}
> For example, here is a test for the error class *UNSUPPORTED_FEATURE*: https://github.com/apache/spark/blob/34e3029a43d2a8241f70f2343be8285cb7f231b9/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala#L151-L170
> +The test must have a check of:+
> # the entire error message
> # sqlState if it is defined in the error-classes.json file
> # the error class



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org