{"record":{"id":"456cdc89c12f729b","repo":"pola-rs/polars","slug":"there-is-no-natural-representation-of-daytime-in-j","errorCode":null,"errorMessage":"There is no natural representation of DayTime in JSON.","messagePattern":"There is no natural representation of DayTime in JSON\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-json/src/json/deserialize.rs","lineNumber":439,"sourceCode":"                check_err_idx(rows, err_idx, \"null\")?;\n            }\n\n            Ok(Box::new(NullArray::new(dtype, rows.len())))\n        },\n        ArrowDataType::Boolean => {\n            fill_generic_array_from::<_, _, BooleanArray>(deserialize_boolean_into, rows)\n        },\n        ArrowDataType::Int8 => {\n            fill_array_from::<_, _, PrimitiveArray<i8>>(deserialize_primitive_into, dtype, rows)\n        },\n        ArrowDataType::Int16 => {\n            fill_array_from::<_, _, PrimitiveArray<i16>>(deserialize_primitive_into, dtype, rows)\n        },\n        ArrowDataType::Int32 | ArrowDataType::Interval(IntervalUnit::YearMonth) => {\n            fill_array_from::<_, _, PrimitiveArray<i32>>(deserialize_primitive_into, dtype, rows)\n        },\n        ArrowDataType::Interval(IntervalUnit::DayTime) => {\n            unimplemented!(\"There is no natural representation of DayTime in JSON.\")\n        },\n        ArrowDataType::Int64 | ArrowDataType::Duration(_) => {\n            fill_array_from::<_, _, PrimitiveArray<i64>>(deserialize_primitive_into, dtype, rows)\n        },\n        ArrowDataType::Date32 => {\n            deserialize_temporal_primitive::<i32, _>(rows, dtype, \"date\", utf8_to_naive_date_scalar)\n        },\n        ArrowDataType::Date64 => {\n            deserialize_temporal_primitive::<i64, _>(rows, dtype, \"date\", |s| {\n                utf8_to_naive_date_scalar(s)\n                    .map(|d| d as i64 * temporal_conversions::MILLISECONDS_IN_DAY)\n            })\n        },\n        ArrowDataType::Time32(tu) => {\n            let tu = *tu;\n            deserialize_temporal_primitive::<i32, _>(rows, dtype, \"time\", |s| {\n                utf8_to_naive_time_scalar(s, tu).and_then(|v| i32::try_from(v).ok())\n            })","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-json/src/json/deserialize.rs#L421-L457","documentation":"The JSON row deserializer has no mapping for Arrow's Interval(DayTime) dtype, so _deserialize calls unimplemented! with this message. DayTime interval values (a day/millisecond pair) have no natural JSON representation, and the library refuses to guess an encoding.","triggerScenarios":"Calling deserialize / deserialize_list / deserialize_struct with an ArrowDataType::Interval(IntervalUnit::DayTime) schema field, e.g. converting a record batch containing a DayTime interval column to/from JSON rows.","commonSituations":"Round-tripping Arrow/Polars data containing duration or interval columns through JSON lines; pipelines where a schema inference step produced DayTime intervals from source data (e.g. pandas date offsets).","solutions":["Change the schema to avoid DayTime intervals: cast the column to Duration (e.g. Duration(Milliseconds)) or i64 before JSON serialization.","Convert the interval into two integer columns (days and millis) in the pre-JSON schema.","Use Arrow IPC/Feather instead of JSON for such columns.","If the dtype arrives from inference, force the expected schema at read time."],"exampleFix":"// before\nlet batch = batch_with_interval_column(); // Interval(DayTime)\n// after\nlet batch = batch.cast_columns(&[(\"col\", DataType::Duration(TimeUnit::Milliseconds))])?;","handlingStrategy":"validation","validationCode":"fn has_day_time(schema: &ArrowSchema) -> bool {\n    schema.fields.iter().any(|f| f.dtype() == &ArrowDataType::Interval(arrow::datatypes::IntervalUnit::DayTime))\n}\nassert!(!has_day_time(&schema), \"cast Interval(DayTime) to Duration/i64 before JSON\");","typeGuard":null,"tryCatchPattern":"if has_day_time(&schema) {\n    let schema = cast_day_time_columns(&schema, ArrowDataType::Duration(TimeUnit::Milliseconds));\n}\nlet array = deserialize(&json, schema.clone(), false)?;","preventionTips":["Avoid Interval(DayTime) columns in schemas destined for JSON conversion; prefer Duration","Pin the schema explicitly instead of relying on inference when sources emit intervals","Test round-trips of interval/duration data through your serialization format early"],"tags":["json","arrow","dtype","unsupported"],"backgroundTag":"unsupported-dtype","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"}