Replacing tables in SparkSQL when using PARQUET

I’m quite new to Spark and I’m trying to use PARQUET to create a table to resolve an issue with a spark runtime – the error message says the following:

The depth of view 'foobar' exceeds the maximum view resolution depth (100).

Essentially, according to this answer, I can apply using PARQUET to resolve the issue however I want to replace existing tables if cases where tables currently exist.

The following logic does not appear to work for some reason as the function is only supported using v2 tables however I’m unsure how to alter a table to v2 which I am currently creating or replacing. I’m aware I can alter existing tables to v2 though using TBLPROPERTIES.

CREATE OR REPLACE TABLE `TABLE_NAME` USING PARQUET AS
SELECT ...

results in the following error message

REPLACE TABLE AS SELECT is only supported with v2 tables

Is there another method to replace the table or even adjust a table that has not been created to allow me to replace the table?

Leave a Comment