kbendick commented on issue #2041:
URL: https://github.com/apache/iceberg/issues/2041#issuecomment-762044087
If `target` is registered in the catalog, fields that need reordering can be
determined via a `DESCRIBE` command or via
`spark.catalog.listColumns(tableName).select("name").as[String].collect()`
We do this occasionally at my work. I can try and take a look to see if
there's a cleaner approach that we might use.
```scala
val targetColumns = spark.sql("DESCRIBE EXTENDED
target").select("col_name").as[String].collect()
spark.sql(s"insert into target select ${targetColumns.mkString(", ")} from
input")
```
----------------------------------------------------------------
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]