You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2024/02/28 19:09:59 UTC
Re: [PR] [SPARK-47169][SQL] Disable bucketing on collated columns [WIP] [spark]
MaxGekk commented on code in PR #45260:
URL: https://github.com/apache/spark/pull/45260#discussion_r1506454082
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1863,6 +1863,12 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat
"normalizedPartCols" -> normalizedPartCols.mkString(", ")))
}
+ def invalidBucketColumnDataTypeError(dataType: String): Throwable = {
+ new AnalysisException(
+ errorClass = "INVALID_BUCKET_COLUMN_DATA_TYPE",
+ messageParameters = Map("type" -> dataType))
Review Comment:
Please, wrap `dataType` by `toSQLType`. It converts any data type to string in unified way across all errors.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala:
##########
@@ -359,6 +359,13 @@ case class PreprocessTableCreation(catalog: SessionCatalog) extends Rule[Logical
case other => failAnalysis(s"Cannot use ${other.catalogString} for sorting column")
}
+ schema.filter(f => normalizedBucketSpec.bucketColumnNames.contains(f.name))
+ .foreach { field =>
+ if (!BucketingUtils.canBucketOn(field.dataType)) {
+ throw QueryCompilationErrors.invalidBucketColumnDataTypeError(field.dataType.toString)
Review Comment:
Just pass `field.dataType`
##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1752,6 +1752,12 @@
},
"sqlState" : "22003"
},
+ "INVALID_BUCKET_COLUMN_DATA_TYPE" : {
+ "message" : [
+ "Cannot use <type> for bucket column."
Review Comment:
Could you help users, and explain why it cannot (or which types can be used) otherwise not clear how users should deal with the error.
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org