[KYUUBI #728] Support SQL State: 0A000 - feature_not_supported

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/NetEase/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
Follow #670 to:
Apply errorCode 0A000: feature_not_supported to val errStatus = KyuubiSQLException("Feature is not  available").toTStatus

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request

Closes #729 from zhaomin1423/728.

Closes #728

396e70d8 [Min Zhao] update FrontendServiceSuite to adapt KyuubiSQLException.featureNotSupported
c06dbfd2 [Min Zhao] invoke KyuubiSQLException.featureNotSupported() in FrontendService
281aed97 [Min Zhao] add featureNotSupported to KyuubiSQLException object

Authored-by: Min Zhao <zhaomin1423@163.com>
Signed-off-by: ulysses-you <ulyssesyou18@gmail.com>
This commit is contained in:
Min Zhao 2021-07-05 13:25:10 +08:00 committed by ulysses-you
parent 58f9d36873
commit ce3147fad8
3 changed files with 10 additions and 6 deletions

View File

@ -81,6 +81,10 @@ object KyuubiSQLException {
}
}
def featureNotSupported(): KyuubiSQLException = {
KyuubiSQLException("feature not supported", sqlState = "0A000")
}
def toTStatus(e: Exception, verbose: Boolean = false): TStatus = e match {
case k: KyuubiSQLException => k.toTStatus
case _ =>

View File

@ -389,7 +389,7 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
override def GetPrimaryKeys(req: TGetPrimaryKeysReq): TGetPrimaryKeysResp = {
debug(req.toString)
val resp = new TGetPrimaryKeysResp
val errStatus = KyuubiSQLException("Feature is not available").toTStatus
val errStatus = KyuubiSQLException.featureNotSupported().toTStatus
resp.setStatus(errStatus)
resp
}
@ -397,7 +397,7 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
override def GetCrossReference(req: TGetCrossReferenceReq): TGetCrossReferenceResp = {
debug(req.toString)
val resp = new TGetCrossReferenceResp
val errStatus = KyuubiSQLException("Feature is not available").toTStatus
val errStatus = KyuubiSQLException.featureNotSupported().toTStatus
resp.setStatus(errStatus)
resp
}

View File

@ -326,8 +326,8 @@ class FrontendServiceSuite extends KyuubiFunSuite {
val resp = client.GetPrimaryKeys(req)
assert(resp.getOperationHandle === null)
assert(resp.getStatus.getStatusCode === TStatusCode.ERROR_STATUS)
assert(resp.getStatus.getSqlState === null)
assert(resp.getStatus.getErrorMessage startsWith "Feature is not available")
assert(resp.getStatus.getSqlState === "0A000")
assert(resp.getStatus.getErrorMessage startsWith "feature not supported")
}
}
@ -338,8 +338,8 @@ class FrontendServiceSuite extends KyuubiFunSuite {
val resp = client.GetCrossReference(req)
assert(resp.getOperationHandle === null)
assert(resp.getStatus.getStatusCode === TStatusCode.ERROR_STATUS)
assert(resp.getStatus.getSqlState === null)
assert(resp.getStatus.getErrorMessage startsWith "Feature is not available")
assert(resp.getStatus.getSqlState === "0A000")
assert(resp.getStatus.getErrorMessage startsWith "feature not supported")
}
}