{"record":{"id":"39a18e4dfae568f6","repo":"pola-rs/polars","slug":"unimplemented-mod","errorCode":null,"errorMessage":"unimplemented","messagePattern":"unimplemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-stream/src/nodes/io_sources/csv/mod.rs","lineNumber":190,"sourceCode":"            missing_columns_policy,\n            num_pipelines,\n            disable_morsel_split: _,\n            last_morsel_pipelines: _,\n            callbacks:\n                FileReaderCallbacks {\n                    file_schema_tx,\n                    n_rows_in_file_tx,\n                    row_position_on_end_tx,\n                },\n        } = args\n        else {\n            panic!(\"unsupported args: {:?}\", args)\n        };\n\n        assert!(row_index.is_none()); // Handled outside the reader for now.\n\n        match &pre_slice {\n            Some(Slice::Negative { .. }) => unimplemented!(),\n\n            // We don't account for comments when slicing lines. We should never hit this panic -\n            // the FileReaderBuilder does not indicate PRE_SLICE support when we have a comment\n            // prefix.\n            Some(pre_slice)\n                if self.options.parse_options.comment_prefix.is_some() && pre_slice.len() > 0 =>\n            {\n                panic!(\"{pre_slice:?}\")\n            },\n\n            _ => {},\n        }\n\n        // There are two byte sourcing strategies `ReaderSource`: (a) async parallel prefetch using a\n        // streaming pipeline, or (b) memory-mapped, only to be used for uncompressed local files.\n        // The `compressed_reader` (of type `ByteSourceReader`) abstracts these source types.\n        // The `use_async_prefetch` flag controls the optional pipeline startup behavior.\n        let use_async_prefetch =","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-stream/src/nodes/io_sources/csv/mod.rs#L172-L208","documentation":"The streaming CSV reader does not implement negative pre-slices (taking the last N rows of the file before reading). When begin_read receives args whose pre_slice is a negative Slice, it hits an explicit unimplemented!() panic. Positive/offset pre-slices are supported; negative ones are not.","triggerScenarios":"Running a streaming query whose scan requires reading only the tail of a CSV (a negative slice reaching the CSV source's begin_read), e.g. certain lazy tail/last-N optimizations over scan_csv in the new streaming engine.","commonSituations":"Lazy plans where Polars pushes down a negative slice optimization into the CSV scan; users combining tail(-n) style queries with the streaming engine.","solutions":["Disable the new streaming engine for this query (run with the in-memory/old engine or engine='in-memory') so negative slices are handled elsewhere.","Restructure the query to avoid tail-only CSV reads, e.g. read fully then .tail(n).","Upgrade Polars — this gap may be implemented in later versions.","File an issue with the query if it should be supported."],"exampleFix":"// before\nlet df = LazyCsvSource::new(path).finish().tail(100).collect_with_engine streaming\n// after\nlet df = lf.collect(engine = \"in-memory\")?.tail(100)","handlingStrategy":"fallback","validationCode":"# If your plan relies on tail-style reads, avoid pushing negative slices to streaming CSV scans:\nq = lf  # build without .tail(-n) style slice pushdown over streaming CSV","typeGuard":"def needs_full_read(slice: tuple | None) -> bool:\n    return slice is not None and slice[0] < 0","tryCatchPattern":"try:\n    df = lf.collect(engine=\"streaming\")\nexcept pl.exceptions.PolarsPanicError:\n    df = lf.collect(engine=\"in-memory\")  # negative slices handled here","preventionTips":["Use the in-memory engine for tail(-n) queries over CSV","Read fully and .tail(n) in Python instead of relying on slice pushdown","Check the streaming engine's supported slice kinds for your version","Keep polars updated — unimplemented paths shrink over releases"],"tags":["rust","panic","csv","unimplemented","streaming"],"backgroundTag":"method-not-implemented","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"}