{"record":{"id":"ee43767fd42ef160","repo":"pola-rs/polars","slug":"not-implemented-ee4376","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/datatypes/mod.rs","lineNumber":351,"sourceCode":"\n    // The datatype underlying this (possibly logical) arrow data type.\n    pub fn underlying_physical_type(&self) -> ArrowDataType {\n        use ArrowDataType::*;\n        match self {\n            Null | Boolean | Int8 | Int16 | Int32 | Int64 | Int128 | UInt8 | UInt16 | UInt32\n            | UInt64 | UInt128 | Float16 | Float32 | Float64 | Binary | LargeBinary | Utf8\n            | LargeUtf8 | BinaryView | Utf8View | FixedSizeBinary(_) | Unknown => self.clone(),\n\n            Decimal32(_, _) | Date32 | Time32(_) | Interval(IntervalUnit::YearMonth) => Int32,\n            Decimal64(_, _)\n            | Date64\n            | Timestamp(_, _)\n            | Time64(_)\n            | Duration(_)\n            | Interval(IntervalUnit::DayTime) => Int64,\n            Interval(IntervalUnit::MonthDayNano | IntervalUnit::MonthDayMillis) => unimplemented!(),\n            Decimal(_, _) => Int128,\n            Decimal256(_, _) => unimplemented!(),\n            List(field) => List(Box::new(\n                field.with_dtype(field.dtype.underlying_physical_type()),\n            )),\n            LargeList(field) => LargeList(Box::new(\n                field.with_dtype(field.dtype.underlying_physical_type()),\n            )),\n            FixedSizeList(field, width) => FixedSizeList(\n                Box::new(field.with_dtype(field.dtype.underlying_physical_type())),\n                *width,\n            ),\n            Struct(fields) => Struct(\n                fields\n                    .iter()\n                    .map(|field| field.with_dtype(field.dtype.underlying_physical_type()))\n                    .collect(),\n            ),\n            Dictionary(keys, _, _) => (*keys).into(),\n            Union(_) => unimplemented!(),","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-arrow/src/datatypes/mod.rs#L333-L369","documentation":"`ArrowDataType::underlying_physical_type()` (crates/polars-arrow/src/datatypes/mod.rs) maps logical types to their physical representation. The `Decimal256(_, _)` arm on line 351 is `unimplemented!()` because polars-arrow has no 256-bit NativeType, and the sibling `Interval(MonthDayNano | MonthDayMillis)` arm is likewise unimplemented. Asking for the physical layout of these types panics with 'not implemented'.","triggerScenarios":"Calling `dtype.underlying_physical_type()` (directly or via `to_physical_type()` consumers such as serialization, kernels, and FFI dispatch) on a `Decimal256` dtype or an `Interval` with MonthDayNano/MonthDayMillis unit. These dtypes typically arrive by importing Arrow IPC/FFI schemas from implementations that do support them (pyarrow, arrow-rs).","commonSituations":"Cross-implementation interop: reading files containing decimal(38+, s) or month-day-nano interval columns produced by pyarrow/arrow-rs, then running any polars operation that needs the physical type. Polars supports Decimal128 (`Decimal(_, _) => Int128`) but not Decimal256, and only YearMonth/DayTime intervals.","solutions":["Convert Decimal256 columns to Decimal128 (or float/string) at the source before interop with polars.","Reject or drop such columns at schema-inspection time when reading foreign Arrow data.","Guard: check `!matches!(dtype, Decimal256(_, _) | Interval(IntervalUnit::MonthDayNano | IntervalUnit::MonthDayMillis))` before touching physical layout.","Track polars' support status — if a later release adds these arms, upgrade."],"exampleFix":"// before\nlet phys = dtype.underlying_physical_type(); // panics for Decimal256 / MonthDayNano\n\n// after\nuse polars_arrow::datatypes::{ArrowDataType, IntervalUnit};\nfn has_physical(dtype: &ArrowDataType) -> bool {\n    !matches!(\n        dtype,\n        ArrowDataType::Decimal256(_, _)\n            | ArrowDataType::Interval(IntervalUnit::MonthDayNano | IntervalUnit::MonthDayMillis)\n    )\n}\nassert!(has_physical(dtype), \"unsupported physical layout for {dtype:?}\");","handlingStrategy":"type-guard","validationCode":"use polars_arrow::datatypes::{ArrowDataType, IntervalUnit};\nfn assert_physical_resolvable(dtype: &ArrowDataType) -> polars_error::PolarsResult<()> {\n    if matches!(dtype, ArrowDataType::Decimal256(_, _) | ArrowDataType::Interval(IntervalUnit::MonthDayNano | IntervalUnit::MonthDayMillis)) {\n        polars_bail!(InvalidOperation: \"no physical type for {dtype:?}\");\n    }\n    Ok(())\n}","typeGuard":"fn has_physical_type(dtype: &ArrowDataType) -> bool {\n    use ArrowDataType::*;\n    !matches!(\n        dtype,\n        Decimal256(_, _) | Union(_) | Map(_, _)\n            | Interval(IntervalUnit::MonthDayNano | IntervalUnit::MonthDayMillis)\n    )\n}","tryCatchPattern":"let phys = std::panic::catch_unwind(|| dtype.underlying_physical_type())\n    .map_err(|_| polars_err!(InvalidOperation: \"physical type unimplemented for {dtype:?}\"))?;","preventionTips":["Convert decimal(38+) to decimal(<=38) or float at the producing system before interop with polars.","Whitelist dtypes when reading foreign Arrow schemas and reject Decimal256/interval variants early.","Remember Union and Map also panic in this function."],"tags":["rust","polars","arrow","decimal256","interval","physical-type","unimplemented","panic"],"backgroundTag":"arrow-unsupported-type-mapping","analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}