Unexpected behavior when execute CREATE OR REPLACE AS SELECT with REST Catalog #12738
Open
1 of 3 tasks
Labels
bug
Something isn't working
Apache Iceberg version
1.7.2
Query engine
Spark
Please describe the bug 🐞
Describe bug
When I try this command
CREATE OR REPLACE TABLE AS SELECT
, it works well for several cases including:However, there's one case I've tested that was unsuccessful: attempting to replace a table with a transform partitiontion to non-partitioned.
Step reproduce
Firstly, I created an empty non-partitioned table using the CREATE TABLE command, followed by inserting test data. Next, I created another partitioned table with a different structure using the same command as in the first step.
Then, I tried to replace the existing partitioned table using the CREATE OR REPLACE TABLE AS SELECT command along with my non-partitioned table. My expectation was that the table would be completely replaced, including both the schema and data, with the non-partitioned table successfully. However, it didn't work and raised
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 24.0 failed 1 times, most recent failure: Lost task 0.0 in stage 24.0 (TID 50) (10.16.14.4 executor driver): org.apache.iceberg.exceptions.ValidationException: Cannot find source column for partition field: 1000: id_bucket: bucket[16](1)
Okay, I tried one more time. Before replacing the table, I dropped all partition columns using ALTER TABLE DROP PARTITION FIELD. However, it still resulted in the same errors. I don't understand why it is still checking for partition fields when I had already dropped them before replacing the table.(I've already checked metadata file, and there's no partition spec now as I dropped before)
My code: Spark + Rest Catalog(catalog_name = 'lakekeeper')
Expected Behavior
Table will be replaced entirely with both schema and data.
Environment
Apache Iceberg Version: 1.7.2
Execution Engines Tested: Spark 3.5.2
Catalog Type: REST catalog
Storage: S3-compatible
Willingness to contribute
The text was updated successfully, but these errors were encountered: