dtenedor commented on code in PR #60535:
URL: https://github.com/apache/spark/pull/60535#discussion_r4606268855


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala:
##########
@@ -307,16 +308,20 @@ case class PreprocessTableCreation(catalog: 
SessionCatalog) extends Rule[Logical
       case _ => cls
     }
 
-  // FILE is not comparable, so it cannot be a partition, bucket or clustering 
column. A
-  // bucket column is reported as a partition column, as for the V2 `bucket` 
transform.
+  // FILE is not comparable, so it cannot be a partition, bucket, bucket sort 
or clustering column.
   private def checkNoFileTypePartitionOrClusteringColumn(

Review Comment:
   [nit] The helper now also rejects bucket and bucket sort columns, so the 
name `checkNoFileTypePartitionOrClusteringColumn` undersells it. Something like 
`checkNoFileTypeInComparableColumns` would match the comment above it.



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -3227,19 +3227,19 @@
   },
   "FILE_TYPE_IN_ROUTINE_SIGNATURE_UNSUPPORTED_MAP_KEY" : {
     "message" : [
-      "The FILE type cannot be a map key in the return type of <routineType> 
<routineName>. Use FILE only as a map value, array element, or struct field."
+      "The FILE type cannot be a map key in the return type of <routineName>. 
Use FILE only as a map value, array element, or struct field."
     ],
     "sqlState" : "42601"
   },
   "FILE_TYPE_IN_ROUTINE_SIGNATURE_UNSUPPORTED_QUALIFIER" : {
     "message" : [
-      "The FILE type in <routineType> <routineName> does not support the 
EXTERNAL qualifier. Use FILE without a qualifier."
+      "The FILE type in the signature of <routineName> does not support the 
EXTERNAL qualifier. Use FILE without a qualifier."
     ],
     "sqlState" : "42601"
   },
   "FILE_TYPE_MISSING_QUALIFIER" : {
     "message" : [
-      "FILE type requires the EXTERNAL qualifier in a column definition. Use 
FILE EXTERNAL."
+      "The column <colName> of type <dataType> holds a FILE without a 
qualifier, which a column definition requires. Use FILE EXTERNAL."

Review Comment:
   [low] "which a column definition requires" can attach to "a FILE without a 
qualifier". Read that way, the message says a column definition requires an 
unqualified FILE, the opposite of what it means. Naming the qualifier keeps it 
clear, for example:
   
   ```suggestion
         "The column <colName> of type <dataType> holds a FILE without a 
qualifier. A FILE in a column definition requires the EXTERNAL qualifier. Use 
FILE EXTERNAL."
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSchemaEvolution.scala:
##########
@@ -52,7 +52,7 @@ object ResolveSchemaEvolution extends Rule[LogicalPlan] {
         case relation @ ExtractV2CatalogAndIdentifier(catalog, ident) =>
           // A table cannot store a FILE without a qualifier, so schema 
evolution cannot add one.
           // This is checked before the catalog changes the table.
-          
TypeUtils.checkNoUnknownFileTypeInColumns(write.pendingSchemaChanges.collect {
+          
TypeUtils.checkNoUnknownFileTypeWrite(write.pendingSchemaChanges.collect {

Review Comment:
   [low] The PR description lists two changed outputs that no test checks: 
schema evolution that adds a new struct column holding a FILE now reports 
`[`s2`.`f`]` instead of `[`s2`]`, and CREATE TABLE LIKE from a view with a FILE 
inside a struct now reports the field path. The existing schema evolution case 
only adds a field to an existing struct, and the CREATE TABLE LIKE cases only 
use a top-level `f`. They share the helper that the CTAS cases test, so the 
risk is small. Still, one case each in `FileTypeRestrictionsSuite` (for example 
`INSERT WITH SCHEMA EVOLUTION INTO testcat.t SELECT 1 AS id, named_struct('a', 
1) AS s, named_struct('f', CAST(NULL AS FILE)) AS s2`, and `CREATE TABLE t LIKE 
v` where `v` has `named_struct('f', CAST(NULL AS FILE)) AS s`) would pin the 
documented messages.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to