@@ -950,6 +950,30 @@ TEST(AvroSchemaProjectionTest, ProjectSchemaEvolutionIntToLong) {
950950 ASSERT_EQ (std::get<1 >(projection.fields [0 ].from ), 0 );
951951}
952952
953+ TEST (AvroSchemaProjectionTest, ProjectDateFromPlainInt) {
954+ Schema expected_schema ({
955+ SchemaField::MakeRequired (/* field_id=*/ 1 , " day" , iceberg::date ()),
956+ });
957+
958+ std::string avro_schema_json = R"( {
959+ "type": "record",
960+ "name": "iceberg_schema",
961+ "fields": [
962+ {"name": "day", "type": "int", "field-id": 1}
963+ ]
964+ })" ;
965+ auto avro_schema = ::avro::compileJsonSchemaFromString (avro_schema_json);
966+
967+ auto projection_result =
968+ Project (expected_schema, avro_schema.root (), /* prune_source=*/ false );
969+ ASSERT_THAT (projection_result, IsOk ());
970+
971+ const auto & projection = *projection_result;
972+ ASSERT_EQ (projection.fields .size (), 1 );
973+ ASSERT_EQ (projection.fields [0 ].kind , FieldProjection::Kind::kProjected );
974+ ASSERT_EQ (std::get<1 >(projection.fields [0 ].from ), 0 );
975+ }
976+
953977TEST (AvroSchemaProjectionTest, ProjectSchemaEvolutionFloatToDouble) {
954978 // Create iceberg schema expecting a double
955979 Schema expected_schema ({
0 commit comments