I am getting an unexpected error when inserting data into an Apache Iceberg stored in AWS Glue. The following queries demonstrate the problem:
-- Create Apache Iceberg Table
create table test1 (col_varchar varchar, col_float float);
-- The following query fails with: Unable to complete query, attempting to union two datasets that have different underlying schemas. Left: schema(EXPR$0::varchar, EXPR$1::decimal(2,1)), Right: schema(EXPR$0::int32, EXPR$1::decimal(2,1))
insert into test1 (col_varchar, col_float) values ('foo', 1.1), (null, 2.2);
-- This query succeeds
insert into test1 (col_varchar, col_float) values ('foo', 1.1), (cast(null as varchar), 2.2);
-- This query also succeeds
insert into test1 (col_varchar, col_float) values ('foo', cast(1.1 as float)), (null, cast(2.2 as float));