{"record":{"id":"5bd79e7386535639","repo":"pola-rs/polars","slug":"avro-maps-are-mapped-to-maparrays","errorCode":null,"errorMessage":"Avro maps are mapped to MapArrays","messagePattern":"Avro maps are mapped to MapArrays","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/io/avro/read/schema.rs","lineNumber":96,"sourceCode":"            None => ArrowDataType::Int64,\n        },\n        AvroSchema::Float => ArrowDataType::Float32,\n        AvroSchema::Double => ArrowDataType::Float64,\n        AvroSchema::Bytes(logical) => match logical {\n            Some(logical) => match logical {\n                avro_schema::schema::BytesLogical::Decimal(precision, scale) => {\n                    ArrowDataType::Decimal(*precision, *scale)\n                },\n            },\n            None => ArrowDataType::Binary,\n        },\n        AvroSchema::String(_) => ArrowDataType::Utf8,\n        AvroSchema::Array(item_schema) => ArrowDataType::List(Box::new(schema_to_field(\n            item_schema,\n            Some(\"item\"), // default name for list items\n            Metadata::default(),\n        )?)),\n        AvroSchema::Map(_) => todo!(\"Avro maps are mapped to MapArrays\"),\n        AvroSchema::Union(schemas) => {\n            // If there are only two variants and one of them is null, set the other type as the field data type\n            let has_nullable = schemas.iter().any(|x| x == &AvroSchema::Null);\n            if has_nullable && schemas.len() == 2 {\n                nullable = true;\n                if let Some(schema) = schemas\n                    .iter()\n                    .find(|&schema| !matches!(schema, AvroSchema::Null))\n                {\n                    schema_to_field(schema, None, Metadata::default())?.dtype\n                } else {\n                    polars_bail!(nyi = \"Can't read avro union {schema:?}\");\n                }\n            } else {\n                let fields = schemas\n                    .iter()\n                    .map(|s| schema_to_field(s, None, Metadata::default()))\n                    .collect::<PolarsResult<Vec<Field>>>()?;","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-arrow/src/io/avro/read/schema.rs#L78-L114","documentation":"At this point in Avro-to-Arrow schema conversion, a map type is translated into an Arrow MapArray. The error fires when the conversion of an Avro map's value schema returns None or an unexpected variant, breaking the assumption that maps always map to MapArrays.","triggerScenarios":"Thrown at crates/polars-arrow/src/io/avro/read/schema.rs:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Avro schema of the map's values and ensure it is a supported primitive or nested type","Add an explicit match arm for the unsupported Avro value type instead of relying on a fallthrough","Upgrade polars/avro-schema so newer Avro logical types are converted correctly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}