{"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/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-json/src/json/deserialize.rs#L421-L457","documentation":"The polars-json deserializer refuses ArrowDataType::Interval(IntervalUnit::DayTime): there is no natural JSON text representation for a days+milliseconds interval, so schema-driven JSON/NDJSON parsing panics with unimplemented!().","triggerScenarios":"Reading JSON/NDJSON with an explicit schema that contains an Interval(DayTime) dtype: pl.read_ndjson(..., schema={\"iv\": pl.Interval}) mapping to the DayTime arrow unit, or the Rust polars-json deserialize() with that dtype.","commonSituations":"Schemas imported from Arrow/Parquet metadata (where DayTime intervals exist) and reused verbatim for JSON ingestion; interop pipelines that assume interval parity across formats.","solutions":["Remove the interval field from the JSON schema, or type it as Duration or String instead","Convert the DayTime intervals to month-day-nanosecond intervals or ISO-8601 duration strings on the producing side, then parse","Read the field as a struct {days, milliseconds} and reconstruct the interval afterwards"],"exampleFix":"# before\npl.read_ndjson(\"x.ndjson\", schema={\"iv\": pl.Interval(\"day_time\")})  # panics\n\n# after\npl.read_ndjson(\"x.ndjson\", schema={\"iv\": pl.String})  # parse, then convert","handlingStrategy":"validation","validationCode":"schema = {k: v for k, v in schema.items() if not (isinstance(v, pl.Interval))}","typeGuard":"def json_safe_schema(schema: dict) -> bool:\n    return not any(isinstance(dt, pl.Interval) for dt in schema.values())","tryCatchPattern":null,"preventionTips":["Never reuse Arrow/Parquet schemas verbatim for JSON readers; strip interval fields","Model intervals as Duration or ISO-8601 strings for JSON interchange"],"tags":["rust","polars","panic","unimplemented","json","ndjson","interval","schema"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}