Skip to content

Commit 9dfa00f

Browse files
committed
Updated all pyarrow.Table.to_pandas() calls to reduce memory consumption
This was done using the split_blocks and self_destruct parameters in tandem.
1 parent 72351e6 commit 9dfa00f

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

apis/python/src/tiledbvcf/dataset.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ def read_variant_stats(
387387
"regions": regions,
388388
"scan_all_samples": scan_all_samples,
389389
}
390-
return self.read_variant_stats_arrow(**kwargs).to_pandas()
390+
return self.read_variant_stats_arrow(**kwargs).to_pandas(
391+
split_blocks=True, self_destruct=True
392+
)
391393

392394
def read_variant_stats_arrow(
393395
self,
@@ -474,7 +476,9 @@ def read_allele_count(
474476
if self.mode != "r":
475477
raise Exception("Dataset not open in read mode")
476478

477-
return self.read_allele_count_arrow(regions=regions).to_pandas()
479+
return self.read_allele_count_arrow(regions=regions).to_pandas(
480+
split_blocks=True, self_destruct=True
481+
)
478482

479483
def read_allele_count_arrow(
480484
self,
@@ -732,7 +736,7 @@ def continue_read(self, release_buffers: bool = True) -> pd.DataFrame:
732736
"""
733737
table = self.continue_read_arrow(release_buffers=release_buffers)
734738

735-
return table.to_pandas()
739+
return table.to_pandas(split_blocks=True, self_destruct=True)
736740

737741
def continue_read_arrow(self, release_buffers: bool = True) -> pa.Table:
738742
"""

apis/python/src/tiledbvcf/sample_qc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ def sample_qc(
2626
pandas.DataFrame
2727
"""
2828

29-
return clib.sample_qc(dataset_uri, samples=samples, config=config).to_pandas()
29+
return clib.sample_qc(dataset_uri, samples=samples, config=config).to_pandas(
30+
split_blocks=True, self_destruct=True
31+
)

0 commit comments

Comments
 (0)