Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Insights on query execution error #392

Closed
noCharger opened this issue Jun 21, 2024 · 2 comments
Closed

[BUG] Insights on query execution error #392

noCharger opened this issue Jun 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@noCharger
Copy link
Collaborator

While the root cause of the exception is parsed and returned as part of the contract, the actual ex should be logged as well.

https://github.com/opensearch-project/opensearch-spark/blame/85fec7edbeef7d38de4bea9b824bfa41f10099fd/spark-sql-application/src/main/scala/org/apache/spark/sql/FlintJobExecutor.scala#L455C5-L455C17

  /**
   * This method converts query exception into error string, which then persist to query result
   * metadata
   */
  def processQueryException(ex: Exception): String = {
    getRootCause(ex) match {
      case r: ParseException =>
        handleQueryException(r, "Syntax error")
      case r: AmazonS3Exception =>
        incrementCounter(MetricConstants.S3_ERR_CNT_METRIC)
        handleQueryException(
          r,
          "Fail to read data from S3. Cause",
          Some(r.getServiceName),
          Some(r.getStatusCode))
      case r: AWSGlueException =>
        incrementCounter(MetricConstants.GLUE_ERR_CNT_METRIC)
        // Redact Access denied in AWS Glue service
        r match {
          case accessDenied: AccessDeniedException =>
            accessDenied.setErrorMessage(
              "Access denied in AWS Glue service. Please check permissions.")
          case _ => // No additional action for other types of AWSGlueException
        }
        handleQueryException(
          r,
          "Fail to read data from Glue. Cause",
          Some(r.getServiceName),
          Some(r.getStatusCode))
      case r: AnalysisException =>
        handleQueryException(r, "Fail to analyze query. Cause")
      case r: SparkException =>
        handleQueryException(r, "Spark exception. Cause")
      case r: Exception =>
        handleQueryException(r, "Fail to run query. Cause")
    }
  }
@noCharger noCharger added bug Something isn't working untriaged labels Jun 21, 2024
@penghuo penghuo removed the untriaged label Jun 21, 2024
@penghuo
Copy link
Collaborator

penghuo commented Jun 21, 2024

Does add log.error for all the Exception in processQueryException can solve this problem?

@noCharger
Copy link
Collaborator Author

Does add log.error for all the Exception in processQueryException can solve this problem

Yes this is the proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants