@@ -328,62 +328,3 @@ def test_ctas_aqe(spark_tmp_table_factory, partition_col_sql):
328328 table_prop ,
329329 partition_col_sql = partition_col_sql ,
330330 conf = conf )
331-
332-
333- @iceberg
334- @ignore_order (local = True )
335- @pytest .mark .skipif (is_iceberg_remote_catalog (), reason = "Skip for remote catalog to reduce test time" )
336- def test_ctas_from_table_after_drop_partition_field (spark_tmp_table_factory ):
337- """Test CTAS with partitioned target after source table drops a partition field (void transform).
338-
339- When a partition field is dropped, Iceberg creates a 'void transform' -
340- the field remains in the partition spec but no longer affects partitioning.
341- This test verifies CTAS still runs correctly on GPU after partition evolution.
342- """
343- base_table_name = get_full_table_name (spark_tmp_table_factory )
344- cpu_table_name = f"{ base_table_name } _cpu"
345- gpu_table_name = f"{ base_table_name } _gpu"
346-
347- table_prop = {"format-version" : "2" }
348- # Use two partition columns so after dropping one, we still have at least one
349- partition_col_sql = "bucket(8, _c2), bucket(8, _c3)"
350-
351- # Create partitioned tables with initial data
352- create_iceberg_table (cpu_table_name , partition_col_sql = partition_col_sql , table_prop = table_prop )
353- create_iceberg_table (gpu_table_name , partition_col_sql = partition_col_sql , table_prop = table_prop )
354-
355- # Insert initial data into tables before partition evolution
356- def insert_initial_data (spark , table_name ):
357- df = gen_df (spark , list (zip (iceberg_base_table_cols , iceberg_gens_list )), seed = 42 )
358- df .writeTo (table_name ).append ()
359-
360- with_cpu_session (lambda spark : insert_initial_data (spark , cpu_table_name ))
361- with_cpu_session (lambda spark : insert_initial_data (spark , gpu_table_name ))
362-
363- # Drop one partition field on both tables (creates void transform)
364- def drop_partition_field (spark , table_name ):
365- spark .sql (f"ALTER TABLE { table_name } DROP PARTITION FIELD bucket(8, _c2)" )
366-
367- with_cpu_session (lambda spark : drop_partition_field (spark , cpu_table_name ))
368- with_cpu_session (lambda spark : drop_partition_field (spark , gpu_table_name ))
369-
370- # CTAS after partition evolution - generate data inline with same seed
371- def execute_ctas (spark , target_table ):
372- df = gen_df (spark , list (zip (iceberg_base_table_cols , iceberg_gens_list )), seed = 43 )
373- view_name = spark_tmp_table_factory .get ()
374- df .createOrReplaceTempView (view_name )
375- spark .sql (f"DROP TABLE IF EXISTS { target_table } " )
376- props_sql = _props_to_sql (table_prop )
377- spark .sql (
378- f"CREATE TABLE { target_table } USING ICEBERG "
379- f"TBLPROPERTIES ({ props_sql } ) AS SELECT * FROM { view_name } " )
380-
381- with_gpu_session (lambda spark : execute_ctas (spark , gpu_table_name ),
382- conf = iceberg_write_enabled_conf )
383- with_cpu_session (lambda spark : execute_ctas (spark , cpu_table_name ),
384- conf = iceberg_write_enabled_conf )
385-
386- # Compare results
387- cpu_data = with_cpu_session (lambda spark : spark .table (cpu_table_name ).collect ())
388- gpu_data = with_cpu_session (lambda spark : spark .table (gpu_table_name ).collect ())
389- assert_equal_with_local_sort (cpu_data , gpu_data )
0 commit comments