beliefer commented on a change in pull request #31757:
URL: https://github.com/apache/spark/pull/31757#discussion_r590966655
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala
##########
@@ -754,4 +756,335 @@ private[spark] object QueryCompilationErrors {
new AnalysisException(s"Invalid partitionExprs specified: $sortOrders For
range " +
"partitioning use REPARTITION_BY_RANGE instead.")
}
+
+ def partitionColumnNotSpecifiedError(format: String, partitionColumn:
String): Throwable = {
+ new AnalysisException(s"Failed to resolve the schema for $format for " +
+ s"the partition column: $partitionColumn. It must be specified
manually.")
+ }
+
+ def dataSchemaNotSpecifiedError(format: String): Throwable = {
+ new AnalysisException(s"Unable to infer schema for $format. It must be
specified manually.")
+ }
+
+ def dataPathNotExistError(path: String): Throwable = {
+ new AnalysisException(s"Path does not exist: $path")
+ }
+
+ def outputModeUnsupportedByDataSourceError(
+ className: String, outputMode: OutputMode): Throwable = {
+ new AnalysisException(s"Data source $className does not support
$outputMode output mode")
+ }
+
+ def notSpecifySchemaForSchemaRelationProviderError(className: String):
Throwable = {
+ new AnalysisException(s"A schema needs to be specified when using
$className.")
+ }
+
+ def userSpecifiedSchemaMismatchActualSchemaError(
+ schema: StructType, actualSchema: StructType): Throwable = {
+ new AnalysisException(
+ s"""
+ |The user-specified schema doesn't match the actual schema:
+ |user-specified: ${schema.toDDL}, actual: ${actualSchema.toDDL}. If
you're using
+ |DataFrameReader.schema API or creating a table, please do not
specify the schema.
+ |Or if you're scanning an existed table, please drop it and re-create
it.
+ """.stripMargin)
+ }
+
+ def dataSchemaNotSpecifiedError(format: String, fileCatalog: String):
Throwable = {
+ new AnalysisException(
+ s"Unable to infer schema for $format at $fileCatalog. It must be
specified manually")
+ }
+
+ def invalidDataSourceError(className: String): Throwable = {
+ new AnalysisException(s"$className is not a valid Spark SQL Data Source.")
+ }
+
+ def cannotSaveIntervalIntoExternalStorageError(): Throwable = {
+ new AnalysisException("Cannot save interval data type into external
storage.")
+ }
+
+ def unableResolveAttributeError(name: String, data: LogicalPlan): Throwable
= {
+ new AnalysisException(
+ s"Unable to resolve $name given [${data.output.map(_.name).mkString(",
")}]")
+ }
+
+ def orcNotUsedWithHiveEnabledError(): Throwable = {
+ new AnalysisException(
+ s"""
+ |Hive built-in ORC data source must be used with Hive support enabled.
+ |Please use the native ORC data source by setting
'spark.sql.orc.impl' to 'native'
+ """.stripMargin)
+ }
+
+ def failedFindAvroDataSourceError(provider: String): Throwable = {
+ new AnalysisException(
+ s"""
+ |Failed to find data source: $provider. Avro is built-in but external
data
+ |source module since Spark 2.4. Please deploy the application as per
+ |the deployment section of "Apache Avro Data Source Guide".
+ """.stripMargin.replaceAll("\n", " "))
+ }
+
+ def failedFindKafkaDataSourceError(provider: String): Throwable = {
+ new AnalysisException(
+ s"""
+ |Failed to find data source: $provider. Please deploy the application
as
+ |per the deployment section of "Structured Streaming + Kafka
Integration Guide".
+ """.stripMargin.replaceAll("\n", " "))
+ }
+
+ def findMultipleDataSourceError(provider: String, sourceNames: Seq[String]):
Throwable = {
+ new AnalysisException(
+ s"""
+ |Multiple sources found for $provider (${sourceNames.mkString(", ")}),
+ | please specify the fully qualified class name.
+ """.stripMargin)
+ }
+
+ def writeEmptySchemasUnsupportedByDataSourceError(): Throwable = {
+ new AnalysisException(
+ s"""
+ |Datasource does not support writing empty or nested empty schemas.
+ |Please make sure the data schema has at least one or more column(s).
+ """.stripMargin)
+ }
+
+ def insertMisMatchedColumnNumberError(
+ targetAttributes: Seq[Attribute],
+ sourceAttributes: Seq[Attribute],
+ staticPartitionsSize: Int): Throwable = {
+ new AnalysisException(
+ s"""
+ |The data to be inserted needs to have the same number of columns as
the
+ |target table: target table has ${targetAttributes.size} column(s)
but the
+ |inserted data has ${sourceAttributes.size + staticPartitionsSize}
column(s),
+ |which contain $staticPartitionsSize partition column(s) having
assigned
+ |constant values.
+ """.stripMargin)
+ }
+
+ def insertMisMatchedPartitionNumberError(
+ targetPartitionSchema: StructType,
+ providedPartitionsSize: Int): Throwable = {
+ new AnalysisException(
+ s"""
+ |The data to be inserted needs to have the same number of partition
columns
+ |as the target table: target table has
${targetPartitionSchema.fields.size}
+ |partition column(s) but the inserted data has $providedPartitionsSize
+ |partition columns specified.
+ """.stripMargin.replaceAll("\n", " "))
+ }
+
+ def invalidPartitionColumnError(
+ partKey: String, targetPartitionSchema: StructType): Throwable = {
+ new AnalysisException(
+ s"""
+ |$partKey is not a partition column. Partition columns are
+ |${targetPartitionSchema.fields.map(_.name).mkString("[", ",", "]")}
+ """.stripMargin)
+ }
+
+ def specifyMultipleValuesForPartitionColumnError(
+ field: StructField, potentialSpecs: Map[String, String]): Throwable = {
+ new AnalysisException(
+ s"""
+ |Partition column ${field.name} have multiple values specified,
+ |${potentialSpecs.mkString("[", ", ", "]")}. Please only specify a
single value.
+ """.stripMargin)
+ }
+
+ def invalidPartitionColumnHavingConstantValueError(
+ targetPartitionSchema: StructType): Throwable = {
+ new AnalysisException(
+ s"""
+ |The ordering of partition columns is
+ |${targetPartitionSchema.fields.map(_.name).mkString("[", ",", "]")}
+ |All partition columns having constant values need to appear before
other
+ |partition columns that do not have an assigned constant value.
+ """.stripMargin)
+ }
+
+ def cannotWriteDataToRelationWithSinglePathError(): Throwable = {
Review comment:
I doubt this change. It seems we should preserve it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]