You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
De couple use_dask from CSV parser and make it a property of parallelizer #233
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:
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.
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__.
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.
Activity
ad-claw000 commentedon May 26, 2026
This issue requests removing the
use_daskparameter fromCSVParserand its subclasses, moving it instead to be a property ofParallelizer(and by extensionParallelQuery,ParallelLoader, etc.) to better separate data parsing from execution orchestration.Here are a few possible approaches to implement this:
Always load via Pandas in CSVParser; convert to Dask in Parallelizer
CSVParser, simplifying the class.Parallelizerconverts it usingdd.from_pandas(). We lose Dask's lazy out-of-core file loading benefits.Move Dask file-loading logic directly into
DaskManagerDaskManager.runcan check ifgeneratorhas a.filenameattribute and usedask.dataframe.read_csvto lazily chunk the file, falling back todd.from_pandas(generator.df)for non-file generators.DaskManagerto the knowledge that file-based generators use CSV format, thoughDaskManageralready heavily relies on slicing and re-instantiatinggenerator.__class__.Extract data loading into a
DataLoaderinterfaceget_df(dask=False)or similar method, allowingParallelizerto dictate how data should be supplied.Recommendation:
I recommend Approach 2. We can move the existing
dask.dataframe.read_csvblocksize calculation fromaperturedb/CSVParser.pydirectly intoaperturedb/DaskManager.py.Parallelizer(inaperturedb/Parallelizer.py) will gain ause_daskproperty, initialized toFalse.ParallelQuerywill set this property and delegate toDaskManager, which will handle chunking the file intelligently. This achieves the requested decoupling without losing performance.