I want to add a column to a spark dataframe which has been registered as a table. This column needs to have an auto incrementing long.
df = spark.sql(query) df.createOrReplaceTempView("user_stories") df = spark.sql("ALTER TABLE user_stories ADD COLUMN rank int AUTO_INCREMENT") df.show(5) This throws the following error,
Py4JJavaError: An error occurred while calling o72.sql. : org.apache.spark.sql.catalyst.parser.ParseException: no viable alternative at input 'ALTER TABLE user_stories ADD COLUMN'(line 1, pos 29) == SQL == ALTER TABLE user_stories ADD COLUMN rank int AUTO_INCREMENT -----------------------------^^^ What am I missing here?