Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-35057][SQL] Group exception messages in hive/thriftserver
### What changes were proposed in this pull request? This PR group exception messages in `sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver`. ### Why are the changes needed? It will largely help with standardization of error messages and its maintenance. ### Does this PR introduce _any_ user-facing change? No. Error messages remain unchanged. ### How was this patch tested? No new tests - pass all original tests to make sure it doesn't break any existing behavior. Closes #32646 from beliefer/SPARK-35057. Authored-by: gengjiaan <gengjiaan@360.cn> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
Showing
8 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...server/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServerErrors.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.sql.hive.thriftserver | ||
|
||
import java.io.IOException | ||
import java.util.concurrent.RejectedExecutionException | ||
|
||
import org.apache.hive.service.ServiceException | ||
import org.apache.hive.service.cli.{HiveSQLException, OperationType} | ||
|
||
/** | ||
* Object for grouping error messages from (most) exceptions thrown during | ||
* hive execution with thrift server. | ||
*/ | ||
object HiveThriftServerErrors { | ||
|
||
def taskExecutionRejectedError(rejected: RejectedExecutionException): Throwable = { | ||
new HiveSQLException("The background threadpool cannot accept" + | ||
" new task for execution, please retry the operation", rejected) | ||
} | ||
|
||
def runningQueryError(e: Throwable): Throwable = { | ||
new HiveSQLException(s"Error running query: ${e.toString}", e) | ||
} | ||
|
||
def hiveOperatingError(operationType: OperationType, e: Throwable): Throwable = { | ||
new HiveSQLException(s"Error operating $operationType ${e.getMessage}", e) | ||
} | ||
|
||
def failedToOpenNewSessionError(e: Throwable): Throwable = { | ||
new HiveSQLException(s"Failed to open new session: $e", e) | ||
} | ||
|
||
def cannotLoginToKerberosError(e: Throwable): Throwable = { | ||
new ServiceException("Unable to login to kerberos with given principal/keytab", e) | ||
} | ||
|
||
def cannotLoginToSpnegoError( | ||
principal: String, keyTabFile: String, e: IOException): Throwable = { | ||
new ServiceException("Unable to login to spnego with given principal " + | ||
s"$principal and keytab $keyTabFile: $e", e) | ||
} | ||
|
||
def failedToStartServiceError(serviceName: String, e: Throwable): Throwable = { | ||
new ServiceException(s"Failed to Start $serviceName", e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters