Looks like hive replace columns is not working with spark 2.2.1 and also with 2.3.1
alterSchemaSql : alter table myschema.mytable replace columns (a int,b int,d int)
Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException:
Operation not allowed: alter table replace columns(line 2, pos 6)
Looks like it's been fixed for ADD COLUMNS 2.2 version onwards. It also works for me but replace columns still fails.
Operation not allowed: alter table add columns(line 1, pos 0)
Following docs says it should be supported. Not sure why it's failing for me. https://spark.apache.org/docs/2.2.0/sql-programming-guide.html#supported-hive-features
Sadly, it seems
ALTER TABLE table REPLACEis not implemented by Spark.Take a look at
SparkSqlParser.scala: SparkSqlParser.scalaThere, you can see, what SQL statements work with Spark.