{"record":{"id":"a421d129b5acbc7a","repo":"pola-rs/polars","slug":"not-implemented-a421d1","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/ffi/schema.rs","lineNumber":495,"sourceCode":"        ArrowDataType::Date64 => \"tdm\".to_string(),\n        ArrowDataType::Time32(TimeUnit::Second) => \"tts\".to_string(),\n        ArrowDataType::Time32(TimeUnit::Millisecond) => \"ttm\".to_string(),\n        ArrowDataType::Time32(_) => {\n            unreachable!(\"Time32 is only supported for seconds and milliseconds\")\n        },\n        ArrowDataType::Time64(TimeUnit::Microsecond) => \"ttu\".to_string(),\n        ArrowDataType::Time64(TimeUnit::Nanosecond) => \"ttn\".to_string(),\n        ArrowDataType::Time64(_) => {\n            unreachable!(\"Time64 is only supported for micro and nanoseconds\")\n        },\n        ArrowDataType::Duration(TimeUnit::Second) => \"tDs\".to_string(),\n        ArrowDataType::Duration(TimeUnit::Millisecond) => \"tDm\".to_string(),\n        ArrowDataType::Duration(TimeUnit::Microsecond) => \"tDu\".to_string(),\n        ArrowDataType::Duration(TimeUnit::Nanosecond) => \"tDn\".to_string(),\n        ArrowDataType::Interval(IntervalUnit::YearMonth) => \"tiM\".to_string(),\n        ArrowDataType::Interval(IntervalUnit::DayTime) => \"tiD\".to_string(),\n        ArrowDataType::Interval(IntervalUnit::MonthDayNano) => \"tin\".to_string(),\n        ArrowDataType::Interval(IntervalUnit::MonthDayMillis) => unimplemented!(),\n        ArrowDataType::Timestamp(unit, tz) => {\n            let unit = match unit {\n                TimeUnit::Second => \"s\",\n                TimeUnit::Millisecond => \"m\",\n                TimeUnit::Microsecond => \"u\",\n                TimeUnit::Nanosecond => \"n\",\n            };\n            format!(\n                \"ts{}:{}\",\n                unit,\n                tz.as_ref().map(|x| x.as_str()).unwrap_or(\"\")\n            )\n        },\n        ArrowDataType::Utf8View => \"vu\".to_string(),\n        ArrowDataType::BinaryView => \"vz\".to_string(),\n        ArrowDataType::Decimal(precision, scale) => format!(\"d:{precision},{scale}\"),\n        ArrowDataType::Decimal32(precision, scale) => format!(\"d:{precision},{scale},32\"),\n        ArrowDataType::Decimal64(precision, scale) => format!(\"d:{precision},{scale},64\"),","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-arrow/src/ffi/schema.rs#L477-L513","documentation":"When a schema is exported over the Arrow C Data Interface, every field dtype is rendered as a C format string by to_format (crates/polars-arrow/src/ffi/schema.rs). The format grammar has codes tiM/tiD/tin for YearMonth/DayTime/MonthDayNano intervals but none for polars' extra MonthDayMillis unit, and that arm (line 495) is unimplemented!(). Exporting a schema containing Interval(MonthDayMillis) — e.g. polars-python handing a DataFrame to pyarrow — panics inside schema construction.","triggerScenarios":"ArrowSchema::new / to_ffi export of any field typed Interval(IntervalUnit::MonthDayMillis), typically during zero-copy C Data Interface transfer to pyarrow or another Arrow implementation.","commonSituations":"Round-tripping interval data produced by older polars versions or custom builders that chose MonthDayMillis; mixed-version clusters where one node emits the nonstandard unit.","solutions":["Cast the interval column to MonthDayNano (formats as 'tin') or Duration before crossing the FFI boundary","Standardize on MonthDayNano; never construct MonthDayMillis intervals","Walk the schema before export and reject unsupported intervals with an error naming the column","Upstream: return an error instead of panicking, or encode MonthDayMillis as 'tin' plus metadata"],"exampleFix":"// before\nlet (arrow_schema, arrays) = to_ffi(&schema, &mut arrays)?; // panics on Interval(MonthDayMillis)\n\n// after: normalize the unit before export\nlet df = df.with_column(col(\"iv\").cast(DataType::Interval(IntervalUnit::MonthDayNano)))?;\nlet (arrow_schema, arrays) = to_ffi(&schema, &mut arrays)?;","handlingStrategy":"type-guard","validationCode":"fn ffi_exportable(dtype: &ArrowDataType) -> bool {\n    !matches!(dtype, ArrowDataType::Interval(IntervalUnit::MonthDayMillis) | ArrowDataType::Unknown)\n}\nfor f in &schema.fields {\n    polars_ensure!(ffi_exportable(f.dtype()), InvalidOperation: \"column '{}' not exportable via C Data Interface\", f.name);\n}","typeGuard":"fn has_monthday_millis(dtype: &ArrowDataType) -> bool {\n    matches!(dtype, ArrowDataType::Interval(IntervalUnit::MonthDayMillis))\n}","tryCatchPattern":"let res = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| to_ffi(&schema, &mut arrays)));\nlet ffi = res.map_err(|_| polars_err!(ComputeError: \"FFI export panicked: unsupported dtype in schema\"))?;","preventionTips":["Normalize all interval units to MonthDayNano at system boundaries","Never construct MonthDayMillis intervals in your own code","Smoke-test the FFI export path with every dtype your schemas can contain"],"tags":["rust","polars-arrow","ffi","c-data-interface","interval","panic"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}