# Guidelines
To throw a standardized user-facing error or exception, developers should specify the error class
and message parameters rather than an arbitrary error message.
## Usage
1. Check if an appropriate error class already exists in `error-class.json`.
If true, skip to step 3. Otherwise, continue to step 2.
2. Add a new class to `error-class.json`; keep in mind the invariants below.
3. Check if the exception type already extends `SparkThrowable`.
If true, skip to step 5. Otherwise, continue to step 4.
4. Mix `SparkThrowable` into the exception.
5. Throw the exception with the error class and message parameters.
### Before
Throw with arbitrary error message:
throw new TestException("Problem A because B")
### After
`error-class.json`
"PROBLEM_BECAUSE": {
"message": ["Problem %s because %s"],
"sqlState": "XXXXX"
}
`SparkException.scala`
class SparkTestException(
errorClass: String,
messageParameters: Seq[String])
extends TestException(SparkThrowableHelper.getMessage(errorClass, messageParameters))
with SparkThrowable {
def getErrorClass: String = errorClass
def getMessageParameters: Array[String] = messageParameters
def getSqlState: String = SparkThrowableHelper.getSqlState(errorClass)
}
Throw with error class and message parameters:
throw new SparkTestException("PROBLEM_BECAUSE", Seq("A", "B"))
## Access fields
To access error fields, catch exceptions that extend `org.apache.spark.SparkThrowable` and access
- Error class with `getErrorClass`
- SQLSTATE with `getSqlState`
try {
...
} catch {
case e: SparkThrowable if Option(e.getSqlState).forall(_.startsWith("42")) =>
warn("Syntax error")
}
## Fields
### Error class
Error classes are a succinct, human-readable representation of the error category.
#### Invariants
- Unique
- Consistent across releases
- Sorted alphabetically
### Message
Error messages provide a descriptive, human-readable representation of the error.
The message format accepts string parameters via the C-style printf syntax.
The quality of the error message should match the
[guidelines](https://spark.apache.org/error-message-guidelines.html).
#### Invariants
- Unique
### SQLSTATE
SQLSTATE is an optional portable error identifier across SQL engines.
For consistency, Spark only sets SQLSTATE as defined in the ANSI/ISO standard.
SQLSTATE comprises a 2-character class value followed by a 3-character subclass value.
Spark only uses the standard-defined classes and subclasses, and does not use implementation-defined classes or subclasses.
#### Invariants
- Consistent across releases
#### ANSI/ISO standard
The following SQLSTATEs are from ISO/IEC CD 9075-2.
|SQLSTATE|Class|Condition |Subclass|Subcondition |
|--------|-----|------------------------------------------------------------|--------|---------------------------------------------------------------|
|07000 |07 |dynamic SQL error |000 |(no subclass) |
|07001 |07 |dynamic SQL error |001 |using clause does not match dynamic parameter specifications |
|07002 |07 |dynamic SQL error |002 |using clause does not match target specifications |
|07003 |07 |dynamic SQL error |003 |cursor specification cannot be executed |
|07004 |07 |dynamic SQL error |004 |using clause required for dynamic parameters |
|07005 |07 |dynamic SQL error |005 |prepared statement not a cursor specification |
|07006 |07 |dynamic SQL error |006 |restricted data type attribute violation |
|07007 |07 |dynamic SQL error |007 |using clause required for result fields |
|07008 |07 |dynamic SQL error |008 |invalid descriptor count |
|07009 |07 |dynamic SQL error |009 |invalid descriptor index |
|0700B |07 |dynamic SQL error |00B |data type transform function violation |
|0700C |07 |dynamic SQL error |00C |undefined DATA value |
|0700D |07 |dynamic SQL error |00D |invalid DATA target |
|0700E |07 |dynamic SQL error |00E |invalid LEVEL value |
|0700F |07 |dynamic SQL error |00F |invalid DATETIME_INTERVAL_CODE |
|08000 |08 |connection exception |000 |(no subclass) |
|08001 |08 |connection exception |001 |SQL-client unable to establish SQL-connection |
|08002 |08 |connection exception |002 |connection name in use |
|08003 |08 |connection exception |003 |connection does not exist |
|08004 |08 |connection exception |004 |SQL-server rejected establishment of SQL-connection |
|08006 |08 |connection exception |006 |connection failure |
|08007 |08 |connection exception |007 |transaction resolution unknown |
|09000 |09 |triggered action exception |000 |(no subclass) |
|0A000 |0A |feature not supported |000 |(no subclass) |
|0A001 |0A |feature not supported |001 |multiple server transactions |
|0D000 |0D |invalid target type specification |000 |(no subclass) |
|0E000 |0E |invalid schema name list specification |000 |(no subclass) |
|0F000 |0F |locator exception |000 |(no subclass) |
|0F001 |0F |locator exception |001 |invalid specification |
|0L000 |0L |invalid grantor |000 |(no subclass) |
|0M000 |0M |invalid SQL-invoked procedure reference |000 |(no subclass) |
|0P000 |0P |invalid role specification |000 |(no subclass) |
|0S000 |0S |invalid transform group name specification
没有合适的资源?快使用搜索试试~ 我知道了~
spark 3.2.1 源码下载
需积分: 10 3 下载量 97 浏览量
2022-04-02
23:20:57
上传
评论
收藏 27MB TGZ 举报
温馨提示
共2000个文件
scala:4054个
q:1561个
java:1008个
spark-3.2.1-source code
资源详情
资源评论
资源推荐
收起资源包目录
spark 3.2.1 源码下载 (2000个子文件)
string_hash_code.c 1KB
bootstrap.min.css 156KB
bootstrap.min.css 156KB
vis-timeline-graph2d.min.css 15KB
jquery.dataTables.1.10.20.min.css 14KB
webui.css 8KB
main.css 7KB
timeline-view.css 5KB
dataTables.bootstrap4.1.10.20.min.css 5KB
pygments-default.css 4KB
spark-dag-viz.css 3KB
pyspark.css 2KB
webui-dataTables.css 2KB
jsonFormatter.min.css 2KB
spark-sql-viz.css 2KB
api-javadocs.css 1KB
streaming-page.css 1KB
api-docs.css 1KB
docsearch.css 833B
global.html 13KB
executorspage-template.html 8KB
stagespage-template.html 5KB
404.html 4KB
historypage-template.html 3KB
nav-left.html 509B
nav-left-wrapper-ml.html 328B
nav-left-wrapper-migration.html 208B
nav-left-wrapper-sql.html 207B
RemoteBlockPushResolverSuite.java 68KB
JavaAPISuite.java 65KB
RemoteBlockPushResolver.java 62KB
JavaAPISuite.java 56KB
JavaDatasetSuite.java 54KB
UTF8String.java 48KB
UTF8StringSuite.java 38KB
ParquetVectorUpdaterFactory.java 37KB
Complex.java 36KB
TimSort.java 35KB
BytesToBytesMap.java 33KB
Java8APISuite.java 33KB
HiveSessionImpl.java 31KB
UnsafeExternalSorter.java 28KB
AbstractBytesToBytesMapSuite.java 27KB
UnsafeShuffleWriterSuite.java 27KB
ThriftCLIService.java 26KB
ExternalBlockHandler.java 25KB
WritableColumnVector.java 25KB
CLIService.java 23KB
UnsafeShuffleWriter.java 22KB
UnsafeRow.java 22KB
UnsafeExternalSorterSuite.java 21KB
ThriftHttpServlet.java 21KB
YarnShuffleService.java 21KB
ExternalBlockHandlerSuite.java 20KB
TaskMemoryManager.java 20KB
TableChange.java 20KB
SparkSubmitCommandBuilder.java 19KB
AvroOptionalPrimitives.java 19KB
ThriftCLIServiceClient.java 19KB
JavaDataFrameSuite.java 19KB
UnsafeArrayData.java 19KB
ShuffleExternalSorter.java 19KB
JavaBeanDeserializationSuite.java 18KB
ExternalShuffleBlockResolver.java 18KB
TransportConf.java 18KB
HiveAuthFactory.java 18KB
LevelDBTypeInfo.java 17KB
JavaSQLDataSourceExample.java 17KB
AvroPrimitives.java 17KB
OffHeapColumnVector.java 17KB
SQLOperation.java 17KB
GangliaReporter.java 17KB
RpcIntegrationSuite.java 16KB
OnHeapColumnVector.java 16KB
InMemoryStore.java 16KB
SparkSaslSuite.java 16KB
VectorizedRleValuesReader.java 16KB
SparkLauncher.java 16KB
SparkSubmitCommandBuilderSuite.java 16KB
JavaStructuredComplexSessionization.java 16KB
DBIteratorSuite.java 16KB
ArrowColumnVector.java 15KB
RowBasedKeyValueBatchSuite.java 15KB
OneForOneBlockFetcher.java 14KB
OneForOneBlockFetcherSuite.java 14KB
TransportClient.java 14KB
RecordBinaryComparatorSuite.java 14KB
ExternalShuffleIntegrationSuite.java 14KB
UnsafeInMemorySorter.java 14KB
TransportClientFactory.java 14KB
LevelDB.java 13KB
SessionManager.java 13KB
LauncherServer.java 13KB
VectorizedColumnReader.java 13KB
JavaUtils.java 13KB
ReadAheadInputStream.java 13KB
TransportRequestHandler.java 13KB
ExternalBlockStoreClient.java 13KB
VectorizedParquetRecordReader.java 12KB
Platform.java 12KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
多栖艺人
- 粉丝: 1
- 资源: 26
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0