Skip to content

Chunked conversion silently no-ops on an unrecognized output format #11

Description

@vgreg

Part of #5.

_handle_chunked_conversion dispatches on the output format with an if/elif and no else (src/daflip/services.py:274-282). When the format matches neither csv nor parquet, the loop drains the entire input reader, writes nothing, creates no file, and returns normally. The CLI then prints "Conversion successful! Output written to " for a file that does not exist.

Reproducer:

daflip convert big.sas7bdat out.parquet.partial --input-chunk-size 1000000

infer_format takes only the final extension (src/daflip/utils.py:35), so this infers the output format as partial. On a 3.8 GB SAS file the command spends 29 seconds reading all 45M rows, discards every chunk, and reports success.

Writing to a temporary name and renaming on completion is a normal way to avoid leaving truncated output behind, which is how I hit this. But the same thing happens for any typo (out.parqet) or unsupported target.

The non-chunked path does not have this problem: _write_dataframe ends in else: raise ValueError(f"Unsupported output format: {output_format}") (services.py:503-504).

Fix: add the matching else: raise ValueError(...) to _handle_chunked_conversion. Better still, validate the output format up front in convert_data so both paths reject it before any input is read, rather than after a full pass over the file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions