CREATE TABLE db_test.table_test (
name STRING,
status STRING,
field1 BIGINT,
field2 BIGINT,
data_dt STRING)
USING parquet
PARTITIONED BY (data_dt)
LOCATION 's3://somebucket/db_test.db/table_test';
如果我尝试删除field1和field2,
alter table db_test.table_test
drop columns(field1, field2)
到了错误
Error in query: DROP COLUMN is only supported with v2 tables.
彻底的表置列语句删除了现有表中提到的列。请注意,此语句仅由V2表支持。
yyes您需要将桌子从平坦的桌子转换为交易格式。SparkSQL指南也说了同样的话,但是尚不清楚如何创建V2表或将现有表转换为V2表。 即使是什么是V2表也不清楚。
ALTER TABLE db_test.table_test SET TBLPROPERTIES ('transactional'='true');
ALTER TABLE db_test.table_test DROP COLUMNS (field1, field2);
Source->
spark.sql(f"""
CREATE TABLE IF NOT EXISTS {CATALOG_NAME}.{DB_NAME}.{TABLE_NAME}_nopartitions (
c_customer_sk int,
c_customer_id string,
c_first_name string,
c_last_name string,
c_birth_country string,
c_email_address string)
USING iceberg
OPTIONS ('format-version'='2')
""")
从Herey