ottomata commented on PR #21012:
URL: https://github.com/apache/spark/pull/21012#issuecomment-1874135870

   Ah, sorry, my scala goggles weren't on quite right.  According to 
`verifyAlterTableAddColumn`, e.g. JsonDataSourceV2 is supported for ALTER TABLE 
ADD COLUMN.  We don't need to change that check at all.
   
   What we need to change is the check in ResolveCatalogSession that does
   ```scala
   throw QueryCompilationErrors.unsupportedTableOperationError(ident, "ADD 
COLUMN with qualified column")
   ```
   
   `if c.name.length > 1`.  
   However, if I remove that, I can see a problem in the way 
`AlterTableAddColumnsCommand` is implemented: it takes a `Seq[StructField]` as 
the list of columns to add.  This list is constructed by `convertToStructField` 
in ResolveSessionCatalog, which naively assumes that the col to add is not 
nested: 
   ```scala
       StructField(col.name.head, col.dataType, nullable = true, 
builder.build())
   ```
   Returns a StructField with the top level column name but the nested leaf 
column's DataType.
   
   
    


-- 
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