Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7757371
Added time and memory check
alexglasertpx May 1, 2025
48e2b11
Added libraries required for testing
alexglasertpx May 1, 2025
fc94974
Added libraries required for testing
alexglasertpx May 1, 2025
7656cd2
Ran black
alexglasertpx May 1, 2025
05a1bad
Calling new table commands
alexglasertpx May 2, 2025
724389a
Edited logging message
alexglasertpx May 2, 2025
b6e9ad4
Bucketed window function
alexglasertpx May 2, 2025
7c1d37a
Ran black
alexglasertpx May 2, 2025
987ecd2
Tidy up of code
alexglasertpx May 2, 2025
285593b
Tidy up of code
alexglasertpx May 2, 2025
fdd293b
Using 'with' to ensure cleanup if any issues
alexglasertpx May 6, 2025
7ced24e
Added tests for new parquet functions
alexglasertpx May 6, 2025
77b80f8
Incorporating batching and bucketing into the calculation of facts, f…
alexglasertpx May 8, 2025
7393361
Removing temp_parquet tests as no longer using those functions
alexglasertpx May 8, 2025
422485e
Removing tempfile library
alexglasertpx May 8, 2025
572a2de
Corrected typo
alexglasertpx May 8, 2025
b784231
Edited comment
alexglasertpx May 8, 2025
137c9a2
Edited exit message
alexglasertpx May 8, 2025
a07b535
Check strategy before calling function
alexglasertpx May 9, 2025
58002c0
Added test for batch processing of parquet files
alexglasertpx May 9, 2025
635e5a5
Remove commented out test
alexglasertpx May 9, 2025
0fb9035
Removed old functions using a single temporary parquet file
alexglasertpx May 9, 2025
c669ba6
Removed comments
alexglasertpx May 9, 2025
4f4c910
Minor edit to comment
alexglasertpx May 9, 2025
8eea573
Edits to logger info
alexglasertpx May 12, 2025
f06d158
Edit to output_path
alexglasertpx May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions digital_land/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,19 @@ def dataset_create(
path=dataset_parquet_path,
specification_dir=None, # TBD: package should use this specification object
duckdb_path=cache_dir / "overflow.duckdb",
transformed_parquet_dir=transformed_parquet_dir,
)
# To find facts we have a complex SQL window function that can cause memory issues. To aid the allocation of memory
# we decide on a parquet strategy, based on how many parquet files we have, the overall size of these
# files and the available memory. We will look at the following strategies:
# 1) if we have a small number of files or the total size of the files is small then we can run the SQL over all of
# these files.
# 2) Grouping the parquet files into 256MB batches. Then running SQL either on all of these batches at once, or
# bucketing the data so that we run the window SQL function on a subset of facts (then concatenate them)

# Group parquet files into approx 256MB batches (if needed)
if pqpackage.strategy != "direct":
pqpackage.group_parquet_files(transformed_parquet_dir, target_mb=256)
pqpackage.load_facts(transformed_parquet_dir)
pqpackage.load_fact_resource(transformed_parquet_dir)
pqpackage.load_entities(transformed_parquet_dir, resource_path, organisation_path)
Expand Down
Loading