Skip to content

De couple use_dask from CSV parser and make it a property of parallelizer #233

Open

Description

@gsaluja9
No description provided.

Activity

  1. self-assigned this
    on May 7, 2026
  2. ad-claw000 commented on May 26, 2026

    @ad-claw000
    Contributor

    This issue requests removing the use_dask parameter from CSVParser and its subclasses, moving it instead to be a property of Parallelizer (and by extension ParallelQuery, ParallelLoader, etc.) to better separate data parsing from execution orchestration.

    Here are a few possible approaches to implement this:

    1. Always load via Pandas in CSVParser; convert to Dask in Parallelizer

      • Pros: Completely strips all Dask imports and logic out of CSVParser, simplifying the class.
      • Cons: Forces the entire dataset into memory via a Pandas DataFrame before Parallelizer converts it using dd.from_pandas(). We lose Dask's lazy out-of-core file loading benefits.
    2. Move Dask file-loading logic directly into DaskManager

      • Pros: Maintains out-of-core memory efficiency. DaskManager.run can check if generator has a .filename attribute and use dask.dataframe.read_csv to lazily chunk the file, falling back to dd.from_pandas(generator.df) for non-file generators.
      • Cons: Slightly couples DaskManager to the knowledge that file-based generators use CSV format, though DaskManager already heavily relies on slicing and re-instantiating generator.__class__.
    3. Extract data loading into a DataLoader interface

      • Pros: Cleanest architectural separation. Generators implement a get_df(dask=False) or similar method, allowing Parallelizer to dictate how data should be supplied.
      • Cons: A larger refactor that might introduce more abstractions than strictly necessary to fix this issue.

    Recommendation:
    I recommend Approach 2. We can move the existing dask.dataframe.read_csv blocksize calculation from aperturedb/CSVParser.py directly into aperturedb/DaskManager.py. Parallelizer (in aperturedb/Parallelizer.py) will gain a use_dask property, initialized to False. ParallelQuery will set this property and delegate to DaskManager, which will handle chunking the file intelligently. This achieves the requested decoupling without losing performance.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions